Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(desktop): handle missing event log entries gracefully

Steven Enamakel8f6bc3b98a58
diff --git a/app/src/components/desktop/DesktopConnectionPage.tsx b/app/src/components/desktop/DesktopConnectionPage.tsx
index 7b937906a8..25d175ef24 100644
--- a/app/src/components/desktop/DesktopConnectionPage.tsx
+++ b/app/src/components/desktop/DesktopConnectionPage.tsx
@@ -1,15 +1,38 @@
-/** Local desktop automation setup in Connections. Permission truth comes from the core. */
+/**
+ * Connections → Desktop Control. Local desktop automation setup: a master
+ * switch card with the live status chip, the OS permissions it needs, pending
+ * desktop-action approvals, and an access check. Permission truth comes from
+ * the core.
+ */
+import {
+ Activity,
+ Check,
+ ExternalLink,
+ type LucideIcon,
+ Monitor,
+ PersonStanding,
+ RefreshCw,
+ ScreenShare,
+ X,
+} from 'lucide-react';
import { useCallback, useEffect, useState } from 'react';
+import { cn } from '../../lib/cn';
import { useT } from '../../lib/i18n/I18nContext';
import { callCoreRpc, isLocalDesktopHost } from '../../services/coreRpcClient';
import { openUrl } from '../../utils/openUrl';
import SettingsTabbedPage from '../settings/layout/SettingsTabbedPage';
-import { Alert, AlertDescription } from '../ui/Alert';
-import Badge from '../ui/Badge';
-import Button from '../ui/Button';
-import Card from '../ui/Card';
-import Separator from '../ui/Separator';
+import {
+ Alert,
+ AlertDescription,
+ Badge,
+ Button,
+ Card,
+ CenteredLoadingState,
+ Field,
+ Switch,
+} from '../ui';
+import { Spinner } from '../ui/icons';
export interface DesktopStatus {
supported: boolean;
@@ -177,32 +200,36 @@ export default function DesktopConnectionPage() {
}
};
+ const permissionState = (value: string) =>
+ value === 'granted'
+ ? { variant: 'success' as const, label: t('desktop.permissionState.granted') }
+ : value === 'not_required'
+ ? { variant: 'success' as const, label: t('desktop.permissionState.notRequired') }
+ : value === 'denied'
+ ? { variant: 'danger' as const, label: t('desktop.permissionState.denied') }
+ : { variant: 'neutral' as const, label: t('desktop.permissionState.unknown') };
+
const permissionRow = (kind: PermissionKind, value: string) => {
- const label = t(`desktop.permission.${kind}`);
+ const Icon = kind === 'accessibility' ? PersonStanding : ScreenShare;
const url = status && permissionSettingsUrl(kind, status.platform);
- const stateLabel =
- value === 'granted'
- ? t('common.success')
- : value === 'denied'
- ? t('common.error')
- : t('common.notAvailable');
+ const state = permissionState(value);
+ const needsAction = value !== 'granted' && value !== 'not_required' && url;
return (
- <div key={kind} className="flex flex-wrap items-center justify-between gap-3 py-3 first:pt-0">
- <div className="flex flex-wrap items-center gap-3">
- <p className="text-sm font-medium text-content">{label}</p>
- <Badge
- variant={
- value === 'granted' || value === 'not_required'
- ? 'success'
- : value === 'denied'
- ? 'danger'
- : 'neutral'
- }>
- {stateLabel}
- </Badge>
- </div>
- {value !== 'granted' && value !== 'not_required' && url && (
- <Button variant="secondary" size="sm" onClick={() => void openSettings(kind)}>
+ <div
+ key={kind}
+ className="flex flex-wrap items-center gap-3 px-4 py-3"
+ data-testid={`desktop-permission-${kind}`}>
+ <IconTile icon={Icon} />
+ <p className="min-w-0 flex-1 text-sm font-medium text-content">
+ {t(`desktop.permission.${kind}`)}
+ </p>
+ <Badge variant={state.variant}>{state.label}</Badge>
+ {needsAction && (
+ <Button
+ variant="secondary"
+ size="sm"
+ trailingIcon={<ExternalLink className="h-3.5 w-3.5" aria-hidden />}
+ onClick={() => void openSettings(kind)}>
{t('desktop.openSettings')}
</Button>
)}
@@ -210,6 +237,26 @@ export default function DesktopConnectionPage() {
);
};
+ const ready =
+ !!status &&
+ status.enabled &&
+ status.module_state === 'ready' &&
+ status.accessibility === 'granted' &&
+ status.jev_ready;
+ const statusBadge = status?.supported ? (
+ <Badge
+ variant={!status.enabled ? 'neutral' : ready ? 'success' : 'warning'}
+ data-testid="desktop-status-badge">
+ {!status.enabled
+ ? t('common.disabled')
+ : status.module_state === 'failed'
+ ? t('desktop.statusModuleFailed')
+ : ready
+ ? t('channels.status.connected')
+ : t('desktop.statusSetupNeeded')}
+ </Badge>
+ ) : null;
+
return (
<SettingsTabbedPage
title={t('desktop.title')}
@@ -218,6 +265,7 @@ export default function DesktopConnectionPage() {
<Button
variant="secondary"
size="sm"
+ leadingIcon={<RefreshCw className="h-3.5 w-3.5" aria-hidden />}
onClick={() => {
void refresh();
if (status?.enabled && status.approvals_enabled) void refreshPending();
@@ -226,128 +274,151 @@ export default function DesktopConnectionPage() {
{t('common.refresh')}
</Button>
}>
- <div className="max-w-5xl space-y-4" data-testid="desktop-connection-page">
- <Alert variant="warning" role={undefined}>
+ <div className="space-y-4" data-testid="desktop-connection-page">
+ <Alert variant="warning" density="compact" role={undefined}>
<AlertDescription>{t('connections.earlyAlphaNotice')}</AlertDescription>
</Alert>
- <div className="grid gap-4 lg:grid-cols-2">
- <Card
- title={t('desktop.title')}
- padded
- divided={false}
- className={status && !status.supported ? 'lg:col-span-2' : undefined}>
- {loading && <p className="text-sm text-content-muted">{t('common.loading')}</p>}
- {!loading && status && (
- <div className="space-y-4">
- {!status.supported ? (
- <p className="text-sm text-content-secondary">{t('desktop.unsupported')}</p>
- ) : (
- <Badge
- variant={
- !status.enabled
- ? 'neutral'
- : status.module_state === 'ready' &&
- status.accessibility === 'granted' &&
- status.jev_ready
- ? 'success'
- : 'warning'
- }>
- {!status.enabled
- ? t('common.disabled')
- : status.module_state === 'failed'
- ? t('desktop.moduleUnavailable')
- : status.module_state === 'ready' &&
- status.accessibility === 'granted' &&
- status.jev_ready
- ? t('channels.status.connected')
- : t('desktop.enabledPending')}
- </Badge>
- )}
- {status.reason && <p className="text-sm text-content-muted">{status.reason}</p>}
- <p className="text-sm text-content-muted">{t('desktop.localOnly')}</p>
- {status.supported && (
- <Button onClick={() => void setEnabled()} disabled={busy}>
- {status.enabled ? t('common.disable') : t('common.enable')}
- </Button>
- )}
+
+ {loading && !status && <CenteredLoadingState label={t('common.loading')} />}
+
+ {status && !status.supported && (
+ <Alert variant="info" density="compact">
+ <AlertDescription>{t('desktop.unsupported')}</AlertDescription>
+ </Alert>
+ )}
+
+ {/* ── Master switch: on/off, where it stands, and why ────────────── */}
+ {status?.supported && (
+ <Card data-testid="desktop-status-card">
+ <div className="flex items-center gap-3 p-4">
+ <IconTile icon={Monitor} active={status.enabled} size="lg" />
+ <div className="min-w-0 flex-1">
+ <label
+ htmlFor="desktop-enabled-switch"
+ className="flex flex-wrap items-center gap-2 text-sm font-semibold text-content">
+ {t('desktop.enableLabel')}
+ {statusBadge}
+ </label>
+ <p className="mt-0.5 text-xs text-content-muted">{t('desktop.localOnly')}</p>
+ </div>
+ <Switch
+ id="desktop-enabled-switch"
+ checked={status.enabled}
+ disabled={busy}
+ onCheckedChange={() => void setEnabled()}
+ aria-label={status.enabled ? t('common.disable') : t('common.enable')}
+ />
+ </div>
+ {(status.reason || (status.enabled && !ready)) && (
+ <div className="px-4 py-3 text-xs text-content-muted">
+ {status.reason ??
+ (status.module_state === 'failed'
+ ? t('desktop.moduleUnavailable')
+ : t('desktop.enabledPending'))}
</div>
)}
</Card>
+ )}
- {status?.supported && (
- <Card title={t('desktop.permissions')} padded divided={false}>
- {permissionRow('accessibility', status.accessibility)}
- <Separator />
- {permissionRow('screen_recording', status.screen_recording)}
- <p className="pt-3 text-xs text-content-muted">{t('desktop.captureNote')}</p>
- </Card>
- )}
- </div>
+ {/* ── System permissions ─────────────────────────────────────────── */}
+ {status?.supported && (
+ <Card title={t('desktop.permissions')} description={t('desktop.captureNote')}>
+ {permissionRow('accessibility', status.accessibility)}
+ {permissionRow('screen_recording', status.screen_recording)}
+ </Card>
+ )}
{status?.supported && status.enabled && (
<>
+ {/* ── Pending approvals ──────────────────────────────────────── */}
{status.approvals_enabled && pending.length > 0 && (
- <Card title={t('chat.approval.title')} padded divided={false}>
+ <Card
+ title={t('chat.approval.title')}
+ headerRight={<Badge variant="warning">{pending.length}</Badge>}
+ data-testid="desktop-pending-card">
{pending.map(entry => (
<div
key={entry.confirmation_id}
- className="space-y-3 border-b border-line-subtle py-4 last:border-b-0">
- <p className="text-sm font-medium text-content">
- {entry.target_name
- ? t('desktop.approvalSummary')
- .replace(
- '{operation}',
- t(`desktop.action.${entry.operation.toLowerCase()}`, entry.operation)
- )
- .replace('{target}', entry.target_name)
- .replace('{app}', entry.app)
- : t('common.notAvailable')}
- </p>
- <p className="text-sm text-content-muted">{entry.reason}</p>
- <div className="flex gap-2">
- <Button
- size="sm"
- disabled={busy || !entry.action_summary || !entry.target_name}
- onClick={() => void decide(entry.confirmation_id, true)}>
- {t('chat.approval.approve')}
- </Button>
+ className="flex flex-wrap items-center gap-3 px-4 py-3">
+ <div className="min-w-0 flex-1">
+ <p className="text-sm font-medium text-content">
+ {entry.target_name
+ ? t('desktop.approvalSummary')
+ .replace(
+ '{operation}',
+ t(
+ `desktop.action.${entry.operation.toLowerCase()}`,
+ entry.operation
+ )
+ )
+ .replace('{target}', entry.target_name)
+ .replace('{app}', entry.app)
+ : t('common.notAvailable')}
+ </p>
+ <p className="mt-0.5 text-xs text-content-muted">{entry.reason}</p>
+ </div>
+ <div className="flex shrink-0 gap-2">
<Button
size="sm"
variant="secondary"
+ leadingIcon={<X className="h-3.5 w-3.5" aria-hidden />}
disabled={busy}
onClick={() => void decide(entry.confirmation_id, false)}>
{t('chat.approval.deny')}
</Button>
+ <Button
+ size="sm"
+ leadingIcon={<Check className="h-3.5 w-3.5" aria-hidden />}
+ disabled={busy || !entry.action_summary || !entry.target_name}
+ onClick={() => void decide(entry.confirmation_id, true)}>
+ {t('chat.approval.approve')}
+ </Button>
</div>
</div>
))}
</Card>
)}
- <Card title={t('desktop.testButton')} padded divided={false}>
- <div className="flex flex-wrap items-center justify-between gap-4">
- <p className="text-sm text-content-muted">{t('desktop.testDescription')}</p>
- <Button variant="secondary" onClick={() => void runProbe()} disabled={busy}>
- {t('desktop.testButton')}
- </Button>
- </div>
+
+ {/* ── Access check ───────────────────────────────────────────── */}
+ <Card title={t('desktop.checkHeading')}>
+ <Field
+ label={t('desktop.checkLabel')}
+ description={t('desktop.testDescription')}
+ control={
+ <Button
+ variant="secondary"
+ size="sm"
+ leadingIcon={
+ busy ? <Spinner /> : <Activity className="h-3.5 w-3.5" aria-hidden />
+ }
+ onClick={() => void runProbe()}
+ disabled={busy}>
+ {t('desktop.testButton')}
+ </Button>
+ }
+ />
{probe && (
- <Alert variant={probe.ok ? 'success' : 'warning'} role="status" className="mt-4">
- <AlertDescription>
- {probe.ok ? t('desktop.testPassed') : (probe.reason ?? t('desktop.testFailed'))}
- </AlertDescription>
- </Alert>
+ <div className="p-4">
+ <Alert variant={probe.ok ? 'success' : 'warning'} density="compact" role="status">
+ <AlertDescription>
+ {probe.ok
+ ? t('desktop.testPassed')
+ : (probe.reason ?? t('desktop.testFailed'))}
+ </AlertDescription>
+ </Alert>
+ </div>
)}
</Card>
</>
)}
{error && (
- <Alert variant="destructive">
+ <Alert variant="destructive" density="compact">
<AlertDescription>{error}</AlertDescription>
</Alert>
)}
{pendingError && (
- <Alert variant="destructive">
+ <Alert variant="destructive" density="compact">
<AlertDescription>{pendingError}</AlertDescription>
</Alert>
)}
@@ -355,3 +426,25 @@ export default function DesktopConnectionPage() {
</SettingsTabbedPage>
);
}
+
+/** Square icon tile, filled with the primary colour when `active`. */
+function IconTile({
+ icon: Icon,
+ active = false,
+ size = 'md',
+}: {
+ icon: LucideIcon;
+ active?: boolean;
+ size?: 'md' | 'lg';
+}) {
+ return (
+ <span
+ className={cn(
+ 'flex shrink-0 items-center justify-center rounded-lg',
+ size === 'lg' ? 'h-10 w-10' : 'h-8 w-8',
+ active ? 'bg-primary-500 text-content-inverted' : 'bg-surface-muted text-content-secondary'
+ )}>
+ <Icon className={size === 'lg' ? 'h-5 w-5' : 'h-4 w-4'} aria-hidden />
+ </span>
+ );
+}
diff --git a/app/src/components/settings/panels/EventLogPanel.tsx b/app/src/components/settings/panels/EventLogPanel.tsx
index 51667c3cf4..ce228c6310 100644
--- a/app/src/components/settings/panels/EventLogPanel.tsx
+++ b/app/src/components/settings/panels/EventLogPanel.tsx
@@ -2,6 +2,7 @@ import { useEffect, useRef, useState } from 'react';
import { useT } from '../../../lib/i18n/I18nContext';
import { getCoreHttpBaseUrl, getCoreRpcToken } from '../../../services/coreRpcClient';
+import { Badge, type BadgeVariant } from '../../ui';
import Button from '../../ui/Button';
import { SettingsSelect, SettingsTextField } from '../controls';
import SettingsPanel from '../layout/SettingsPanel';
diff --git a/app/src/lib/i18n/en.ts b/app/src/lib/i18n/en.ts
index e4e5c84910..ff2541005c 100644
--- a/app/src/lib/i18n/en.ts
+++ b/app/src/lib/i18n/en.ts
@@ -774,6 +774,15 @@ const en: TranslationMap = {
'desktop.permission.accessibility': 'Accessibility',
'desktop.permission.screen_recording': 'Screen Recording',
'desktop.openSettings': 'Open settings',
+ 'desktop.enableLabel': 'Let the agent control apps',
+ 'desktop.statusSetupNeeded': 'Setup needed',
+ 'desktop.statusModuleFailed': 'Unavailable',
+ 'desktop.permissionState.granted': 'Granted',
+ 'desktop.permissionState.denied': 'Denied',
+ 'desktop.permissionState.notRequired': 'Not required',
+ 'desktop.permissionState.unknown': 'Not determined',
+ 'desktop.checkHeading': 'Access check',
+ 'desktop.checkLabel': 'App visibility',
'desktop.captureNote':
'Screen Recording is needed only for screenshots. Accessibility is needed to inspect and control apps.',
'desktop.testDescription': 'Check that the core can see the apps running on this computer.',
@@ -1351,6 +1360,8 @@ const en: TranslationMap = {
'channels.defaultMessaging': 'Default Messaging Channel',
'channels.setAsDefault': 'Set as default',
'channels.defaultBadge': 'Default',
+ 'channels.connectedDesc': 'Ready to send and receive messages. Pick one as the default.',
+ 'channels.availableDesc': 'Chat apps you can link. Open one to set it up.',
// Webhooks
'webhooks.title': 'Webhooks',
diff --git a/app/src/pages/Skills.tsx b/app/src/pages/Skills.tsx
index 421d5221bd..72bd0f357e 100644
--- a/app/src/pages/Skills.tsx
+++ b/app/src/pages/Skills.tsx
@@ -1,3 +1,4 @@
+import { Check, ChevronRight, Info } from 'lucide-react';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
@@ -42,7 +43,8 @@ import {
import SkillSearchBar from '../components/skills/SkillSearchBar';
import SkillsPage from '../components/skills/SkillsPage';
import VoiceSetupModal from '../components/skills/VoiceSetupModal';
-import Badge from '../components/ui/Badge';
+import { Alert, AlertDescription } from '../components/ui/Alert';
+import Badge, { type BadgeVariant } from '../components/ui/Badge';
import Button from '../components/ui/Button';
import Card from '../components/ui/Card';
import { useVoiceSkillStatus } from '../features/voice/useVoiceSkillStatus';
@@ -83,16 +85,16 @@ function channelStatusLabel(status: ChannelConnectionStatus, t: (key: string) =>
}
}
-function channelStatusColor(status: ChannelConnectionStatus): string {
+function channelStatusVariant(status: ChannelConnectionStatus): BadgeVariant {
switch (status) {
case 'connected':
- return 'text-sage-600 dark:text-sage-300';
+ return 'success';
case 'connecting':
- return 'text-amber-600 dark:text-amber-300';
+ return 'warning';
case 'error':
- return 'text-coral-600 dark:text-coral-300';
+ return 'danger';
default:
- return 'text-content-faint';
+ return 'neutral';
}
}
@@ -291,37 +293,23 @@ function ChannelTile({
}: ChannelTileProps) {
const { t } = useT();
const isConnected = status === 'connected';
- const isPending = status === 'connecting';
- const isError = status === 'error';
const statusLabel = channelStatusLabel(status, t);
const ctaLabel = isConnected ? t('skills.configure') : t('channels.setup');
- // Horizontal tile: icon on the left; name → status → default control stacked
- // on the right. The tile is a container (not one button) so "configure" (the
- // icon + name row) and "set as default" stay distinct, focusable controls —
- // collapsing the old two-selector layout (connect grid + separate picker)
- // into one place. "Set as default" only appears for channels you can actually
- // route through (connected); the default badge still shows on whichever
- // channel is persisted as default, connected or not.
+ // The tile is a container, not one button, so "configure" (icon + name row)
+ // and "set as default" stay distinct, focusable controls. Status is a Badge;
+ // the default channel gets the primary selection border used by every
+ // picker tile in Settings. "Set as default" only appears for channels you
+ // can route through (connected); the Default badge follows the persisted
+ // default whether or not it is currently connected.
const showDefaultControl = isDefault || isConnected;
return (
<div
- className={`group flex flex-col gap-2 rounded-2xl border p-3 transition-colors ${
- isConnected
- ? 'border-sage-300 bg-sage-50/80 shadow-[0_0_0_1px_rgba(34,197,94,0.12)] dark:border-sage-500/30 dark:bg-sage-500/10'
- : isPending
- ? 'border-amber-200 bg-amber-50/40 dark:border-amber-500/30 dark:bg-amber-500/10'
- : isError
- ? 'border-coral-200 bg-coral-50/30 dark:border-coral-500/30 dark:bg-coral-500/10'
- : 'border-line bg-surface'
- } ${
- // The default channel keeps its connection-status colour but gains a
- // primary ring so "which one is the default" reads at a glance without
- // masking whether it is connected.
+ className={`flex h-full flex-col rounded-xl border bg-surface transition-colors ${
isDefault
- ? 'ring-2 ring-primary-400 ring-offset-1 ring-offset-white dark:ring-offset-neutral-900'
- : ''
+ ? 'border-primary-500 ring-1 ring-primary-500'
+ : 'border-line hover:border-line-strong'
}`}>
<Button
type="button"
@@ -331,47 +319,87 @@ function ChannelTile({
onClick={onOpen}
title={`${def.display_name} — ${def.description}`}
aria-label={`${def.display_name}, ${statusLabel}. ${ctaLabel}.`}
- className="h-auto w-full justify-start gap-3 rounded-xl p-0 text-left">
- <div className="relative flex h-10 w-10 shrink-0 items-center justify-center text-content-secondary [&>span]:h-10 [&>span]:w-10 [&>span]:rounded-2xl [&_svg]:h-6 [&_svg]:w-6">
+ className="h-auto w-full justify-start gap-3 rounded-b-none rounded-t-xl px-3 py-3 text-left">
+ <span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-surface-muted text-content-secondary [&>span]:h-9 [&>span]:w-9 [&>span]:rounded-lg [&_svg]:h-5 [&_svg]:w-5">
{icon}
- </div>
- <div className="flex min-w-0 flex-1 flex-col gap-0.5">
- <span className="line-clamp-2 text-xs font-semibold leading-tight text-content">
+ </span>
+ <span className="min-w-0 flex-1">
+ <span className="block truncate text-sm font-semibold text-content">
{def.display_name}
</span>
- <span className={`line-clamp-1 text-[11px] font-medium ${channelStatusColor(status)}`}>
- {statusLabel}
+ <span className="mt-0.5 block truncate text-xs font-normal text-content-muted">
+ {def.description}
</span>
- </div>
+ </span>
+ <ChevronRight className="h-4 w-4 shrink-0 text-content-faint" aria-hidden />
</Button>
- {showDefaultControl && (
- // Aligns under the name/status text (icon 2.5rem + gap 0.75rem).
- <div className="pl-13">
- {isDefault ? (
+ <div className="mt-auto flex min-h-11 items-center justify-between gap-2 border-t border-line-subtle px-3 py-2">
+ <Badge variant={channelStatusVariant(status)}>{statusLabel}</Badge>
+ {showDefaultControl &&
+ (isDefault ? (
<Badge data-testid={setDefaultTestId} variant="primary" dot={false}>
- <svg className="h-3 w-3" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
- <path
- fillRule="evenodd"
- d="M16.704 5.29a1 1 0 010 1.42l-7.5 7.5a1 1 0 01-1.42 0l-3.5-3.5a1 1 0 111.42-1.42l2.79 2.79 6.79-6.79a1 1 0 011.42 0z"
- clipRule="evenodd"
- />
- </svg>
+ <Check className="h-3 w-3" aria-hidden />
{t('channels.defaultBadge')}
</Badge>
) : (
<Button
type="button"
- variant="secondary"
+ variant="tertiary"
size="xs"
data-testid={setDefaultTestId}
onClick={onSetDefault}
- disabled={setDefaultBusy}
- className="text-content-muted hover:border-primary-300 hover:text-primary-600 dark:hover:border-primary-500/40 dark:hover:text-primary-300">
+ disabled={setDefaultBusy}>
{t('channels.setAsDefault')}
</Button>
- )}
- </div>
+ ))}
+ </div>
+ </div>
+ );
+}
+
+/**
+ * Connections → Channels body: connected channels first, then the ones still
+ * to set up, each in its own card with a count, and the Slack pointer as a
+ * quiet note underneath.
+ */
+function ChannelsOverview({
+ defs,
+ statusFor,
+ renderTile,
+}: {
+ defs: ChannelDefinition[];
+ statusFor: (def: ChannelDefinition) => ChannelConnectionStatus;
+ renderTile: (def: ChannelDefinition, status: ChannelConnectionStatus) => React.ReactNode;
+}) {
+ const { t } = useT();
+ const withStatus = defs.map(def => ({ def, status: statusFor(def) }));
+ const connected = withStatus.filter(d => d.status === 'connected');
+ const available = withStatus.filter(d => d.status !== 'connected');
+ const grid = 'grid gap-3 p-4 sm:grid-cols-2 xl:grid-cols-3';
+
+ return (
+ // `skills-channels` is the product-tour anchor for this surface.
+ <div className="space-y-4" data-testid="channels-overview" data-walkthrough="skills-channels">
+ {connected.length > 0 && (
+ <Card
+ title={t('skills.connected')}
+ description={t('channels.connectedDesc')}
+ headerRight={<Badge variant="success">{connected.length}</Badge>}>
+ <div className={grid}>{connected.map(d => renderTile(d.def, d.status))}</div>
+ </Card>
)}
+ {available.length > 0 && (
+ <Card
+ title={t('skills.available')}
+ description={t('channels.availableDesc')}
+ headerRight={<Badge variant="neutral">{available.length}</Badge>}>
+ <div className={grid}>{available.map(d => renderTile(d.def, d.status))}</div>
+ </Card>
+ )}
+ <Alert density="compact">
+ <Info className="h-4 w-4 shrink-0 text-content-muted" aria-hidden />
+ <AlertDescription>{t('channels.connectHelp.slackNote')}</AlertDescription>
+ </Alert>
</div>
);
}
@@ -1222,84 +1250,32 @@ export default function Skills() {
{
<>
{activeTab === 'channels' && channelsGroup && (
- <Card className="animate-fade-up">
- <div className="p-3">
- <div className="px-1 pb-3 pt-1">
- <h2
- className="flex items-center gap-2 text-sm font-semibold text-content"
- data-walkthrough="skills-channels">
- <span className="inline-flex h-6 w-6 items-center justify-center rounded-full bg-surface-subtle">
- <SkillCategoryIcon
- category="Channels"
- className={skillCategoryHeadingClassName('Channels')}
- />
- </span>
- {t('skills.channels')}
- </h2>
- <p className="mt-0.5 text-[11px] leading-relaxed text-content-muted">
- {t('channels.defaultMessaging')}
- </p>
- <p className="mt-1 text-[11px] leading-relaxed text-content-faint">
- {t('channels.connectHelp.slackNote')}
- </p>
- </div>
- {/* One unified surface: each tile shows connection status,
- opens setup/configure on click, and owns the "default
- messaging channel" selection via its footer control.
- Connected channels and not-yet-connected channels are
- rendered as two separate grids (no divider/label) so
- each group occupies its own rows. */}
- {(() => {
- // The built-in web channel needs no connection — treat it
- // as always available so it stays selectable as default.
- const statusFor = (def: ChannelDefinition): ChannelConnectionStatus =>
- def.id === 'web'
- ? 'connected'
- : bestChannelStatus(def.id as ChannelType);
- const renderTile = (def: ChannelDefinition) => {
- const channelId = def.id as ChannelType;
- return (
- <div key={channelId} data-testid={`skill-row-channel-${channelId}`}>
- <ChannelTile
- def={def}
- status={statusFor(def)}
- icon={channelIcons[def.icon]}
- testId={`skill-install-channel-${channelId}`}
- onOpen={() => setChannelModalDef(def)}
- isDefault={
- channelConnections.defaultMessagingChannel === channelId
- }
- onSetDefault={() => void handleSetDefaultChannel(channelId)}
- setDefaultTestId={`channel-select-${channelId}`}
- setDefaultBusy={defaultChannelBusy !== null}
- />
- </div>
- );
- };
- const connected = channelDefs.filter(d => statusFor(d) === 'connected');
- const notConnected = channelDefs.filter(
- d => statusFor(d) !== 'connected'
- );
- const gridStyle = {
- gridTemplateColumns: 'repeat(auto-fill, minmax(13rem, 1fr))',
- };
- return (
- <div className="space-y-2 sm:space-y-3">
- {connected.length > 0 && (
- <div className="grid gap-2 sm:gap-3" style={gridStyle}>
- {connected.map(renderTile)}
- </div>
- )}
- {notConnected.length > 0 && (
- <div className="grid gap-2 sm:gap-3" style={gridStyle}>
- {notConnected.map(renderTile)}
- </div>
- )}
- </div>
- );
- })()}
- </div>
- </Card>
+ <ChannelsOverview
+ defs={channelDefs}
+ statusFor={def =>
+ // The built-in web channel needs no connection, so it
+ // stays selectable as the default.
+ def.id === 'web' ? 'connected' : bestChannelStatus(def.id as ChannelType)
+ }
+ renderTile={(def, status) => {
+ const channelId = def.id as ChannelType;
+ return (
+ <div key={channelId} data-testid={`skill-row-channel-${channelId}`}>
+ <ChannelTile
+ def={def}
+ status={status}
+ icon={channelIcons[def.icon]}
+ testId={`skill-install-channel-${channelId}`}
+ onOpen={() => setChannelModalDef(def)}
+ isDefault={channelConnections.defaultMessagingChannel === channelId}
+ onSetDefault={() => void handleSetDefaultChannel(channelId)}
+ setDefaultTestId={`channel-select-${channelId}`}
+ setDefaultBusy={defaultChannelBusy !== null}
+ />
+ </div>
+ );
+ }}
+ />
)}
{activeTab === 'composio' && (