Commit Graph
1545 Commits
Author SHA1 Message Date
g-butandClaude Sonnet 4.6 8475bbb4f3 feat(projects): next_step attribute — inline editor + card display
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 10:28:41 +02:00
g-butandClaude Sonnet 4.6 a0b85c2559 refactor(projects): SSOT health config, ui-tab classes, design token fixes
Merge three duplicated health-signal tables (ISSUE_DISPLAY, HEALTH_BADGE_STYLE,
HEALTH_BADGE_ICON) into a single HEALTH_SIGNAL_CONFIG in project-badges.tsx.
Extract ui-tab/ui-tab-active/ui-tab-badge classes to globals.css, replacing
inline conditional strings in ProjectDetailTabBar. Fix accent-[var()] violation
with ui-range-accent, bg-black/20 with bg-surface-overlay. Improve loading
state to distinguish initial vs. background refetch, better error message.
Fix Escape key to skip when drawer is open; truncate long status filter chips.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 09:37:19 +02:00
g-butandClaude Sonnet 4.6 3d4a1d00b1 perf(daemon): long-poll for commands, change-detection for state push
Command pickup latency: 5s → ~100ms. The API now holds requests for up to
25s (local) / 8s (remote Vercel) until a command arrives, eliminating the
sleep-then-poll cycle. The push loop skips the POST when state is unchanged
(md5 hash comparison), cutting idle DB writes from ~30/min to near zero.
After each command execution, a background push fires immediately so the UI
reflects results without waiting for the next push cycle.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 09:28:41 +02:00
g-butandClaude Sonnet 4.6 501444622e fix(control): truthful state labels and SSOT for card/tile badges
Four truth issues fixed:
- "Closing" state was missing from both ProjectCardHeader and ProjectTile —
  both fell through to "Ready" label + grey dot. Now shows "Closing" with
  amber warning dot/tag matching the card's warning border.
- isClosing was never passed to ProjectCardHeader so a Closing case could
  never fire even if added.
- "Open tabs" metric showed 0 when daemon was offline (zellijTabs is empty
  with no daemon push). Now shows "—" with "daemon offline" note.
- stateLabel + stateTagClass duplicated independently in ProjectCardHeader
  and ProjectTile. Moved to control-presenter.ts (SSOT, derived from tone).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 08:56:58 +02:00
g-butandClaude Sonnet 4.6 f2790f069d fix(mobile): prompt category chips scroll horizontally on mobile
8 category chips in flex-wrap stacked into 3+ rows on narrow screens.
Apply the same horizontal-scroll pattern used on Projects/Events/SummaryBar.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 08:44:41 +02:00
g-butandClaude Sonnet 4.6 a7bd065ea5 fix(mobile): project/event filter chips scroll horizontally on mobile
Long status chip labels (e.g. project maturity descriptions) no longer
wrap into multi-row stacks on narrow screens — single scrollable row with
hidden scrollbar, wraps back to grid on sm+.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 08:40:22 +02:00
g-butandClaude Sonnet 4.6 5865cfc132 fix(mobile): Today page UX — horizontal summary bar + 44px touch targets
- SummaryBar: scrolls horizontally on mobile (no-wrap + overflow-x-auto,
  hidden scrollbar) so all pills fit in one row instead of 3; wraps
  normally on sm+. Shorten "105 contacts need attention" → "105 contacts".
  Add min-h-11/shrink-0 to Pill links and Brief Ivy button.
- LogConversationButton, QuickCaptureButton, IvyDispatchButton (plan/wrap):
  add min-h-11 sm:min-h-0 so trigger buttons meet 44px touch target on mobile.
- ui-btn-row-action (CommitmentItem check/edit/delete): add
  min-h-11 min-w-11 sm:min-h-0 sm:min-w-0 for mobile touch targets.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 08:24:01 +02:00
g-butandClaude Sonnet 4.6 a0f25945e2 feat(responsive): mobile UX pass — control hierarchy, auth card, homepage spacing
Control page: metrics (Control Inventory) now appear first on mobile via CSS
order swap; BrainConfig hero moves below. Description text hidden on small
screens. Desktop two-column layout unchanged (xl:order-none reverts to
source order).

Auth: .ui-auth-card padding tightened to p-6 on mobile (was p-8 everywhere).

Homepage: hero/section spacing halved on mobile (pt-16, mt-16, pb-16) so
content fits without excessive blank space on 375px viewports.

MobileNav: close-sheet button increased from p-1.5 to p-3 (28px → 40px
touch target, approaching the 44px minimum).

.app-main bottom padding reduced pb-24→pb-20 to match actual nav height.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 08:06:03 +02:00
g-butandClaude Sonnet 4.6 ebffb35271 fix(shell): sidebar collapse toggle missing on md–xl screens
The footer expand button was only rendered when `collapsed=true`, leaving
no way to collapse an expanded sidebar on viewports between 768–1279px
(where the brand-header toggle is hidden by `xl:inline-flex`).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 07:46:14 +02:00
g-butandClaude Sonnet 4.6 4b40dbf5ef feat(shell): sticky sidebar, light/dark toggle, x.ai-style hover labels
- Remove forcedTheme="dark" — enable system preference + user toggle
- Sidebar is now position:sticky height:100svh, never scrolls away
- Collapsed nav items show portal tooltips (escape overflow clipping)
  using createPortal to document.body with slide-in animation
- Theme toggle in sidebar footer (sun/moon, persisted via next-themes)
- Footer utility buttons get hover tooltips when collapsed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 07:24:31 +02:00
g-butandClaude Sonnet 4.6 3c5c8cb346 fix(daemon): execute_inject now clears closing sentinel and cancels beacon on re-dispatch
Non-lifecycle cloud-queued injects had the same gap as the run route (fixed
in 0bc9cd8): stale closing sentinel persisted, keeping UI in "Closing…" state.
Also cancels any open web-beacon popup for the tab (mirrors cancelActiveBeaconSessions)
so the React beacon client self-closes when a new task is injected remotely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 04:57:00 +02:00
g-butandClaude Sonnet 4.6 0bc9cd8893 fix(orchestration): claude adapter run route now clears stale closing sentinel
Inject route and codex/gemini adapter both unlink closing sentinel on non-lifecycle
dispatch to prevent the UI from staying in "Closing…" state if user re-dispatches
after a close_session was sent but not yet consumed by the stop hook. Claude adapter
path in /api/orchestration/run was missing this step.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 04:51:13 +02:00
g-butandClaude Sonnet 4.6 86679e6b3a fix(control): SSE lockAt never patched — beacon could race with web auto-continue
mergeProjectPatches updated readyAt from SSE but dropped lockAt, so
isBeaconActive stayed false while the beacon popup was showing. Web UI
auto-continue countdown would start even with beacon open, risking
double-injection. Also add lockAt to the SSE change-detection predicate
so a lock-only change (e.g. lock expiry without readyAt change) propagates.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 04:43:27 +02:00
g-butandClaude Sonnet 4.6 5d514730b1 fix(hook-bridge): patch_project_state was always 401 — add Bearer auth
Route used getSessionUserId() (cookie-only); hook bridge sent no auth header.
Switch route to getApiUserId() (cookie + Bearer) and read COCKPIT_DAEMON_TOKEN
from env or .env.local fallback in patch_project_state curl call.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 04:27:37 +02:00
g-butandClaude Sonnet 4.6 f11ca5233f fix(orchestration): claude adapter now writes current-prompt file on run
The claude adapter path injected the prompt but never wrote stateFile.prompt(),
so the UI showed no "Running: [task]" banner for any orchestration intent
(next_best, custom, etc.) dispatched via onRunWithBrain. Codex/gemini and the
inject route both wrote it; the claude run path was the only gap.

Added the write in the else branch (excluding hard_stop/close_session which
end sessions rather than start tracked prompts) — mirrors the inject route's
pattern and what the daemon now does for cloud-queued tasks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 04:12:53 +02:00
g-butandClaude Sonnet 4.6 585eae54d5 fix(beacon): notification handler respects health gate before queue dequeue
The notification auto-inject path dequeued queue items before reading session
health, so a critical/degraded health state was ignored and queue items fired
when they shouldn't. Moved the health read before the queue dequeue check and
gates the dequeue on auto_key=next_best — mirroring sessionHealthBlocksQueue()
on the client and the server-side gate in /api/orchestration/run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 04:03:39 +02:00
g-butandClaude Sonnet 4.6 5e4af110b8 fix(cloud): daemon now pushes session content (done/next/health/tests) to DB
In cloud mode (Vercel), session content was never populated in DB —
the runtime-state route only accepted agent/lifecycle fields, and the
daemon only pushed those. The UI showed empty done/next/health/tests
in the ReadyBanner and ClosedBanner for all cloud-mode users.

Daemon reads ~/.claude/sessions/<tab>.md per project each push cycle and
merges sessionDone/Next/Tests/Todos/Health/UpdatedAt into the payload when
the file exists. Route extended to accept and pass these fields through to
upsertProjectState (absent = skip, present = update).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 03:55:03 +02:00
g-butandClaude Sonnet 4.6 6f2c2b3e0c fix(daemon): write current-prompt file after cloud-queued inject
execute_inject injected prompts but never wrote /tmp/agent-current-prompt-<tab>,
so the UI showed no running banner for cloud-queued tasks. Now reads promptLabel
from the payload (already stored by enqueueInjectCommand) and writes the file
after a successful inject, mirroring what the local inject/run routes do.
Skipped for hard_stop and close_session (session-ending, not task-starting).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 03:47:01 +02:00
g-butandClaude Sonnet 4.6 f7a3ccc0e4 fix(daemon): use original-case tab name for sentinel files in execute_inject
Cycle 2 used tab_lower (lowercase) for all /tmp sentinel writes, but the
stop hook and push_runtime_state both read them with the original-cased tab
name (from zellij / conf). The case mismatch meant the stop hook never found
the close_session sentinel, so it showed the beacon popup and wrote readyAt
instead of closedAt — defeating the cycle 2 fix entirely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 03:37:27 +02:00
g-butandClaude Sonnet 4.6 6d7d413f4a fix(orchestration): server-side queue pop now respects session health gate
When sessionHealth is critical or sessionTests contain "fail", the server
no longer pops from the queue for next_best intent — mirroring the client-side
sessionHealthBlocksQueue() check. Previously the UI said "AI picks recovery
task — queue paused" but the server still ran queue items.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 03:25:20 +02:00
g-butandClaude Sonnet 4.6 820d29fbf8 fix(daemon): write close_session/hard_stop sentinel files in execute_inject
When the daemon processes an inject command from the cloud queue, it had
the promptKey but never wrote the sentinel or closing files.  The stop
hook would then treat the session end as a normal completion (readyAt +
beacon popup) instead of writing closedAt.

Mirrors the same fix applied to /api/orchestration/run for the local path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 03:10:27 +02:00
g-butandClaude Sonnet 4.6 8c6bd56b35 fix(orchestration): write close_session sentinel in run route — matches inject route
Without this, dispatching close_session via onRunWithBrain (ReadyBanner or direct)
injected the prompt but never wrote the agent-session-closed-<tab> sentinel.
The stop hook would then fire as a normal stop (readyAt + beacon popup) instead
of writing closedAt, leaving the UI in the wrong state after a clean session close.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 03:01:23 +02:00
g-butandClaude Sonnet 4.6 8a018188c8 fix(control): orch-ready banner no longer silently drops non-mapped prompt keys
The isOrchReady ReadyBanner wrapped onSend with a mapClaudePromptToIntent
guard that returned early for any key not in CLAUDE_PROMPT_TO_INTENT (e.g.
browser_test, health_check, unblock). Clicking those buttons did nothing.

The parent onSend (send in use-project-card-actions) already handles
non-orchestration keys by calling onInject directly — the guard was
redundant. Removed the wrapper and pass onSend through unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 02:41:56 +02:00
g-butandClaude Sonnet 4.6 6b509aff26 fix(queue): enqueue also writes file immediately
enqueue only called setQueue, relying on the effect cycle to write the file.
If the queue was empty and auto-continue fired before the next render, the
file would show an empty queue and next_best would run instead of the newly
queued item. Now enqueue reads the current localStorage state and calls
writeToFile directly, same as remove/shift.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 02:24:53 +02:00
g-butandClaude Sonnet 4.6 d3d5f7ee93 fix(queue): write reorder/edit/mergeItems immediately — same as remove
reorder, edit, and mergeItems only updated the file via the React effect
cycle, while remove and shift wrote synchronously. If auto-continue fires
in the gap between a drag-reorder and the next render, the agent receives
items in the old order. All three mutations now read from localStorage and
call writeToFile directly before the state update, matching the remove path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 02:21:38 +02:00
g-butandClaude Sonnet 4.6 311c93d187 fix(registry): add getCodexAvailability() — codex now checked like gemini
Codex had available: true hardcoded while gemini used getGeminiAvailability()
to probe the binary. On machines without codex, resolveNextAvailableAgent()
would wrongly suggest codex as the fallback, causing switch attempts to fail.
Now both agents gate on commandExistsInPath() + config-dir heuristic.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 02:15:22 +02:00
g-butandClaude Sonnet 4.6 4609e63666 fix(ssot): unify session handoff todos format across all dispatch paths
agent-config.ts (buildPromptWithSession), renderers.ts (openclaw path),
and cockpit-daemon.sh (_resolve_prompt) all emitted "todos: <count>"
while agent-hook-bridge.sh, install-beacon.sh, and prompt-library.ts
all emitted "todos: <count> TODOs". Agents dispatched from the web UI
would write "todos: 0" while beacon-fired agents wrote "todos: 0 TODOs",
producing inconsistent session files depending on which dispatch path ran.

Standardised on "todos: <count> TODOs" (the format present in all actual
session files and the majority of the emit sites).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 02:02:09 +02:00
g-butandClaude Sonnet 4.6 61c4fd6112 fix(control): enforce dark mode; cap and sanitize recent-prompt chips
Three fixes found via browser inspection of the Control panel:

1. ThemeProvider: add forcedTheme="dark" — localStorage "light" was
   overriding defaultTheme and rendering the entire app in light mode
2. SidebarFooter: remove ThemeToggle — no theme switching in a dark-only
   product; it was the root cause of the stale localStorage value
3. project-intent-panel: cap idle-state recent prompts at 5 (was
   unlimited); collapse whitespace/newlines in chip preview text so
   multiline prompts don't blow out the chip height

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 01:48:42 +02:00
g-butandClaude Sonnet 4.6 86c5ca661a feat(daemon): add --restart flag to install-daemon.sh for code-change reloads
The daemon runs directly from the repo scripts/, so after committing
changes to cockpit-daemon.sh or agent-hook-lib.sh the service must be
restarted to load the new code. Without this flag there was no quick
path — the full installer re-generates the service file unnecessarily.

Also restarted the running daemon which had been running stale code
since before the bc07b0a / 3ac1f01 reliability fixes were committed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 01:29:47 +02:00
g-butandClaude Sonnet 4.6 7b189ef4c9 fix(beacon): add notify-choice.py and get-idle-secs.py to install sync list
Both files are referenced by agent-hook-bridge.sh via \$SCRIPT_DIR and
were already present in the installed location from a prior install, but
were missing from _copy_scripts() — meaning --sync would never update
them when they change. Added to the canonical copy list alongside the
other bridge-referenced scripts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 01:12:00 +02:00
g-butandClaude Sonnet 4.6 f3e706875e fix(beacon): fix two runner script bugs blocking codex/gemini switches
run-codex-task.sh passed --ask-for-approval which only exists on the
interactive codex CLI, not codex exec — causing immediate failure on
every switch. Also both runner scripts computed ROOT=parent-of-scripts-dir
which resolves to ~/.local/share when installed, making the stop-hook
call (agent-hook-bridge.sh) silently fail every run. Fixed to use
SCRIPT_DIR (same directory as the runners) which works both in the
repo and from the installed ~/.local/share/cockpit-beacon/ location.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 01:03:02 +02:00
g-butandClaude Sonnet 4.6 dbe471ed1f fix(beacon): install run-{codex,gemini}-task.sh and sync-agent-runtime-config.py
install-beacon.sh was missing three scripts that agent-hook-bridge.sh
references via \$SCRIPT_DIR:
  - run-codex-task.sh / run-gemini-task.sh — agent-hook-bridge.sh
    constructs 'bash \$SCRIPT_DIR/run-{agent}-task.sh ...' and injects
    it into the terminal for Codex/Gemini switches; without the file
    present the injected command fails silently
  - sync-agent-runtime-config.py — called at bridge startup (non-fatal
    but missing from the install location)

Also DRY the install: extract _copy_scripts() so --sync and the full
install share a single list, eliminating the previous duplication.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 00:50:08 +02:00
g-butandClaude Sonnet 4.6 23ecd45251 feat(beacon): add --sync flag to install-beacon.sh for lightweight re-deploys
Full install is too heavy for day-to-day script updates — it re-creates
hook files and reruns dependency checks. --sync copies only the runtime
scripts (beacon.py, _beacon_config.py, agent-hook-bridge.sh, etc.) to
~/.local/share/cockpit-beacon without touching hooks or config.

Also synced the installed scripts to pick up all 4 recent fixes:
- agent-hook-bridge.sh: reliable switch (send_raw_key_to_tab+inject_prompt)
                        + capacity sentinel write in handle_notification
- agent-hook-lib.sh: grep -qxF exact-line fix in _find_session_for_tab
- beacon.py: nextAgent/capacityIssue computed in local session creation
             + _check_capacity_sentinel
- _beacon_config.py: looks_like_capacity_issue() + resolve_next_agent()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 00:41:56 +02:00
g-butandClaude Sonnet 4.6 11a368d989 fix(beacon): wire Claude Code rate-limit notifications into capacityIssue detection
The Notification hook receives a 'message' field from Claude Code (e.g.
"Claude is at capacity. Please try again in 60 seconds.") but the bridge
never read it, so capacity issues were invisible to the auto-switch system.

Fix: handle_notification now extracts 'message', regex-matches it against
rate-limit phrases (same set as looksLikeAgentCapacityIssue), and writes
/tmp/agent-capacity-issue-<tab> with a timestamp when matched.

beacon.py reads and clears this sentinel in _write_beacon_session so the
beacon session gets capacityIssue=true, triggering the auto-switch countdown
instead of the normal continue prompt. Sentinel expires after 5 minutes so
a missed stop hook doesn't poison the next unrelated session.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 00:27:27 +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 16d0b80136 fix(beacon): reliable agent switch in stop hook — use send_raw_key_to_tab + inject_prompt
switch_agent_and_continue had the same fragile fixed-sleep pattern as the
TypeScript route and daemon already fixed: manual go-to-tab + sleep 0.2 +
write 3 + sleep 0.1 + write-chars + sleep 0.1 + write 13 racing against
async tab focus.

Replace with:
- send_raw_key_to_tab for Ctrl+C (handles session discovery + tab focus)
- inject_prompt for launch command (polls dump-layout until focused)

This is the third and final execution path for agent switching. All three
paths (TypeScript route, daemon, beacon hook) now use the same reliable
pattern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 00:08:16 +02:00
g-butandClaude Sonnet 4.6 bc07b0ae74 fix(daemon): 6 correctness fixes from engineering audit
- grep -qixF (exact-line, case-insensitive) in tab_open check and
  _find_session_for_tab — -qiF was a substring match so 'cockpit'
  incorrectly matched 'cockpit-dev'
- --max-time 15/10/8 on claim_next, mark_done, push_runtime_state
  curl calls — missing timeouts let the main loop hang indefinitely
  if the server is unresponsive
- codex default model: codex-4-5 → gpt-5.4 to match agent-registry.ts SSOT
- _is_agent_running_in_dir rewritten to delegate to _scan_agents,
  eliminating the duplicate /proc walking logic

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 23:57:17 +02:00
g-butandClaude Sonnet 4.6 3ac1f017e6 fix(daemon): reliable switch_agent — poll /proc + Ctrl+C fallback
Mirrors the reliability fix applied to the TypeScript switch-agent route
(aa3a743) for the daemon execution path (cloud → daemon → local zellij).

Previously execute_switch_agent used a fixed `sleep 1` after injecting
the quit command, with no verification the old agent actually exited.
If the agent was stuck on a permission dialog the new agent's launch
command would be typed straight into the running session.

Changes:
- cockpit-daemon.sh: adds _is_agent_running_in_dir() to scan /proc for
  the outgoing agent by basename+cwd; replaces sleep 1 with a 2s poll
  loop, then sends Ctrl+C (key 3) + 600ms grace if still alive.
- agent-hook-lib.sh: adds send_raw_key_to_tab() — raw keycode injection
  reusing existing session-discovery logic, parallel to inject_prompt().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 23:41:29 +02:00
g-butandClaude Sonnet 4.6 aa3a7430b5 fix(control): reliable agent switch — poll /proc + Ctrl+C fallback
The fixed 900ms sleep before launching a replacement agent was fragile:
if Claude was stuck on a permission dialog or context-limit screen, the
/exit command wouldn't land and the new agent's launch command would be
typed into the running Claude session.

New behaviour:
- After sending the quit command, poll /proc every 200ms for up to 2s
  until the outgoing agent process disappears from the project directory.
- If still running after 2s (stuck on a prompt), send Ctrl+C (key 3)
  as a harder interrupt, then wait 600ms before launching.
- Also adds sendRawKey() to zellij.ts for raw keycode injection without
  characters, and removes the duplicate userId null-check in cloud mode.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 23:29:18 +02:00
g-butandClaude Sonnet 4.6 0261c57bfd fix(auth): surface NextAuth ?error= param as user-facing message on sign-in
OAuth failures (OAuthAccountNotLinked, AccessDenied) redirect back to
/sign-in?error=... but the form previously ignored the error param,
leaving users with no feedback after a failed OAuth attempt.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 21:22:53 +02:00
g-butandClaude Sonnet 4.6 0980f31745 fix(groq): extend callGroqText with systemPrompt; remove duplicate in ivy route
callGroqText in lib/groq.ts now accepts an optional systemPrompt so all
callers share the same fetch logic and model constant (GROQ_FAST_MODEL).

ivy/route.ts had a local callGroq that hardcoded "llama-3.3-70b-versatile"
and duplicated the fetch call — replaced with callGroqText + GROQ_FAST_MODEL.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 20:13:32 +02:00
g-butandClaude Sonnet 4.6 6c7c2bc4a1 fix(ssot): complete route SSOT — 3 missed hardcodes + delete dead verify-email API route
settings/page.tsx line 31, auth.config.ts /sign-out check, and
verify-email/[token]/page.tsx redirects were still using string literals.
All now use ROUTES.* from config/auth.ts.

Deleted src/app/api/auth/verify-email/[token]/route.ts — unreferenced dead
code (email links go to /verify-email/[token] page, not the API route).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 19:33:57 +02:00
g-butandClaude Sonnet 4.6 faed05deb1 fix(auth): DRY — centralize appUrl() in email.ts; use query layer in reset-password
appUrl() was defined identically in 4 files (forgot-password, register,
resend-verification, email.ts). Exported from email.ts; other 3 now import it.

reset-password was calling db.update(users) directly, bypassing
updateUserPasswordHash() that already exists in db/queries/users.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 19:18:15 +02:00
g-butandClaude Sonnet 4.6 6b37f926c9 fix(observability): surface silent DB write errors in orchestration routes
All .catch(() => {}) on fire-and-forget DB writes (upsertProjectState,
createOrchestrationEvent, insertPromptHistory, appendDevLog) now log via
console.error so failures appear in Vercel/journalctl logs. Responses are
still non-blocking — only visibility changes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 19:08:47 +02:00
g-butandClaude Sonnet 4.6 177640b119 fix(ssot): replace all hardcoded route strings with ROUTES.* constants
Completes the centralization started in 60c858d — 11 files, 20+ occurrences
of /sign-in, /today, /onboarding, and /sign-out now all import from
src/config/auth.ts ROUTES, making route renames a one-file change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 18:15:43 +02:00
g-butandClaude Sonnet 4.6 97933e5b95 feat(daemon): install-daemon.sh converts daemon to systemd user service
Auto-discovers COCKPIT_DAEMON_TOKEN from .env.local, snapshots the current
login PATH so zellij/jq/ffmpeg are reachable, writes ~/.config/cockpit/daemon.env
(chmod 600) and a user service file, then enables and starts it. Supports
--uninstall. Replaces manual `COCKPIT_DAEMON_TOKEN=... ./scripts/cockpit-daemon.sh`

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 17:10:01 +02:00
g-butandClaude Sonnet 4.6 e342e8728e fix(css): exclude CLAUDE.md from Tailwind scanning to fix CSS compile crash
Tailwind v4 auto-scans all project files including CLAUDE.md, which contains
`shadow-[var(--*)]` as a violation example. Tailwind generates CSS for this,
producing invalid `var(--*)` that crashes the PostCSS parser and causes all
CSS to fail loading on both dev and production.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 16:33:45 +02:00
g-butandClaude Sonnet 4.6 60c858dc89 fix(build): lazy-init Resend SDK to fix Vercel build crash; centralize auth routes
Resend SDK throws at construction when given an empty string API key, which
crashed next build on routes that import email.ts. Fix: lazy-initialize via
getResend() so the Resend instance is only created at send time, not module
evaluation time.

Route SSOT: create src/config/auth.ts with ROUTES and PUBLIC_NAV_LINKS constants.
Replace 25+ hardcoded "/sign-in", "/today", "/onboarding" etc. strings across
all auth pages, public pages, AuthShell, SignInForm, and SidebarFooter. Nav
links for public surface (landing + auth) now come from one place.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 15:44:09 +02:00
g-butandClaude Sonnet 4.6 d2ee8b993a feat(auth): resend SDK + styled emails, email verification, Groq fallback for Ivy
- Upgrade email.ts to resend SDK with sendEmailFire (fire-and-forget) and sendEmail (awaitable)
- Add styled HTML templates for verification, welcome, and password reset emails
- Add email_verification_tokens table + queries (mirrors password-reset-tokens pattern)
- Register route now sends verification + welcome emails after sign-up
- Add /verify-email/[token] page and /api/auth/verify-email/[token] route to consume tokens
- Add /verify-email page (success, expired-link, and resend states)
- Add /api/auth/resend-verification route with rate limiting
- Add verify-email to proxy public route exclusions
- Add Groq (llama-3.3-70b-versatile) fallback to /api/ivy when openclaw is unavailable

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 14:56:15 +02:00
g-butandClaude Sonnet 4.6 e72623d803 feat(auth): add Google and X OAuth providers; fix production email login
Login fix: production Neon user existed but had no email set (created via
owner-key flow). Updated the record directly — email and fresh password
hash now match local credentials.

Google OAuth: added Google provider behind GOOGLE_CLIENT_ID/SECRET env
vars. Sign-in page shows "Continue with Google" button when both are set.

X OAuth: added Twitter provider behind TWITTER_CLIENT_ID/SECRET env vars.
Sign-in page shows "Continue with X" button when both are set.

Both new providers use allowDangerousEmailAccountLinking so existing
email+password accounts link automatically on first OAuth sign-in.
Providers are conditionally spread into the providers array — absent
env vars = provider simply doesn't exist, no runtime error.

SignInForm: unified oauthLoading state across all three OAuth buttons
(only one can be in-flight at a time); replaced single githubLoading bool.

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