@dsh-workbench/shared 1.5.2-alpha.5 → 1.5.2-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/contract/needs.d.ts +3 -1
  2. package/dist/contract/needs.js +4 -2
  3. package/dist/contract/protocol/bundle-install.d.ts +1 -1
  4. package/dist/contract/unit.js +2 -1
  5. package/dist/host/runtime/dsh-compat.d.ts +4 -0
  6. package/dist/host/runtime/dsh-compat.js +32 -16
  7. package/dist/host/runtime/verified-dsh.d.ts +5 -0
  8. package/dist/host/runtime/verified-dsh.js +20 -0
  9. package/dist/host/supply/builtin-catalog.d.ts +3 -0
  10. package/dist/host/supply/builtin-catalog.js +38 -0
  11. package/dist/host/supply/preflight.d.ts +14 -1
  12. package/dist/host/supply/supply-index.js +6 -0
  13. package/dist/host.d.ts +2 -0
  14. package/dist/host.js +2 -0
  15. package/dist/i18n/en.js +14 -3
  16. package/dist/i18n/index.d.ts +15 -4
  17. package/dist/i18n/zh.d.ts +14 -3
  18. package/dist/i18n/zh.js +14 -3
  19. package/dist/lib/bundle-requirements.d.ts +1 -0
  20. package/dist/lib/bundle-requirements.js +9 -0
  21. package/dist/lib/dsh-client.d.ts +1 -1
  22. package/package.json +47 -51
  23. package/src/contract/__tests__/unit.test.ts +7 -0
  24. package/src/contract/needs.ts +5 -3
  25. package/src/contract/protocol/bundle-install.ts +1 -0
  26. package/src/contract/unit.ts +2 -1
  27. package/src/host/runtime/__tests__/dsh-compat.test.ts +19 -1
  28. package/src/host/runtime/__tests__/verified-dsh.test.ts +55 -0
  29. package/src/host/runtime/dsh-compat.ts +36 -12
  30. package/src/host/runtime/verified-dsh.ts +22 -0
  31. package/src/host/supply/__tests__/builtin-catalog.test.ts +44 -0
  32. package/src/host/supply/builtin-catalog.ts +38 -0
  33. package/src/host/supply/preflight.ts +16 -1
  34. package/src/host/supply/supply-index.ts +3 -0
  35. package/src/host.ts +2 -0
  36. package/src/i18n/en.ts +17 -3
  37. package/src/i18n/zh.ts +16 -3
  38. package/src/lib/bundle-requirements.ts +11 -0
  39. package/src/lib/dsh-client.ts +1 -2
@@ -127,7 +127,8 @@ export function needsOf(manifest: UnitManifest): readonly Need[] {
127
127
  export function provisionableNeedsOf(manifest: UnitManifest): readonly (ExtensionNeed | LibNeed)[] {
128
128
  return needsOf(manifest).filter(
129
129
  (need): need is ExtensionNeed | LibNeed =>
130
- (need.kind === 'extension' || need.kind === 'lib') && (need.sources ?? []).length > 0,
130
+ (need.kind === 'extension' || need.kind === 'lib') &&
131
+ (need.sources ?? []).some((source) => source.kind !== 'builtin'),
131
132
  );
132
133
  }
133
134
 
@@ -2,7 +2,7 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
2
2
  import { tmpdir } from 'node:os';
3
3
  import { join, dirname } from 'node:path';
4
4
  import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
5
- import { dshCompatibilityOf, dshRequirementsOf, dshVersionIn } from '../dsh-compat.js';
5
+ import { dshCompatibilityOf, dshRequirementsOf, dshVersionFrom, dshVersionIn } from '../dsh-compat.js';
6
6
 
7
7
  const ROOT = mkdtempSync(join(tmpdir(), 'dsh-wb-dsh-compat-'));
8
8
 
@@ -111,6 +111,24 @@ describe('dsh 版本从 profile 的安装锚点读', () => {
111
111
  expect(dshVersionIn(anchored)).toBe('0.2.2-rc.2');
112
112
  });
113
113
 
114
+ it('★ 顺带说清这个版本是从哪读到的(排障要看得出原文)', () => {
115
+ const dir = profileWith({
116
+ 'node_modules/@deepseek-ai/dsh/package.json': { name: '@deepseek-ai/dsh', version: '0.2.2-rc.5' },
117
+ });
118
+ const found = dshVersionFrom(dir);
119
+ expect(found?.version).toBe('0.2.2-rc.5');
120
+ expect(found?.from).toBe(join(dir, 'node_modules/@deepseek-ai/dsh/package.json'));
121
+
122
+ const anchored = profileWith({
123
+ 'node_modules/@deepseek-ai/dsh-app-boot/package.json': {
124
+ name: '@deepseek-ai/dsh-app-boot',
125
+ version: '0.2.2-rc.2',
126
+ dependencies: { '@deepseek-ai/dsh': '0.2.2-rc.2' },
127
+ },
128
+ });
129
+ expect(dshVersionFrom(anchored)?.from).toContain('@deepseek-ai/dsh-app-boot');
130
+ });
131
+
114
132
  it('只有 dsh 清单时读它自己的版本;都读不到就是 undefined', () => {
115
133
  const dir = profileWith({
116
134
  'node_modules/@deepseek-ai/dsh/package.json': { name: '@deepseek-ai/dsh', version: '0.2.2-rc.1' },
@@ -0,0 +1,55 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { VERIFIED_DSH, dshHostGapOf, dshTierOf } from '../verified-dsh.js';
3
+
4
+ describe('运行中的 dsh 与验证过的 dsh 分档', () => {
5
+ it('同代(major.minor 相同)不打扰:补丁版与预发布版都算已验证', () => {
6
+ expect(dshTierOf('0.2.3', '0.2.3-alpha.2')).toBe('ok');
7
+ expect(dshTierOf('0.2.5-rc.1', '0.2.3-alpha.2')).toBe('ok');
8
+ expect(dshTierOf('0.2.3-alpha.2', '0.2.3-alpha.2')).toBe('ok');
9
+ });
10
+
11
+ it('跨代才算未验证', () => {
12
+ expect(dshTierOf('0.3.0-rc.1', '0.2.3-alpha.2')).toBe('newer');
13
+ expect(dshTierOf('1.0.0', '0.2.3-alpha.2')).toBe('newer');
14
+ });
15
+
16
+ it('低于下限算版本过低,预发布边界不漏', () => {
17
+ expect(dshTierOf('0.2.3-alpha.1', '0.2.3-alpha.2')).toBe('older');
18
+ expect(dshTierOf('0.2.2-rc.5', '0.2.3-alpha.2')).toBe('older');
19
+ });
20
+
21
+ it('读不到或读不懂就当不知道,不猜', () => {
22
+ expect(dshTierOf(undefined)).toBe('unknown');
23
+ expect(dshTierOf('')).toBe('unknown');
24
+ expect(dshTierOf('garbage')).toBe('unknown');
25
+ expect(dshTierOf('0.2.3', 'garbage')).toBe('unknown');
26
+ });
27
+
28
+ it('★ 缺省以常量为准:它必须和 engines.dsh 一致(由自动检查钉住)', () => {
29
+ expect(VERIFIED_DSH).toBe('0.2.2-rc.2');
30
+ expect(dshTierOf('0.2.3')).toBe('ok');
31
+ });
32
+ });
33
+
34
+ describe('给启动检查的缺口对象', () => {
35
+ it('同代 / 不知道都不出缺口', () => {
36
+ expect(dshHostGapOf('0.2.3', '0.2.3-alpha.2')).toBeUndefined();
37
+ expect(dshHostGapOf(undefined)).toBeUndefined();
38
+ });
39
+
40
+ it('★ 跨代出缺口,带运行版本与验证版本,不带命令(命令由调用方补一处真相)', () => {
41
+ expect(dshHostGapOf('0.3.0-rc.1', '0.2.3-alpha.2')).toEqual({
42
+ tier: 'newer',
43
+ runtime: '0.3.0-rc.1',
44
+ verified: '0.2.3-alpha.2',
45
+ });
46
+ });
47
+
48
+ it('版本过低出缺口,版本号原样不改写', () => {
49
+ expect(dshHostGapOf(' 0.2.2-rc.5 ', '0.2.3-alpha.2')).toEqual({
50
+ tier: 'older',
51
+ runtime: '0.2.2-rc.5',
52
+ verified: '0.2.3-alpha.2',
53
+ });
54
+ });
55
+ });
@@ -70,18 +70,42 @@ export function dshCompatibilityOf(input: {
70
70
  }
71
71
 
72
72
  export function dshVersionIn(profileDir: string): string | undefined {
73
- const fromClient = process.env['DSH_CLIENT_VERSION'];
74
- if (typeof fromClient === 'string' && semver.valid(fromClient.trim()) !== null) return fromClient.trim();
75
- for (const dir of searchDirsOf(profileDir)) {
76
- const own = readManifest(join(dir, 'node_modules', '@deepseek-ai', 'dsh', 'package.json'))?.['version'];
77
- if (typeof own === 'string' && semver.valid(own) !== null) return own;
78
- }
79
- const fromEnv = process.env['DSH_VERSION'];
80
- if (typeof fromEnv === 'string' && semver.valid(fromEnv.trim()) !== null) return fromEnv.trim();
81
- for (const dir of searchDirsOf(profileDir)) {
82
- const anchor = readManifest(join(dir, 'node_modules', '@deepseek-ai', 'dsh-app-boot', 'package.json'));
83
- const version = dependencyVersionOf(anchor, '@deepseek-ai/dsh');
84
- if (version !== undefined) return version;
73
+ return dshVersionFrom(profileDir)?.version;
74
+ }
75
+
76
+ export function dshVersionFrom(
77
+ profileDir: string,
78
+ ): { readonly version: string; readonly from: string } | undefined {
79
+ const fromClient = envVersionOf('DSH_CLIENT_VERSION');
80
+ if (fromClient !== undefined) return { version: fromClient, from: 'DSH_CLIENT_VERSION' };
81
+
82
+ const dirs = searchDirsOf(profileDir);
83
+ const installed = firstOver(dirs, (dir) => {
84
+ const file = join(dir, 'node_modules', '@deepseek-ai', 'dsh', 'package.json');
85
+ const own = readManifest(file)?.['version'];
86
+ return typeof own === 'string' && semver.valid(own) !== null ? { version: own, from: file } : undefined;
87
+ });
88
+ if (installed !== undefined) return installed;
89
+
90
+ const fromEnv = envVersionOf('DSH_VERSION');
91
+ if (fromEnv !== undefined) return { version: fromEnv, from: 'DSH_VERSION' };
92
+
93
+ return firstOver(dirs, (dir) => {
94
+ const file = join(dir, 'node_modules', '@deepseek-ai', 'dsh-app-boot', 'package.json');
95
+ const version = dependencyVersionOf(readManifest(file), '@deepseek-ai/dsh');
96
+ return version === undefined ? undefined : { version, from: `${file} → @deepseek-ai/dsh` };
97
+ });
98
+ }
99
+
100
+ function envVersionOf(name: string): string | undefined {
101
+ const raw = process.env[name];
102
+ return typeof raw === 'string' && semver.valid(raw.trim()) !== null ? raw.trim() : undefined;
103
+ }
104
+
105
+ function firstOver<T>(dirs: readonly string[], read: (dir: string) => T | undefined): T | undefined {
106
+ for (const dir of dirs) {
107
+ const got = read(dir);
108
+ if (got !== undefined) return got;
85
109
  }
86
110
  return undefined;
87
111
  }
@@ -0,0 +1,22 @@
1
+ import semver from 'semver';
2
+ import type { PreflightHostGap } from '../supply/preflight.js';
3
+
4
+ export const VERIFIED_DSH = '0.2.2-rc.2';
5
+
6
+ export type DshTier = 'ok' | 'newer' | 'older' | 'unknown';
7
+
8
+ export function dshTierOf(runtime: string | undefined, verified: string = VERIFIED_DSH): DshTier {
9
+ const got = runtime?.trim() ?? '';
10
+ if (semver.valid(got) === null || semver.valid(verified) === null) return 'unknown';
11
+ if (semver.lt(got, verified)) return 'older';
12
+ const have = semver.parse(got);
13
+ const want = semver.parse(verified);
14
+ if (have === null || want === null) return 'unknown';
15
+ return have.major === want.major && have.minor === want.minor ? 'ok' : 'newer';
16
+ }
17
+
18
+ export function dshHostGapOf(runtime: string | undefined, verified: string = VERIFIED_DSH): PreflightHostGap | undefined {
19
+ const tier = dshTierOf(runtime, verified);
20
+ if (tier !== 'newer' && tier !== 'older') return undefined;
21
+ return { tier, runtime: (runtime ?? '').trim(), verified };
22
+ }
@@ -0,0 +1,44 @@
1
+ import { mkdtempSync, writeFileSync } from 'node:fs';
2
+ import { tmpdir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import { describe, expect, it } from 'vitest';
5
+ import { builtinCommandsOf, builtinMissingOf } from '../builtin-catalog.js';
6
+
7
+ function catalogOf(entries: readonly unknown[]): ReadonlyMap<string, readonly string[]> {
8
+ const dir = mkdtempSync(join(tmpdir(), 'wb-builtin-'));
9
+ const file = join(dir, 'cli-manifest.json');
10
+ writeFileSync(file, JSON.stringify(entries));
11
+ return builtinCommandsOf(file);
12
+ }
13
+
14
+ const builtin = { kind: 'builtin' as const };
15
+
16
+ describe('builtinMissingOf', () => {
17
+ it('站点与命令都在 → 不缺', () => {
18
+ const catalog = catalogOf([{ site: 'zhihu', name: 'hot' }]);
19
+ expect(
20
+ builtinMissingOf([{ kind: 'extension', runtime: 'opencli', name: 'zhihu', commands: ['hot'], purpose: '测试', sources: [builtin] }], catalog),
21
+ ).toEqual([]);
22
+ });
23
+
24
+ it('清单里没有这个站点 → 缺', () => {
25
+ const catalog = catalogOf([{ site: 'zhihu', name: 'hot' }]);
26
+ expect(
27
+ builtinMissingOf([{ kind: 'extension', runtime: 'opencli', name: 'weibo', commands: ['hot'], purpose: '测试', sources: [builtin] }], catalog),
28
+ ).toEqual(['weibo']);
29
+ });
30
+
31
+ it('站点在、命令不在 → 缺', () => {
32
+ const catalog = catalogOf([{ site: 'zhihu', name: 'hot' }]);
33
+ expect(
34
+ builtinMissingOf([{ kind: 'extension', runtime: 'opencli', name: 'zhihu', commands: ['search'], purpose: '测试', sources: [builtin] }], catalog),
35
+ ).toEqual(['zhihu']);
36
+ });
37
+
38
+ it('没声明 builtin 来源的不算(那是别人的安装路径)', () => {
39
+ const catalog = catalogOf([]);
40
+ expect(
41
+ builtinMissingOf([{ kind: 'extension', runtime: 'opencli', name: 'coding', purpose: '测试', sources: [{ kind: 'npm', package: 'opencli-plugin-coding' }] }], catalog),
42
+ ).toEqual([]);
43
+ });
44
+ });
@@ -0,0 +1,38 @@
1
+ import type { ExtensionNeed, LibNeed, Need } from '../../contract/needs.js';
2
+ import { readJsonObject } from '../runtime/read-json.js';
3
+
4
+ export function builtinCommandsOf(file: string): ReadonlyMap<string, readonly string[]> {
5
+ const parsed = readJsonObject(file);
6
+ if (!Array.isArray(parsed)) return new Map();
7
+ const bySite = new Map<string, string[]>();
8
+ for (const one of parsed) {
9
+ if (typeof one !== 'object' || one === null) continue;
10
+ const row = one as Record<string, unknown>;
11
+ const site = typeof row['site'] === 'string' ? row['site'] : '';
12
+ const name = typeof row['name'] === 'string' ? row['name'] : '';
13
+ if (site === '' || name === '') continue;
14
+ const list = bySite.get(site) ?? [];
15
+ list.push(name);
16
+ for (const alias of Array.isArray(row['aliases']) ? row['aliases'] : []) {
17
+ if (typeof alias === 'string' && alias !== '') list.push(alias);
18
+ }
19
+ bySite.set(site, list);
20
+ }
21
+ return bySite;
22
+ }
23
+
24
+ export function builtinMissingOf(
25
+ needs: readonly Need[] | undefined,
26
+ catalog: ReadonlyMap<string, readonly string[]>,
27
+ ): readonly string[] {
28
+ return (needs ?? [])
29
+ .filter((need): need is ExtensionNeed | LibNeed => need.kind === 'extension' || need.kind === 'lib')
30
+ .filter((need) => (need.sources ?? []).some((source) => source.kind === 'builtin'))
31
+ .filter((need) => {
32
+ const commands = catalog.get(need.name);
33
+ if (commands === undefined) return true;
34
+ if (need.kind !== 'extension') return false;
35
+ return (need.commands ?? []).some((name) => !commands.includes(name));
36
+ })
37
+ .map((need) => need.name);
38
+ }
@@ -1,4 +1,4 @@
1
- export type PreflightStepId = 'toolchain' | 'cli' | 'bridge' | 'runtime' | 'diy' | 'warm';
1
+ export type PreflightStepId = 'toolchain' | 'cli' | 'bridge' | 'runtime' | 'host' | 'diy' | 'warm';
2
2
  export type PreflightStepStatus = 'pending' | 'running' | 'ok' | 'warn' | 'failed';
3
3
  export type PreflightFailure = 'permission' | 'network' | 'missing' | 'host' | 'unknown';
4
4
  export type PreflightGuidance = 'install' | 'path' | 'shell' | 'host';
@@ -20,6 +20,20 @@ export interface PreflightDiyGap {
20
20
  readonly command: string;
21
21
  }
22
22
 
23
+ export type PreflightHostTier = 'newer' | 'older';
24
+
25
+ export type PreflightHostStanding =
26
+ | { readonly tier: 'ok'; readonly log?: readonly string[] }
27
+ | PreflightHostGap;
28
+
29
+ export interface PreflightHostGap {
30
+ readonly tier: PreflightHostTier;
31
+ readonly runtime: string;
32
+ readonly verified: string;
33
+ readonly command?: string;
34
+ readonly log?: readonly string[];
35
+ }
36
+
23
37
  export interface PreflightSnapshot {
24
38
  readonly phase: 'idle' | 'checking' | 'installing' | 'ready' | 'failed';
25
39
  readonly steps: readonly PreflightStep[];
@@ -28,6 +42,7 @@ export interface PreflightSnapshot {
28
42
  readonly failure?: PreflightFailure;
29
43
  readonly guidance?: PreflightGuidance;
30
44
  readonly bridgeIssues?: readonly PreflightBridgeIssue[];
45
+ readonly hostGap?: PreflightHostGap;
31
46
  readonly diyGap?: PreflightDiyGap;
32
47
  readonly canWakeBrowser?: boolean;
33
48
  readonly extensionDir?: string;
@@ -69,6 +69,7 @@ function conventionPackage(name: string, prefix: string): string {
69
69
  function nativeSourcePackage(source: SupplySource): string {
70
70
  if (source.kind === 'npm') return text(source.package);
71
71
  if (source.kind === 'git') return `git:${text(source.url)}`;
72
+ if (source.kind === 'builtin') return 'builtin';
72
73
  return `local:${text(source.env) || text(source.path)}`;
73
74
  }
74
75
 
@@ -114,6 +115,7 @@ function sourceCompatible(
114
115
  if (left.kind === 'local' && right.kind === 'local') {
115
116
  return text(left.env) === text(right.env) && text(left.path) === text(right.path);
116
117
  }
118
+ if (left.kind === 'builtin' && right.kind === 'builtin') return true;
117
119
  return false;
118
120
  }
119
121
 
@@ -168,6 +170,7 @@ function sourceText(source: SupplySource): string {
168
170
  return `${source.package === undefined ? '按包名约定' : source.package}(${source.registryEnv ?? '默认源'})`;
169
171
  }
170
172
  if (source.kind === 'git') return `git:${source.url}`;
173
+ if (source.kind === 'builtin') return '运行时自带';
171
174
  return `local:${source.env ?? source.path ?? ''}`;
172
175
  }
173
176
 
package/src/host.ts CHANGED
@@ -112,6 +112,7 @@ export * from './host/runtime/process-alive.js';
112
112
  export * from './host/runtime/read-json.js';
113
113
  export * from './host/runtime/time.js';
114
114
  export * from './host/runtime/version-range.js';
115
+ export * from './host/runtime/verified-dsh.js';
115
116
  export * from './host/runtime/version.js';
116
117
  export * from './host/runtime/workspace-store.js';
117
118
  export * from './host/runtime/write-result.js';
@@ -136,6 +137,7 @@ export * from './host/supply/installed-sources.js';
136
137
  export * from './host/supply/lib-capabilities.js';
137
138
  export * from './host/supply/lib-install.js';
138
139
  export * from './host/supply/lib-runners.js';
140
+ export * from './host/supply/builtin-catalog.js';
139
141
  export * from './host/supply/market-index-claim.js';
140
142
  export * from './host/supply/market-index-doc.js';
141
143
  export * from './host/supply/market-index-parse.js';
package/src/i18n/en.ts CHANGED
@@ -200,7 +200,7 @@ export const en: Record<keyof WorkbenchMessages, string> = {
200
200
  'panels.market.selfUpdateMigration': 'This update needs Desktop to be closed once: quit Desktop and it finishes automatically, with no further action.',
201
201
  'panels.market.selfUpdatePendingRestart': 'The new version is ready — restart to pick it up.',
202
202
  'panels.market.selfUpdateRetry': 'Update failed. Click Update to try again.',
203
- 'panels.market.selfUpdateNeedsDsh': 'Update failed: this version needs {dsh}. Upgrade dsh first.',
203
+ 'panels.market.selfUpdateNeedsHost': 'Update failed: this version needs {host} {version} or newer; you have {runtime}.',
204
204
  'panels.market.selfUpdateBusy': 'The previous update has not finished. Wait for it to end, then update again.',
205
205
  'panels.market.selfUpdateReinstallFailed': 'Reinstalling dependencies failed. Restart the workbench and try again; if it still fails, install manually with the command shown in the terminal.',
206
206
  'panels.market.selfUpdateReinstallStopped': 'Automatic dependency installation kept failing. Install manually with the command shown in the terminal.',
@@ -269,6 +269,8 @@ export const en: Record<keyof WorkbenchMessages, string> = {
269
269
  'panels.market.needLib': 'Install the library {name} first.',
270
270
  'panels.market.localMark': 'local',
271
271
  'panels.market.noSource': 'This module does not declare an install method; handle it manually.',
272
+ 'panels.market.needBuiltinMissing':
273
+ 'This module declares a broken dependency: the module author needs to fix it (or wait for a module update).',
272
274
  'panels.market.badSource': 'The install method is incomplete; handle it manually.',
273
275
  'panels.market.empty': 'No modules available to install yet. Add a module source or refresh and try again.',
274
276
  'panels.market.updateAllPlugins': 'Update all',
@@ -330,7 +332,9 @@ export const en: Record<keyof WorkbenchMessages, string> = {
330
332
  'panels.market.olderOnDiskNote':
331
333
  'Installed {installed} while {running} is running. Update before restarting; a restart now runs {installed}.',
332
334
  'panels.market.updateNeedsWorkbench': 'This version needs a newer workbench first.',
333
- 'panels.market.updateNeedsDsh': 'This version needs {dsh}; the running dsh is {runtime}.',
335
+ 'panels.market.needsHostVersion': 'This version needs {host} {version} or newer; you have {runtime}.',
336
+ 'panels.market.needsHostAction.desktop': 'Update DeepSeek Harness, then try again.',
337
+ 'panels.market.needsHostAction.dsh': 'Upgrade dsh, restart it, then try again.',
334
338
  'panels.market.updateIncompatible': 'The new version does not match this workbench, so it cannot be updated now.',
335
339
  'panels.market.updateUnverified': 'Compatibility is unverified; the update may fail.',
336
340
  'panels.market.moduleRefused': 'This module does not match this workbench, so it cannot be used for now.',
@@ -449,7 +453,6 @@ export const en: Record<keyof WorkbenchMessages, string> = {
449
453
  'panels.market.add.failureModuleRow': 'The module is installed in this workbench, but the module list in its configuration was not updated, so it will not load. Fix that list, then restart the workbench.',
450
454
  'panels.market.add.failureModuleRowRemove': 'The module was removed from this workbench, but the module list in its configuration was not updated. Fix that list, then restart the workbench.',
451
455
  'panels.market.add.failureNoProfileDir': 'The directory for this workbench configuration cannot be found, so the module cannot be installed. Check the configuration directory in workbench settings, or install the workbench again.',
452
- 'panels.market.add.failureIncompatible': 'This version needs {dsh}; the running dsh is {runtime}. Upgrade dsh first.',
453
456
  'panels.market.add.failureCredentials': 'This repository needs credentials, and this machine has none for it. Run a clone once in a terminal and set up a credential helper, or switch to the SSH address and try again.',
454
457
  'panels.market.approve.title': 'Install scripts need approval',
455
458
  'panels.market.approve.caution': 'Approve only packages you trust. Install scripts run on this machine with your permissions.',
@@ -659,6 +662,8 @@ export const en: Record<keyof WorkbenchMessages, string> = {
659
662
  'panels.market.add.removed': 'Removed.',
660
663
  'panels.market.add.supplyPending': 'The plugins this module needs will be installed after a restart.',
661
664
  'panels.market.add.supplyFailed': 'The plugins this module needs are not installed: {reason}',
665
+ 'panels.market.add.problemBuiltinMissing':
666
+ 'This module declares a broken dependency: the module author needs to fix it (or wait for a module update).',
662
667
  'panels.market.add.notModule': "This is not a workbench module (no dsh.workbench declaration), so it will not show up on the board.",
663
668
  'panels.market.add.removedRestart': 'Uninstalled; restart to finish.',
664
669
  'panels.market.add.remove': 'Remove it',
@@ -764,6 +769,15 @@ export const en: Record<keyof WorkbenchMessages, string> = {
764
769
  'env.diy.noRow': 'The startup check did not find “Workbench DIY mode” in dsh’s mode list. This workbench install most likely does not include the matching mode patch.',
765
770
  'env.diy.step': 'Upgrade dsh, then restart the workbench:',
766
771
  'env.diy.continue': 'Enter the workbench anyway',
772
+
773
+ 'env.step.hostVersion': 'Check {host} version',
774
+ 'env.hostVersion.newer': 'Unverified',
775
+ 'env.hostVersion.older': 'Too old',
776
+ 'env.hostVersion.newer.why': 'This machine has {host} {runtime}. The workbench is verified on {verified}. You can continue. Upgrade the workbench if a module or panel does not work as expected.',
777
+ 'env.hostVersion.older.why': 'The workbench needs {host} {verified} or later. This machine has {runtime}. Upgrade {host}, then restart.',
778
+ 'env.hostVersion.older.step': 'Upgrade {host}, then restart:',
779
+ 'env.hostVersion.recover': 'If the workbench keeps failing to open, remove it from this workbench configuration, then restart {host}.',
780
+ 'env.hostVersion.recover.detail': 'Remove @dsh-workbench/core from dsh.profile.bundles in package.json.',
767
781
  'env.copyCommand': 'Copy command',
768
782
  'env.copied': 'Copied',
769
783
  'env.step.toolchain': 'Check the environment',
package/src/i18n/zh.ts CHANGED
@@ -199,7 +199,7 @@ export const zh = {
199
199
  'panels.market.selfUpdateMigration': '本次更新需要先退出 Desktop(仅这一次):退出后会自动完成,无需再次操作。',
200
200
  'panels.market.selfUpdatePendingRestart': '新版本已就绪,重启后生效。',
201
201
  'panels.market.selfUpdateRetry': '更新失败,请再次点击「更新」。',
202
- 'panels.market.selfUpdateNeedsDsh': '更新失败:这个版本需要 {dsh},请先升级 dsh。',
202
+ 'panels.market.selfUpdateNeedsHost': '更新失败:这个版本要求 {host} {version} 或更高,当前为 {runtime}。',
203
203
  'panels.market.selfUpdateBusy': '上一次更新尚未结束,请等待结束后再更新。',
204
204
  'panels.market.selfUpdateReinstallFailed': '依赖重新安装失败,请重启工作台后重试;如果仍然失败,请按终端中的提示手动安装。',
205
205
  'panels.market.selfUpdateReinstallStopped': '依赖自动安装连续失败,请按终端中的提示手动安装。',
@@ -265,6 +265,7 @@ export const zh = {
265
265
  'panels.market.needLib': '请先安装库 {name}。',
266
266
  'panels.market.localMark': '本地',
267
267
  'panels.market.noSource': '这个模块没有声明安装方式,只能手动处理。',
268
+ 'panels.market.needBuiltinMissing': '这个模块声明的依赖有问题:需要模块作者修复(或等模块更新)。',
268
269
  'panels.market.badSource': '安装方式不完整,只能手动处理。',
269
270
  'panels.market.empty': '还没有可安装的模块。请添加模块来源或刷新后重试。',
270
271
  'panels.market.updateAllPlugins': '全部更新',
@@ -326,7 +327,9 @@ export const zh = {
326
327
  'panels.market.olderOnDiskNote':
327
328
  '已安装 {installed},正在运行 {running}。请先更新再重启;直接重启会运行 {installed}。',
328
329
  'panels.market.updateNeedsWorkbench': '这个版本需要先升级工作台。',
329
- 'panels.market.updateNeedsDsh': '这个版本需要 {dsh},当前 dsh 为 {runtime}。',
330
+ 'panels.market.needsHostVersion': '这个版本要求 {host} {version} 或更高,当前为 {runtime}。',
331
+ 'panels.market.needsHostAction.desktop': '更新 DeepSeek Harness 后再试。',
332
+ 'panels.market.needsHostAction.dsh': '升级 dsh 后重启再试。',
330
333
  'panels.market.updateIncompatible': '新版本与当前工作台不匹配,暂时无法更新。',
331
334
  'panels.market.updateUnverified': '兼容性尚未验证,更新可能失败。',
332
335
  'panels.market.moduleRefused': '模块版本与工作台不匹配,暂时无法使用',
@@ -446,7 +449,6 @@ export const zh = {
446
449
  '模块已安装到工作台配置,但工作台配置里的模块清单没有更新,因此还不会加载。请修好这份清单,再重启工作台。',
447
450
  'panels.market.add.failureModuleRowRemove': '模块已从工作台配置移除,但模块清单没有更新。请修好这份清单,再重启工作台。',
448
451
  'panels.market.add.failureNoProfileDir': '找不到这份工作台配置的目录,无法安装模块。请在工作台设置里检查配置目录,或重新安装工作台。',
449
- 'panels.market.add.failureIncompatible': '这个版本需要 {dsh},当前 dsh 为 {runtime}。请先升级 dsh 再安装。',
450
452
  'panels.market.add.failureCredentials': '这个仓库需要凭证,本机没有它的 git 凭据。请先在终端中执行一次 clone,并配置凭据助手,或改用 SSH 地址后重试。',
451
453
  'panels.market.approve.title': '安装脚本需要批准',
452
454
  'panels.market.approve.caution': '请只批准可信的包。安装脚本会以你的权限在这台机器上运行。',
@@ -655,6 +657,8 @@ export const zh = {
655
657
  'panels.market.add.removed': '已移除。',
656
658
  'panels.market.add.supplyPending': '该模块所需的插件会在重启后安装。',
657
659
  'panels.market.add.supplyFailed': '该模块所需的插件未安装:{reason}',
660
+ 'panels.market.add.problemBuiltinMissing':
661
+ '这个模块声明的依赖有问题:需要模块作者修复(或等模块更新)。',
658
662
  'panels.market.add.notModule': '这不是工作台模块(没有 dsh.workbench 声明),不会出现在面板上。',
659
663
  'panels.market.add.removedRestart': '已卸载,重启后彻底生效。',
660
664
  'panels.market.add.remove': '移除它',
@@ -760,6 +764,15 @@ export const zh = {
760
764
  'env.diy.noRow': '启动检查没有在 dsh 的模式列表中找到「工作台 DIY 模式」,多半是这次工作台安装没有包含对应的模式补丁。',
761
765
  'env.diy.step': '升级 dsh,然后重启一次工作台:',
762
766
  'env.diy.continue': '先进入工作台',
767
+
768
+ 'env.step.hostVersion': '检查 {host} 版本',
769
+ 'env.hostVersion.newer': '未验证',
770
+ 'env.hostVersion.older': '版本过低',
771
+ 'env.hostVersion.newer.why': '{host} 的版本是 {runtime},工作台在 {verified} 上验证过。可以继续使用。如果模块或面板显示异常,请升级工作台。',
772
+ 'env.hostVersion.older.why': '工作台需要 {host} {verified} 或更高,这台机器上是 {runtime}。请升级 {host},然后重启。',
773
+ 'env.hostVersion.older.step': '升级 {host},然后重启:',
774
+ 'env.hostVersion.recover': '如果工作台一直打不开,可以把它从这份工作台配置里去掉,再重启 {host}。',
775
+ 'env.hostVersion.recover.detail': '从 package.json 的 dsh.profile.bundles 里删除 @dsh-workbench/core。',
763
776
  'env.copyCommand': '复制命令',
764
777
  'env.copied': '已复制',
765
778
  'env.step.toolchain': '检查运行环境',
@@ -4,3 +4,14 @@ export function requirementsText(requirements: Readonly<Record<string, string>>
4
4
  .map(([name, range]) => `${name === 'engines.dsh' ? 'dsh' : name} ${range}`);
5
5
  return parts.length === 0 ? undefined : parts.join('、');
6
6
  }
7
+
8
+ export function requirementVersionText(
9
+ requirements: Readonly<Record<string, string>> | undefined,
10
+ ): string | undefined {
11
+ const entries = Object.entries(requirements ?? {});
12
+ const picked = entries.find(([name]) => name === 'engines.dsh') ?? entries[0];
13
+ if (picked === undefined) return undefined;
14
+ const raw = picked[1].trim();
15
+ const stripped = raw.replace(/^(>=|<=|>|<|=|\^|~)\s*/, '');
16
+ return /^\d/.test(stripped) && !/[\s|<>=]/.test(stripped) ? stripped : raw;
17
+ }
@@ -12,7 +12,6 @@ import type {} from '@deepseek-ai/dsh-client-ui-input-trigger/client';
12
12
  import type {} from '@deepseek-ai/dsh-client-ui-layout/client';
13
13
  import type {} from '@deepseek-ai/dsh-client-ui-renderer/client';
14
14
  import type {} from '@deepseek-ai/dsh-client-ui-session/client';
15
- import type {} from '@deepseek-ai/dsh-client-ui-session-status/client';
16
15
  import type {} from '@deepseek-ai/dsh-client-ui-sidebar-right/client';
17
16
  import type {} from '@deepseek-ai/dsh-client-ui-settings/client';
18
17
  import type {} from '@deepseek-ai/dsh-client-ui-workspace/client';
@@ -20,7 +19,7 @@ import type {} from '@deepseek-ai/dsh-subagent';
20
19
  import type { SlotRegistry } from '@deepseek-ai/dsh-client-ui-renderer/client';
21
20
  import type { PropsRenderSlots, SlotLabel } from '@deepseek-ai/dsh-client-ui-slots';
22
21
  import type { SessionInput as OfficialSessionInput } from '@deepseek-ai/dsh-client-ui-conversation/client';
23
- import type { SessionStatus as OfficialSessionStatus } from '@deepseek-ai/dsh-client-ui-session-status/client';
22
+ import type { SessionStatus as OfficialSessionStatus } from '@deepseek-ai/dsh-client-ui-session/client';
24
23
  import type { SessionSummary as OfficialSessionSummary } from '@deepseek-ai/dsh-api-session-controller/client';
25
24
  import type {
26
25
  WorkspaceSnapshot as OfficialWorkspaceSnapshot,