diff --git a/src/renderer/components/settings/ConfigHealthCard.tsx b/src/renderer/components/settings/ConfigHealthCard.tsx index 328151c..1d7c481 100644 --- a/src/renderer/components/settings/ConfigHealthCard.tsx +++ b/src/renderer/components/settings/ConfigHealthCard.tsx @@ -1,11 +1,8 @@ import React from 'react' import { - Activity, AlertTriangle, ArrowRight, Check, - CheckCircle2, - CircleDashed, GitBranch, KeyRound, Loader2, @@ -20,79 +17,100 @@ import type { ConfigHealthStatus, McpAttentionItem } from '@shared/types' const STATUS_STYLES: Record< ConfigHealthStatus, - { label: string; text: string; border: string; background: string; dot: string } + { label: string; text: string; track: string; fill: string } > = { ok: { - label: 'Ready', - text: 'text-emerald-500', - border: 'border-emerald-500/20', - background: 'bg-emerald-500/[0.07]', - dot: 'bg-emerald-500', + label: 'Done', + text: 'text-emerald-600 dark:text-emerald-400', + track: 'bg-emerald-500/15', + fill: 'bg-emerald-500', }, warn: { - label: 'Action needed', - text: 'text-amber-500', - border: 'border-amber-500/25', - background: 'bg-amber-500/[0.07]', - dot: 'bg-amber-500', + label: 'Needs a quick fix', + text: 'text-amber-600 dark:text-amber-400', + track: 'bg-amber-500/15', + fill: 'bg-amber-500', }, error: { - label: 'Not ready', - text: 'text-red-400', - border: 'border-red-500/25', - background: 'bg-red-500/[0.07]', - dot: 'bg-red-500', + label: 'Blocked', + text: 'text-red-500', + track: 'bg-red-500/15', + fill: 'bg-red-500', }, } -function StatusIcon({ status, pending }: { status: ConfigHealthStatus; pending?: boolean }) { - if (pending) { - return - } +function stepDone(status: ConfigHealthStatus | undefined, pending: boolean): boolean { + return !pending && status === 'ok' +} + +function nextActionCopy( + kind: 'git' | 'encryption' | 'mcps', + status: ConfigHealthStatus | undefined, + message: string, + pending: boolean, + loadError?: string +): string { + if (pending) return 'We are checking this for you…' + if (loadError) return loadError if (status === 'ok') { - return + if (kind === 'git') return 'Git is available for cloning and worktrees.' + if (kind === 'encryption') return 'Secrets can be stored safely.' + return 'Your enabled MCP connections look healthy.' + } + if (kind === 'git') { + return message || 'Install Git on the Conduit host so agents can work with repositories.' } - if (status === 'warn') { - return + if (kind === 'encryption') { + return ( + message || + 'Set or repair CONDUIT_SECRET_KEY so Conduit can encrypt API keys and tokens.' + ) } - return + return message || 'Open MCP settings and reconnect anything that needs attention.' } -function HealthTile({ - icon, - title, - status, - message, +function StepMarker({ + index, + done, pending, - children, + status, }: { - icon: React.ReactNode - title: string + index: number + done: boolean + pending: boolean status: ConfigHealthStatus - message: string - pending?: boolean - children?: React.ReactNode }) { - const style = STATUS_STYLES[status] + if (pending) { + return ( + + + + ) + } + if (done) { + return ( + + + + ) + } + const tone = + status === 'error' + ? 'border-red-500/40 bg-red-500/10 text-red-500' + : 'border-amber-500/40 bg-amber-500/10 text-amber-600 dark:text-amber-400' return ( -
-
-
- {icon} -
- - - {pending ? 'Checking' : style.label} - -
-
-

{title}

-

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

- {children} -
-
+ + {index} + ) } @@ -101,34 +119,118 @@ function McpAttentionList({ items }: { items: McpAttentionItem[] }) { if (items.length === 0) return null return (
- {items.map((item) => ( -
-
- - {item.name} -
-

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

-
- ))} +
    + {items.map((item) => ( +
  • + {item.status === 'unauthorized' ? ( + + ) : ( + + )} +
    +
    {item.name}
    +

    + {item.status === 'unauthorized' + ? 'Sign in again to reconnect this tool.' + : 'This connection failed — check the server URL or credentials.'} + {item.message ? ` ${item.message}` : ''} +

    +
    +
  • + ))} +
) } +function ChecklistStep({ + index, + icon, + title, + plainWhy, + status, + pending, + nextAction, + isLast, + children, +}: { + index: number + icon: React.ReactNode + title: string + plainWhy: string + status: ConfigHealthStatus + pending?: boolean + nextAction: string + isLast?: boolean + children?: React.ReactNode +}) { + const done = stepDone(status, !!pending) + const style = STATUS_STYLES[status] + const stateLabel = pending ? 'Checking' : style.label + + return ( +
  • + {!isLast && ( + + )} + +
    +
    +
    + + {icon} + +
    +

    + Step {index}: + {title} +

    +

    {plainWhy}

    +
    +
    + + {stateLabel} + +
    +

    + {done ? 'You’re set — ' : 'Next: '} + {nextAction} +

    + {children} +
    +
  • + ) +} + export function ConfigHealthCard() { const health = useConfigHealth() const data = health.data @@ -144,61 +246,67 @@ export function ConfigHealthCard() { ? 'error' : 'warn' - const overallCopy = pending - ? 'Checking the services Conduit relies on.' + const checks = [ + { key: 'git' as const, status: data?.git.status }, + { key: 'encryption' as const, status: data?.encryption.status }, + { key: 'mcps' as const, status: data?.mcps.status }, + ] + const completedCount = pending + ? 0 : health.isError - ? `Couldn't load configuration health: ${health.error instanceof Error ? health.error.message : String(health.error)}` - : data?.ok - ? 'Everything Conduit needs is configured and responding.' - : overall === 'warn' - ? 'Conduit can run, but some connections need your attention.' - : 'Resolve the items below before relying on Conduit.' + ? 0 + : checks.filter((c) => c.status === 'ok').length + const totalCount = checks.length + const progressPct = pending ? 12 : Math.round((completedCount / totalCount) * 100) const overallTitle = pending - ? 'Checking Conduit' + ? 'Checking your setup…' : health.isError - ? 'Status unavailable' + ? 'We couldn’t check your setup' : data?.ok - ? 'Conduit is ready' + ? 'Foundation setup complete' : overall === 'warn' - ? 'Conduit needs attention' - : 'Conduit is not fully ready' + ? 'A few setup steps still need you' + : 'Finish these steps before you rely on Conduit' + + const overallCopy = pending + ? 'Hang tight while we confirm Git, encryption, and MCP connections.' + : health.isError + ? `Something went wrong loading status: ${health.error instanceof Error ? health.error.message : String(health.error)}` + : data?.ok + ? 'The core pieces Conduit needs are in place. Next, connect the agent CLIs you plan to use.' + : 'Work through the checklist below — each item explains what to do in plain language.' + + const loadError = + health.isError + ? `Couldn't load this check: ${health.error instanceof Error ? health.error.message : String(health.error)}` + : undefined return ( -
    -
    -
    -
    -
    -
    - {pending ? ( - - ) : overall === 'ok' ? ( - - ) : overall === 'warn' ? ( - - ) : ( - - )} -
    -
    -
    -

    {overallTitle}

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

    {overallCopy}

    -
    +
    +
    +
    +
    +

    + Setup checklist +

    +

    + {overallTitle} +

    +

    {overallCopy}

    + +
    +
    + + {pending + ? 'Progress pending…' + : health.isError + ? 'Progress unavailable' + : `${completedCount} of ${totalCount} foundation checks ready`} + + {!pending && !health.isError && ( + + {STATUS_STYLES[overall].label} + + )} +
    +
    +
    +
    +
    -
    - + } - title="Git" - status={data?.git.status ?? 'ok'} - message={data?.git.message ?? ''} + title="Git on the server" + plainWhy="Needed so Conduit can clone repos and create isolated workspaces for each run." + status={data?.git.status ?? (health.isError ? 'error' : 'ok')} pending={pending} + nextAction={nextActionCopy('git', data?.git.status, data?.git.message ?? '', pending, loadError)} /> - } - title="Encryption" - status={data?.encryption.status ?? 'ok'} - message={data?.encryption.message ?? ''} + title="Secret encryption" + plainWhy="Protects API keys, GitHub App keys, and MCP tokens stored in Conduit." + status={data?.encryption.status ?? (health.isError ? 'error' : 'ok')} pending={pending} + nextAction={nextActionCopy( + 'encryption', + data?.encryption.status, + data?.encryption.message ?? '', + pending, + loadError + )} /> - } - title="MCP connections" - status={data?.mcps.status ?? 'ok'} - message={data?.mcps.message ?? ''} + title="MCP tool connections" + plainWhy="Optional tools your agents can call. Skip if you are not using global MCPs yet." + status={data?.mcps.status ?? (health.isError ? 'error' : 'ok')} pending={pending} + nextAction={nextActionCopy('mcps', data?.mcps.status, data?.mcps.message ?? '', pending, loadError)} + isLast > {data && } - -
    + +
    ) } diff --git a/src/renderer/components/settings/PromptComponentManager.tsx b/src/renderer/components/settings/PromptComponentManager.tsx index 89fa129..054acef 100644 --- a/src/renderer/components/settings/PromptComponentManager.tsx +++ b/src/renderer/components/settings/PromptComponentManager.tsx @@ -300,9 +300,9 @@ export function PromptComponentManager() {
    -

    Run defaults

    -

    - Give every agent the same instructions and workspace files. Only enabled components are added to runs. +

    Shared prompt components

    +

    + Optional instructions and workspace files added to every run. Only enabled components apply.

    - - -
    - setKeyValue(e.target.value)} - onKeyDown={(e) => { - if (e.key === 'Enter') handleSaveKey() - }} - placeholder={configured ? 'Replace existing key…' : 'Paste API key…'} - autoComplete="off" - className="flex-1" + - -
    - {configured && ( - - )} +

    {meta.hint}

    +
    + + {meta.envVar} + + {configured && ( + + + Encrypted for your account + + )} +
    -
    -
    - - Background wait - {!timeoutSupported && ( - - Not applied - + +
    + setKeyValue(e.target.value)} + onKeyDown={(e) => { + if (e.key === 'Enter') handleSaveKey() + }} + placeholder={configured ? 'Replace existing key…' : 'Paste API key…'} + autoComplete="off" + className="flex-1" + /> + +
    + {configured && ( + )} + +
    + + + + Advanced: background wait + {!timeoutSupported && ( + + Not applied yet + + )} + + +

    + {timeoutSupported + ? 'How long to wait for background work. Use 0 for no limit.' + : 'Saved for future CLI support — changing it has no effect today.'} +

    +
    + setTimeoutValue(e.target.value)} + onKeyDown={(e) => { + if (e.key === 'Enter') handleSaveTimeout() + }} + className="w-20" + /> + sec + +
    +
    -

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

    -
    - setTimeoutValue(e.target.value)} - onKeyDown={(e) => { - if (e.key === 'Enter') handleSaveTimeout() - }} - className="w-20" - /> - sec - -
    -
    + )}
    ) } @@ -185,7 +265,7 @@ function StorageUsageSummary() { if (usage.isLoading) { return ( -
    +
    Calculating storage usage…
    @@ -193,25 +273,19 @@ function StorageUsageSummary() { } 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)} - + {formatBytes(totalBytes)} in use {usage.isFetching && }
    {reclaimableBytes > 0 && ( -
    +
    {formatBytes(reclaimableBytes)} reclaimable from finished runs
    )} @@ -223,36 +297,36 @@ function StorageMaintenanceCard() { const sweep = useDataDirSweep() return ( -
    +
    -
    +
    -
    Conduit data
    +
    Disk cleanup

    - Clean up worktrees, temporary workspaces, and MCP files left by finished runs. - Active runs are never touched. + Free space from finished runs. Active work is 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)}

    )} @@ -263,58 +337,103 @@ function StorageMaintenanceCard() { export function SettingsManager() { const { data: status } = useAgentCredentialStatus() const { data: timeouts } = useRunnerTimeouts() + const connectedCount = RUNNERS.filter((m) => status?.[m.runner]).length return (
    -
    -
    - - Workspace administration +
    +
    + + Guided setup
    -

    Conduit settings

    -

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

    + Get Conduit ready +

    +

    + Follow the checklist to confirm the server basics, then add the agent keys you need. + Everything else stays optional until you want it.

    -
    +
    -
    -
    -

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

    +
    +
    + + {connectedCount === RUNNERS.length ? ( + + ) : ( + 4 + )} + +
    +

    + Connect the agents you’ll use +

    +

    + Paste an API key for each CLI you care about. Keys stay encrypted to your account; + you only need the ones you’ll actually run. Open a row to add or replace a key. +

    +

    + {connectedCount} of {RUNNERS.length} connected + {connectedCount === 0 ? ' — start with the CLI you use most.' : '.'} +

    +
    -
    - {RUNNERS.map((meta) => ( - + {RUNNERS.map((meta, i) => ( + ))}
    -
    - -
    - -
    -
    -

    Storage

    -

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

    +
    +

    + Optional · later +

    +

    + Run defaults & storage +

    +

    + These don’t block getting started. Adjust shared prompt defaults or reclaim disk when + you need them.

    - + +
    + +
    +

    Storage

    +

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

    + +
    +