The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): the onboarding connector picker reads the live catalog
brooklyn!731b04c06e6c
diff --git a/apps/desktop/src/components/onboarding-chat/cards/setup.tsx b/apps/desktop/src/components/onboarding-chat/cards/setup.tsxindex 869472d716e..3af4eb82ad2 100644--- a/apps/desktop/src/components/onboarding-chat/cards/setup.tsx+++ b/apps/desktop/src/components/onboarding-chat/cards/setup.tsx@@ -6,29 +6,45 @@*/import { useStore } from '@nanostores/react'+import { useMemo, useState } from 'react'+import { useSessionView } from '@/app/chat/session-view'import { $chatLayoutPicked, assembleChatOnboarding } from '@/components/onboarding-chat/assembly'import { CardFrame, type CardProps, useCardCommit } from '@/components/onboarding-chat/cards/frame'import { Chip } from '@/components/onboarding-chat/chip'import {accentsFor,AccentSwatch,- CONNECTORS,LayoutPreviewCard,LAYOUTS,- NOUS_ACCENT+ NOUS_ACCENT,+ orderConnectorPicks} from '@/components/onboarding-chat/options'import type { LayoutNode } from '@/components/pane-shell/tree/model'import { ConnectorLogo } from '@/components/ui/connector-logo'+import { SearchField } from '@/components/ui/search-field'import { registry } from '@/contrib/registry'+import { connectorTitle } from '@/lib/connector-tools'+import { useConnectorCatalog } from '@/store/connector-catalog'import { $onboardingAnswers, setOnboardingAnswers } from '@/store/onboarding-answers'import { useTheme } from '@/themes'import { setAccentOverride } from '@/themes/accent-override'export function ConnectorsCard({ locked }: CardProps) {+ const view = useSessionView()+ const storedId = useStore(view.$storedId)+ const runtimeId = useStore(view.$runtimeId)const answers = useStore($onboardingAnswers)const { commit, done } = useCardCommit('connectors')- const picked = CONNECTORS.filter(connector => answers.connectors.includes(connector.id))+ const catalog = useConnectorCatalog(storedId, runtimeId)+ const [query, setQuery] = useState('')++ // Only what the gateway actually carries. A pick is a slug the build chat+ // can hand straight to manage_connections; a name with nothing behind it+ // is a promise it has to walk back.+ const rows = useMemo(() => (catalog.status === 'ready' ? orderConnectorPicks(catalog.rows) : []), [catalog])+ const shown = rows.filter(row => connectorTitle(row.connector).toLowerCase().includes(query.toLowerCase()))+ const picked = rows.filter(row => answers.connectors.includes(row.connector))const toggle = (id: string) =>setOnboardingAnswers({@@ -37,34 +53,56 @@ export function ConnectorsCard({ locked }: CardProps) {: [...answers.connectors, id]})+ // Nothing to pick from: the toolset is off or the gateway is unreachable.+ // The step still has to end, so it ends honestly.+ if (catalog.status === 'unavailable' || (catalog.status === 'ready' && rows.length === 0)) {+ return (+ <CardFrame continueLabel="Skip this" done={done} locked={locked} onContinue={() => commit('apps I use: none for now')}>+ <p className="text-sm text-muted-foreground">Connections aren’t available right now — this can be set up later.</p>+ </CardFrame>+ )+ }+return (<CardFramecontinueLabel={picked.length > 0 ? `Continue with ${picked.length}` : 'None of these'}+ disabled={catalog.status === 'loading'}done={done}locked={locked}onContinue={() => {commit(- `apps I use, not connected yet: ${picked.length > 0 ? picked.map(c => c.name).join(', ') : 'none for now'}`+ `apps I use, not connected yet: ${picked.length > 0 ? picked.map(row => row.connector).join(', ') : 'none for now'}`)}}>- <div className="grid grid-cols-3 gap-2">- {CONNECTORS.map(connector => (- <Chip- icon={- <ConnectorLogo- className="size-7 rounded-full text-sm"- connector={{ homepage: connector.homepage, name: connector.id, title: connector.name }}+ {catalog.status === 'loading' ? (+ <div className="grid grid-cols-3 gap-2">+ {Array.from({ length: 9 }, (_, index) => (+ <div className="h-10 animate-pulse rounded-lg bg-muted/40" key={index} />+ ))}+ </div>+ ) : (+ <>+ {rows.length > 12 ? <SearchField onChange={setQuery} placeholder="Find an app" value={query} /> : null}+ <div className="grid max-h-72 grid-cols-3 gap-2 overflow-y-auto">+ {shown.map(row => (+ <Chip+ icon={+ <ConnectorLogo+ className="size-7 rounded-full text-sm"+ connector={{ name: row.connector, title: row.name || connectorTitle(row.connector) }}+ />+ }+ key={row.connector}+ label={row.name || connectorTitle(row.connector)}+ on={answers.connectors.includes(row.connector)}+ onToggle={() => toggle(row.connector)}/>- }- key={connector.id}- label={connector.name}- on={answers.connectors.includes(connector.id)}- onToggle={() => toggle(connector.id)}- />- ))}- </div>- {/* Picking is a preference, not an authorization: nothing is signed into+ ))}+ </div>+ </>+ )}+ {/* Picking is a preference, not an authorization: nothing *** signed intohere. Saying so is what keeps the Connect cards later from reading asa second ask for the same thing. */}<p className="text-xs text-muted-foreground">diff --git a/apps/desktop/src/components/onboarding-chat/options.tsx b/apps/desktop/src/components/onboarding-chat/options.tsxindex 12bda65bcb9..b9cfa022050 100644--- a/apps/desktop/src/components/onboarding-chat/options.tsx+++ b/apps/desktop/src/components/onboarding-chat/options.tsx@@ -3,34 +3,45 @@ import { Tip } from '@/components/ui/tooltip'import { IS_MAC } from '@/lib/keybinds/combo'import { cn } from '@/lib/utils'-// Preferences for the first build’s optional connector offer. Every id here is-// a real slug from the deployed connector catalog (manage_connections-// action="status"), spelled the way the gateway spells it — the picks are-// matched against that catalog and an app it does not carry cannot be-// offered, so a pretty name with no slug behind it is a promise the build-// chat has to walk back ("Spotify isn't in the connector list"). Marks resolve-// through the shared ConnectorLogo ladder: curated brand glyph first, the-// product's own favicon, monogram last.-//+// Which live-catalog slugs to lead with, and in what order. The catalog is the+// source of truth for WHAT can be connected — this is only a sort key for the+// picker, so the apps most people use land in the first rows and the rest+// stay reachable by search. A slug the catalog no longer carries is simply+// not shown; a new one it gains is shown after these.+export const CONNECTOR_LEAD_ORDER = [+ 'gmail',+ 'googlecalendar',+ 'googledrive',+ 'googledocs',+ 'googlesheets',+ 'outlook',+ 'slack',+ 'notion',+ 'linear',+ 'jira',+ 'figma',+ 'todoist'+]+// Connectors are the apps Hermes reads and acts on FOR the user. Chat channels// (Discord, Telegram, WhatsApp) are how a user talks TO Hermes — those live on// the Messaging page, and offering them here as if they were data sources-// taught users the wrong thing about what "connect" does. GitHub is not a-// connector either: the agent already has git and gh in the terminal.-export const CONNECTORS: Array<{ homepage?: string; id: string; name: string }> = [- { id: 'gmail', name: 'Gmail' },- { id: 'googlecalendar', name: 'Calendar' },- { id: 'googledrive', name: 'Drive' },- { id: 'googlesheets', name: 'Sheets' },- { id: 'slack', name: 'Slack' },- { id: 'notion', name: 'Notion' },- { id: 'linear', name: 'Linear' },- { id: 'jira', name: 'Jira' },- { id: 'figma', name: 'Figma' },- { homepage: 'https://outlook.live.com', id: 'outlook', name: 'Outlook' },- { id: 'todoist', name: 'Todoist' },- { id: 'youtube', name: 'YouTube' }-]+// taught users the wrong thing about what "connect" does. The catalog+// carries them for the agent's sake; the first-run picker leaves them out.+export const CONNECTOR_PICKER_HIDDEN = new Set(['discord', 'discordbot', 'microsoft_teams'])++export function orderConnectorPicks<T extends { connector: string }>(rows: T[]): T[] {+ const rank = new Map(CONNECTOR_LEAD_ORDER.map((slug, index) => [slug, index]))++ return rows+ .filter(row => !CONNECTOR_PICKER_HIDDEN.has(row.connector))+ .sort((a, b) => {+ const ra = rank.get(a.connector) ?? Number.POSITIVE_INFINITY+ const rb = rank.get(b.connector) ?? Number.POSITIVE_INFINITY++ return ra - rb || a.connector.localeCompare(b.connector)+ })+}// Big accent swatches, Dia-style. Each seeds `retintTheme` through the accent// override, so a click repaints the surface live. Nous blue is the default =diff --git a/apps/desktop/src/store/connector-catalog.ts b/apps/desktop/src/store/connector-catalog.tsnew file mode 100644index 00000000000..702891ef765--- /dev/null+++ b/apps/desktop/src/store/connector-catalog.ts@@ -0,0 +1,68 @@+/**+ * The live connector catalog for a chat session, read once per mount.+ *+ * The onboarding picker used to be a hardcoded list, and it drifted from the+ * deployed catalog: it offered apps the gateway does not carry and spelled+ * others with hyphens the gateway does not use. The pick was then a promise+ * the build chat had to walk back. This hook asks the gateway what is+ * actually there, through the same session-owned RPC the connector cards+ * use, so the picker can only ever offer what can be connected.+ *+ * `available: false` (toolset off, signed out) and a failed request both+ * resolve to `null` rows — the caller decides what to show; there is no+ * fallback list here, because a fallback is how the drift started.+ */+import { useEffect, useState } from 'react'++import { resolveSessionOwner } from '@/app/session/hooks/use-session-actions/utils'+import type { ConnectorRow } from '@/lib/connector-tools'+import { requestGatewayForAgent } from '@/store/gateway'+import { $activeGatewayProfile } from '@/store/profile'+import { assertSessionOwnerResolved } from '@/store/session-owner-resolution'+import { isSessionOwnerRoute } from '@/store/session-request-router'++export type ConnectorCatalog = { status: 'loading' } | { status: 'ready'; rows: ConnectorRow[] } | { status: 'unavailable' }++export function useConnectorCatalog(storedId: null | string, runtimeId: null | string): ConnectorCatalog {+ const [catalog, setCatalog] = useState<ConnectorCatalog>({ status: 'loading' })++ useEffect(() => {+ if (!storedId || !runtimeId) {+ return+ }++ let cancelled = false+ const ambientProfile = $activeGatewayProfile.get()++ void resolveSessionOwner(storedId)+ .then(scope => {+ assertSessionOwnerResolved(scope, { method: 'connectors.list', sessionId: storedId })++ const connectionId = isSessionOwnerRoute(scope) ? scope.connectionId : null+ const profile = isSessionOwnerRoute(scope) ? scope.profile : scope || ambientProfile++ return requestGatewayForAgent<{ available: boolean; connectors: ConnectorRow[] }>(+ connectionId,+ profile,+ 'connectors.list',+ { session_id: runtimeId }+ )+ })+ .then(response => {+ if (!cancelled) {+ setCatalog(response.available ? { rows: response.connectors, status: 'ready' } : { status: 'unavailable' })+ }+ })+ .catch(() => {+ if (!cancelled) {+ setCatalog({ status: 'unavailable' })+ }+ })++ return () => {+ cancelled = true+ }+ }, [storedId, runtimeId])++ return catalog+}