dsh-workplan 2.0.4 → 2.1.0
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 +62 -0
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/README.zh.md +1 -1
- package/lib/comm-format.js +184 -0
- package/lib/host.js +1 -1
- package/lib/plan.js +268 -12
- package/lib/runtime.js +36 -3
- package/package.json +1 -1
- package/src/comm-format.ts +215 -0
- package/src/host.ts +1 -1
- package/src/plan.ts +269 -12
- package/src/runtime.ts +36 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,65 @@
|
|
|
1
|
+
## 2.1.0 — 2026-11-06
|
|
2
|
+
|
|
3
|
+
**建立主 Agent 与部门人员之间的统一沟通交流格式契约(下发—自检—核验—退回闭环),并保留 2.0.5 草案的规划器 JSON 结构修复。**
|
|
4
|
+
|
|
5
|
+
### 一、问题与证据链
|
|
6
|
+
|
|
7
|
+
用户 2026-11-05 在同一会话里连续两次遇到自动分解失败:
|
|
8
|
+
|
|
9
|
+
| # | 事实 | 证据 |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| 1 | 第一次:`Expected ',' or '}' after property value in JSON at position 12475` | 会话降级消息原文 |
|
|
12
|
+
| 2 | 第二次:规划器 JSON 被 max tokens 截断,旧实现先 `lastIndexOf('}')` 找不到结尾括号,直接判 `NO_JSON` | `src/plan.ts#extractJson` 旧实现 |
|
|
13
|
+
| 3 | 两次都不是「没规划」,而是「规划结果有一个字符的结构瑕疵」 | 降级消息均带 `degraded:true` 与原 JSON 错误 |
|
|
14
|
+
|
|
15
|
+
2.0.4 修的是**子 Agent 回执**的解析(`repairEvidenceJson`),规划器入口的 `extractJson` 仍是裸 `JSON.parse`,是同一个病根的另一个出口。
|
|
16
|
+
|
|
17
|
+
### 二、改了什么
|
|
18
|
+
|
|
19
|
+
- **结构修复**:新增 `repairJsonStructure()`——配平未闭合的 `{` `[` `"`、去掉尾逗号、把字符串内的裸换行/制表符/控制符转义。**只修结构,不新增或猜测任何字段值**。
|
|
20
|
+
- **截断修复**:新增 `truncatedCandidates()`——输出被 max tokens 截断时,从尾部逐个丢弃不完整成员(每次都是「本来就残缺、不可用」的内容),最多 24 轮,每轮尝试解析。
|
|
21
|
+
- **不再误判 NO_JSON**:旧实现要求文本里存在结尾 `}`,截断输出因此被判「没有 JSON 对象」;现在只要以 `{` 起头就进入修复流程。
|
|
22
|
+
- **失败仍然如实报错**:修不好照旧抛 `INVALID_JSON`,不静默返回空计划;成功修复时打印一条 warn 日志说明「只补括号/逗号,未改内容」。
|
|
23
|
+
|
|
24
|
+
### 三、验证
|
|
25
|
+
|
|
26
|
+
- 新增离线自检 10 条,全部通过:合法 JSON、少一个 `}`、少两个 `}]`、尾逗号、字符串内裸换行、截断 70%、截断 55%、代码块包裹、无 JSON(应抛 `NO_JSON`)、纯空白(应抛 `EMPTY_OUTPUT`)。
|
|
27
|
+
- `npm run check`(tsc --noEmit)退出码 0;`npm run build` 重新生成 `lib/`、`dist/`、`client.js`。
|
|
28
|
+
- `npm test` 全套回归见本版本 CI 输出。
|
|
29
|
+
|
|
30
|
+
### 四、边界(不夸大)
|
|
31
|
+
|
|
32
|
+
- 结构修复无法把「内容本身就错」的 JSON 变成正确内容;它只解决括号/逗号/截断这类机械损伤。
|
|
33
|
+
- 丢弃尾部残缺成员意味着该成员的信息丢失,调用方的 schema 校验仍会拦下缺字段的计划,不会因此产出半成品计划。
|
|
34
|
+
|
|
35
|
+
### 五、沟通交流格式契约(本次核心)
|
|
36
|
+
|
|
37
|
+
用户 2026-11-06 的强制要求:派发工作的同时附带一份统一的沟通交流格式要求;部门人员提交结果前依此自查;主 Agent 收到后依同一份格式核验,不合规立刻退回,通知其重新检查格式后全盘重交。
|
|
38
|
+
|
|
39
|
+
| 环节 | 落地位置 | 行为 |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| 下发 | `src/comm-format.ts#renderCommFormatSpec` → `src/plan.ts#buildChildPrompt` 末尾 | 每个子任务提示都附带 F1–F9 九条格式规范与「提交前自查(强制)」指令 |
|
|
42
|
+
| 自检 | 同上(提示词内强制指令) | 部门人员提交前逐条对照 F1–F9 |
|
|
43
|
+
| 核验 | `src/comm-format.ts#checkCommFormatCompliance` → `src/plan.ts#adjudicateResult` done 路径前 | 主 Agent 用同一份规范逐条核验 F1–F8(F9 为诚信约束,由三阶段门禁与人工复核兜底) |
|
|
44
|
+
| 退回 | `adjudicateResult` 返回 `blockedKind:'comm-format'` + `renderCommFormatRejection` | 不合规即判 blocked,退回通知写明逐条不合规项与修正要求 |
|
|
45
|
+
| 重交 | `src/runtime.ts#executeSubtask` 的 `lastFailure` 注入 | 复位重派时把退回通知作为上次失败原因(`COMM_FORMAT_REJECTED`)随提示词发回,子 Agent 看到具体不合规条目,只补缺口不重做 |
|
|
46
|
+
|
|
47
|
+
九条规范:F1 证据块标记成对、F2 status 合法、F3 三阶段齐全、F4 pass 必须带证据、F5 验收条数不少于计划、F6 产物条目合法(kind ∈ file/url/note 且 ref 非空)、F7 复盘四项、F8 blocked 必须带 question、F9 不得编造。
|
|
48
|
+
|
|
49
|
+
设计边界(不夸大):
|
|
50
|
+
|
|
51
|
+
- 只拦 `done` 路径。解析失败、验收缺口、三阶段缺失已被更早的门禁拦下,保留原有更具针对性的诊断,不用格式条目覆盖。
|
|
52
|
+
- `requirePhases:false`(历史回放 / 明确关闭新契约)不追溯否决旧日志里按当时规则合法的 done。
|
|
53
|
+
- F6 只校验「产物声明的合法性」,是否必须交付文件由计划验收标准决定——避免把无文件产物的写作类子任务误判为不合规。
|
|
54
|
+
- F9 不做自动判定:编造检测需要语义理解而非结构校验,把它写成提示词级诚信约束,由三阶段门禁与人工复核承担。
|
|
55
|
+
|
|
56
|
+
### 六、验证
|
|
57
|
+
|
|
58
|
+
- `npm run check`(tsc --noEmit)退出码 0。
|
|
59
|
+
- `npm test`:578 条用例,pass 578 / fail 0。
|
|
60
|
+
- 新增 `tests/workplan-comm-format.test.ts`:覆盖 F1–F8 逐条拒收、合规放行、退回通知文案、`requirePhases:false` 兼容边界。
|
|
61
|
+
- 既有用例按新契约修订 1 条:`workplan-evidence-contract.test.ts` 的 C-19 由「空证据 pass 降级 unverified 仍算 done」改为「按 F4 退回 blocked/comm-format」——这是用户要求的行为前移,不是放宽。
|
|
62
|
+
|
|
1
63
|
## 2.0.4 — 2026-11-05
|
|
2
64
|
|
|
3
65
|
**修复「子 Agent 干完活却交不了差」的四条判定缺陷,并给交互式会话收尾加上「放行但留痕」。**
|
package/README.en.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> **Two selling points, one line: a full ISO/IEC 15408:2026 evidence pack you can verify with 5 commands, and a one-command install with zero runtime dependencies.**
|
|
4
4
|
|
|
5
5
|
[](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml)
|
|
6
|
-
[](https://github.com/abbaababa/dsh-workplan/releases/tag/v2.1.0)
|
|
7
7
|
|
|
8
8
|
Adds "plan first → dispatch real department subagents → watch progress in the sidebar" to **DeepSeek Harness (DSH)**. No app, no DSH source patch, no page replacement.
|
|
9
9
|
|
|
@@ -80,7 +80,7 @@ The full contract — roles, data shapes, state machine, recovery, and the three
|
|
|
80
80
|
## Install
|
|
81
81
|
|
|
82
82
|
```bash
|
|
83
|
-
dsh plugin --profile web add dsh-workplan@2.0
|
|
83
|
+
dsh plugin --profile web add dsh-workplan@2.1.0
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
Restart the DSH Web process (or reload the page) so the bundle is picked up.
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> **两个卖点,一句话:ISO/IEC 15408:2026 全套安全证据,5 条命令自己验;安装一条命令、零第三方运行时依赖。**
|
|
4
4
|
|
|
5
5
|
[](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml)
|
|
6
|
-
[](https://github.com/abbaababa/dsh-workplan/releases/tag/v2.1.0)
|
|
7
7
|
|
|
8
8
|
给 **DeepSeek Harness(DSH)** 加一段「先拆计划 → 真派部门子 Agent 去做 → 左侧栏实时看进度」的能力。不装 App、不改 DSH 源码、不换页面。
|
|
9
9
|
|
|
@@ -69,7 +69,7 @@ grep -RInE "child_process|execSync|eval\(|writeFileSync" src || echo "0 命中
|
|
|
69
69
|
## 一键安装
|
|
70
70
|
|
|
71
71
|
```bash
|
|
72
|
-
dsh plugin --profile web add dsh-workplan@2.0
|
|
72
|
+
dsh plugin --profile web add dsh-workplan@2.1.0
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
装完**重启一次 DSH Web**(或重新载入当前页面)让插件生效。
|
package/README.zh.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> **两个卖点,一句话:ISO/IEC 15408:2026 全套安全证据,5 条命令自己验;安装一条命令、零第三方运行时依赖。**
|
|
4
4
|
|
|
5
5
|
[](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml)
|
|
6
|
-
[](https://github.com/abbaababa/dsh-workplan/releases/tag/v2.1.0)
|
|
7
7
|
|
|
8
8
|
给 **DeepSeek Harness(DSH)** 加一段「先拆计划 → 真派部门子 Agent 去做 → 左侧栏实时看进度」的能力。不装 App、不改 DSH 源码、不换页面。
|
|
9
9
|
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [2.1.0] 统一沟通交流格式规范与合规检查(用户 2026-11-06 的强制要求)。
|
|
3
|
+
*
|
|
4
|
+
* 机制闭环:
|
|
5
|
+
* 1. 主 Agent 派发子任务时,在提示词里附带本模块渲染的《沟通交流格式规范》
|
|
6
|
+
* (renderCommFormatSpec),作为双方认可的唯一结果格式契约;
|
|
7
|
+
* 2. 部门人员提交结果前,必须逐条对照规范自查(提示词中有强制自查指令);
|
|
8
|
+
* 3. 主 Agent 收到结果后,由 adjudicateResult 用 checkCommFormatCompliance
|
|
9
|
+
* 按同一份规范逐条核验;不合规即判定 blocked/comm-format,把
|
|
10
|
+
* renderCommFormatRejection 生成的退回通知随下一次激活发回,
|
|
11
|
+
* 通知部门人员重新检查格式后重交。
|
|
12
|
+
*
|
|
13
|
+
* 设计约束:
|
|
14
|
+
* - 本模块只做「格式/结构」核验,不做语义真伪判断(F9 为提示词级诚信约束,
|
|
15
|
+
* 由三阶段门禁与人工复核兜底,这里不自动判);
|
|
16
|
+
* - 规范是纯数据,可序列化进提示词,也可独立校验,版本号随内容变更递增;
|
|
17
|
+
* - 与既有门禁正交:解析失败、验收缺口、三阶段缺失仍由原门禁先拦,
|
|
18
|
+
* 本门禁只负责把「其它门禁都过了、但格式仍不合规」的 done 退回。
|
|
19
|
+
*/
|
|
20
|
+
/** 格式规范版本,随规范内容变更递增。 */
|
|
21
|
+
export const COMM_FORMAT_VERSION = 1;
|
|
22
|
+
/**
|
|
23
|
+
* 统一沟通交流格式规范定义(F1-F9,冻结不可变)。
|
|
24
|
+
*/
|
|
25
|
+
export const COMM_FORMAT_SPEC = Object.freeze({
|
|
26
|
+
version: COMM_FORMAT_VERSION,
|
|
27
|
+
name: 'dsh-workplan 沟通交流格式规范',
|
|
28
|
+
requirements: Object.freeze([
|
|
29
|
+
Object.freeze({ id: 'F1', category: 'structure',
|
|
30
|
+
description: '结果必须包含结构化证据块:以 <!-- WORKPLAN_EVIDENCE:START --> 开头、<!-- WORKPLAN_EVIDENCE:END --> 结尾,且两块标记成对出现',
|
|
31
|
+
rationale: '没有标记块,主 Agent 无法定位与解析结果,交付门禁无从启动' }),
|
|
32
|
+
Object.freeze({ id: 'F2', category: 'structure',
|
|
33
|
+
description: '证据块必须是合法 JSON 对象,顶层必须含 status 字段,取值只能是 done / blocked / partial',
|
|
34
|
+
rationale: 'status 是交付门禁的入口条件,缺失或非法则无法判定完成与否' }),
|
|
35
|
+
Object.freeze({ id: 'F3', category: 'phases',
|
|
36
|
+
description: '必须包含三阶段证据:phases.planning(问题分析与可执行思路)、phases.execution(实际执行步骤)、phases.verification(逐项验证)',
|
|
37
|
+
rationale: '三阶段是质量闭环的基础,缺任一阶段等于跳过对应质控环节' }),
|
|
38
|
+
Object.freeze({ id: 'F4', category: 'acceptance',
|
|
39
|
+
description: '验收结果必须逐条回应计划的验收标准(A1、A2…),且每条 result=pass 必须附带具体证据(命令输出/文件路径/引用),禁止空证据 pass',
|
|
40
|
+
rationale: '空证据 pass 是自述而非验证,交付门禁只认可证据' }),
|
|
41
|
+
Object.freeze({ id: 'F5', category: 'acceptance',
|
|
42
|
+
description: '验收回应的条数不得少于计划定义的验收标准条数',
|
|
43
|
+
rationale: '少回应一条等于该条验收未做,交付门禁会判为未完成' }),
|
|
44
|
+
Object.freeze({ id: 'F6', category: 'artifacts',
|
|
45
|
+
description: 'artifacts 声明清单中每一项都必须是合法条目:kind 只能取 file / url / note,且 ref 非空;不允许空条目或占位条目',
|
|
46
|
+
rationale: '主 Agent 按 ref 核验交付物;非法条目让核验无从执行。是否必须交付文件由计划验收标准决定,不由本条决定' }),
|
|
47
|
+
Object.freeze({ id: 'F7', category: 'retrospective',
|
|
48
|
+
description: 'phases.verification.retrospective 复盘必须完整:problems、resolutions、prevention 均至少 1 条(detours 没有可写空数组)',
|
|
49
|
+
rationale: '复盘是自我学习闭环的入口,缺失则教训无法写入永久记忆' }),
|
|
50
|
+
Object.freeze({ id: 'F8', category: 'blocked',
|
|
51
|
+
description: '若 status 为 blocked,必须附非空 question 字段写清受阻原因(卡在哪一步、已尝试什么、需要谁决定什么)',
|
|
52
|
+
rationale: '受阻无原因等于主 Agent 不知道卡在哪里,无法给出指示或转派' }),
|
|
53
|
+
Object.freeze({ id: 'F9', category: 'integrity',
|
|
54
|
+
description: '不得编造、虚构或伪造任何证据、文件路径、命令输出或验收结果;无法确认的项目必须写 unverified',
|
|
55
|
+
rationale: '虚假证据一旦通过交付门禁,用户拿到的就是不可信的成品' }),
|
|
56
|
+
]),
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* 对子 Agent 的证据块执行沟通交流格式合规检查(F1-F8 自动核验;F9 为诚信约束不自动判)。
|
|
60
|
+
*
|
|
61
|
+
* @param parsed - 已解析的证据块 payload(parseEvidenceBlock 的 payload,可为 null)
|
|
62
|
+
* @param rawOutput - 子 Agent 原始输出全文
|
|
63
|
+
* @param expectedAcceptanceCount - 计划定义的验收标准条数
|
|
64
|
+
*/
|
|
65
|
+
export function checkCommFormatCompliance(parsed, rawOutput, expectedAcceptanceCount) {
|
|
66
|
+
const violations = [];
|
|
67
|
+
const text = typeof rawOutput === 'string' ? rawOutput : '';
|
|
68
|
+
// F1: 证据块标记必须成对出现(rescueEvidence 捞到的豁免——主 Agent 已能解析)
|
|
69
|
+
if (!text.includes('WORKPLAN_EVIDENCE:START') || !text.includes('WORKPLAN_EVIDENCE:END')) {
|
|
70
|
+
if (!parsed) {
|
|
71
|
+
violations.push({ ruleId: 'F1', category: 'structure',
|
|
72
|
+
message: '缺少 WORKPLAN_EVIDENCE:START/END 标记块,主 Agent 无法定位与解析结果' });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (!parsed || typeof parsed !== 'object') {
|
|
76
|
+
if (violations.length === 0) {
|
|
77
|
+
violations.push({ ruleId: 'F2', category: 'structure', message: '证据块无法解析为 JSON 对象' });
|
|
78
|
+
}
|
|
79
|
+
return { compliant: false, violations, version: COMM_FORMAT_VERSION };
|
|
80
|
+
}
|
|
81
|
+
// F2: status 必填且取值合法
|
|
82
|
+
if (!['done', 'blocked', 'partial'].includes(String(parsed.status ?? ''))) {
|
|
83
|
+
violations.push({ ruleId: 'F2', category: 'structure',
|
|
84
|
+
message: `status 字段缺失或取值非法("${String(parsed.status ?? '')}"),只能是 done / blocked / partial` });
|
|
85
|
+
}
|
|
86
|
+
// F3: 三阶段证据齐全
|
|
87
|
+
const phases = parsed.phases;
|
|
88
|
+
if (!phases || typeof phases !== 'object') {
|
|
89
|
+
violations.push({ ruleId: 'F3', category: 'phases',
|
|
90
|
+
message: '缺少 phases 对象:planning / execution / verification 三阶段证据全部缺失' });
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
const missing = [];
|
|
94
|
+
if (!phases.planning || typeof phases.planning !== 'object')
|
|
95
|
+
missing.push('planning(问题分析与思路)');
|
|
96
|
+
if (!phases.execution || typeof phases.execution !== 'object')
|
|
97
|
+
missing.push('execution(实际执行步骤)');
|
|
98
|
+
if (!phases.verification || typeof phases.verification !== 'object')
|
|
99
|
+
missing.push('verification(逐项验证与复盘)');
|
|
100
|
+
if (missing.length > 0) {
|
|
101
|
+
violations.push({ ruleId: 'F3', category: 'phases', message: `三阶段证据缺失:${missing.join('、')}` });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// F4: pass 必须带证据
|
|
105
|
+
const acceptance = Array.isArray(parsed.acceptance) ? parsed.acceptance : [];
|
|
106
|
+
const emptyPass = [];
|
|
107
|
+
for (const item of acceptance) {
|
|
108
|
+
if (item && item.result === 'pass' && !String(item.evidence ?? '').trim()) {
|
|
109
|
+
emptyPass.push(String(item.criterion ?? '(未命名验收项)'));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (emptyPass.length > 0) {
|
|
113
|
+
violations.push({ ruleId: 'F4', category: 'acceptance',
|
|
114
|
+
message: `以下验收项 result=pass 但未附证据:${emptyPass.slice(0, 5).join('、')};pass 必须附命令输出/文件路径/引用` });
|
|
115
|
+
}
|
|
116
|
+
// F5: 验收条数不得少于计划定义
|
|
117
|
+
if (expectedAcceptanceCount > 0 && acceptance.length < expectedAcceptanceCount) {
|
|
118
|
+
violations.push({ ruleId: 'F5', category: 'acceptance',
|
|
119
|
+
message: `验收回应仅 ${acceptance.length} 条,少于计划定义的 ${expectedAcceptanceCount} 条;须逐条回应 A1、A2…` });
|
|
120
|
+
}
|
|
121
|
+
// F6: 产物声明必须逐条合法(kind 枚举 + ref 非空);是否必须交付文件由计划验收决定,不在此拦
|
|
122
|
+
const artifacts = Array.isArray(parsed.artifacts) ? parsed.artifacts : [];
|
|
123
|
+
const badArtifacts = artifacts.filter((item) => !item || typeof item !== 'object'
|
|
124
|
+
|| !['file', 'url', 'note'].includes(String(item.kind ?? ''))
|
|
125
|
+
|| String(item.ref ?? '').trim() === '');
|
|
126
|
+
if (badArtifacts.length > 0) {
|
|
127
|
+
violations.push({ ruleId: 'F6', category: 'artifacts',
|
|
128
|
+
message: `artifacts 有 ${badArtifacts.length} 条非法声明:每条必须 kind 取 file/url/note 且 ref 非空,不允许空条目` });
|
|
129
|
+
}
|
|
130
|
+
// F7: 复盘完整(problems/resolutions/prevention 均至少 1 条)
|
|
131
|
+
const retro = phases?.verification?.retrospective;
|
|
132
|
+
if (!retro || typeof retro !== 'object') {
|
|
133
|
+
violations.push({ ruleId: 'F7', category: 'retrospective',
|
|
134
|
+
message: '缺少 phases.verification.retrospective 复盘(problems / detours / resolutions / prevention)' });
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
const missingRetro = [];
|
|
138
|
+
if (!Array.isArray(retro.problems) || retro.problems.length === 0)
|
|
139
|
+
missingRetro.push('problems(遇到的问题,现象+根因)');
|
|
140
|
+
if (!Array.isArray(retro.resolutions) || retro.resolutions.length === 0)
|
|
141
|
+
missingRetro.push('resolutions(最终如何解决)');
|
|
142
|
+
if (!Array.isArray(retro.prevention) || retro.prevention.length === 0)
|
|
143
|
+
missingRetro.push('prevention(防再犯规则)');
|
|
144
|
+
if (missingRetro.length > 0) {
|
|
145
|
+
violations.push({ ruleId: 'F7', category: 'retrospective',
|
|
146
|
+
message: `复盘不完整,缺少:${missingRetro.join('、')},均至少 1 条` });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// F8: blocked 必须附非空 question
|
|
150
|
+
if (parsed.status === 'blocked' && !String(parsed.question ?? '').trim()) {
|
|
151
|
+
violations.push({ ruleId: 'F8', category: 'blocked',
|
|
152
|
+
message: 'status 为 blocked 但 question 为空:须写清卡在哪一步、已尝试什么、需要谁做什么决定' });
|
|
153
|
+
}
|
|
154
|
+
return { compliant: violations.length === 0, violations, version: COMM_FORMAT_VERSION };
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* 把格式规范渲染为嵌入子 Agent 提示词的文本。
|
|
158
|
+
* 这是「派发工作时附带统一沟通交流格式要求」的具体实现。
|
|
159
|
+
*/
|
|
160
|
+
export function renderCommFormatSpec() {
|
|
161
|
+
const lines = [
|
|
162
|
+
'沟通交流格式规范(v' + String(COMM_FORMAT_VERSION) + ',主 Agent 与部门人员双方认可的结果格式契约):',
|
|
163
|
+
];
|
|
164
|
+
for (const req of COMM_FORMAT_SPEC.requirements) {
|
|
165
|
+
lines.push(`- 【${req.id}】${req.description}`);
|
|
166
|
+
}
|
|
167
|
+
lines.push('不合规的后果:主 Agent 收到结果后按本规范逐条核验;任一不合规,结果立刻退回,你将收到列明不合规条目的退回通知,须全部修正后重新提交完整结果。');
|
|
168
|
+
return lines.join('\n');
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* 把合规检查结果渲染为退回通知文本(随下一次激活发回部门人员)。
|
|
172
|
+
*/
|
|
173
|
+
export function renderCommFormatRejection(result) {
|
|
174
|
+
if (result.compliant)
|
|
175
|
+
return '';
|
|
176
|
+
const lines = [
|
|
177
|
+
'结果退回:沟通交流格式不合规(规范 v' + String(result.version) + ')。',
|
|
178
|
+
'你的结果未通过以下条目,请逐条修正、重新自查全部 F1-F9 后再提交完整结果(不要只修一条就重交):',
|
|
179
|
+
];
|
|
180
|
+
for (const v of result.violations) {
|
|
181
|
+
lines.push(`- ${v.ruleId}:${v.message}`);
|
|
182
|
+
}
|
|
183
|
+
return lines.join('\n');
|
|
184
|
+
}
|
package/lib/host.js
CHANGED
|
@@ -1363,7 +1363,7 @@ export function apply(ctx, config = {}) {
|
|
|
1363
1363
|
}
|
|
1364
1364
|
export const meta = {
|
|
1365
1365
|
name,
|
|
1366
|
-
version: '2.0
|
|
1366
|
+
version: '2.1.0',
|
|
1367
1367
|
promptOrder: PROMPT_ORDER,
|
|
1368
1368
|
routes: ['/dsh-workplan/plans', '/dsh-workplan/vendor/chart.umd.js'],
|
|
1369
1369
|
};
|