diff --git a/src/renderer/components/settings/ConfigHealthCard.tsx b/src/renderer/components/settings/ConfigHealthCard.tsx index 328151c..e65b64b 100644 --- a/src/renderer/components/settings/ConfigHealthCard.tsx +++ b/src/renderer/components/settings/ConfigHealthCard.tsx @@ -1,11 +1,9 @@ -import React from 'react' +import React, { useState } from 'react' import { - Activity, AlertTriangle, - ArrowRight, Check, - CheckCircle2, - CircleDashed, + ChevronDown, + ChevronRight, GitBranch, KeyRound, Loader2, @@ -20,115 +18,150 @@ import type { ConfigHealthStatus, McpAttentionItem } from '@shared/types' const STATUS_STYLES: Record< ConfigHealthStatus, - { label: string; text: string; border: string; background: string; dot: string } + { label: string; short: string; text: string; bg: string; dot: string } > = { ok: { label: 'Ready', + short: 'OK', text: 'text-emerald-500', - border: 'border-emerald-500/20', - background: 'bg-emerald-500/[0.07]', + bg: 'bg-emerald-500/10', dot: 'bg-emerald-500', }, warn: { - label: 'Action needed', + label: 'Needs attention', + short: 'WARN', text: 'text-amber-500', - border: 'border-amber-500/25', - background: 'bg-amber-500/[0.07]', + bg: 'bg-amber-500/10', dot: 'bg-amber-500', }, error: { label: 'Not ready', + short: 'ERR', text: 'text-red-400', - border: 'border-red-500/25', - background: 'bg-red-500/[0.07]', + bg: 'bg-red-500/10', dot: 'bg-red-500', }, } -function StatusIcon({ status, pending }: { status: ConfigHealthStatus; pending?: boolean }) { +function StatusGlyph({ status, pending }: { status: ConfigHealthStatus; pending?: boolean }) { if (pending) { - return + return } if (status === 'ok') { - return + return } if (status === 'warn') { - return + return } - return + return } -function HealthTile({ - icon, - title, - status, - message, - pending, - children, -}: { - icon: React.ReactNode - title: string - status: ConfigHealthStatus - message: string - pending?: boolean - children?: React.ReactNode -}) { - const style = STATUS_STYLES[status] +function McpAttentionRows({ items }: { items: McpAttentionItem[] }) { + const setShowGlobalMcpManager = useUIStore((s) => s.setShowGlobalMcpManager) + if (items.length === 0) return null return ( -
-
-
- {icon} -
- - - {pending ? 'Checking' : style.label} - -
-
-

{title}

-

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

- {children} +
+
+ MCP attention
+
    + {items.map((item) => ( +
  • + +
    +
    {item.name}
    +
    + {item.status === 'unauthorized' ? 'Authentication required' : 'Connection failed'} + {item.message ? ` · ${item.message}` : ''} +
    +
    +
  • + ))} +
+
) } -function McpAttentionList({ items }: { items: McpAttentionItem[] }) { - const setShowGlobalMcpManager = useUIStore((s) => s.setShowGlobalMcpManager) - if (items.length === 0) return null +interface CheckRowProps { + icon: React.ReactNode + name: string + status: ConfigHealthStatus + message: string + pending?: boolean + detail?: React.ReactNode +} + +function CheckRow({ icon, name, status, message, pending, detail }: CheckRowProps) { + const style = STATUS_STYLES[status] + const hasDetail = Boolean(detail) + const [open, setOpen] = useState(hasDetail) + + React.useEffect(() => { + if (hasDetail) setOpen(true) + }, [hasDetail]) + return ( -
- {items.map((item) => ( -
-
- - {item.name} + <> + + +
+ {icon} + {name}
-

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

-
- ))} - -
+ + + + + {pending ? '…' : style.short} + + + + {pending ? 'Checking…' : message} + + + {hasDetail && ( + + )} + + + {hasDetail && open && ( + + + {detail} + + + )} + ) } +/** + * Compact control-center status strip: overall state plus a dense check table. + * Preserves the same AppConfigHealth data and recheck / MCP actions as before. + */ export function ConfigHealthCard() { const health = useConfigHealth() const data = health.data @@ -144,98 +177,107 @@ export function ConfigHealthCard() { ? 'error' : 'warn' - const overallCopy = pending - ? 'Checking the services Conduit relies on.' + const overallStyle = STATUS_STYLES[overall] + const summary = pending + ? 'Checking services…' : health.isError - ? `Couldn't load configuration health: ${health.error instanceof Error ? health.error.message : String(health.error)}` + ? `Status unavailable: ${health.error instanceof Error ? health.error.message : String(health.error)}` : data?.ok - ? 'Everything Conduit needs is configured and responding.' + ? 'All checks passing' : overall === 'warn' - ? 'Conduit can run, but some connections need your attention.' - : 'Resolve the items below before relying on Conduit.' + ? 'Runnable, with items to review' + : 'Blocking issues detected' - const overallTitle = pending - ? 'Checking Conduit' - : health.isError - ? 'Status unavailable' - : data?.ok - ? 'Conduit is ready' - : overall === 'warn' - ? 'Conduit needs attention' - : 'Conduit is not fully ready' + const mcpAttention = data?.mcps.attention ?? [] return ( -
-
-
-
-
-
- {pending ? ( - - ) : overall === 'ok' ? ( - - ) : overall === 'warn' ? ( - - ) : ( - - )} -
-
-
-

{overallTitle}

- {!pending && ( - - {STATUS_STYLES[overall].label} - - )} -
-

{overallCopy}

-
-
- + + {pending ? 'Checking' : overallStyle.label} + +
+

+ Instance health +

+

{summary}

+
+
-
- } - 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 && } - +
+ + + + + + + + + + + + } + name="Git" + status={data?.git.status ?? 'ok'} + message={data?.git.message ?? ''} + pending={pending} + /> + } + name="Encryption" + status={data?.encryption.status ?? 'ok'} + message={data?.encryption.message ?? ''} + pending={pending} + /> + } + name="MCP" + status={data?.mcps.status ?? 'ok'} + message={data?.mcps.message ?? ''} + pending={pending} + detail={data && mcpAttention.length > 0 ? : undefined} + /> + +
Configuration health checks
+ Check + + State + + Detail + + Expand +
) diff --git a/src/renderer/components/settings/PromptComponentManager.tsx b/src/renderer/components/settings/PromptComponentManager.tsx index 89fa129..2e41545 100644 --- a/src/renderer/components/settings/PromptComponentManager.tsx +++ b/src/renderer/components/settings/PromptComponentManager.tsx @@ -208,24 +208,23 @@ function ComponentRow({ } return ( -
+
{item.kind === 'file' ? : }
-
- {item.name} +
+ {item.name} {item.kind} {!item.enabled && ( - + Off )} @@ -233,11 +232,11 @@ function ComponentRow({ {item.kind === 'file' && item.filePath && ( {item.filePath} )} -

+

{item.content.trim() || '(empty)'}

-
+
- {isOwner && ( - )} @@ -266,7 +265,7 @@ function ComponentRow({
-
- Instructions are prepended to every prompt. - Files are written into every workspace. -
- {showAdd && ( - +
+ Loading…
) : items.length === 0 && !showAdd ? ( -
-

No Conduit-wide instructions or files yet.

-

- Add house style, org rules, or a CLAUDE.md / AGENTS.md that every agent should see. +

+

No Conduit-wide components yet.

+

+ Add house style, org rules, or a shared CLAUDE.md / AGENTS.md.

-
) : ( -
+
{mine.length > 0 && ( - <> -
+
+
Mine {mine.length}
{mine.map((item) => ( setShareId(item.id)} /> ))} - +
)} {shared.length > 0 && ( - <> -
- Shared with me {shared.length} +
+
+ Shared {shared.length}
{shared.map((item) => ( setShareId(item.id)} /> ))} - +
)}
)} diff --git a/src/renderer/components/settings/SettingsManager.tsx b/src/renderer/components/settings/SettingsManager.tsx index 8491ca0..37f0619 100644 --- a/src/renderer/components/settings/SettingsManager.tsx +++ b/src/renderer/components/settings/SettingsManager.tsx @@ -1,12 +1,21 @@ -import React, { useState, useEffect } from 'react' -import { Check, Loader2, KeyRound, HardDrive, Trash2, Timer, ShieldCheck } from 'lucide-react' +import React, { useEffect, useState } from 'react' +import { + Check, + HardDrive, + KeyRound, + Loader2, + ScrollText, + Settings2, + Timer, + Trash2, +} from 'lucide-react' import { Button } from '@renderer/components/ui/button' import { Input } from '@renderer/components/ui/input' import { useAgentCredentialStatus, useSetAgentCredential } from '@renderer/hooks/useAgentCredentials' import { useRunnerTimeouts, useSetRunnerTimeout } from '@renderer/hooks/useRunnerTimeouts' import { useDataDirSweep } from '@renderer/hooks/useDataDirSweep' import { useStorageUsage } from '@renderer/hooks/useStorageUsage' -import { formatBytes } from '@renderer/lib/utils' +import { cn, formatBytes } from '@renderer/lib/utils' import type { RunnerType, SweepResult } from '@shared/types' import { PromptComponentManager } from './PromptComponentManager' import { ConfigHealthCard } from './ConfigHealthCard' @@ -19,17 +28,74 @@ 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.', + }, ] +const NAV_ITEMS = [ + { id: 'status', label: 'Status', icon: Settings2 }, + { id: 'agents', label: 'Agents', icon: KeyRound }, + { id: 'defaults', label: 'Defaults', icon: ScrollText }, + { id: 'storage', label: 'Storage', icon: HardDrive }, +] as const + +const NAV_IDS = NAV_ITEMS.map((n) => n.id) + +function scrollToSection(id: string) { + const el = document.getElementById(id) + if (!el) return + el.scrollIntoView({ behavior: 'smooth', block: 'start' }) +} + +function useActiveSection() { + const [active, setActive] = useState<(typeof NAV_IDS)[number]>(NAV_IDS[0]) + + useEffect(() => { + const elements = NAV_IDS + .map((id) => document.getElementById(id)) + .filter((el): el is HTMLElement => Boolean(el)) + if (elements.length === 0) return + + const observer = new IntersectionObserver( + (entries) => { + const visible = entries + .filter((e) => e.isIntersecting) + .sort((a, b) => b.intersectionRatio - a.intersectionRatio) + const id = visible[0]?.target.id + if (id && (NAV_IDS as readonly string[]).includes(id)) { + setActive(id as (typeof NAV_IDS)[number]) + } + }, + { rootMargin: '-15% 0px -55% 0px', threshold: [0.1, 0.35, 0.6] } + ) + + for (const el of elements) observer.observe(el) + return () => observer.disconnect() + }, []) + + return active +} + /** - * 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. + * Dense row for one agent harness: credential + timeout in a single line group. */ -function RunnerSettingsCard({ +function RunnerSettingsRow({ meta, configured, seconds, @@ -38,7 +104,6 @@ function RunnerSettingsCard({ configured: boolean seconds: number }) { - // Credential (API key) state. const [keyValue, setKeyValue] = useState('') const setCredential = useSetAgentCredential() const credBusy = setCredential.isPending @@ -62,13 +127,11 @@ 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]) @@ -86,66 +149,77 @@ function RunnerSettingsCard({ } return ( -
-
-
-
- {meta.label} - - {meta.envVar} - -
-

{meta.hint}

+
+
+
+ {meta.label} + + {configured && } + {configured ? 'On' : 'Off'} +
- - {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 key…'} + autoComplete="off" + className="h-8 flex-1 text-sm" + /> + +
+ {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-20" + aria-label={`${meta.label} background wait seconds`} + title={ + timeoutSupported + ? 'How long to wait for background work. Use 0 for no limit.' + : 'Saved for future CLI support.' + } /> - sec -
@@ -185,74 +270,71 @@ function StorageUsageSummary() { if (usage.isLoading) { return ( -
+
- Calculating storage usage… + Calculating…
) } if (usage.isError || !usage.data) { - return ( -
- Couldn't measure storage usage. -
- ) + return
Couldn't measure storage usage.
} const { totalBytes, reclaimableBytes } = usage.data return ( -
+
- + {formatBytes(totalBytes)} - in use + in use {usage.isFetching && }
{reclaimableBytes > 0 && ( -
- {formatBytes(reclaimableBytes)} reclaimable from finished runs -
+ + {formatBytes(reclaimableBytes)} reclaimable + )}
) } -function StorageMaintenanceCard() { +function StorageMaintenancePanel() { const sweep = useDataDirSweep() return ( -
-
-
-
- -
-
-
Conduit data
- -

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

-
+
+
+
+
Data directory
+ +

+ Reclaim worktrees, temp workspaces, and MCP files from finished runs. Active runs are never + touched. +

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

{sweepSummary(sweep.data)}

+

+ {sweepSummary(sweep.data)} +

)} {sweep.isError && ( -

+

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

)} @@ -260,63 +342,125 @@ function StorageMaintenanceCard() { ) } +function SectionChrome({ + id, + title, + description, + children, +}: { + id: string + title: string + description: string + children: React.ReactNode +}) { + return ( +
+
+

+ {title} +

+

{description}

+
+ {children} +
+ ) +} + export function SettingsManager() { const { data: status } = useAgentCredentialStatus() const { data: timeouts } = useRunnerTimeouts() + const active = useActiveSection() return (
-
-
-
- - Workspace administration +
+
+
+

Settings

+

+ Control center · credentials, defaults, and instance health +

-

Conduit settings

-

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

+ + Ops view +
-
-
- - -
-
-

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. -

-
-
- {RUNNERS.map((meta) => ( - - ))} -
-
- -
- -
- -
-
-

Storage

-

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

-
- -
-
+
+
+ {/* Sticky in-page section nav */} + + +
+ + + +
+
+ Runtime + Credential + Background wait +
+ {RUNNERS.map((meta) => ( + + ))} +
+
+ + + + + + + + +
+
)