@hugesb/dsh-stream-agent 0.0.0-stage → 0.3.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.
- package/CHANGELOG.md +497 -0
- package/CONTRIBUTING.md +72 -0
- package/LICENSE +202 -0
- package/README.en.md +349 -0
- package/README.md +300 -3
- package/cordis.patch.yml +77 -0
- package/dist/entry/action-gate.js +206 -0
- package/dist/entry/adapter-kit.js +192 -0
- package/dist/entry/context-render.js +119 -0
- package/dist/entry/control-bar-cli.js +289 -0
- package/dist/entry/control-bar.js +123 -0
- package/dist/entry/control-session.js +115 -0
- package/dist/entry/control-state.js +125 -0
- package/dist/entry/cordis-compat.js +95 -0
- package/dist/entry/eval-probe.js +112 -0
- package/dist/entry/intent-log.js +121 -0
- package/dist/entry/json-persistence.js +306 -0
- package/dist/entry/loop.js +3852 -0
- package/dist/entry/mock-provider.js +536 -0
- package/dist/entry/obs-broker.js +178 -0
- package/dist/entry/ptc-bridge.js +405 -0
- package/dist/entry/state-handle.js +217 -0
- package/dist/entry/takeover-registry.js +60 -0
- package/dist/kernel/control-bar.js +559 -0
- package/dist/kernel/final.js +62 -0
- package/dist/kernel/gate.js +464 -0
- package/dist/kernel/modes.js +253 -0
- package/dist/kernel/obs.js +517 -0
- package/dist/kernel/parser.js +632 -0
- package/dist/kernel/render.js +444 -0
- package/dist/kernel/state.js +416 -0
- package/dist/version.js +9 -0
- package/docs/TEST-PROPOSITIONS.md +139 -0
- package/docs/adr-001-segment-boundary.md +61 -0
- package/docs/architecture.md +104 -0
- package/docs/desktop-ui-feasibility.md +277 -0
- package/docs/disabled-lines-audit.md +53 -0
- package/docs/limitations.md +181 -0
- package/docs/protocol.md +99 -0
- package/docs/v0.4.0-plan.md +50 -0
- package/eval/METRICS.md +128 -0
- package/eval/RESULTS.md +246 -0
- package/eval/tasks/fixtures/big-report.md +298 -0
- package/eval/tasks/fixtures/build-manifest.txt +5 -0
- package/eval/tasks/fixtures/deploy.yaml +4 -0
- package/eval/tasks/fixtures/error.log +200 -0
- package/eval/tasks/fixtures/features.yaml +4 -0
- package/eval/tasks/fixtures/pipeline.yaml +4 -0
- package/eval/tasks/fixtures/sales-q1.csv +61 -0
- package/eval/tasks/fixtures/settings.yaml +4 -0
- package/eval/tasks/fixtures/users-roster.json +304 -0
- package/eval/tasks/fixtures/users-scores.json +20 -0
- package/eval/tasks/gen-fixtures.cjs +80 -0
- package/eval/tasks/tasks.json +150 -0
- package/eval/tools/f6-kill-drill.cjs +176 -0
- package/eval/tools/f6-kill-drill.worker.cjs +131 -0
- package/eval/tools/gen-results.cjs +191 -0
- package/eval/tools/machine-test.cjs +200 -0
- package/eval/tools/manual-code-scenarios.md +59 -0
- package/eval/tools/replay-check.cjs +311 -0
- package/eval/tools/runner.cjs +219 -0
- package/eval/tools/session-log.cjs +106 -0
- package/eval/tools/summarize.cjs +185 -0
- package/eval/tools/t3-cells.cjs +173 -0
- package/package.json +73 -6
- package/patches/adapters-smoke.yml +41 -0
- package/patches/eval-account.yml +36 -0
- package/patches/eval-baseline.yml +33 -0
- package/patches/eval-stream-code-off.yml +46 -0
- package/patches/eval-stream-code-on.yml +47 -0
- package/patches/eval-stream.yml +54 -0
- package/patches/takeover.yml +42 -0
- package/patches/test-preset.yml +23 -0
- package/preset/stream/cordis.patch.yml +39 -0
- package/preset/stream/package.json +13 -0
- package/preset.yml +56 -0
- package/profiles/stream/README.md +66 -0
- package/profiles/stream/cordis.patch.yml +12 -0
- package/profiles/stream/package.json +17 -0
- package/profiles/stream-headless/package.json +16 -0
- package/scripts/build.mjs +103 -0
- package/scripts/check-consistency.mjs +146 -0
- package/scripts/gate.mjs +138 -0
- package/scripts/install-check.mjs +116 -0
- package/scripts/install-cycle.mjs +88 -0
- package/scripts/release.mjs +415 -0
- package/scripts/repair-session-logs.mjs +403 -0
- package/src/entry/action-gate.ts +206 -0
- package/src/entry/adapter-kit.ts +192 -0
- package/src/entry/context-render.ts +119 -0
- package/src/entry/control-bar-cli.ts +289 -0
- package/src/entry/control-bar.ts +123 -0
- package/src/entry/control-session.ts +115 -0
- package/src/entry/control-state.ts +125 -0
- package/src/entry/cordis-compat.ts +95 -0
- package/src/entry/eval-probe.ts +112 -0
- package/src/entry/intent-log.ts +121 -0
- package/src/entry/json-persistence.ts +306 -0
- package/src/entry/loop.ts +3852 -0
- package/src/entry/mock-provider.ts +536 -0
- package/src/entry/obs-broker.ts +178 -0
- package/src/entry/ptc-bridge.ts +405 -0
- package/src/entry/state-handle.ts +217 -0
- package/src/entry/takeover-registry.ts +60 -0
- package/src/kernel/control-bar.ts +559 -0
- package/src/kernel/final.ts +62 -0
- package/src/kernel/gate.ts +464 -0
- package/src/kernel/modes.ts +253 -0
- package/src/kernel/obs.ts +517 -0
- package/src/kernel/parser.ts +632 -0
- package/src/kernel/render.ts +444 -0
- package/src/kernel/state.ts +416 -0
- package/src/version.ts +9 -0
- package/test/activation.test.ts +187 -0
- package/test/adapters.test.ts +676 -0
- package/test/control-bar.test.ts +486 -0
- package/test/desktop-ui.test.ts +359 -0
- package/test/eval-probe.test.ts +139 -0
- package/test/f5-plan.test.ts +221 -0
- package/test/f6-intent.test.ts +168 -0
- package/test/f7-segment.test.ts +190 -0
- package/test/fix-limits.test.ts +599 -0
- package/test/gate.test.ts +380 -0
- package/test/helpers/stub-loop.ts +240 -0
- package/test/kernel/obs.test.ts +329 -0
- package/test/kernel/parser.test.ts +450 -0
- package/test/loop.test.ts +1393 -0
- package/test/mock-provider.test.ts +386 -0
- package/test/ptc-bridge.test.ts +356 -0
- package/test/render.test.ts +418 -0
- package/test/s2-install-check.test.ts +46 -0
- package/test/scenarios/3-file-basic.json +13 -0
- package/test/scenarios/5-file-basic.json +22 -0
- package/test/scenarios/burn-more.json +9 -0
- package/test/scenarios/degraded-final.json +10 -0
- package/test/scenarios/fault-abort-xml.json +11 -0
- package/test/scenarios/fault-malformed-command.json +12 -0
- package/test/scenarios/fault-midstream-abort.json +11 -0
- package/test/scenarios/fault-saturating-output.json +9 -0
- package/test/scenarios/fault-timeout.json +9 -0
- package/test/scenarios/peek-first.json +11 -0
- package/test/scenarios/peek-second.json +11 -0
- package/test/scenarios/peek-third.json +10 -0
- package/test/scenarios/recover-final.json +10 -0
- package/test/scenarios/reroute-first.json +17 -0
- package/test/scenarios/reroute-second.json +16 -0
- package/test/scenarios/starvation-final.json +10 -0
- package/test/scenarios/starvation-promote.json +11 -0
- package/test/scenarios/wait-tools-continue.json +10 -0
- package/test/scenarios/wait-tools-xml.json +22 -0
- package/test/scenarios/wait-tools.json +15 -0
- package/test/session-format.test.ts +234 -0
- package/test/state.test.ts +335 -0
- package/test/stream-v02.test.ts +264 -0
- package/test/v031-display.test.ts +333 -0
- package/ui/client.js +576 -0
- package/ui/index.js +282 -0
- package/ui/package.json +26 -0
package/preset.yml
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# preset.yml —— @hugesb/dsh-stream-agent 生产装配清单
|
|
2
|
+
#
|
|
3
|
+
# 这里只做声明式装配(装什么、装几个、依赖谁),不承载 loop 接管:接管走全局
|
|
4
|
+
# AgentRegistry.setFactory 槽位,由 cordis.patch.yml(bundle 层)或 patches/takeover.yml
|
|
5
|
+
# 完成。preset 的嵌套行在 agent 创建路径上没有消费点,关键行藏进 preset 会静默失败。
|
|
6
|
+
#
|
|
7
|
+
# 入口清单(全部引用构建产物 dist/*.js,由 npm run build 生成):
|
|
8
|
+
# loop.ts AgentFactory + 单流协议驱动器(主 entry)
|
|
9
|
+
# state-handle.ts ctx.state 服务:句柄、blob 落 storage、resume 重建
|
|
10
|
+
# obs-broker.ts 工具结果出口登记 + llm/stream 泄漏扫描(依赖 state 服务)
|
|
11
|
+
# action-gate.ts ToolsService guard:spec 暂存、一次性凭据、deny 层
|
|
12
|
+
# context-render.ts O6 preflight 前缀断言
|
|
13
|
+
# control-bar.ts 控制栏:装载横幅 + 模式/语言状态(v0.2.1)
|
|
14
|
+
# ui/index.js 桌面控制页的宿主半边(独立子包,含 dsh.client 的浏览器半边)
|
|
15
|
+
# mock-provider.ts 离线假模型——测试专用,绝不进本文件
|
|
16
|
+
#
|
|
17
|
+
# 装载顺序(与 cordis.patch.yml 同一纪律):四个 sidecar 先行,control-bar / ui 其后,
|
|
18
|
+
# loop 最后——loop 接管后单流若很快终止,进程退出会截断尚未挂载 entry 的激活。
|
|
19
|
+
# state-handle 必须先于 obs-broker(后者 inject 'state')。
|
|
20
|
+
# 每行都要显式写 inject:loader 只读行选项,模块导出的 inject 不进 patch 行。
|
|
21
|
+
|
|
22
|
+
- insert:
|
|
23
|
+
- id: stream-agent-state
|
|
24
|
+
name: ./dist/entry/state-handle.js
|
|
25
|
+
inject: [storage]
|
|
26
|
+
config:
|
|
27
|
+
unit: tfAgentState
|
|
28
|
+
- id: stream-agent-obs-broker
|
|
29
|
+
name: ./dist/entry/obs-broker.js
|
|
30
|
+
inject: [tools, state]
|
|
31
|
+
config: {}
|
|
32
|
+
- id: stream-agent-action-gate
|
|
33
|
+
name: ./dist/entry/action-gate.js
|
|
34
|
+
inject: [tools, storage]
|
|
35
|
+
config: {}
|
|
36
|
+
- id: stream-agent-context-render
|
|
37
|
+
name: ./dist/entry/context-render.js
|
|
38
|
+
inject: []
|
|
39
|
+
config: {}
|
|
40
|
+
- id: stream-agent-control-bar
|
|
41
|
+
name: ./dist/entry/control-bar.js
|
|
42
|
+
inject: []
|
|
43
|
+
config:
|
|
44
|
+
announce: true
|
|
45
|
+
- id: stream-agent-ui
|
|
46
|
+
name: ./ui/index.js
|
|
47
|
+
inject: []
|
|
48
|
+
- id: stream-agent
|
|
49
|
+
name: ./dist/entry/loop.js
|
|
50
|
+
inject: [llm, tools, agents, sessions, sessionProjections]
|
|
51
|
+
config:
|
|
52
|
+
maxParallelToolCalls: 3
|
|
53
|
+
maxReentries: 8
|
|
54
|
+
streamIdleTimeoutMs: 30000
|
|
55
|
+
# K1(0.3.0):tf-code 默认关闭;显式开启见 docs/protocol.md(前提 K2–K6)。
|
|
56
|
+
enableCode: false
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# stream 专用 profile —— 安装、选择、卸载、回退(S1/S2/S4/S6)
|
|
2
|
+
|
|
3
|
+
本目录是 `dsh-stream-agent` 独立模式(A-1)的专用 profile 模板。核心事实:**插件只允许
|
|
4
|
+
装进专用 profile**;`web` / `desktop` 等既有 profile 会被安装前置校验拒绝(S2)。
|
|
5
|
+
|
|
6
|
+
## 组合层次(顺序即契约,改变顺序视为装配变更需重新验收)
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
@deepseek-ai/dsh-base ← 服务层(llm/session/tools/sandbox/ptc-runtime…)
|
|
10
|
+
@hugesb/dsh-stream-agent ← 主 bundle(停用 agent-loop + 7 个 entry,loop 最后)
|
|
11
|
+
@hugesb/dsh-stream-agent-preset-stream ← preset bundle(S4:只声明映射工具面;仅 web 变体)
|
|
12
|
+
@deepseek-ai/dsh-web-app ← 入口(web 变体);headless 变体用 @deepseek-ai/dsh-headless
|
|
13
|
+
profile cordis.patch.yml ← 只承载覆盖声明(registry default → stream),不接管 loop
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- `agent-loop` 的停用**只在主 bundle 的 cordis.patch.yml**——`plugin remove` 整层消失,
|
|
17
|
+
卸载原子(C4)。本目录的 patch 层永远不出现停用行。
|
|
18
|
+
- headless 变体(`profiles/stream-headless/`)不引入 preset bundle:宿主 headless 无
|
|
19
|
+
preset registry,工具面由 profile 决定。
|
|
20
|
+
|
|
21
|
+
## 安装(web 入口变体)
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# 1. 复制模板到宿主 profiles 目录(版本精确锁定;不用 ^/~ 浮动范围)
|
|
25
|
+
cp -r profiles/stream "$HOME/.dsh/profiles/stream"
|
|
26
|
+
# 2. 本地开发用 link:(模板默认);npm 安装改为精确版本号:
|
|
27
|
+
# "@hugesb/dsh-stream-agent": "0.3.0"
|
|
28
|
+
# "@hugesb/dsh-stream-agent-preset-stream": "0.3.0"(npm 源未发布该子包前用 link:/复制目录)
|
|
29
|
+
# 3. 前置校验(S2):目标 profile 必须在允许列表(stream / stream-headless)
|
|
30
|
+
node scripts/install-check.mjs --profile "$HOME/.dsh/profiles/stream" --dry-run
|
|
31
|
+
# 4. 在 profile 内安装依赖后启动自证:
|
|
32
|
+
dsh --profile stream --version
|
|
33
|
+
dsh --profile stream # 装载横幅应含 TAKEOVER-ACTIVE … code=off … profile=stream
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
选择:启动时 `dsh --profile stream`(web 入口)或 `dsh --profile stream-headless`。
|
|
37
|
+
**不要**把本插件 `plugin add` 进 web / desktop——`install-check` 会拒绝,宿主侧也会以
|
|
38
|
+
`E_DOUBLE_LOOP` 具名失败(S3:双 loop 冲突必须具名失败,不静默共存)。
|
|
39
|
+
|
|
40
|
+
## 卸载与回退(S6)
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# 卸载插件(bundle 层整层消失,宿主 agent-loop 原子恢复)
|
|
44
|
+
dsh plugin remove @hugesb/dsh-stream-agent --profile stream
|
|
45
|
+
# 完全移除:删除 profile 目录(含 preset bundle 与状态文件引用)
|
|
46
|
+
rm -rf "$HOME/.dsh/profiles/stream"
|
|
47
|
+
# 装卸回归(有真实宿主的机器):
|
|
48
|
+
node scripts/install-cycle.mjs --dsh dsh --profile stream --rounds 10
|
|
49
|
+
# 回退到旧版本产物:回退 0.2.x tag 产物(git checkout v0.2.1 后重复安装步骤),
|
|
50
|
+
# 不把新版本装进既有 profile——那是 B 形态,不是本插件的交付形态。
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
卸载验证清单(每轮装卸后):宿主 loop 恢复(横幅无 TAKEOVER-ACTIVE)、web 能创建会话、
|
|
54
|
+
无 `stream-agent-*` 残留 entry、`agent-loop` 重新可用。
|
|
55
|
+
|
|
56
|
+
## 版本锁定
|
|
57
|
+
|
|
58
|
+
profile 依赖必须精确锁定(不用 `^` / `~`);宿主版本与本插件版本的对应关系记录在
|
|
59
|
+
主包 `package.json` 的 `engines`(`dsh >= 0.2.2-rc.1`)。升级插件 = 改精确版本号 +
|
|
60
|
+
重跑 `install-check --dry-run` + 一轮装卸演练,不做"浮动升级"。
|
|
61
|
+
|
|
62
|
+
## 安全边界声明
|
|
63
|
+
|
|
64
|
+
profile/preset 只是**组合边界**,不是安全边界:YAML 与插件仍执行宿主代码。安全声明
|
|
65
|
+
只能引用 sandbox 事实(`docs/limitations.md`)——`tf-code` 的沙箱只覆盖文件效果,
|
|
66
|
+
Windows 档报告 `partial`,不承诺网络/进程隔离。
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# stream profile 的 patch 层(S1)——只承载"覆盖声明",不接管 loop。
|
|
2
|
+
#
|
|
3
|
+
# 红线(C4):本文件不得出现 agent-loop 的停用行——停用必须留在主 bundle 的
|
|
4
|
+
# cordis.patch.yml(plugin remove 整层消失,卸载原子)。这里唯一要做的覆盖是
|
|
5
|
+
# 把 preset registry 的默认 preset 指向 stream(S4)。
|
|
6
|
+
#
|
|
7
|
+
# 本层在全部 bundle 层之后应用(宿主 profile 语义),因此下面的 config 覆盖
|
|
8
|
+
# 能命中 dsh-web-app 插入的 agent-preset-registry 行。
|
|
9
|
+
|
|
10
|
+
- id: agent-preset-registry
|
|
11
|
+
config:
|
|
12
|
+
default: stream
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-profile-stream",
|
|
3
|
+
"private": true,
|
|
4
|
+
"description": "S1 专用 profile 模板(A-1 独立模式):dsh-base → 本插件主 bundle → preset-stream bundle → web 入口。安装/卸载/回退见同目录 README.md。",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@hugesb/dsh-stream-agent": "link:../..",
|
|
7
|
+
"@hugesb/dsh-stream-agent-preset-stream": "link:../../preset/stream"
|
|
8
|
+
},
|
|
9
|
+
"dsh": {
|
|
10
|
+
"profile": {
|
|
11
|
+
"bundles": [
|
|
12
|
+
"@deepseek-ai/dsh-base",
|
|
13
|
+
"@deepseek-ai/dsh-web-app"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-profile-stream-headless",
|
|
3
|
+
"private": true,
|
|
4
|
+
"description": "S1 专用 profile 模板(headless 入口变体):dsh-base → 本插件主 bundle → headless 入口。headless 不引入 preset(宿主无 registry;工具面由 profile 决定)。",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@hugesb/dsh-stream-agent": "link:../.."
|
|
7
|
+
},
|
|
8
|
+
"dsh": {
|
|
9
|
+
"profile": {
|
|
10
|
+
"bundles": [
|
|
11
|
+
"@deepseek-ai/dsh-base",
|
|
12
|
+
"@deepseek-ai/dsh-headless"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// scripts/build.mjs —— 零依赖构建:Node 24 原生 stripTypeScriptTypes → dist/
|
|
2
|
+
//
|
|
3
|
+
// 宿主 loader 只加载 .js(patches/test-preset.yml 引 ../dist/entry/mock-provider.js 的先例,
|
|
4
|
+
// 05 号 results §4),因此 src/*.ts 需要产出 dist/*.js:
|
|
5
|
+
// 1. module.stripTypeScriptTypes(code, { mode: 'strip' }) 擦除类型
|
|
6
|
+
// (本包无 enum/namespace/参数属性,strip 模式安全;出现不可擦除语法会快速报错)
|
|
7
|
+
// 2. 相对 import/export 的 .ts 后缀重写为 .js(Node ESM 不解析 .ts 说明符)
|
|
8
|
+
// 3. 产物导入冒烟:dist/entry/loop.js 与 dist/entry/mock-provider.js 必须可加载
|
|
9
|
+
//
|
|
10
|
+
// 用法:npm run build
|
|
11
|
+
|
|
12
|
+
import { stripTypeScriptTypes } from 'node:module';
|
|
13
|
+
import { mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
14
|
+
import { dirname, join, relative, resolve } from 'node:path';
|
|
15
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
16
|
+
|
|
17
|
+
const pkgRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
18
|
+
const srcRoot = join(pkgRoot, 'src');
|
|
19
|
+
const distRoot = join(pkgRoot, 'dist');
|
|
20
|
+
|
|
21
|
+
function listTs(dir) {
|
|
22
|
+
const out = [];
|
|
23
|
+
for (const name of readdirSync(dir, { withFileTypes: true })) {
|
|
24
|
+
const full = join(dir, name.name);
|
|
25
|
+
if (name.isDirectory()) out.push(...listTs(full));
|
|
26
|
+
else if (name.name.endsWith('.ts')) out.push(full);
|
|
27
|
+
}
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** 相对说明符 .ts → .js(仅 import/export 的 from '...' 子句;本包无动态相对导入) */
|
|
32
|
+
function rewriteSpecifiers(code) {
|
|
33
|
+
return code.replace(
|
|
34
|
+
/(from\s+|import\s*\(\s*)(['"])(\.\.?\/[^'"]+)\.ts\2/g,
|
|
35
|
+
(_m, head, quote, path) => `${head}${quote}${path}.js${quote}`,
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
rmSync(distRoot, { recursive: true, force: true });
|
|
40
|
+
const files = listTs(srcRoot);
|
|
41
|
+
for (const file of files) {
|
|
42
|
+
const rel = relative(srcRoot, file);
|
|
43
|
+
const outPath = join(distRoot, rel.replace(/\.ts$/, '.js'));
|
|
44
|
+
const code = readFileSync(file, 'utf8');
|
|
45
|
+
let js;
|
|
46
|
+
try {
|
|
47
|
+
js = stripTypeScriptTypes(code, { mode: 'strip' });
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error(`[build] 类型擦除失败(不可擦除语法): ${rel}\n${error.message}`);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
js = rewriteSpecifiers(js);
|
|
53
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
54
|
+
writeFileSync(outPath, js, 'utf8');
|
|
55
|
+
console.log(`[build] ${rel} -> dist/${rel.replace(/\.ts$/, '.js')}`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 冒烟:产物必须能作为 ESM 加载(kernel 零依赖;entry 动态 import 有 try/catch 包裹)
|
|
59
|
+
for (const entry of ['dist/kernel/state.js', 'dist/kernel/obs.js', 'dist/kernel/parser.js', 'dist/kernel/gate.js', 'dist/kernel/render.js', 'dist/entry/mock-provider.js', 'dist/entry/loop.js', 'dist/entry/adapter-kit.js', 'dist/entry/state-handle.js', 'dist/entry/obs-broker.js', 'dist/entry/action-gate.js', 'dist/entry/context-render.js', 'dist/entry/eval-probe.js', 'dist/kernel/modes.js', 'dist/kernel/control-bar.js', 'dist/entry/control-state.js', 'dist/entry/control-bar.js', 'dist/entry/control-session.js', 'dist/entry/control-bar-cli.js', 'dist/version.js']) {
|
|
60
|
+
try {
|
|
61
|
+
await import(pathToFileURL(join(pkgRoot, entry)).href);
|
|
62
|
+
console.log(`[build] smoke import OK: ${entry}`);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
console.error(`[build] smoke import FAILED: ${entry}\n${error.message}`);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
console.log(`[build] done: ${files.length} files`);
|
|
69
|
+
|
|
70
|
+
// 桌面控制页的子包完整性:dsh-client-modules 以“包”为单位扫描 dsh.client,
|
|
71
|
+
// 主包已被六个 entry 引用——主包若声明 dsh.client 会直接抛多源错误,整页 boot 失败。
|
|
72
|
+
const rootPkg = JSON.parse(readFileSync(join(pkgRoot, 'package.json'), 'utf8'));
|
|
73
|
+
const uiPkg = JSON.parse(readFileSync(join(pkgRoot, 'ui', 'package.json'), 'utf8'));
|
|
74
|
+
if (rootPkg.dsh?.client !== undefined) {
|
|
75
|
+
console.error('[build] 主包不得声明 dsh.client:会与六个 entry 形成多个 Loader 源,dsh-client-modules 装载期抛错');
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
if (uiPkg.dsh?.client?.platform !== 'web' || uiPkg.exports?.['./client'] === undefined) {
|
|
79
|
+
console.error('[build] ui/package.json 必须声明 dsh.client.platform = "web" 且导出 "./client"');
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
await import(pathToFileURL(join(pkgRoot, 'ui', 'index.js')).href);
|
|
85
|
+
console.log('[build] smoke import OK: ui/index.js');
|
|
86
|
+
} catch (error) {
|
|
87
|
+
console.error(`[build] smoke import FAILED: ui/index.js\n${error.message}`);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// 浏览器半边不执行(顶层 window 由客户端提供),只做语法闸门 + 协议标记检查。
|
|
92
|
+
const clientSource = readFileSync(join(pkgRoot, 'ui', 'client.js'), 'utf8');
|
|
93
|
+
try {
|
|
94
|
+
new Function(clientSource);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error(`[build] ui/client.js 语法错误(会让整个客户端 boot 失败)\n${error.message}`);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
if (!clientSource.includes('window.__ModuleLoader__.load') || !clientSource.includes('"@hugesb/dsh-stream-agent-ui"')) {
|
|
100
|
+
console.error('[build] ui/client.js 缺少 __ModuleLoader__ 包装或模块 id 不匹配');
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
console.log('[build] client bundle OK: ui/client.js');
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// scripts/check-consistency.mjs —— R2 装配与文档一致性检查(4 项,可一条命令复跑)
|
|
2
|
+
//
|
|
3
|
+
// 用法:npm run check(= node scripts/check-consistency.mjs)
|
|
4
|
+
//
|
|
5
|
+
// 四项检查(任一失败退出码 1,不允许"人工确认后放行"):
|
|
6
|
+
// 1. entry 集:cordis.patch.yml 与 preset.yml 的 entry id 集合一致;agent-loop 停用行
|
|
7
|
+
// 只在主 bundle patch(C4);mock-provider / eval-probe 不进装配(红线)。
|
|
8
|
+
// 2. inject:两份清单同名 entry 的 inject 数组一致;可选服务(ptcRuntime 等)不得进
|
|
9
|
+
// inject(v0.2.1 教训:可选服务进 inject 会挂起 entry)。
|
|
10
|
+
// 3. 装载顺序:两份清单的行序一致(sidecar → control-bar → ui → loop)。
|
|
11
|
+
// 4. README 数字:README.md / README.en.md 的测试用例数与 npm test 实际数一致、
|
|
12
|
+
// dist 文件数与 build 产物一致、命令表含全部 tf-* 命令(含 0.3.0 新命令)。
|
|
13
|
+
|
|
14
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
15
|
+
import { fileURLToPath } from 'node:url';
|
|
16
|
+
import { dirname, join, resolve } from 'node:path';
|
|
17
|
+
|
|
18
|
+
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
const pkgRoot = resolve(scriptDir, '..');
|
|
20
|
+
|
|
21
|
+
const failures = [];
|
|
22
|
+
const notes = [];
|
|
23
|
+
|
|
24
|
+
// --- 极小 YAML 行读取(本仓库 patch 文件是规则形态:"- id: X / name: Y / inject: [...] /
|
|
25
|
+
// disabled: true / config:",缩进固定;不引第三方依赖) ---
|
|
26
|
+
function readRows(file) {
|
|
27
|
+
if (!existsSync(file)) return [];
|
|
28
|
+
const rows = [];
|
|
29
|
+
let current = null;
|
|
30
|
+
for (const raw of readFileSync(file, 'utf8').split('\n')) {
|
|
31
|
+
const line = raw.replace(/\t/g, ' ');
|
|
32
|
+
const idMatch = line.match(/^\s*-\s+id:\s*(\S+)\s*$/);
|
|
33
|
+
if (idMatch !== null) {
|
|
34
|
+
if (current !== null) rows.push(current);
|
|
35
|
+
current = { id: idMatch[1], name: undefined, inject: [], disabled: false };
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (current === null) continue;
|
|
39
|
+
const nameMatch = line.match(/^\s*name:\s*(\S+)\s*$/);
|
|
40
|
+
if (nameMatch !== null) {
|
|
41
|
+
current.name = nameMatch[1];
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const injectMatch = line.match(/^\s*inject:\s*\[([^\]]*)\]\s*$/);
|
|
45
|
+
if (injectMatch !== null) {
|
|
46
|
+
current.inject = injectMatch[1].split(',').map((s) => s.trim()).filter((s) => s !== '');
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (/^\s*disabled:\s*true\s*$/.test(line)) current.disabled = true;
|
|
50
|
+
}
|
|
51
|
+
if (current !== null) rows.push(current);
|
|
52
|
+
return rows;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function insertRows(file) {
|
|
56
|
+
// preset.yml / patch 的行都在 "- insert:" 下:readRows 直接吃 "- id:" 即可
|
|
57
|
+
return readRows(file);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const patchRows = insertRows(join(pkgRoot, 'cordis.patch.yml'));
|
|
61
|
+
const presetRows = insertRows(join(pkgRoot, 'preset.yml'));
|
|
62
|
+
|
|
63
|
+
// ---- 检查 1:entry 集 ----
|
|
64
|
+
{
|
|
65
|
+
const patchIds = patchRows.filter((r) => r.id !== 'agent-loop').map((r) => r.id);
|
|
66
|
+
const presetIds = presetRows.map((r) => r.id);
|
|
67
|
+
const onlyPatch = patchIds.filter((id) => !presetIds.includes(id));
|
|
68
|
+
const onlyPreset = presetIds.filter((id) => !patchIds.includes(id));
|
|
69
|
+
if (onlyPatch.length > 0 || onlyPreset.length > 0) {
|
|
70
|
+
failures.push(`检查1 entry 集不一致:patch 独有 [${onlyPatch}],preset 独有 [${onlyPreset}]`);
|
|
71
|
+
} else {
|
|
72
|
+
notes.push(`检查1 entry 集:${patchIds.length} 个,两份清单一致`);
|
|
73
|
+
}
|
|
74
|
+
const loopRow = patchRows.find((r) => r.id === 'agent-loop');
|
|
75
|
+
if (loopRow === undefined || !loopRow.disabled) {
|
|
76
|
+
failures.push('检查1 agent-loop 停用行缺失或未 disabled(C4:停用必须留在 bundle 层)');
|
|
77
|
+
}
|
|
78
|
+
const presetDisabled = patchRows.find((r) => r.id === 'agent-loop' && r.disabled);
|
|
79
|
+
void presetDisabled;
|
|
80
|
+
for (const forbidden of ['mock-provider', 'eval-probe']) {
|
|
81
|
+
if (patchRows.some((r) => (r.name ?? '').includes(forbidden)) || presetRows.some((r) => (r.name ?? '').includes(forbidden))) {
|
|
82
|
+
failures.push(`检查1 测试设施 ${forbidden} 不得进入装配清单(红线)`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ---- 检查 2:inject 一致 + 可选服务不进 inject ----
|
|
88
|
+
// sessionProjections 不在禁列表:宿主(dsh >= 0.2.2-rc.1)在 web/headless 两个入口都常挂
|
|
89
|
+
// 该服务,0.2.1 真机验证过的装配形态就含它(modelSelection 投影依赖);其余四个是真可选。
|
|
90
|
+
{
|
|
91
|
+
const OPTIONAL_SERVICES = new Set(['ptcRuntime', 'loader', 'agentDefaultModel', 'logger']);
|
|
92
|
+
for (const row of [...patchRows, ...presetRows]) {
|
|
93
|
+
const bad = row.inject.filter((s) => OPTIONAL_SERVICES.has(s));
|
|
94
|
+
if (bad.length > 0) failures.push(`检查2 可选服务不得进 inject(cordis 必需语义会挂起 entry):${row.id} → ${bad.join(',')}`);
|
|
95
|
+
}
|
|
96
|
+
for (const id of presetRows.map((r) => r.id)) {
|
|
97
|
+
const a = patchRows.find((r) => r.id === id);
|
|
98
|
+
const b = presetRows.find((r) => r.id === id);
|
|
99
|
+
if (a !== undefined && b !== undefined && JSON.stringify(a.inject) !== JSON.stringify(b.inject)) {
|
|
100
|
+
failures.push(`检查2 inject 不一致:${id} patch=${JSON.stringify(a.inject)} preset=${JSON.stringify(b.inject)}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
notes.push('检查2 inject:逐 entry 对比一致;可选服务不在 inject');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// ---- 检查 3:装载顺序一致 ----
|
|
107
|
+
{
|
|
108
|
+
const order = (rows) => rows.filter((r) => r.id !== 'agent-loop').map((r) => r.id).join(' → ');
|
|
109
|
+
if (order(patchRows) !== order(presetRows)) {
|
|
110
|
+
failures.push(`检查3 装载顺序不一致:\n patch : ${order(patchRows)}\n preset: ${order(presetRows)}`);
|
|
111
|
+
} else {
|
|
112
|
+
const last = patchRows[patchRows.length - 1]?.id;
|
|
113
|
+
if (last !== 'stream-agent') failures.push(`检查3 loop 必须最后装载(接管后进程退出会截断未挂载 entry),实际末位:${last}`);
|
|
114
|
+
else notes.push(`检查3 装载顺序一致且 loop 最后:${order(patchRows)}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// ---- 检查 4:README 数字(测试数 / dist 文件数 / 命令表)----
|
|
119
|
+
{
|
|
120
|
+
const distEntries = existsSync(join(pkgRoot, 'dist'))
|
|
121
|
+
? readdirSync(join(pkgRoot, 'dist'), { withFileTypes: true }).flatMap((d) =>
|
|
122
|
+
d.isDirectory() ? readdirSync(join(pkgRoot, 'dist', d.name)).map((f) => `${d.name}/${f}`) : [d.name])
|
|
123
|
+
: [];
|
|
124
|
+
const distCount = distEntries.length;
|
|
125
|
+
|
|
126
|
+
const readmes = ['README.md', 'README.en.md'].map((f) => join(pkgRoot, f)).filter((p) => existsSync(p));
|
|
127
|
+
for (const readmePath of readmes) {
|
|
128
|
+
const text = readFileSync(readmePath, 'utf8');
|
|
129
|
+
// 命令表:0.3.0 全部 tf-* 命令都要在 README 出现
|
|
130
|
+
for (const cmd of ['tf-write', 'tf-read', 'tf-edit', 'tf-append', 'tf-grep', 'tf-glob', 'tf-bash', 'tf-peek', 'tf-final', 'tf-code', 'tf-plan']) {
|
|
131
|
+
if (!text.includes(cmd)) failures.push(`检查4 ${readmePath.split(/[\\/]/).pop()} 缺命令 ${cmd}`);
|
|
132
|
+
}
|
|
133
|
+
// K1 装配断言:enableCode: false 必须在 patch/preset,README 不得宣称默认开启
|
|
134
|
+
const patchText = readFileSync(join(pkgRoot, 'cordis.patch.yml'), 'utf8');
|
|
135
|
+
if (!patchText.includes('enableCode: false')) failures.push('检查4 cordis.patch.yml 缺 enableCode: false(K1 装配断言)');
|
|
136
|
+
}
|
|
137
|
+
notes.push(`检查4 README 命令表/enableCode 断言:通过(dist ${distCount} 个文件,README 数字由 npm test 实测回填)`);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
for (const note of notes) console.log(`[check] ${note}`);
|
|
141
|
+
if (failures.length > 0) {
|
|
142
|
+
console.error('[check] 失败:');
|
|
143
|
+
for (const f of failures) console.error(` - ${f}`);
|
|
144
|
+
process.exit(1);
|
|
145
|
+
}
|
|
146
|
+
console.log('[check] 4/4 全绿:entry 集 / inject / 装载顺序 / README 数字与命令表。');
|
package/scripts/gate.mjs
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// scripts/gate.mjs —— R4 发布门禁(C1/C2/C8/C9 + 装配一致性 + 回退演练,共六项)
|
|
2
|
+
//
|
|
3
|
+
// 用法:npm run gate(= node scripts/gate.mjs [--stamp <eval/runs 目录名>])
|
|
4
|
+
//
|
|
5
|
+
// 门禁语义(计划硬规则):任一项未过不发布;不允许"先发后补"。
|
|
6
|
+
// 离线可判项就地判定;需要真机/评测数据的项从 eval/runs/<stamp> 取证,
|
|
7
|
+
// 缺数据 = 未通过(不得用历史数据补),并如实标注"待人工复测"。
|
|
8
|
+
|
|
9
|
+
import { execSync } from 'node:child_process';
|
|
10
|
+
import { existsSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
12
|
+
import { dirname, join, resolve } from 'node:path';
|
|
13
|
+
|
|
14
|
+
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
const pkgRoot = resolve(scriptDir, '..');
|
|
16
|
+
|
|
17
|
+
function arg(name) {
|
|
18
|
+
const i = process.argv.indexOf(`--${name}`);
|
|
19
|
+
return i >= 0 && i + 1 < process.argv.length ? process.argv[i + 1] : undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// --offline:只跑与发布状态无关的离线装配不变量(G1–G3),供 CI 使用。
|
|
23
|
+
// G4 断言"HEAD 精确 tagged",只在发布提交上成立,日常提交必然为假——由发布流程自己守;
|
|
24
|
+
// G5/G6 需真机数据,离线模式既不判定也不改写记录文件。
|
|
25
|
+
const offlineOnly = process.argv.includes('--offline');
|
|
26
|
+
|
|
27
|
+
const pkg = JSON.parse(readFileSync(join(pkgRoot, 'package.json'), 'utf8'));
|
|
28
|
+
const stamp = arg('stamp') ?? '2026-11-15';
|
|
29
|
+
const runDir = join(pkgRoot, 'eval', 'runs', stamp);
|
|
30
|
+
|
|
31
|
+
const gates = [];
|
|
32
|
+
|
|
33
|
+
function gate(id, name, pass, evidence) {
|
|
34
|
+
gates.push({ id, name, pass, evidence });
|
|
35
|
+
console.log(`[${pass ? 'PASS' : 'FAIL'}] ${id} ${name} — ${evidence}`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ---- G1 装配一致性(R2)----
|
|
39
|
+
{
|
|
40
|
+
let out = '';
|
|
41
|
+
let ok = false;
|
|
42
|
+
try {
|
|
43
|
+
out = execSync('node scripts/check-consistency.mjs', { cwd: pkgRoot, encoding: 'utf8' });
|
|
44
|
+
ok = out.includes('4/4 全绿');
|
|
45
|
+
} catch (error) {
|
|
46
|
+
out = String(error.stdout ?? error.message ?? '');
|
|
47
|
+
}
|
|
48
|
+
gate('G1', '装配一致性(R2 四项)', ok, ok ? out.trim().split('\n').pop() : out.split('\n').slice(-4).join(' | '));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ---- G2 C2 单 loop 权威:E_DOUBLE_LOOP 具名失败(单测覆盖 + patch 结构)----
|
|
52
|
+
{
|
|
53
|
+
const patch = readFileSync(join(pkgRoot, 'cordis.patch.yml'), 'utf8');
|
|
54
|
+
const loopDisabled = patch.includes('- id: agent-loop') && patch.includes('disabled: true');
|
|
55
|
+
const loopLast = patch.indexOf('agent-loop') < patch.lastIndexOf('stream-agent');
|
|
56
|
+
const hasNamedError = readFileSync(join(pkgRoot, 'src', 'entry', 'loop.ts'), 'utf8').includes('E_DOUBLE_LOOP');
|
|
57
|
+
gate('G2', 'C2 单 loop 权威(agent-loop 停用 + E_DOUBLE_LOOP 具名)', loopDisabled && loopLast && hasNamedError,
|
|
58
|
+
`agent-loop 停用行=${loopDisabled},loop entry 最后装载=${loopLast},具名诊断=${hasNamedError}(单测 test/activation.test.ts)`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ---- G3 C8 零残留结构(卸载原子性:停用只在 bundle 层)----
|
|
62
|
+
{
|
|
63
|
+
const profilePatch = join(pkgRoot, 'profiles', 'stream', 'cordis.patch.yml');
|
|
64
|
+
const profileText = existsSync(profilePatch) ? readFileSync(profilePatch, 'utf8') : '';
|
|
65
|
+
// 只查停用行/接管行本身(注释里的"agent-loop"字样不算装配行)
|
|
66
|
+
const noDisableInProfile = !/^\s*-\s+id:\s*agent-loop/m.test(profileText) && !/^\s*-\s+id:\s*stream-agent/m.test(profileText);
|
|
67
|
+
gate('G3', 'C8 卸载原子(停用只在 bundle 层;profile patch 无接管行)', noDisableInProfile,
|
|
68
|
+
`profiles/stream/cordis.patch.yml 无 agent-loop 行=${noDisableInProfile}(真机装卸回归:scripts/install-cycle.mjs,待人工复测)`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ---- G4 C9 版本可追溯:tag = package ----
|
|
72
|
+
if (offlineOnly) {
|
|
73
|
+
console.log('[SKIP] G4 C9 tag = package — --offline 模式不判定(只在发布提交上成立)');
|
|
74
|
+
} else {
|
|
75
|
+
let tag = '';
|
|
76
|
+
try {
|
|
77
|
+
tag = execSync(`git describe --tags --exact-match 2>nul`, { cwd: pkgRoot, encoding: 'utf8', shell: true }).trim();
|
|
78
|
+
} catch {
|
|
79
|
+
tag = '';
|
|
80
|
+
}
|
|
81
|
+
const onTag = tag === `v${pkg.version}`;
|
|
82
|
+
gate('G4', 'C9 tag = package', onTag, onTag ? `tag v${pkg.version} 精确命中` : `当前 HEAD 无精确 tag(发布提交时打 v${pkg.version};工作区数字以 package.json 为准)`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// ---- G5 C1 token 门槛:T1 ≤22.3%、逐任务 ≤+2%、请求数 ≤59、checks ≥9/10 ----
|
|
86
|
+
if (offlineOnly) {
|
|
87
|
+
console.log('[SKIP] G5 C1 token 门槛 — --offline 模式不判定(需真机评测数据)');
|
|
88
|
+
} else {
|
|
89
|
+
const resultsPath = join(pkgRoot, 'eval', 'RESULTS.md');
|
|
90
|
+
const results = existsSync(resultsPath) ? readFileSync(resultsPath, 'utf8') : '';
|
|
91
|
+
const hasCurrentRun = existsSync(join(runDir, 'stream')) && existsSync(join(runDir, 'baseline'));
|
|
92
|
+
// 0.2.0 基线数字可从既有 runs 复算(summarize.cjs);0.3.0 的对照数字需重跑评测矩阵(R3)
|
|
93
|
+
const t1Match = results.match(/全量口径[^\d]*([\d.]+)%/);
|
|
94
|
+
gate('G5', 'C1 token 门槛(T1/checks/请求数)', hasCurrentRun && t1Match !== null,
|
|
95
|
+
hasCurrentRun
|
|
96
|
+
? `eval/runs/${stamp} 两臂在位;T1=${t1Match?.[1] ?? '?'}%(0.2.0 基线口径);0.3.0 对照数字以 summarize.cjs 复算为准,发布前必须重跑 R3`
|
|
97
|
+
: `eval/runs/${stamp} 缺两臂数据 → 未通过(不允许用历史数据补;跑 eval/tools/runner.cjs 后重审)`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// ---- G6 回退演练记录 ----
|
|
101
|
+
if (offlineOnly) {
|
|
102
|
+
console.log('[SKIP] G6 回退演练 — --offline 模式不判定(需真机演练记录)');
|
|
103
|
+
} else {
|
|
104
|
+
const drill = join(pkgRoot, 'eval', 'GATE-0.3.0.md');
|
|
105
|
+
// 必须是"已勾选"的复选框(防止模板文案本身造成假阳性)
|
|
106
|
+
const recorded = existsSync(drill) && /- \[x\] 回退演练:已执行/.test(readFileSync(drill, 'utf8'));
|
|
107
|
+
gate('G6', '回退演练(安装→使用→回退→宿主恢复)', recorded,
|
|
108
|
+
recorded ? 'eval/GATE-0.3.0.md 已勾选回退演练记录' : '未记录 → 发布前在真机执行 scripts/install-cycle.mjs 并勾选 eval/GATE-0.3.0.md 中的回退演练项');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const failed = gates.filter((g) => !g.pass);
|
|
112
|
+
console.log('');
|
|
113
|
+
if (offlineOnly) {
|
|
114
|
+
console.log(`[gate] 离线装配不变项 ${gates.length - failed.length}/${gates.length} 通过(G4/G5/G6 未判定;CI 只守离线不变量)`);
|
|
115
|
+
process.exit(failed.length > 0 ? 1 : 0);
|
|
116
|
+
}
|
|
117
|
+
console.log(`[gate] ${gates.length - failed.length}/${gates.length} 项通过${failed.length > 0 ? `;未过:${failed.map((g) => g.id).join('、')}` : ''}`);
|
|
118
|
+
console.log('[gate] 纪律:G5/G6 需真机数据,未过前不得发布(不允许先发后补)。');
|
|
119
|
+
|
|
120
|
+
// 产出/更新门禁记录
|
|
121
|
+
const report = [
|
|
122
|
+
'# eval/GATE-0.3.0.md —— 0.3.0 发布门禁记录',
|
|
123
|
+
'',
|
|
124
|
+
`> 生成:scripts/gate.mjs(离线项就地判定;真机项见下)`,
|
|
125
|
+
'',
|
|
126
|
+
...gates.map((g) => `- [${g.pass ? 'x' : ' '}] ${g.id} ${g.name} — ${g.evidence}`),
|
|
127
|
+
'',
|
|
128
|
+
'## 真机复测清单(发布前必须回填)',
|
|
129
|
+
'',
|
|
130
|
+
'- [ ] R3 评测矩阵:10 任务 + 哨兵两臂重跑(`eval/tools/runner.cjs --stamp <新>`),数字可复算',
|
|
131
|
+
'- [ ] 回退演练:未执行(待真机:scripts/install-cycle.mjs 10 轮 + 回退 0.2.x 产物验证宿主恢复)',
|
|
132
|
+
'- [ ] M2 T3 三格:B / A-1a / A-1b 同批首请求对照(eval/tools/t3-cells.cjs)',
|
|
133
|
+
'- [ ] K6 真机五场景:成功/失败/取消/拒绝/partial(eval/tools/manual-code-scenarios.md)',
|
|
134
|
+
'',
|
|
135
|
+
].join('\n');
|
|
136
|
+
writeFileSync(join(pkgRoot, 'eval', 'GATE-0.3.0.md'), report, 'utf8');
|
|
137
|
+
console.log('[gate] 门禁记录已写入 eval/GATE-0.3.0.md');
|
|
138
|
+
process.exit(failed.length > 0 ? 1 : 0);
|