dsh-tidy-display 0.2.3 → 0.2.4-beta.4
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 +183 -0
- package/CHANGELOG.es.md +183 -0
- package/CHANGELOG.fr.md +183 -0
- package/CHANGELOG.it.md +183 -0
- package/CHANGELOG.ru.md +183 -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 +38 -21
- 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/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/index.tsx +7 -4
- package/src/client/rail/RailView.tsx +31 -5
- package/src/client/settings-copy.ts +14 -14
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* test-host-compat.mjs —— 本地隔离矩阵执行体(improve-dsh-plugins/enum-peer-migration
|
|
3
|
+
* /INDEX.md §E:`_wt` 工作树 + 离线 tgz 的 CI 前身)。
|
|
4
|
+
*
|
|
5
|
+
* 骨架沿 dsh-date-wrapper P0 试点定型版;沙箱加固(传递 dsh-* 全量钉版)与
|
|
6
|
+
* HTTP 探针回读沿 dsh-paste-dock 执行体。每格 = 一个宿主 rc:
|
|
7
|
+
* 1. tgz 缓存(`pnpm pack @deepseek-ai/dsh@<version>` → `.compat-results/host-tgz/`);
|
|
8
|
+
* 2. 沙箱安装:宿主 tgz + **钉宿主自己的 Cordis 线**(INDEX §A 铁律:cordis 本体 +
|
|
9
|
+
* group/hmr/include/loader/timer 五件,按宿主线 4.0.2/4.0.4 分档,经
|
|
10
|
+
* pnpm-workspace.yaml overrides)+ `.pnpmfile.cjs` 把全部传递 `@deepseek-ai/dsh*`
|
|
11
|
+
* 钉到宿主版本(防混装)。pnpm `--ignore-scripts`。
|
|
12
|
+
* 3. 插件 tgz(lib/ 已入库,pack 无需构建)经**宿主 CLI 自建 profile** 装入:
|
|
13
|
+
* `dsh plugin --profile web add <tgz>` —— peer 闸(app-boot
|
|
14
|
+
* evaluatePluginCompatibility,逐 dsh-* peer 对宿主运行时版本 semver 匹配)
|
|
15
|
+
* 在这一步咬合,add 日志可判 plugin-blocked。
|
|
16
|
+
* 4. 引导形态协商:A 形 `--profile web --port 0 --no-open`(0.1.0-rc.8+),
|
|
17
|
+
* 老线回退 C 形裸启动(默认端口,可能弹浏览器)。
|
|
18
|
+
* 5. HTTP 探针(带 landing 会话 cookie):
|
|
19
|
+
* GET /tidy-display/skill-status → 200 + JSON(scanGenerativeMcpappsStatus)
|
|
20
|
+
* POST /tidy-display/reveal {path:''} → 400 {ok:false,error:'Empty path'}
|
|
21
|
+
* (空路径探针不弹资源管理器窗口,纯语义验证路由与 handler 挂载)
|
|
22
|
+
* 6. 日志断言:正向签名 `[my-plugins/dsh-tidy-display] loaded`;反向签名
|
|
23
|
+
* 挂载/审计/重名/兼容拦截。
|
|
24
|
+
*
|
|
25
|
+
* 指纹门禁说明:本插件 18 文件哈希基线针对宿主 **monorepo 源码**,npm 发布包只带
|
|
26
|
+
* lib/ 无 src/ ——矩阵格无法从沙箱采集指纹(需逐版本 monorepo 检出,CI 化事项)。
|
|
27
|
+
* 故本执行体以**行为冒烟**为验收(spec §6 口径:指纹回答"宿主改没改",冒烟回答
|
|
28
|
+
* "插件还能不能用")。
|
|
29
|
+
*
|
|
30
|
+
* 归因(日志签名):
|
|
31
|
+
* - ready + 探针全过 + 无签名 → green
|
|
32
|
+
* - /requires the Cordis HMR service/ → host-blocked(宿主引导墙,非插件问题)
|
|
33
|
+
* - /is incompatible with dsh/(add 或 boot)→ plugin-blocked(peer 闸拒入/拒挂)
|
|
34
|
+
* - 挂载/审计/重名签名 → plugin-blocked(notes 注明)
|
|
35
|
+
*
|
|
36
|
+
* 产物:`.compat-results/<version>/{install.log, plugin-add.log, boot-<X>.log,
|
|
37
|
+
* result.json}` + 汇总 `results.json` + 绿名单 `verified.json`
|
|
38
|
+
* (sync-hosts.mjs 据此写 README 的 Runtime-verified 行)。沙箱在系统临时目录:
|
|
39
|
+
* 绿格即弃,红/错误格保留(路径见 result.json 的 sandbox 字段,--keep 全留)。
|
|
40
|
+
*
|
|
41
|
+
* 用法:
|
|
42
|
+
* node scripts/test-host-compat.mjs # 全量(hosts.mjs 枚举)
|
|
43
|
+
* node scripts/test-host-compat.mjs --only 0.2.0-rc.2 # 单格复跑
|
|
44
|
+
* node scripts/test-host-compat.mjs --keep # 全部保留 sandbox 便于复查
|
|
45
|
+
* node scripts/test-host-compat.mjs --force # 忽略已有结论强制重跑
|
|
46
|
+
*/
|
|
47
|
+
import { spawn, spawnSync } from 'node:child_process'
|
|
48
|
+
import { existsSync } from 'node:fs'
|
|
49
|
+
import { mkdir, mkdtemp, readFile, readdir, rm, writeFile } from 'node:fs/promises'
|
|
50
|
+
import { tmpdir } from 'node:os'
|
|
51
|
+
import path from 'node:path'
|
|
52
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
53
|
+
import { supportedHosts } from './hosts.mjs'
|
|
54
|
+
|
|
55
|
+
const ROOT = path.resolve(fileURLToPath(new URL('..', import.meta.url)))
|
|
56
|
+
const RESULTS = path.join(ROOT, '.compat-results')
|
|
57
|
+
const MATRIX = path.join(RESULTS, 'matrix')
|
|
58
|
+
const TGZ_CACHE = path.join(RESULTS, 'host-tgz')
|
|
59
|
+
const WIN32 = process.platform === 'win32'
|
|
60
|
+
const PNPM = WIN32 ? 'pnpm.cmd' : 'pnpm'
|
|
61
|
+
const NPM = WIN32 ? 'npm.cmd' : 'npm'
|
|
62
|
+
const INSTALL_ARGS = ['install', '--ignore-scripts', '--prefer-offline', '--loglevel=error']
|
|
63
|
+
const REGISTRY = '--registry=https://registry.npmjs.org/'
|
|
64
|
+
|
|
65
|
+
/** INDEX §A 铁律:cordis-plugin-* 钉宿主自己的 Cordis 线(映射表与 date-wrapper/paste-dock 执行体一致)。 */
|
|
66
|
+
function cordisPin(hostVersion) {
|
|
67
|
+
const [triplet] = hostVersion.split('-')
|
|
68
|
+
const [maj, min, patch] = triplet.split('.').map(Number)
|
|
69
|
+
return [maj, min, patch] >= [0, 1, 7] ? '4.0.4' : '4.0.2'
|
|
70
|
+
}
|
|
71
|
+
const CORDIS_PLUGIN_PINS = {
|
|
72
|
+
'4.0.2': {
|
|
73
|
+
'@deepseek-ai/cordis-plugin-group': '1.0.2',
|
|
74
|
+
'@deepseek-ai/cordis-plugin-hmr': '1.0.17',
|
|
75
|
+
'@deepseek-ai/cordis-plugin-include': '1.0.7',
|
|
76
|
+
'@deepseek-ai/cordis-plugin-loader': '1.0.3',
|
|
77
|
+
'@deepseek-ai/cordis-plugin-timer': '1.1.4',
|
|
78
|
+
},
|
|
79
|
+
'4.0.4': {
|
|
80
|
+
'@deepseek-ai/cordis-plugin-group': '1.0.4',
|
|
81
|
+
'@deepseek-ai/cordis-plugin-hmr': '1.0.19',
|
|
82
|
+
'@deepseek-ai/cordis-plugin-include': '1.0.9',
|
|
83
|
+
'@deepseek-ai/cordis-plugin-loader': '1.0.5',
|
|
84
|
+
'@deepseek-ai/cordis-plugin-timer': '1.1.6',
|
|
85
|
+
},
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// pnpm 的通配 override 不保证匹配传递依赖;解析每个包时统一官方版本。
|
|
89
|
+
function pinHostDependencies(pkg, version) {
|
|
90
|
+
const pinned = { ...pkg }
|
|
91
|
+
for (const field of ['dependencies', 'optionalDependencies', 'peerDependencies']) {
|
|
92
|
+
if (!pkg[field]) continue
|
|
93
|
+
pinned[field] = Object.fromEntries(
|
|
94
|
+
Object.entries(pkg[field]).map(([name, range]) => [
|
|
95
|
+
name,
|
|
96
|
+
name === '@deepseek-ai/dsh' || name.startsWith('@deepseek-ai/dsh-') ? version : range,
|
|
97
|
+
]),
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
return pinned
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const args = process.argv.slice(2)
|
|
104
|
+
const only = args.includes('--only') ? args[args.indexOf('--only') + 1] : undefined
|
|
105
|
+
const keep = args.includes('--keep')
|
|
106
|
+
const force = args.includes('--force')
|
|
107
|
+
const bootTimeoutSec = args.includes('--timeout') ? Number(args[args.indexOf('--timeout') + 1]) : 90
|
|
108
|
+
const versions = only ? [only] : [...supportedHosts]
|
|
109
|
+
|
|
110
|
+
/** 顺序跑外部命令,非零退出/超时均带尾巴抛错。(win32 的 pnpm.cmd 必须经 shell 启动) */
|
|
111
|
+
function run(cwd, cmd, cmdArgs, label, limitMs = 15 * 60_000, env = process.env) {
|
|
112
|
+
const r = spawnSync(cmd, cmdArgs, { cwd, encoding: 'utf8', shell: WIN32, windowsHide: true, timeout: limitMs, env })
|
|
113
|
+
if (r.error?.code === 'ETIMEDOUT' || r.signal === 'SIGTERM') {
|
|
114
|
+
throw new Error(`${label} 超时(>${Math.round(limitMs / 60_000)}min)`)
|
|
115
|
+
}
|
|
116
|
+
if (r.status !== 0) {
|
|
117
|
+
throw new Error(
|
|
118
|
+
`${label} 失败(exit ${r.status}${r.error ? `,${r.error.code ?? r.error.message}` : ''})\nstdout: ${(r.stdout ?? '').slice(-600)}\nstderr: ${(r.stderr ?? '').slice(-600)}`,
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
return r
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function ensureTgz(version) {
|
|
125
|
+
await mkdir(TGZ_CACHE, { recursive: true })
|
|
126
|
+
const dest = path.join(TGZ_CACHE, `deepseek-ai-dsh-${version}.tgz`)
|
|
127
|
+
if (existsSync(dest)) return dest
|
|
128
|
+
console.log(` pack host ${version}`)
|
|
129
|
+
// npm 而非 pnpm:本仓 pnpm-workspace.yaml 无 packages 字段,pnpm pack 会被
|
|
130
|
+
// workspace 解析绊倒(date-wrapper 无此文件故未踩);npm pack 不读 workspace。
|
|
131
|
+
await run(TGZ_CACHE, NPM, ['pack', `@deepseek-ai/dsh@${version}`, '--pack-destination', TGZ_CACHE, '--registry=https://registry.npmjs.org/', '--loglevel=error'], `npm pack host ${version}`)
|
|
132
|
+
return dest
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** 就绪横幅(宽松:老版本横幅不一定带 dsh 前缀)。 */
|
|
136
|
+
const READY_RE = /https?:\/\/(127\.0\.0\.1|localhost):/
|
|
137
|
+
const HMR_WALL_RE = /requires the Cordis HMR service/
|
|
138
|
+
const COMPAT_BLOCK_RE = /is incompatible with dsh/
|
|
139
|
+
const AUDIT_RE = /startup audit|failed to mount|mount error|failed to start/i
|
|
140
|
+
const DUP_RE = /already (been )?registered|duplicate|conflict/i
|
|
141
|
+
const LOADED_RE = /\[my-plugins\/dsh-tidy-display\] loaded/
|
|
142
|
+
|
|
143
|
+
/** 无头启动一次,返回 { outcome, log, child };就绪/退出/超时先到先得。
|
|
144
|
+
* 不在此处杀进程:HTTP 探针要在宿主存活窗口内跑(runCell 探完再 stopHost)。 */
|
|
145
|
+
async function bootOnce(binJs, cwd, env, extraArgs, timeoutSec) {
|
|
146
|
+
const child = spawn(process.execPath, [binJs, ...extraArgs], { cwd, env, windowsHide: true })
|
|
147
|
+
let log = ''
|
|
148
|
+
child.stdout.on('data', (d) => { log += d })
|
|
149
|
+
child.stderr.on('data', (d) => { log += d })
|
|
150
|
+
const exited = new Promise((resolve) => child.on('exit', (code) => resolve({ exited: true, code })))
|
|
151
|
+
const timer = new Promise((resolve) => setTimeout(() => resolve({ timeout: true }), timeoutSec * 1000))
|
|
152
|
+
const ready = (async () => {
|
|
153
|
+
while (!READY_RE.test(log)) await new Promise((r) => setTimeout(r, 400))
|
|
154
|
+
await new Promise((r) => setTimeout(r, 1200)) // 留给插件挂载/审计日志冲刷
|
|
155
|
+
return { ready: true }
|
|
156
|
+
})()
|
|
157
|
+
const outcome = await Promise.race([exited, timer, ready])
|
|
158
|
+
return { outcome, log, child }
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** 杀宿主进程树(win32 用 taskkill /T 连子进程)。 */
|
|
162
|
+
async function stopHost(child) {
|
|
163
|
+
if (!child || child.exitCode !== null) return
|
|
164
|
+
if (WIN32) spawnSync('taskkill', ['/PID', String(child.pid), '/T', '/F'], { windowsHide: true })
|
|
165
|
+
else child.kill('SIGKILL')
|
|
166
|
+
await new Promise((r) => setTimeout(r, 300)) // 杀树后给日志冲刷留时间
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** HTTP 探针:landing 取会话 cookie,打两条插件路由。返回 { checks, errors }。 */
|
|
170
|
+
async function probeRoutes(url) {
|
|
171
|
+
const checks = {}
|
|
172
|
+
const errors = []
|
|
173
|
+
const landing = await fetch(url, { redirect: 'manual' })
|
|
174
|
+
const cookie = landing.headers
|
|
175
|
+
.getSetCookie()
|
|
176
|
+
.map((value) => value.split(';')[0])
|
|
177
|
+
.join('; ')
|
|
178
|
+
const headers = cookie ? { cookie } : {}
|
|
179
|
+
try {
|
|
180
|
+
const res = await fetch(new URL('/tidy-display/skill-status', url), {
|
|
181
|
+
headers, signal: AbortSignal.timeout(20_000),
|
|
182
|
+
})
|
|
183
|
+
const text = await res.text()
|
|
184
|
+
checks.skillStatus = res.status === 200
|
|
185
|
+
if (res.status === 200) {
|
|
186
|
+
try { checks.skillStatusJson = typeof JSON.parse(text) === 'object' } catch { checks.skillStatusJson = false }
|
|
187
|
+
} else {
|
|
188
|
+
errors.push(`skill-status ${res.status}: ${text.slice(0, 200)}`)
|
|
189
|
+
}
|
|
190
|
+
} catch (e) {
|
|
191
|
+
checks.skillStatus = false
|
|
192
|
+
errors.push(`skill-status fetch: ${String(e?.message ?? e).slice(0, 200)}`)
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
const res = await fetch(new URL('/tidy-display/reveal', url), {
|
|
196
|
+
method: 'POST', headers: { ...headers, 'content-type': 'application/json' },
|
|
197
|
+
body: JSON.stringify({ path: '' }), signal: AbortSignal.timeout(20_000),
|
|
198
|
+
})
|
|
199
|
+
const text = await res.text()
|
|
200
|
+
checks.revealEmptyPath = res.status === 400 && /Empty path/.test(text)
|
|
201
|
+
if (!checks.revealEmptyPath) errors.push(`reveal empty-path ${res.status}: ${text.slice(0, 200)}`)
|
|
202
|
+
} catch (e) {
|
|
203
|
+
checks.revealEmptyPath = false
|
|
204
|
+
errors.push(`reveal fetch: ${String(e?.message ?? e).slice(0, 200)}`)
|
|
205
|
+
}
|
|
206
|
+
return { checks, errors }
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async function runCell(version) {
|
|
210
|
+
// 沙箱放系统临时目录(paste-dock 布局),证据目录留在仓内 .compat-results/。
|
|
211
|
+
// 教训(2026-10-04 首跑实证):沙箱嵌在仓内时,corepack pnpm 垫片按 cwd 向上
|
|
212
|
+
// 走查 packageManager pin 解析到 pnpm 9.x,宿主 CLI 的内部 `pnpm add` 在
|
|
213
|
+
// profile workspace 根触发 ERR_PNPM_ADDING_TO_ROOT;TEMP 下无 pin → corepack
|
|
214
|
+
// 默认 pnpm 12.x,与 paste-dock 全绿矩阵一致。
|
|
215
|
+
const cell = path.join(MATRIX, version)
|
|
216
|
+
await mkdir(cell, { recursive: true })
|
|
217
|
+
const sandboxRoot = await mkdtemp(path.join(tmpdir(), `dsh-tidy-display-compat-${version}-`))
|
|
218
|
+
const sandbox = path.join(sandboxRoot, 'sandbox')
|
|
219
|
+
const homeDir = path.join(sandbox, 'home')
|
|
220
|
+
const userProfile = path.join(sandbox, 'user')
|
|
221
|
+
const workspace = path.join(sandbox, 'workspace')
|
|
222
|
+
for (const dir of [sandbox, userProfile, workspace]) await mkdir(dir, { recursive: true })
|
|
223
|
+
const env = { ...process.env, DSH_HOME: homeDir, USERPROFILE: userProfile }
|
|
224
|
+
const checks = { version, notes: [], sandbox }
|
|
225
|
+
|
|
226
|
+
// 1-2. 宿主 tgz + 钉线安装(overrides 钉 cordis 五件套;pnpmfile 钉全部传递 dsh-*)
|
|
227
|
+
const hostTgz = await ensureTgz(version)
|
|
228
|
+
const cordis = cordisPin(version)
|
|
229
|
+
if (!existsSync(path.join(sandbox, 'node_modules', '@deepseek-ai', 'dsh', 'package.json'))) {
|
|
230
|
+
await writeFile(path.join(sandbox, 'package.json'), JSON.stringify({
|
|
231
|
+
name: 'dsh-host-cell',
|
|
232
|
+
private: true,
|
|
233
|
+
dependencies: { '@deepseek-ai/dsh': pathToFileURL(hostTgz).href },
|
|
234
|
+
}, null, 2))
|
|
235
|
+
await writeFile(path.join(sandbox, 'pnpm-workspace.yaml'), `packages:\n - .\nautoInstallPeers: true\nstrictPeerDependencies: false\noverrides:\n${Object.entries({ '@deepseek-ai/cordis': cordis, ...CORDIS_PLUGIN_PINS[cordis] }).map(([n, v]) => ` '${n}': '${v}'`).join('\n')}\n`)
|
|
236
|
+
await writeFile(path.join(sandbox, '.pnpmfile.cjs'), `const pinHostDependencies = ${pinHostDependencies.toString()};\nmodule.exports = { hooks: { readPackage: (pkg) => pinHostDependencies(pkg, ${JSON.stringify(version)}) } };\n`, 'utf8')
|
|
237
|
+
console.log(` install host ${version}(cordis 线 ${cordis})…`)
|
|
238
|
+
const installLog = run(sandbox, PNPM, INSTALL_ARGS, `install host ${version}`)
|
|
239
|
+
await writeFile(path.join(cell, 'install.log'), installLog.stdout ?? '')
|
|
240
|
+
}
|
|
241
|
+
checks.hostInstalled = JSON.parse(await readFile(path.join(sandbox, 'node_modules', '@deepseek-ai', 'dsh', 'package.json'), 'utf8')).version === version
|
|
242
|
+
if (!checks.hostInstalled) throw new Error(`宿主安装版本与格子不符: ${version}`)
|
|
243
|
+
const binJs = path.join(sandbox, 'node_modules', '@deepseek-ai', 'dsh', 'lib', 'bin.js')
|
|
244
|
+
|
|
245
|
+
// 3. 打插件包(lib 已入库,pack 无构建;npm pack 理由同 ensureTgz)→ 宿主 CLI 自建 profile 并装入(peer 闸咬合)
|
|
246
|
+
await run(ROOT, NPM, ['pack', '--pack-destination', cell, '--loglevel=error'], 'npm pack plugin')
|
|
247
|
+
const packed = (await readdir(cell)).find((f) => /^dsh-tidy-display-.*\.tgz$/.test(f))
|
|
248
|
+
if (!packed) throw new Error('插件 tgz 打包失败')
|
|
249
|
+
const pluginTgz = path.join(cell, packed)
|
|
250
|
+
const addRun = spawnSync(process.execPath, [binJs, 'plugin', '--profile', 'web', 'add', pluginTgz, REGISTRY], {
|
|
251
|
+
cwd: sandbox, encoding: 'utf8', shell: false, windowsHide: true, timeout: 10 * 60_000, env,
|
|
252
|
+
})
|
|
253
|
+
const addLog = `${addRun.stdout ?? ''}${addRun.stderr ?? ''}`
|
|
254
|
+
await writeFile(path.join(cell, 'plugin-add.log'), addLog)
|
|
255
|
+
checks.pluginAdded = addRun.status === 0
|
|
256
|
+
if (!checks.pluginAdded) {
|
|
257
|
+
if (COMPAT_BLOCK_RE.test(addLog)) {
|
|
258
|
+
checks.verdict = 'plugin-blocked'
|
|
259
|
+
checks.notes.push('plugin add 阶段 peer 闸拒绝')
|
|
260
|
+
await writeResult(cell, checks)
|
|
261
|
+
return checks
|
|
262
|
+
}
|
|
263
|
+
throw new Error(`dsh plugin add 失败(exit ${addRun.status})\n${addLog.slice(-600)}`)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// 4. 引导形态协商:A 形(--port 0 --no-open,0.1.0-rc.8+)→ C 形(裸启动)
|
|
267
|
+
const shapes = [
|
|
268
|
+
['A', ['--profile', 'web', '--port', '0', '--no-open']],
|
|
269
|
+
['C', ['--profile', 'web']],
|
|
270
|
+
]
|
|
271
|
+
let last = { outcome: {}, log: '', child: undefined }
|
|
272
|
+
let shapeUsed
|
|
273
|
+
for (const [shape, extra] of shapes) {
|
|
274
|
+
last = await bootOnce(binJs, workspace, env, extra, bootTimeoutSec)
|
|
275
|
+
shapeUsed = shape
|
|
276
|
+
await writeFile(path.join(cell, `boot-${shape}.log`), last.log)
|
|
277
|
+
if (last.outcome.ready || HMR_WALL_RE.test(last.log) || COMPAT_BLOCK_RE.test(last.log)) break
|
|
278
|
+
await stopHost(last.child)
|
|
279
|
+
if (shape === 'C') break
|
|
280
|
+
checks.notes.push(`A 形旗标不被 ${version} 接受,回退 C 形`)
|
|
281
|
+
}
|
|
282
|
+
const bootLog = last.log
|
|
283
|
+
|
|
284
|
+
// 5. 归因(日志签名)
|
|
285
|
+
checks.booted = Boolean(last.outcome.ready)
|
|
286
|
+
checks.bootShape = shapeUsed
|
|
287
|
+
if (!checks.booted) {
|
|
288
|
+
await stopHost(last.child)
|
|
289
|
+
if (HMR_WALL_RE.test(bootLog)) {
|
|
290
|
+
checks.verdict = 'host-blocked'
|
|
291
|
+
checks.notes.push('宿主 hmr 引导墙(date-wrapper 基座对照亦然)——宿主侧问题,非插件不兼容')
|
|
292
|
+
} else if (COMPAT_BLOCK_RE.test(bootLog)) {
|
|
293
|
+
checks.verdict = 'plugin-blocked'
|
|
294
|
+
checks.notes.push('boot 阶段 peer 闸拦截')
|
|
295
|
+
} else {
|
|
296
|
+
checks.verdict = 'plugin-blocked'
|
|
297
|
+
checks.notes.push(`未就绪且无已知签名(${last.outcome.exited ? `exit ${last.outcome.code}` : '超时'}),见 boot 日志`)
|
|
298
|
+
}
|
|
299
|
+
await writeResult(cell, checks)
|
|
300
|
+
return checks
|
|
301
|
+
}
|
|
302
|
+
checks.noMountError = !AUDIT_RE.test(bootLog)
|
|
303
|
+
checks.noDupContext = !bootLog.split('\n').some((line) => /tidy-display/.test(line) && DUP_RE.test(line))
|
|
304
|
+
checks.noCompatBlock = !COMPAT_BLOCK_RE.test(bootLog)
|
|
305
|
+
checks.loadedLogPresent = LOADED_RE.test(bootLog)
|
|
306
|
+
if (!checks.noMountError) checks.notes.push('挂载/审计错误签名')
|
|
307
|
+
if (!checks.noDupContext) checks.notes.push('疑似重名注册签名')
|
|
308
|
+
if (!checks.loadedLogPresent) checks.notes.push('宿主日志无插件 apply 正向签名(inject 未满足或挂载失活)')
|
|
309
|
+
|
|
310
|
+
// 6. HTTP 探针(宿主存活窗口内:就绪 URL 从横幅取;--port 0 时是随机端口真实地址)
|
|
311
|
+
try {
|
|
312
|
+
const match = bootLog.match(/http:\/\/(?:127\.0\.0\.1|localhost):\d+/)
|
|
313
|
+
if (!match) {
|
|
314
|
+
checks.routesProbed = false
|
|
315
|
+
checks.notes.push('横幅无可解析 URL,路由探针跳过')
|
|
316
|
+
} else {
|
|
317
|
+
const { checks: routeChecks, errors } = await probeRoutes(match[0])
|
|
318
|
+
Object.assign(checks, routeChecks)
|
|
319
|
+
checks.routesProbed = true
|
|
320
|
+
if (errors.length) checks.notes.push(...errors)
|
|
321
|
+
}
|
|
322
|
+
} finally {
|
|
323
|
+
await stopHost(last.child)
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
checks.green =
|
|
327
|
+
checks.noMountError && checks.noDupContext && checks.noCompatBlock && checks.loadedLogPresent &&
|
|
328
|
+
checks.skillStatus === true && checks.revealEmptyPath === true
|
|
329
|
+
checks.verdict = checks.green ? 'green' : 'plugin-blocked'
|
|
330
|
+
await writeResult(cell, checks)
|
|
331
|
+
return checks
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
async function writeResult(cell, checks) {
|
|
335
|
+
await writeFile(path.join(cell, 'result.json'), JSON.stringify(checks, null, 2) + '\n')
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// ── 主流程 ───────────────────────────────────────────────────────────────────
|
|
339
|
+
await mkdir(MATRIX, { recursive: true })
|
|
340
|
+
const results = []
|
|
341
|
+
for (const version of versions) {
|
|
342
|
+
const cellResult = path.join(MATRIX, version, 'result.json')
|
|
343
|
+
if (!force && existsSync(cellResult)) {
|
|
344
|
+
const prev = JSON.parse(await readFile(cellResult, 'utf8'))
|
|
345
|
+
if (prev.green || prev.verdict === 'host-blocked') {
|
|
346
|
+
console.log(`skip ${version}(已有结论 ${prev.verdict},--force 重跑)`)
|
|
347
|
+
results.push(prev)
|
|
348
|
+
continue
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
process.stdout.write(`cell ${version} … `)
|
|
352
|
+
try {
|
|
353
|
+
const checks = await runCell(version)
|
|
354
|
+
console.log(`${checks.verdict.toUpperCase()}${checks.notes.length ? `(${checks.notes.join(';')})` : ''}`)
|
|
355
|
+
results.push(checks)
|
|
356
|
+
} catch (error) {
|
|
357
|
+
console.log('ERROR')
|
|
358
|
+
const checks = { version, verdict: 'error', green: false, error: String(error.message ?? error) }
|
|
359
|
+
results.push(checks)
|
|
360
|
+
await mkdir(path.join(MATRIX, version), { recursive: true })
|
|
361
|
+
await writeResult(path.join(MATRIX, version), checks)
|
|
362
|
+
}
|
|
363
|
+
// 绿格即弃沙箱;红/错误格保留 TEMP 沙箱供复查(路径在 result.json 的 sandbox 字段)
|
|
364
|
+
const last = results.at(-1)
|
|
365
|
+
if (last?.green && last.sandbox && !keep) {
|
|
366
|
+
await rm(path.dirname(last.sandbox), { recursive: true, force: true, maxRetries: 3, retryDelay: 500 }).catch(() => {})
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const verified = results.filter((r) => r.green).map((r) => r.version)
|
|
371
|
+
const pluginBlocked = results.filter((r) => r.verdict === 'plugin-blocked').map((r) => r.version)
|
|
372
|
+
const hostBlocked = results.filter((r) => r.verdict === 'host-blocked').map((r) => r.version)
|
|
373
|
+
await writeFile(path.join(RESULTS, 'results.json'), JSON.stringify({ generatedAt: new Date().toISOString(), results }, null, 2) + '\n')
|
|
374
|
+
await writeFile(path.join(RESULTS, 'verified.json'), JSON.stringify({ generatedAt: new Date().toISOString(), verified, pluginBlocked, hostBlocked }, null, 2) + '\n')
|
|
375
|
+
console.log(`\n绿 ${verified.length}/${results.length}: ${verified.join(', ') || '(无)'}`)
|
|
376
|
+
if (pluginBlocked.length) console.log(`插件不兼容 ${pluginBlocked.length}: ${pluginBlocked.join(', ')}`)
|
|
377
|
+
if (hostBlocked.length) console.log(`宿主阻塞(不可判定)${hostBlocked.length}: ${hostBlocked.join(', ')}`)
|
|
378
|
+
if (!only) console.log('下一步:node scripts/sync-hosts.mjs --write # 把 verified 清单下发七语 README')
|
package/src/client/index.tsx
CHANGED
|
@@ -84,19 +84,22 @@ export function apply(ctx: Context): void {
|
|
|
84
84
|
},
|
|
85
85
|
}, () => document.querySelector('[data-conversation-scroll]'));
|
|
86
86
|
|
|
87
|
-
//
|
|
88
|
-
//
|
|
87
|
+
// 原生「对话」视图的轨挂载:轨语义按视图分流(2026-10-05 用户裁定)——
|
|
88
|
+
// 阅读视图恒用本轨(官方 TurnNavigator 在阅读视图下不挂载);对话视图由
|
|
89
|
+
// 「接管官方消息轨」开关决定:开 = 本轨替换官方轨,关 = 官方轨(本轨让位,
|
|
90
|
+
// 否则两条右缘轨重叠)。这里的 enabled 因此是 railEnabled && hideOfficialNav。
|
|
89
91
|
function NativeRailView(): React.ReactElement | null {
|
|
90
92
|
const snap = React.useSyncExternalStore(prefs.subscribe, () => prefs.getSnapshot());
|
|
91
93
|
const loadEarlierPattern = /^(加载更早|Load earlier|Load older)/;
|
|
92
94
|
const hasMore = [...document.querySelectorAll('button')]
|
|
93
95
|
.some((b) => loadEarlierPattern.test((b.textContent || '').trim()));
|
|
96
|
+
const takeover = snap.hideOfficialNav !== false;
|
|
94
97
|
return React.createElement(RailView, {
|
|
95
|
-
enabled: snap.railEnabled !== false,
|
|
98
|
+
enabled: snap.railEnabled !== false && takeover,
|
|
96
99
|
side: snap.railSide === 'right' ? 'right' : 'left',
|
|
97
100
|
style: snap.railStyle === 'dot' ? 'dot' : 'bar',
|
|
98
101
|
ring: snap.railRing === true,
|
|
99
|
-
hideOfficialNav:
|
|
102
|
+
hideOfficialNav: takeover,
|
|
100
103
|
hasMore,
|
|
101
104
|
loadOlder: () => {
|
|
102
105
|
const btn = [...document.querySelectorAll('button')]
|