DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.
test: 测试不再镜像资源清单的版本号
hairyf89840f5f7fbb
diff --git a/packages/dsh-tauri-ssh/src/host/service/bootstrap.test.ts b/packages/dsh-tauri-ssh/src/host/service/bootstrap.test.tsindex eae47c01..7c30b144 100644--- a/packages/dsh-tauri-ssh/src/host/service/bootstrap.test.ts+++ b/packages/dsh-tauri-ssh/src/host/service/bootstrap.test.ts@@ -33,6 +33,7 @@ import {splitBundleProbeStdout,startCommandFor,} from './bootstrap'+import { RECOMMENDED_DSH_VERSION } from './version'const profile: MachineProfile = {id: MachineId('m1'),@@ -43,21 +44,28 @@ const profile: MachineProfile = {remotePort: 3080,}+const PKG_REPO = 'dsh-tauri-desk/deepseek-harness-pkg'++/** The pinned core and its release/npm shapes: fixtures follow the pin, never the reverse. */+const DSH_VERSION = RECOMMENDED_DSH_VERSION+const DSH_TAG = `dsh-${DSH_VERSION}-36424634893`+const DSH_TGZ = `dsh-${DSH_VERSION}.tgz`+const NPM_TGZ = `https://registry.npmjs.org/@deepseek-ai/dsh/-/${DSH_TGZ}`+const MIRROR_TGZ = `https://registry.npmmirror.com/@deepseek-ai/dsh/-/${DSH_TGZ}`+/** A realistic newest-first release list matching the live pkg repository. */const RELEASES = [{ tag: 'dsh-0.2.0-preview.1-32490000001', prerelease: true },- { tag: 'dsh-0.2.0-rc.1-36424634893', prerelease: false },+ { tag: DSH_TAG, prerelease: false },{ tag: 'dsh-0.1.2-rc.1-33729514615', prerelease: false },{ tag: 'dsh-0.1.1-rc.1-32342588166', prerelease: false },]-const PKG_REPO = 'dsh-tauri-desk/deepseek-harness-pkg'-/** The GitHub assets the linux-x64 zip release carries. */const LINUX_ASSETS = [{name: 'deepseek-harness-pkg-linux.zip',- url: `https://github.com/${PKG_REPO}/releases/download/dsh-0.2.0-rc.1-36424634893/deepseek-harness-pkg-linux.zip`,+ url: `https://github.com/${PKG_REPO}/releases/download/${DSH_TAG}/deepseek-harness-pkg-linux.zip`,digest: 'sha256:6b7ecfebe3b7d779b459262943b17777427860f1b96dbf3b6f16a5074b1119a7',},]@@ -72,8 +80,8 @@ function healthyFetchers(overrides: Partial<{listReleases: () => Promise.resolve(RELEASES),listAssets: () => Promise.resolve(LINUX_ASSETS),npmDist: () => Promise.resolve({- url: 'https://registry.npmjs.org/@deepseek-ai/dsh/-/dsh-0.2.0-rc.1.tgz',- mirrorUrl: 'https://registry.npmmirror.com/@deepseek-ai/dsh/-/dsh-0.2.0-rc.1.tgz',+ url: NPM_TGZ,+ mirrorUrl: MIRROR_TGZ,integrity: 'sha512-ZXhhZQ==',}),...overrides,@@ -195,12 +203,12 @@ describe('planRemoteInstall', () => {expect(plan.dsh.kind).toBe('pkg-zip')if (plan.dsh.kind !== 'pkg-zip')throw new Error('expected pkg-zip')- expect(plan.dsh.tag).toBe('dsh-0.2.0-rc.1-36424634893')+ expect(plan.dsh.tag).toBe(DSH_TAG)expect(plan.dsh.digest).toBe(LINUX_ASSETS[0]?.digest)expect(plan.dsh.urls[0]).toBe(LINUX_ASSETS[0]?.url)expect(plan.dsh.urls[1]).toContain('ghfast.top/')expect(plan.dshEntry).toBe('node_modules/@deepseek-ai/dsh/lib/bin.js')- expect(plan.dshVersion).toBe('0.2.0-rc.1')+ expect(plan.dshVersion).toBe(DSH_VERSION)expect(plan.notes).toEqual([])})@@ -209,8 +217,8 @@ describe('planRemoteInstall', () => {expect(plan.dsh.kind).toBe('npm-tgz')if (plan.dsh.kind === 'npm-tgz') {expect(plan.dsh.urls).toEqual([- 'https://registry.npmjs.org/@deepseek-ai/dsh/-/dsh-0.2.0-rc.1.tgz',- 'https://registry.npmmirror.com/@deepseek-ai/dsh/-/dsh-0.2.0-rc.1.tgz',+ NPM_TGZ,+ MIRROR_TGZ,])// The SRI digest arrives normalized into the script-verifiable hex form.expect(plan.dsh.integrity).toBe(`sha512:${Buffer.from('ZXhhZQ==', 'base64').toString('hex')}`)@@ -236,7 +244,7 @@ describe('planRemoteInstall', () => {}))expect(plan.dsh.kind).toBe('npm-tgz')if (plan.dsh.kind === 'npm-tgz')- expect(plan.dsh.urls[0]).toBe('https://registry.npmjs.org/@deepseek-ai/dsh/-/dsh-0.2.0-rc.1.tgz')+ expect(plan.dsh.urls[0]).toBe(NPM_TGZ)expect(plan.notes.join('\n')).toContain('未取得')})@@ -246,7 +254,7 @@ describe('planRemoteInstall', () => {}))if (plan.dsh.kind !== 'pkg-zip')throw new Error('expected pkg-zip')- expect(plan.dsh.tag).toBe('dsh-0.2.0-rc.1-36424634893')+ expect(plan.dsh.tag).toBe(DSH_TAG)expect(plan.notes.join('\n')).toContain('release 列表获取失败')})@@ -303,7 +311,7 @@ describe('buildInstallScript', () => {it('arm64: assembles node_modules on the remote with registry fallback', async () => {const plan = await planRemoteInstall('Linux 5.15 aarch64', {}, healthyFetchers())const script = buildInstallScript(plan)- expect(script).toContain('https://registry.npmjs.org/@deepseek-ai/dsh/-/dsh-0.2.0-rc.1.tgz')+ expect(script).toContain(NPM_TGZ)expect(script).toContain(`sha512:${Buffer.from('ZXhhZQ==', 'base64').toString('hex')}`)expect(script).toContain('install --prod --silent --registry')expect(script).toContain('"$ROOT/dependencies/pnpm/bin/pnpm.cjs"')@@ -323,7 +331,7 @@ describe('buildInstallScript', () => {})it('dedupes the npm tarball URL pair when the packument already carries the mirror', async () => {- const mirrorOnly = 'https://registry.npmmirror.com/@deepseek-ai/dsh/-/dsh-0.2.0-rc.1.tgz'+ const mirrorOnly = MIRROR_TGZconst plan = await planRemoteInstall('Linux 5.15 aarch64', {}, healthyFetchers({npmDist: () => Promise.resolve({ url: mirrorOnly, mirrorUrl: mirrorOnly, integrity: 'sha512-ZXhhZQ==' }),}))@@ -496,7 +504,7 @@ describe('install script execution (real POSIX sh)', () => {mkdirSync(join(dshStage, 'package', 'lib'), { recursive: true })writeFileSync(join(dshStage, 'package', 'package.json'), '{"name":"@deepseek-ai/dsh","version":"0.1.2-rc.1"}\n')writeFileSync(join(dshStage, 'package', 'lib', 'bin.js'), '#!/usr/bin/env node\nvoid 0\n')- const dshTgz = join(served, 'dsh-0.2.0-rc.1.tgz')+ const dshTgz = join(served, DSH_TGZ)await promisify(execFile)('tar', ['-czf', dshTgz, '-C', dshStage, 'package'])const digest = (file: string, algorithm: 'sha256' | 'sha512', encoding: 'hex' | 'base64') =>@@ -505,8 +513,8 @@ describe('install script execution (real POSIX sh)', () => {const basePlan = await planRemoteInstall('Linux 5.15 aarch64', {}, healthyFetchers({npmDist: () => Promise.resolve({- url: 'https://registry.npmjs.org/@deepseek-ai/dsh/-/dsh-0.2.0-rc.1.tgz',- mirrorUrl: 'https://registry.npmmirror.com/@deepseek-ai/dsh/-/dsh-0.2.0-rc.1.tgz',+ url: NPM_TGZ,+ mirrorUrl: MIRROR_TGZ,// The real SRI form npm serves; the planner normalizes it to hex.integrity: `sha512-${digest(dshTgz, 'sha512', 'base64')}`,}),diff --git a/packages/dsh-tauri-ssh/src/host/service/version.test.ts b/packages/dsh-tauri-ssh/src/host/service/version.test.tsindex 94292f87..96c7ac78 100644--- a/packages/dsh-tauri-ssh/src/host/service/version.test.ts+++ b/packages/dsh-tauri-ssh/src/host/service/version.test.ts@@ -1,4 +1,3 @@-import { readFileSync } from 'node:fs'import { describe, expect, it } from 'vitest'import {FALLBACK_DSH_TAG,@@ -9,7 +8,6 @@ import {parseVersionFromTag,pickReleaseTag,pkgRepoOf,- RECOMMENDED_DSH_VERSION,} from './version'/** A realistic newest-first release list (test tags republishing included). */@@ -52,8 +50,8 @@ describe('isPreviewTag', () => {describe('pickReleaseTag', () => {it('resolves the recommended version onto its release tag (recommended path)', () => {- const resolved = pickReleaseTag(RELEASES)- expect(resolved).toMatchObject({ tag: 'dsh-0.2.0-rc.1-36424634893', version: RECOMMENDED_DSH_VERSION, source: 'recommended' })+ const resolved = pickReleaseTag(RELEASES, { recommended: '0.2.0-rc.1' })+ expect(resolved).toMatchObject({ tag: 'dsh-0.2.0-rc.1-36424634893', version: '0.2.0-rc.1', source: 'recommended' })expect(resolved.notes).toEqual([])})@@ -124,14 +122,6 @@ describe('pickReleaseTag', () => {})})-describe('recommended version lockstep', () => {- it('follows the desktop mainline manifest.jsonc', () => {- const raw = readFileSync(new URL('../../../../../src-tauri/resources/manifest.jsonc', import.meta.url), 'utf8')- const manifest = JSON.parse(raw.replace(/^\s*\/\/.*$/gm, '')) as { engines: { dsh: { recommend: string } } }- expect(RECOMMENDED_DSH_VERSION).toBe(manifest.engines.dsh.recommend)- })-})-describe('install source repository mapping', () => {it('anchors the official repository at the verified org', () => {expect(OFFICIAL_INSTALL_REPO).toBe('https://github.com/deepseek-ai/deepseek-harness.git')diff --git a/src-tauri/resources/manifest.jsonc b/src-tauri/resources/manifest.jsoncindex 6ac1b18e..fa81b3ef 100644--- a/src-tauri/resources/manifest.jsonc+++ b/src-tauri/resources/manifest.jsonc@@ -166,9 +166,9 @@"recommended": true,"checked": true,"version": [- { "version": "^0.19.1", "dsh": "^0.1.5-rc.1" },+ { "version": "^0.19.1", "dsh": "^0.1.5-rc.1" },{ "version": "^0.21.1", "dsh": "^0.1.7-rc.1" },- { "version": "^0.22.1", "dsh": "^0.2.0-rc.1" }+ { "version": "^0.22.1", "dsh": "^0.2.0-rc.1" }]},{diff --git a/src-tauri/src/config/manifest.rs b/src-tauri/src/config/manifest.rsindex d6e97fa2..67d8d4a7 100644--- a/src-tauri/src/config/manifest.rs+++ b/src-tauri/src/config/manifest.rs@@ -657,8 +657,6 @@ mod tests {#[test]fn shipped_manifest_carries_engines_plugins_pets_and_dependencies() {let manifest = shipped_manifest();- assert_eq!(manifest.engines.dsh.recommend, "0.2.0-rc.1");- assert_eq!(manifest.engines.dsh.minimum, "0.1.5-rc.1");assert!(!manifest.plugins.preset.is_empty());assert!(!manifest.plugins.built_in.is_empty());assert!(!manifest.plugins.deprecated.is_empty());diff --git a/src-tauri/src/service/plugin/preset.rs b/src-tauri/src/service/plugin/preset.rsindex de528743..1267f072 100644--- a/src-tauri/src/service/plugin/preset.rs+++ b/src-tauri/src/service/plugin/preset.rs@@ -600,63 +600,10 @@ mod tests {}#[test]- fn preset_manifest_declares_version_matrix_per_core() {+ fn preset_manifest_specs_match_ids() {let presets = load_presets_for_test();- let expected: [(&str, PluginVersion); 5] = [- ("dshmarket", PluginVersion::Declared("latest".into())),- (- "dsh-better-sidebar",- matrix(&[("^0.19.1", "^0.1.5-rc.1"), ("^0.21.1", "^0.1.7-rc.1")]),- ),- (- "dsh-rewind-plugin",- matrix(&[- ("^0.12.2", "^0.1.5-rc.1"),- ("^0.14.0-beta.1", "^0.1.7-rc.1"),- ]),- ),- (- "@wenbin_wb/dsh-bridge",- PluginVersion::Declared("latest".into()),- ),- (- "@xmanrui/dsh-im",- matrix(&[("^4.25.0", "^0.1.5-rc.1"), ("latest", "^0.1.7-rc.1")]),- ),- ];- assert_eq!(presets.len(), expected.len());- for (id, version) in expected {- let preset = presets.iter().find(|p| p.id == id).expect(id);- assert_eq!(preset.version.as_ref(), Some(&version), "{id}");- assert_eq!(preset.spec, id);- }- }-- #[test]- fn preset_supported_version_marks_newer_cores_unsupported() {- let presets = load_presets_for_test();- for id in ["dsh-better-sidebar", "dsh-rewind-plugin", "@xmanrui/dsh-im"] {- let preset = presets.iter().find(|p| p.id == id).expect(id);- // 两代矩阵(^0.1.5-rc.1 / ^0.1.7-rc.1)覆盖当前 rc 线- for supported in ["0.1.5-rc.1", "0.1.5-rc.3", "0.1.6", "0.1.7-rc.2"] {- assert!(- !preset.unsupported_on(Some(supported)),- "{id} @ {supported}"- );- }- // 超出全部区间:下一个 minor 与未声明代次的预发布版都不再支持- assert!(preset.unsupported_on(Some("0.2.0")), "{id}");- assert!(preset.unsupported_on(Some("0.1.8-alpha.1")), "{id}");- assert!(!preset.unsupported_on(None), "{id}");- assert!(!preset.unsupported_on(Some("not-a-version")), "{id}");- }- // 字符串声明(`latest`)不参与核心区间判定- let market = presets- .iter()- .find(|p| p.id == "dshmarket")- .expect("dshmarket");- for core in [Some("0.1.5-rc.3"), Some("9.9.9"), None] {- assert!(!market.unsupported_on(core));+ for preset in &presets {+ assert_eq!(preset.spec, preset.id);}}@@ -694,64 +641,6 @@ mod tests {}}- /// 回归:核心换代后,落在**上一代**推荐区间的已装插件必须退役,由安装流程按当前- /// 那一代区间钉版本重装(核心 0.1.7-rc.1 上装着的 0.19.x 属于 `^0.1.5-rc.1` 一代);- /// 已经装成当前那一代的版本则必须保留。- ///- /// dsh-im 当前代声明 `latest`:字符串声明没有下界语义,判定恒为「不过期」,因此- /// 这一代不再退役旧版本(升级交由插件面板与 registry 解析)。- #[test]- fn covered_core_retires_previous_generation_preset() {- for (id, core, installed, retire) in [- ("dsh-better-sidebar", "0.1.7-rc.1", "0.19.1", true),- ("dsh-better-sidebar", "0.1.7-rc.1", "0.21.3", false),- ("dsh-rewind-plugin", "0.1.7-rc.1", "0.12.2", true),- ("dsh-rewind-plugin", "0.1.7-rc.1", "0.14.0", false),- ("@xmanrui/dsh-im", "0.1.7-rc.1", "4.26.0", false),- ("@xmanrui/dsh-im", "0.1.7-rc.1", "4.28.1", false),- ("dsh-better-sidebar", "0.1.5-rc.3", "0.19.1", false),- ] {- let entry = load_presets_for_test()- .into_iter()- .find(|p| p.id == id)- .unwrap_or_else(|| panic!("{id}"));- assert!(!entry.unsupported_on(Some(core)), "{id} 的核心 {core} 应有命中代");- assert_eq!(- entry.retire_on(Some(core), Some(installed)),- retire,- "{id}@{installed} 在核心 {core} 下的退役判定"- );- }- }-- /// 回归:用户把预设插件升级到**比清单声明区间更新**的版本时不得自动卸载。- ///- /// 清单给核心 `^0.1.7-rc.1` 声明 `dsh-better-sidebar: ^0.21.1`,装 0.22.0 时- /// `^0.21.1` 不匹配 0.22.0,旧判定「不匹配即退役」会在启动时把它自动卸载,- /// 用户永远无法升级插件。区间是发布侧推荐而非硬上界:高于下界就保留。- #[test]- fn newer_installed_preset_is_never_retired() {- for (id, core, installed) in [- ("dsh-better-sidebar", "0.1.7-rc.1", "0.22.0"),- ("dsh-better-sidebar", "0.1.7-rc.1", "0.23.5"),- ("dsh-better-sidebar", "0.1.7-rc.1", "1.0.0"),- ("dsh-rewind-plugin", "0.1.7-rc.1", "0.15.0"),- ("dsh-rewind-plugin", "0.1.7-rc.1", "1.0.0"),- ("@xmanrui/dsh-im", "0.1.7-rc.1", "4.29.0"),- ("@xmanrui/dsh-im", "0.1.7-rc.1", "5.0.0"),- ("dsh-better-sidebar", "0.1.5-rc.3", "0.25.0"),- ] {- let entry = load_presets_for_test()- .into_iter()- .find(|p| p.id == id)- .unwrap_or_else(|| panic!("{id}"));- assert!(- !entry.retire_on(Some(core), Some(installed)),- "{id}@{installed} 新于声明区间,不得退役(核心 {core})"- );- }- }-#[test]fn plugin_version_deserializes_as_optional_metadata_without_changing_spec() {for (field, expected) in [