The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
Catalog install card: plugin and skill rows with an Advanced install modal (#119633)
Siddharth Balyan8365cae59462
diff --git a/apps/desktop/src/app/session/hooks/use-session-actions/restore-pending-connection.ts b/apps/desktop/src/app/session/hooks/use-session-actions/restore-pending-connection.tsindex a064f4b55d3..bd6459dfacf 100644--- a/apps/desktop/src/app/session/hooks/use-session-actions/restore-pending-connection.ts+++ b/apps/desktop/src/app/session/hooks/use-session-actions/restore-pending-connection.ts@@ -3,6 +3,7 @@ import {$connectionRequests,clearConnectionRequest,type ConnectionRequest,+ isCatalogKind,normalizeConnectionRequest,setConnectionRequest} from '@/store/connection-request'@@ -57,6 +58,14 @@ export function restorePendingConnectionFromSnapshot(/** Tool row for a pending operation whose `tool.start` event was missed. */export function connectionRequestToolPayload(request: ConnectionRequest): GatewayEventPayload & { name: string } {+ if (request.targets.some(target => isCatalogKind(target.kind))) {+ return {+ args: { action: 'install', items: request.targets.map(target => ({ id: target.name, kind: target.kind })) },+ name: 'manage_catalog',+ tool_id: request.toolCallId+ }+ }+return {args: {action: request.targets[0]?.action ?? (request.targets[0]?.kind === 'connector' ? 'connect' : 'install'),diff --git a/apps/desktop/src/components/assistant-ui/catalog-advanced-dialog.tsx b/apps/desktop/src/components/assistant-ui/catalog-advanced-dialog.tsxnew file mode 100644index 00000000000..66d5ead7f73--- /dev/null+++ b/apps/desktop/src/components/assistant-ui/catalog-advanced-dialog.tsx@@ -0,0 +1,268 @@+import { useStore } from '@nanostores/react'+import { type ReactNode, useState } from 'react'++import { Button } from '@/components/ui/button'+import { Checkbox } from '@/components/ui/checkbox'+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle+} from '@/components/ui/dialog'+import { Input } from '@/components/ui/input'+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'+import { type SetupField, SetupFieldList } from '@/components/ui/setup-field-list'+import { Switch } from '@/components/ui/switch'+import { useI18n } from '@/i18n'+import { ExternalLink } from '@/lib/external-link'+import { cn } from '@/lib/utils'+import { COMMIT_SHA_RE } from '@/store/agent-plugins'+import type { CatalogEntry } from '@/store/connection-request'+import { $profiles, normalizeProfileKey, profileLabel } from '@/store/profile'++interface CatalogAdvancedDialogProps {+ entry: CatalogEntry+ fields: SetupField[]+ /** A skill has no agent/desktop halves, no enable step and no commit pin; it keeps profile and force. */+ kind: 'plugin' | 'skill'+ onCancel: () => void+ /** The `connection.respond` env map (CATALOG-ROW-CONTRACT.md): every value a string. */+ onInstall: (env: Record<string, string>) => void+ open: boolean+}++const CAPTION = 'text-[length:var(--conversation-caption-font-size)]'+const flag = (value: boolean) => (value ? '1' : '0')++/** Files view of a GitHub catalog entry at its pin; other hosts get the repository link only. */+function pluginFilesUrl({ repo, sha, subdir }: CatalogEntry): null | string {+ const base = repo?.replace(/\.git$/, '').replace(/\/+$/, '')++ return base?.startsWith('https://github.com/') && subdir ? `${base}/tree/${sha || 'HEAD'}/${subdir}` : null+}++/** The row's Install with every Plugins-tab control exposed. Its own Install sends the values; the row's+ * Install never reads them, so closing the modal leaves nothing behind. */+export function CatalogAdvancedDialog(props: CatalogAdvancedDialogProps) {+ // Mounted only while open, so every opening starts from the entry's defaults.+ return (+ <Dialog onOpenChange={next => !next && props.onCancel()} open={props.open}>+ {props.open ? <CatalogAdvancedForm {...props} /> : null}+ </Dialog>+ )+}++function CatalogAdvancedForm({ entry, fields, kind, onCancel, onInstall }: CatalogAdvancedDialogProps) {+ const { t } = useI18n()+ const m = t.settings.plugins.installModal+ const copy = t.assistant.catalogInstall+ const profiles = useStore($profiles)+ const [agentHalf, setAgentHalf] = useState(true)+ const [desktopHalf, setDesktopHalf] = useState(entry.hasDesktopHalf)+ const [targetProfile, setTargetProfile] = useState(normalizeProfileKey(entry.targetProfile))+ const [enable, setEnable] = useState(true)+ const [force, setForce] = useState(false)+ const [pin, setPin] = useState(entry.sha ?? '')++ const [credentials, setCredentials] = useState<Record<string, string>>(() =>+ Object.fromEntries(fields.map(field => [field.name, field.secret ? '' : field.default]))+ )++ const pinTrimmed = pin.trim().toLowerCase()+ const pinInvalid = pinTrimmed !== '' && !COMMIT_SHA_RE.test(pinTrimmed)+ const missingCredential = fields.some(field => field.required && !credentials[field.name]?.trim())+ const nothingSelected = !agentHalf && !desktopHalf+ const known = profiles.some(profile => normalizeProfileKey(profile.name) === targetProfile)+ const profileOptions = known ? profiles : [...profiles, { name: targetProfile }]+ const filesUrl = pluginFilesUrl(entry)++ const plugin = kind === 'plugin'++ const install = () =>+ onInstall(+ plugin+ ? {+ ...credentials,+ agent_half: flag(agentHalf),+ ...(entry.hasDesktopHalf ? { desktop_half: flag(desktopHalf) } : {}),+ enable: flag(enable),+ force: flag(force),+ ...(pinTrimmed ? { ref: pinTrimmed } : {}),+ target_profile: targetProfile+ }+ : { ...credentials, force: flag(force), target_profile: targetProfile }+ )++ const profileSelect = (+ <Select disabled={!agentHalf} onValueChange={setTargetProfile} value={targetProfile}>+ <SelectTrigger aria-label={m.profileLabel} className="w-full">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {profileOptions.map(profile => (+ <SelectItem key={profile.name} value={normalizeProfileKey(profile.name)}>+ {profileLabel(profile)}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ )++ return (+ <DialogContent className="w-[min(32rem,calc(100vw-2rem))]" data-slot="catalog-advanced">+ <DialogHeader>+ <DialogTitle className="truncate">{entry.display}</DialogTitle>+ {entry.description ? <DialogDescription>{entry.description}</DialogDescription> : null}+ </DialogHeader>++ <div className="grid max-h-[60vh] gap-4 overflow-y-auto">+ {plugin ? (+ <Section title={m.includesHeading}>+ <div className="grid gap-2 rounded-lg border border-(--ui-stroke-tertiary) px-3 py-2">+ <label className="flex items-start gap-3">+ <Checkbox checked={agentHalf} onCheckedChange={value => setAgentHalf(value === true)} />+ <span className="font-medium text-foreground">{m.agentLabel}</span>+ </label>+ <label className="grid gap-1 pl-7">+ <span className={cn(CAPTION, 'text-foreground')}>{m.profileLabel}</span>+ {profileSelect}+ </label>+ </div>+ {entry.hasDesktopHalf ? (+ <label className="flex items-start gap-3 rounded-lg border border-(--ui-stroke-tertiary) px-3 py-2">+ <Checkbox checked={desktopHalf} onCheckedChange={value => setDesktopHalf(value === true)} />+ <span className="font-medium text-foreground">{m.desktopLabel}</span>+ </label>+ ) : null}+ {nothingSelected ? <p className={cn(CAPTION, 'text-destructive')}>{m.selectComponent}</p> : null}+ </Section>+ ) : (+ <label className="grid gap-1">+ <span className={cn(CAPTION, 'text-foreground')}>{m.profileLabel}</span>+ {profileSelect}+ </label>+ )}++ <div className="grid gap-3">+ {plugin ? (+ <label className="flex items-center justify-between gap-3">+ <span className={cn(CAPTION, 'text-foreground')}>{m.enableAgent}</span>+ <Switch checked={enable} disabled={!agentHalf} onCheckedChange={setEnable} />+ </label>+ ) : null}+ <label className="flex items-center justify-between gap-3">+ <span className={cn(CAPTION, 'text-foreground')}>{m.forceReinstall}</span>+ <Switch checked={force} onCheckedChange={setForce} />+ </label>+ {plugin ? (+ <label className="grid gap-1">+ <span className={cn(CAPTION, 'text-foreground')}>{m.pinToCommit}</span>+ <Input+ aria-invalid={pinInvalid || undefined}+ aria-label={m.pinToCommit}+ className="font-mono"+ disabled={!agentHalf}+ onChange={event => setPin(event.target.value)}+ placeholder={m.pinToCommitPlaceholder}+ spellCheck={false}+ value={pin}+ />+ <span className={cn(CAPTION, pinInvalid ? 'text-destructive' : 'text-(--ui-text-tertiary)')}>+ {pinInvalid ? m.pinToCommitInvalid : m.pinToCommitHint}+ </span>+ </label>+ ) : null}+ </div>++ {entry.repo ? (+ <Section title={m.sourceHeading}>+ <Facts+ rows={[+ [m.repoLabel, entry.repo],+ [copy.commitLabel, entry.sha?.slice(0, 12)],+ [copy.subdirLabel, entry.subdir]+ ]}+ />+ <div className={cn(CAPTION, 'flex flex-wrap gap-x-4 gap-y-1')}>+ <ExternalLink href={entry.repo} showExternalIcon>+ {m.viewRepository}+ </ExternalLink>+ {filesUrl ? (+ <ExternalLink href={filesUrl} showExternalIcon>+ {m.viewPluginFiles}+ </ExternalLink>+ ) : null}+ </div>+ </Section>+ ) : null}++ {entry.scan || entry.requirements.length > 0 ? (+ <Section title={copy.securityHeading}>+ {entry.scan ? (+ <p className={cn(CAPTION, SCAN_TONE[entry.scan.status])}>+ {copy.scan[entry.scan.status]}+ {entry.scan.summary ? ` · ${entry.scan.summary}` : ''}+ </p>+ ) : null}+ {entry.requirements.length > 0 ? (+ <Facts mono={false} rows={[[copy.requirementsLabel, entry.requirements.join(', ')]]} />+ ) : null}+ </Section>+ ) : null}++ {fields.length > 0 ? (+ <Section title={copy.credentialsHeading}>+ <SetupFieldList+ draft={credentials}+ fields={fields}+ onChange={(name, value) => setCredentials(current => ({ ...current, [name]: value }))}+ />+ </Section>+ ) : null}+ </div>++ <DialogFooter>+ <Button onClick={onCancel} variant="outline">+ {t.common.cancel}+ </Button>+ <Button disabled={pinInvalid || nothingSelected || missingCredential} onClick={install}>+ {copy.install}+ </Button>+ </DialogFooter>+ </DialogContent>+ )+}++const SCAN_TONE = {+ failed: 'text-destructive',+ passed: 'text-emerald-600 dark:text-emerald-400',+ warnings: 'text-amber-600 dark:text-amber-400'+} as const++function Section({ children, title }: { children: ReactNode; title: string }) {+ return (+ <section className="grid gap-2">+ <h3 className={cn(CAPTION, 'font-medium text-foreground')}>{title}</h3>+ {children}+ </section>+ )+}++/** Read-only provenance as a two-column table; empty values are left out. The label column is fixed so+ * Source and Security line up. */+function Facts({ mono = true, rows }: { mono?: boolean; rows: [string, null | string | undefined][] }) {+ return (+ <dl className={cn(CAPTION, 'grid grid-cols-[5.5rem_minmax(0,1fr)] gap-x-3 gap-y-1')}>+ {rows+ .filter((row): row is [string, string] => Boolean(row[1]))+ .map(([label, value]) => (+ <div className="contents" key={label}>+ <dt className="text-(--ui-text-tertiary)">{label}</dt>+ <dd className={cn('text-foreground', mono ? 'break-all font-mono' : 'wrap-anywhere')}>{value}</dd>+ </div>+ ))}+ </dl>+ )+}diff --git a/apps/desktop/src/components/assistant-ui/catalog-install-tool.test.tsx b/apps/desktop/src/components/assistant-ui/catalog-install-tool.test.tsxnew file mode 100644index 00000000000..1c4563f1967--- /dev/null+++ b/apps/desktop/src/components/assistant-ui/catalog-install-tool.test.tsx@@ -0,0 +1,256 @@+import type { ToolCallMessagePartProps } from '@assistant-ui/react'+import type { ConnectionOperationTarget, ConnectionRequestPayload } from '@hermes/shared'+import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'+import { atom } from 'nanostores'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'++import { type SessionView, SessionViewProvider } from '@/app/chat/session-view'+import { CatalogInstallTool } from '@/components/assistant-ui/catalog-install-tool'+import { I18nProvider } from '@/i18n'+import {+ $connectionRequests,+ applyOperationStatus,+ normalizeConnectionRequest,+ setConnectionRequest+} from '@/store/connection-request'+import { $gateway, setPrimaryGateway, setPrimaryGatewayConnectionId } from '@/store/gateway'+import { $profiles } from '@/store/profile'+import { setSessionOwnerHint } from '@/store/session'++const SESSION_ID = 'session-1'+const SHA = '5023f3a4ea5023f3a4ea5023f3a4ea5023f3a4ea'++const NVIDIA_APP: ConnectionOperationTarget = {+ action: 'install',+ description: 'Read driver and overlay state, optimise games, capture the overlay.',+ display: 'NVIDIA App',+ has_desktop_half: false,+ kind: 'plugin',+ name: 'nvidia-app',+ platforms: ['windows'],+ repo: 'https://github.com/NousResearch/hermes-nvidia',+ sha: SHA,+ state: 'pending',+ subdir: 'nvidia-app',+ target_profile: 'default',+ tier: 'official'+}++const OBSIDIAN: ConnectionOperationTarget = {+ action: 'install',+ description: 'Read, search and write notes in your vault.',+ display: 'Obsidian notes',+ kind: 'skill',+ name: 'obsidian-notes',+ state: 'pending',+ target_profile: 'default',+ tier: 'community'+}++const PAYLOAD: ConnectionRequestPayload = {+ deadline_at: 1_800_000_000,+ op_id: 'operation-1',+ seq: 1,+ targets: [NVIDIA_APP, OBSIDIAN],+ timeout_seconds: 600,+ tool_call_id: 'catalog-call-1'+}++const ARGS = {+ action: 'install',+ items: [+ { id: 'nvidia-app', kind: 'plugin' },+ { id: 'obsidian-notes', kind: 'skill' }+ ]+}++const PROPS: ToolCallMessagePartProps = {+ addResult: vi.fn(),+ args: ARGS,+ argsText: JSON.stringify(ARGS),+ isError: false,+ respondToApproval: vi.fn(),+ resume: vi.fn(),+ status: { type: 'running' },+ toolCallId: 'catalog-call-1',+ toolName: 'manage_catalog',+ type: 'tool-call'+}++function view(sessionId: string): SessionView {+ return {+ $awaitingResponse: atom(false),+ $busy: atom(false),+ $cwd: atom(''),+ $fast: atom(false),+ $lastVisibleIsUser: atom(false),+ $messages: atom([]),+ $messagesEmpty: atom(false),+ $model: atom(''),+ $provider: atom(''),+ $reasoningEffort: atom(''),+ $reasoningEffortWire: atom(''),+ $runtimeId: atom(sessionId),+ $storedId: atom(sessionId),+ $turnStartedAt: atom(null),+ kind: 'primary'+ }+}++/** Open the card from a wire payload, as the `connection.request` handler does. */+function openCard(payload: ConnectionRequestPayload = PAYLOAD) {+ const request = normalizeConnectionRequest(payload, SESSION_ID)++ if (!request) {+ throw new Error('fixture payload did not normalize')+ }++ setConnectionRequest(request)++ return render(+ <I18nProvider configClient={null} initialLocale="en">+ <SessionViewProvider value={view(SESSION_ID)}>+ <div data-testid="catalog">+ <CatalogInstallTool {...PROPS} />+ </div>+ </SessionViewProvider>+ </I18nProvider>+ )+}++/** Move the open operation to a newer snapshot, as `connection.update` does. */+function pushFrame(targets: ConnectionOperationTarget[], seq: number) {+ const current = $connectionRequests.get()[SESSION_ID]+ const status = { deadline_at: 1_800_000_000, op_id: 'operation-1', seq, settled: false, targets }++ act(() => setConnectionRequest(applyOperationStatus(current, status)))+}++const row = (name: string) => {+ const node = screen.getByTestId('catalog').querySelector<HTMLElement>(`[data-connector-row="${name}"]`)++ if (!node) {+ throw new Error(`no row ${name}`)+ }++ return within(node)+}++let rpc: ReturnType<typeof vi.fn>++beforeEach(() => {+ // Radix Select scrolls the chosen option into view; jsdom has no layout.+ Object.defineProperty(Element.prototype, 'scrollIntoView', { configurable: true, value: vi.fn() })+ rpc = vi.fn().mockResolvedValue({ settled: false, status: 'ok' })+ setSessionOwnerHint(SESSION_ID, { connectionId: 'local', profile: 'default' })+ // SAFETY: the card calls only `request`; the rest of the client is never touched in this test.+ setPrimaryGateway({ request: rpc } as never)+ setPrimaryGatewayConnectionId('local')+ $profiles.set([+ {+ has_env: false,+ is_default: true,+ model: null,+ name: 'default',+ path: '/p/default',+ provider: null,+ skill_count: 0+ },+ { has_env: false, is_default: false, model: null, name: 'work', path: '/p/work', provider: null, skill_count: 0 }+ ])+})++afterEach(() => {+ cleanup()+ $connectionRequests.set({})+ $gateway.set(null)+ setPrimaryGateway(null)+ vi.clearAllMocks()+})++const respondedWith = (targets: unknown[]) => [+ 'connection.respond',+ { op_id: 'operation-1', owner: { session_id: SESSION_ID, type: 'session' }, result: { targets } }+]++describe('the catalog install card', () => {+ it('draws plugin and skill rows as catalog items with their purpose, and a platform only when restricted', () => {+ openCard()++ expect(screen.getByTestId('catalog').querySelectorAll('[data-connector-row]')).toHaveLength(2)+ expect(row('nvidia-app').getByText('plugin')).toBeTruthy()+ expect(row('nvidia-app').getByText(NVIDIA_APP.description!)).toBeTruthy()+ expect(row('nvidia-app').getByText('Windows')).toBeTruthy()+ expect(row('obsidian-notes').getByText('skill')).toBeTruthy()+ expect(row('obsidian-notes').getByText(OBSIDIAN.description!)).toBeTruthy()+ expect(row('obsidian-notes').queryByText('Windows')).toBeNull()+ })++ it('sends defaults from the row, the modal values from Advanced, and nothing on Cancel', async () => {+ openCard()++ fireEvent.click(row('obsidian-notes').getByRole('button', { name: 'Install' }))+ await waitFor(() => expect(rpc).toHaveBeenCalledTimes(1))+ expect(rpc).toHaveBeenLastCalledWith(...respondedWith([{ env: null, name: 'obsidian-notes', status: 'approved' }]))++ fireEvent.click(row('nvidia-app').getByRole('button', { name: 'Advanced' }))+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }))+ expect(screen.queryByRole('dialog')).toBeNull()+ expect(rpc).toHaveBeenCalledTimes(1)++ fireEvent.click(row('nvidia-app').getByRole('button', { name: 'Advanced' }))+ const dialog = within(screen.getByRole('dialog'))+ fireEvent.click(dialog.getByRole('combobox', { name: 'Install for profile' }))+ fireEvent.click(await screen.findByRole('option', { name: 'work' }))+ fireEvent.click(dialog.getByRole('switch', { name: /Force reinstall/ }))+ fireEvent.click(dialog.getByRole('button', { name: 'Install' }))++ await waitFor(() => expect(rpc).toHaveBeenCalledTimes(2))+ expect(rpc).toHaveBeenLastCalledWith(+ ...respondedWith([+ {+ env: { agent_half: '1', enable: '1', force: '1', ref: SHA, target_profile: 'work' },+ name: 'nvidia-app',+ status: 'approved'+ }+ ])+ )+ })++ it('settles each row to its outcome and retries only the failed one', async () => {+ const tools = Array.from({ length: 12 }, (_, index) => `nvapp_client_tool_${index}`)++ openCard({+ ...PAYLOAD,+ targets: [NVIDIA_APP, { ...NVIDIA_APP, display: 'NVIDIA Broadcast', name: 'nvidia-broadcast' }, OBSIDIAN]+ })+ pushFrame(+ [+ { ...NVIDIA_APP, state: 'connected', tools },+ {+ ...NVIDIA_APP,+ detail: 'NVIDIA Broadcast is not running',+ display: 'NVIDIA Broadcast',+ name: 'nvidia-broadcast',+ state: 'failed'+ },+ { ...OBSIDIAN, state: 'skipped' }+ ],+ 2+ )++ expect(row('nvidia-app').getByText(/Installed · 12 tools/)).toBeTruthy()+ expect(row('nvidia-app').queryByText('nvapp_client_tool_0')).toBeNull()+ fireEvent.click(row('nvidia-app').getByRole('button', { name: 'show names' }))+ expect(row('nvidia-app').getByText('nvapp_client_tool_0')).toBeTruthy()+ expect(row('nvidia-broadcast').getByText(/NVIDIA Broadcast is not running/)).toBeTruthy()+ expect(row('obsidian-notes').getByText('Skipped')).toBeTruthy()+ expect(row('obsidian-notes').queryByRole('button')).toBeNull()++ fireEvent.click(row('nvidia-broadcast').getByRole('button', { name: 'Try again' }))+ await waitFor(() => expect(rpc).toHaveBeenCalledTimes(1))+ expect(rpc).toHaveBeenLastCalledWith(+ ...respondedWith([{ env: null, name: 'nvidia-broadcast', status: 'approved' }])+ )+ })+})diff --git a/apps/desktop/src/components/assistant-ui/catalog-install-tool.tsx b/apps/desktop/src/components/assistant-ui/catalog-install-tool.tsxnew file mode 100644index 00000000000..8a265119b78--- /dev/null+++ b/apps/desktop/src/components/assistant-ui/catalog-install-tool.tsx@@ -0,0 +1,323 @@+import type { ToolCallMessagePartProps } from '@assistant-ui/react'+import { useStore } from '@nanostores/react'+import { useMemo, useRef, useState } from 'react'++import { useSessionView } from '@/app/chat/session-view'+import { CatalogAdvancedDialog } from '@/components/assistant-ui/catalog-advanced-dialog'+import {+ connectionRequestOwnsPart,+ CONNECTOR_CARD_PHASES,+ useConnectorFocusHandoff+} from '@/components/assistant-ui/connector-tool'+import { ToolFallback } from '@/components/assistant-ui/tool/fallback'+import { WIDGET_SHELL_CLASS } from '@/components/chat/widget-shell'+import { Button } from '@/components/ui/button'+import { Progress } from '@/components/ui/progress'+import { useI18n } from '@/i18n'+import { Book, Loader2, Plug } from '@/lib/icons'+import { cn } from '@/lib/utils'+import {+ type CatalogEntry,+ type ConnectionRequest,+ type ConnectionTarget,+ continueConnectionRequest,+ respondToConnectionRequest,+ sessionConnectionRequest+} from '@/store/connection-request'+import { notifyError } from '@/store/notifications'+import { profileLabel } from '@/store/profile'++type CatalogCopy = ReturnType<typeof useI18n>['t']['assistant']['catalogInstall']+type CatalogTarget = ConnectionTarget & { catalog: CatalogEntry; kind: 'plugin' | 'skill' }++const SHELL_CLASS = `${WIDGET_SHELL_CLASS} text-[length:var(--conversation-text-font-size)] text-(--ui-text-primary)`+const CAPTION = 'text-[length:var(--conversation-caption-font-size)] leading-(--conversation-caption-line-height)'+const PILL = 'inline-flex items-center rounded-full px-1.5 py-0.5 text-[0.62rem] font-medium leading-[0.93rem]'++const KIND_GLYPH = { plugin: Plug, skill: Book } as const++const PLATFORM_NAMES: Record<string, string> = { darwin: 'macOS', linux: 'Linux', macos: 'macOS', windows: 'Windows' }+const platformName = (platform: string) => PLATFORM_NAMES[platform.toLowerCase()] ?? platform++const isCatalogTarget = (target: ConnectionTarget): target is CatalogTarget => Boolean(target.catalog)++/** `manage_catalog`: the host's catalog-install card. The model named ids; every word on a row is the+ * host's resolution of that id. The card lives on the tool row that opened the operation only. */+export function CatalogInstallTool(props: ToolCallMessagePartProps) {+ const { t } = useI18n()+ const view = useSessionView()+ const runtimeId = useStore(view.$runtimeId)+ const $request = useMemo(() => sessionConnectionRequest(runtimeId), [runtimeId])+ const request = useStore($request)++ if (request && connectionRequestOwnsPart(props, request)) {+ return <CatalogInstallCard request={request} />+ }++ // `tool.start` arrives before `connection.request`; a finished call with no card is plain history.+ if (props.result !== undefined || props.status?.type !== 'running') {+ return <ToolFallback {...props} />+ }++ return (+ <div className={cn(SHELL_CLASS, 'my-1.5 flex max-w-lg items-center gap-2')} data-slot="connector-card">+ <Loader2 aria-hidden className="size-4 animate-spin text-(--ui-text-tertiary) motion-reduce:animate-none" />+ <span className="text-(--ui-text-tertiary)">{t.assistant.catalogInstall.preparing}</span>+ </div>+ )+}++export function CatalogInstallCard({ request }: { request: ConnectionRequest }) {+ const { t } = useI18n()+ const cardRef = useRef<HTMLDivElement | null>(null)+ const rows = request.targets.filter(isCatalogTarget)+ const unresolved = rows.some(target => !CONNECTOR_CARD_PHASES[target.state].resolved)+ const profile = rows[0]?.catalog.targetProfile ?? 'default'++ useConnectorFocusHandoff(request.targets, cardRef)++ return (+ <div className="my-2 grid min-w-0 max-w-lg gap-4.5" data-catalog-card data-connector-offer ref={cardRef}>+ {rows.map(target => (+ <CatalogRow key={target.name} request={request} target={target} />+ ))}+ <div className="flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 px-3.5">+ {unresolved && !request.settled ? (+ <Button onClick={() => void continueConnectionRequest(request)} size="xs" variant="textStrong">+ {t.common.continue}+ </Button>+ ) : null}+ <span className={cn(CAPTION, 'text-(--ui-text-tertiary)')}>+ {t.assistant.catalogInstall.targetProfile(profileLabel({ name: profile }))}+ </span>+ </div>+ </div>+ )+}++interface CatalogRowProps {+ request: ConnectionRequest+ target: CatalogTarget+}++/** One catalog item: what it is, what the agent can do with it, and one decision. */+export function CatalogRow({ request, target }: CatalogRowProps) {+ const { t } = useI18n()+ const copy = t.assistant.catalogInstall+ const { catalog } = target+ const [advancedOpen, setAdvancedOpen] = useState(false)+ // The operation's seq when an answer was sent; the verbs stay held until a newer frame answers it,+ // so a second click cannot send the answer twice.+ const [sentAtSeq, setSentAtSeq] = useState<null | number>(null)+ const sending = sentAtSeq !== null && request.seq <= sentAtSeq+ const Glyph = KIND_GLYPH[target.kind]++ const answer = async (status: 'approved' | 'skipped', env: Record<string, string> | null = null) => {+ setSentAtSeq(request.seq)++ try {+ const sent = await respondToConnectionRequest(request, { targets: [{ env, name: target.name, status }] })++ if (!sent) {+ setSentAtSeq(null)+ }+ } catch (error) {+ notifyError(error, copy.sendFailed)+ setSentAtSeq(null)+ }+ }++ return (+ <div className={cn(SHELL_CLASS, 'grid min-w-0 gap-1.5')} data-connector-row={target.name} tabIndex={-1}>+ <div className="flex min-w-0 items-start gap-3">+ <span+ aria-hidden+ className="grid size-10 shrink-0 place-items-center rounded-xl bg-(--ui-bg-quaternary) text-(--ui-text-secondary)"+ >+ <Glyph className="size-5" stroke={1.75} />+ </span>+ <div className="grid min-w-0 flex-1 gap-0.5">+ <div className="flex min-w-0 flex-wrap items-baseline gap-x-1.5 gap-y-1">+ <span className="font-medium leading-4.5 wrap-anywhere">{catalog.display}</span>+ <span className={cn(PILL, 'bg-(--ui-bg-quaternary) text-muted-foreground')}>{copy.kind[target.kind]}</span>+ {catalog.tier ? (+ <span className={cn(PILL, 'bg-(--ui-bg-quaternary) text-muted-foreground')}>+ {copy.tier[catalog.tier]}+ </span>+ ) : null}+ {catalog.platforms.map(platform => (+ <span className={cn(PILL, 'bg-primary/8 text-primary')} key={platform}>+ {platformName(platform)}+ </span>+ ))}+ </div>+ {catalog.description ? (+ <p className="leading-4.5 text-(--ui-text-secondary) wrap-anywhere">{catalog.description}</p>+ ) : null}+ </div>+ </div>++ <div className="min-w-0 pl-13">+ <RowOutcome+ copy={copy}+ onAdvanced={() => setAdvancedOpen(true)}+ onInstall={() => void answer('approved')}+ onSkip={() => void answer('skipped')}+ retryLabel={t.connectors.retry}+ sending={sending}+ settled={request.settled}+ skippedLabel={t.connectors.skipped}+ target={target}+ toolCount={t.assistant.mcpSetup.toolCount}+ />+ </div>++ <CatalogAdvancedDialog+ entry={catalog}+ fields={target.requiredEnv}+ kind={target.kind}+ onCancel={() => setAdvancedOpen(false)}+ onInstall={env => {+ setAdvancedOpen(false)+ void answer('approved', env)+ }}+ open={advancedOpen}+ />+ </div>+ )+}++interface RowOutcomeProps {+ copy: CatalogCopy+ onAdvanced: () => void+ onInstall: () => void+ onSkip: () => void+ retryLabel: string+ sending: boolean+ skippedLabel: string+ settled: boolean+ target: CatalogTarget+ toolCount: (count: number) => string+}++/** The third line: the verbs while the row waits on the user, else what happened to it. */+function RowOutcome({+ copy,+ onAdvanced,+ onInstall,+ onSkip,+ retryLabel,+ sending,+ settled,+ skippedLabel,+ target,+ toolCount+}: RowOutcomeProps) {+ const [namesOpen, setNamesOpen] = useState(false)++ if (target.state === 'connected') {+ const { skill } = target.catalog++ const parts = [+ copy.installed,+ target.tools.length > 0 ? toolCount(target.tools.length) : '',+ skill ? copy.skill(skill) : ''+ ]++ return (+ <div className="grid min-w-0 gap-1">+ <p className={cn(CAPTION, 'text-emerald-600 dark:text-emerald-400')} role="status">+ {parts.filter(Boolean).join(' · ')}+ {target.tools.length > 0 ? (+ <>+ {' · '}+ <button+ aria-expanded={namesOpen}+ className="underline-offset-2 hover:underline"+ onClick={() => setNamesOpen(open => !open)}+ type="button"+ >+ {namesOpen ? copy.hideNames : copy.showNames}+ </button>+ </>+ ) : null}+ </p>+ {namesOpen ? (+ <ul className="flex min-w-0 flex-wrap gap-x-3 gap-y-0.5 font-mono text-[0.6875rem] leading-4 text-(--ui-text-secondary)">+ {target.tools.map(tool => (+ <li className="min-w-0 break-all" key={tool}>+ {tool}+ </li>+ ))}+ </ul>+ ) : null}+ </div>+ )+ }++ if (target.state === 'failed' || target.state === 'expired') {+ return (+ <div className="flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1">+ <p className={cn(CAPTION, 'min-w-0 text-destructive wrap-anywhere')} role="status">+ {target.detail ? `${copy.failed} · ${target.detail}` : copy.failed}+ </p>+ {settled ? null : (+ <Button+ className="h-6 px-1.5 text-(--ui-text-tertiary)"+ disabled={sending}+ loading={sending}+ onClick={onInstall}+ size="xs"+ variant="ghost"+ >+ {retryLabel}+ </Button>+ )}+ </div>+ )+ }++ if (target.state === 'skipped') {+ return (+ <p className={cn(CAPTION, 'text-(--ui-text-tertiary)')} role="status">+ {skippedLabel}+ </p>+ )+ }++ if (settled) {+ return <p className={cn(CAPTION, 'text-(--ui-text-tertiary)')}>{copy.notInstalled}</p>+ }++ if (target.state === 'initiated' || sending) {+ return (+ <div className="grid min-w-0 gap-1.5" role="status">+ <p className={cn(CAPTION, 'text-(--ui-text-tertiary) wrap-anywhere')}>+ {target.state === 'initiated' && target.detail ? target.detail : copy.installing}+ </p>+ <Progress animated aria-label={copy.installing} className="h-0.5 bg-primary/15" indeterminate />+ </div>+ )+ }++ return (+ <div className="flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1">+ <span className="inline-flex h-6 items-stretch overflow-hidden rounded-md border border-primary/25 bg-primary/10 text-primary">+ <Button+ className="h-full rounded-none px-2 text-xs font-medium text-primary hover:bg-primary/15 hover:text-primary"+ onClick={onInstall}+ size="xs"+ variant="ghost"+ >+ {copy.install}+ </Button>+ </span>+ <Button className="h-6 px-1.5 text-(--ui-text-tertiary)" onClick={onAdvanced} size="xs" variant="ghost">+ {copy.advanced}+ </Button>+ <Button className="h-6 px-1.5 text-(--ui-text-tertiary)" onClick={onSkip} size="xs" variant="ghost">+ {copy.skip}+ </Button>+ </div>+ )+}diff --git a/apps/desktop/src/components/assistant-ui/thread/message-parts.tsx b/apps/desktop/src/components/assistant-ui/thread/message-parts.tsxindex 87ed5c9324a..e0a0afa7978 100644--- a/apps/desktop/src/components/assistant-ui/thread/message-parts.tsx+++ b/apps/desktop/src/components/assistant-ui/thread/message-parts.tsx@@ -9,6 +9,7 @@ import {import { useStore } from '@nanostores/react'import { type ComponentProps, type FC, type ReactNode, useEffect, useRef, useState } from 'react'+import { CatalogInstallTool } from '@/components/assistant-ui/catalog-install-tool'import { ClarifyTool } from '@/components/assistant-ui/clarify-tool'import { ConnectorExecution, ConnectorTool } from '@/components/assistant-ui/connector-tool'import { MarkdownText, MarkdownTextContent } from '@/components/assistant-ui/markdown-text'@@ -121,6 +122,10 @@ const ChainToolFallback: FC<TimelineToolCallProps> = props => {)}+ if (props.toolName === 'manage_catalog') {+ return <CatalogInstallTool {...props} />+ }+if (mcpTargets(props.toolName, props.args).length > 0) {return <McpSetupTool {...props} />}diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.tsindex 8634a22d43e..e7527c732bf 100644--- a/apps/desktop/src/i18n/ar.ts+++ b/apps/desktop/src/i18n/ar.ts@@ -2929,6 +2929,29 @@ export const ar = defineLocale({}},assistant: {+ catalogInstall: {+ preparing: 'جارٍ تجهيز التثبيت…',+ install: 'تثبيت',+ advanced: 'خيارات متقدمة',+ skip: 'تخطٍّ',+ installing: 'جارٍ التثبيت…',+ installed: 'مثبّت',+ notInstalled: 'غير مثبّت',+ failed: 'فشل',+ showNames: 'إظهار الأسماء',+ hideNames: 'إخفاء الأسماء',+ skill: name => `المهارة ${name}`,+ kind: { plugin: 'إضافة', skill: 'مهارة' },+ tier: { official: 'رسمي', community: 'مجتمعي' },+ targetProfile: profile => `يُثبَّت في ملفك الشخصي ${profile}`,+ sendFailed: 'تعذّر إرسال ردك. حاول مرة أخرى.',+ commitLabel: 'الإيداع',+ subdirLabel: 'المجلد',+ securityHeading: 'الأمان',+ scan: { passed: 'نجح الفحص', warnings: 'وجد الفحص تحذيرات', failed: 'فشل الفحص' },+ requirementsLabel: 'المتطلبات',+ credentialsHeading: 'بيانات الاعتماد'+ },thread: {loadingSession: 'جار تحميل الجلسة...',showEarlier: 'عرض الرسائل الأقدم',diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 5ba67d7d913..a84166f530f 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -4599,6 +4599,29 @@ export const en: Translations = {lateAnswerTip: 'Draft this answer as a follow-up message',lateAnswerHint: 'This prompt is no longer waiting. Pick an option to draft it as a follow-up message.'},+ catalogInstall: {+ preparing: 'Preparing the install…',+ install: 'Install',+ advanced: 'Advanced',+ skip: 'Skip',+ installing: 'Installing…',+ installed: 'Installed',+ notInstalled: 'Not installed',+ failed: 'Failed',+ showNames: 'show names',+ hideNames: 'hide names',+ skill: name => `skill ${name}`,+ kind: { plugin: 'plugin', skill: 'skill' },+ tier: { official: 'official', community: 'community' },+ targetProfile: profile => `Installs into your ${profile} profile`,+ sendFailed: 'Could not send your answer. Try again.',+ commitLabel: 'Commit',+ subdirLabel: 'Folder',+ securityHeading: 'Security',+ scan: { passed: 'Scan passed', warnings: 'Scan found warnings', failed: 'Scan failed' },+ requirementsLabel: 'Requires',+ credentialsHeading: 'Credentials'+ },mcpSetup: {installTitle: 'Add MCP servers',enableTitle: 'Enable MCP servers',diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex 93da3183762..7f7f5ab87d9 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -3393,6 +3393,29 @@ export const ja = defineLocale({},assistant: {+ catalogInstall: {+ preparing: 'インストールを準備中…',+ install: 'インストール',+ advanced: '詳細設定',+ skip: 'スキップ',+ installing: 'インストール中…',+ installed: 'インストール済み',+ notInstalled: '未インストール',+ failed: '失敗',+ showNames: '名前を表示',+ hideNames: '名前を隠す',+ skill: name => `スキル ${name}`,+ kind: { plugin: 'プラグイン', skill: 'スキル' },+ tier: { official: '公式', community: 'コミュニティ' },+ targetProfile: profile => `${profile} プロファイルにインストールします`,+ sendFailed: '回答を送信できませんでした。もう一度お試しください。',+ commitLabel: 'コミット',+ subdirLabel: 'フォルダー',+ securityHeading: 'セキュリティ',+ scan: { passed: 'スキャン合格', warnings: 'スキャンで警告あり', failed: 'スキャン不合格' },+ requirementsLabel: '必要条件',+ credentialsHeading: '認証情報'+ },thread: {loadingSession: 'セッションを読み込み中',showEarlier: '以前のメッセージを表示',diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.tsindex e1d338facd9..c9056181623 100644--- a/apps/desktop/src/i18n/ru.ts+++ b/apps/desktop/src/i18n/ru.ts@@ -3753,6 +3753,29 @@ export const ru = defineLocale({lateAnswerTip: 'Составить этот ответ как продолжение',lateAnswerHint: 'Этот промпт больше не ждёт. Выберите вариант, чтобы составить его как сообщение-продолжение.'},+ catalogInstall: {+ preparing: 'Готовим установку…',+ install: 'Установить',+ advanced: 'Дополнительно',+ skip: 'Пропустить',+ installing: 'Установка…',+ installed: 'Установлено',+ notInstalled: 'Не установлено',+ failed: 'Ошибка',+ showNames: 'показать имена',+ hideNames: 'скрыть имена',+ skill: name => `навык ${name}`,+ kind: { plugin: 'плагин', skill: 'навык' },+ tier: { official: 'официальный', community: 'сообщество' },+ targetProfile: profile => `Установка в ваш профиль ${profile}`,+ sendFailed: 'Не удалось отправить ответ. Попробуйте ещё раз.',+ commitLabel: 'Коммит',+ subdirLabel: 'Папка',+ securityHeading: 'Безопасность',+ scan: { passed: 'Проверка пройдена', warnings: 'Проверка нашла предупреждения', failed: 'Проверка не пройдена' },+ requirementsLabel: 'Требования',+ credentialsHeading: 'Учётные данные'+ },mcpSetup: {installTitle: 'Добавить MCP-серверы',enableTitle: 'Включить MCP-серверы',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex b558eb59dd7..9204c4db352 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -3879,6 +3879,29 @@ export interface Translations {lateAnswerTip: stringlateAnswerHint: string}+ catalogInstall: {+ preparing: string+ install: string+ advanced: string+ skip: string+ installing: string+ installed: string+ notInstalled: string+ failed: string+ showNames: string+ hideNames: string+ skill: (name: string) => string+ kind: { plugin: string; skill: string }+ tier: { official: string; community: string }+ targetProfile: (profile: string) => string+ sendFailed: string+ commitLabel: string+ subdirLabel: string+ securityHeading: string+ scan: { passed: string; warnings: string; failed: string }+ requirementsLabel: string+ credentialsHeading: string+ }mcpSetup: {installTitle: stringenableTitle: stringdiff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex 7e067074726..5604145b60e 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -3344,6 +3344,29 @@ export const zhHant = defineLocale({},assistant: {+ catalogInstall: {+ preparing: '正在準備安裝…',+ install: '安裝',+ advanced: '進階',+ skip: '略過',+ installing: '正在安裝…',+ installed: '已安裝',+ notInstalled: '未安裝',+ failed: '失敗',+ showNames: '顯示名稱',+ hideNames: '隱藏名稱',+ skill: name => `技能 ${name}`,+ kind: { plugin: '外掛', skill: '技能' },+ tier: { official: '官方', community: '社群' },+ targetProfile: profile => `安裝到你的 ${profile} 設定檔`,+ sendFailed: '無法傳送你的回覆,請再試一次。',+ commitLabel: '提交',+ subdirLabel: '資料夾',+ securityHeading: '安全性',+ scan: { passed: '掃描通過', warnings: '掃描發現警告', failed: '掃描未通過' },+ requirementsLabel: '需求',+ credentialsHeading: '憑證'+ },thread: {loadingSession: '正在載入工作階段',showEarlier: '顯示較早的訊息',diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex 923382a92f3..b7ff561c6c3 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -4229,6 +4229,29 @@ export const zh = defineLocale({lateAnswerTip: '将此回答起草为后续消息',lateAnswerHint: '此问题已不再等待回答。选择一个选项会将其起草为后续消息。'},+ catalogInstall: {+ preparing: '正在准备安装…',+ install: '安装',+ advanced: '高级',+ skip: '跳过',+ installing: '正在安装…',+ installed: '已安装',+ notInstalled: '未安装',+ failed: '失败',+ showNames: '显示名称',+ hideNames: '隐藏名称',+ skill: name => `技能 ${name}`,+ kind: { plugin: '插件', skill: '技能' },+ tier: { official: '官方', community: '社区' },+ targetProfile: profile => `安装到你的 ${profile} 配置文件`,+ sendFailed: '无法发送你的回复,请重试。',+ commitLabel: '提交',+ subdirLabel: '文件夹',+ securityHeading: '安全',+ scan: { passed: '扫描通过', warnings: '扫描发现警告', failed: '扫描未通过' },+ requirementsLabel: '要求',+ credentialsHeading: '凭据'+ },mcpSetup: {installTitle: '添加 MCP 服务器',enableTitle: '启用 MCP 服务器',diff --git a/apps/desktop/src/lib/icons.ts b/apps/desktop/src/lib/icons.tsindex a3e72206d30..76f1af34f22 100644--- a/apps/desktop/src/lib/icons.ts+++ b/apps/desktop/src/lib/icons.ts@@ -11,6 +11,7 @@ import {IconWaveSine as AudioLines,IconChartBar as BarChart3,IconBell as Bell,+ IconBook as Book,IconBookmark as Bookmark,IconBookmarkFilled as BookmarkFilled,IconBox as Box,@@ -95,6 +96,7 @@ import {IconPencil as PencilLine,IconPin as Pin,IconPlayerPlay as Play,+ IconPlug as Plug,IconPlus as Plus,IconPower as Power,IconQrcode as QrCode,@@ -144,6 +146,7 @@ export {AudioLines,BarChart3,Bell,+ Book,Bookmark,BookmarkFilled,Box,@@ -228,6 +231,7 @@ export {PencilLine,Pin,Play,+ Plug,Plus,Power,QrCode,diff --git a/apps/desktop/src/lib/tool-render-class.ts b/apps/desktop/src/lib/tool-render-class.tsindex c85d2774fe8..409022abd7c 100644--- a/apps/desktop/src/lib/tool-render-class.ts+++ b/apps/desktop/src/lib/tool-render-class.ts@@ -24,11 +24,11 @@ export function isFileEditTool(toolName: string): boolean {// - `clarify`, `image_generate` and `delegate_task` bypass ToolEntry to// render their own markup: a question the user has to answer, an image// they asked for, the several agents a fan-out is running.-// - `manage_connections` is a consent card; its controls must stay visible.+// - `manage_connections` and `manage_catalog` are consent cards; their controls must stay visible.//// Everything else is ephemeral activity — reads, searches, commands — which is// what a run summarizes and what the live ticker cycles through.-const CARD_TOOL_NAMES = new Set(['clarify', 'delegate_task', 'image_generate'])+const CARD_TOOL_NAMES = new Set(['clarify', 'delegate_task', 'image_generate', 'manage_catalog'])// Name the run splitter uses for a manage_connections part it has classified as a card.export const CONNECTION_CARD_KEY = 'manage_connections:card'diff --git a/apps/desktop/src/store/connection-request.ts b/apps/desktop/src/store/connection-request.tsindex 978c1b53809..bc28c6022e8 100644--- a/apps/desktop/src/store/connection-request.ts+++ b/apps/desktop/src/store/connection-request.ts@@ -1,4 +1,7 @@import type {+ CatalogAppState,+ CatalogScan,+ CatalogTier,ConnectionAnswer,ConnectionOperationStatus,ConnectionOperationTarget,@@ -38,6 +41,26 @@ export type {ConnectionTargetState}+/** What the catalog says about a `plugin` / `skill` row (CATALOG-ROW-CONTRACT.md). The host resolved all of+ * it; the model supplied only the id. */+export interface CatalogEntry {+ display: string+ description: string+ tier: CatalogTier | null+ /** Empty when the entry runs everywhere; the card shows a platform only when it is restricted. */+ platforms: string[]+ repo: string | null+ sha: string | null+ subdir: string | null+ scan: CatalogScan | null+ requirements: string[]+ hasDesktopHalf: boolean+ targetProfile: string+ appState: CatalogAppState | null+ /** On an installed skill row: the qualified name the model can now load. */+ skill: string | null+}+/** One target of the operation as the renderer knows it. State comes only from the backend* (`connection.request`, `connectors.operation.status`, `connection.update`); the card never sets it. */export interface ConnectionTarget {@@ -55,6 +78,8 @@ export interface ConnectionTarget {requiredEnv: SetupField[]instructions: string | nulldiscoveryError: string | null+ /** Present on `plugin` and `skill` rows only. */+ catalog?: CatalogEntry}/** The session's connection operation. `deadlineAt`, `opId`, `targets[].state`, `settled` and@@ -97,6 +122,7 @@ const TARGET_STATES: readonly ConnectionTargetState[] = ['skipped']+const KINDS: readonly ConnectionTargetKind[] = ['connector', 'mcp', 'plugin', 'skill']const ACTIONS: readonly ConnectionTargetAction[] = ['authorize', 'connect', 'enable', 'install', 'reconnect']const SETTLE_REASONS: readonly ConnectionSettleReason[] = ['all_resolved', 'continue', 'deadline', 'interrupt']@@ -106,10 +132,36 @@ const oneOf =(value: null | string | undefined): T | undefined =>allowed.find(candidate => candidate === value)+const targetKind = oneOf(KINDS)const targetState = oneOf(TARGET_STATES)const targetAction = oneOf(ACTIONS)const settleReason = oneOf(SETTLE_REASONS)+export const isCatalogKind = (kind: ConnectionTargetKind): kind is 'plugin' | 'skill' =>+ kind === 'plugin' || kind === 'skill'++function catalogEntry(entry: ConnectionOperationTarget, name: string): CatalogEntry {+ return {+ appState: entry.app_state ?? null,+ description: entry.description ?? '',+ display: entry.display?.trim() || name,+ hasDesktopHalf: entry.has_desktop_half ?? false,+ platforms: entry.platforms ?? [],+ repo: entry.repo ?? null,+ requirements: entry.requirements ?? [],+ scan: entry.scan ?? null,+ sha: entry.sha ?? null,+ skill: entry.skill ?? null,+ subdir: entry.subdir ?? null,+ targetProfile: entry.target_profile?.trim() || 'default',+ tier: entry.tier ?? null+ }+}++// Every frame carries a fresh object; a field-equal entry keeps the old reference so the row does not churn.+const sameCatalog = (next: CatalogEntry | undefined, previous: CatalogEntry | undefined): boolean =>+ next === previous || JSON.stringify(next) === JSON.stringify(previous)+export function parseConnectionTarget(entry: ConnectionOperationTarget): ConnectionTarget | null {const name = entry.name.trim()@@ -117,11 +169,15 @@ export function parseConnectionTarget(entry: ConnectionOperationTarget): Connectreturn null}+ // An unknown kind from a backend a version ahead renders as the generic MCP row.+ const kind = targetKind(entry.kind) ?? 'mcp'+return {action: targetAction(entry.action) ?? 'install',+ catalog: isCatalogKind(kind) ? catalogEntry(entry, name) : undefined,connectUrl: entry.connect_url ?? null,detail: entry.detail ?? '',- kind: entry.kind === 'connector' ? 'connector' : 'mcp',+ kind,name,state: targetState(entry.state) ?? 'pending',tools: entry.tools ?? [],@@ -195,8 +251,11 @@ export function applyOperationStatus(request: ConnectionRequest, status: Connect}function mergeLiveTarget(target: ConnectionTarget, live: ConnectionOperationTarget): ConnectionTarget {+ const liveCatalog = target.catalog ? catalogEntry(live, target.name) : undefined+const next: ConnectionTarget = {...target,+ catalog: sameCatalog(liveCatalog, target.catalog) ? target.catalog : liveCatalog,connectUrl: live.connect_url ?? target.connectUrl,detail: live.detail ?? target.detail,state: live.state,@@ -208,6 +267,7 @@ function mergeLiveTarget(target: ConnectionTarget, live: ConnectionOperationTarg}const same =+ next.catalog === target.catalog &&next.connectUrl === target.connectUrl &&next.connectionId === target.connectionId &&next.detail === target.detail &&diff --git a/apps/shared/src/gateway-contract.generated.ts b/apps/shared/src/gateway-contract.generated.tsindex b078c3eb945..9aed88a615f 100644--- a/apps/shared/src/gateway-contract.generated.ts+++ b/apps/shared/src/gateway-contract.generated.ts@@ -889,8 +889,21 @@ export interface ConnectionOperationTarget {required_env?: ConnectionTargetEnvField[] | nulltools?: string[] | nullhint?: string | null+ display?: string | null+ description?: string | null+ tier?: CatalogTier | null+ platforms?: string[] | null+ repo?: string | null+ sha?: string | null+ subdir?: string | null+ scan?: CatalogScan | null+ requirements?: string[] | null+ has_desktop_half?: boolean | null+ target_profile?: string | null+ app_state?: CatalogAppState | null+ skill?: string | null}-export type ConnectionTargetKind = 'connector' | 'mcp'+export type ConnectionTargetKind = 'connector' | 'mcp' | 'plugin' | 'skill'export type ConnectionTargetAction = 'authorize' | 'connect' | 'enable' | 'install' | 'reconnect'/** ``tools/connectors/contract.py::TargetState``. */export type ConnectionTargetState = 'pending' | 'initiated' | 'connected' | 'skipped' | 'failed' | 'expired' | 'not_connected'@@ -902,6 +915,15 @@ export interface ConnectionTargetEnvField {default: stringprompt?: string | null}+export type CatalogTier = 'official' | 'community'+/** The catalog's security scan of the pinned commit; read-only on the card. */+export interface CatalogScan {+ status: CatalogScanStatus+ summary: string+}+export type CatalogScanStatus = 'passed' | 'warnings' | 'failed'+/** The desktop app a catalog plugin drives, from its ``hermes_platform`` declaration. */+export type CatalogAppState = 'present' | 'missing_app' | 'app_not_running' | 'unknown'export interface ConnectionWakeResult {status: 'ok'}diff --git a/apps/shared/src/gateway-contract.openrpc.json b/apps/shared/src/gateway-contract.openrpc.jsonindex 09f8b6c353e..4bcc18fbd86 100644--- a/apps/shared/src/gateway-contract.openrpc.json+++ b/apps/shared/src/gateway-contract.openrpc.json@@ -7035,6 +7035,53 @@"title": "CapabilityEntry","type": "object"},+ "CatalogAppState": {+ "description": "The desktop app a catalog plugin drives, from its ``hermes_platform`` declaration.",+ "enum": [+ "present",+ "missing_app",+ "app_not_running",+ "unknown"+ ],+ "title": "CatalogAppState",+ "type": "string"+ },+ "CatalogScan": {+ "additionalProperties": false,+ "description": "The catalog's security scan of the pinned commit; read-only on the card.",+ "properties": {+ "status": {+ "$ref": "#/components/schemas/CatalogScanStatus"+ },+ "summary": {+ "title": "Summary",+ "type": "string"+ }+ },+ "required": [+ "status",+ "summary"+ ],+ "title": "CatalogScan",+ "type": "object"+ },+ "CatalogScanStatus": {+ "enum": [+ "passed",+ "warnings",+ "failed"+ ],+ "title": "CatalogScanStatus",+ "type": "string"+ },+ "CatalogTier": {+ "enum": [+ "official",+ "community"+ ],+ "title": "CatalogTier",+ "type": "string"+ },"ChangeSignalPayload": {"additionalProperties": true,"description": "``change_watcher._CHANGE_WATCHES`` payload fn \u2014 ``{}`` for every watch except pet.changed.",@@ -8831,6 +8878,165 @@],"default": null,"title": "Hint"+ },+ "display": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Display"+ },+ "description": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Description"+ },+ "tier": {+ "anyOf": [+ {+ "$ref": "#/components/schemas/CatalogTier"+ },+ {+ "type": "null"+ }+ ],+ "default": null+ },+ "platforms": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Platforms"+ },+ "repo": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Repo"+ },+ "sha": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Sha"+ },+ "subdir": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Subdir"+ },+ "scan": {+ "anyOf": [+ {+ "$ref": "#/components/schemas/CatalogScan"+ },+ {+ "type": "null"+ }+ ],+ "default": null+ },+ "requirements": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Requirements"+ },+ "has_desktop_half": {+ "anyOf": [+ {+ "type": "boolean"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Has Desktop Half"+ },+ "target_profile": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Target Profile"+ },+ "app_state": {+ "anyOf": [+ {+ "$ref": "#/components/schemas/CatalogAppState"+ },+ {+ "type": "null"+ }+ ],+ "default": null+ },+ "skill": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Skill"}},"required": [@@ -9028,7 +9234,9 @@"ConnectionTargetKind": {"enum": ["connector",- "mcp"+ "mcp",+ "plugin",+ "skill"],"title": "ConnectionTargetKind","type": "string"diff --git a/tui_gateway/contracts/connectors_operation.py b/tui_gateway/contracts/connectors_operation.pyindex 8c52f7cd6ec..0892714ad4c 100644--- a/tui_gateway/contracts/connectors_operation.py+++ b/tui_gateway/contracts/connectors_operation.py@@ -21,6 +21,9 @@ from .registry import event, methodclass ConnectionTargetKind(WireEnum):connector = "connector"mcp = "mcp"+ # ``manage_catalog`` rows: a catalog plugin (may bring MCP tools and/or skills) or a skill.+ plugin = "plugin"+ skill = "skill"class ConnectionTargetAction(WireEnum):@@ -71,6 +74,33 @@ class ConnectionTargetEnvField(Payload):prompt: str | None = None+class CatalogTier(WireEnum):+ official = "official"+ community = "community"+++class CatalogAppState(WireEnum):+ """The desktop app a catalog plugin drives, from its ``hermes_platform`` declaration."""++ present = "present"+ missing_app = "missing_app"+ app_not_running = "app_not_running"+ unknown = "unknown"+++class CatalogScanStatus(WireEnum):+ passed = "passed"+ warnings = "warnings"+ failed = "failed"+++class CatalogScan(Payload):+ """The catalog's security scan of the pinned commit; read-only on the card."""++ status: CatalogScanStatus+ summary: str++class ConnectionOperationTarget(Payload):"""``Target.snapshot``: the link minted up front rides here, never in the model result. ``extra``keys a leg records (``tools``, ``hint``) are typed here as they appear."""@@ -90,6 +120,21 @@ class ConnectionOperationTarget(Payload):required_env: list[ConnectionTargetEnvField] | None = Nonetools: list[str] | None = Nonehint: str | None = None+ # Catalog rows (kind ``plugin`` / ``skill``) only; field set agreed in CATALOG-ROW-CONTRACT.md.+ display: str | None = None+ description: str | None = None+ tier: CatalogTier | None = None+ platforms: list[str] | None = None+ repo: str | None = None+ sha: str | None = None+ subdir: str | None = None+ scan: CatalogScan | None = None+ requirements: list[str] | None = None+ has_desktop_half: bool | None = None+ target_profile: str | None = None+ app_state: CatalogAppState | None = None+ # On an installed skill row: the qualified skill name the model can now load.+ skill: str | None = Noneclass ConnectionRequestPayload(Payload):