The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(catalog): restore confirmed skill installs without weakening plugin links
brooklyn!59c54c789288
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.tsxindex 44700b52610..9b27c09b148 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@@ -1,8 +1,11 @@-import { renderHook } from '@testing-library/react'+import { act, renderHook, waitFor } from '@testing-library/react'import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { setApiRequestConnection, setApiRequestProfile } from '@/hermes'import { createClientSessionState } from '@/lib/chat-runtime'import { adoptNewSessionDraft, stashSessionDraft, takeSessionDraft } from '@/store/composer'+import { $confirmRequest, runConfirm, settleConfirm } from '@/store/confirm'+import { $hubInstalledOverride } from '@/store/hub-actions'import { requestMcpInstallFromDeepLink } from '@/store/mcp-deeplink-install'import { requestPluginCatalogInstallFromDeepLink } from '@/store/plugin-catalog-install'import { openPluginInstallRequest } from '@/store/plugin-install-request'@@ -61,6 +64,8 @@ describe('useDesktopIntegrations', () => {window.localStorage.clear()_resetLegacyDiscardForTests()vi.mocked(requestMcpInstallFromDeepLink).mockClear()+ vi.mocked(requestPluginCatalogInstallFromDeepLink).mockClear()+ vi.mocked(openPluginInstallRequest).mockClear()navigate = vi.fn()// Every test starts as a main window; only the HUD describe flips this.hudWindowMock.mockReturnValue(false)@@ -449,7 +454,7 @@ describe('useDesktopIntegrations', () => {render({ profileReady: true, sessions })- // /skills is not a session route — no ownership validation needed.+ // /capabilities is not a session route — no ownership validation needed.expect(navigate).toHaveBeenCalledWith('/capabilities', { replace: true })})@@ -614,6 +619,111 @@ describe('useDesktopIntegrations', () => {})})+ describe('catalog install deep links', () => {+ function listen() {+ render({ profileReady: true, resumeLastSession: false })++ return vi.mocked(window.hermesDesktop.onDeepLink!).mock.calls[0]![0]+ }++ afterEach(() => {+ settleConfirm(false)+ $hubInstalledOverride.set({})+ setApiRequestConnection(null)+ setApiRequestProfile(null)+ })++ it('opens repository confirmation without trusting catalog metadata from the link', () => {+ const deepLink = listen()+ const params = { repo: 'owner/repo#plugin', catalog_name: 'catalog-plugin', sha: 'display-pin' }+ deepLink({ kind: 'plugin', name: 'install', params })++ expect(openPluginInstallRequest).toHaveBeenCalledExactlyOnceWith({+ repo: params.repo,+ enable: true,+ force: false,+ legacyHint: null+ })+ expect(requestPluginCatalogInstallFromDeepLink).not.toHaveBeenCalled()+ expect(navigate).not.toHaveBeenCalled()+ })++ 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.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')+ const identifier = 'skills-sh/owner/repo/skill'+ const payload = { kind: 'skill', name: 'install', params: { identifier } }++ for (const [connection, profile] of [+ ['server-a', 'research'],+ ['server-b', 'work'],+ ['server-a', 'research']+ ]) {+ setApiRequestConnection(connection)+ setApiRequestProfile(profile)+ api.mockClear()+ $hubInstalledOverride.set({})+ act(() => deepLink(payload))+ 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 () => 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,+ priority: 'foreground',+ path: '/api/skills/hub/install',+ method: 'POST',+ body: { identifier }+ }+ ]+ ])+ expect(api).toHaveBeenCalledWith({+ connectionId: connection,+ profile,+ priority: 'foreground',+ path: '/api/actions/skill-link-test/status?lines=200'+ })+ }++ api.mockClear()+ act(() => deepLink(payload))+ setApiRequestConnection('server-b')+ setApiRequestProfile('work')+ 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()+ expect(navigate).not.toHaveBeenCalled()+ })+ })+describe('notification click -> focus-session id translation', () => {function withFocusSession(): (sessionId: string) => void {let handler: ((sessionId: string) => void) | undefineddiff --git a/apps/desktop/src/app/contrib/hooks/use-desktop-integrations.ts b/apps/desktop/src/app/contrib/hooks/use-desktop-integrations.tsindex 4da893ab0ed..56c1b813e7b 100644--- a/apps/desktop/src/app/contrib/hooks/use-desktop-integrations.ts+++ b/apps/desktop/src/app/contrib/hooks/use-desktop-integrations.ts@@ -33,6 +33,7 @@ import {} from '@/store/session'import { $botChatScopes, $sessionTiles, storedSessionIdForRuntimeId } from '@/store/session-states'import { onSessionsChanged } from '@/store/session-sync'+import { requestSkillInstallFromDeepLink } from '@/store/skill-deeplink-install'import { openUpdatesWindow, startUpdatePoller, stopUpdatePoller } from '@/store/updates'import { isBrowserWindow, isHudWindow, isSecondaryWindow } from '@/store/windows'import type { SessionInfo } from '@/types/hermes'@@ -312,6 +313,7 @@ export function useDesktopIntegrations({// names toast an error and never fall back to a git-path install.// - plugin/install?… (and legacy plugin-agent/plugin-desktop) → plugin install// modal awaiting explicit confirmation. Never auto-installs.+ // - skill/install?identifier=… → confirmation, then the existing hub pipeline// - blueprint/<name>?… → reviewable /blueprint command in the composer// - <plugin>/<path>?… → in-app navigate (e.g. index-network/intent/1)// - open/<path>?… → in-app navigate (generic)@@ -380,6 +382,16 @@ export function useDesktopIntegrations({return}+ if (action.type === 'skill-install') {+ void requestSkillInstallFromDeepLink(action.identifier)++ return+ }++ if (payload.kind === 'skill') {+ return+ }+// Not a core action — treat as a plugin-scoped or open/ navigation deep// link (hermes://index-network/intent/1, hermes://open/…). The resolver// rejects reserved kinds and unsafe paths.diff --git a/apps/desktop/src/components/confirm-host.test.tsx b/apps/desktop/src/components/confirm-host.test.tsxindex 0aeff59273e..99aee7e4fd5 100644--- a/apps/desktop/src/components/confirm-host.test.tsx+++ b/apps/desktop/src/components/confirm-host.test.tsx@@ -64,6 +64,45 @@ 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.tsxindex 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.tsxindex fc166efd439..37f5a904617 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> | voidtitle: ReactNodedescription?: ReactNode+ children?: ReactNodeconfirmLabel?: stringbusyLabel?: stringdoneLabel?: string@@ -48,6 +49,7 @@ export function ConfirmDialog({onConfirm,title,description,+ children,confirmLabel,busyLabel,doneLabel,@@ -153,6 +155,7 @@ export function ConfirmDialog({{description ? <DialogDescription className="whitespace-pre-line">{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.tsindex 2103204b316..e3989dd1584 100644--- a/apps/desktop/src/i18n/ar.ts+++ b/apps/desktop/src/i18n/ar.ts@@ -8,6 +8,45 @@ export const ar = defineLocale({close: 'إغلاق'},+ catalog: {+ listView: 'عرض القائمة',+ cardView: 'عرض البطاقات',+ installTitle: (name: string) => `تثبيت «${name}»؟`,+ installDescription: 'ستتوفر هذه المهارة في الجلسات الجديدة. ثبّت من المصادر التي تثق بها فقط.',+ installTo: 'التثبيت في',+ thisComputer: 'هذا الكمبيوتر',+ installing: 'جارٍ التثبيت…',+ installComplete: (name: string) => `تم تثبيت «${name}»`,+ destinationChanged: 'تغيرت وجهة التثبيت. أغلق هذا الحوار وافتح رابط التثبيت مجددًا.',+ browse: 'تصفح',+ installed: 'المثبتة',+ searchSkills: 'البحث في المهارات',+ searchPlugins: 'البحث في الإضافات',+ allSources: 'كل المصادر',+ allCategories: 'كل الفئات',+ about: 'نبذة',+ author: 'المؤلف',+ source: 'المصدر',+ category: 'الفئة',+ version: 'الإصدار',+ platforms: 'المنصات',+ requires: 'المتطلبات',+ tools: 'الأدوات',+ hooks: 'الخطافات',+ repository: 'المستودع',+ documentation: 'التوثيق',+ noResults: 'لا توجد نتائج مطابقة',+ tryAnother: 'جرّب بحثًا آخر أو امسح عوامل التصفية.',+ clearFilters: 'مسح عوامل التصفية',+ loadFailed: 'تعذر تحميل الكتالوج',+ retry: 'حاول مرة أخرى',+ more: 'عرض المزيد',+ pinned: 'التزام تمت مراجعته',+ snapshotHint: 'من كتالوج Hermes. لا يتصل التصفح بمستودعات المصدر مطلقًا.',+ installHint: 'راجع المصدر قبل التثبيت. تسري التغييرات على الجلسات الجديدة.',+ results: (count: number) => `النتائج: ${count.toLocaleString('ar')}`,+ back: 'العودة إلى النتائج'+ },sessionImport: {title: 'المتابعة من تطبيق آخر',subtitle: 'انقل محادثة إلى Hermes وتابع من حيث توقفت.',diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex ed93456fa0d..7e68147f992 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -11,6 +11,45 @@ export const en: Translations = {},// English editorial copy stays in the shipped JSONL; other locales override it.intro: { stock: {}, custom: () => [] },+ catalog: {+ listView: 'List view',+ cardView: 'Card view',+ 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',+ searchPlugins: 'Search plugins',+ allSources: 'All sources',+ allCategories: 'All categories',+ about: 'About',+ author: 'Author',+ source: 'Source',+ category: 'Category',+ version: 'Version',+ platforms: 'Platforms',+ requires: 'Requires',+ tools: 'Tools',+ hooks: 'Hooks',+ repository: 'Repository',+ documentation: 'Documentation',+ noResults: 'No matches',+ tryAnother: 'Try another search or clear your filters.',+ clearFilters: 'Clear filters',+ loadFailed: 'Could not load the catalog',+ retry: 'Try again',+ more: 'Show more',+ pinned: 'Reviewed commit',+ snapshotHint: 'From the Hermes catalog. Browsing never contacts source repositories.',+ installHint: 'Review the source before installing. Changes apply to new sessions.',+ results: (count: number) => `${count.toLocaleString()} result${count === 1 ? '' : 's'}`,+ back: 'Back to results'+ },connectors: {title: 'Connect your apps',connect: 'Connect',diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex a52151f61a6..54dc3a26f15 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -11,6 +11,47 @@ export const ja = defineLocale({close: '閉じる'},intro: introJa,+ catalog: {+ listView: 'リスト表示',+ cardView: 'カード表示',+ installTitle: (name: string) => `「${name}」をインストールしますか?`,+ installDescription:+ 'このスキルは新しいセッションで利用できます。信頼できる提供元からのみインストールしてください。',+ installTo: 'インストール先',+ thisComputer: 'このコンピューター',+ installing: 'インストール中…',+ installComplete: (name: string) => `「${name}」をインストールしました`,+ destinationChanged:+ 'インストール先が変更されました。このダイアログを閉じ、インストールリンクを開き直してください。',+ browse: '閲覧',+ installed: 'インストール済み',+ searchSkills: 'スキルを検索',+ searchPlugins: 'プラグインを検索',+ allSources: 'すべての提供元',+ allCategories: 'すべてのカテゴリ',+ about: '概要',+ author: '作者',+ source: '提供元',+ category: 'カテゴリ',+ version: 'バージョン',+ platforms: '対応プラットフォーム',+ requires: '必要なもの',+ tools: 'ツール',+ hooks: 'フック',+ repository: 'リポジトリ',+ documentation: 'ドキュメント',+ noResults: '一致する項目がありません',+ tryAnother: '別の検索を試すか、フィルターをクリアしてください。',+ clearFilters: 'フィルターをクリア',+ loadFailed: 'カタログを読み込めませんでした',+ retry: '再試行',+ more: 'さらに表示',+ pinned: 'レビュー済みコミット',+ snapshotHint: 'Hermesカタログの情報です。閲覧時に提供元のリポジトリへ接続することはありません。',+ installHint: 'インストール前にソースを確認してください。変更は新しいセッションに適用されます。',+ results: (count: number) => `${count.toLocaleString('ja')}件の結果`,+ back: '結果に戻る'+ },sessionImport: {title: '別のアプリから続ける',subtitle: '会話をHermesに取り込み、続きを始めましょう。',diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.tsindex 288aba7cc18..e821f2a63b3 100644--- a/apps/desktop/src/i18n/ru.ts+++ b/apps/desktop/src/i18n/ru.ts@@ -24,6 +24,46 @@ const RU_NOUN = (count: number | string, one: string, few: string, many: string)}export const ru = defineLocale({+ catalog: {+ listView: 'Список',+ cardView: 'Карточки',+ installTitle: (name: string) => `Установить «${name}»?`,+ installDescription: 'Навык будет доступен в новых сессиях. Устанавливайте только из источников, которым доверяете.',+ installTo: 'Установить в',+ thisComputer: 'Этот компьютер',+ installing: 'Установка…',+ installComplete: (name: string) => `«${name}» установлен`,+ destinationChanged: 'Место установки изменилось. Закройте диалог и снова откройте ссылку установки.',+ browse: 'Обзор',+ installed: 'Установленные',+ searchSkills: 'Поиск навыков',+ searchPlugins: 'Поиск плагинов',+ allSources: 'Все источники',+ allCategories: 'Все категории',+ about: 'Описание',+ author: 'Автор',+ source: 'Источник',+ category: 'Категория',+ version: 'Версия',+ platforms: 'Платформы',+ requires: 'Требования',+ tools: 'Инструменты',+ hooks: 'Хуки',+ repository: 'Репозиторий',+ documentation: 'Документация',+ noResults: 'Совпадений нет',+ tryAnother: 'Попробуйте другой запрос или сбросьте фильтры.',+ clearFilters: 'Сбросить фильтры',+ loadFailed: 'Не удалось загрузить каталог',+ retry: 'Попробовать снова',+ more: 'Показать ещё',+ pinned: 'Проверенный коммит',+ snapshotHint: 'Из каталога Hermes. При просмотре нет обращений к исходным репозиториям.',+ installHint: 'Проверьте исходный код перед установкой. Изменения применяются к новым сессиям.',+ results: (count: number) =>+ `${count.toLocaleString('ru')} ${RU_PLURAL(count, 'результат', 'результата', 'результатов')}`,+ back: 'Назад к результатам'+ },sessionImport: {title: 'Продолжить из другого приложения',subtitle: 'Перенесите разговор в Hermes и продолжите с того места, где остановились.',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 85dd257a339..6a0fd52d1e6 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -69,6 +69,45 @@ export interface Translations {stock: Record<string, string[]>custom: (label: string) => string[]}+ catalog: {+ listView: string+ cardView: string+ installTitle: (name: string) => string+ installDescription: string+ installTo: string+ thisComputer: string+ installing: string+ installComplete: (name: string) => string+ destinationChanged: string+ browse: string+ installed: string+ searchSkills: string+ searchPlugins: string+ allSources: string+ allCategories: string+ about: string+ author: string+ source: string+ category: string+ version: string+ platforms: string+ requires: string+ tools: string+ hooks: string+ repository: string+ documentation: string+ noResults: string+ tryAnother: string+ clearFilters: string+ loadFailed: string+ retry: string+ more: string+ pinned: string+ snapshotHint: string+ installHint: string+ results: (count: number) => string+ back: string+ }connectors: {title: stringconnect: stringdiff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex 886b6071ced..67e58ee4122 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -11,6 +11,45 @@ export const zhHant = defineLocale({close: '關閉'},intro: introZhHant,+ catalog: {+ listView: '清單檢視',+ cardView: '卡片檢視',+ installTitle: (name: string) => `安裝「${name}」?`,+ installDescription: '此技能將於新的工作階段中可用。請僅安裝可信來源的內容。',+ installTo: '安裝至',+ thisComputer: '這部電腦',+ installing: '正在安裝…',+ installComplete: (name: string) => `已安裝「${name}」`,+ destinationChanged: '安裝目標已變更。請關閉此對話框並重新開啟安裝連結。',+ browse: '瀏覽',+ installed: '已安裝',+ searchSkills: '搜尋技能',+ searchPlugins: '搜尋外掛',+ allSources: '所有來源',+ allCategories: '所有分類',+ about: '簡介',+ author: '作者',+ source: '來源',+ category: '分類',+ version: '版本',+ platforms: '支援的平台',+ requires: '相依項目',+ tools: '工具',+ hooks: '掛鉤',+ repository: '程式碼儲存庫',+ documentation: '文件',+ noResults: '沒有符合的項目',+ tryAnother: '請嘗試其他搜尋或清除篩選條件。',+ clearFilters: '清除篩選條件',+ loadFailed: '無法載入目錄',+ retry: '再試一次',+ more: '顯示更多',+ pinned: '已審核的提交',+ snapshotHint: '內容來自 Hermes 目錄。瀏覽時不會連線至來源程式碼儲存庫。',+ installHint: '安裝前請檢查原始碼。變更將於新的工作階段生效。',+ results: (count: number) => `${count.toLocaleString('zh-Hant')} 個結果`,+ back: '返回結果'+ },sessionImport: {title: '從其他應用程式繼續',subtitle: '將對話匯入 Hermes,接著上次的進度繼續。',diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex 0469310e97d..842196176d0 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -11,6 +11,45 @@ export const zh = defineLocale({close: '关闭'},intro: introZh,+ catalog: {+ listView: '列表视图',+ cardView: '卡片视图',+ installTitle: (name: string) => `安装“${name}”?`,+ installDescription: '此技能将在新会话中可用。请仅安装可信来源的内容。',+ installTo: '安装到',+ thisComputer: '此电脑',+ installing: '正在安装…',+ installComplete: (name: string) => `已安装“${name}”`,+ destinationChanged: '安装目标已更改。请关闭此对话框并重新打开安装链接。',+ browse: '浏览',+ installed: '已安装',+ searchSkills: '搜索技能',+ searchPlugins: '搜索插件',+ allSources: '所有来源',+ allCategories: '所有分类',+ about: '简介',+ author: '作者',+ source: '来源',+ category: '分类',+ version: '版本',+ platforms: '支持的平台',+ requires: '依赖项',+ tools: '工具',+ hooks: '钩子',+ repository: '代码仓库',+ documentation: '文档',+ noResults: '没有匹配项',+ tryAnother: '请尝试其他搜索或清除筛选条件。',+ clearFilters: '清除筛选条件',+ loadFailed: '无法加载目录',+ retry: '重试',+ more: '显示更多',+ pinned: '已审核的提交',+ snapshotHint: '内容来自 Hermes 目录。浏览时不会连接来源代码仓库。',+ installHint: '安装前请检查源代码。更改将在新会话中生效。',+ results: (count: number) => `${count.toLocaleString('zh')} 个结果`,+ back: '返回结果'+ },connectors: {title: '连接你的应用',connect: '连接',diff --git a/apps/desktop/src/lib/catalog-install.test.ts b/apps/desktop/src/lib/catalog-install.test.tsnew file mode 100644index 00000000000..0395b9e38c9--- /dev/null+++ b/apps/desktop/src/lib/catalog-install.test.ts@@ -0,0 +1,53 @@+import { pluginCatalogInstallUrl, skillCatalogInstallIdentifier, skillCatalogInstallUrl } from '@hermes/shared'+import { describe, expect, it } from 'vitest'++import { resolveDeepLinkAction } from './deeplink-routes'++function route(href: string) {+ const url = new URL(href)++ return resolveDeepLinkAction({+ kind: url.hostname,+ name: url.pathname.slice(1),+ params: Object.fromEntries(url.searchParams)+ })+}++describe('public catalog install links', () => {+ it.each([+ [{ name: 'Apple Design', source: 'ClawHub', identifier: 'apple-design' }, 'clawhub/apple-design'],+ [{ name: 'Apple Design', source: 'ClawHub', identifier: 'clawhub/apple-design' }, 'clawhub/apple-design'],+ [{ name: 'pdf', source: 'Anthropic', identifier: 'anthropics/skills/skills/pdf' }, 'anthropics/skills/skills/pdf'],+ [{ name: 'pdf', source: 'optional' }, 'official/pdf'],+ [+ { name: 'pdf', source: 'built-in', installIdentifier: 'NousResearch/hermes-agent/skills/productivity/pdf' },+ 'NousResearch/hermes-agent/skills/productivity/pdf'+ ],+ [+ { name: 'A name', source: 'future-source', identifier: 'provider/path?mode=one&two#readme' },+ 'provider/path?mode=one&two#readme'+ ]+ ])('preserves the source-specific target for %o', (entry, identifier) => {+ expect(skillCatalogInstallIdentifier(entry)).toBe(identifier)+ expect(route(skillCatalogInstallUrl(entry)!)).toEqual({ type: 'skill-install', identifier })+ })++ it('omits bundled install links when an older snapshot has no exact target', () => {+ expect(skillCatalogInstallUrl({ name: 'pdf', source: 'built-in' })).toBeNull()+ })++ it('routes only the canonical catalog name through the reviewed lookup', () => {+ const plugin = {+ name: 'weather',+ repo: 'https://github.com/owner/plugins',+ subdir: 'packages/weather',+ sha: 'a'.repeat(40)+ }++ expect(route(pluginCatalogInstallUrl(plugin))).toEqual({+ type: 'plugin-catalog-install',+ name: plugin.name+ })+ expect([...new URL(pluginCatalogInstallUrl(plugin)).searchParams]).toEqual([['catalog', plugin.name]])+ })+})diff --git a/apps/desktop/src/lib/deeplink-routes.test.ts b/apps/desktop/src/lib/deeplink-routes.test.tsindex ace1834ef96..9742789918f 100644--- a/apps/desktop/src/lib/deeplink-routes.test.ts+++ b/apps/desktop/src/lib/deeplink-routes.test.ts@@ -39,6 +39,31 @@ describe('resolveDeepLinkAction', () => {).toEqual({ type: 'plugin-catalog-install', name: '' })})+ it('does not trust URL catalog metadata on a repository install', () => {+ const params = {+ repo: 'https://github.com/owner/repo#plugins/example',+ catalog_name: 'example',+ sha: '0123456789abcdef0123456789abcdef01234567',+ enable: '1'+ }++ const url = new URL(`hermes://plugin/install?${new URLSearchParams(params)}`)++ expect(+ resolveDeepLinkAction({+ kind: url.hostname,+ name: url.pathname.slice(1),+ params: Object.fromEntries(url.searchParams)+ })+ ).toEqual({+ type: 'plugin-install',+ repo: params.repo,+ enable: true,+ force: false,+ legacyHint: null+ })+ })+it('routes legacy plugin-agent alias', () => {expect(resolveDeepLinkAction({@@ -49,6 +74,50 @@ describe('resolveDeepLinkAction', () => {).toMatchObject({ type: 'plugin-install', legacyHint: 'agent' })})+ it('only routes skill installs with an explicit, unchanged identifier', () => {+ const identifier = 'skills-sh/owner/repo/a skill?mode=one&two#readme'+ const url = new URL(`hermes://skill/install?${new URLSearchParams({ identifier })}`)++ expect(+ resolveDeepLinkAction({+ kind: url.hostname,+ name: url.pathname.slice(1),+ params: Object.fromEntries(url.searchParams)+ })+ ).toEqual({ type: 'skill-install', identifier })++ const invalidParams: Record<string, string>[] = [+ {},+ { identifier: '' },+ { identifier: ' ' },+ { identifier: ' official/skill ' }+ ]++ for (const params of invalidParams) {+ expect(resolveDeepLinkAction({ kind: 'skill', name: 'install', params })).toEqual({ type: 'ignore' })+ }++ expect(resolveDeepLinkAction({ kind: 'skill', name: 'remove', params: { identifier } })).toEqual({ type: 'ignore' })+ expect(resolveDeepLinkAction({ kind: 'plugin', name: 'install', params: {} })).toEqual({ type: 'ignore' })+ })++ it('preserves connector completion routing without treating browser status as authority', () => {+ expect(+ resolveDeepLinkAction({+ kind: 'connections',+ name: 'done',+ params: { op: ' operation-1 ', status: ' connected ' }+ })+ ).toEqual({ type: 'connection-done', op: 'operation-1', status: 'connected' })+ expect(+ resolveDeepLinkAction({+ kind: 'connections',+ name: 'done',+ params: { status: 'connected' }+ })+ ).toEqual({ type: 'ignore' })+ })+it('routes blueprint composer inserts', () => {expect(resolveDeepLinkAction({diff --git a/apps/desktop/src/lib/deeplink-routes.ts b/apps/desktop/src/lib/deeplink-routes.tsindex 547728b5657..158254050ea 100644--- a/apps/desktop/src/lib/deeplink-routes.ts+++ b/apps/desktop/src/lib/deeplink-routes.ts@@ -11,6 +11,7 @@ export type DeepLinkAction =/** `hermes://plugin/install?catalog=<name>` — resolved against the curated* catalog by the caller; the raw name is never treated as a git identifier. */| { type: 'plugin-catalog-install'; name: string }+ | { type: 'skill-install'; identifier: string }| { type: 'composer-blueprint'; name: string; params: Record<string, string> }| { type: 'connection-done'; op: string; status: string }| { type: 'ignore' }@@ -50,7 +51,20 @@ export function resolveDeepLinkAction(payload: DeepLinkPayload | null | undefinereturn { type: 'plugin-catalog-install', name: payload.params.catalog.trim() }}- const repo = (payload.params?.repo || payload.params?.identifier || payload.name || '').trim()+ if (payload.kind === 'skill') {+ const identifier = payload.params?.identifier++ return payload.name === 'install' && identifier && identifier === identifier.trim()+ ? { type: 'skill-install', identifier }+ : { type: 'ignore' }+ }++ const repo = (+ payload.params?.repo ||+ payload.params?.identifier ||+ (payload.kind !== 'plugin' ? payload.name : '') ||+ ''+ ).trim()if (payload.kind === 'plugin' && payload.name === 'install' && repo) {return {diff --git a/apps/desktop/src/lib/hermes-open-target.test.ts b/apps/desktop/src/lib/hermes-open-target.test.tsindex 35f1c7439d5..59f8d3f4fef 100644--- a/apps/desktop/src/lib/hermes-open-target.test.ts+++ b/apps/desktop/src/lib/hermes-open-target.test.ts@@ -59,5 +59,6 @@ describe('pathFromHermesDeepLink', () => {it('ignores reserved kinds', () => {expect(pathFromHermesDeepLink('blueprint', 'morning-brief')).toBeNull()expect(pathFromHermesDeepLink('plugin', 'install')).toBeNull()+ expect(pathFromHermesDeepLink('skill', 'install')).toBeNull()})})diff --git a/apps/desktop/src/lib/hermes-open-target.ts b/apps/desktop/src/lib/hermes-open-target.tsindex a865486d1be..6c0f36bef01 100644--- a/apps/desktop/src/lib/hermes-open-target.ts+++ b/apps/desktop/src/lib/hermes-open-target.ts@@ -26,7 +26,8 @@ const RESERVED_DEEP_LINK_KINDS = new Set(['plugin','plugin-agent','plugin-desktop',- 'settings'+ 'settings',+ 'skill'])function appendSearch(path: string, params: URLSearchParams | Record<string, string> | undefined): string {diff --git a/apps/desktop/src/store/confirm.ts b/apps/desktop/src/store/confirm.tsindex 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: stringdescription?: stringconfirmLabel?: string+ busyLabel?: string+ doneLabel?: string+ details?: { label: string; value: string }[]+ onConfirm?: () => Promise<void>cancelLabel?: stringdestructive?: boolean}export interface PendingConfirm extends ConfirmRequest {+ id: numberresolve: (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.tsnew file mode 100644index 00000000000..99c50ea5a4c--- /dev/null+++ b/apps/desktop/src/store/skill-deeplink-install.test.ts@@ -0,0 +1,105 @@+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.tsnew file mode 100644index 00000000000..51c8d2e9523--- /dev/null+++ b/apps/desktop/src/store/skill-deeplink-install.ts@@ -0,0 +1,64 @@+import { getApiRequestConnection, getApiRequestProfile, type ProfileScope } from '@/hermes'+import { translateNow } from '@/i18n'++import { confirm } from './confirm'+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. */+export async function requestSkillInstallFromDeepLink(identifier: string): Promise<void> {+ const connectionId = getApiRequestConnection()+ const profile = getApiRequestProfile()+ const scope: ProfileScope = { connectionId, profile }+ 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'}`++ const assertDestination = () => {+ if (connectionId !== getApiRequestConnection() || profile !== getApiRequestProfile()) {+ throw new Error(translateNow('catalog.destinationChanged'))+ }+ }++ 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')+ })+ }+ })+}diff --git a/apps/shared/src/catalog-install.ts b/apps/shared/src/catalog-install.tsnew file mode 100644index 00000000000..451cc24ebd7--- /dev/null+++ b/apps/shared/src/catalog-install.ts@@ -0,0 +1,35 @@+/** Install targets shared by the public docs galleries and native catalog. */+export interface SkillCatalogTarget {+ name: string+ source: string+ identifier?: string+ installIdentifier?: string+}++export function skillCatalogInstallIdentifier(skill: SkillCatalogTarget): string | null {+ if (skill.installIdentifier) {+ return skill.installIdentifier+ }++ const identifier = skill.identifier++ // Older snapshots omit identifiers for local skills. Optional skills have a+ // source-qualified name lookup; bundled skills are not in that source.+ if (!identifier) {+ return skill.source === 'built-in' ? null : skill.source === 'optional' ? `official/${skill.name}` : skill.name+ }++ return skill.source.toLowerCase() === 'clawhub' && !identifier.startsWith('clawhub/')+ ? `clawhub/${identifier}`+ : identifier+}++export function skillCatalogInstallUrl(skill: SkillCatalogTarget): string | null {+ const identifier = skillCatalogInstallIdentifier(skill)++ return identifier ? `hermes://skill/install?${new URLSearchParams({ identifier })}` : null+}++export function pluginCatalogInstallUrl(plugin: { name: string }): string {+ return `hermes://plugin/install?${new URLSearchParams({ catalog: plugin.name })}`+}diff --git a/apps/shared/src/index.ts b/apps/shared/src/index.tsindex aada831da1a..1ff335bebff 100644--- a/apps/shared/src/index.ts+++ b/apps/shared/src/index.ts@@ -27,6 +27,7 @@ export type {UsageBarData,UsageModelData} from './billing-types'+export { pluginCatalogInstallUrl, skillCatalogInstallIdentifier, skillCatalogInstallUrl } from './catalog-install'export {driveChargeSettlement,SETTLEMENT_MAX_RETRY_AFTER_MS,