Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
Merge origin/dev into feat/mcp-connectors-desktop-refactor
Diego Zacarias6bcd175161a2
diff --cc desktop-app/ui/src/lib/connectorRows.tsindex df26f38b6,8a7f1ebd8..9a439d700--- a/desktop-app/ui/src/lib/connectorRows.ts+++ b/desktop-app/ui/src/lib/connectorRows.ts@@@ -1,38 -1,43 +1,59 @@@import type { RpcAgentConnectors, RpcConnector } from '../../../src/types'import { formatMcpServerDisplayName } from './format'+ /**+ * A connector is "shared by the team" when its grant is keyed by Context, not by+ * user (spec §1.3). Authorizing/disconnecting it affects EVERYONE in the+ * Context, so both the confirm-dialog copy and the panel warning key off this.+ *+ * Lives in `lib/` (pure, no react) so `lib/connectorPresentation` can consume it+ * without `lib/` importing from `hooks/domain/` — the layering runs one way.+ */+ export function isSharedConnector(+ connector: Pick<RpcConnector, 'authKind' | 'grantScope'>+ ): boolean {+ return connector.grantScope === 'context' || connector.authKind === 'oauth-context'+ }++ /** A connector row is actionable from the connectors rail only when it is+ * OAuth-governed: `authorized` → disconnect, `requires_setup` → authorize.+ * `no_oauth` (static / none) is managed by Secret, out of scope — no button. */+ export function isActionableConnector(connector: Pick<RpcConnector, 'status'>): boolean {+ return connector.status === 'authorized' || connector.status === 'requires_setup'+ }+/**- * A single deduplicated row of the Connectors table.+ * A single row of the Connectors table.*- * The payload from rpc-proxy is grouped BY AGENT, but a grant is never- * per-agent: `oauth-context` grants are keyed by `(server, context)` and- * `oauth-user` grants by `(server, userId)`. So the correct dedup key for the- * view is `(server, context)` — two agents that share a Context list the SAME- * connector once, not twice.+ * In the agent-centric model (spec §5.E) the table shows ONE row per+ * `(connector, agent)`: clicking a row deep-links to THAT agent's Connectors+ * tab. The grant itself is never per-agent — `oauth-context`/`grantScope:'context'`+ * grants are keyed by `(server, context)` and `oauth-user` grants by+ * `(server, userId)` — so a row carries TWO keys:+ *+ * - `renderKey` — unique per `(agent, context, server)`; the React key.+ * - `grantKey` — the GRANT identity `(context, server)`; the anchor for the+ * `pendingKey` busy-state and the authorize/disconnect action.+ *+ * Two agents that share a grant produce two rows with the SAME `grantKey` and+ * DISTINCT `renderKey`. `agentName` is the row's own agent: both the deep-link+ * target and the RPC-token minter for the action.*/export type ConnectorRow = {- /** Stable per-row key `(context, server)` — also the `pendingKey` anchor. */- key: string+ /** React key — UNIQUE per row: `(agent, context, server)`. */+ renderKey: string/**- * The representative connector policy for the group. `status`/`provider`/- * `authKind`/`grantScope` are invariant across a `(server, context)` group,- * so any member describes the row; see the defensive status merge below.+ * Grant identity `(context, server)` = `connectorRowKey(contextRef, name)`.+ * The `pendingKey` busy-state anchor and the action target. Shared by every+ * sibling row of the same grant.+ */+ grantKey: string+ /**+ * The connector policy for this row, with the grant's CANONICAL status+ * stamped in (max `STATUS_RANK` across all `(agent, connector)` appearances of+ * the grant) so sibling rows can never disagree on status. `provider`/+ * `authKind`/`grantScope` are invariant across the grant, so this row's own+ * connector describes them.*/connector: RpcConnectorcontextRef: string | nulldiff --cc desktop-app/ui/src/pages/McpServersPage.tsxindex e6c814d50,faab25a81..0a0917015--- a/desktop-app/ui/src/pages/McpServersPage.tsx+++ b/desktop-app/ui/src/pages/McpServersPage.tsx@@@ -14,17 -15,24 +15,22 @@@ import { clickableRowProps } from '../lfunction ConnectorRowView({row,busy,+ agentDisplayByName,onAuthorize,onDisconnect,- onOpenContext,onOpenAgent,}: {row: ConnectorRowbusy: boolean+ // Visible agent name (spec.host) from the catalog map, as everywhere else in+ // the app (AppHeader, ContextDetailsPage, TeamsPage). Falls back to the raw+ // identifier for agents absent from the map (e.g. cross-team), not `|| name`.+ agentDisplayByName: Record<string, string>onAuthorize: (input: ConnectorActionInput) => voidonDisconnect: (input: ConnectorActionInput) => void- onOpenContext: (contextRef: string) => voidonOpenAgent: (agentName: string) => void}) {- const { connector, contextRef } = row+ const { connector, contextRef, agentName } = rowconst presentation = statusPresentation(connector.status)const caption = scopeCaption(connector)// The action IPC needs a hostRef to mint the token; the row is per@@@ -55,11 -64,40 +61,18 @@@</td><td className="da-table__cell">- {contextRef ? (- <ReferenceTag kind="context" title={`Context: ${contextRef}`}>- {contextRef}- </ReferenceTag>- ) : (- <span className="agent-table-muted">—</span>- )}- </td>-- <td className="da-table__cell">- {row.usedByAgents.length ? (- <span className="reference-tag-list">- {row.usedByAgents.map(agentName => (- <ReferenceTag- key={agentName}- kind="agent"- onClick={event => {- event.stopPropagation()- onOpenAgent(agentName)- }}- // The row's clickableRowProps installs an Enter/Space onKeyDown- // on the <tr>; stop keyboard activation from bubbling so a chip- // press opens the agent instead of navigating the row.- onKeyDown={event => event.stopPropagation()}- title={agentDisplayByName[agentName] ?? agentName}- aria-label={`Open agent ${agentDisplayByName[agentName] ?? agentName}`}- >- {agentDisplayByName[agentName] ?? agentName}- </ReferenceTag>- ))}- </span>- ) : (- <span className="agent-table-muted">None</span>- )}+ {/* Presentational: the whole row already navigates to this agent, so the- tag carries no click/key handlers of its own. */}- <ReferenceTag kind="agent" title={agentName} aria-label={`Agent ${agentName}`}>- {agentName}++ tag carries no click/key handlers of its own. Visible display name++ (spec.host) from the catalog map, as everywhere else in the app;++ falls back to the raw identifier for agents absent from the map++ (e.g. cross-team), not `|| name`. */}++ <ReferenceTag++ kind="agent"++ title={agentDisplayByName[agentName] ?? agentName}++ aria-label={`Agent ${agentDisplayByName[agentName] ?? agentName}`}++ >++ {agentDisplayByName[agentName] ?? agentName}+ </ReferenceTag></td><td className="da-table__cell">@@@ -109,8 -147,10 +122,10 @@@}export function McpServersPage() {- const { loading, error, agents, pendingKey, authorize, disconnect } = useConnectorsController()+ const { loading, error, actionError, agents, pendingKey, authorize, disconnect } =+ useConnectorsController()+ const { agentDisplayByName } = useAgentsDataController()- const { handleOpenContextDetails, handleOpenAgentWorkspace } = useNavigationContext()+ const { handleOpenAgentWorkspace } = useNavigationContext()const rows = useMemo(() => deriveConnectorRows(agents), [agents])const hasRows = rows.length > 0@@@ -157,19 -202,21 +174,22 @@@<tbody>{rows.map(row => (<ConnectorRowView- key={row.key}+ key={row.renderKey}row={row}- busy={pendingKey === row.key}+ // Busy is a property of the GRANT, never the render row:+ // authorizing/disconnecting a shared grant must show every+ // sibling row busy, so anchor on grantKey (matches the+ // controller's pendingKey = connectorRowKey).+ busy={pendingKey === row.grantKey}+ agentDisplayByName={agentDisplayByName}onAuthorize={input => {- authorize(input).catch(() => undefined)+ // The hook records any write failure in `actionError` and+ // never rejects, so the call site no longer swallows it.+ void authorize(input)}}onDisconnect={input => {- disconnect(input).catch(() => undefined)+ void disconnect(input)}}- onOpenContext={contextRef =>- handleOpenContextDetails(contextRef, 'mcp-servers')- }onOpenAgent={agentName => handleOpenAgentWorkspace(agentName, 'mcp-servers')}/>))}