Skip to content

The agent that grows with you

feat(desktop): every desktop chat can install catalog plugins; tools gated by session platform

alt-glitchc2b13dc3d85e
diff --git a/agent/agent_init.py b/agent/agent_init.py
index 95c6fcf1137..eaf57f603ce 100644
--- a/agent/agent_init.py
+++ b/agent/agent_init.py
@@ -1147,8 +1147,8 @@ def _load_tools(agent, enabled_toolsets, disabled_toolsets):
# A finite -q run has no later session to learn for: no skill authoring tool (agent/oneshot_footprint.py).
from agent.oneshot_footprint import prune_oneshot_tools
agent.tools = prune_oneshot_tools(agent.tools or [])
- from tools.connectors.turn import side_agent_tool_drops
- drops = side_agent_tool_drops(agent)
+ from toolsets import agent_tool_drops
+ drops = agent_tool_drops(agent)
if drops:
agent.tools = [t for t in agent.tools if t["function"]["name"] not in drops]
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.ts
index bd6459dfacf..231558c5d68 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
@@ -2,8 +2,9 @@ import { type ChatMessage, type GatewayEventPayload, restorePendingBlockingToolC
import {
$connectionRequests,
clearConnectionRequest,
+ CONNECTION_OP_ARG,
type ConnectionRequest,
- isCatalogKind,
+ isCatalogRequest,
normalizeConnectionRequest,
setConnectionRequest
} from '@/store/connection-request'
@@ -56,11 +57,16 @@ export function restorePendingConnectionFromSnapshot(
return { authoritativeAbsent: false, cleared: null, request }
}
-/** Tool row for a pending operation whose `tool.start` event was missed. */
+/** Tool row for a pending operation (upserted onto the `tool.start` row when that arrived). The row keeps
+ * the op id, so its card stays this operation's after a later call reuses the call id. */
export function connectionRequestToolPayload(request: ConnectionRequest): GatewayEventPayload & { name: string } {
- if (request.targets.some(target => isCatalogKind(target.kind))) {
+ if (isCatalogRequest(request)) {
return {
- args: { action: 'install', items: request.targets.map(target => ({ id: target.name, kind: target.kind })) },
+ args: {
+ action: 'install',
+ items: request.targets.map(target => ({ id: target.name, kind: target.kind })),
+ [CONNECTION_OP_ARG]: request.opId
+ },
name: 'manage_catalog',
tool_id: request.toolCallId
}
@@ -69,7 +75,8 @@ export function connectionRequestToolPayload(request: ConnectionRequest): Gatewa
return {
args: {
action: request.targets[0]?.action ?? (request.targets[0]?.kind === 'connector' ? 'connect' : 'install'),
- connectors: request.targets.map(target => ({ mcp: target.kind === 'mcp', name: target.name }))
+ connectors: request.targets.map(target => ({ mcp: target.kind === 'mcp', name: target.name })),
+ [CONNECTION_OP_ARG]: request.opId
},
name: 'manage_connections',
tool_id: request.toolCallId
diff --git a/apps/desktop/src/components/assistant-ui/catalog-advanced-dialog.tsx b/apps/desktop/src/components/assistant-ui/catalog-advanced-dialog.tsx
index f3a725cac9a..10f3c6371fa 100644
--- a/apps/desktop/src/components/assistant-ui/catalog-advanced-dialog.tsx
+++ b/apps/desktop/src/components/assistant-ui/catalog-advanced-dialog.tsx
@@ -109,7 +109,8 @@ function CatalogAdvancedForm({ entry, fields, kind, onCancel, onInstall }: Catal
const profiles = useStore($profiles)
const [agentHalf, setAgentHalf] = useState(true)
const [desktopHalf, setDesktopHalf] = useState(entry.hasDesktopHalf)
- const [targetProfile, setTargetProfile] = useState(normalizeProfileKey(entry.targetProfile))
+ // Empty when the chat's home is no named profile: the install then goes to the chat's own home.
+ const [targetProfile, setTargetProfile] = useState(entry.targetProfile ? normalizeProfileKey(entry.targetProfile) : '')
const [enable, setEnable] = useState(true)
const [force, setForce] = useState(false)
const [pin, setPin] = useState(entry.sha ?? '')
@@ -123,9 +124,14 @@ function CatalogAdvancedForm({ entry, fields, kind, onCancel, onInstall }: Catal
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 profileOptions = known || !targetProfile ? profiles : [...profiles, { name: targetProfile }]
const filesUrl = pluginFilesUrl(entry)
+ const requirements = [
+ ...(entry.requiresHermes ? [copy.requiresHermes(entry.requiresHermes)] : []),
+ ...fields.map(field => copy.envVar(field.name))
+ ]
+
const plugin = kind === 'plugin'
const install = () =>
@@ -207,7 +213,7 @@ function CatalogAdvancedForm({ entry, fields, kind, onCancel, onInstall }: Catal
</Section>
) : null}
- {entry.scan || entry.requirements.length > 0 ? (
+ {entry.scan || requirements.length > 0 ? (
<Section title={copy.securityHeading}>
{entry.scan ? (
<p className={cn(CAPTION, SCAN_TONE[entry.scan.status])}>
@@ -215,8 +221,8 @@ function CatalogAdvancedForm({ entry, fields, kind, onCancel, onInstall }: Catal
{entry.scan.summary ? ` · ${entry.scan.summary}` : ''}
</p>
) : null}
- {entry.requirements.length > 0 ? (
- <Facts mono={false} rows={[[copy.requirementsLabel, entry.requirements.join(', ')]]} />
+ {requirements.length > 0 ? (
+ <Facts mono={false} rows={[[copy.requirementsLabel, requirements.join(', ')]]} />
) : null}
</Section>
) : null}
diff --git a/apps/desktop/src/components/assistant-ui/catalog-install-tool.tsx b/apps/desktop/src/components/assistant-ui/catalog-install-tool.tsx
index f5aa189042b..2f6c8822810 100644
--- a/apps/desktop/src/components/assistant-ui/catalog-install-tool.tsx
+++ b/apps/desktop/src/components/assistant-ui/catalog-install-tool.tsx
@@ -4,11 +4,7 @@ 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 { connectionRequestOwnsPart, 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'
@@ -16,14 +12,18 @@ import { Progress } from '@/components/ui/progress'
import { useI18n } from '@/i18n'
import { Book, Loader2, Plug } from '@/lib/icons'
import { cn } from '@/lib/utils'
+import { installAgentPlugin } from '@/store/agent-plugins'
import {
type CatalogEntry,
+ connectionOpOf,
+ connectionOwnerFor,
type ConnectionRequest,
type ConnectionTarget,
continueConnectionRequest,
respondToConnectionRequest,
- sessionConnectionRequest
+ toolConnectionRequest
} from '@/store/connection-request'
+import { requestGatewayForAgent } from '@/store/gateway'
import { notifyError } from '@/store/notifications'
import { profileLabel } from '@/store/profile'
@@ -62,7 +62,14 @@ export function CatalogInstallTool(props: ToolCallMessagePartProps) {
const { t } = useI18n()
const view = useSessionView()
const runtimeId = useStore(view.$runtimeId)
- const $request = useMemo(() => sessionConnectionRequest(runtimeId), [runtimeId])
+ const opId = connectionOpOf(props.args)
+ const running = props.result === undefined
+
+ const $request = useMemo(
+ () => toolConnectionRequest(runtimeId, props.toolCallId, opId, running),
+ [opId, props.toolCallId, running, runtimeId]
+ )
+
const request = useStore($request)
if (request && connectionRequestOwnsPart(props, request)) {
@@ -86,8 +93,8 @@ 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'
+ const unresolved = rows.some(target => !target.catalog.resolved)
+ const profile = rows[0]?.catalog.targetProfile
useConnectorFocusHandoff(request.targets, cardRef)
@@ -102,9 +109,11 @@ export function CatalogInstallCard({ request }: { request: ConnectionRequest })
{t.common.continue}
</Button>
) : null}
- <span className={cn(CAPTION, 'text-(--ui-text-tertiary)')}>
- {t.assistant.catalogInstall.targetProfile(profileLabel({ name: profile }))}
- </span>
+ {profile ? (
+ <span className={cn(CAPTION, 'text-(--ui-text-tertiary)')}>
+ {t.assistant.catalogInstall.targetProfile(profileLabel({ name: profile }))}
+ </span>
+ ) : null}
</div>
</div>
)
@@ -121,27 +130,72 @@ export function CatalogRow({ request, target }: CatalogRowProps) {
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
+ // The operation and seq an answer was sent at; the verbs stay held until a newer frame of that
+ // operation answers it, so a second click cannot send the answer twice. Keyed by op so a seq from
+ // another operation can never hold this row.
+ const [sentAt, setSentAt] = useState<null | { opId: string; seq: number }>(null)
+ // Try again on a failed plugin row after the operation settled: a fresh host install (which enables a
+ // plugin already on disk). The settled operation is frozen, so the row shows this outcome over it.
+ const [retry, setRetry] = useState<null | { detail: string; status: 'failed' | 'installed' | 'running' }>(null)
+ const sending = (sentAt?.opId === request.opId && request.seq <= sentAt.seq) || retry?.status === 'running'
const Glyph = KIND_GLYPH[target.kind]
const answer = async (status: 'approved' | 'skipped', env: Record<string, string> | null = null) => {
- setSentAtSeq(request.seq)
+ setSentAt({ opId: request.opId, seq: request.seq })
try {
const sent = await respondToConnectionRequest(request, { targets: [{ env, name: target.name, status }] })
if (!sent) {
- setSentAtSeq(null)
+ setSentAt(null)
}
} catch (error) {
notifyError(error, copy.sendFailed)
- setSentAtSeq(null)
+ setSentAt(null)
}
}
+ const retrySettled = async () => {
+ setRetry({ detail: '', status: 'running' })
+ const owner = request.sessionId ? await connectionOwnerFor(request.sessionId, 'plugins.manage') : null
+
+ if (!owner) {
+ setRetry({ detail: copy.sendFailed, status: 'failed' })
+
+ return
+ }
+
+ // The choices the user approved on this row, so the retry installs what they asked for.
+ const approved = catalog.approved
+
+ const result = await installAgentPlugin(
+ (method, params, timeoutMs) => requestGatewayForAgent(owner.connectionId, owner.profile, method, params, timeoutMs),
+ {
+ catalogName: target.name,
+ enable: approved?.enable,
+ force: approved?.force,
+ identifier: '',
+ profile: catalog.targetProfile,
+ ref: approved?.ref ?? undefined
+ }
+ )
+
+ setRetry(result.ok ? { detail: '', status: 'installed' } : { detail: result.error ?? '', status: 'failed' })
+ }
+
+ const shown: CatalogTarget =
+ retry?.status === 'installed'
+ ? { ...target, detail: '', state: 'connected' }
+ : retry?.status === 'failed'
+ ? { ...target, detail: retry.detail || target.detail }
+ : target
+
+ const onRetry = !request.settled
+ ? () => void answer('approved')
+ : target.kind === 'plugin'
+ ? () => void retrySettled()
+ : undefined
+
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">
@@ -177,12 +231,13 @@ export function CatalogRow({ request, target }: CatalogRowProps) {
copy={copy}
onAdvanced={() => setAdvancedOpen(true)}
onInstall={() => void answer('approved')}
+ onRetry={onRetry}
onSkip={() => void answer('skipped')}
retryLabel={t.connectors.retry}
sending={sending}
settled={request.settled}
skippedLabel={t.connectors.skipped}
- target={target}
+ target={shown}
toolCount={t.assistant.mcpSetup.toolCount}
/>
</div>
@@ -206,6 +261,8 @@ interface RowOutcomeProps {
copy: CatalogCopy
onAdvanced: () => void
onInstall: () => void
+ /** Try again on a failed row; absent when nothing can run it again. */
+ onRetry?: () => void
onSkip: () => void
retryLabel: string
sending: boolean
@@ -215,11 +272,22 @@ interface RowOutcomeProps {
toolCount: (count: number) => string
}
+/** What an installed row still needs, worded from the backend's facts. */
+function installedNotes(catalog: CatalogEntry, copy: CatalogCopy): string[] {
+ return [
+ ...catalog.serverErrors.map(({ error, name }) => copy.serverNotConnected(name, error)),
+ ...(catalog.enabled === false ? [copy.notEnabled] : []),
+ ...(catalog.missingEnv.length > 0 ? [copy.missingEnv(catalog.missingEnv.join(', '))] : []),
+ ...(catalog.alreadyInstalled ? [copy.alreadyInstalled] : [])
+ ]
+}
+
/** The third line: the verbs while the row waits on the user, else what happened to it. */
function RowOutcome({
copy,
onAdvanced,
onInstall,
+ onRetry,
onSkip,
retryLabel,
sending,
@@ -232,6 +300,7 @@ function RowOutcome({
if (target.state === 'connected') {
const { skill } = target.catalog
+ const notes = installedNotes(target.catalog, copy)
const parts = [
copy.installed,
@@ -257,6 +326,9 @@ function RowOutcome({
</>
) : null}
</p>
+ {notes.length > 0 ? (
+ <p className={cn(CAPTION, 'text-(--ui-text-tertiary) wrap-anywhere')}>{notes.join(' · ')}</p>
+ ) : null}
{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 => (
@@ -276,18 +348,18 @@ function RowOutcome({
<p className={cn(CAPTION, 'min-w-0 text-destructive wrap-anywhere')} role="status">
{target.detail ? `${copy.failed} · ${target.detail}` : copy.failed}
</p>
- {settled ? null : (
+ {onRetry ? (
<Button
className="h-6 px-1.5 text-(--ui-text-tertiary)"
disabled={sending}
loading={sending}
- onClick={onInstall}
+ onClick={onRetry}
size="xs"
variant="ghost"
>
{retryLabel}
</Button>
- )}
+ ) : null}
</div>
)
}
@@ -307,10 +379,11 @@ function RowOutcome({
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>
+ <p className={cn(CAPTION, 'text-(--ui-text-tertiary)')}>{copy.installing}</p>
<Progress animated aria-label={copy.installing} className="h-0.5 bg-primary/15" indeterminate />
+ {target.state === 'initiated' && target.catalog.phase ? (
+ <p className={cn(CAPTION, 'text-(--ui-text-quaternary)')}>{copy.phase[target.catalog.phase]}</p>
+ ) : null}
</div>
)
}
diff --git a/apps/desktop/src/components/assistant-ui/connector-tool.tsx b/apps/desktop/src/components/assistant-ui/connector-tool.tsx
index 68b3dda179c..d174ab2364a 100644
--- a/apps/desktop/src/components/assistant-ui/connector-tool.tsx
+++ b/apps/desktop/src/components/assistant-ui/connector-tool.tsx
@@ -20,13 +20,14 @@ import {
} from '@/lib/connector-tools'
import {
$connectionRequests,
+ connectionOpOf,
type ConnectionOwner,
connectionOwnerFor,
type ConnectionRequest,
connectionRequestOpen,
type ConnectionTarget,
continueConnectionRequest,
- sessionConnectionRequest
+ toolConnectionRequest
} from '@/store/connection-request'
import { requestGatewayForAgent } from '@/store/gateway'
import { notifyError } from '@/store/notifications'
@@ -148,7 +149,14 @@ export function ConnectorTool(props: ToolCallMessagePartProps) {
const view = useSessionView()
const runtimeId = useStore(view.$runtimeId)
const storedId = useStore(view.$storedId)
- const $request = useMemo(() => sessionConnectionRequest(runtimeId), [runtimeId])
+ const opId = connectionOpOf(props.args)
+ const running = props.result === undefined
+
+ const $request = useMemo(
+ () => toolConnectionRequest(runtimeId, props.toolCallId, opId, running),
+ [opId, props.toolCallId, running, runtimeId]
+ )
+
const request = useStore($request)
const targetNames = requestedConnectorNames(props.args)
diff --git a/apps/desktop/src/components/assistant-ui/mcp-setup-tool.tsx b/apps/desktop/src/components/assistant-ui/mcp-setup-tool.tsx
index 3ef7b724dbd..10beb6ae512 100644
--- a/apps/desktop/src/components/assistant-ui/mcp-setup-tool.tsx
+++ b/apps/desktop/src/components/assistant-ui/mcp-setup-tool.tsx
@@ -24,13 +24,14 @@ import { Loader2 } from '@/lib/icons'
import { prettyName } from '@/lib/text'
import { cn } from '@/lib/utils'
import {
+ connectionOpOf,
type ConnectionOwner,
type ConnectionRequest,
type ConnectionTarget,
type ConnectionTargetState,
continueConnectionRequest,
respondToConnectionRequest,
- sessionConnectionRequest
+ toolConnectionRequest
} from '@/store/connection-request'
import { notifyError } from '@/store/notifications'
import { invalidateMcpSuggestionIndex } from '@/store/suggestion-providers/mcp'
@@ -189,7 +190,14 @@ export function McpSetupPending(props: ToolCallMessagePartProps) {
const sessionId = useStore(view.$runtimeId)
// Owner routes and hints are keyed by the stored id, not the runtime id the events carry.
const storedId = useStore(view.$storedId)
- const $request = useMemo(() => sessionConnectionRequest(sessionId), [sessionId])
+ const opId = connectionOpOf(props.args)
+ const running = props.result === undefined
+
+ const $request = useMemo(
+ () => toolConnectionRequest(sessionId, props.toolCallId, opId, running),
+ [opId, props.toolCallId, running, sessionId]
+ )
+
const request = useStore($request)
const action = useMemo(() => readSetupAction(props.args), [props.args])
// The session's operation belongs to one tool call; another call's request never paints here.
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 4e30da689cb..417adaf1451 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -2,6 +2,7 @@ import { FIELD_DESCRIPTIONS, FIELD_LABELS } from '@/app/settings/constants'
import { enAuxTasks } from './en_aux_tasks'
import { enBoot } from './en_boot'
+import { enCatalogInstall } from './en_catalog_install'
import { enModelMenu } from './en_model_menu'
import { enNotices } from './en_notices'
import { enSharedMetrics } from './en_shared_metrics'
@@ -5181,29 +5182,7 @@ export const en: Translations = {
notDelivered:
"This question didn't reach the app, so it can't be answered here. Press Stop to end the turn, then reply in chat."
},
- 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'
- },
+ catalogInstall: enCatalogInstall,
mcpSetup: {
installTitle: 'Add MCP servers',
enableTitle: 'Enable MCP servers',
diff --git a/apps/desktop/src/i18n/en_catalog_install.ts b/apps/desktop/src/i18n/en_catalog_install.ts
new file mode 100644
index 00000000000..5a4df6057c0
--- /dev/null
+++ b/apps/desktop/src/i18n/en_catalog_install.ts
@@ -0,0 +1,36 @@
+import type { CatalogInstallTranslations } from './types_catalog_install'
+
+export const enCatalogInstall: CatalogInstallTranslations = {
+ 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',
+ requiresHermes: range => `Hermes ${range}`,
+ envVar: name => `${name} environment variable`,
+ credentialsHeading: 'Credentials',
+ phase: {
+ downloading: 'Downloading…',
+ python_packages: 'Installing Python packages…',
+ loading_tools: 'Loading its tools…'
+ },
+ serverNotConnected: (server, reason) => `MCP server ${server} not connected${reason ? `: ${reason}` : ''}`,
+ notEnabled: 'Installed but not turned on',
+ missingEnv: names => `Set ${names} to finish setup`,
+ alreadyInstalled: 'Already installed; left as it is'
+}
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index 56852a3c0ff..f5a22c9444d 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -10,6 +10,7 @@ import type { TipId } from '@/lib/tips/catalog'
import type { AuxTaskCopyMap } from './types_aux_tasks'
import type { BootTranslations } from './types_boot'
+import type { CatalogInstallTranslations } from './types_catalog_install'
import type { ModelMenuTranslations } from './types_model_menu'
import type { NoticeTranslations } from './types_notices'
import type { SharedMetricsTranslations } from './types_shared_metrics'
@@ -4301,29 +4302,7 @@ export interface Translations extends NoticeTranslations {
questionProgress: (answered: number, total: number) => string
notDelivered: 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
- }
+ catalogInstall: CatalogInstallTranslations
mcpSetup: {
installTitle: string
enableTitle: string
diff --git a/apps/desktop/src/i18n/types_catalog_install.ts b/apps/desktop/src/i18n/types_catalog_install.ts
new file mode 100644
index 00000000000..a4c256ab6b6
--- /dev/null
+++ b/apps/desktop/src/i18n/types_catalog_install.ts
@@ -0,0 +1,33 @@
+import type { InstallPhase } from '@hermes/shared'
+
+/** Copy for the desktop catalog-install card (`manage_catalog`) and its Advanced dialog. */
+export interface CatalogInstallTranslations {
+ 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
+ requiresHermes: (range: string) => string
+ envVar: (name: string) => string
+ credentialsHeading: string
+ phase: Record<InstallPhase, string>
+ serverNotConnected: (server: string, reason: string) => string
+ notEnabled: string
+ missingEnv: (names: string) => string
+ alreadyInstalled: string
+}
diff --git a/apps/desktop/src/store/connection-request.ts b/apps/desktop/src/store/connection-request.ts
index bc28c6022e8..b67b7ad9339 100644
--- a/apps/desktop/src/store/connection-request.ts
+++ b/apps/desktop/src/store/connection-request.ts
@@ -1,6 +1,9 @@
+import type { ToolCallMessagePart } from '@assistant-ui/react'
import type {
+ CatalogApproved,
CatalogAppState,
CatalogScan,
+ CatalogServerError,
CatalogTier,
ConnectionAnswer,
ConnectionOperationStatus,
@@ -11,12 +14,14 @@ import type {
ConnectionTargetEnvField,
ConnectionTargetKind,
ConnectionTargetState,
- ConnectionUpdatePayload
+ ConnectionUpdatePayload,
+ InstallPhase
} from '@hermes/shared'
import { atom, computed } from 'nanostores'
import { resolveSessionOwner } from '@/app/session/hooks/use-session-actions/utils'
import type { SetupField } from '@/components/ui/setup-field-list'
+import { connectorText } from '@/lib/connector-tools'
import { $gateway, requestGatewayForAgent } from './gateway'
import { $activeGatewayProfile } from './profile'
@@ -53,12 +58,25 @@ export interface CatalogEntry {
sha: string | null
subdir: string | null
scan: CatalogScan | null
- requirements: string[]
+ /** The Hermes version range the plugin needs; its env vars are the target's `requiredEnv`. */
+ requiresHermes: string | null
hasDesktopHalf: boolean
- targetProfile: string
+ /** The profile the row installs into; null when the chat's home is no named profile. */
+ targetProfile: string | null
appState: CatalogAppState | null
/** On an installed skill row: the qualified name the model can now load. */
skill: string | null
+ /** The install step while the row is installing; the card words it. */
+ phase: InstallPhase | null
+ /** The non-secret choices the user approved; a Try again after the card settled repeats them. */
+ approved: CatalogApproved | null
+ /** Facts on an installed row: whether it was turned on, what it still needs, what did not connect. */
+ enabled: boolean | null
+ missingEnv: string[]
+ serverErrors: CatalogServerError[]
+ alreadyInstalled: boolean
+ /** The backend's word that the row needs nothing more from the user: installed, skipped or failed. */
+ resolved: boolean
}
/** One target of the operation as the renderer knows it. State comes only from the backend
@@ -90,7 +108,8 @@ export interface ConnectionOwner {
}
export interface ConnectionRequest {
- /** The model's tool call that opened the operation. The card lives on that row and no other. */
+ /** The model's tool call that opened the operation. Call ids repeat across turns, so the row names its
+ * card by op id (`CONNECTION_OP_ARG`); the call id is only the fallback for a row without one. */
toolCallId: string
opId: string
/** The sequence of the newest frame this cache holds; an older frame for the same op is dropped. */
@@ -109,8 +128,45 @@ const keyFor = (sessionId: string | null | undefined): string => sessionId ?? ''
export const $connectionRequests = atom<Record<string, ConnectionRequest>>({})
-export const sessionConnectionRequest = (sessionId: string | null) =>
- computed($connectionRequests, requests => requests[keyFor(sessionId)] ?? null)
+/** Settled operations the session's current one replaced, oldest first. Their cards stay drawn on the
+ * rows that opened them: every settled install card, and the last settled connect card when the current
+ * operation is an install one. A later connect operation still replaces the connect card, so consecutive
+ * connect calls show one card. */
+const $keptConnectionRequests = atom<Record<string, ConnectionRequest[]>>({})
+
+/** The key a tool row's args carry its operation id under, written when `connection.request` arrives.
+ * Models reuse call ids (`call_0` on every turn), so the op id, not the call id, names a row's card. */
+export const CONNECTION_OP_ARG = 'hermes_connection_op'
+
+export const connectionOpOf = (args: ToolCallMessagePart['args']): null | string =>
+ connectorText(args[CONNECTION_OP_ARG]) || null
+
+/** The operation a tool row draws. A row that carries an op id draws that operation and no other. A row
+ * without one (history loaded from disk, or a call whose request has not arrived yet) falls back to its
+ * call id, but only when a single known operation has that id, and a running row never takes a settled
+ * one: that is an earlier call's card. */
+export const toolConnectionRequest = (
+ sessionId: string | null,
+ toolCallId: string,
+ opId: null | string,
+ running: boolean
+) =>
+ computed([$connectionRequests, $keptConnectionRequests], (requests, kept) => {
+ const key = keyFor(sessionId)
+
+ const known = [requests[key], ...(kept[key] ?? [])].filter((request): request is ConnectionRequest =>
+ Boolean(request)
+ )
+
+ if (opId) {
+ return known.find(request => request.opId === opId) ?? null
+ }
+
+ const matches = known.filter(request => request.toolCallId === toolCallId)
+ const only = matches.length === 1 ? matches[0] : null
+
+ return only && !(running && only.settled) ? only : null
+ })
const TARGET_STATES: readonly ConnectionTargetState[] = [
'connected',
@@ -140,20 +196,37 @@ const settleReason = oneOf(SETTLE_REASONS)
export const isCatalogKind = (kind: ConnectionTargetKind): kind is 'plugin' | 'skill' =>
kind === 'plugin' || kind === 'skill'
+/** A `manage_catalog` install operation, as opposed to a `manage_connections` one. */
+export const isCatalogRequest = (request: ConnectionRequest): boolean =>
+ request.targets.some(target => isCatalogKind(target.kind))
+
+type InstalledFacts = Pick<CatalogEntry, 'alreadyInstalled' | 'enabled' | 'missingEnv' | 'serverErrors'>
+
+const installedFacts = (entry: ConnectionOperationTarget): InstalledFacts => ({
+ alreadyInstalled: entry.already_installed ?? false,
+ enabled: entry.enabled ?? null,
+ missingEnv: entry.missing_env ?? [],
+ serverErrors: entry.server_errors ?? []
+})
+
function catalogEntry(entry: ConnectionOperationTarget, name: string): CatalogEntry {
return {
+ ...installedFacts(entry),
appState: entry.app_state ?? null,
+ approved: entry.approved ?? null,
description: entry.description ?? '',
display: entry.display?.trim() || name,
hasDesktopHalf: entry.has_desktop_half ?? false,
+ phase: entry.phase ?? null,
platforms: entry.platforms ?? [],
repo: entry.repo ?? null,
- requirements: entry.requirements ?? [],
+ requiresHermes: entry.requires_hermes ?? null,
+ resolved: entry.resolved ?? false,
scan: entry.scan ?? null,
sha: entry.sha ?? null,
skill: entry.skill ?? null,
subdir: entry.subdir ?? null,
- targetProfile: entry.target_profile?.trim() || 'default',
+ targetProfile: entry.target_profile?.trim() || null,
tier: entry.tier ?? null
}
}
@@ -304,7 +377,22 @@ export function applyConnectionUpdate(request: ConnectionRequest, update: Connec
}
export function setConnectionRequest(request: ConnectionRequest): void {
- $connectionRequests.set({ ...$connectionRequests.get(), [keyFor(request.sessionId)]: request })
+ const key = keyFor(request.sessionId)
+ const requests = $connectionRequests.get()
+ const previous = requests[key]
+
+ if (previous && previous.opId !== request.opId) {
+ const catalog = isCatalogRequest(request)
+ const stays = (entry: ConnectionRequest) => isCatalogRequest(entry) || isCatalogRequest(entry) !== catalog
+ const kept = ($keptConnectionRequests.get()[key] ?? []).filter(entry => entry.opId !== request.opId && stays(entry))
+
+ $keptConnectionRequests.set({
+ ...$keptConnectionRequests.get(),
+ [key]: previous.settled && stays(previous) ? [...kept, previous] : kept
+ })
+ }
+
+ $connectionRequests.set({ ...requests, [key]: request })
}
export function updateConnectionRequest(sessionId: string | null, update: ConnectionUpdatePayload): void {
@@ -321,28 +409,27 @@ export function updateConnectionRequest(sessionId: string | null, update: Connec
}
}
+/** Drop the session's operation (or, with no session, every one) whose op id matches, from the current
+ * and the replaced caches alike. */
export function clearConnectionRequest(opId?: string, sessionId?: string | null): void {
- const requests = $connectionRequests.get()
+ const cleared = ([key, value]: [string, ConnectionRequest]) =>
+ (sessionId === undefined || key === keyFor(sessionId)) && (!opId || value.opId === opId)
- if (sessionId !== undefined) {
- const key = keyFor(sessionId)
- const current = requests[key]
+ const entries = Object.entries($connectionRequests.get())
+ const current = entries.filter(entry => !cleared(entry))
- if (!current || (opId && current.opId !== opId)) {
- return
- }
-
- const next = { ...requests }
- delete next[key]
- $connectionRequests.set(next)
-
- return
+ if (current.length !== entries.length) {
+ $connectionRequests.set(Object.fromEntries(current))
}
- const kept = Object.entries(requests).filter(([, value]) => opId && value.opId !== opId)
+ const keptBefore = $keptConnectionRequests.get()
+
+ const keptAfter = Object.fromEntries(
+ Object.entries(keptBefore).map(([key, list]) => [key, list.filter(request => !cleared([key, request]))])
+ )
- if (kept.length !== Object.keys(requests).length) {
- $connectionRequests.set(Object.fromEntries(kept))
+ if (Object.keys(keptBefore).some(key => keptAfter[key].length !== keptBefore[key].length)) {
+ $keptConnectionRequests.set(keptAfter)
}
}
diff --git a/apps/shared/src/gateway-contract.generated.ts b/apps/shared/src/gateway-contract.generated.ts
index ba3e2d22b79..0aa03c2935a 100644
--- a/apps/shared/src/gateway-contract.generated.ts
+++ b/apps/shared/src/gateway-contract.generated.ts
@@ -1033,6 +1033,7 @@ export interface ConnectionOperationTarget {
kind: ConnectionTargetKind
action: ConnectionTargetAction
state: ConnectionTargetState
+ resolved?: boolean | null
detail?: string | null
instructions?: string | null
discovery_error?: string | null
@@ -1050,11 +1051,17 @@ export interface ConnectionOperationTarget {
sha?: string | null
subdir?: string | null
scan?: CatalogScan | null
- requirements?: string[] | null
+ requires_hermes?: string | null
has_desktop_half?: boolean | null
target_profile?: string | null
app_state?: CatalogAppState | null
skill?: string | null
+ phase?: InstallPhase | null
+ approved?: CatalogApproved | null
+ enabled?: boolean | null
+ missing_env?: string[] | null
+ server_errors?: CatalogServerError[] | null
+ already_installed?: boolean | null
}
export type ConnectionTargetKind = 'connector' | 'mcp' | 'plugin' | 'skill'
export type ConnectionTargetAction = 'authorize' | 'connect' | 'enable' | 'install' | 'reconnect'
@@ -1077,6 +1084,19 @@ export interface CatalogScan {
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'
+/** The slow steps of an install, as ids; the desktop catalog card words them in its own language. The wire contract imports this enum. */
+export type InstallPhase = 'downloading' | 'python_packages' | 'loading_tools'
+/** The non-secret Advanced choices the user approved on a catalog row; a Try again after the operation settled repeats them. */
+export interface CatalogApproved {
+ force: boolean
+ enable: boolean
+ ref?: string | null
+}
+/** An MCP server an installed plugin brought that did not connect, with the raw reason. */
+export interface CatalogServerError {
+ name: string
+ error: string
+}
export interface ConnectionWakeResult {
status: 'ok'
}
diff --git a/apps/shared/src/gateway-contract.openrpc.json b/apps/shared/src/gateway-contract.openrpc.json
index 92946d483d2..dbd6379bef8 100644
--- a/apps/shared/src/gateway-contract.openrpc.json
+++ b/apps/shared/src/gateway-contract.openrpc.json
@@ -7559,6 +7559,38 @@
"title": "CatalogAppState",
"type": "string"
},
+ "CatalogApproved": {
+ "additionalProperties": false,
+ "description": "The non-secret Advanced choices the user approved on a catalog row; a Try again after the\noperation settled repeats them.",
+ "properties": {
+ "force": {
+ "title": "Force",
+ "type": "boolean"
+ },
+ "enable": {
+ "title": "Enable",
+ "type": "boolean"
+ },
+ "ref": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Ref"
+ }
+ },
+ "required": [
+ "force",
+ "enable"
+ ],
+ "title": "CatalogApproved",
+ "type": "object"
+ },
"CatalogScan": {
"additionalProperties": false,
"description": "The catalog's security scan of the pinned commit; read-only on the card.",
@@ -7587,6 +7619,26 @@
"title": "CatalogScanStatus",
"type": "string"
},
+ "CatalogServerError": {
+ "additionalProperties": false,
+ "description": "An MCP server an installed plugin brought that did not connect, with the raw reason.",
+ "properties": {
+ "name": {
+ "title": "Name",
+ "type": "string"
+ },
+ "error": {
+ "title": "Error",
+ "type": "string"
+ }
+ },
+ "required": [
+ "name",
+ "error"
+ ],
+ "title": "CatalogServerError",
+ "type": "object"
+ },
"CatalogTier": {
"enum": [
"official",
@@ -9266,6 +9318,18 @@
"state": {
"$ref": "#/components/schemas/ConnectionTargetState"
},
+ "resolved": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Resolved"
+ },
"detail": {
"anyOf": [
{
@@ -9477,20 +9541,17 @@
],
"default": null
},
- "requirements": {
+ "requires_hermes": {
"anyOf": [
{
- "items": {
- "type": "string"
- },
- "type": "array"
+ "type": "string"
},
{
"type": "null"
}
],
"default": null,
- "title": "Requirements"
+ "title": "Requires Hermes"
},
"has_desktop_half": {
"anyOf": [
@@ -9538,6 +9599,82 @@
],
"default": null,
"title": "Skill"
+ },
+ "phase": {
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/InstallPhase"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null
+ },
+ "approved": {
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/CatalogApproved"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null
+ },
+ "enabled": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Enabled"
+ },
+ "missing_env": {
+ "anyOf": [
+ {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Missing Env"
+ },
+ "server_errors": {
+ "anyOf": [
+ {
+ "items": {
+ "$ref": "#/components/schemas/CatalogServerError"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Server Errors"
+ },
+ "already_installed": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Already Installed"
}
},
"required": [
@@ -16678,6 +16815,16 @@
"title": "InsightsGetResult",
"type": "object"
},
+ "InstallPhase": {
+ "description": "The slow steps of an install, as ids; the desktop catalog card words them in its own language.\nThe wire contract imports this enum.",
+ "enum": [
+ "downloading",
+ "python_packages",
+ "loading_tools"
+ ],
+ "title": "InstallPhase",
+ "type": "string"
+ },
"InterruptStatus": {
"enum": [
"interrupted",
diff --git a/hermes_cli/config_defaults.py b/hermes_cli/config_defaults.py
index 4e1c16b0dd9..e29687dbbd6 100644
--- a/hermes_cli/config_defaults.py
+++ b/hermes_cli/config_defaults.py
@@ -2023,8 +2023,8 @@ DEFAULT_CONFIG = {
"defer": [
"computer_use", "session_search", "image_generate",
"todo_list", "process_manage", "cronjob_manage",
- # Desktop GUI surface (desktop_ui + project toolsets)
- "drive_preview", "gui_tour", "desktop_preview", "annotate_preview",
+ # Desktop GUI surface (desktop_ui, project and catalog toolsets)
+ "drive_preview", "gui_tour", "desktop_preview", "annotate_preview", "manage_catalog",
"show_tip", "desktop_project", "close_terminal",
"apply_layout", "read_terminal", "read_window_below", "focus_pane",
],
diff --git a/hermes_cli/observability/schemas/hermes.shared_metrics.v3.schema.json b/hermes_cli/observability/schemas/hermes.shared_metrics.v3.schema.json
index e919a64f7d6..af55afbbf46 100644
--- a/hermes_cli/observability/schemas/hermes.shared_metrics.v3.schema.json
+++ b/hermes_cli/observability/schemas/hermes.shared_metrics.v3.schema.json
@@ -3226,6 +3226,7 @@
"enum": [
"bot_room",
"browser",
+ "catalog",
"clarify",
"code_execution",
"coding",
@@ -3272,7 +3273,6 @@
"safe",
"search",
"session_search",
- "setup",
"skills",
"spotify",
"terminal",
diff --git a/hermes_cli/observability/schemas/hermes.shared_metrics.v4.schema.json b/hermes_cli/observability/schemas/hermes.shared_metrics.v4.schema.json
index 8c31546b612..d9e674e0b18 100644
--- a/hermes_cli/observability/schemas/hermes.shared_metrics.v4.schema.json
+++ b/hermes_cli/observability/schemas/hermes.shared_metrics.v4.schema.json
@@ -3560,6 +3560,7 @@
"enum": [
"bot_room",
"browser",
+ "catalog",
"clarify",
"code_execution",
"coding",
@@ -3606,7 +3607,6 @@
"safe",
"search",
"session_search",
- "setup",
"skills",
"spotify",
"terminal",
diff --git a/hermes_cli/plugins_cmd.py b/hermes_cli/plugins_cmd.py
index ba3950ae51a..1e6bb076a1f 100644
--- a/hermes_cli/plugins_cmd.py
+++ b/hermes_cli/plugins_cmd.py
@@ -11,10 +11,11 @@ import logging
import os
import shutil
import sys
+import threading
from pathlib import Path
from typing import Any, NoReturn, Optional
-from hermes_constants import get_hermes_home
+from hermes_constants import get_hermes_home, hermes_home_key
from hermes_cli.config import cfg_get
from hermes_cli.plugin_capabilities import _child_dict
# Tests patch these two on the facade; the install/remove siblings read them through it.
@@ -601,19 +602,32 @@ def _forget_plugin_config(aliases: set) -> dict[str, Any]:
return result
+# One lock per Hermes home. The Desktop install card enables several plugins at once, each on its own
+# thread; without it every thread read the same config version and all but the first commit were
+# refused as stale. The version check in PM stays: it still catches an edit from another process.
+_SELECTION_LOCKS: dict[str, threading.Lock] = {}
+_SELECTION_LOCKS_GUARD = threading.Lock()
+
+
+def _selection_lock() -> threading.Lock:
+ with _SELECTION_LOCKS_GUARD:
+ return _SELECTION_LOCKS.setdefault(hermes_home_key(), threading.Lock())
+
+
def _set_plugin_enabled(name: str, *, enable: bool, aliases=(), console=None) -> None:
"""Submit the command's delta with the version of the selection it read."""
from pm.plugins_state import read_home_selection
- expected_config = _plugin_selection_version()
- config = read_home_selection(get_hermes_home()) or {}
- plugins = config.get("plugins") or {}
- enabled = set(plugins.get("enabled") or ())
- disabled = set(plugins.get("disabled") or ())
- _apply_activation(enabled, disabled, name, aliases, enable=enable)
- _admit_and_save_plugin_sets(enabled, disabled, console=console,
- action=f"{'Enable' if enable else 'Disable'} '{name}'",
- expected_config=expected_config, plugin=name if enable else None)
+ with _selection_lock():
+ expected_config = _plugin_selection_version()
+ config = read_home_selection(get_hermes_home()) or {}
+ plugins = config.get("plugins") or {}
+ enabled = set(plugins.get("enabled") or ())
+ disabled = set(plugins.get("disabled") or ())
+ _apply_activation(enabled, disabled, name, aliases, enable=enable)
+ _admit_and_save_plugin_sets(enabled, disabled, console=console,
+ action=f"{'Enable' if enable else 'Disable'} '{name}'",
+ expected_config=expected_config, plugin=name if enable else None)
def _apply_activation(enabled: set, disabled: set, key: str, aliases, *, enable: bool) -> None:
diff --git a/hermes_cli/plugins_cmd_install.py b/hermes_cli/plugins_cmd_install.py
index 6fd4a05dab3..8ed89e320e3 100644
--- a/hermes_cli/plugins_cmd_install.py
+++ b/hermes_cli/plugins_cmd_install.py
@@ -13,6 +13,7 @@ import sys
import tempfile
from contextlib import contextmanager
from contextvars import ContextVar
+from enum import StrEnum
from pathlib import Path
from typing import Any, Callable, Optional
@@ -709,26 +710,42 @@ def _select_memory_provider(name: str, console, *, select: bool) -> None:
f"Run `hermes memory setup {name}` to configure it; new sessions use it.")
-def dashboard_install_plugin(
- identifier: str, *, force: bool, enable: bool, catalog_name: Optional[str] = None,
- ref: Optional[str] = None, assume_deps_consent: Optional[bool] = None,
-) -> dict[str, Any]:
- """Non-interactive install for the dashboard/TUI. *catalog_name* installs a curated entry at its
- pinned SHA (identifier may be empty); *ref* pins a custom source to one full commit SHA (same
- contract as ``--ref``); every path enforces the kill list (no GUI bypass). *assume_deps_consent*
- is consent the caller holds for the Python deps, so no terminal is needed to answer the gate.
- None (a user's Install click) is the consent the fresh-install enable already acts on: a plugin
- the config already selects (``memory.provider``) would otherwise be refused every time, while
- the same plugin unselected installs and enables. A forced replacement still needs explicit consent."""
- if assume_deps_consent is None:
- assume_deps_consent = enable and not force
+class InstallPhase(StrEnum):
+ """The slow steps of an install, as ids; the desktop catalog card words them in its own language.
+ The wire contract imports this enum."""
+
+ downloading = "downloading"
+ python_packages = "python_packages"
+ loading_tools = "loading_tools"
+
+
+def _catalog_install_on_disk(catalog_name: str) -> Optional[tuple]:
+ """``(target, manifest, installed_name)`` of the installed, not enabled tree whose install record
+ names catalog entry *catalog_name*, else None. A refused enable leaves the published clone in
+ place (there is no rollback), so the card's Try again, or the model asking again, stopped at
+ "already exists" on a second clone and the plugin could never be turned on from the card."""
+ enabled = _pc()._get_enabled_set()
+ for key, record in _pc()._read_install_metadata().items():
+ block = record.get("catalog") if isinstance(record, dict) else None
+ target = _pc()._plugins_dir() / key
+ if not (isinstance(block, dict) and block.get("name") == catalog_name and target.is_dir()):
+ continue
+ manifest = _pc()._read_manifest(target)
+ installed_name = manifest.get("name") or target.name
+ return None if {installed_name, target.name} & enabled else (target, manifest, installed_name)
+ return None
+
+
+def _resolve_source(identifier: str, catalog_name: Optional[str]) -> tuple:
+ """``(entry, identifier, warnings, error)``: the catalog entry (None for a custom source), the
+ identifier to clone, the warnings so far, and the refusal result when there is one."""
from hermes_cli import plugins_cmd_catalog as catalog
warnings: list[str] = []
entry = None
if catalog_name:
entry = catalog.get_live_catalog_entry(catalog_name)
if entry is None:
- return {"ok": False, "error": f"'{catalog_name}' is not in the Hermes plugin catalog."}
+ return None, identifier, warnings, {"ok": False, "error": f"'{catalog_name}' is not in the Hermes plugin catalog."}
warnings.extend(_known_issue_warnings(entry))
identifier = entry.install_identifier
else:
@@ -741,7 +758,19 @@ def dashboard_install_plugin(
except ValueError:
pass
except _pc().PluginOperationError as exc:
- return {"ok": False, "error": str(exc)}
+ return entry, identifier, warnings, {"ok": False, "error": str(exc)}
+ return entry, identifier, warnings, None
+
+
+def _place_tree(entry, identifier: str, *, force: bool, ref: Optional[str], assume_deps_consent: bool,
+ step: Callable[[InstallPhase], None]) -> tuple | dict:
+ """``(target, manifest, installed_name)`` of the tree to enable, or the error result. A catalog
+ entry already on disk and not enabled (an earlier enable was refused) is used as it is."""
+ from hermes_cli import plugins_cmd_catalog as catalog
+ on_disk = _catalog_install_on_disk(entry.name) if entry is not None and not force else None
+ if on_disk is not None:
+ return on_disk
+
def _install() -> tuple:
if entry is not None:
return catalog.install_catalog_entry(entry, force=force, allow_removed=False,
@@ -749,9 +778,10 @@ def dashboard_install_plugin(
return _pc()._install_plugin_core(identifier, force=force, ref=(ref or "").strip() or None,
assume_deps_consent=assume_deps_consent)
+ step(InstallPhase.downloading)
try:
- target, installed_manifest, installed_name = recorded_install(
- _install, catalog_name=entry.name if entry is not None else None, identifier=identifier)
+ return recorded_install(_install, catalog_name=entry.name if entry is not None else None,
+ identifier=identifier)
except _pc().PluginScanBlocked as exc:
fields = ("pattern_id", "severity", "category", "file", "line", "description")
return {
@@ -765,21 +795,53 @@ def dashboard_install_plugin(
except _pc().PluginOperationError as exc:
return {"ok": False, "error": str(exc)}
- if enable:
- from hermes_cli.plugins_admission import AdmissionRefused
- try:
- _pc()._set_plugin_enabled(installed_name, enable=True)
- except AdmissionRefused as exc:
- return {
- "ok": False, "error": f"enable refused: {exc}",
- "plugin_name": installed_name, "enabled": False,
- }
+def _enable_placed(installed_name: str, deps, step: Callable[[InstallPhase], None]) -> Optional[dict]:
+ """None once enabled, else the refusal result. Enabling admits the plugin, and admission resolves
+ its Python dependencies."""
+ from hermes_cli.plugins_admission import AdmissionRefused
+
+ if deps:
+ step(InstallPhase.python_packages)
+ try:
+ _pc()._set_plugin_enabled(installed_name, enable=True)
+ except AdmissionRefused as exc:
+ return {"ok": False, "error": f"enable refused: {exc}", "plugin_name": installed_name, "enabled": False}
+ return None
+
+
+def dashboard_install_plugin(
+ identifier: str, *, force: bool, enable: bool, catalog_name: Optional[str] = None,
+ ref: Optional[str] = None, assume_deps_consent: Optional[bool] = None,
+ on_step: Optional[Callable[[InstallPhase], None]] = None,
+) -> dict[str, Any]:
+ """Non-interactive install for the dashboard/TUI. *catalog_name* installs a curated entry at its
+ pinned SHA (identifier may be empty); *ref* pins a custom source to one full commit SHA (same
+ contract as ``--ref``); every path enforces the kill list (no GUI bypass). *assume_deps_consent*
+ is consent the caller holds for the Python deps, so no terminal is needed to answer the gate.
+ None (a user's Install click) is the consent the fresh-install enable already acts on: a plugin
+ the config already selects (``memory.provider``) would otherwise be refused every time, while
+ the same plugin unselected installs and enables. A forced replacement still needs explicit consent.
+ *on_step* hears each slow phase as it starts (the catalog card draws it under its bar)."""
+ if assume_deps_consent is None:
+ assume_deps_consent = enable and not force
+ step = on_step or (lambda _phase: None)
+ entry, identifier, warnings, error = _resolve_source(identifier, catalog_name)
+ if error is not None:
+ return error
+ placed = _place_tree(entry, identifier, force=force, ref=ref, assume_deps_consent=assume_deps_consent, step=step)
+ if isinstance(placed, dict):
+ return placed
+ target, installed_manifest, installed_name = placed
deps = _pc()._python_dependency_summary(target, warnings)
+ if enable and (refused := _enable_placed(installed_name, deps, step)):
+ return refused
ap = target / "after-install.md"
# Deps first, then load: the plugin activates in this process (TUI/Desktop server subscribers see it)
# and in the running gateway; ``activation`` says what is live now vs next session (#87770).
from hermes_cli.plugins_activation import activate_plugin_now
+ if enable:
+ step(InstallPhase.loading_tools)
activated = activate_plugin_now(installed_name) if enable else {
"gateway_reloaded": False, "activation": None, "restart_required": False}
return {
diff --git a/locales/_keys.desktop.json b/locales/_keys.desktop.json
index ff55544f4fc..7651b31eafc 100644
--- a/locales/_keys.desktop.json
+++ b/locales/_keys.desktop.json
@@ -105,8 +105,10 @@
"assistant.approval.sendFailed",
"assistant.approval.timedOutSystemLine",
"assistant.catalogInstall.advanced",
+ "assistant.catalogInstall.alreadyInstalled",
"assistant.catalogInstall.commitLabel",
"assistant.catalogInstall.credentialsHeading",
+ "assistant.catalogInstall.envVar",
"assistant.catalogInstall.failed",
"assistant.catalogInstall.hideNames",
"assistant.catalogInstall.install",
@@ -114,14 +116,21 @@
"assistant.catalogInstall.installing",
"assistant.catalogInstall.kind.plugin",
"assistant.catalogInstall.kind.skill",
+ "assistant.catalogInstall.missingEnv",
+ "assistant.catalogInstall.notEnabled",
"assistant.catalogInstall.notInstalled",
+ "assistant.catalogInstall.phase.downloading",
+ "assistant.catalogInstall.phase.loading_tools",
+ "assistant.catalogInstall.phase.python_packages",
"assistant.catalogInstall.preparing",
"assistant.catalogInstall.requirementsLabel",
+ "assistant.catalogInstall.requiresHermes",
"assistant.catalogInstall.scan.failed",
"assistant.catalogInstall.scan.passed",
"assistant.catalogInstall.scan.warnings",
"assistant.catalogInstall.securityHeading",
"assistant.catalogInstall.sendFailed",
+ "assistant.catalogInstall.serverNotConnected",
"assistant.catalogInstall.showNames",
"assistant.catalogInstall.skill",
"assistant.catalogInstall.skip",
diff --git a/model_tools.py b/model_tools.py
index 138797668fa..2a976c7ed06 100644
--- a/model_tools.py
+++ b/model_tools.py
@@ -324,14 +324,10 @@ def _select_tool_names(enabled_toolsets: Optional[List[str]], disabled_toolsets:
enabled.append("kanban")
_apply_toolset_selection(tools, enabled, quiet_mode, disable=False)
else:
- from toolsets import get_all_toolsets
+ from toolsets import TOOLSET_SESSION_PLATFORMS, get_all_toolsets
for ts_name in get_all_toolsets():
- tools.update(resolve_toolset(ts_name))
- # A role-reserved toolset (``setup``) reaches only a profile carrying that role, whatever the config,
- # CLI flag, env pin or "all" asked for; this is the one point every surface's selection passes.
- from toolsets import profile_role_toolsets
- for ts_name in profile_role_toolsets()[1]:
- tools.difference_update(resolve_toolset(ts_name))
+ if ts_name not in TOOLSET_SESSION_PLATFORMS:
+ tools.update(resolve_toolset(ts_name))
# Disabled toolsets are always subtracted LAST, so a tool in a disabled
# toolset is stripped even when a composite (hermes-cli) re-enables it.
# This ensures that even if a composite toolset (like hermes-cli) is enabled, any tools belonging to a
diff --git a/tests/tools/test_connectors_catalog.py b/tests/tools/test_connectors_catalog.py
index 079a255a29d..631f9ef3c10 100644
--- a/tests/tools/test_connectors_catalog.py
+++ b/tests/tools/test_connectors_catalog.py
@@ -1,11 +1,11 @@
-"""``manage_catalog`` (the setup profile's catalog install through the connection card).
+"""``manage_catalog`` (catalog install through the connection card).
Contracts:
-- the tool reaches only a session of the ``role: setup`` profile, and only a desktop chat draws it
+- the tool reaches only desktop sessions, whatever a config selects, and is deferred by default
+- only a desktop chat draws it
- the model sends catalog ids and an action; every other key is refused before anything runs
- an id the catalog does not know, or a plugin this OS cannot run, is drawn failed and never installed
-- an approved row installs into ``default`` (or the profile the Advanced modal named) and reports
- what went live; the card never witnesses the outcome
+- an approved row installs and reports what went live; the card never witnesses the outcome
"""
import json
@@ -53,7 +53,7 @@ class FakeInstaller:
if entry.name in self.refusal:
raise RuntimeError(self.refusal[entry.name])
- def install_plugin(self, name, *, force, enable, ref):
+ def install_plugin(self, name, *, force, enable, ref, on_step):
from hermes_constants import get_hermes_home
self.installs.append({"name": name, "force": force, "enable": enable, "ref": ref,
@@ -101,28 +101,22 @@ def _approve(env=None):
for t in payload["targets"] if t["state"] == "pending"]}
-def test_only_a_setup_profile_session_selects_the_tool(tmp_path, monkeypatch):
+def test_only_a_desktop_session_carries_the_tool():
import model_tools
- from hermes_cli.profiles import write_profile_meta
- from hermes_constants import reset_hermes_home_override, set_hermes_home_override
-
- homes = {}
- for name, role in (("default", None), ("hermes-setup", "setup")):
- homes[name] = tmp_path / name
- homes[name].mkdir()
- if role:
- write_profile_meta(homes[name], role=role)
- for name, expected in (("default", False), ("hermes-setup", True)):
- token = set_hermes_home_override(str(homes[name]))
- try:
- # Even an explicit request for the toolset does not reach a profile without the role.
- names = model_tools._select_tool_names(["setup", "web"], None, quiet_mode=True)
- finally:
- reset_hermes_home_override(token)
- assert ("manage_catalog" in names) is expected, name
- # The setup guide's one tool is sent directly, never hidden behind tool_search.
+ import toolsets
+ from hermes_cli.config_defaults import DEFAULT_CONFIG
from tools.tool_search import is_deferrable_tool_name
- assert not is_deferrable_tool_name("manage_catalog")
+
+ # A config may name the toolset; `all` never brings it in.
+ assert "manage_catalog" in model_tools._select_tool_names(["catalog", "web"], None, quiet_mode=True)
+ assert "manage_catalog" not in model_tools._select_tool_names(None, None, quiet_mode=True)
+ assert "manage_catalog" not in toolsets.resolve_toolset("all")
+ # The agent's own session platform decides whether it keeps the tool.
+ for platform in ("cli", "tui", "telegram", "cron", None):
+ assert "manage_catalog" in toolsets.session_platform_tool_drops(platform), platform
+ assert "manage_catalog" not in toolsets.session_platform_tool_drops("desktop")
+ # Behind tool_search by default, like the other desktop surface tools.
+ assert is_deferrable_tool_name("manage_catalog", frozenset(DEFAULT_CONFIG["tools"]["tool_search"]["defer"]))
@pytest.mark.parametrize("args", [
@@ -147,42 +141,40 @@ def test_off_the_desktop_the_result_points_at_the_cli_and_opens_no_card():
assert not card.seen and not installer.installs and live.current("s1") is None
-def test_unknown_and_unsupported_ids_are_drawn_failed_and_never_installed():
+def test_unknown_and_unsupported_ids_fail_at_once_with_the_reason_and_are_never_installed():
installer = FakeInstaller([_entry("nvidia-app", platforms=["windows"])],
refuse={"nvidia-app": "Plugin 'nvidia-app' is unavailable on darwin; "
"supported platforms: windows."})
card = _card(lambda payload: {"settled_by": "continue"})
out = _install([{"kind": "plugin", "id": "nope"}, {"kind": "plugin", "id": "nvidia-app"}], installer, card)
- drawn = {t["name"]: t for t in card.seen[0]["targets"]}
- assert {t["state"] for t in drawn.values()} == {TargetState.failed.value} # drawn with the reason
+ assert not card.seen # every row is already done: the model reads the reasons, no card waits
rows = {t["name"]: t for t in out["targets"]}
+ assert {t["state"] for t in rows.values()} == {TargetState.failed.value}
assert "catalog" in rows["nope"]["detail"]
assert "unavailable on darwin" in rows["nvidia-app"]["detail"]
assert rows["nvidia-app"]["display"] == "Nvidia App" and rows["nvidia-app"]["platforms"] == ["windows"]
assert not installer.installs
-def test_an_approved_row_installs_into_default_and_lists_the_live_tools(tmp_path):
- from hermes_cli.profiles import get_profile_dir, write_profile_meta
+def test_an_approved_row_installs_into_the_chats_profile_and_lists_the_live_tools():
+ from hermes_cli.profiles import create_profile
from hermes_constants import reset_hermes_home_override, set_hermes_home_override
- setup_home = tmp_path / "hermes-setup"
- setup_home.mkdir()
- write_profile_meta(setup_home, role="setup")
+ b_home = Path(create_profile("b", no_alias=True))
installer = FakeInstaller([_entry("blender")])
- card = _card(_approve(), profile_home=str(setup_home))
- token = set_hermes_home_override(str(setup_home)) # the call comes from the setup chat
+ card = _card(_approve(), profile_home=str(b_home))
+ token = set_hermes_home_override(str(b_home))
try:
out = _install([{"kind": "plugin", "id": "blender"}], installer, card)
finally:
reset_hermes_home_override(token)
(row,) = out["targets"]
assert card.seen[0]["targets"][0]["state"] == TargetState.pending.value # nothing ran before the card
- assert row["state"] == TargetState.connected.value and row["target_profile"] == "default"
+ assert row["state"] == TargetState.connected.value and row["target_profile"] == "b"
assert row["tools"] == ["mcp__blender__status", "mcp__blender__launch"]
(call,) = installer.installs
assert (call["force"], call["enable"], call["ref"]) == (False, True, None)
- assert call["home"].resolve() == Path(get_profile_dir("default")).resolve() != setup_home.resolve()
+ assert call["home"].resolve() == b_home.resolve()
def test_advanced_values_pick_the_profile_force_and_pin(tmp_path):
@@ -197,33 +189,44 @@ def test_advanced_values_pick_the_profile_force_and_pin(tmp_path):
(call,) = installer.installs
assert (call["force"], call["enable"], call["ref"]) == (True, False, pin)
assert call["home"].resolve() == Path(work).resolve() and row["target_profile"] == "work"
- assert "not enabled" in row["detail"]
+ # The row carries what the user approved, so a Try again after settle repeats it.
+ assert row["approved"] == {"force": True, "enable": False, "ref": pin}
+ assert row["enabled"] is False and "not enabled" in row["detail"]
-def test_a_failed_install_stays_failed_until_the_user_tries_again():
- installer = FakeInstaller([_entry("blender")], install_error="clone failed: network down")
- attempts = []
+def test_a_failed_row_keeps_its_reason_and_try_again_works_while_the_card_is_open():
+ installer = FakeInstaller([_entry("blender"), _entry("krita")], install_error="clone failed: network down")
+ card = _card(lambda payload: {"targets": [{"name": "blender", "status": "approved", "env": None}]})
- def answer(payload):
- (target,) = payload["targets"]
- attempts.append(target["state"])
- return {"targets": [{"name": "blender", "status": "approved", "env": None}]}
+ def wait_for(state):
+ for _ in range(200):
+ operation = live.current("s1")
+ if operation is not None and operation.targets[0].state == state:
+ return operation
+ threading.Event().wait(0.01)
+ raise AssertionError(f"blender never reached {state}")
- card = _card(answer)
with patch("tools.connectors.run.WATCH_INTERVAL_SECONDS", 0.01):
result = {}
thread = threading.Thread(target=lambda: result.setdefault("out", json.loads(manage_catalog(
- {"action": "install", "items": [{"kind": "plugin", "id": "blender"}]}, session_id="s1",
- connection_callback=card, card_surface=True, installer=installer))))
+ {"action": "install", "items": [{"kind": "plugin", "id": "blender"}, {"kind": "plugin", "id": "krita"}]},
+ session_id="s1", connection_callback=card, card_surface=True, installer=installer))))
thread.start()
- for _ in range(200):
- operation = live.current("s1")
- if operation is not None and operation.targets[0].state == TargetState.failed:
- break
- threading.Event().wait(0.01)
+ operation = wait_for(TargetState.failed)
assert operation.targets[0].detail == "clone failed: network down"
+ assert not operation.settled # krita still waits on the user
installer.install_error = ""
apply_answer(operation, json.dumps({"targets": [{"name": "blender", "status": "approved"}]}))
+ wait_for(TargetState.connected)
+ apply_answer(operation, json.dumps({"targets": [{"name": "krita", "status": "skipped"}]}))
thread.join(5)
assert result["out"]["targets"][0]["state"] == TargetState.connected.value
assert len(installer.installs) == 2
+
+ # A failed row does not hold the turn to the deadline: once it is the last open row, the
+ # operation settles and the row keeps its state and reason.
+ installer.install_error = "clone failed: network down"
+ out = _install([{"kind": "plugin", "id": "blender"}], installer, _card(_approve()))
+ (row,) = out["targets"]
+ assert out["settled_by"] == "all_resolved"
+ assert (row["state"], row["detail"]) == (TargetState.failed.value, "clone failed: network down")
diff --git a/tests/tools/test_connectors_operation.py b/tests/tools/test_connectors_operation.py
index 143b99e2f2f..56cf58bf629 100644
--- a/tests/tools/test_connectors_operation.py
+++ b/tests/tools/test_connectors_operation.py
@@ -82,7 +82,7 @@ def test_request_payload_carries_the_live_target_snapshot():
operation.transition("gmail", c.TargetState.initiated, c.Actor.backend_watcher, connect_url="https://l/gmail")
payload = operation.request_payload()
(target,) = payload["targets"]
- assert target == {"name": "gmail", "kind": "connector", "action": "reconnect", "state": "initiated",
+ assert target == {"name": "gmail", "kind": "connector", "action": "reconnect", "state": "initiated", "resolved": False,
"instructions": "Finish setup", "connect_url": "https://l/gmail"}
# The model's own id keys the card to its tool row; a later op for the same apps gets a new one.
assert payload["tool_call_id"] == "call-1"
diff --git a/tests/tui_gateway/test_gui_surface_toolsets.py b/tests/tui_gateway/test_gui_surface_toolsets.py
index 0ab7d1c1499..483022e8a67 100644
--- a/tests/tui_gateway/test_gui_surface_toolsets.py
+++ b/tests/tui_gateway/test_gui_surface_toolsets.py
@@ -86,6 +86,7 @@ class TestResolverPlumbing:
no_desktop_env.setattr(cc, "coding_selection", lambda **_: ["coding"])
assert server._load_enabled_toolsets("desktop") == [
+ "catalog",
"coding",
"desktop_ui",
"project",
diff --git a/tests/tui_gateway/test_tui_gateway_server.py b/tests/tui_gateway/test_tui_gateway_server.py
index 4524f4fc6be..41572ed70bc 100644
--- a/tests/tui_gateway/test_tui_gateway_server.py
+++ b/tests/tui_gateway/test_tui_gateway_server.py
@@ -2509,17 +2509,10 @@ def test_with_session_toolsets_keeps_desktop_ui_when_project_disabled(monkeypatc
``desktop_ui`` — the client's own control surface — survives the subtraction."""
monkeypatch.setattr(server, "_load_disabled_toolsets", lambda: ["project"])
- assert server._with_session_toolsets(["memory"], "desktop") == [
- "memory",
- "desktop_ui",
- ]
- # Nothing disabled: the fold-in keeps both client-surface toolsets.
+ assert server._with_session_toolsets(["memory"], "desktop") == ["memory", "catalog", "desktop_ui"]
+ # Nothing disabled: the fold-in keeps every client-surface toolset.
monkeypatch.setattr(server, "_load_disabled_toolsets", lambda: None)
- assert server._with_session_toolsets(["memory"], "desktop") == [
- "memory",
- "desktop_ui",
- "project",
- ]
+ assert server._with_session_toolsets(["memory"], "desktop") == ["memory", "catalog", "desktop_ui", "project"]
def test_load_enabled_toolsets_rejects_disabled_mcp_env(monkeypatch, capsys):
diff --git a/tools/connectors/catalog.py b/tools/connectors/catalog.py
index 47c4dcd5c11..cfb416c4a7d 100644
--- a/tools/connectors/catalog.py
+++ b/tools/connectors/catalog.py
@@ -3,9 +3,10 @@
``prepare`` resolves every id against the plugin catalog (the Plugins tab's resolver) or the skills
hub and fills the row the card draws; an id that does not resolve, or a plugin this OS cannot run,
is drawn failed with the reason. Nothing installs until the user approves a row. The install runs on
-a worker under the TARGET profile's runtime scope (``default`` unless the Advanced modal named
-another), through the same host install the Plugins tab uses, so the catalog pin, the kill list, the
-security scan and the live activation of the plugin's MCP servers and skills are the host's.
+a worker under the TARGET profile's runtime scope (the calling chat's own home unless the Advanced
+modal named another profile), through the same host install the Plugins tab uses, so the catalog
+pin, the kill list, the security scan and the live activation of the plugin's MCP servers and skills
+are the host's.
"""
from __future__ import annotations
@@ -18,15 +19,19 @@ import logging
import re
import threading
from dataclasses import dataclass, field
-from typing import Any, Callable, Dict, List, Optional
+from pathlib import Path
+from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional
+from hermes_constants import get_hermes_home, profile_name_for_home
from tools.connectors.contract import Actor, SettleReason, TargetState
from tools.connectors.mcp import _fail, _move
from tools.connectors.operation import ConnectionOperation, IllegalTransition, Target
+if TYPE_CHECKING:
+ from hermes_cli.plugins_cmd_install import InstallPhase
+
logger = logging.getLogger(__name__)
-DEFAULT_PROFILE = "default"
# The Advanced modal's own keys (CATALOG-ROW-CONTRACT.md); every other answer key is a credential.
_OPTION_KEYS = frozenset({"target_profile", "agent_half", "desktop_half", "enable", "force", "ref"})
_COMMIT_SHA = re.compile(r"^[0-9a-fA-F]{40}$")
@@ -49,21 +54,28 @@ def _display(identifier: str) -> str:
@contextlib.contextmanager
-def target_scope(profile: str):
- """Bind the named profile's home, secrets and terminal policy, the way an RPC for that profile
- does. The install writes its tree, config and ``.env`` there, never into the setup profile. The
- home override is bound for the launch profile too: the calling thread carries the setup
- profile's override, and an unbound launch scope would leave it in place."""
+def target_scope(home: Path):
+ """Bind the profile at *home*: its home, secrets and terminal policy, the way an RPC for that
+ profile does. The install writes its tree, config and ``.env`` there. The home override is
+ bound for the launch profile too: the calling thread may carry another profile's override, and
+ an unbound launch scope would leave it in place."""
from tui_gateway import server
from tui_gateway.launch_profile_policy import launch_profile_runtime_scope
- home = server._profile_home(profile) # None = the launch profile; raises for a missing one
- scope = (launch_profile_runtime_scope(server._hermes_home) if home is None
+ launch = home.resolve() == Path(server._hermes_home).resolve()
+ scope = (launch_profile_runtime_scope(server._hermes_home) if launch
else server._session_profile_runtime_scope({"profile_home": str(home)}))
with scope:
yield
+def _named_home(name: str) -> Path:
+ """The home of the profile the Advanced modal named; raises for one that does not exist."""
+ from tui_gateway import server
+
+ return server._profile_home(name) or Path(server._hermes_home)
+
+
class HostInstaller:
"""The host side of a catalog row. Tests replace it; production reads the real catalog, hub and
installer."""
@@ -80,10 +92,11 @@ class HostInstaller:
raise_if_removed(entry.name, entry.repo)
_refuse_unsupported_catalog_platform(entry)
- def install_plugin(self, name: str, *, force: bool, enable: bool, ref: Optional[str]) -> Dict[str, Any]:
+ def install_plugin(self, name: str, *, force: bool, enable: bool, ref: Optional[str],
+ on_step: Callable[[InstallPhase], None]) -> Dict[str, Any]:
from hermes_cli.plugins_cmd import dashboard_install_plugin
- return dashboard_install_plugin("", force=force, enable=enable, catalog_name=name, ref=ref)
+ return dashboard_install_plugin("", force=force, enable=enable, catalog_name=name, ref=ref, on_step=on_step)
def skill_meta(self, identifier: str) -> Optional[Dict[str, Any]]:
"""The first hub source that knows the identifier; metadata only, no bundle download."""
@@ -147,6 +160,10 @@ class _Runner:
# The Advanced values the user approved per row; Try again (env null) reuses them. Values
# are credentials in part, so they stay here, off the target.
self.approved_env: Dict[str, Dict[str, str]] = {}
+ # Built on the tool call's thread: the calling chat's own home is the default install
+ # target, and its profile name labels the row (None for a home that is no named profile).
+ self.home: Path = get_hermes_home()
+ self.label: Optional[str] = profile_name_for_home(self.home)
# -- prepare: resolve each id and draw its row ------------------------------------------------
@@ -154,7 +171,7 @@ class _Runner:
_RUNNERS[operation.op_id] = self
self.op_id = operation.op_id
for target in operation.targets:
- target.extra = {"display": _display(target.name), "target_profile": DEFAULT_PROFILE}
+ target.extra = {"display": _display(target.name), "target_profile": self.label}
try:
self._resolve(target)
except Exception as exc:
@@ -166,7 +183,7 @@ class _Runner:
if entry is None:
raise LookupError(f"'{target.name}' is not in the Hermes plugin catalog")
self.facts[target.name] = entry
- target.extra = _plugin_row(entry)
+ target.extra = _plugin_row(entry, self.label)
target.required_env = [{"name": name, "required": False, "secret": True, "default": ""}
for name in entry.capabilities.requires_env]
self.installer.refuse(entry)
@@ -179,7 +196,7 @@ class _Runner:
"display": str(meta.get("name") or _display(target.name)),
"description": _first_sentence(meta.get("description") or ""),
"tier": "official" if meta.get("source") == "official" else "community",
- "target_profile": DEFAULT_PROFILE,
+ "target_profile": self.label,
}
# -- the card's answer ------------------------------------------------------------------------
@@ -198,9 +215,15 @@ class _Runner:
_fail(operation, target, error)
return
self.approved_env[target.name] = approved
- if not _move(operation, target, TargetState.initiated, actor, detail=""):
+ # The non-secret choices go on the row, so a Try again after the operation settled repeats
+ # what the user approved; the credentials are already in the target profile's .env by then.
+ options = {"force": _flag(approved.get("force"), False), "enable": _flag(approved.get("enable"), True),
+ "ref": approved.get("ref") or None}
+ profile = (approved.get("target_profile") or "").strip()
+ if not _move(operation, target, TargetState.initiated, actor, detail="",
+ **{**target.extra, "target_profile": profile or self.label, "approved": options}):
return
- self._spawn(operation, target, approved)
+ self._spawn(operation, target, approved, options)
def _check_answer(self, target: Target, env: Dict[str, str]) -> str:
if target.kind == "plugin" and env.get("agent_half") == "0":
@@ -214,13 +237,20 @@ class _Runner:
return f"'{target.name}' does not declare {', '.join(undeclared)}"
return ""
- def _spawn(self, operation: ConnectionOperation, target: Target, env: Dict[str, str]) -> None:
+ def _spawn(self, operation: ConnectionOperation, target: Target, env: Dict[str, str],
+ options: Dict[str, Any]) -> None:
work = _Work()
self.work[target.name] = work
+ def step(phase: InstallPhase) -> None:
+ # A row that left ``initiated`` keeps its own state.
+ if not operation.settled and target.state == TargetState.initiated:
+ operation.refresh(target.name, connect_url=None, detail="", actor=Actor.backend_watcher,
+ phase=phase.value)
+
def body() -> None:
try:
- work.outcome = self._install(target, env)
+ work.outcome = self._install(target, env, options, step)
except Exception as exc:
work.error = self._detail(exc, target)
work.done.set()
@@ -230,19 +260,22 @@ class _Runner:
threading.Thread(target=contextvars.copy_context().run, args=(body,), daemon=True,
name=f"catalog-install-{target.name}").start()
- def _install(self, target: Target, env: Dict[str, str]) -> Dict[str, Any]:
- profile = (env.get("target_profile") or DEFAULT_PROFILE).strip()
- force = _flag(env.get("force"), False)
- with target_scope(profile):
+ def _install(self, target: Target, env: Dict[str, str], options: Dict[str, Any],
+ step: Callable[[InstallPhase], None]) -> Dict[str, Any]:
+ from hermes_cli.plugins_cmd_install import InstallPhase
+
+ named = (env.get("target_profile") or "").strip()
+ with target_scope(_named_home(named) if named else self.home):
_save_credentials({k: v for k, v in env.items() if k not in _OPTION_KEYS and v})
if target.kind == "skill":
identifier = str(self.facts[target.name].get("identifier") or target.name)
- return {"profile": profile, **self.installer.install_skill(identifier, force=force)}
- enable = _flag(env.get("enable"), True)
- result = self.installer.install_plugin(target.name, force=force, enable=enable, ref=env.get("ref") or None)
+ step(InstallPhase.downloading)
+ return self.installer.install_skill(identifier, force=options["force"])
+ result = self.installer.install_plugin(target.name, force=options["force"], enable=options["enable"],
+ ref=options["ref"], on_step=step)
if not result.get("ok"):
raise RuntimeError(result.get("error") or "the install failed")
- return {"profile": profile, "enabled": enable, **result}
+ return {"enabled": options["enable"], **result}
# -- the watcher --------------------------------------------------------------------------------
@@ -277,9 +310,7 @@ def target_declared_env(fact: Any) -> List[str]:
return list(getattr(caps, "requires_env", None) or ())
-def _plugin_row(entry: Any) -> Dict[str, Any]:
- requirements = [f"Hermes {entry.requires_hermes}"] if entry.requires_hermes else []
- requirements += [f"{name} environment variable" for name in entry.capabilities.requires_env]
+def _plugin_row(entry: Any, label: Optional[str]) -> Dict[str, Any]:
from hermes_cli.plugin_catalog_presence import presence
row: Dict[str, Any] = {
@@ -288,9 +319,9 @@ def _plugin_row(entry: Any) -> Dict[str, Any]:
"tier": entry.tier if entry.tier in _TIERS else "community",
"repo": entry.repo,
"sha": entry.sha,
- "requirements": requirements,
+ "requires_hermes": entry.requires_hermes or None,
"has_desktop_half": False,
- "target_profile": DEFAULT_PROFILE,
+ "target_profile": label,
"app_state": presence(entry).state,
}
if entry.platforms:
@@ -301,25 +332,29 @@ def _plugin_row(entry: Any) -> Dict[str, Any]:
def _installed_row(target: Target, outcome: Dict[str, Any]) -> tuple:
- """The connected row's fields (the drawn row plus what went live) and its one-line detail."""
- extra = {**target.extra, "target_profile": outcome["profile"]}
+ """The connected row's fields (the drawn row plus what went live, as facts the card words) and
+ the same notes in one English line for the model."""
+ extra = dict(target.extra)
if target.kind == "skill":
- detail = "already installed; left as it is (Advanced, force reinstall replaces it)" \
- if outcome.get("already_installed") else ""
- return {**extra, "skill": outcome["name"], "tools": []}, detail
+ already = bool(outcome.get("already_installed"))
+ detail = "already installed; left as it is (Advanced, force reinstall replaces it)" if already else ""
+ return {**extra, "skill": outcome["name"], "tools": [], "already_installed": already}, detail
live = (outcome.get("activation") or {}).get("live_now") or {}
servers = live.get("mcp_servers") or []
tools = [name for server in servers if server.get("connected") for name in server.get("tools") or ()]
- notes = [f"MCP server {s['name']} not connected: {s.get('error') or 'unknown error'}"
- for s in servers if not s.get("connected")]
- if not outcome.get("enabled", True):
+ server_errors = [{"name": s["name"], "error": s.get("error") or ""} for s in servers if not s.get("connected")]
+ enabled = bool(outcome.get("enabled", True))
+ missing_env = list(outcome.get("missing_env") or ())
+ notes = [f"MCP server {e['name']} not connected: {e['error'] or 'unknown error'}" for e in server_errors]
+ if not enabled:
notes.append("installed but not enabled")
- if outcome.get("missing_env"):
- notes.append(f"set {', '.join(outcome['missing_env'])} to finish setup")
+ if missing_env:
+ notes.append(f"set {', '.join(missing_env)} to finish setup")
skills = [s["name"] for s in live.get("skills") or () if s.get("name")]
if skills:
extra["skill"] = skills[0]
- return {**extra, "tools": tools}, "; ".join(notes)
+ facts = {"tools": tools, "enabled": enabled, "missing_env": missing_env, "server_errors": server_errors}
+ return {**extra, **facts}, "; ".join(notes)
def _save_credentials(env: Dict[str, str]) -> None:
diff --git a/tools/connectors/catalog_tool.py b/tools/connectors/catalog_tool.py
index 0cedf41b266..a6b9193fb23 100644
--- a/tools/connectors/catalog_tool.py
+++ b/tools/connectors/catalog_tool.py
@@ -1,7 +1,7 @@
-"""``manage_catalog``: the setup agent's catalog search and install-through-the-card.
+"""``manage_catalog``: a desktop chat's catalog search and install-through-the-card.
``search`` reads the plugin catalog (the Plugins tab's resolver) and the skills hub and says what is
-already installed in ``default``. ``install`` opens the same connection operation
+already installed in this chat's profile. ``install`` opens the same connection operation
``manage_connections`` opens, with rows of kind ``plugin`` / ``skill``; the host installs each row
the user approves (``tools/connectors/catalog.py``). The model sends catalog ids and an action,
nothing else: the pin, scan, target profile and activation are the host's.
@@ -38,9 +38,10 @@ MANAGE_CATALOG_SCHEMA = {
"description": (
"Find and install Hermes catalog plugins and hub skills for the user. 'search' lists matches "
"(id, kind, display, tier, platforms, installed) and changes nothing. 'install' shows the user "
- "one approval card with a row per item and blocks until every row is installed, skipped, or "
- "the card is closed; the host installs each approved row into the user's default profile at "
- "the catalog's reviewed version. Pass only catalog ids exactly as 'search' returns them; the "
+ "one approval card with a row per item and blocks until every row is installed, skipped or "
+ "failed, or the card is closed; the host installs each approved row into this chat's profile at "
+ "the catalog's reviewed version, and turns on a catalog plugin that is installed but not "
+ "enabled. Pass only catalog ids exactly as 'search' returns them; the "
"host decides the source, version, profile and settings, and the user can change them on the "
"card. Offer an install only for something the user asked for or agreed to."
),
@@ -145,15 +146,16 @@ def install(items: List[Dict[str, str]], *, session_id: Optional[str], tool_call
def search(query: str, kind: Optional[str], *, installer: Any = None) -> Dict[str, Any]:
- from tools.connectors.catalog import DEFAULT_PROFILE, target_scope
+ """Runs on the tool call's thread, in this chat's profile scope, so ``installed`` is this
+ chat's profile's."""
+ from hermes_constants import get_hermes_home, profile_name_for_home
rows: List[Dict[str, Any]] = []
- with target_scope(DEFAULT_PROFILE):
- if kind in (None, "plugin"):
- rows += _plugin_rows(query)
- if kind in (None, "skill") and query.strip():
- rows += _skill_rows(query)
- return {"results": rows, "installed_in": DEFAULT_PROFILE}
+ if kind in (None, "plugin"):
+ rows += _plugin_rows(query)
+ if kind in (None, "skill") and query.strip():
+ rows += _skill_rows(query)
+ return {"results": rows, "installed_in": profile_name_for_home(get_hermes_home())}
def _plugin_rows(query: str) -> List[Dict[str, Any]]:
diff --git a/tools/connectors/contract.py b/tools/connectors/contract.py
index cc45e12ece0..442abc335ca 100644
--- a/tools/connectors/contract.py
+++ b/tools/connectors/contract.py
@@ -36,6 +36,15 @@ class SettleReason(str, Enum):
KINDS: Tuple[str, ...] = ("connector", "mcp", "plugin", "skill")
RESOLVED_STATES = frozenset({TargetState.connected, TargetState.skipped})
+# A failed catalog row is done as well: the host already ran the install and the row carries the
+# reason. Counting it as open held the model's turn until the deadline while nobody clicked. Try
+# again still works while another row keeps the operation open, and the failed row keeps its state
+# and reason when the operation settles.
+_RESOLVED_BY_KIND = {kind: RESOLVED_STATES | {TargetState.failed} for kind in ("plugin", "skill")}
+
+
+def resolves(kind: str, state: TargetState) -> bool:
+ return state in _RESOLVED_BY_KIND.get(kind, RESOLVED_STATES)
_S, _A = TargetState, Actor
diff --git a/tools/connectors/operation.py b/tools/connectors/operation.py
index f908da5d367..5d1af4538cd 100644
--- a/tools/connectors/operation.py
+++ b/tools/connectors/operation.py
@@ -8,7 +8,7 @@ import uuid
from dataclasses import dataclass, field
from typing import Any, Callable, ClassVar, Dict, List, Optional
-from tools.connectors.contract import RESOLVED_STATES, Actor, SettleReason, TargetState, allowed
+from tools.connectors.contract import Actor, SettleReason, TargetState, allowed, resolves
# Not a config key: a user-tunable wait with clamp rails was a foot-gun (PR1 shipped one, unmerged).
OPERATION_DEADLINE_SECONDS = 300.0
@@ -39,13 +39,18 @@ class Target:
required_env: List[Dict[str, Any]] = field(default_factory=list)
# Fields a transition passes through to the model (``tools`` on a connected MCP target).
extra: Dict[str, Any] = field(default_factory=dict)
+ # The install step an ``initiated`` catalog row is in (an ``InstallPhase`` id); drawn only then.
+ phase: Optional[str] = None
@property
def resolved(self) -> bool:
- return self.state in RESOLVED_STATES
+ return resolves(self.kind, self.state)
def snapshot(self, *, with_url: bool = True) -> Dict[str, Any]:
- out: Dict[str, Any] = {"name": self.name, "kind": self.kind, "action": self.action, "state": self.state.value}
+ out: Dict[str, Any] = {"name": self.name, "kind": self.kind, "action": self.action, "state": self.state.value,
+ "resolved": self.resolved}
+ if self.phase and self.state == TargetState.initiated:
+ out["phase"] = self.phase
if self.detail:
out["detail"] = self.detail
if self.instructions:
@@ -128,8 +133,10 @@ class ConnectionOperation:
self._changed(change, snapshot)
return change
- def refresh(self, name: str, *, connect_url: Optional[str], detail: str, actor: Actor = Actor.user) -> None:
- """Replace a target's link and detail without a state change (a repeated failure).
+ def refresh(self, name: str, *, connect_url: Optional[str], detail: str, actor: Actor = Actor.user,
+ phase: Optional[str] = None) -> None:
+ """Replace a target's link, detail and install phase without a state change (a repeated
+ failure, or the next step of an install).
``actor`` says who produced the new text: a second failure of a backend attempt is the
backend's report, not the user's move, and the frame must not claim otherwise."""
@@ -139,6 +146,7 @@ class ConnectionOperation:
with self._lock:
target.connect_url = connect_url
target.detail = detail
+ target.phase = phase
change = {"target": name, "from": target.state.value, "to": target.state.value, "actor": actor.value,
"detail": detail}
snapshot = self._bump_locked()
@@ -218,6 +226,7 @@ class ConnectionOperation:
result = self._result_locked(with_urls=with_urls)
for target in result["targets"]:
target.pop("connection_id", None)
+ target.pop("resolved", None) # the card's flag; the model reads state
if result.get("settled_at") is None:
return result
from tools.registry import registry
diff --git a/tools/connectors/tool.py b/tools/connectors/tool.py
index dce527280c5..d2f92d238d7 100644
--- a/tools/connectors/tool.py
+++ b/tools/connectors/tool.py
@@ -145,11 +145,10 @@ registry.register(
emoji="🔗",
)
-# The setup profile's catalog install. Reachable only through the ``setup`` toolset, which the
-# profile's role grants; registry dispatch has no card callback, so it answers with the CLI pointer.
+# Registry dispatch has no card callback, so it answers with the CLI pointer.
registry.register(
name="manage_catalog",
- toolset="setup",
+ toolset="catalog",
schema=MANAGE_CATALOG_SCHEMA,
handler=lambda args, **kw: manage_catalog(args, session_id=kw.get("session_id")),
emoji="🧩",
diff --git a/tools/mcp_tool_agent.py b/tools/mcp_tool_agent.py
index 94f711b32aa..6d7bb8960d0 100644
--- a/tools/mcp_tool_agent.py
+++ b/tools/mcp_tool_agent.py
@@ -52,9 +52,9 @@ def _tool_defs_content_changed(agent, new_defs: list) -> bool:
return False
-def _drop_side_agent_tools(agent, new_defs: list, new_names: set) -> tuple:
- from tools.connectors.turn import side_agent_tool_drops
- drops = side_agent_tool_drops(agent)
+def _drop_session_tools(agent, new_defs: list, new_names: set) -> tuple:
+ from toolsets import agent_tool_drops
+ drops = agent_tool_drops(agent)
if not drops:
return new_defs, new_names
return [entry for entry in new_defs if _def_name(entry) not in drops], new_names - drops
@@ -76,7 +76,7 @@ def _publish_tool_snapshot(
current = {_def_name(t) for t in current_defs}
if prefix_registered is not None:
new_defs, new_names = _merge_preserving_prefix(current_defs, new_defs, prefix_registered)
- new_defs, new_names = _drop_side_agent_tools(agent, new_defs, new_names)
+ new_defs, new_names = _drop_session_tools(agent, new_defs, new_names)
# Record the generation even when unchanged so an in-flight older caller can't clobber.
agent._tool_snapshot_generation = max(published_gen, snapshot_generation)
# Same NAME set: no change for MCP-reload callers. Content-aware callers
@@ -173,7 +173,7 @@ def persist_agent_tool_names(agent) -> None:
def _config_permitted_names(agent) -> set:
"""Tool names this agent's toolset selection allows before ``check_fn``: all a pin may carry
forward. A client-surface toolset counts as allowed (only its client can add it, so its absence
- here is no config choice); ``disabled_toolsets`` and role reservations still strip it."""
+ here is no config choice); ``disabled_toolsets`` still strips it."""
from model_tools import _select_tool_names
from toolsets import CLIENT_SURFACE_TOOLSETS
enabled = getattr(agent, "enabled_toolsets", None)
@@ -227,7 +227,7 @@ def restore_agent_tool_prefix(agent, saved) -> bool:
merged = _drop_gated_carried_tools(merged, carried)
merged_names = {_def_name(t) for t in merged}
_reinject_authorized_dynamic_tools(agent, merged, merged_names)
- merged, merged_names = _drop_side_agent_tools(agent, merged, merged_names)
+ merged, merged_names = _drop_session_tools(agent, merged, merged_names)
changed = merged != fresh_defs
if changed:
with _agent_tools_lock:
diff --git a/tools/tool_search.py b/tools/tool_search.py
index a460a4466d2..d9656a1b804 100644
--- a/tools/tool_search.py
+++ b/tools/tool_search.py
@@ -18,6 +18,7 @@ from typing import Any, Dict, Iterable, List, Optional, Tuple
from hermes_cli.config_defaults import DEFAULT_CONFIG
from tools.registry import tool_error
+from toolsets import CLIENT_SURFACE_TOOLSETS, TOOLSET_SESSION_PLATFORMS
from tools.tool_search_catalog import (
BRIDGE_TOOL_NAMES, CHARS_PER_TOKEN, TOOL_CALL_NAME, TOOL_DESCRIBE_NAME, TOOL_SEARCH_NAME,
CatalogEntry, _fn, _listing_group_label, _registry_entry, _registry_toolset,
@@ -134,10 +135,8 @@ def _core_tool_names() -> frozenset[str]:
# Session-gated GUI toolsets: off ``_HERMES_CORE_TOOLS`` so non-GUI clients never pay
-# their schema; once enabled they stay direct unless the deferral list names them. ``setup``
-# is the setup profile's whole job: a guide that has to search for its one tool first
-# answers the user's install request with a tool_search round trip.
-_DIRECT_SURFACE_TOOLSETS = frozenset({"desktop_ui", "project", "setup"})
+# their schema; once enabled they stay direct unless the deferral list names them.
+_DIRECT_SURFACE_TOOLSETS = CLIENT_SURFACE_TOOLSETS | TOOLSET_SESSION_PLATFORMS.keys()
# Event-triggered tools deferred BY DEFAULT (a catalog stub suffices). Keep the curated
# list in DEFAULT_CONFIG so config discovery and runtime behavior cannot drift. An explicit
diff --git a/toolsets.py b/toolsets.py
index b4c1298df1b..2dcbe18d362 100644
--- a/toolsets.py
+++ b/toolsets.py
@@ -1,6 +1,5 @@
"""Toolset helpers: get/resolve/validate named tool groups (static TOOLSETS + registry-registered)."""
-from pathlib import Path
from typing import Dict, List, Any, Set, Optional, Tuple
@@ -69,7 +68,7 @@ _CODING_TOOLS = _core_without("image_generate", "text_to_speech", "cronjob_manag
# Toolsets a CLIENT adds to its own sessions (tui_gateway/server.py::_gui_surface_toolsets), never
# config: another surface lacking them made no configuration choice.
-CLIENT_SURFACE_TOOLSETS = frozenset({"project", "desktop_ui"})
+CLIENT_SURFACE_TOOLSETS = frozenset({"project", "desktop_ui", "catalog"})
# Core toolset definitions: individual tools or references to other toolsets.
TOOLSETS = {
@@ -144,15 +143,11 @@ TOOLSETS = {
"annotate_preview", "read_window_below", "focus_pane", "react_to_message",
"gui_tour", "show_tip"],
),
- # Enabled per SESSION whose PROFILE carries ``role: setup`` in its backend-written
- # profile.yaml (tui_gateway/server.py::_load_enabled_toolsets); stripped from every
- # other profile's selection whatever the config, env pin or client asked for
- # (model_tools._select_tool_names). Never configurable, never in `hermes tools`.
- "setup": _ts(
- "Onboarding-only surface for the setup profile: catalog plugin/skill install "
- "requests through the approval card",
+ # ``platforms``: the session platforms this toolset exists for (TOOLSET_SESSION_PLATFORMS).
+ "catalog": _ts(
+ "Desktop catalog plugin/skill install requests through the approval card (GUI sessions only)",
["manage_catalog"],
- role="setup",
+ platforms=frozenset({"desktop"}),
),
"clarify": _ts("Ask the user clarifying questions (multiple-choice or open-ended)", ["clarify"]),
"code_execution": _ts("Run Python scripts that call tools programmatically (reduces LLM round trips)", ["execute_code"]),
@@ -251,6 +246,9 @@ TOOLSETS = {
),
}
+# Toolset -> the session platforms it exists for, from the specs that carry ``platforms``.
+TOOLSET_SESSION_PLATFORMS = {name: spec["platforms"] for name, spec in TOOLSETS.items() if "platforms" in spec}
+
# Captured before create_custom_toolset() can add user-named tools: shared metrics may export only
# these names, so a plugin, MCP server or custom toolset name never leaves the machine.
BUILTIN_TOOL_NAMES = frozenset(tool for spec in TOOLSETS.values() for tool in spec["tools"])
@@ -385,11 +383,13 @@ def resolve_toolset(name: str, visited: Set[str] = None, *, include_registry: bo
return list(cached)
visited = set()
- # "all"/"*" span every toolset so new toolsets are included automatically.
+ # "all"/"*" span every toolset so new toolsets are included automatically, except the ones a
+ # session platform gates: a profile gets those only when its config names them.
if name in {"all", "*"}:
all_tools: Set[str] = set()
for toolset_name in get_toolset_names():
- all_tools.update(resolve_toolset(toolset_name, visited.copy(), include_registry=include_registry))
+ if toolset_name not in TOOLSET_SESSION_PLATFORMS:
+ all_tools.update(resolve_toolset(toolset_name, visited.copy(), include_registry=include_registry))
return sorted(all_tools)
# Diamond include or cycle: [] silently — the tools are collected via another path.
@@ -452,16 +452,17 @@ def get_toolset_names() -> List[str]:
return sorted(set(TOOLSETS.keys()) | set(_plugin_display_names()))
-def profile_role_toolsets(profile_home: Optional[Path] = None) -> Tuple[Set[str], Set[str]]:
- """``(granted, denied)`` for the profile at *profile_home* (default: the in-scope home; a session's
- home override, when bound, IS its profile dir): toolsets reserved for the role in its backend-written
- ``profile.yaml``, and toolsets reserved for any other role. An ordinary profile is granted none."""
- from hermes_cli.profiles import read_profile_meta
- from hermes_constants import get_hermes_home
- role = read_profile_meta(Path(profile_home or get_hermes_home())).get("role")
- granted = {name for name, spec in TOOLSETS.items() if role is not None and spec.get("role") == role}
- denied = {name for name, spec in TOOLSETS.items() if spec.get("role") not in (None, role)}
- return granted, denied
+def session_platform_tool_drops(platform: Optional[str]) -> frozenset:
+ """Tools of every platform-gated toolset that a session on *platform* does not get."""
+ return frozenset(tool for name, platforms in TOOLSET_SESSION_PLATFORMS.items() if platform not in platforms
+ for tool in resolve_toolset(name))
+
+
+def agent_tool_drops(agent: Any) -> frozenset:
+ """Tool names *agent* never carries, whatever its toolsets resolved to: the side-agent drops and
+ the toolsets its session platform does not get. Applied at load, MCP refresh and prefix restore."""
+ from tools.connectors.turn import side_agent_tool_drops
+ return side_agent_tool_drops(agent) | session_platform_tool_drops(getattr(agent, "platform", None))
def validate_toolset(name: str) -> bool:
diff --git a/tui_gateway/contracts/connectors_operation.py b/tui_gateway/contracts/connectors_operation.py
index 0892714ad4c..e0c76f94b18 100644
--- a/tui_gateway/contracts/connectors_operation.py
+++ b/tui_gateway/contracts/connectors_operation.py
@@ -13,6 +13,8 @@ from typing import Literal
from pydantic import Field
+from hermes_cli.plugins_cmd_install import InstallPhase
+
from .base import Params, Payload, Result, WireEnum
from .common import ConnectorOwner, ProfileParams
from .registry import event, method
@@ -101,6 +103,22 @@ class CatalogScan(Payload):
summary: str
+class CatalogApproved(Payload):
+ """The non-secret Advanced choices the user approved on a catalog row; a Try again after the
+ operation settled repeats them."""
+
+ force: bool
+ enable: bool
+ ref: str | None = None
+
+
+class CatalogServerError(Payload):
+ """An MCP server an installed plugin brought that did not connect, with the raw reason."""
+
+ name: str
+ error: 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."""
@@ -109,6 +127,8 @@ class ConnectionOperationTarget(Payload):
kind: ConnectionTargetKind
action: ConnectionTargetAction
state: ConnectionTargetState
+ # ``Target.resolved``: the row needs nothing more from the user (a failed catalog row counts).
+ resolved: bool | None = None
detail: str | None = None
instructions: str | None = None
discovery_error: str | None = None
@@ -129,12 +149,21 @@ class ConnectionOperationTarget(Payload):
sha: str | None = None
subdir: str | None = None
scan: CatalogScan | None = None
- requirements: list[str] | None = None
+ # The Hermes version range the plugin needs; its env vars ride in ``required_env``.
+ requires_hermes: str | None = None
has_desktop_half: bool | None = None
+ # The profile the row installs into; absent when the chat's home is no named profile.
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 = None
+ phase: InstallPhase | None = None
+ approved: CatalogApproved | None = None
+ # Facts on an installed row, drawn by the card (``detail`` words them for the model).
+ enabled: bool | None = None
+ missing_env: list[str] | None = None
+ server_errors: list[CatalogServerError] | None = None
+ already_installed: bool | None = None
class ConnectionRequestPayload(Payload):
diff --git a/tui_gateway/server.py b/tui_gateway/server.py
index ed5bf22e2b5..bfe735494b8 100644
--- a/tui_gateway/server.py
+++ b/tui_gateway/server.py
@@ -1979,25 +1979,19 @@ def _gui_surface_toolsets(platform: str) -> set[str]:
return set(CLIENT_SURFACE_TOOLSETS) if platform == "desktop" else {"project"}
-def _with_session_toolsets(selection, platform: str | None) -> list[str]:
- """*selection* plus what the session carries whatever its config says (the client surface's
- toolsets when *platform* is given; the ones its PROFILE's role reserves, from the backend-written
- profile.yaml under the session's home override), minus toolsets reserved for another role.
+def _with_session_toolsets(selection, platform: str) -> list[str]:
+ """*selection* plus the client surface's toolsets the session carries whatever its config says.
The fold-in happens after ``_get_platform_tools`` already subtracted ``agent.disabled_toolsets``,
so the same subtraction is applied to the fold-in itself — otherwise ``disabled_toolsets:
[project]`` is a no-op on desktop/TUI, the only surfaces where the client toolsets exist
(#54433). ``desktop_ui`` is kept regardless: it is the client's own control surface, not a
model toolset."""
- from toolsets import profile_role_toolsets
- granted, denied = profile_role_toolsets()
- surface = _gui_surface_toolsets(platform) if platform is not None else set()
- kept = [name for name in selection if name not in denied]
- fold_in = (surface | granted) - set(kept)
+ fold_in = _gui_surface_toolsets(platform) - set(selection)
disabled = set(_load_disabled_toolsets() or [])
if disabled:
fold_in -= disabled - {"desktop_ui"}
- return [*kept, *sorted(fold_in)]
+ return [*selection, *sorted(fold_in)]
def _tui_notice(text: str) -> None:
@@ -2068,8 +2062,8 @@ def _load_enabled_toolsets(platform: str | None = None) -> list[str] | None:
if explicit and validate_toolset is not None:
resolved = _resolve_explicit_toolsets(explicit, validate_toolset)
if resolved is not False:
- # An operator pin replaces the surface fold-in but never strips the profile's own role toolsets.
- return resolved if resolved is None else _with_session_toolsets(resolved, None)
+ # An operator pin replaces the surface fold-in.
+ return resolved
fallback_notice = "[tui] no valid HERMES_TUI_TOOLSETS entries; using configured CLI toolsets"
try:
from hermes_cli.config import load_config
diff --git a/website/docs/reference/tools-reference.md b/website/docs/reference/tools-reference.md
index 87582903d76..481d70a479d 100644
--- a/website/docs/reference/tools-reference.md
+++ b/website/docs/reference/tools-reference.md
@@ -173,13 +173,13 @@ Tools for driving desktop [Projects](../user-guide/cli.md) — named, multi-fold
|------|-------------|----------------------|
| `memory` | Save important information to persistent memory that survives across sessions. Your memory appears in your system prompt at session start -- it's how you remember things about the user and your environment between conversations. WHEN TO SA… | — |
-## `setup` toolset
+## `catalog` toolset
-Granted only to sessions of the desktop setup profile (`role: setup` in its `profile.yaml`); never configurable.
+Enabled for sessions whose source is the desktop app, whichever backend it's connected to. CLI, TUI, `hermes -z`, cron, kanban and messaging sessions never get it, even when a config list names it. `all` does not include it. Remove it with `agent.disabled_toolsets: [catalog]`.
| Tool | Description | Requires environment |
|------|-------------|----------------------|
-| `manage_catalog` | Setup profile only (the `setup` toolset), desktop chat only. `search` lists catalog plugins and hub skills matching `query` (optionally one `kind`) with `id`, `kind`, `display`, `tier`, `platforms` and `installed` (present in the `default` profile); it changes nothing. `install` takes `items: [{kind, id}]` and shows one approval card with a row per item (Install, Advanced, Skip); an id the catalog does not know, or a plugin this OS cannot run, is drawn failed with the reason. An approved row installs into `default` (or the profile chosen under Advanced) at the catalog's reviewed commit, with the same kill list, security scan and live activation as the Plugins tab, so the plugin's MCP tools and skills are usable in that profile's open chats at once. The result lists each row as `connected` (with `tools` and `skill`), `skipped`, `failed` (with `detail`) or `not_connected`. The model cannot pass a source, commit, profile or setting. Anywhere else the call returns the `hermes plugins install` / `hermes skills install` command to run instead. | — |
+| `manage_catalog` | Desktop sessions only, deferred behind `tool_search` by default. `search` lists catalog plugins and hub skills matching `query` (optionally one `kind`) with `id`, `kind`, `display`, `tier`, `platforms` and `installed` (present in this chat's profile); it changes nothing. `install` takes `items: [{kind, id}]` and shows one approval card with a row per item (Install, Advanced, Skip); an id the catalog does not know, or a plugin this OS cannot run, is drawn failed with the reason. An approved row installs into this chat's profile (or the profile chosen under Advanced) at the catalog's reviewed commit, with the same kill list, security scan and live activation as the Plugins tab, so the plugin's MCP tools and skills are usable in that profile's open chats at once. The result lists each row as `connected` (with `tools` and `skill`), `skipped`, `failed` (with `detail`) or `not_connected`; a failed row ends the wait like an installed or skipped one, and an install turns on a catalog plugin that is on disk but not enabled. The model cannot pass a source, commit, profile or setting. Anywhere else the call returns the `hermes plugins install` / `hermes skills install` command to run instead. | — |
## `session_search` toolset
diff --git a/website/docs/reference/toolsets-reference.md b/website/docs/reference/toolsets-reference.md
index 13a9ab6b2d8..cf880409fb0 100644
--- a/website/docs/reference/toolsets-reference.md
+++ b/website/docs/reference/toolsets-reference.md
@@ -73,10 +73,10 @@ Or in-session:
| `memory` | `memory` | Persistent cross-session memory management. |
| `desktop_ui` | `annotate_preview`, `apply_layout`, `close_terminal`, `desktop_preview`, `drive_preview`, `focus_pane`, `gui_tour`, `react_to_message`, `read_terminal`, `read_window_below`, `show_tip` | Affordances that act on the Hermes desktop app itself — read/close the embedded terminal pane, open, read, close, interact with, and annotate the in-app browser, identify the OS window behind the app, reveal a pane, react to a message, run a guided tour (highlight + narrate UI elements in the app or the preview pane), and apply a layout preset. Enabled for sessions whose source is the desktop app, whichever backend it's connected to (local, SSH, URL, or Hermes Cloud). Never present on CLI, TUI, messaging, or cron sessions. |
| `project` | `desktop_project` | Create and switch desktop [Projects](../user-guide/cli.md) (named, multi-folder workspaces) via one `create`/`switch`/`list` action enum. GUI / desktop sessions only. |
+| `catalog` | `manage_catalog` | Search the plugin catalog and skills hub, and install items through the approval card into this chat's profile. Enabled for sessions whose source is the desktop app, whichever backend it's connected to (local, SSH, URL, or Hermes Cloud). Never present on CLI, TUI, messaging, or cron sessions, even when a config list names it. `all` does not include it. Deferred behind `tool_search` by default. Remove it with `agent.disabled_toolsets: [catalog]`. |
| `safe` | `image_generate`, `vision_analyze`, `web_extract`, `web_search` (via `includes`) | Read-only research + media generation. No file writes, no terminal, no code execution. |
| `search` | `web_search` | Web search only (without extract). |
| `session_search` | `session_search` | Search past conversation sessions. |
-| `setup` | `manage_catalog` | Onboarding-only surface of the desktop setup profile: search the plugin catalog and skills hub, and install items through the approval card. Granted by the backend to sessions whose profile carries `role: setup` in its `profile.yaml`; stripped from every other profile even when a config list, `HERMES_TUI_TOOLSETS`, or `all` names it. Not configurable and not listed by `hermes tools`. |
| `skills` | `skill_manage`, `skill_view`, `skills_list` | Skill CRUD and browsing. |
| `spotify` | `spotify_albums`, `spotify_devices`, `spotify_library`, `spotify_playback`, `spotify_playlists`, `spotify_queue`, `spotify_search` | Native Spotify control (playback, queue, search, playlists, albums, library). Registered by the bundled `spotify` plugin. |
| `terminal` | `process_manage`, `terminal` | Shell command execution and background process management. |
diff --git a/website/docs/user-guide/features/tool-search.md b/website/docs/user-guide/features/tool-search.md
index 4f32f076c35..06be76b336c 100644
--- a/website/docs/user-guide/features/tool-search.md
+++ b/website/docs/user-guide/features/tool-search.md
@@ -117,6 +117,7 @@ tools:
- todo_list
- process_manage
- cronjob_manage
+ - manage_catalog
```
The default `defer` list also includes the selected desktop GUI helpers listed