DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.
feat(extension): 将官方插件合并到扩展管理首 Tab (#870)
Mao Mrcbe9d655e0ff
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex ababbcb2..a3ec88f8 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -122,10 +122,21 @@ jobs:# 0.1.6 起上游改了设置侧栏分区名与未分组 chip 等文案,另需一轮 e2e 适配。npm install --no-audit --no-fund @deepseek-ai/[email protected]- - name: Plugin L2 test+ - name: Plugin L2 test (legacy core)env:DSH_E2E_DSH_BIN: ${{ runner.temp }}/dsh-cli/node_modules/@deepseek-ai/dsh/lib/bin.js- run: pnpm run test:e2e:plugin -- --run+ run: node node_modules/vitest/vitest.mjs run --project plugin --exclude test/e2e/plugins/dsh-tauri-extension-panel.e2e.ts++ - name: Install current dsh CLI (isolated)+ run: npm install --prefix "$RUNNER_TEMP/dsh-cli-current" --no-audit --no-fund @deepseek-ai/[email protected]++ - name: Official plugins composition (current core)+ env:+ DSH_E2E_DSH_BIN: ${{ runner.temp }}/dsh-cli-current/node_modules/@deepseek-ai/dsh/lib/bin.js+ run: |+ for seed in 101 102 103 104 105; do+ node node_modules/vitest/vitest.mjs run --project plugin --sequence.shuffle --sequence.seed="$seed" test/e2e/plugins/dsh-tauri-extension-panel.e2e.ts || exit $?+ done# 桌面端 L3 E2E(vitest + WebdriverIO):# 驱动真实 Tauri 窗口,只能在 Windows 上跑(embedded WebDriver + WebView2)。diff --git a/packages/dsh-tauri-extension/src/client/components/extension-panel.test.tsx b/packages/dsh-tauri-extension/src/client/components/extension-panel.test.tsxindex 92f68f96..b1b9940e 100644--- a/packages/dsh-tauri-extension/src/client/components/extension-panel.test.tsx+++ b/packages/dsh-tauri-extension/src/client/components/extension-panel.test.tsx@@ -1,28 +1,55 @@+import type { SegmentedControlProps } from '../../../../dsh-tauri-ui/src/client/components/segmented-control'import type { MarketFace } from '../service/market.types'import { renderToStaticMarkup } from 'react-dom/server'import { afterEach, describe, expect, it, vi } from 'vitest'import { ExtensionPanel } from './extension-panel'-vi.mock('dsh-tauri-ui/client', () => ({ SegmentedControl: () => null }))+vi.mock('dsh-tauri/client', async () => import('../../../../dsh-tauri/src/client/modules/reause'))+vi.mock('dsh-tauri-ui/client', () => ({+ SegmentedControl: ({ options, value }: SegmentedControlProps) => <nav data-active={value}>{options.map(option => <span key={option.value}>{option.value}</span>)}</nav>,+}))vi.mock('../locales', () => ({ locale: { text: (key: string) => key } }))vi.mock('./skills-tab', () => ({ SkillsTab: () => <section>skills-content</section> }))vi.mock('./mcp-tab', () => ({ McpTab: () => <section>mcp-content</section> }))afterEach(() => vi.restoreAllMocks())-describe('extension panel market composition', () => {- it('renders the market element with the installed subsection preference', () => {+describe('extension panel composition', () => {+ it('renders the official plugins element as the first selected tab', () => {+ const render = vi.fn(() => <section>installed-market-content</section>)+ const market: MarketFace = { version: 1, render, setSettingsVisible: vi.fn(), settingsVisible: () => false }+ const markup = renderToStaticMarkup(<ExtensionPanel plugins={<section>official-plugins-content</section>} market={market} createSkill={async () => {}} />)+ expect(markup).toContain('data-active="plugins"')+ expect(markup).toContain('<span>plugins</span><span>market</span><span>skills</span><span>mcp</span>')+ expect(markup).toContain('official-plugins-content')+ expect(render).not.toHaveBeenCalled()+ expect(markup).not.toContain('skills-content')+ expect(markup).not.toContain('mcp-content')+ })++ it('renders plugins without the optional market service', () => {+ const markup = renderToStaticMarkup(<ExtensionPanel plugins={<section>official-plugins-content</section>} market={undefined} createSkill={async () => {}} />)+ expect(markup).toContain('data-active="plugins"')+ expect(markup).toContain('<span>plugins</span><span>skills</span><span>mcp</span>')+ expect(markup).toContain('official-plugins-content')+ })++ it('renders the market element with the installed subsection preference when plugins are unavailable', () => {const render = vi.fn(() => <section>installed-market-content</section>)const market: MarketFace = { version: 1, render, setSettingsVisible: vi.fn(), settingsVisible: () => false }const markup = renderToStaticMarkup(<ExtensionPanel market={market} createSkill={async () => {}} />)+ expect(markup).toContain('data-active="market"')+ expect(markup).toContain('<span>market</span><span>skills</span><span>mcp</span>')expect(render).toHaveBeenCalledExactlyOnceWith({ preferredSubsectionId: 'installed' })expect(markup).toContain('installed-market-content')expect(markup).not.toContain('skills-content')expect(markup).not.toContain('mcp-content')})- it('renders skills when the optional market service is missing', () => {+ it('renders skills when both optional pages are unavailable', () => {const markup = renderToStaticMarkup(<ExtensionPanel market={undefined} createSkill={async () => {}} />)+ expect(markup).toContain('data-active="skills"')+ expect(markup).toContain('<span>skills</span><span>mcp</span>')expect(markup).toContain('skills-content')expect(markup).not.toContain('installed-market-content')expect(markup).not.toContain('mcp-content')diff --git a/packages/dsh-tauri-extension/src/client/components/extension-panel.tsx b/packages/dsh-tauri-extension/src/client/components/extension-panel.tsxindex 5345edaf..545248a5 100644--- a/packages/dsh-tauri-extension/src/client/components/extension-panel.tsx+++ b/packages/dsh-tauri-extension/src/client/components/extension-panel.tsx@@ -1,7 +1,8 @@import type { ReactElement } from 'react'import type { MarketFace } from '../service/market.types'import { SegmentedControl } from 'dsh-tauri-ui/client'-import { useEffect, useId, useState } from 'react'+import { useWatchImmediate } from 'dsh-tauri/client'+import { useId, useState } from 'react'import { locale } from '../locales'import { resolveActiveTab } from './extension-panel.utils'import { McpTab } from './mcp-tab'@@ -9,7 +10,7 @@ import { SkillsTab } from './skills-tab'export interface ExtensionPanelProps {createSkill: () => Promise<void>- /** 市场未安装 / 未发布 `render` 时为 undefined:此时不出现市场标签页。 */+ plugins?: ReactElementmarket: MarketFace | undefined}@@ -19,11 +20,12 @@ interface ExtensionTab {render: () => ReactElement}-export function ExtensionPanel({ createSkill, market }: ExtensionPanelProps): ReactElement {+export function ExtensionPanel({ createSkill, market, plugins }: ExtensionPanelProps): ReactElement {const t = locale.textconst tabsId = useId()const marketFace = marketconst rows: ExtensionTab[] = [+ ...(plugins === undefined ? [] : [{ id: 'plugins', label: t('pluginsTab'), render: () => plugins }]),...(marketFace === undefined? []: [{ id: 'market', label: t('marketTab'), render: () => <>{marketFace.render({ preferredSubsectionId: 'installed' })}</> }]),@@ -34,9 +36,7 @@ export function ExtensionPanel({ createSkill, market }: ExtensionPanelProps): Reconst [requestedId, setRequestedId] = useState(initialId)const [visited, setVisited] = useState<ReadonlySet<string>>(() => new Set([initialId]))const activeId = resolveActiveTab(rows, requestedId)- // 市场服务消失时会回落到别的标签页:那也已经「打开过」,同样要留在挂载集里,- // 否则市场一回来它就卸载,用户在那一页里的状态被丢掉。- useEffect(() => setVisited(previous => previous.has(activeId) ? previous : new Set([...previous, activeId])), [activeId])+ useWatchImmediate(activeId, () => setVisited(previous => previous.has(activeId) ? previous : new Set([...previous, activeId])))return (<div>@@ -50,7 +50,7 @@ export function ExtensionPanel({ createSkill, market }: ExtensionPanelProps): ReonChange={setRequestedId}/></div>- {rows.filter(row => row.id === activeId || visited.has(row.id)).map((row) => {+ {rows.filter(row => row.id === activeId || (row.id !== 'plugins' && visited.has(row.id))).map((row) => {const selected = row.id === activeIdreturn <div key={row.id} id={`${tabsId}-${row.id}-panel`} className="min-w-0 pt-[2px]" role="tabpanel" aria-labelledby={`${tabsId}-${row.id}`} hidden={!selected}>{row.render()}</div>})}diff --git a/packages/dsh-tauri-extension/src/client/locales/index.ts b/packages/dsh-tauri-extension/src/client/locales/index.tsindex d0dbc278..3c806940 100644--- a/packages/dsh-tauri-extension/src/client/locales/index.ts+++ b/packages/dsh-tauri-extension/src/client/locales/index.ts@@ -2,7 +2,8 @@ import { defineLocale } from 'dsh-tauri/client'import { PLUGIN_ID } from '../constants'const zh = {- extension: '扩展管理',+ extension: '插件扩展',+ pluginsTab: '插件',skillsTab: '技能',mcpTab: 'MCP',marketTab: '市场',@@ -118,7 +119,8 @@ const zh = {type LocaleKey = keyof typeof zhconst en: Record<LocaleKey, string> = {- extension: 'Extension Management',+ extension: 'Plugin Extensions',+ pluginsTab: 'Plugins',skillsTab: 'Skills',mcpTab: 'MCP',marketTab: 'Market',diff --git a/packages/dsh-tauri-extension/src/client/register/extension-panel.tsx b/packages/dsh-tauri-extension/src/client/register/extension-panel.tsxindex 548cefb0..b3cf604e 100644--- a/packages/dsh-tauri-extension/src/client/register/extension-panel.tsx+++ b/packages/dsh-tauri-extension/src/client/register/extension-panel.tsx@@ -1,6 +1,8 @@-import type { ClientContext, PanelHandle } from 'dsh-tauri/client'-import { Icon, Panel, Puzzle } from 'dsh-tauri-ui/client'-import { definePanel, defineRegister } from 'dsh-tauri/client'+import type { ClientContext, PanelHandle, SlotRegistry } from 'dsh-tauri/client'+import type { ReactElement } from 'react'+import { cssr, Icon, IconSparkleRegular, mountStyle, Panel, Puzzle, SlotOutlet } from 'dsh-tauri-ui/client'+import { definePanel, defineRegister, hidePanel } from 'dsh-tauri/client'+import { useSyncExternalStore } from 'react'import { ExtensionPanel } from '../components/extension-panel'import { MARKET_SERVICE_NAME, PANEL_ACTION_ORDER, PANEL_ID } from '../constants'import { locale } from '../locales'@@ -8,14 +10,54 @@ import { currentScope, hostsMarketPanel, readMarket } from '../service/market'import { store } from '../store'import { chooseWorkspace, sessionSnapshotOf, workspaceSnapshotOf } from './extension-panel.utils'+const pluginsStyle = cssr.c([+ cssr.c('[data-dsh-extension-plugins]', { position: 'relative' }),+ cssr.c('[data-dsh-extension-plugins] > [data-dsh-plugins-icon]', { display: 'none', position: 'absolute', top: '5px', left: 0, width: '22px', height: '22px', alignItems: 'center', justifyContent: 'center', pointerEvents: 'none' }),+ cssr.c('[data-dsh-extension-plugins]:has([data-plugin-panel] > header[data-window-drag]) > [data-dsh-plugins-icon]', { display: 'inline-flex' }),+ cssr.c('[data-dsh-extension-plugins] [data-plugin-panel]', { height: 'auto', padding: 0, overflow: 'visible', gap: '14px' }),+ cssr.c('[data-dsh-extension-plugins] [data-plugin-panel] > header[data-window-drag]', { paddingTop: 0, flexWrap: 'wrap', alignItems: 'center', gap: '14px 10px' }),+ cssr.c('[data-dsh-extension-plugins] [data-plugin-panel] > header > div:first-child', { display: 'contents' }),+ cssr.c('[data-dsh-extension-plugins] [data-plugin-panel] > header h1', { margin: 0, paddingLeft: '32px', fontSize: '16px', lineHeight: '24px', fontWeight: 500 }),+ cssr.c('[data-dsh-extension-plugins] [data-plugin-panel] > header > div:first-child > div', { order: 2, width: '100%', margin: 0, fontSize: '12px', lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)' }),+ cssr.c('[data-dsh-extension-plugins] [data-plugin-panel] > header > div:last-child', { marginLeft: 'auto' }),+ cssr.c('[data-dsh-extension-plugins] [data-plugin-panel] div[data-window-drag]', { paddingTop: '12px' }),+])+export const extensionPanelFeature = defineRegister<ClientContext>((controller, ctx, adapter) => {let panel: PanelHandle | undefined- // 同一份 profile 也服务普通浏览器标签:只有桌面 iframe 收编市场,浏览器保留其设置页入口。const embedMarket = hostsMarketPanel(currentScope())+ const slots = adapter.service<SlotRegistry>('slots')+ let restorePlugins: (() => void) | undefined++ function hasPlugins(): boolean {+ return typeof SlotOutlet === 'function'+ && typeof slots?.subscribe === 'function'+ && typeof slots?.entriesOfSlot === 'function'+ && slots.entriesOfSlot('main').some(entry => entry.options.key === 'plugins')+ }++ function subscribePlugins(listener: () => void): () => void {+ if (typeof slots?.subscribe !== 'function')+ return () => {}+ return slots.subscribe('main', listener)+ }++ function syncPlugins(): void {+ if (hasPlugins()) {+ restorePlugins ??= hidePanel(ctx, 'plugins', PANEL_ID)+ }+ else {+ restorePlugins?.()+ restorePlugins = undefined+ }+ }++ controller.add(mountStyle(pluginsStyle, `${PANEL_ID}-plugins`, PANEL_ID))+ if (typeof slots?.subscribe === 'function')+ controller.add(subscribePlugins(syncPlugins))+ syncPlugins()+ controller.add(() => restorePlugins?.())- // 市场收进本插槽后,它自带的设置页入口就是重复入口,撤下它;撤下前记住原状态,- // 服务被撤下或本插件卸载时由 inject 返回的 disposer 还原。服务由另一个客户端插件- // 发布,apply 顺序不保证,所以用 inject 等它到位。ctx.inject([MARKET_SERVICE_NAME], () => {if (!embedMarket)return@@ -27,7 +69,7 @@ export const extensionPanelFeature = defineRegister<ClientContext>((controller,return () => face.setSettingsVisible(restore)})- const createSkill = async (): Promise<void> => {+ async function createSkill(): Promise<void> {const id = chooseWorkspace(sessionSnapshotOf(adapter.sessions.list?.getSnapshot()),workspaceSnapshotOf(adapter.workspaces.list?.getSnapshot()),@@ -48,11 +90,23 @@ export const extensionPanelFeature = defineRegister<ClientContext>((controller,locale: locale.NS,label: () => locale.text('extension'),icon: props => <Icon as={Puzzle} size={props.size} />,- render: () => (- <Panel>- <ExtensionPanel createSkill={createSkill} market={embedMarket ? readMarket(ctx) : undefined} />- </Panel>- ),+ render: function ExtensionPage() {+ const available = useSyncExternalStore(subscribePlugins, hasPlugins, hasPlugins)+ let plugins: ReactElement | undefined+ if (available && typeof SlotOutlet === 'function') {+ plugins = (+ <div data-dsh-extension-plugins>+ <span data-dsh-plugins-icon aria-hidden="true"><IconSparkleRegular size={16} /></span>+ <SlotOutlet slotKey="main" opts={{ entryKey: 'plugins' }} />+ </div>+ )+ }+ return (+ <Panel>+ <ExtensionPanel plugins={plugins} createSkill={createSkill} market={embedMarket ? readMarket(ctx) : undefined} />+ </Panel>+ )+ },})controller.add(panel.dispose)})diff --git a/packages/dsh-tauri-ui/src/client/components/official.tsx b/packages/dsh-tauri-ui/src/client/components/official.tsxindex e7b6ef3d..fbc3e020 100644--- a/packages/dsh-tauri-ui/src/client/components/official.tsx+++ b/packages/dsh-tauri-ui/src/client/components/official.tsx@@ -1,21 +1,3 @@-// 引用源 @deepseek-ai/dsh-client-ui-primitives · packages/client/ui-primitives/src/ · 版本 0.1.7-rc.2(≥0.1.5-rc.1)· hash 官方原样(无 refork 类)-/**- * 官方 `@deepseek-ai/dsh-client-ui-primitives` 的直通转发层。- *- * 只转发 **0.1.5-rc.1 与 0.1.7-alpha.1 都导出** 的成员(判定依据见 `registry.ts` 的- * `availableAt`):两代内核拿到同一个官方实现,本包不复制样式,也不制造版本漂移。- *- * 仅 0.1.7 才有的组件必须在本目录 refork(`checkbox`、`segmented-control` 就是先例),- * 否则在 0.1.5 内核上取到 `undefined` 并触发 React #130(`Element type is invalid …`)。- *- * `Button` / `Tag` 已由本目录的 `button.tsx` / `tag.tsx` 接管(单组件内分发:官方 variant- * 继续走官方实现,本地 variant 走 refork 样式),故不在此转发。- *- * 不在此转发官方 icons 桶:两代导出名不同(`IconXxx16` → `IconXxxRegular`),图标- * 统一走 `@gravity-ui/icons`(见 `icons.tsx`)。也不转发 `ReferenceIcon` / `LinkIcon`:- * 0.1.7 已删除这两个名字,改为 `ReferenceIcon{Regular,Medium}` / `LinkIcon{Regular,Medium}`。- */-export {BrandWordmark,classifyFileType,@@ -37,6 +19,7 @@ export {FISH_LOGO_VIEWBOX,FishLogo,HoverCard,+ IconSparkleRegular,Input,JsonBlock,JsonTree,@@ -110,3 +93,5 @@ export type {WebSearchBlockProps,WebSourceView,} from '@deepseek-ai/dsh-client-ui-primitives'++export { SlotOutlet } from '@deepseek-ai/dsh-client-ui-renderer'diff --git a/packages/dsh-tauri/src/client/panel/index.test.ts b/packages/dsh-tauri/src/client/panel/index.test.tsnew file mode 100644index 00000000..6a880429--- /dev/null+++ b/packages/dsh-tauri/src/client/panel/index.test.ts@@ -0,0 +1,67 @@+import type { SlotComponent } from '@deepseek-ai/dsh-client-ui-slots'+import type { ComponentType } from 'react'+import type { ClientContext } from '../types'+import { SlotCore } from '@deepseek-ai/dsh-client-ui-slots'+import { createElement } from 'react'+import { renderToStaticMarkup } from 'react-dom/server'+import { afterEach, describe, expect, it, vi } from 'vitest'+import { hidePanel } from './index'++function panelRegistry(): { core: SlotCore, ctx: ClientContext } {+ const core = new SlotCore()+ core.register({+ name: 'root',+ children: {+ 'main': { kind: 'keyed', scope: 'root' },+ 'sidebar.panellist': { kind: 'list', scope: 'root' },+ },+ } as never, (() => null) as SlotComponent<never>)+ const ctx = {+ slots: {+ entriesOfSlot: (key: string) => core.entriesOfSlot(key),+ register: core.register.bind(core),+ inject: (_key: string, callback: () => () => void) => callback(),+ },+ } as unknown as ClientContext+ return { core, ctx }+}++afterEach(() => vi.restoreAllMocks())++describe('hidePanel', () => {+ it('shadows only the sidebar icon while preserving the official main entry', () => {+ const { core, ctx } = panelRegistry()+ const originalIcon = () => null+ const originalPage = () => null+ core.register({ name: 'sidebar.panellist', id: 'plugins', label: 'Plugins', order: 40 } as never, originalIcon)+ core.register({ name: 'main', key: 'plugins' }, originalPage)+ const main = core.entriesOfSlot('main')[0]++ const restore = hidePanel(ctx, 'plugins', 'dsh-tauri-extension')+ const winner = core.entriesOfSlot('sidebar.panellist')[0]+ expect(winner.options).toMatchObject({ id: 'plugins', label: 'Plugins', order: 40, priority: -1 })+ const markup = renderToStaticMarkup(createElement(winner.component as ComponentType))+ expect(markup).toContain('data-dsh-hidden-panel="plugins"')+ expect(markup).toContain('data-plugin="dsh-tauri-extension"')+ expect(markup).toContain('button:has([data-dsh-hidden-panel]) { display: none !important; }')+ expect(core.entriesOfSlot('main')[0]).toBe(main)+ expect(core.entries('sidebar.panellist')).toHaveLength(2)++ restore()+ restore()+ expect(core.entriesOfSlot('sidebar.panellist')[0].component).toBe(originalIcon)+ expect(core.entries('sidebar.panellist')).toHaveLength(1)+ expect(core.entriesOfSlot('main')[0].component).toBe(originalPage)+ })++ it('hides a sidebar icon that registers after its main page', () => {+ const { core, ctx } = panelRegistry()+ const restore = hidePanel(ctx, 'plugins', 'dsh-tauri-extension')+ const hidden = core.entriesOfSlot('sidebar.panellist')[0]+ const originalIcon = () => null+ core.register({ name: 'sidebar.panellist', id: 'plugins', order: 40 } as never, originalIcon)+ expect(core.entriesOfSlot('sidebar.panellist')[0]).toBe(hidden)+ restore()+ expect(core.entriesOfSlot('sidebar.panellist')[0].component).toBe(originalIcon)+ })+})diff --git a/packages/dsh-tauri/src/client/panel/index.ts b/packages/dsh-tauri/src/client/panel/index.tsindex dabcb5d1..ba13891e 100644--- a/packages/dsh-tauri/src/client/panel/index.ts+++ b/packages/dsh-tauri/src/client/panel/index.ts@@ -1,5 +1,6 @@import type { ComponentType, ReactElement } from 'react'import type { ClientContext, Translate } from '../types'+import { createElement } from 'react'const PANEL_LIST_SLOT = 'sidebar.panellist'const PANEL_MAIN_SLOT = 'main'@@ -24,6 +25,23 @@ export interface PanelHandle {dispose: () => void}+export function hidePanel(ctx: ClientContext, id: string, registrant: string): () => void {+ return ctx.slots.inject(PANEL_LIST_SLOT as never, () => {+ const entry = ctx.slots.entriesOfSlot(PANEL_LIST_SLOT as never).find(entry => entry.options.id === id)+ return ctx.slots.register({+ ...entry?.options,+ name: PANEL_LIST_SLOT,+ id,+ priority: (entry?.options.priority ?? 0) - 1,+ registrant,+ } as never, () => createElement(+ 'span',+ { 'data-dsh-hidden-panel': id },+ createElement('style', { 'data-plugin': registrant }, 'button:has([data-dsh-hidden-panel]) { display: none !important; }'),+ ))+ })+}+export function definePanel(ctx: ClientContext, entry: PanelEntry): PanelHandle {const { id } = entryconst disposers: Array<() => void> = [diff --git a/test/e2e/plugins/dsh-tauri-extension-panel.e2e.ts b/test/e2e/plugins/dsh-tauri-extension-panel.e2e.tsnew file mode 100644index 00000000..9ca0346d--- /dev/null+++ b/test/e2e/plugins/dsh-tauri-extension-panel.e2e.ts@@ -0,0 +1,88 @@+import type { Browser } from 'playwright'+import { afterAll, beforeAll, describe, expect, it } from 'vitest'+import { expectNoSyntheticFallbacks, launchDshBrowser, newDshPage } from '../support/browser'++let browser: Browser+beforeAll(async () => {+ browser = await launchDshBrowser()+})+afterAll(async () => {+ await browser?.close()+})++describe('extension panel official plugins composition', () => {+ it('hides the original sidebar row and mounts the official page only while its first tab is active', async () => {+ const app = await newDshPage(browser, { ready: '[data-dsh-hidden-panel="plugins"]' })+ try {+ const originalRow = app.frame.locator('button:has([data-dsh-hidden-panel="plugins"])')+ expect(await originalRow.count(), '原插件入口必须保留注册但隐藏整行').toBe(1)+ expect(await originalRow.evaluate(el => getComputedStyle(el).display)).toBe('none')+ expect(await originalRow.isVisible()).toBe(false)++ await app.frame.getByRole('button', { name: '插件扩展', exact: true }).click()+ const tabs = app.frame.getByRole('tablist', { name: '插件扩展' })+ const pluginsTab = tabs.getByRole('tab', { name: '插件', exact: true })+ await expect.poll(() => tabs.getByRole('tab').first().textContent()).toBe('插件')+ await expect.poll(() => pluginsTab.getAttribute('aria-selected')).toBe('true')++ const officialPage = app.frame.locator('[data-dsh-extension-plugins] [data-plugin-panel]')+ await expect.poll(() => officialPage.isVisible(), { message: '首 Tab 必须渲染真实官方插件页面' }).toBe(true)+ expect(await officialPage.count()).toBe(1)+ expect(await officialPage.evaluate((el) => {+ const style = getComputedStyle(el)+ return { padding: style.padding, overflow: style.overflow }+ })).toEqual({ padding: '0px', overflow: 'visible' })+ expect(await officialPage.locator(':scope > header[data-window-drag]').evaluate(el => getComputedStyle(el).paddingTop)).toBe('0px')++ const heading = officialPage.locator(':scope > header h1')+ const intro = officialPage.locator(':scope > header > div:first-child > div')+ const titleStyle = await heading.evaluate((el) => {+ const style = getComputedStyle(el)+ return { fontSize: style.fontSize, lineHeight: style.lineHeight, fontWeight: style.fontWeight }+ })+ const introStyle = await intro.evaluate((el) => {+ const style = getComputedStyle(el)+ return { fontSize: style.fontSize, lineHeight: style.lineHeight, color: style.color }+ })+ expect(titleStyle).toEqual({ fontSize: '16px', lineHeight: '24px', fontWeight: '500' })+ expect(introStyle).toMatchObject({ fontSize: '12px', lineHeight: '18px' })+ expect(await officialPage.locator(':scope > header').evaluate(el => getComputedStyle(el).rowGap)).toBe('14px')+ const sparkle = app.frame.locator('[data-dsh-plugins-icon] svg')+ expect(await sparkle.isVisible(), '官方闪光图标必须出现在页头').toBe(true)+ expect(await sparkle.getAttribute('width')).toBe('16')++ await expect.poll(() => officialPage.locator('[data-plugin-item]').count()).toBeGreaterThan(0)+ await officialPage.locator('[data-plugin-item]').first().getByRole('button').first().click()+ const detailTop = officialPage.locator('[data-plugin-item-detail] > div[data-window-drag]')+ await expect.poll(() => detailTop.isVisible()).toBe(true)+ expect(await detailTop.evaluate(el => getComputedStyle(el).paddingTop), '详情顶部间距必须为 12px').toBe('12px')+ expect(await sparkle.isVisible(), '详情页不显示列表页头图标').toBe(false)+ await detailTop.getByRole('button').first().click()++ await tabs.getByRole('tab', { name: '技能', exact: true }).click()+ const skillsPanel = app.frame.getByRole('tabpanel', { name: '技能', exact: true, includeHidden: true })+ await expect.poll(() => skillsPanel.isVisible()).toBe(true)+ expect(await skillsPanel.locator(':scope > div > div:first-child > h3').evaluate((el) => {+ const style = getComputedStyle(el)+ return { fontSize: style.fontSize, lineHeight: style.lineHeight, fontWeight: style.fontWeight }+ }), '插件标题尺寸必须与技能页一致').toEqual(titleStyle)+ expect(await skillsPanel.locator(':scope > div > p').first().evaluate((el) => {+ const style = getComputedStyle(el)+ return { fontSize: style.fontSize, lineHeight: style.lineHeight, color: style.color }+ }), '插件描述尺寸和颜色必须与技能页一致').toEqual(introStyle)+ await expect.poll(() => app.frame.locator('[data-plugin-panel]').count(), { message: '离开插件 Tab 必须卸载官方页面,不能仅 hidden' }).toBe(0)++ await tabs.getByRole('tab', { name: 'MCP', exact: true }).click()+ expect(await skillsPanel.count(), '其他已访问 Tab 仍须保留挂载').toBe(1)+ expect(await skillsPanel.isVisible()).toBe(false)+ await pluginsTab.click()+ await expect.poll(() => officialPage.isVisible()).toBe(true)+ expect(await originalRow.isVisible()).toBe(false)+ expectNoSyntheticFallbacks(app)+ expect(app.errors, '复用官方页面和切换 Tab 不得产生浏览器错误').toEqual([])+ }+ finally {+ await app.close()+ }+ })+})diff --git a/types/slot-outlet.d.ts b/types/slot-outlet.d.tsindex 38cd48d8..21dec738 100644--- a/types/slot-outlet.d.ts+++ b/types/slot-outlet.d.ts@@ -13,7 +13,7 @@ declare module '@deepseek-ai/dsh-client-ui-renderer' {export const SlotOutlet: ComponentType<{slotKey: stringownerProps?: Record<string, unknown>- opts?: { only?: string, fallback?: ReactNode }+ opts?: { only?: string, entryKey?: string, fallback?: ReactNode }}> | undefined}