DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.
feat: add DSH OPS plugin to manifest and remove deprecated tests
hairyfd8efbbc02547
diff --git a/src-tauri/resources/manifest.jsonc b/src-tauri/resources/manifest.jsoncindex dbf06388..5fb6c52d 100644--- a/src-tauri/resources/manifest.jsonc+++ b/src-tauri/resources/manifest.jsonc@@ -211,6 +211,16 @@"checked": false,"version": "latest"},+ {+ "id": "dsh-ops",+ "spec": "dsh-ops",+ "name": "DSH Optimize",+ "description": "dsh-ops 底层操作工具插件,旨在减少 Token 消耗与任务耗时。 | A toolkit for low-level operations in DSH, designed to reduce token usage and task execution time.",+ "repo": "https://github.com/T-Auto/dsh-ops",+ "recommended": true,+ "checked": false,+ "version": "latest"+ },{"id": "dshmarket","spec": "dshmarket",@@ -240,16 +250,6 @@}]},- {- "id": "dsh-ops",- "spec": "dsh-ops",- "name": "DSH OPS",- "description": "DSH 底层操作工具插件,旨在减少 Token 消耗与任务耗时。 | A toolkit for low-level operations in DSH, designed to reduce token usage and task execution time.",- "repo": "https://github.com/T-Auto/dsh-ops",- "recommended": true,- "checked": false,- "version": "latest"- },{"id": "@changfenhuang/dsh-genui","spec": "@changfenhuang/dsh-genui",diff --git a/test/bundle-metadata.test.ts b/test/bundle-metadata.test.tsdeleted file mode 100644index bb6f85d7..00000000--- a/test/bundle-metadata.test.ts+++ /dev/null@@ -1,271 +0,0 @@-import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'-import { tmpdir } from 'node:os'-import path from 'node:path'-import { describe, expect, it } from 'vitest'-import * as bundleMetadata from '../scripts/bundle-metadata.mjs'--// 类型来自随脚本发布的 `bundle-metadata.d.mts`,测试不再另抄一份接口-// (抄一份的代价:脚本签名一变,用例仍在旧接口上编译通过)。-type BundlePlatform = 'windows' | 'macos' | 'linux'-type BundleArch = 'x64' | 'arm64'--const constants = {- nodeVersion: '22.22.0',- nodeBaseUrl: 'https://nodejs.org/dist/',- pnpmVersion: '11.7.0',- pnpmBaseUrl: 'https://registry.npmjs.org/pnpm/-/',- pnpmSha256: 'a'.repeat(64),- mingitVersion: '2.53.0.2',- mingitBaseUrl: 'https://github.com/git-for-windows/git/releases/download/v2.53.0.windows.2/',- mingitX64Sha256: 'b'.repeat(64),- mingitArm64Sha256: 'c'.repeat(64),- dshCoreUrl: 'https://github.com/dsh-tauri-desk/deepseek-harness-pkg/releases/latest/download/',-}--const DSH_TAG = 'dsh-0.2.1-rc.2-39022695148'--function assetsFor(platform: BundlePlatform, arch: BundleArch, options: { withGit?: boolean } = {}) {- return bundleMetadata.bundleAssets({ platform, arch, constants, dshTag: DSH_TAG, ...options })-}--describe('bundle metadata tag parsing', () => {- it.each([- ['dsh-0.1.0-rc.7-32054485373', '0.1.0-rc.7'],- ['dsh-0.1.1-rc.2-32485170079', '0.1.1-rc.2'],- ['src-0.1.2-alpha.1', '0.1.2-alpha.1'],- ['dsh-src-0.1.2-alpha.1-33260039971', '0.1.2-alpha.1'],- ])('parses %s', (tag, version) => {- expect(bundleMetadata.parseVersionFromTag(tag)).toBe(version)- })-- it.each(['dsh-0.2.0', '0.1.0-rc.7-abc', '', 'dsh-'])('rejects %s', (tag) => {- expect(bundleMetadata.parseVersionFromTag(tag)).toBeNull()- })-})--describe('bundle asset names', () => {- it('mirrors the runtime node distribution layout', () => {- expect(bundleMetadata.nodeAssetName('windows', 'x64', '22.22.0')).toBe('node-v22.22.0-win-x64.zip')- expect(bundleMetadata.nodeAssetName('windows', 'arm64', '22.22.0')).toBe('node-v22.22.0-win-x64.zip')- expect(bundleMetadata.nodeAssetName('macos', 'arm64', '22.22.0')).toBe('node-v22.22.0-darwin-arm64.tar.gz')- expect(bundleMetadata.nodeAssetName('macos', 'x64', '22.22.0')).toBe('node-v22.22.0-darwin-x64.tar.gz')- expect(bundleMetadata.nodeAssetName('linux', 'x64', '22.22.0')).toBe('node-v22.22.0-linux-x64.tar.gz')- expect(bundleMetadata.nodeAssetName('linux', 'arm64', '22.22.0')).toBe('node-v22.22.0-linux-arm64.tar.gz')- })-- it('mirrors the packaged core asset layout', () => {- expect(bundleMetadata.dshAssetName('windows', 'x64')).toBe('deepseek-harness-pkg-windows.zip')- expect(bundleMetadata.dshAssetName('linux', 'x64')).toBe('deepseek-harness-pkg-linux.zip')- expect(bundleMetadata.dshAssetName('linux', 'arm64')).toBe('deepseek-harness-pkg-linux-arm64.zip')- expect(bundleMetadata.dshAssetName('macos', 'arm64')).toBe('deepseek-harness-pkg-macos-arm64.zip')- expect(bundleMetadata.dshAssetName('macos', 'x64')).toBe('deepseek-harness-pkg-macos-x64.zip')- })-- it('mirrors the MinGit asset layout and rejects unknown architectures', () => {- expect(bundleMetadata.mingitAssetName('x64', '2.53.0.2')).toBe('MinGit-2.53.0.2-64-bit.zip')- expect(bundleMetadata.mingitAssetName('arm64', '2.53.0.2')).toBe('MinGit-2.53.0.2-arm64.zip')- // 平台/架构来自 workflow 输入,运行期必须对未知值报错,而不是静默拼一个资产名。- expect(() => bundleMetadata.mingitAssetName('ia32' as BundleArch, '2.53.0.2')).toThrow(/^BUNDLE_METADATA:/)- })-})--describe('bundle asset resolution', () => {- it('pins every essentials asset to a downloadable url', () => {- const assets = assetsFor('windows', 'x64')-- expect(assets.node.url).toBe('https://nodejs.org/dist/v22.22.0/node-v22.22.0-win-x64.zip')- expect(assets.node.sha256Url).toBe('https://nodejs.org/dist/v22.22.0/SHASUMS256.txt')- expect(assets.dsh.url).toBe(- `https://github.com/dsh-tauri-desk/deepseek-harness-pkg/releases/download/${DSH_TAG}/deepseek-harness-pkg-windows.zip`,- )- expect(assets.pnpm.url).toBe('https://registry.npmjs.org/pnpm/-/pnpm-11.7.0.tgz')- })-- it('bundles MinGit only on request, and only on windows', () => {- // 启动 dsh 不需要 Git:默认只随包必要品。- expect(bundleMetadata.bundleTargets('windows')).toEqual(['node', 'pnpm', 'dsh'])- expect(bundleMetadata.bundleTargets('macos')).toEqual(['node', 'pnpm', 'dsh'])- expect(Object.keys(assetsFor('windows', 'x64')).sort()).toEqual(['dsh', 'node', 'pnpm'])- expect(Object.keys(assetsFor('macos', 'arm64')).sort()).toEqual(['dsh', 'node', 'pnpm'])-- const withGit = assetsFor('windows', 'x64', { withGit: true })- expect(bundleMetadata.bundleTargets('windows', { withGit: true })).toEqual(['node', 'pnpm', 'dsh', 'git'])- expect(withGit.git?.url).toBe(- 'https://github.com/git-for-windows/git/releases/download/v2.53.0.windows.2/MinGit-2.53.0.2-64-bit.zip',- )- expect(withGit.git?.sha256).toBe(constants.mingitX64Sha256)- expect(assetsFor('windows', 'arm64', { withGit: true }).git?.sha256).toBe(constants.mingitArm64Sha256)- // 非 Windows 平台没有 MinGit 可选。- expect(Object.keys(assetsFor('linux', 'x64', { withGit: true })).sort()).toEqual(['dsh', 'node', 'pnpm'])- })-- it('keeps empty sha256 fields in the asset table', () => {- const assets = assetsFor('linux', 'x64')- const rows = bundleMetadata.toAssetTable(assets).split('\n')- expect(rows.map(row => row.split('|')[0])).toEqual(['node', 'pnpm', 'dsh'])- const field = (key: string, index: number) =>- rows.find(row => row.startsWith(`${key}|`))!.split('|')[index]- // 空字段必须如实保留(bash `read` 用 `|` 而不是 TAB 作为分隔符的原因)。- expect(field('node', 3)).toBe('')- expect(field('node', 4)).toBe(assets.node.sha256Url)- expect(field('pnpm', 3)).toBe(constants.pnpmSha256)- expect(field('pnpm', 4)).toBe('')- expect(field('dsh', 3)).toBe('')- expect(field('dsh', 4)).toBe('')- })-})--describe('bundle release resolution', () => {- it('picks the release whose tag parses to the recommended version', () => {- expect(bundleMetadata.findReleaseTag([- { tag_name: 'dsh-0.1.7-rc.1-35871708301' },- { tag_name: DSH_TAG },- ], '0.2.1-rc.2')).toBe(DSH_TAG)- })-- it('fails loudly when no release matches', () => {- expect(() => bundleMetadata.findReleaseTag([], '9.9.9')).toThrow(/^BUNDLE_METADATA:/)- })-- it('resolves the tag through the GitHub releases API', async () => {- const tag = await bundleMetadata.resolveDshTag('0.2.1-rc.2', async () => [- { tag_name: 'dsh-0.1.7-rc.1-35871708301' },- { tag_name: DSH_TAG },- ])- expect(tag).toBe(DSH_TAG)- })-})--describe('bundle build constants', () => {- it('reads the node/pnpm/MinGit pins and the recommended core from the checkout', () => {- const parsed = bundleMetadata.readBuildConstants(process.cwd())- expect(parsed.nodeVersion).toMatch(/^\d+\.\d+\.\d+$/)- expect(parsed.nodeBaseUrl).toMatch(/^https:\/\//)- expect(parsed.pnpmVersion).toMatch(/^\d+\.\d+\.\d+/)- expect(parsed.pnpmSha256).toHaveLength(64)- expect(parsed.mingitX64Sha256).toHaveLength(64)- expect(parsed.dshCoreUrl).toContain('deepseek-harness-pkg')- expect(bundleMetadata.readRecommendedDshVersion(process.cwd())).toBe('0.2.1-rc.2')- expect(bundleMetadata.readManifest(process.cwd())).toMatchObject({ engines: { dsh: { recommend: '0.2.1-rc.2', minimum: '0.1.7-rc.1' } } })- })-})--describe('jsonc stripping', () => {- it('tolerates comments and trailing commas without touching string content', () => {- const raw = `{- // 行注释- "id": "a//b/*c*/",- /* 块注释- 跨行 */- "list": [1, 2,],- }`- expect(JSON.parse(bundleMetadata.stripJsonc(raw))).toEqual({- id: 'a//b/*c*/',- list: [1, 2],- })- })-})--describe('bundle manifest rewrite', () => {- const SHIPPED = `{- // 依赖映射规范- "engines": { "dsh": { "recommend": "0.2.1-rc.2", "minimum": "0.1.7-rc.1" } },- "dependencies": {- "node": { "entry": "node.exe", "managedRoot": "$AppData/runtime", "overridable": true },- "pnpm": { "entry": "bin/pnpm.cjs", "managedRoot": "$AppData/dependencies/pnpm", "overridable": true },- "dsh": { "entry": "node_modules/@deepseek-ai/dsh/lib/bin.js", "managedRoot": "$AppData/dependencies/dsh", "overridable": true },- "git": { "entry": { "windows": "cmd/git.exe", "default": "bin/git" }, "managedRoot": "$AppData/dependencies/git", "overridable": true }- }-}`-- function tempRepo() {- const repo = mkdtempSync(path.join(tmpdir(), 'dsh-bundle-manifest-'))- mkdirSync(path.join(repo, 'src-tauri', 'resources'), { recursive: true })- writeFileSync(path.join(repo, 'src-tauri', 'resources', 'manifest.jsonc'), SHIPPED, 'utf8')- return repo- }-- it('points every bundled dependency at $Resources and disables overrides', () => {- const repo = tempRepo()- try {- const result = bundleMetadata.applyBundleManifest({ repo, platform: 'windows' })- expect(result.applied).toEqual([- 'node -> $Resources/node (overridable: false)',- 'pnpm -> $Resources/pnpm (overridable: false)',- 'dsh -> $Resources/dsh (overridable: true)',- ])-- const manifest = JSON.parse(readFileSync(result.file, 'utf8'))- const shipped = JSON.parse(bundleMetadata.stripJsonc(SHIPPED))- for (const [key, dir] of [['node', 'node'], ['pnpm', 'pnpm'], ['dsh', 'dsh']]) {- expect(manifest.dependencies[key].managedRoot).toBe(`$Resources/${dir}`)- // 内核保持可覆盖:核心面板要能把 dsh 根切到 AppData 里的其它版本再切回来。- expect(manifest.dependencies[key].overridable).toBe(key === 'dsh')- // 入口形状由清单声明,改写托管根不得动它。- expect(manifest.dependencies[key].entry).toEqual(shipped.dependencies[key].entry)- }- expect(manifest.engines.dsh.recommend).toBe('0.2.1-rc.2')- // 未随包的 git 保持清单原值:不能指向并不存在的 `$Resources/git`。- expect(manifest.dependencies.git.managedRoot).toBe('$AppData/dependencies/git')- expect(manifest.dependencies.git.overridable).toBe(true)- }- finally {- rmSync(repo, { recursive: true, force: true })- }- })-- it('moves git to $Resources only when MinGit is bundled', () => {- const repo = tempRepo()- try {- const { file, applied } = bundleMetadata.applyBundleManifest({ repo, platform: 'windows', withGit: true })- expect(applied).toEqual([- 'node -> $Resources/node (overridable: false)',- 'pnpm -> $Resources/pnpm (overridable: false)',- 'dsh -> $Resources/dsh (overridable: true)',- 'git -> $Resources/git (overridable: false)',- ])- const manifest = JSON.parse(readFileSync(file, 'utf8'))- expect(manifest.dependencies.git.managedRoot).toBe('$Resources/git')- expect(manifest.dependencies.git.overridable).toBe(false)- }- finally {- rmSync(repo, { recursive: true, force: true })- }- })-- it('leaves the non-Windows git mapping on app data', () => {- const repo = tempRepo()- try {- const { file, applied } = bundleMetadata.applyBundleManifest({ repo, platform: 'macos' })- expect(applied).toEqual([- 'node -> $Resources/node (overridable: false)',- 'pnpm -> $Resources/pnpm (overridable: false)',- 'dsh -> $Resources/dsh (overridable: true)',- ])- const manifest = JSON.parse(readFileSync(file, 'utf8'))- expect(manifest.dependencies.git.managedRoot).toBe('$AppData/dependencies/git')- expect(manifest.dependencies.git.overridable).toBe(true)- }- finally {- rmSync(repo, { recursive: true, force: true })- }- })-- it('is idempotent and fails loudly on unknown platforms', () => {- const repo = tempRepo()- try {- bundleMetadata.applyBundleManifest({ repo, platform: 'linux' })- const second = bundleMetadata.applyBundleManifest({ repo, platform: 'linux' })- expect(second.applied).toEqual([- 'node -> $Resources/node (overridable: false)',- 'pnpm -> $Resources/pnpm (overridable: false)',- 'dsh -> $Resources/dsh (overridable: true)',- ])- expect(() => bundleMetadata.applyBundleManifest({ repo, platform: 'freebsd' as BundlePlatform }))- .toThrow(/^BUNDLE_METADATA:/)- }- finally {- rmSync(repo, { recursive: true, force: true })- }- })-})diff --git a/test/plugin-presets.test.ts b/test/plugin-presets.test.tsdeleted file mode 100644index 10be28a4..00000000--- a/test/plugin-presets.test.ts+++ /dev/null@@ -1,98 +0,0 @@-import { readFileSync } from 'node:fs'-import { describe, expect, it } from 'vitest'-import { stripJsonc } from '../scripts/bundle-metadata.mjs'--const manifest = JSON.parse(stripJsonc(- readFileSync(new URL('../src-tauri/resources/manifest.jsonc', import.meta.url), 'utf8'),-)) as { plugins: { 'preset': { id: string }[], 'built-in': { id: string }[], 'depercated': string[] } }--const presets = manifest.plugins.preset--describe('community plugin presets', () => {- it('removes DSH Bridge from install presets without marking existing installs for removal', () => {- expect(presets.map(plugin => plugin.id)).not.toContain('@wenbin_wb/dsh-bridge')- expect(manifest.plugins['built-in'].map(plugin => plugin.id)).not.toContain('@wenbin_wb/dsh-bridge')- expect(manifest.plugins.depercated).not.toContain('@wenbin_wb/dsh-bridge')- })-- it('keeps DSH IM optional without the recommended badge', () => {- expect(presets.filter(plugin => plugin.id === '@xmanrui/dsh-im')).toMatchObject([- { spec: '@xmanrui/dsh-im', recommended: false, checked: false },- ])- })-- it('recommends Office Kit without preselecting it immediately before DSH Market', () => {- expect(presets.filter(plugin => plugin.id === 'dsh-office-kit')).toEqual([- {- id: 'dsh-office-kit',- spec: 'dsh-office-kit',- name: 'DSH Office Kit',- description: 'Office documents, PDF, presentations, and spreadsheets for DeepSeek Harness',- repo: 'https://github.com/hairyf/dsh-office-kit',- recommended: true,- checked: false,- version: 'latest',- },- ])- const ids = presets.map(plugin => plugin.id)- expect(ids[ids.indexOf('dsh-office-kit') + 1]).toBe('dshmarket')- })-- it('recommends DSH OPS without preselecting it immediately before DSH GenUI', () => {- expect(presets.filter(plugin => plugin.id === 'dsh-ops')).toMatchObject([- {- spec: 'dsh-ops',- name: 'DSH OPS',- repo: 'https://github.com/T-Auto/dsh-ops',- recommended: true,- checked: false,- version: 'latest',- },- ])- const ids = presets.map(plugin => plugin.id)- expect(ids[ids.indexOf('dsh-ops') + 1]).toBe('@changfenhuang/dsh-genui')- })-- it.each([- ['@changfenhuang/dsh-genui', /^交互式界面插件/],- ['dsh-context', /^一站式 DeepSeek Harness 上下文可视化插件/],- ['billion-context', /^基本稳定可用。上下文压缩插件/],- ])('%s leads its description with Chinese', (id, prefix) => {- expect(presets.filter(plugin => plugin.id === id)).toMatchObject([- { description: expect.stringMatching(prefix) },- ])- })-- it('keeps DSH Market unselected and ordered after Billion Context', () => {- const ids = presets.map(plugin => plugin.id)- expect(ids.indexOf('dshmarket')).toBeGreaterThan(ids.indexOf('billion-context'))- expect(presets.filter(plugin => plugin.id === 'dshmarket')).toMatchObject([- { spec: 'dshmarket', recommended: false, checked: false },- ])- })-- it.each([- {- id: '@changfenhuang/dsh-genui',- spec: '@changfenhuang/dsh-genui',- name: 'DSH GenUI',- description: '交互式界面插件,通过 dsh-ui 代码块在助手回复中直接呈现布局、图表、绘图、表单、测验、Mermaid 和 3D 场景,并将交互事件回传模型。内含宿主插件、浏览器渲染器和 genui 技能。 | GenUI for DeepSeek Harness: interactive UI components rendered inline in assistant replies via the dsh-ui fence — layout, charts, plots, forms, quizzes, mermaid, 3D scenes, and an action event loop back to the model. Ships the fence-teaching host plugin, the browser renderer (client half), and the genui skill.',- repo: 'https://github.com/omdsh-dev/dsh-genui',- recommended: false,- checked: false,- version: 'latest',- },- {- id: 'dsh-context',- spec: 'dsh-context',- name: 'DSH Context',- description: '一站式 DeepSeek Harness 上下文可视化插件,Context 面板及浏览器和侧边栏与 Context 命令,透视上下文组成、演进、压缩、剪枝等事件与动作。 | The best DeepSeek Harness plugin for context insight and management, with context dashboard / browser / sidebar and context command, for context statistics, composition, breakdown, evolution details, understanding how the context is made of, and how it evolves.',- repo: 'https://github.com/bowenliang123/dsh-context',- recommended: false,- checked: false,- version: 'latest',- },- ])('lists $id once as an optional preset with its Chinese-first bilingual description', (expected) => {- expect(presets.filter(plugin => plugin.id === expected.id)).toEqual([expected])- })-})diff --git a/test/preset-pet-description.test.ts b/test/preset-pet-description.test.tsdeleted file mode 100644index d5cd8f1b..00000000--- a/test/preset-pet-description.test.ts+++ /dev/null@@ -1,36 +0,0 @@-import { readFileSync } from 'node:fs'-import { describe, expect, it } from 'vitest'--describe('built-in pet descriptions', () => {- it('ships Maid DeepSeek Sticker with pinned preview, config and platform video URLs', () => {- const source = readFileSync(new URL('../src-tauri/resources/manifest.jsonc', import.meta.url), 'utf8')- const manifest = JSON.parse(source.replace(/^\s*\/\/.*$/gm, '')) as {- pets: { 'built-in': { id: string }[] }- }- const pets = manifest.pets['built-in']- const base = 'https://raw.githubusercontent.com/hairyf/dsh-pet-sticker/6634e0de9cace37ac6b747a960c833209ad015a3'-- expect(pets.filter(entry => entry.id === 'dsh-chan-sticker-pet')).toEqual([{- id: 'dsh-chan-sticker-pet',- name: 'Maid DeepSeek Sticker',- desc: '157 个贴纸动作与透明待机动画。',- image: `${base}/preview/preview.gif`,- kind: 'dsh',- size: 220,- config: `${base}/config.jsonc`,- uri: { default: `${base}/webm`, mac: `${base}/mov` },- ext: { default: 'webm', mac: 'mov' },- }])- expect(pets[0].id).toBe('maid-deepseek-whale')- })-- it('describes Maid DeepSeek Whale with the approved Chinese copy', () => {- const source = readFileSync(new URL('../src-tauri/resources/manifest.jsonc', import.meta.url), 'utf8')- const manifest = JSON.parse(source.replace(/^\s*\/\/.*$/gm, '')) as {- pets: { 'built-in': { id: string, desc?: string }[] }- }- const pet = manifest.pets['built-in'].find(entry => entry.id === 'maid-deepseek-whale')-- expect(pet?.desc).toBe('一只小小的迷你蓝头发的鲸鱼女仆,穿着海军蓝裙子,白色褶边,蓝眼睛,侧鳍和鲸鱼尾巴。')- })-})