Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

chore(ui): 拆出仅 dev 安装的 dsh-tauri-ui-playground 包

hairyf3c61bbd29366
diff --git a/packages/dsh-tauri-ui-playground/README.md b/packages/dsh-tauri-ui-playground/README.md
new file mode 100644
index 00000000..f90cef52
--- /dev/null
+++ b/packages/dsh-tauri-ui-playground/README.md
@@ -0,0 +1,5 @@
+# dsh-tauri-ui-playground
+
+Dev-only「UI 组件」调试面板,从 `dsh-tauri-ui` 拆出的独立包;组件层仍从 `dsh-tauri-ui/client` 复用。
+
+该包 **不在** `src-tauri/resources/internal-plugins.json` 中:debug 构建由 `preset.rs` 的 `discover_dev_internal_plugins_at` 扫描 `packages/*` 发现并安装,release 构建不包含它。
diff --git a/packages/dsh-tauri-ui-playground/cordis.patch.yml b/packages/dsh-tauri-ui-playground/cordis.patch.yml
new file mode 100644
index 00000000..b0097530
--- /dev/null
+++ b/packages/dsh-tauri-ui-playground/cordis.patch.yml
@@ -0,0 +1,3 @@
+- insert:
+ - id: dsh-tauri-ui-playground
+ name: dsh-tauri-ui-playground
diff --git a/packages/dsh-tauri-ui-playground/package.json b/packages/dsh-tauri-ui-playground/package.json
new file mode 100644
index 00000000..5d566d68
--- /dev/null
+++ b/packages/dsh-tauri-ui-playground/package.json
@@ -0,0 +1,69 @@
+{
+ "name": "dsh-tauri-ui-playground",
+ "type": "module",
+ "version": "0.1.0",
+ "description": "Dev-only UI component playground panel for the DSH Tauri desktop shell.",
+ "author": "Hairyf <[email protected]>",
+ "license": "MIT",
+ "homepage": "https://github.com/dsh-tauri-desk/dsh-tauri-plugins#readme",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/dsh-tauri-desk/dsh-tauri-plugins.git"
+ },
+ "bugs": "https://github.com/dsh-tauri-desk/dsh-tauri-plugins/issues",
+ "keywords": [
+ "dsh",
+ "plugin",
+ "dsh-plugin",
+ "ui",
+ "playground",
+ "tauri",
+ "deepseek-harness"
+ ],
+ "sideEffects": false,
+ "exports": {
+ ".": "./dist/index.js",
+ "./client": "./dist/client.cjs",
+ "./package.json": "./package.json"
+ },
+ "main": "./dist/index.js",
+ "module": "./dist/index.js",
+ "types": "./dist/index.d.ts",
+ "files": [
+ "cordis.patch.yml",
+ "dist"
+ ],
+ "dsh": {
+ "client": {
+ "inject": [
+ "@deepseek-ai/dsh-client-ui-layout",
+ "dsh-tauri",
+ "dsh-tauri-ui"
+ ],
+ "external": [
+ "dsh-tauri/client",
+ "dsh-tauri-ui/client"
+ ],
+ "platform": "web"
+ },
+ "bundle": {
+ "patch": "./cordis.patch.yml"
+ }
+ },
+ "scripts": {
+ "build": "tsdown",
+ "dev": "tsdown --watch",
+ "prepublishOnly": "nr build",
+ "start": "tsx src/index.ts",
+ "typecheck": "tsc"
+ },
+ "devDependencies": {
+ "@deepseek-ai/cordis": "catalog:dsh",
+ "@deepseek-ai/dsh-client-ui-layout": "catalog:dsh",
+ "dsh-tauri": "workspace:*",
+ "dsh-tauri-tsdown": "workspace:*",
+ "dsh-tauri-ui": "workspace:*",
+ "react": "catalog:runtime",
+ "tsdown": "catalog:cli"
+ }
+}
diff --git a/packages/dsh-tauri-ui-playground/src/client/constants/index.ts b/packages/dsh-tauri-ui-playground/src/client/constants/index.ts
new file mode 100644
index 00000000..33196640
--- /dev/null
+++ b/packages/dsh-tauri-ui-playground/src/client/constants/index.ts
@@ -0,0 +1,9 @@
+import { PLUGIN_ID } from '../../shared/constants'
+
+/** 面板 id / 顺序 / 样式挂载 id 沿用原 dsh-tauri-ui 取值:调试入口的位置与样式不随搬家改变。 */
+export const UI_COMPONENTS_PANEL_ID = 'dsh-tauri-ui-components'
+export const UI_COMPONENTS_PANEL_ORDER = 50
+export const UI_COMPONENTS_STYLE_ID = 'dsh-tauri-ui-components-styles'
+
+export const LOCALE_EFFECT = `${PLUGIN_ID}: locale`
+export const UI_COMPONENTS_EFFECT = `${PLUGIN_ID}: ui components panel`
diff --git a/packages/dsh-tauri-ui-playground/src/client/index.ts b/packages/dsh-tauri-ui-playground/src/client/index.ts
new file mode 100644
index 00000000..326f7305
--- /dev/null
+++ b/packages/dsh-tauri-ui-playground/src/client/index.ts
@@ -0,0 +1,14 @@
+import type { ClientContext } from 'dsh-tauri/client'
+import { PLUGIN_ID } from '../shared/constants'
+import { LOCALE_EFFECT, UI_COMPONENTS_EFFECT } from './constants'
+import { locale } from './locales'
+import { registerUiComponentsPanel } from './register/components-playground'
+
+export const name = PLUGIN_ID
+
+export const inject = ['slots', 'layout', 'locale']
+
+export function apply(ctx: ClientContext): void {
+ ctx.effect(locale.registerLocale, LOCALE_EFFECT)
+ ctx.effect(registerUiComponentsPanel, UI_COMPONENTS_EFFECT)
+}
diff --git a/packages/dsh-tauri-ui-playground/src/client/locales/index.ts b/packages/dsh-tauri-ui-playground/src/client/locales/index.ts
new file mode 100644
index 00000000..847626ff
--- /dev/null
+++ b/packages/dsh-tauri-ui-playground/src/client/locales/index.ts
@@ -0,0 +1,11 @@
+import { defineLocale } from 'dsh-tauri/client'
+import { PLUGIN_ID } from '../../shared/constants'
+
+export const locale = defineLocale(PLUGIN_ID, {
+ zh: {
+ uiComponents: 'UI 组件',
+ },
+ en: {
+ uiComponents: 'UI components',
+ },
+})
diff --git a/packages/dsh-tauri-ui-playground/src/client/register/components-playground.tsx b/packages/dsh-tauri-ui-playground/src/client/register/components-playground.tsx
new file mode 100644
index 00000000..d1b9f9b8
--- /dev/null
+++ b/packages/dsh-tauri-ui-playground/src/client/register/components-playground.tsx
@@ -0,0 +1,30 @@
+import type { ClientContext } from 'dsh-tauri/client'
+import { Icon, PanelPage, Puzzle } from 'dsh-tauri-ui/client'
+import { definePanel, defineRegister, invoke } from 'dsh-tauri/client'
+import { UI_COMPONENTS_PANEL_ID, UI_COMPONENTS_PANEL_ORDER } from '../constants'
+import { locale } from '../locales'
+import { UiComponentsPanel } from '../ui/components-playground/ui-components'
+
+/** 仅 dev 构建挂载:插件侧没有可用的构建期开关,只能向宿主问 `is_dev_build`。 */
+export const registerUiComponentsPanel = defineRegister<ClientContext>((controller, ctx) => {
+ // 同一 profile 也服务普通浏览器标签:只有桌面 iframe 有宿主命令可问。
+ if (typeof window === 'undefined' || window.parent === window)
+ return
+
+ invoke<boolean>('is_dev_build')
+ .then((dev) => {
+ if (!dev)
+ return
+ const panel = definePanel(ctx, {
+ id: UI_COMPONENTS_PANEL_ID,
+ order: UI_COMPONENTS_PANEL_ORDER,
+ label: () => locale.text('uiComponents'),
+ icon: props => <Icon as={Puzzle} size={props.size} />,
+ render: () => <PanelPage><UiComponentsPanel /></PanelPage>,
+ })
+ controller.add(panel.dispose)
+ })
+ .catch((error: unknown) => {
+ console.warn('[dsh-tauri-ui-playground] is_dev_build unavailable; UI components panel stays hidden', error)
+ })
+})
diff --git a/packages/dsh-tauri-ui-playground/src/client/ui/components-playground/ui-components.cssr.ts b/packages/dsh-tauri-ui-playground/src/client/ui/components-playground/ui-components.cssr.ts
new file mode 100644
index 00000000..15a0fbe1
--- /dev/null
+++ b/packages/dsh-tauri-ui-playground/src/client/ui/components-playground/ui-components.cssr.ts
@@ -0,0 +1,105 @@
+import { cssr, styles as sharedStyles } from 'dsh-tauri-ui/client'
+
+const { c, bem: { b, e } } = cssr
+const { borderL2, layer1, layer3, primary, secondary, tertiary } = sharedStyles
+
+export default b('ui-components', {
+ display: 'flex',
+ flexDirection: 'column',
+ gap: '22px',
+ width: '100%',
+ minWidth: 0,
+ color: primary,
+}, [
+ e('section', {
+ display: 'flex',
+ flexDirection: 'column',
+ gap: '10px',
+ minWidth: 0,
+ }),
+ e('title', {
+ fontSize: '13px',
+ fontWeight: '600',
+ lineHeight: '20px',
+ color: primary,
+ }),
+ e('hint', {
+ fontSize: '12px',
+ lineHeight: '1.5',
+ color: tertiary,
+ }),
+ e('row', {
+ display: 'flex',
+ flexWrap: 'wrap',
+ alignItems: 'center',
+ gap: '10px',
+ }),
+ e('grid', {
+ display: 'grid',
+ gridTemplateColumns: 'repeat(auto-fill, minmax(260px, 1fr))',
+ gap: '10px',
+ }),
+ e('card', {
+ display: 'flex',
+ flexDirection: 'column',
+ gap: '8px',
+ minWidth: 0,
+ padding: '12px',
+ border: `0.5px solid ${borderL2}`,
+ borderRadius: '10px',
+ background: layer1,
+ }),
+ e('cardHead', {
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ gap: '8px',
+ }),
+ e('name', {
+ fontSize: '12px',
+ fontWeight: '600',
+ lineHeight: '18px',
+ color: primary,
+ }),
+ e('badge', {
+ flex: 'none',
+ padding: '0 6px',
+ fontSize: '10px',
+ lineHeight: '16px',
+ color: secondary,
+ background: layer3,
+ borderRadius: '999px',
+ }),
+ e('meta', {
+ display: 'flex',
+ flexDirection: 'column',
+ gap: '2px',
+ fontSize: '11px',
+ lineHeight: '16px',
+ color: tertiary,
+ }),
+ e('code', {
+ fontFamily: 'monospace',
+ fontSize: '11px',
+ lineHeight: '16px',
+ color: secondary,
+ wordBreak: 'break-all',
+ }),
+ e('sample', {
+ display: 'flex',
+ flexWrap: 'wrap',
+ alignItems: 'center',
+ gap: '8px',
+ minHeight: '48px',
+ padding: '10px',
+ background: layer3,
+ borderRadius: '8px',
+ }),
+ e('stack', {
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'flex-start',
+ gap: '8px',
+ }),
+ c('.dshp-ui-components__sample > *', { flex: 'none' }),
+])
diff --git a/packages/dsh-tauri-ui-playground/src/client/ui/components-playground/ui-components.tsx b/packages/dsh-tauri-ui-playground/src/client/ui/components-playground/ui-components.tsx
new file mode 100644
index 00000000..a96a7770
--- /dev/null
+++ b/packages/dsh-tauri-ui-playground/src/client/ui/components-playground/ui-components.tsx
@@ -0,0 +1,231 @@
+import type { ChipVariant, UiComponentEntry } from 'dsh-tauri-ui/client'
+import type { ReactElement, ReactNode } from 'react'
+import {
+ Button,
+ ChevronDown,
+ Chip,
+ CircleTree,
+ Comments,
+ Gear,
+ GoalBar,
+ GoalBarAction,
+ Icon,
+ IconButton,
+ Input,
+ Magnifier,
+ Menu,
+ Person,
+ Pill,
+ Plus,
+ Puzzle,
+ Switch,
+ Tag,
+ TrashBin,
+ UI_COMPONENT_REGISTRY,
+ useMountStyle,
+} from 'dsh-tauri-ui/client'
+import { useState } from 'react'
+import { UI_COMPONENTS_STYLE_ID } from '../../constants'
+import uiComponentsStyle from './ui-components.cssr'
+
+const BUTTON_VARIANTS = ['primary', 'outline', 'ghost', 'toolbar'] as const
+const BUTTON_SIZES = ['md', 'sm'] as const
+const TAG_TONES = ['outline', 'solid', 'neutral', 'quiet', 'success', 'info', 'warning', 'danger'] as const
+
+interface SampleOption { id: string, label: string }
+
+const SEAT_OPTIONS: readonly SampleOption[] = [
+ { id: 'default', label: '默认' },
+ { id: 'plan', label: '计划模式' },
+ { id: 'review', label: '评审模式' },
+]
+const PERMISSION_OPTIONS: readonly SampleOption[] = [
+ { id: 'default', label: '默认权限' },
+ { id: 'acceptEdits', label: '接受编辑' },
+ { id: 'bypass', label: '跳过确认' },
+]
+const THEME_OPTIONS: readonly SampleOption[] = [
+ { id: 'system', label: '跟随系统' },
+ { id: 'light', label: '浅色' },
+ { id: 'dark', label: '深色' },
+]
+
+/** 这三个 chip 在应用里是 select 触发按钮,接上官方 `Menu` 才能调试选中态、chevron 旋转与弹层位置。 */
+function SelectSample({ variant, icon, options }: {
+ variant: ChipVariant
+ icon?: ReactNode
+ options: readonly SampleOption[]
+}): ReactElement {
+ const [open, setOpen] = useState(false)
+ const [value, setValue] = useState(options[0]?.id ?? '')
+ return (
+ <Menu
+ open={open}
+ onClose={() => setOpen(false)}
+ onSelect={(id) => {
+ setOpen(false)
+ setValue(id)
+ }}
+ items={options.map(option => ({ id: option.id, label: option.label }))}
+ selectedId={value}
+ portal
+ align="end"
+ anchor={(
+ <Chip
+ aria-expanded={open}
+ aria-haspopup="menu"
+ chevron={<Icon as={ChevronDown} size={12} />}
+ icon={icon}
+ open={open}
+ variant={variant}
+ onClick={() => setOpen(openState => !openState)}
+ >
+ {options.find(option => option.id === value)?.label ?? value}
+ </Chip>
+ )}
+ />
+ )
+}
+
+function SourceCard({ entry }: { entry: UiComponentEntry }): ReactElement {
+ const { source } = entry
+ return (
+ <div className="dshp-ui-components__card">
+ <div className="dshp-ui-components__cardHead">
+ <span className="dshp-ui-components__name">{entry.title}</span>
+ <span className="dshp-ui-components__badge">{source.kind}</span>
+ </div>
+ <div className="dshp-ui-components__meta">
+ <span>
+ {source.variant === undefined
+ ? `映射组件:${source.component}`
+ : `映射组件:${source.component} · ${source.variant}`}
+ </span>
+ <span className="dshp-ui-components__code">{source.package}</span>
+ <span>{`版本:${source.availableAt.join(' / ')}`}</span>
+ {source.mappedClass === undefined
+ ? null
+ : <span>{`官方类名:.${source.mappedClass}`}</span>}
+ <span className="dshp-ui-components__code">{source.upstreamPath}</span>
+ </div>
+ </div>
+ )
+}
+
+export function UiComponentsPanel(): ReactElement {
+ useMountStyle(uiComponentsStyle, UI_COMPONENTS_STYLE_ID)
+ const [checked, setChecked] = useState(true)
+ const [activePill, setActivePill] = useState('alpha')
+ const [query, setQuery] = useState('')
+
+ return (
+ <div className="dshp-ui-components">
+ <section className="dshp-ui-components__section">
+ <span className="dshp-ui-components__title">官方转发(reexport)</span>
+ <span className="dshp-ui-components__hint">
+ 两代内核都导出,直接转发官方实现,样式由官方 CSS Modules 提供。
+ </span>
+ <div className="dshp-ui-components__sample">
+ {BUTTON_SIZES.map(size => BUTTON_VARIANTS.map(variant => (
+ <Button key={`${size}-${variant}`} size={size} variant={variant}>
+ {`${variant} / ${size}`}
+ </Button>
+ )))}
+ </div>
+ <div className="dshp-ui-components__sample">
+ <Button icon={<Plus />} variant="primary">带图标</Button>
+ <Button icon={<TrashBin />} variant="ghost">带图标</Button>
+ {TAG_TONES.map(tone => <Tag key={tone} tone={tone}>{tone}</Tag>)}
+ <Pill active={activePill === 'alpha'} onClick={() => setActivePill('alpha')}>alpha</Pill>
+ <Pill active={activePill === 'beta'} onClick={() => setActivePill('beta')}>beta</Pill>
+ <Switch checked={checked} label="开关" onChange={setChecked} />
+ <Input
+ icon={<Magnifier />}
+ placeholder="搜索"
+ value={query}
+ onChange={event => setQuery(event.target.value)}
+ />
+ </div>
+ </section>
+
+ <section className="dshp-ui-components__section">
+ <span className="dshp-ui-components__title">refork 组件</span>
+ <span className="dshp-ui-components__hint">
+ 官方只在 0.1.7 有实现或未导出,按官方 CSS 在本地重写;映射见下方表格。
+ </span>
+ <div className="dshp-ui-components__sample">
+ <div className="dshp-ui-components__stack">
+ <Button icon={<Plus width={16} height={16} />} variant="elevated">新建会话</Button>
+ <Button disabled icon={<Plus width={16} height={16} />} variant="elevated">禁用态</Button>
+ <Button icon={<Plus width={16} height={16} />} variant="add">添加模型</Button>
+ <Button icon={<Comments width={16} height={16} />} variant="addGhost">通过 Chat 创建</Button>
+ <Button icon={<TrashBin width={16} height={16} />} variant="danger">删除</Button>
+ <Button icon={<TrashBin width={16} height={16} />} size="sm" variant="danger">删除 / sm</Button>
+ </div>
+ <IconButton aria-label="搜索" icon={<Magnifier width={16} height={16} />} variant="search" />
+ <IconButton aria-label="工具栏" icon={<Gear width={16} height={16} />} variant="toolbar" />
+ <IconButton aria-label="模型" icon={<Puzzle width={16} height={16} />} variant="model" />
+ <IconButton aria-label="圆形" icon={<Plus width={16} height={16} />} variant="round" />
+ <IconButton aria-label="行内" icon={<TrashBin width={16} height={16} />} variant="row" />
+ <IconButton aria-expanded aria-label="帮助" icon={<Person width={16} height={16} />} variant="help" />
+ <IconButton aria-label="消息动作" icon={<Comments width={16} height={16} />} variant="action" />
+ </div>
+ <div className="dshp-ui-components__sample">
+ <div className="dshp-ui-components__stack">
+ <GoalBar
+ actions={(
+ <>
+ <GoalBarAction>日志</GoalBarAction>
+ <GoalBarAction>检出本地</GoalBarAction>
+ <GoalBarAction variant="danger">放弃</GoalBarAction>
+ </>
+ )}
+ glyph={<Icon as={CircleTree} size={14} />}
+ label="工作树"
+ objective="deepseek-harness-desktop · worktree 5a25420f"
+ />
+ <GoalBar
+ actions={<GoalBarAction>关闭</GoalBarAction>}
+ error="worktree create failed: exit 128"
+ glyph={<Icon as={CircleTree} size={14} />}
+ label="错误"
+ />
+ </div>
+ </div>
+ <div className="dshp-ui-components__sample">
+ <SelectSample icon={<Icon as={Person} size={14} />} options={SEAT_OPTIONS} variant="seat" />
+ <SelectSample icon={<Icon as={Gear} size={14} />} options={PERMISSION_OPTIONS} variant="composerTrigger" />
+ <SelectSample options={THEME_OPTIONS} variant="selector" />
+ <Tag variant="version">1.0.0</Tag>
+ <Tag tone="neutral" variant="version">1.0.0</Tag>
+ <Tag tone="outline" variant="status">outline</Tag>
+ <Tag tone="info" variant="status">info</Tag>
+ <Tag tone="danger" variant="status">danger</Tag>
+ </div>
+ </section>
+
+ <section className="dshp-ui-components__section">
+ <span className="dshp-ui-components__title">{`映射表(${UI_COMPONENT_REGISTRY.length})`}</span>
+ <span className="dshp-ui-components__hint">
+ kind = reexport 表示直接转发官方;refork 表示按官方 CSS 在本地重写。
+ </span>
+ <div className="dshp-ui-components__grid">
+ {UI_COMPONENT_REGISTRY.map(entry => <SourceCard key={entry.id} entry={entry} />)}
+ </div>
+ </section>
+
+ <section className="dshp-ui-components__section">
+ <span className="dshp-ui-components__title">图标</span>
+ <span className="dshp-ui-components__hint">
+ 官方 icons 桶两代导出名不同,统一走 @gravity-ui/icons,经 dsh-tauri-ui/client 转发。
+ </span>
+ <div className="dshp-ui-components__sample">
+ <Icon as={Plus} size={20} />
+ <Icon as={TrashBin} size={20} />
+ <Icon as={Magnifier} size={20} />
+ <Icon as={Gear} size={20} />
+ </div>
+ </section>
+ </div>
+ )
+}
diff --git a/packages/dsh-tauri-ui-playground/src/host/apply.ts b/packages/dsh-tauri-ui-playground/src/host/apply.ts
new file mode 100644
index 00000000..5203581d
--- /dev/null
+++ b/packages/dsh-tauri-ui-playground/src/host/apply.ts
@@ -0,0 +1,2 @@
+/** 调试面板只有客户端半边;宿主侧留一个空插件体,只为让加载器拿到合法插件。 */
+export function apply(): void {}
diff --git a/packages/dsh-tauri-ui-playground/src/index.ts b/packages/dsh-tauri-ui-playground/src/index.ts
new file mode 100644
index 00000000..b966dee2
--- /dev/null
+++ b/packages/dsh-tauri-ui-playground/src/index.ts
@@ -0,0 +1,5 @@
+import { PLUGIN_ID } from './shared/constants'
+
+export const name = PLUGIN_ID
+
+export { apply } from './host/apply'
diff --git a/packages/dsh-tauri-ui-playground/src/shared/constants.ts b/packages/dsh-tauri-ui-playground/src/shared/constants.ts
new file mode 100644
index 00000000..3c473c3c
--- /dev/null
+++ b/packages/dsh-tauri-ui-playground/src/shared/constants.ts
@@ -0,0 +1 @@
+export const PLUGIN_ID = 'dsh-tauri-ui-playground'
diff --git a/packages/dsh-tauri-ui-playground/tsdown.config.ts b/packages/dsh-tauri-ui-playground/tsdown.config.ts
new file mode 100644
index 00000000..7b808c14
--- /dev/null
+++ b/packages/dsh-tauri-ui-playground/tsdown.config.ts
@@ -0,0 +1,3 @@
+import { defineDshConfig } from '../dsh-tauri-tsdown/src/index.ts'
+
+export default defineDshConfig()