Skip to content

The agent that grows with you

fix(desktop): show skill install progress and completion in the shared dialog

brooklyn!25be09822d32
diff --git a/apps/desktop/src/app/contrib/hooks/use-desktop-integrations.test.tsx b/apps/desktop/src/app/contrib/hooks/use-desktop-integrations.test.tsx
index dc8b1b9675d..f4c324e957c 100644
--- a/apps/desktop/src/app/contrib/hooks/use-desktop-integrations.test.tsx
+++ b/apps/desktop/src/app/contrib/hooks/use-desktop-integrations.test.tsx
@@ -3,7 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { setApiRequestConnection, setApiRequestProfile } from '@/hermes'
import { createClientSessionState } from '@/lib/chat-runtime'
-import { $confirmRequest, settleConfirm } from '@/store/confirm'
+import { $confirmRequest, runConfirm, settleConfirm } from '@/store/confirm'
import { $hubInstalledOverride } from '@/store/hub-actions'
import { requestMcpInstallFromDeepLink } from '@/store/mcp-deeplink-install'
import { $pluginInstallRequest } from '@/store/plugin-install-request'
@@ -579,7 +579,7 @@ describe('useDesktopIntegrations', () => {
function listen() {
render({ profileReady: true, resumeLastSession: false })
- return vi.mocked(window.hermesDesktop.onDeepLink).mock.calls[0]![0]
+ return vi.mocked(window.hermesDesktop.onDeepLink!).mock.calls[0]![0]
}
afterEach(() => {
@@ -603,12 +603,17 @@ describe('useDesktopIntegrations', () => {
it('requires skill confirmation, preserves the request scope, and uses the hub pipeline', async () => {
const api = vi.fn(async (request: { path: string }) => {
- if (request.path === '/api/skills/hub/install') return { name: 'skill-link-test' }
+ if (request.path === '/api/skills/hub/install') {
+ return { name: 'skill-link-test' }
+ }
+
if (request.path.startsWith('/api/actions/skill-link-test/')) {
return { name: 'skill-link-test', running: false, exit_code: 0, lines: ['Installed'], pid: 123 }
}
+
return {}
})
+
desktopWindow.hermesDesktop = { ...desktopWindow.hermesDesktop, api } as unknown as Window['hermesDesktop']
const deepLink = listen()
const installs = () => api.mock.calls.filter(([r]) => r.path === '/api/skills/hub/install')
@@ -621,14 +626,19 @@ describe('useDesktopIntegrations', () => {
api.mockClear()
$hubInstalledOverride.set({})
act(() => deepLink(payload))
- expect($confirmRequest.get()?.description).toContain(identifier)
- expect($confirmRequest.get()?.description).toContain(profile)
+ expect($confirmRequest.get()?.title).toBe('Install “skill”?')
+ expect($confirmRequest.get()?.details).toEqual([
+ { label: 'Source', value: identifier },
+ { label: 'Install to', value: `${connection} · ${profile}` }
+ ])
expect(installs()).toHaveLength(0)
await act(async () => settleConfirm(false))
expect(installs()).toHaveLength(0)
act(() => deepLink(payload))
- await act(async () => settleConfirm(true))
+ await act(async () => runConfirm($confirmRequest.get()!))
+ expect($confirmRequest.get()?.phase).toBe('done')
+ settleConfirm(true)
await waitFor(() => expect($hubInstalledOverride.get()[identifier]).toBe(true))
expect(installs()).toEqual([[{
connectionId: connection, profile, path: '/api/skills/hub/install', method: 'POST', body: { identifier }
@@ -642,7 +652,8 @@ describe('useDesktopIntegrations', () => {
act(() => deepLink(payload))
setApiRequestConnection('server-b')
setApiRequestProfile('work')
- await act(async () => settleConfirm(true))
+ await expect(runConfirm($confirmRequest.get()!)).rejects.toThrow('The destination changed')
+ settleConfirm(false)
expect(installs()).toHaveLength(0)
act(() => deepLink({ kind: 'skill', name: 'install', params: {} }))
expect($confirmRequest.get()).toBeNull()
diff --git a/apps/desktop/src/components/confirm-host.test.tsx b/apps/desktop/src/components/confirm-host.test.tsx
index 0aeff59273e..7ae5ff312f7 100644
--- a/apps/desktop/src/components/confirm-host.test.tsx
+++ b/apps/desktop/src/components/confirm-host.test.tsx
@@ -64,6 +64,42 @@ describe('confirm()', () => {
expect(read()).toBe(false)
})
+ it('keeps async actions open through progress, inline failure, retry and completion', async () => {
+ render(<ConfirmHost />)
+ let fail!: (error: Error) => void
+ let finish!: () => void
+ let attempts = 0
+ let answer: boolean | undefined
+
+ const pending = confirm({
+ title: 'Install “pdf”?',
+ confirmLabel: 'Install',
+ busyLabel: 'Installing…',
+ doneLabel: 'Installed',
+ details: [{ label: 'Source', value: 'official/productivity/pdf' }],
+ onConfirm: () => new Promise<void>((resolve, reject) => {
+ attempts += 1
+ finish = resolve
+ fail = reject
+ })
+ }).then(value => { answer = value })
+
+ expect(await screen.findByText('official/productivity/pdf')).toBeTruthy()
+ fireEvent.click(screen.getByRole('button', { name: 'Install' }))
+ expect(await screen.findByRole('button', { name: 'Installing…' })).toBeTruthy()
+ expect(answer).toBeUndefined()
+ expect(await confirm({ title: 'Must not interrupt' })).toBe(false)
+ await act(async () => fail(new Error('Network unavailable')))
+ expect(await screen.findByText('Network unavailable')).toBeTruthy()
+ fireEvent.click(screen.getByRole('button', { name: 'Install' }))
+ await act(async () => finish())
+ expect(await screen.findByRole('button', { name: 'Installed' })).toBeTruthy()
+ await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull())
+ await pending
+ expect(answer).toBe(true)
+ expect(attempts).toBe(2)
+ })
+
it('supersedes an open request, answering the one it replaces no', async () => {
render(<ConfirmHost />)
diff --git a/apps/desktop/src/components/confirm-host.tsx b/apps/desktop/src/components/confirm-host.tsx
index 2b6f8752b97..02446f70d04 100644
--- a/apps/desktop/src/components/confirm-host.tsx
+++ b/apps/desktop/src/components/confirm-host.tsx
@@ -2,7 +2,7 @@ import { useStore } from '@nanostores/react'
import { useEffect, useState } from 'react'
import { ConfirmDialog } from '@/components/ui/confirm-dialog'
-import { $confirmRequest, type PendingConfirm, settleConfirm } from '@/store/confirm'
+import { $confirmRequest, type PendingConfirm, runConfirm, settleConfirm } from '@/store/confirm'
// The one mount point for `confirm()` from @/store/confirm. Mounted once at the
// shell, the way NotificationStack backs notify().
@@ -24,17 +24,29 @@ export function ConfirmHost() {
return (
<ConfirmDialog
+ busyLabel={shown.busyLabel}
cancelLabel={shown.cancelLabel}
confirmLabel={shown.confirmLabel}
description={shown.description}
destructive={shown.destructive}
- // The caller does the work once it has its answer, so there is nothing
- // here to keep the dialog open for.
- dismissOnConfirm
- onClose={() => settleConfirm(false)}
- onConfirm={() => settleConfirm(true)}
+ dismissOnConfirm={!shown.onConfirm}
+ doneLabel={shown.doneLabel}
+ key={shown.id}
+ onClose={() => settleConfirm(shown.phase === 'done', shown)}
+ onConfirm={() => runConfirm(shown)}
open={request !== null}
title={shown.title}
- />
+ >
+ {shown.details && (
+ <dl className="space-y-3 text-xs">
+ {shown.details.map(({ label, value }) => (
+ <div className="grid grid-cols-[5rem_minmax(0,1fr)] gap-3" key={label}>
+ <dt className="text-muted-foreground">{label}</dt>
+ <dd className="m-0 whitespace-pre-wrap break-words text-foreground">{value}</dd>
+ </div>
+ ))}
+ </dl>
+ )}
+ </ConfirmDialog>
)
}
diff --git a/apps/desktop/src/components/ui/confirm-dialog.tsx b/apps/desktop/src/components/ui/confirm-dialog.tsx
index 3792ff41ce6..4aa4b08bca8 100644
--- a/apps/desktop/src/components/ui/confirm-dialog.tsx
+++ b/apps/desktop/src/components/ui/confirm-dialog.tsx
@@ -21,6 +21,7 @@ interface ConfirmDialogProps {
onConfirm: () => Promise<void> | void
title: ReactNode
description?: ReactNode
+ children?: ReactNode
confirmLabel?: string
busyLabel?: string
doneLabel?: string
@@ -48,6 +49,7 @@ export function ConfirmDialog({
onConfirm,
title,
description,
+ children,
confirmLabel,
busyLabel,
doneLabel,
@@ -151,6 +153,7 @@ export function ConfirmDialog({
{description ? <DialogDescription>{description}</DialogDescription> : null}
</DialogHeader>
+ {children}
{error && (
<div className="flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive">
<AlertTriangle className="mt-0.5 size-3.5 shrink-0" />
diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.ts
index 2c1421bbb02..a60819bbea0 100644
--- a/apps/desktop/src/i18n/ar.ts
+++ b/apps/desktop/src/i18n/ar.ts
@@ -2,6 +2,13 @@ import { defineLocale } from './define-locale'
export const ar = defineLocale({
catalog: {
+ installTitle: (name: string) => `تثبيت «${name}»؟`,
+ installDescription: 'ستتوفر هذه المهارة في الجلسات الجديدة. ثبّت من المصادر التي تثق بها فقط.',
+ installTo: 'التثبيت في',
+ thisComputer: 'هذا الكمبيوتر',
+ installing: 'جارٍ التثبيت…',
+ installComplete: (name: string) => `تم تثبيت «${name}»`,
+ destinationChanged: 'تغيرت وجهة التثبيت. أغلق هذا الحوار وافتح رابط التثبيت مجددًا.',
browse: 'تصفح',
installed: 'المثبتة',
searchSkills: 'البحث في المهارات',
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 7e1183e3cbd..01f886d1c6e 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -4,6 +4,13 @@ import type { Translations } from './types'
export const en: Translations = {
catalog: {
+ installTitle: (name: string) => `Install “${name}”?`,
+ installDescription: 'This skill will be available in new sessions. Only install sources you trust.',
+ installTo: 'Install to',
+ thisComputer: 'This computer',
+ installing: 'Installing…',
+ installComplete: (name: string) => `“${name}” installed`,
+ destinationChanged: 'The destination changed. Close this dialog and open the install link again.',
browse: 'Browse',
installed: 'Installed',
searchSkills: 'Search skills',
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index a2aa61677aa..7b0dca87780 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -4,6 +4,13 @@ import { defineLocale } from './define-locale'
export const ja = defineLocale({
catalog: {
+ installTitle: (name: string) => `「${name}」をインストールしますか?`,
+ installDescription: 'このスキルは新しいセッションで利用できます。信頼できる提供元からのみインストールしてください。',
+ installTo: 'インストール先',
+ thisComputer: 'このコンピューター',
+ installing: 'インストール中…',
+ installComplete: (name: string) => `「${name}」をインストールしました`,
+ destinationChanged: 'インストール先が変更されました。このダイアログを閉じ、インストールリンクを開き直してください。',
browse: '閲覧',
installed: 'インストール済み',
searchSkills: 'スキルを検索',
diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.ts
index 643c8520610..30b77f6981a 100644
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@ -25,6 +25,13 @@ const RU_NOUN = (count: number | string, one: string, few: string, many: string)
export const ru = defineLocale({
catalog: {
+ installTitle: (name: string) => `Установить «${name}»?`,
+ installDescription: 'Навык будет доступен в новых сессиях. Устанавливайте только из источников, которым доверяете.',
+ installTo: 'Установить в',
+ thisComputer: 'Этот компьютер',
+ installing: 'Установка…',
+ installComplete: (name: string) => `«${name}» установлен`,
+ destinationChanged: 'Место установки изменилось. Закройте диалог и снова откройте ссылку установки.',
browse: 'Обзор',
installed: 'Установленные',
searchSkills: 'Поиск навыков',
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index e7075541600..23e61ef4662 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -60,6 +60,13 @@ interface AuxTaskCopy {
export interface Translations {
catalog: {
+ installTitle: (name: string) => string
+ installDescription: string
+ installTo: string
+ thisComputer: string
+ installing: string
+ installComplete: (name: string) => string
+ destinationChanged: string
browse: string
installed: string
searchSkills: string
diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.ts
index 041dbfad799..677ed78d0be 100644
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@ -4,6 +4,13 @@ import { defineLocale } from './define-locale'
export const zhHant = defineLocale({
catalog: {
+ installTitle: (name: string) => `安裝「${name}」?`,
+ installDescription: '此技能將於新的工作階段中可用。請僅安裝可信來源的內容。',
+ installTo: '安裝至',
+ thisComputer: '這部電腦',
+ installing: '正在安裝…',
+ installComplete: (name: string) => `已安裝「${name}」`,
+ destinationChanged: '安裝目標已變更。請關閉此對話框並重新開啟安裝連結。',
browse: '瀏覽',
installed: '已安裝',
searchSkills: '搜尋技能',
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index 2b0ba11add2..7e63bd7fad8 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -4,6 +4,13 @@ import { defineLocale } from './define-locale'
export const zh = defineLocale({
catalog: {
+ installTitle: (name: string) => `安装“${name}”?`,
+ installDescription: '此技能将在新会话中可用。请仅安装可信来源的内容。',
+ installTo: '安装到',
+ thisComputer: '此电脑',
+ installing: '正在安装…',
+ installComplete: (name: string) => `已安装“${name}”`,
+ destinationChanged: '安装目标已更改。请关闭此对话框并重新打开安装链接。',
browse: '浏览',
installed: '已安装',
searchSkills: '搜索技能',
diff --git a/apps/desktop/src/store/confirm.ts b/apps/desktop/src/store/confirm.ts
index 6fd6fa46d0d..d1918bdaf54 100644
--- a/apps/desktop/src/store/confirm.ts
+++ b/apps/desktop/src/store/confirm.ts
@@ -4,34 +4,68 @@ export interface ConfirmRequest {
title: string
description?: string
confirmLabel?: string
+ busyLabel?: string
+ doneLabel?: string
+ details?: { label: string; value: string }[]
+ onConfirm?: () => Promise<void>
cancelLabel?: string
destructive?: boolean
}
export interface PendingConfirm extends ConfirmRequest {
+ id: number
resolve: (confirmed: boolean) => void
+ phase?: 'running' | 'done'
}
export const $confirmRequest = atom<null | PendingConfirm>(null)
+let nextRequestId = 0
// Imperative front door to ConfirmDialog, for handlers that want the answer
-// inline the way window.confirm gave it — `if (!ok) return`. A surface that
-// wants the busy → done beat or an inline error should mount <ConfirmDialog>
-// itself and hand it the async onConfirm.
+// inline the way window.confirm gave it — `if (!ok) return`. Pass onConfirm
+// to use the shared dialog's progress, completion and inline error states.
export function confirm(request: ConfirmRequest): Promise<boolean> {
- // One modal at a time: a second ask supersedes the first, which answers no.
+ // An action already in progress must not lose its owner or completion UI.
+ if ($confirmRequest.get()?.phase) {
+ return Promise.resolve(false)
+ }
+
+ // One modal at a time: a second ask supersedes an unanswered question.
settleConfirm(false)
return new Promise<boolean>(resolve => {
- $confirmRequest.set({ ...request, resolve })
+ $confirmRequest.set({ ...request, id: ++nextRequestId, resolve })
})
}
+/** Run the captured request, not a replacement that arrived during I/O. */
+export async function runConfirm(pending: PendingConfirm): Promise<void> {
+ if ($confirmRequest.get() !== pending || pending.phase) {
+ return
+ }
+
+ if (!pending.onConfirm) {
+ settleConfirm(true, pending)
+
+ return
+ }
+
+ pending.phase = 'running'
+
+ try {
+ await pending.onConfirm()
+ pending.phase = 'done'
+ } catch (error) {
+ delete pending.phase
+ throw error
+ }
+}
+
/** Answer the open request, if there still is one. Idempotent. */
-export function settleConfirm(confirmed: boolean): void {
+export function settleConfirm(confirmed: boolean, expected?: PendingConfirm): void {
const pending = $confirmRequest.get()
- if (!pending) {
+ if (!pending || pending.phase === 'running' || (expected && pending !== expected)) {
return
}
diff --git a/apps/desktop/src/store/skill-deeplink-install.test.ts b/apps/desktop/src/store/skill-deeplink-install.test.ts
new file mode 100644
index 00000000000..0b39697232d
--- /dev/null
+++ b/apps/desktop/src/store/skill-deeplink-install.test.ts
@@ -0,0 +1,100 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+
+import { setApiRequestConnection, setApiRequestProfile } from '@/hermes'
+
+import { $confirmRequest, runConfirm, settleConfirm } from './confirm'
+import { $connectionsRegistry } from './connection-registry-state'
+import type * as HubActions from './hub-actions'
+import { installHubSkill } from './hub-actions'
+import { notify } from './notifications'
+import { requestSkillInstallFromDeepLink } from './skill-deeplink-install'
+
+vi.mock('./hub-actions', async importOriginal => ({
+ ...(await importOriginal<typeof HubActions>()),
+ installHubSkill: vi.fn()
+}))
+vi.mock('./notifications', () => ({ notify: vi.fn(), notifyError: vi.fn() }))
+
+beforeEach(() => {
+ setApiRequestConnection('local')
+ setApiRequestProfile('research')
+ vi.mocked(installHubSkill).mockResolvedValue(undefined)
+})
+
+afterEach(() => {
+ settleConfirm(false)
+ $connectionsRegistry.set(null)
+ setApiRequestConnection(null)
+ setApiRequestProfile(null)
+ vi.clearAllMocks()
+})
+
+describe('skill link installation', () => {
+ it('shows the exact source and readable destination, and cancellation installs nothing', async () => {
+ const pending = requestSkillInstallFromDeepLink('clawhub/apple-design')
+ expect($confirmRequest.get()).toMatchObject({
+ title: 'Install “apple-design”?',
+ details: [
+ { label: 'Source', value: 'clawhub/apple-design' },
+ { label: 'Install to', value: 'This computer · research' }
+ ]
+ })
+ settleConfirm(false)
+ await pending
+ expect(installHubSkill).not.toHaveBeenCalled()
+ expect(notify).not.toHaveBeenCalled()
+ })
+
+ it('uses the registered remote name without changing the install destination', async () => {
+ setApiRequestConnection('server-a')
+ $connectionsRegistry.set({
+ version: 2, primary: 'server-a', secureTokenStorage: false,
+ connections: [{ id: 'server-a', kind: 'remote', label: 'Homelab', tokenSet: false, tokenPreview: null }]
+ })
+ const pending = requestSkillInstallFromDeepLink('official/research/example')
+ const request = $confirmRequest.get()!
+ expect(request.details?.[1].value).toBe('Homelab · research')
+ await runConfirm(request)
+ expect(installHubSkill).toHaveBeenCalledExactlyOnceWith('official/research/example', {
+ connectionId: 'server-a', profile: 'research'
+ })
+ expect(notify).toHaveBeenCalledWith(expect.objectContaining({ title: '“example” installed' }))
+ settleConfirm(true)
+ await pending
+ })
+
+ it('keeps a failed action retryable without sending a success notification', async () => {
+ vi.mocked(installHubSkill).mockRejectedValueOnce(new Error('Download failed'))
+ const pending = requestSkillInstallFromDeepLink('clawhub/apple-design')
+ const request = $confirmRequest.get()!
+ await expect(runConfirm(request)).rejects.toThrow('Download failed')
+ expect($confirmRequest.get()).toBe(request)
+ expect(request.phase).toBeUndefined()
+ expect(notify).not.toHaveBeenCalled()
+ await runConfirm(request)
+ expect(request.phase).toBe('done')
+ expect(notify).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({ title: '“apple-design” installed' }))
+ settleConfirm(true)
+ await pending
+ })
+
+ it('refuses a changed destination before installation or retry', async () => {
+ const pending = requestSkillInstallFromDeepLink('clawhub/apple-design')
+ setApiRequestConnection('server-b')
+ await expect(runConfirm($confirmRequest.get()!)).rejects.toThrow('The destination changed')
+ expect(installHubSkill).not.toHaveBeenCalled()
+ settleConfirm(false)
+ await pending
+ })
+
+ it('does not report completion when a profile switch abandons polling', async () => {
+ vi.mocked(installHubSkill).mockImplementationOnce(async () => { setApiRequestProfile('other') })
+ const pending = requestSkillInstallFromDeepLink('clawhub/apple-design')
+ const request = $confirmRequest.get()!
+ await expect(runConfirm(request)).rejects.toThrow('The destination changed')
+ expect(request.phase).toBeUndefined()
+ expect(notify).not.toHaveBeenCalled()
+ settleConfirm(false)
+ await pending
+ })
+})
diff --git a/apps/desktop/src/store/skill-deeplink-install.ts b/apps/desktop/src/store/skill-deeplink-install.ts
index 23dcb1b2b05..10ddedb17e8 100644
--- a/apps/desktop/src/store/skill-deeplink-install.ts
+++ b/apps/desktop/src/store/skill-deeplink-install.ts
@@ -2,7 +2,8 @@ import { getApiRequestConnection, getApiRequestProfile, type ProfileScope } from
import { translateNow } from '@/i18n'
import { confirm } from './confirm'
-import { installHubSkill, notifyHubActionFailed } from './hub-actions'
+import { $connectionsRegistry } from './connection-registry-state'
+import { HubInstallBlockedError, installHubSkill, notifyHubActionFailed } from './hub-actions'
import { notify } from './notifications'
/** The URL supplies only an identifier, never a destination profile or scan override. */
@@ -10,26 +11,52 @@ export async function requestSkillInstallFromDeepLink(identifier: string): Promi
const connectionId = getApiRequestConnection()
const profile = getApiRequestProfile()
const scope: ProfileScope = { connectionId, profile }
- const destination = [connectionId, profile || 'default'].filter(Boolean).join(' / ')
- const confirmed = await confirm({
- title: translateNow('skills.hub.policyAsk'),
- description: `${identifier}
-${translateNow('skills.configuringProfile')} ${destination}
-${translateNow('skills.changesApplyNewSessions')}`,
- confirmLabel: translateNow('skills.hub.install')
- })
+ const name = identifier.split('/').filter(Boolean).at(-1) || identifier
+
+ const connectionLabel = !connectionId || connectionId === 'local'
+ ? translateNow('catalog.thisComputer')
+ : $connectionsRegistry.get()?.connections.find(connection => connection.id === connectionId)?.label || connectionId
+
+ const destination = `${connectionLabel} · ${profile || 'default'}`
- // A pending website request cannot follow the user to a different agent.
- if (!confirmed || connectionId !== getApiRequestConnection() || profile !== getApiRequestProfile()) {
- return
+ const assertDestination = () => {
+ if (connectionId !== getApiRequestConnection() || profile !== getApiRequestProfile()) {
+ throw new Error(translateNow('catalog.destinationChanged'))
+ }
}
- notify({
- kind: 'success',
- title: translateNow('skills.hub.installStarted', identifier),
- message: translateNow('skills.hub.actionLog')
+ await confirm({
+ title: translateNow('catalog.installTitle', name),
+ description: translateNow('catalog.installDescription'),
+ details: [
+ { label: translateNow('catalog.source'), value: identifier },
+ { label: translateNow('catalog.installTo'), value: destination }
+ ],
+ confirmLabel: translateNow('skills.hub.install'),
+ busyLabel: translateNow('catalog.installing'),
+ doneLabel: translateNow('catalog.installed'),
+ onConfirm: async () => {
+ // Recheck on retries too: a link must never follow a changed destination.
+ assertDestination()
+
+ try {
+ await installHubSkill(identifier, scope)
+ } catch (error) {
+ if (error instanceof HubInstallBlockedError) {
+ notifyHubActionFailed(error, translateNow('skills.hub.actionFailed'), name, scope)
+ }
+
+ throw error
+ }
+
+ // The hub abandons polling when the active profile changes. That is not
+ // proof of success, so do not show an Installed state in that case.
+ assertDestination()
+ notify({
+ kind: 'success',
+ title: translateNow('catalog.installComplete', name),
+ message: translateNow('skills.changesApplyNewSessions')
+ })
+ }
})
- await installHubSkill(identifier, scope).catch(err =>
- notifyHubActionFailed(err, translateNow('skills.hub.actionFailed'), identifier, scope)
- )
}
diff --git a/website/docs/user-guide/features/skills.md b/website/docs/user-guide/features/skills.md
index e38a792ff75..59253a7178e 100644
--- a/website/docs/user-guide/features/skills.md
+++ b/website/docs/user-guide/features/skills.md
@@ -49,11 +49,13 @@ The same target is used by native Browse and the card's CLI fallback:
hermes://skill/install?identifier=official%2Fsecurity%2F1password
```
-Hermes asks you to review the identifier and destination profile before
-installing. Cancel makes no changes. Confirmation uses the existing Skills Hub
-background installer, including security scanning, action logs, error reporting,
-and installed-list refresh. If you switch profile or connection while the
-confirmation is open, reopen the link for the new destination. Changes apply to
+Hermes shows **Install “skill-name”?** with separate **Source** and **Install to**
+rows. Cancel makes no changes. After confirmation, the same dialog shows
+**Installing…**, then **Installed** and a completion notification. Errors stay
+in the dialog so you can read them and retry. Installation uses the existing
+Skills Hub pipeline, including security scanning, action logs, and installed-list
+refresh. If you switch profile or connection while the confirmation is open,
+reopen the link for the new destination. Changes apply to
new sessions; a link cannot bypass scanning or select a different profile.
The public links use `hermes://`, not the development-only `hermes-dev://`