dsh-tidy-display 0.2.3 → 0.2.4-beta.5
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.
- package/CHANGELOG.de.md +187 -0
- package/CHANGELOG.es.md +187 -0
- package/CHANGELOG.fr.md +187 -0
- package/CHANGELOG.it.md +187 -0
- package/CHANGELOG.md +4 -0
- package/CHANGELOG.ru.md +187 -0
- package/README.de.md +7 -2
- package/README.en.md +7 -2
- package/README.es.md +7 -2
- package/README.fr.md +7 -2
- package/README.it.md +7 -2
- package/README.md +7 -2
- package/README.ru.md +7 -2
- package/lib/client.js +78 -39
- package/lib/client.js.map +1 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +7 -4
- package/lib/types/client/index.js.map +1 -1
- package/lib/types/client/official-slots.d.ts.map +1 -1
- package/lib/types/client/official-slots.js +14 -8
- package/lib/types/client/official-slots.js.map +1 -1
- package/lib/types/client/rail/RailView.d.ts.map +1 -1
- package/lib/types/client/rail/RailView.js +30 -6
- package/lib/types/client/rail/RailView.js.map +1 -1
- package/lib/types/client/settings-copy.js +14 -14
- package/lib/types/client/settings-copy.js.map +1 -1
- package/package.json +59 -19
- package/scripts/check-harness-compat.mjs +5 -1
- package/scripts/hosts.mjs +80 -0
- package/scripts/sync-hosts.mjs +170 -0
- package/scripts/test-host-compat.mjs +378 -0
- package/src/client/OfficialContent.tsx +10 -4
- package/src/client/Reader.tsx +20 -2
- package/src/client/index.tsx +7 -4
- package/src/client/official-slots.tsx +25 -10
- package/src/client/rail/RailView.tsx +31 -5
- package/src/client/settings-copy.ts +14 -14
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-tidy-display",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "One plugin for a calmer DeepSeek Harness: reading view + message rail + smart history loading, for
|
|
3
|
+
"version": "0.2.4-beta.5",
|
|
4
|
+
"description": "One plugin for a calmer DeepSeek Harness: reading view + message rail + smart history loading, for Harness 0.1.0-0.2.0 (all rc).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"publishConfig": {
|
|
@@ -49,19 +49,19 @@
|
|
|
49
49
|
"check": "npm run typecheck && npm run lint && npm test"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@deepseek-ai/cordis": "
|
|
53
|
-
"@deepseek-ai/dsh-api-session-controller": "
|
|
54
|
-
"@deepseek-ai/dsh-attachment": "
|
|
55
|
-
"@deepseek-ai/dsh-client-store": "
|
|
56
|
-
"@deepseek-ai/dsh-client-ui-chat": "
|
|
57
|
-
"@deepseek-ai/dsh-client-ui-conversation": "
|
|
58
|
-
"@deepseek-ai/dsh-client-ui-primitives": "
|
|
59
|
-
"@deepseek-ai/dsh-client-ui-renderer": "
|
|
60
|
-
"@deepseek-ai/dsh-client-ui-session": "
|
|
61
|
-
"@deepseek-ai/dsh-client-ui-slots": "
|
|
62
|
-
"@deepseek-ai/dsh-client-ui-tool": "
|
|
63
|
-
"@deepseek-ai/dsh-session": "
|
|
64
|
-
"@deepseek-ai/dsh-util-workspace-path": "
|
|
52
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
53
|
+
"@deepseek-ai/dsh-api-session-controller": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
|
|
54
|
+
"@deepseek-ai/dsh-attachment": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
|
|
55
|
+
"@deepseek-ai/dsh-client-store": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
|
|
56
|
+
"@deepseek-ai/dsh-client-ui-chat": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
|
|
57
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
|
|
58
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
|
|
59
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
|
|
60
|
+
"@deepseek-ai/dsh-client-ui-session": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
|
|
61
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
|
|
62
|
+
"@deepseek-ai/dsh-client-ui-tool": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
|
|
63
|
+
"@deepseek-ai/dsh-session": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
|
|
64
|
+
"@deepseek-ai/dsh-util-workspace-path": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
|
|
65
65
|
"react": "^18.2.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
@@ -110,16 +110,18 @@
|
|
|
110
110
|
"tsconfig.json",
|
|
111
111
|
"tsdown.config.ts",
|
|
112
112
|
"README.md",
|
|
113
|
-
"README
|
|
113
|
+
"README.*.md",
|
|
114
|
+
"CHANGELOG.md",
|
|
115
|
+
"CHANGELOG.*.md",
|
|
114
116
|
"DESIGN.md",
|
|
115
117
|
"LICENSE",
|
|
116
118
|
"THIRD_PARTY_NOTICES.md",
|
|
117
|
-
"CHANGELOG.md",
|
|
118
119
|
"compat",
|
|
119
120
|
"docs"
|
|
120
121
|
],
|
|
121
122
|
"engines": {
|
|
122
|
-
"node": "^22.19.0 || >=24.0.0"
|
|
123
|
+
"node": "^22.19.0 || >=24.0.0",
|
|
124
|
+
"dsh": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2"
|
|
123
125
|
},
|
|
124
126
|
"repository": {
|
|
125
127
|
"type": "git",
|
|
@@ -138,5 +140,43 @@
|
|
|
138
140
|
"reasoning",
|
|
139
141
|
"streaming",
|
|
140
142
|
"accessibility"
|
|
141
|
-
]
|
|
143
|
+
],
|
|
144
|
+
"peerDependenciesMeta": {
|
|
145
|
+
"@deepseek-ai/dsh-api-session-controller": {
|
|
146
|
+
"optional": true
|
|
147
|
+
},
|
|
148
|
+
"@deepseek-ai/dsh-attachment": {
|
|
149
|
+
"optional": true
|
|
150
|
+
},
|
|
151
|
+
"@deepseek-ai/dsh-client-store": {
|
|
152
|
+
"optional": true
|
|
153
|
+
},
|
|
154
|
+
"@deepseek-ai/dsh-client-ui-chat": {
|
|
155
|
+
"optional": true
|
|
156
|
+
},
|
|
157
|
+
"@deepseek-ai/dsh-client-ui-conversation": {
|
|
158
|
+
"optional": true
|
|
159
|
+
},
|
|
160
|
+
"@deepseek-ai/dsh-client-ui-primitives": {
|
|
161
|
+
"optional": true
|
|
162
|
+
},
|
|
163
|
+
"@deepseek-ai/dsh-client-ui-renderer": {
|
|
164
|
+
"optional": true
|
|
165
|
+
},
|
|
166
|
+
"@deepseek-ai/dsh-client-ui-session": {
|
|
167
|
+
"optional": true
|
|
168
|
+
},
|
|
169
|
+
"@deepseek-ai/dsh-client-ui-slots": {
|
|
170
|
+
"optional": true
|
|
171
|
+
},
|
|
172
|
+
"@deepseek-ai/dsh-client-ui-tool": {
|
|
173
|
+
"optional": true
|
|
174
|
+
},
|
|
175
|
+
"@deepseek-ai/dsh-session": {
|
|
176
|
+
"optional": true
|
|
177
|
+
},
|
|
178
|
+
"@deepseek-ai/dsh-util-workspace-path": {
|
|
179
|
+
"optional": true
|
|
180
|
+
}
|
|
181
|
+
}
|
|
142
182
|
}
|
|
@@ -8,7 +8,11 @@ import { createRequire } from 'node:module';
|
|
|
8
8
|
|
|
9
9
|
const root = resolve(import.meta.dirname, '..');
|
|
10
10
|
const harness = resolve(process.env.DSHX_HARNESS?.trim() || readFileSync(join(homedir(), '.config/dshx/harness'), 'utf8').trim());
|
|
11
|
-
|
|
11
|
+
// Per-host-version baselines (`--host 0.2.0-rc.2` -> compat/harness-0.2.0-rc.2.json);
|
|
12
|
+
// no --host keeps the committed build-gate baseline. Matrix cells pass --host once a
|
|
13
|
+
// monorepo checkout of that host version exists (npm packages ship no sources to hash).
|
|
14
|
+
const hostArg = process.argv.includes('--host') ? process.argv[process.argv.indexOf('--host') + 1] : undefined;
|
|
15
|
+
const baselineFile = join(root, 'compat', hostArg ? `harness-${hostArg}.json` : 'harness-020rc2.json');
|
|
12
16
|
const ts = createRequire(join(root, 'package.json'))('typescript');
|
|
13
17
|
const files = [
|
|
14
18
|
'packages/client/ui-slots/src/index.ts',
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hosts.mjs —— 宿主版本枚举的**唯一事实源**。
|
|
3
|
+
*
|
|
4
|
+
* 迁移基线:improve-dsh-plugins/enum-peer-migration/INDEX.md §A;
|
|
5
|
+
* 枚举口径(2026-10-04 用户指令,沿 dsh-date-wrapper P0 试点先例):
|
|
6
|
+
* **起步即全量收入 npm 上六条线(0.1.0/0.1.1/0.1.2/0.1.5/0.1.7/0.2.0)的全部 rc**
|
|
7
|
+
* (2026-10-04 对 @deepseek-ai/dsh 及全部 12 个 peer 子包逐一 npm 实测;0.1.3-alpha.2
|
|
8
|
+
* 与 0.1.6-alpha.1/2 为未成线 alpha,不入列),由本地隔离矩阵逐格验证后**删红留绿**;
|
|
9
|
+
* 矩阵结论落 `.compat-results/`。
|
|
10
|
+
* 升级流程:本数组加版本 → `node scripts/sync-hosts.mjs --write` → 矩阵绿 → 发版。
|
|
11
|
+
*
|
|
12
|
+
* 本数组与由它生成的声明写点(package.json peerDependencies 的 12 个 dsh-* 项 /
|
|
13
|
+
* package.json engines.dsh / 各 README 的 host-compat 管理块)**禁止手改**,
|
|
14
|
+
* 由 sync-hosts.mjs 校验/下发。cordis 与 react 例外(见 cordisRange 注释)。
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** 全部声明支持的宿主 rc(冻结;新增只在此处追加)。 */
|
|
18
|
+
export const supportedHosts = Object.freeze([
|
|
19
|
+
// 0.1.0 线(5 个 rc)
|
|
20
|
+
'0.1.0-rc.2',
|
|
21
|
+
'0.1.0-rc.3',
|
|
22
|
+
'0.1.0-rc.6',
|
|
23
|
+
'0.1.0-rc.7',
|
|
24
|
+
'0.1.0-rc.8',
|
|
25
|
+
// 0.1.1 线(2 个 rc)
|
|
26
|
+
'0.1.1-rc.1',
|
|
27
|
+
'0.1.1-rc.2',
|
|
28
|
+
// 0.1.2 线(1 个 rc)
|
|
29
|
+
'0.1.2-rc.1',
|
|
30
|
+
// 0.1.5 线(3 个 rc)
|
|
31
|
+
'0.1.5-rc.1',
|
|
32
|
+
'0.1.5-rc.2',
|
|
33
|
+
'0.1.5-rc.3',
|
|
34
|
+
// 0.1.7 线(2 个 rc)
|
|
35
|
+
'0.1.7-rc.1',
|
|
36
|
+
'0.1.7-rc.2',
|
|
37
|
+
// 0.2.0 线(2 个 rc)
|
|
38
|
+
'0.2.0-rc.1',
|
|
39
|
+
'0.2.0-rc.2',
|
|
40
|
+
])
|
|
41
|
+
|
|
42
|
+
/** peerDependencies / engines.dsh 共用的枚举串(精确枚举无暗坑,INDEX §B)。 */
|
|
43
|
+
export const peerRange = supportedHosts.join(' || ')
|
|
44
|
+
|
|
45
|
+
/** 本地开发与矩阵默认宿主(devDependencies 若引入宿主包一律钉这里)。 */
|
|
46
|
+
export const developmentHost = '0.2.0-rc.2'
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* peer 闸指向的宿主子包(本插件消费的全部宿主面:peerDependencies 里的 12 个
|
|
50
|
+
* `@deepseek-ai/dsh-*` 项;`cordis` 与 `react` 不在其中——见各自注释)。
|
|
51
|
+
*
|
|
52
|
+
* 机制事实(2026-10-04 对宿主 app-boot/src/plugin-compatibility.ts 逐行核实,
|
|
53
|
+
* 0.1.7-rc.2 源码):宿主 peer 闸把**每一个** dsh-* peer 的范围拿去匹配
|
|
54
|
+
* **宿主运行时版本**(semver.satisfies + includePrerelease),既不按包名跳过、
|
|
55
|
+
* 也不按子包自身版本比对——因此若像 arrowkey-nav 那样按“包存在线”拆分范围,
|
|
56
|
+
* 0.1.0/0.1.1 宿主会因 client-store 等项的窄枚举被整体拒载。要覆盖全部 15 rc,
|
|
57
|
+
* 12 项 peer 必须都携带**全量枚举**;“某子包在老线不存在”由矩阵的运行时断言
|
|
58
|
+
* (client inject / 路由探针)裁决,不由声明面预判。
|
|
59
|
+
*/
|
|
60
|
+
export const hostPeerPackages = Object.freeze([
|
|
61
|
+
'@deepseek-ai/dsh-api-session-controller',
|
|
62
|
+
'@deepseek-ai/dsh-attachment',
|
|
63
|
+
'@deepseek-ai/dsh-client-store',
|
|
64
|
+
'@deepseek-ai/dsh-client-ui-chat',
|
|
65
|
+
'@deepseek-ai/dsh-client-ui-conversation',
|
|
66
|
+
'@deepseek-ai/dsh-client-ui-primitives',
|
|
67
|
+
'@deepseek-ai/dsh-client-ui-renderer',
|
|
68
|
+
'@deepseek-ai/dsh-client-ui-session',
|
|
69
|
+
'@deepseek-ai/dsh-client-ui-slots',
|
|
70
|
+
'@deepseek-ai/dsh-client-ui-tool',
|
|
71
|
+
'@deepseek-ai/dsh-session',
|
|
72
|
+
'@deepseek-ai/dsh-util-workspace-path',
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* cordis 的 peer:宿主 0.1.7+ 线依赖 cordis ~4.0.4,更早线锁 ~4.0.2(INDEX §A
|
|
77
|
+
* 铁律),故放宽为 ^4.0.2 横跨两代——cordis 版本不随宿主 rc 逐版发布,不适用
|
|
78
|
+
* 枚举法。react 为上游生态 peer,保持 ^18.2.0 不动。
|
|
79
|
+
*/
|
|
80
|
+
export const cordisRange = '^4.0.2'
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sync-hosts.mjs —— 从 hosts.mjs(唯一事实源)下发本仓全部宿主声明写点。
|
|
3
|
+
*
|
|
4
|
+
* 改编自 dsh-date-wrapper/scripts/sync-hosts.mjs(P0 试点定型版),本仓差异:
|
|
5
|
+
* 1. 写点 1 = package.json:engines.dsh + **12 个 dsh-* peer**(全量枚举,optional
|
|
6
|
+
* ——profile 安装 autoInstallPeers:false,peer 不经注册表解析;optional 只影响
|
|
7
|
+
* 独立 npm 安装的开发场景)+ cordis peer(^4.0.2 横跨两代 cordis 线);
|
|
8
|
+
* `react` 为上游生态 peer,不属于宿主声明面,本脚本不碰。
|
|
9
|
+
* 2. 写点 2 = dsh.plugin.json:本仓**没有**插件 manifest(findings §1.2)——存在
|
|
10
|
+
* 才管理(engines.dsh + version 镜像),不存在跳过不报错(INDEX §C 写点全景)。
|
|
11
|
+
* 3. 写点 3 = **七语 README** 管理块(README.md 为简体中文 + en/de/es/fr/it/ru)。
|
|
12
|
+
*
|
|
13
|
+
* 双模式:默认只校验(exit 1 = 有漂移);`--write` 实际写盘。
|
|
14
|
+
* 用法:node scripts/sync-hosts.mjs [--write]
|
|
15
|
+
*/
|
|
16
|
+
import { readFile, writeFile } from 'node:fs/promises'
|
|
17
|
+
import { existsSync } from 'node:fs'
|
|
18
|
+
import assert from 'node:assert/strict'
|
|
19
|
+
import { supportedHosts, peerRange, developmentHost, hostPeerPackages, cordisRange } from './hosts.mjs'
|
|
20
|
+
|
|
21
|
+
const ROOT = new URL('..', import.meta.url)
|
|
22
|
+
const write = process.argv.includes('--write')
|
|
23
|
+
const read = (rel) => readFile(new URL(rel, ROOT), 'utf8')
|
|
24
|
+
|
|
25
|
+
// ── 0. hosts.mjs 自检 ────────────────────────────────────────────────────────
|
|
26
|
+
const RC_RE = /^\d+\.\d+\.\d+-rc\.\d+$/
|
|
27
|
+
assert(supportedHosts.length > 0, 'supportedHosts 不得为空')
|
|
28
|
+
assert.equal(new Set(supportedHosts).size, supportedHosts.length, 'supportedHosts 有重复项')
|
|
29
|
+
for (const v of supportedHosts) assert(RC_RE.test(v), `非 rc 版本混入枚举: ${v}(本插件只收 rc)`)
|
|
30
|
+
assert(supportedHosts.includes(developmentHost), 'developmentHost 必须在 supportedHosts 内')
|
|
31
|
+
assert(hostPeerPackages.length > 0, 'hostPeerPackages 不得为空')
|
|
32
|
+
|
|
33
|
+
// ── 1. package.json:engines.dsh + 12 个 dsh-* peer + cordis peer ────────────
|
|
34
|
+
const pkgUrl = new URL('package.json', ROOT)
|
|
35
|
+
const pkgOriginal = await read('package.json')
|
|
36
|
+
const pkg = JSON.parse(pkgOriginal)
|
|
37
|
+
pkg.engines ??= {}
|
|
38
|
+
pkg.engines.dsh = peerRange
|
|
39
|
+
pkg.peerDependencies ??= {}
|
|
40
|
+
pkg.peerDependenciesMeta ??= {}
|
|
41
|
+
for (const name of hostPeerPackages) {
|
|
42
|
+
pkg.peerDependencies[name] = peerRange
|
|
43
|
+
// optional:宿主 peer 闸(app-boot evaluatePluginCompatibility)照样逐项比对外来
|
|
44
|
+
// 版本;meta 只影响独立 npm 安装场景——缺失不拦安装(fail-soft 与运行时姿态
|
|
45
|
+
// 一致:webServer/skills/webServer 路由全有守卫)。树内一旦存在但版本不在枚举,
|
|
46
|
+
// npm/pnpm 照样 ERESOLVE。
|
|
47
|
+
pkg.peerDependenciesMeta[name] = { optional: true }
|
|
48
|
+
}
|
|
49
|
+
pkg.peerDependencies['@deepseek-ai/cordis'] = cordisRange
|
|
50
|
+
delete pkg.peerDependenciesMeta['@deepseek-ai/cordis']
|
|
51
|
+
const pkgExpected = JSON.stringify(pkg, null, 2) + '\n'
|
|
52
|
+
|
|
53
|
+
// ── 2. dsh.plugin.json(存在才管理):engines.dsh + manifest version 镜像 ─────
|
|
54
|
+
const pluginJsonUrl = new URL('dsh.plugin.json', ROOT)
|
|
55
|
+
const hasManifest = existsSync(pluginJsonUrl)
|
|
56
|
+
let manifestOriginal, manifestExpected
|
|
57
|
+
if (hasManifest) {
|
|
58
|
+
manifestOriginal = await read('dsh.plugin.json')
|
|
59
|
+
const manifest = JSON.parse(manifestOriginal)
|
|
60
|
+
manifest.engines ??= {}
|
|
61
|
+
manifest.engines.dsh = peerRange
|
|
62
|
+
manifest.version = pkg.version // version 以 package.json 为准,manifest 只镜像
|
|
63
|
+
manifestExpected = JSON.stringify(manifest, null, 2) + '\n'
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// ── 3. 七语 README:管理块(支持清单 + 运行时已验证清单) ────────────────────
|
|
67
|
+
const BEGIN = '<!-- host-compat:begin — generated by scripts/sync-hosts.mjs from scripts/hosts.mjs; DO NOT EDIT -->'
|
|
68
|
+
const END = '<!-- host-compat:end -->'
|
|
69
|
+
const versionList = supportedHosts.map((v) => `\`${v}\``).join(' ')
|
|
70
|
+
const LINES = '0.1.0 / 0.1.1 / 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0'
|
|
71
|
+
const linesPerLang = {
|
|
72
|
+
'README.md': [
|
|
73
|
+
`- **支持的 DSH 宿主:** ${versionList}(覆盖 ${LINES} 六条线共 ${supportedHosts.length} 个 rc)`,
|
|
74
|
+
],
|
|
75
|
+
'README.en.md': [
|
|
76
|
+
`- **Supported DSH hosts:** ${versionList} (${supportedHosts.length} rc releases across lines ${LINES})`,
|
|
77
|
+
],
|
|
78
|
+
'README.de.md': [
|
|
79
|
+
`- **Unterstützte DSH-Hosts:** ${versionList} (${supportedHosts.length} RC über die Linien ${LINES})`,
|
|
80
|
+
],
|
|
81
|
+
'README.es.md': [
|
|
82
|
+
`- **Hosts DSH compatibles:** ${versionList} (${supportedHosts.length} rc en las líneas ${LINES})`,
|
|
83
|
+
],
|
|
84
|
+
'README.fr.md': [
|
|
85
|
+
`- **Hôtes DSH pris en charge :** ${versionList} (${supportedHosts.length} rc sur les lignes ${LINES})`,
|
|
86
|
+
],
|
|
87
|
+
'README.it.md': [
|
|
88
|
+
`- **Host DSH supportati:** ${versionList} (${supportedHosts.length} rc attraverso le linee ${LINES})`,
|
|
89
|
+
],
|
|
90
|
+
'README.ru.md': [
|
|
91
|
+
`- **Поддерживаемые хосты DSH:** ${versionList} (${supportedHosts.length} rc по линиям ${LINES})`,
|
|
92
|
+
],
|
|
93
|
+
}
|
|
94
|
+
// 矩阵跑绿清单(.compat-results/verified.json,由 scripts/test-host-compat.mjs 写出)
|
|
95
|
+
const verifiedUrl = new URL('.compat-results/verified.json', ROOT)
|
|
96
|
+
if (existsSync(verifiedUrl)) {
|
|
97
|
+
const { verified = [] } = JSON.parse(await readFile(verifiedUrl, 'utf8'))
|
|
98
|
+
if (verified.length > 0) {
|
|
99
|
+
const list = verified.map((v) => `\`${v}\``).join(', ')
|
|
100
|
+
const verifiedLine = {
|
|
101
|
+
'README.md': `- **运行时已验证:** ${list}(证据见 \`.compat-results/\`)`,
|
|
102
|
+
'README.en.md': `- **Runtime-verified:** ${list} — evidence in \`.compat-results/\``,
|
|
103
|
+
'README.de.md': `- **Zur Laufzeit verifiziert:** ${list} — Nachweise in \`.compat-results/\``,
|
|
104
|
+
'README.es.md': `- **Verificado en tiempo de ejecución:** ${list} — evidencia en \`.compat-results/\``,
|
|
105
|
+
'README.fr.md': `- **Vérifié à l'exécution :** ${list} — preuves dans \`.compat-results/\``,
|
|
106
|
+
'README.it.md': `- **Verificato a runtime:** ${list} — prove in \`.compat-results/\``,
|
|
107
|
+
'README.ru.md': `- **Проверено на этапе выполнения:** ${list} — доказательства в \`.compat-results/\``,
|
|
108
|
+
}
|
|
109
|
+
for (const [file, line] of Object.entries(verifiedLine)) linesPerLang[file].push(line)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const readmeProblems = []
|
|
113
|
+
for (const [file, lines] of Object.entries(linesPerLang)) {
|
|
114
|
+
const block = `${BEGIN}\n${lines.join('\n')}\n${END}`
|
|
115
|
+
const url = new URL(file, ROOT)
|
|
116
|
+
const content = await readFile(url, 'utf8')
|
|
117
|
+
const beginAt = content.indexOf(BEGIN)
|
|
118
|
+
if (beginAt === -1) {
|
|
119
|
+
// 插入点:第一个 `## ` 二级标题前(七语结构一致)
|
|
120
|
+
const at = content.search(/^## /m)
|
|
121
|
+
assert(at !== -1, `${file} 找不到插入锚点(第一个二级标题)`)
|
|
122
|
+
if (write) {
|
|
123
|
+
await writeFile(url, content.slice(0, at) + block + '\n\n' + content.slice(at))
|
|
124
|
+
console.log(`write ${file}: 插入管理块`)
|
|
125
|
+
} else {
|
|
126
|
+
readmeProblems.push(`${file} 缺少 host-compat 管理块`)
|
|
127
|
+
}
|
|
128
|
+
continue
|
|
129
|
+
}
|
|
130
|
+
const endAt = content.indexOf(END, beginAt)
|
|
131
|
+
assert(endAt !== -1, `${file} 管理块缺少 end 标记`)
|
|
132
|
+
const current = content.slice(beginAt, endAt + END.length)
|
|
133
|
+
if (write) {
|
|
134
|
+
if (current !== block) {
|
|
135
|
+
await writeFile(url, content.slice(0, beginAt) + block + content.slice(endAt + END.length))
|
|
136
|
+
console.log(`write ${file}: 更新管理块`)
|
|
137
|
+
} else {
|
|
138
|
+
console.log(`ok ${file}: 管理块已是最新`)
|
|
139
|
+
}
|
|
140
|
+
} else if (current !== block) {
|
|
141
|
+
readmeProblems.push(`${file} 管理块内容需要同步`)
|
|
142
|
+
} else {
|
|
143
|
+
console.log(`ok ${file}: 管理块已是最新`)
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// ── 4. 汇总校验/写盘 ────────────────────────────────────────────────────────
|
|
148
|
+
if (write) {
|
|
149
|
+
if (pkgOriginal !== pkgExpected) {
|
|
150
|
+
await writeFile(pkgUrl, pkgExpected)
|
|
151
|
+
console.log('write package.json (engines.dsh + 12 dsh-* peers + cordis)')
|
|
152
|
+
} else console.log('ok package.json')
|
|
153
|
+
if (hasManifest) {
|
|
154
|
+
if (manifestOriginal !== manifestExpected) {
|
|
155
|
+
await writeFile(pluginJsonUrl, manifestExpected)
|
|
156
|
+
console.log('write dsh.plugin.json (engines.dsh + version)')
|
|
157
|
+
} else console.log('ok dsh.plugin.json')
|
|
158
|
+
} else console.log('skip dsh.plugin.json(本仓无插件 manifest)')
|
|
159
|
+
console.log('done --write 完成')
|
|
160
|
+
} else {
|
|
161
|
+
const jsonDrift = pkgOriginal !== pkgExpected ? ['package.json (engines.dsh / peerDependencies / cordis)'] : []
|
|
162
|
+
if (hasManifest && manifestOriginal !== manifestExpected) jsonDrift.push('dsh.plugin.json (engines.dsh / version)')
|
|
163
|
+
if (jsonDrift.length === 0 && readmeProblems.length === 0) {
|
|
164
|
+
console.log('ok 全部写点与 hosts.mjs 一致')
|
|
165
|
+
} else {
|
|
166
|
+
for (const p of [...jsonDrift, ...readmeProblems]) console.error(`drift ${p}`)
|
|
167
|
+
console.error('\n运行 node scripts/sync-hosts.mjs --write 修复')
|
|
168
|
+
process.exit(1)
|
|
169
|
+
}
|
|
170
|
+
}
|