diff --git a/src/renderer/components/settings/ConfigHealthCard.tsx b/src/renderer/components/settings/ConfigHealthCard.tsx index 328151c..e95a7dc 100644 --- a/src/renderer/components/settings/ConfigHealthCard.tsx +++ b/src/renderer/components/settings/ConfigHealthCard.tsx @@ -1,15 +1,13 @@ import React from 'react' import { - Activity, AlertTriangle, ArrowRight, Check, - CheckCircle2, - CircleDashed, GitBranch, KeyRound, Loader2, Plug, + Radio, RefreshCw, XCircle, } from 'lucide-react' @@ -18,113 +16,127 @@ import { useConfigHealth } from '@renderer/hooks/useConfigHealth' import { useUIStore } from '@renderer/store/ui' import type { ConfigHealthStatus, McpAttentionItem } from '@shared/types' -const STATUS_STYLES: Record< +const STATUS_META: Record< ConfigHealthStatus, - { label: string; text: string; border: string; background: string; dot: string } + { label: string; text: string; chip: string; bar: string; glow: string } > = { ok: { - label: 'Ready', + label: 'Nominal', text: 'text-emerald-500', - border: 'border-emerald-500/20', - background: 'bg-emerald-500/[0.07]', - dot: 'bg-emerald-500', + chip: 'bg-emerald-500/15 text-emerald-500 ring-1 ring-emerald-500/30', + bar: 'bg-emerald-500', + glow: 'shadow-[inset_3px_0_0_0_rgb(16_185_129)]', }, warn: { - label: 'Action needed', + label: 'Degraded', text: 'text-amber-500', - border: 'border-amber-500/25', - background: 'bg-amber-500/[0.07]', - dot: 'bg-amber-500', + chip: 'bg-amber-500/15 text-amber-500 ring-1 ring-amber-500/30', + bar: 'bg-amber-500', + glow: 'shadow-[inset_3px_0_0_0_rgb(245_158_11)]', }, error: { - label: 'Not ready', + label: 'Critical', text: 'text-red-400', - border: 'border-red-500/25', - background: 'bg-red-500/[0.07]', - dot: 'bg-red-500', + chip: 'bg-red-500/15 text-red-400 ring-1 ring-red-500/30', + bar: 'bg-red-500', + glow: 'shadow-[inset_3px_0_0_0_rgb(248_113_113)]', }, } -function StatusIcon({ status, pending }: { status: ConfigHealthStatus; pending?: boolean }) { +function StatusGlyph({ status, pending }: { status: ConfigHealthStatus; pending?: boolean }) { if (pending) { - return + return } - if (status === 'ok') { - return - } - if (status === 'warn') { - return - } - return + if (status === 'ok') return + if (status === 'warn') return + return } -function HealthTile({ +function MatrixRow({ icon, + code, title, status, message, pending, - children, + detail, }: { icon: React.ReactNode + code: string title: string status: ConfigHealthStatus message: string pending?: boolean - children?: React.ReactNode + detail?: React.ReactNode }) { - const style = STATUS_STYLES[status] + const meta = STATUS_META[status] return ( -
-
-
+
+
+
{icon}
- - - {pending ? 'Checking' : style.label} +
+
+ + {code} + + {title} +
+

+ {pending ? 'Probing…' : message} +

+ {detail} +
+ + + {pending ? 'Check' : meta.label}
-
-

{title}

-

- {pending ? 'Checking configuration…' : message} -

- {children} -
) } -function McpAttentionList({ items }: { items: McpAttentionItem[] }) { +function McpAttentionRail({ items }: { items: McpAttentionItem[] }) { const setShowGlobalMcpManager = useUIStore((s) => s.setShowGlobalMcpManager) if (items.length === 0) return null return ( -
+
{items.map((item) => (
-
- - {item.name} + +
+
{item.name}
+
+ {item.status === 'unauthorized' ? 'Auth required' : 'Failed'} + {item.message ? ` · ${item.message}` : ''} +
-

- {item.status === 'unauthorized' ? 'Authentication required' : 'Connection failed'} - {item.message ? ` · ${item.message}` : ''} -

))} - + Open MCP console + +
) } @@ -144,98 +156,140 @@ export function ConfigHealthCard() { ? 'error' : 'warn' - const overallCopy = pending - ? 'Checking the services Conduit relies on.' + const overallMeta = STATUS_META[overall] + + const headline = pending + ? 'Systems check in progress' : health.isError - ? `Couldn't load configuration health: ${health.error instanceof Error ? health.error.message : String(health.error)}` + ? 'Telemetry unavailable' : data?.ok - ? 'Everything Conduit needs is configured and responding.' + ? 'All systems nominal' : overall === 'warn' - ? 'Conduit can run, but some connections need your attention.' - : 'Resolve the items below before relying on Conduit.' + ? 'Degraded — attention required' + : 'Critical — not ready to run' - const overallTitle = pending - ? 'Checking Conduit' + const detail = pending + ? 'Collecting Git, encryption, and MCP probes.' : health.isError - ? 'Status unavailable' + ? health.error instanceof Error + ? health.error.message + : String(health.error) : data?.ok - ? 'Conduit is ready' + ? 'Instance dependencies are healthy. Agents can launch against this host.' : overall === 'warn' - ? 'Conduit needs attention' - : 'Conduit is not fully ready' + ? 'Conduit can still run, but one or more probes need operator action.' + : 'Resolve critical probes before relying on managed runs.' + + const counts = { + ok: [data?.git.status, data?.encryption.status, data?.mcps.status].filter((s) => s === 'ok').length, + warn: [data?.git.status, data?.encryption.status, data?.mcps.status].filter((s) => s === 'warn').length, + error: [data?.git.status, data?.encryption.status, data?.mcps.status].filter((s) => s === 'error').length, + } return ( -
-
-
-
-
-
- {pending ? ( - - ) : overall === 'ok' ? ( - - ) : overall === 'warn' ? ( - - ) : ( - - )} +
+
+
+ + + Ops · Readiness console + +
+ +
+ +
+ {/* Left: overall readiness panel */} + -
- } - title="Git" - status={data?.git.status ?? 'ok'} - message={data?.git.message ?? ''} - pending={pending} - /> - } - title="Encryption" - status={data?.encryption.status ?? 'ok'} - message={data?.encryption.message ?? ''} - pending={pending} - /> - } - title="MCP connections" - status={data?.mcps.status ?? 'ok'} - message={data?.mcps.message ?? ''} - pending={pending} - > - {data && } - + {/* Right: health matrix / status rail */} +
+
+ + Probe matrix · Git · Encryption · MCP + +
+ } + code="GIT" + title="Git binary" + status={data?.git.status ?? 'ok'} + message={data?.git.message ?? ''} + pending={pending} + /> + } + code="ENC" + title="Secret encryption" + status={data?.encryption.status ?? 'ok'} + message={data?.encryption.message ?? ''} + pending={pending} + /> + } + code="MCP" + title="Global MCP links" + status={data?.mcps.status ?? 'ok'} + message={data?.mcps.message ?? ''} + pending={pending} + detail={data ? : undefined} + /> +
) diff --git a/src/renderer/components/settings/SettingsManager.tsx b/src/renderer/components/settings/SettingsManager.tsx index 8491ca0..4398345 100644 --- a/src/renderer/components/settings/SettingsManager.tsx +++ b/src/renderer/components/settings/SettingsManager.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react' -import { Check, Loader2, KeyRound, HardDrive, Trash2, Timer, ShieldCheck } from 'lucide-react' +import { Check, Loader2, HardDrive, Trash2, Timer, Gauge, Cable } from 'lucide-react' import { Button } from '@renderer/components/ui/button' import { Input } from '@renderer/components/ui/input' import { useAgentCredentialStatus, useSetAgentCredential } from '@renderer/hooks/useAgentCredentials' @@ -19,17 +19,16 @@ interface RunnerMeta { } const RUNNERS: RunnerMeta[] = [ - { runner: 'claude', label: 'Claude Code', envVar: 'ANTHROPIC_API_KEY', hint: 'Anthropic API key used to authenticate the Claude Code CLI.' }, - { runner: 'amp', label: 'Amp', envVar: 'AMP_API_KEY', hint: 'Sourcegraph Amp API key used to authenticate the Amp CLI.' }, - { runner: 'cursor', label: 'Cursor', envVar: 'CURSOR_API_KEY', hint: 'Cursor API key used to authenticate the cursor-agent CLI.' }, + { runner: 'claude', label: 'Claude Code', envVar: 'ANTHROPIC_API_KEY', hint: 'Anthropic API key for the Claude Code CLI.' }, + { runner: 'amp', label: 'Amp', envVar: 'AMP_API_KEY', hint: 'Sourcegraph Amp API key for the Amp CLI.' }, + { runner: 'cursor', label: 'Cursor', envVar: 'CURSOR_API_KEY', hint: 'Cursor API key for the cursor-agent CLI.' }, ] /** - * One card per agent harness, holding both its credential (API key) and its - * background-task timeout — the two per-harness settings live together instead of - * in separate screen sections. + * Compact connection-matrix row: credential + background wait in one dense line + * instead of a large per-runner card. */ -function RunnerSettingsCard({ +function RunnerMatrixRow({ meta, configured, seconds, @@ -38,11 +37,21 @@ function RunnerSettingsCard({ configured: boolean seconds: number }) { - // Credential (API key) state. const [keyValue, setKeyValue] = useState('') const setCredential = useSetAgentCredential() const credBusy = setCredential.isPending + const [timeoutValue, setTimeoutValue] = useState(String(seconds)) + const saveTimeout = useSetRunnerTimeout() + const timeoutBusy = saveTimeout.isPending + const timeoutSupported = meta.runner === 'claude' + + useEffect(() => { + setTimeoutValue(String(seconds)) + }, [seconds]) + + const timeoutDirty = String(seconds) !== timeoutValue.trim() + const handleSaveKey = async () => { if (!keyValue.trim()) return try { @@ -62,19 +71,6 @@ function RunnerSettingsCard({ } } - // Background-task timeout state. - const [timeoutValue, setTimeoutValue] = useState(String(seconds)) - const saveTimeout = useSetRunnerTimeout() - const timeoutBusy = saveTimeout.isPending - const timeoutSupported = meta.runner === 'claude' - - // Keep the field in sync when the stored value changes (initial load / refetch). - useEffect(() => { - setTimeoutValue(String(seconds)) - }, [seconds]) - - const timeoutDirty = String(seconds) !== timeoutValue.trim() - const handleSaveTimeout = async () => { const n = Math.max(0, Math.floor(Number(timeoutValue) || 0)) try { @@ -86,66 +82,73 @@ function RunnerSettingsCard({ } return ( -
-
-
-
- {meta.label} - - {meta.envVar} - -
-

{meta.hint}

+
+
+
+ {meta.label} + + {configured && } + {configured ? 'Linked' : 'Unset'} +
- - {configured && } - {configured ? 'Connected' : 'Not set'} - + + {meta.envVar} + +

{meta.hint}

- -
- setKeyValue(e.target.value)} - onKeyDown={(e) => { - if (e.key === 'Enter') handleSaveKey() - }} - placeholder={configured ? 'Replace existing key…' : 'Paste API key…'} - autoComplete="off" - className="flex-1" - /> - +
+ +
+ setKeyValue(e.target.value)} + onKeyDown={(e) => { + if (e.key === 'Enter') handleSaveKey() + }} + placeholder={configured ? 'Replace key…' : 'Paste API key…'} + autoComplete="off" + className="h-8 flex-1 text-xs" + /> + +
+ {configured && ( + + )}
- {configured && ( - - )} -
-
- - Background wait +
+
+ + {!timeoutSupported && ( - - Not applied + + N/A )}
-

- {timeoutSupported ? 'How long to wait for background work. Use 0 for no limit.' : 'Saved for future CLI support.'} -

-
+
{ if (e.key === 'Enter') handleSaveTimeout() }} - className="w-20" + className="h-8 w-[4.5rem] text-xs" + disabled={!timeoutSupported} /> - sec -
+

+ {timeoutSupported ? '0 = no limit' : 'Stored for future CLI support'} +

) @@ -180,82 +193,107 @@ function sweepSummary(r: SweepResult): string { return [removed, compacted].filter(Boolean).join(' ') || 'Nothing to clean up — already tidy.' } -function StorageUsageSummary() { +function StorageOpsPanel() { const usage = useStorageUsage() - - if (usage.isLoading) { - return ( -
- - Calculating storage usage… -
- ) - } - - if (usage.isError || !usage.data) { - return ( -
- Couldn't measure storage usage. -
- ) - } - - const { totalBytes, reclaimableBytes } = usage.data - return ( -
-
- - {formatBytes(totalBytes)} - - in use - {usage.isFetching && } -
- {reclaimableBytes > 0 && ( -
- {formatBytes(reclaimableBytes)} reclaimable from finished runs -
- )} -
- ) -} - -function StorageMaintenanceCard() { const sweep = useDataDirSweep() return ( -
-
-
-
- -
-
-
Conduit data
- -

- Clean up worktrees, temporary workspaces, and MCP files left by finished runs. - Active runs are never touched. -

-
+
+
+
+ + + Storage · Data plane +
- {sweep.data && !sweep.isPending && ( -

{sweepSummary(sweep.data)}

- )} - {sweep.isError && ( -

- Cleanup failed: {sweep.error instanceof Error ? sweep.error.message : String(sweep.error)} -

- )} + +
+
+
+ Footprint +
+ {usage.isLoading ? ( +
+ + Measuring… +
+ ) : usage.isError || !usage.data ? ( +

Couldn't measure storage usage.

+ ) : ( + <> +
+ + {formatBytes(usage.data.totalBytes)} + + in use + {usage.isFetching && } +
+
+
+ Reclaimable +
+
+ {formatBytes(usage.data.reclaimableBytes)} +
+
+ + )} +
+ +
+
+ Maintenance +
+

+ Reclaim worktrees, temporary workspaces, and MCP files left by finished runs. Active runs are never touched. +

+ {sweep.data && !sweep.isPending && ( +

{sweepSummary(sweep.data)}

+ )} + {sweep.isError && ( +

+ Cleanup failed: {sweep.error instanceof Error ? sweep.error.message : String(sweep.error)} +

+ )} +
+
+
+ ) +} + +function SectionChrome({ + icon, + code, + title, + blurb, +}: { + icon: React.ReactNode + code: string + title: string + blurb: string +}) { + return ( +
+
+
+ {icon} + + {code} + +
+

{title}

+

{blurb}

+
) } @@ -263,37 +301,54 @@ function StorageMaintenanceCard() { export function SettingsManager() { const { data: status } = useAgentCredentialStatus() const { data: timeouts } = useRunnerTimeouts() + const linkedCount = RUNNERS.filter((m) => !!status?.[m.runner]).length return (
-
-
-
- - Workspace administration +
+
+
+
+ + Operations dashboard +
+

+ Instance settings +

+

+ Readiness probes, agent links, run defaults, and storage — scanned like an ops console. +

+
+
+
+
Agents linked
+
+ {linkedCount}/{RUNNERS.length} +
+
-

Conduit settings

-

- Check readiness, connect agent runtimes, and manage defaults for every run. -

-
+
-
-

Agent connections

-

- Add credentials for the CLIs your agents use. Keys are encrypted and scoped to your account; - settings on an individual agent take precedence. -

-
-
+ } + code="CONN · Agent matrix" + title="Agent connections" + blurb="Credentials and background waits in one dense matrix. Per-agent env still wins at run time." + /> +
+
+ Runtime + API key + Run default +
{RUNNERS.map((meta) => ( -
-
+
-
-
-

Storage

-

- See how much space Conduit uses and safely reclaim files from completed runs. -

-
- +
+ } + code="DISK · Retention" + title="Storage" + blurb="Footprint and reclaimable capacity at a glance." + /> +