Both routes use child_process to run claude CLI and git pull respectively —
neither is available on Vercel. Returns 503 with descriptive message.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
spawn() and zellij inject are not available on Vercel.
The orchestration run endpoint now returns a clear 503 instead of crashing.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three routes called child_process / zellij / ffmpeg without checking whether
the local runtime is present. On Vercel they would crash or return opaque 500s.
- agent route: skip applyToOpenTabs with an explanatory skipped result
- transcribe route: return 503 in cloud mode (ffmpeg/whisper not installed)
- bootstrap route: return 503 in cloud mode (local dir + git ops won't work)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
getCurrentUserId() falls back to a hardcoded ID when no session exists.
For the daemon bridge endpoints this would let any unauthenticated request
read/mutate the command queue. Use auth() directly: daemon bearer token
validates against DB is_default user, browser requests require a real session.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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>
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>
- Add pending_commands schema + queries: command queue table that the local
daemon polls when the cloud control plane is not co-located with zellij
- Add src/lib/runtime.ts: isRuntimeAvailable() reads RUNTIME_AVAILABLE env var
(set to "true" locally, absent on Vercel) — single source of truth for the
local/remote split
- Add src/lib/executor.ts: executeInject() routes to injectIntoTab() (direct)
or enqueueInjectCommand() (DB queue) based on runtime availability; callers
express intent once, the executor picks the mechanism
- Refactor /api/inject: use executeInject(); all DB side-effects (prompt history,
orchestration events, project state) run in both modes; file-system writes
(stateFile.prompt, sentinel, closing) guarded behind isRuntimeAvailable()
- Guard /api/control/focus-tab, /api/weather, /api/github, /api/calendar,
/api/system with early returns when runtime is unavailable — clean empty
responses instead of timeout errors on Vercel
- Add RUNTIME_AVAILABLE=true to .env.local; push pending_commands table to DB
- Add thoughts articles: portable creation cockpit vision + dispatch intelligence
problem (blind queue drain vs contextual AI triage)
- Control panel: agent switcher popover on runtime chip, cross-session
focus-tab, sticky left panel, Projects↔Control navigation bridge,
ClaudeSession uses runtimeState.tabName instead of entity name
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Writes sentinel + closing + closed files immediately so stop.sh never
re-opens the tab. Claude adapter skips session context to inject the
bare stop directive; codex adapter follows the same sentinel logic.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The abandoned goal flow added in 4e0de3e left a gap: getGoalStats only
counted active/completed, so the StatCard sub-text showed 'X completed'
while silently omitting any abandoned goals. Now counts all three states
and shows 'X completed · Y abandoned' (or just the non-zero ones).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The habit scheduling query hardcoded 'daily'/'weekdays'/'weekly' strings
directly in the SQL template instead of the HABIT_FREQUENCY constants
that are the canonical SSOT for these values. Now uses parameterized
template interpolation so a rename only requires changing statuses.ts.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The original page hardcoded 'en-US' locale for date formatting while
the rest of the codebase uses APP_LOCALE (COCKPIT_LOCALE env / 'de-CH').
HistoryFeed client component:
- Uses APP_LOCALE for all date/time formatting
- Project filter chips (hide project column when filtered — wider prompt
column makes the text readable at a glance)
- groupByDay / format helpers moved out of the server page
Server page is now thin: fetch + empty state + <HistoryFeed>.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Every agent dispatch (inject + orchestration) has been stored in
prompt_history since the table was created. This surfaces it:
- getPromptHistory() query fetches last 200 rows without the 24h cap
- /history page groups dispatches by calendar day, shows time /
project / prompt text / adapter badge
- History nav item added (non-mobile)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
GOAL_STATUS.ABANDONED existed in the SSOT but nothing used it — abandoned
goals silently piled up in the active list. Now:
- GoalCard: Archive button marks goal abandoned; toggles back to active;
blocked when completed. Title/desc/progress editing guarded by isClosed.
- AbandonedGoals: collapsible section (mirrors CompletedGoals)
- GoalsGrid: renders AbandonedGoals, filtering respected
- Goals page: splits tree into active / completed / abandoned correctly
- patchGoal: clears completedAt when transitioning to ABANDONED
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
30 dots in a flex-wrap row were hard to read for day-of-week patterns.
New layout: Mon-first 7-row × N-week grid (GitHub contributions style)
with M/W/F/S labels on the left so weekday vs weekend consistency is
immediately visible.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
scheduledDays is pure logic — no DB dependency — so it belongs alongside
isHabitScheduled in statuses.ts. HabitCard now imports from the constants
file instead of from the db/queries layer.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
isDue (HabitHeatmap) and isScheduled (habits query) contained identical logic.
Moved to lib/constants/statuses.ts alongside HABIT_FREQUENCY. HabitHeatmap
frequency prop strengthened from string to HabitFrequency.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
NotesSection and DevLogSection each called useFetch for the same endpoint.
Now fetched once in ProjectProfile and passed as props. Also extends useFetch
to accept null URL (skips fetch when no ID available).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The 4-line unlinkSync block for stale handshake files appeared identically in
inject/route.ts and orchestration/run/route.ts. Centralized in agent-config.ts.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three callsites passed identical GOAL_PROGRESS_THRESHOLDS to ProgressBar+getProgressTone.
GoalProgressBar bakes in those thresholds, reducing 3 imports to 1 per file.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously computeStreak broke on any day with no completion, so a
weekdays-only habit would show 0 streak on Saturday even with a full
week of completions. Also deduplicates isDueToday → isScheduled.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The 4-line Map<habitId, Set<completedDate>> construction appeared in both
listHabitsForToday and getHabitHeatmapData. Extracted to a shared helper.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The 7-line streak loop appeared twice — once using HABIT_HISTORY_DAYS
as the bound (listHabitsForToday) and once using a dynamic days param
(getHabitHeatmapData). Extracted to a private computeStreak(dates, maxDays)
function eliminating the duplication.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The repeating inline-edit input pattern (bg-surface-raised border rounded
outline-none transition-colors with focus:border-border-strong) appeared
14 times across 9 components with no shared class. Adds ui-input-inline
to globals.css as the single source of truth for click-to-edit inputs on
raised surfaces. Callers supply their own padding, text-size, width, and
border-strength overrides as needed.
Files updated: HabitCard, CommitmentItem, GoalCard, goal-card-helpers,
HabitRow, LogConversationButton, ProjectInlineEditors, ProjectPromptsTab,
project-overview-helpers.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Eliminates the duplicate type Agent = "codex" | "claude" that violated
the single-source-of-truth principle.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CreateEventInput, PatchEventInput, MilestoneSchema, SubscriptionRow,
PatchSubscriptionInput, LatestLifecycleEvents, PatchProjectInput,
PatchCommitmentInput — all referenced only within their own query file,
never imported by route handlers or components.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
WhisperModel (beacon), CHANNEL_ATTR_PREFIX + ChannelConfig (channels),
PromptScope (prompt-library), SubscriptionMeta (subscriptions) — all
had zero external callers and are only referenced within their own file.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
agent-registry: remove sanitizeAgentOption, getDefaultAgentId,
getAgentRegistryEntry, getDefaultAgentConfig, sanitizeAgentConfig,
listSwitchableAgentRegistry — all had zero external callers.
agent-config: make CLAUDE_HOME, PROJECTS_CONF, CLAUDE_PROJECTS_CONF,
CLAUDE_PROMPTS_FILE, PromptConfig, readPromptConfig private — only
used within the file.
agent-preferences: make AGENT_PREFERENCES_FILE private.
agent-catalog: make AgentCatalogEntry private.
constants: make OPENCLAW_DIR, WORKSPACE_DIR private.
utils: make UUID_RE private.
session-content: make ParsedSession private.
crons: make CronFileData private.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ProjectTab, SwitchTabResult, getConfiguredProjectTabs, getOpenZellijTabs,
restartTab, and restartOpenProjectTabs had zero external callers. The
internal helpers (getOpenZellijTabs, restartTab) are kept as private
functions since launchAgentInTab still depends on them.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The export was unused — both control routes import from control-fast-state.ts
which has the correct basename-only matching. The agent-runtime version used
a full cmdline scan that produced false positives on bash shell-snapshot scripts
and was superseded when control-fast-state.ts was introduced.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
isOrchestrationReady was not included in isActive, so projects where an
orchestration run just finished were buried in the collapsed idle grid
instead of appearing in the active section where the user can see the
result. The sort rank was already correct (rank 2, same as isReady) but
the active/idle split was wrong.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Removed three duplicates in agent-preferences.ts:
- local `type Agent` (same as registry export)
- local `sanitizeAgentId` (identical implementation)
- local `syncClaudeSettings` (same logic as registry's syncAgentSettings)
Now calls syncAgentSettings("claude", ...) directly instead of re-deriving the
~/.claude/settings.json path inline.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both maps cover the same health labels (good/excellent/needs-attention/degraded/critical)
so an agent writing "degraded" no longer silently falls through to neutral tag style
in DevLogList and the public profile page.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Removed local duplicate of the agent-prompts.json path. agent-config.ts is
already the SSOT and also supports AGENT_PROMPTS_FILE env-var override which
the local copy silently ignored.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both beacon-settings and beacon/transcribe routes defined the same
~/.config/agent-dashboard-settings.json path. Extracted to BEACON_SETTINGS_PATH
in config/beacon.ts (already the SSOT for beacon config after WHISPER_MODELS).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaced ad hoc pattern matching (startsWith "green"/"red", includes "fail")
with the existing SSOT from lib/constants/control. Fixes degraded health showing
as muted text-secondary instead of warning color in project detail view.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Within same display-state rank, surface projects with degraded or critical
health before those with only git activity, so attention-needed projects
float to the top of the idle grid.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
agent/route.ts redefined AGENT_IDS locally instead of importing from
lib/agent-registry.ts where it lives. One source of truth for agent IDs.
AlertSeverity derived type had zero external usages — removed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Avoids recreating Record objects on every render. Renamed to
HEALTH_BADGE_STYLE and HEALTH_BADGE_ICON for UPPER_SNAKE_CASE consistency.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Labels belonged alongside SORT_MODE in lib/constants/statuses.ts.
PeopleGrid now imports from there instead of defining them locally.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds collapsible "Library prompts" section to IntentButtonPanel showing
featured project-scoped prompts as polished mini-cards (2-col grid with
name, description, category badge). Clicking injects directly when the
agent is ready (bannerActive) or populates the input for review when idle.
Adds FEATURED_PROJECT_PROMPTS and substituteProjectName() to
config/prompt-library.ts as the SSOT for control-panel prompt injection.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>