dsh-workplan 3.0.1 → 3.0.3
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 +9 -0
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/lib/comm-format.js +10 -8
- package/lib/host.js +18 -7
- package/lib/plan.js +94 -5
- package/lib/runtime.js +6 -6
- package/lib/three-phase.js +72 -23
- package/package.json +1 -1
- package/src/comm-format.ts +9 -8
- package/src/host.ts +18 -7
- package/src/plan.ts +89 -5
- package/src/runtime.ts +6 -6
- package/src/three-phase.ts +90 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## 3.0.3 — 2026-11-17
|
|
2
|
+
|
|
3
|
+
- release v3.0.3: latest source + version publish
|
|
4
|
+
|
|
5
|
+
## 3.0.2 — 2026-11-17
|
|
6
|
+
|
|
7
|
+
- **修复**:GitHub Actions Release 流水线补齐 `NPM_TOKEN` secret + `gh release create` 幂等(已存在则 upload --clobber),npm 发布不再 ENEEDAUTH/E403。
|
|
8
|
+
- **版本**:全仓版本号对齐 3.0.2。
|
|
9
|
+
|
|
1
10
|
## 3.0.1 — 2026-11-16
|
|
2
11
|
|
|
3
12
|
### 激活热修:`dsh_workplan_hold` / `dsh_workplan_release` 缺 output 契约导致插件启用失败(宿主 register 硬校验)
|
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/v3.0.3)
|
|
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@3.0.
|
|
83
|
+
dsh plugin --profile web add dsh-workplan@3.0.3
|
|
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/v3.0.3)
|
|
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@3.0.
|
|
72
|
+
dsh plugin --profile web add dsh-workplan@3.0.3
|
|
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/v3.0.3)
|
|
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@3.0.
|
|
72
|
+
dsh plugin --profile web add dsh-workplan@3.0.3
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
装完**重启一次 DSH Web**(或重新载入当前页面)让插件生效。
|
package/lib/comm-format.js
CHANGED
|
@@ -27,7 +27,7 @@ import { checkDepartmentSummary, checkExpertReport, renderDepartmentSummarySpec,
|
|
|
27
27
|
* 专家结果查 F10,部门负责人结果查 F11,未声明层级时两条都不查
|
|
28
28
|
* (历史回放与其它调用点零回归)。
|
|
29
29
|
*/
|
|
30
|
-
export const COMM_FORMAT_VERSION =
|
|
30
|
+
export const COMM_FORMAT_VERSION = 3;
|
|
31
31
|
/**
|
|
32
32
|
* 统一沟通交流格式规范定义(F1-F9,冻结不可变)。
|
|
33
33
|
*/
|
|
@@ -42,8 +42,8 @@ export const COMM_FORMAT_SPEC = Object.freeze({
|
|
|
42
42
|
description: '证据块必须是合法 JSON 对象,顶层必须含 status 字段,取值只能是 done / blocked / partial',
|
|
43
43
|
rationale: 'status 是交付门禁的入口条件,缺失或非法则无法判定完成与否' }),
|
|
44
44
|
Object.freeze({ id: 'F3', category: 'phases',
|
|
45
|
-
description: '
|
|
46
|
-
rationale: '
|
|
45
|
+
description: '必须包含五步工作法证据:phases.planning(第一步问题梳理 problemAnalysis + 第二步资源 resources / 工具 tools / 方法流程步骤 approach / 依据 approachBasis)、phases.preparation(第三步准备与就绪证据)、phases.execution(第四步实际执行步骤)、phases.verification(第四步逐项验证与复盘);第五步交付由 F10/F11 的 report / departmentSummary 承载',
|
|
46
|
+
rationale: '五步是质量闭环的基础,缺任一步等于跳过对应质控环节' }),
|
|
47
47
|
Object.freeze({ id: 'F4', category: 'acceptance',
|
|
48
48
|
description: '验收结果必须逐条回应计划的验收标准(A1、A2…),且每条 result=pass 必须附带具体证据(命令输出/文件路径/引用),禁止空证据 pass',
|
|
49
49
|
rationale: '空证据 pass 是自述而非验证,交付门禁只认可证据' }),
|
|
@@ -127,18 +127,20 @@ export function checkCommFormatCompliance(parsed, rawOutput, expectedAcceptanceC
|
|
|
127
127
|
const phases = parsed.phases;
|
|
128
128
|
if (!phases || typeof phases !== 'object') {
|
|
129
129
|
violations.push({ ruleId: 'F3', category: 'phases',
|
|
130
|
-
message: '缺少 phases 对象:planning / execution / verification
|
|
130
|
+
message: '缺少 phases 对象:planning / preparation / execution / verification 证据全部缺失' });
|
|
131
131
|
}
|
|
132
132
|
else {
|
|
133
133
|
const missing = [];
|
|
134
134
|
if (!phases.planning || typeof phases.planning !== 'object')
|
|
135
|
-
missing.push('planning
|
|
135
|
+
missing.push('planning(第一步问题梳理 + 第二步资源/工具/方案)');
|
|
136
|
+
if (!phases.preparation || typeof phases.preparation !== 'object')
|
|
137
|
+
missing.push('preparation(第三步准备与就绪证据)');
|
|
136
138
|
if (!phases.execution || typeof phases.execution !== 'object')
|
|
137
|
-
missing.push('execution
|
|
139
|
+
missing.push('execution(第四步实际执行步骤)');
|
|
138
140
|
if (!phases.verification || typeof phases.verification !== 'object')
|
|
139
|
-
missing.push('verification
|
|
141
|
+
missing.push('verification(第四步逐项验证与复盘)');
|
|
140
142
|
if (missing.length > 0) {
|
|
141
|
-
violations.push({ ruleId: 'F3', category: 'phases', message:
|
|
143
|
+
violations.push({ ruleId: 'F3', category: 'phases', message: `五步证据缺失:${missing.join('、')}` });
|
|
142
144
|
}
|
|
143
145
|
}
|
|
144
146
|
// F4: pass 必须带证据
|
package/lib/host.js
CHANGED
|
@@ -75,7 +75,7 @@ export const name = 'dsh-workplan';
|
|
|
75
75
|
export const inject = ['tools', 'systemPrompt', 'llm', 'subagents', 'sessions'];
|
|
76
76
|
export const PROMPT_ORDER = 40;
|
|
77
77
|
const PROMPT_SECTION = [
|
|
78
|
-
'
|
|
78
|
+
'本会话已启用自动任务分解。系统会在每个新用户任务的第一个模型步骤前生成计划,并先把计划显示在对话里;看到【任务分解】计划消息后,若插件未自动派发或需要续跑/重试,再调用 dsh_workplan_dispatch(默认 wait 等结果;预计较久时用 mode:"async" 先开跑)。若只收到「任务分解已在后台生成中」而尚未看到【任务分解】,不要手动派发,先告知用户正在分配并等待计划落地。',
|
|
79
79
|
/*
|
|
80
80
|
* [3.0.0] 用户 2026-11-14 十三条要求的提示词侧双保险(代码侧同源门禁见
|
|
81
81
|
* v3-contract / comm-format / llm-rules / runtime)。文案不做发挥,只写
|
|
@@ -85,7 +85,7 @@ const PROMPT_SECTION = [
|
|
|
85
85
|
'3.0.0 任务书质量要求(用户要求 3/6):插件派给部门负责人的每个子任务都携带 qualityRequirements(结果质量要求),部门负责人派给专家的每条任务也必须携带 qualityRequirements。负责人→专家缺它平台直接拒绝派发(DELEGATE_QUALITY_REQUIREMENTS_MISSING);主 Agent→部门负责人缺它则该子任务在派发时被直接拒发(DISPATCH_QUALITY_REQUIREMENTS_MISSING,不启动部门 Agent),须 replan 补齐后重派。你审阅计划时先看每个子任务是否写了清楚的质量要求。',
|
|
86
86
|
'3.0.0 极简任务(用户要求 5,用户裁决 A=硬门槛):部门负责人派出的每条任务必须简单到像 1+1=2——一个动作、一个主产物、一项可独立验收,单句、≤300 字符、不含「并且/同时/另外/还要/以及/分别/顺便」等并列词;不满足即被拒绝并给出拆分提示(DELEGATE_TASK_NOT_ATOMIC)。',
|
|
87
87
|
'3.0.0 角色与汇报(用户要求 7/8/9/10/11/12):部门组员角色已取消,只保留部门负责人与全球顶尖专家(role 只允许 expert);专家完成后必须以 JSON 汇报(证据块里的 report:keyResults/keyInfo/importantInfo/leadRequirements,精简、禁止重复,F10);部门负责人必须全面汇总本部门全部专家汇报后,以 JSON 交回主 Agent(departmentSummary:keyResults/keyInfo/importantInfo/sources,精简、禁止累赘重复,F11);等所有部门的汇总都交回后,由你再全面、深入整理汇总成最终成果交付给用户(用户要求 12)。',
|
|
88
|
-
'3.0.
|
|
88
|
+
'3.0.3 版本(用户要求 13):本插件当前版本为 3.0.3。涉及版本号的对外表述一律写 3.0.3。',
|
|
89
89
|
/*
|
|
90
90
|
* [2.5.1] 主 Agent 两轮深度思考协议(用户 2026-11-11 补充要求):部门三层
|
|
91
91
|
* 执行者已有结算/再分配双门禁,主 Agent 自己也必须做到同一协议——提示词
|
|
@@ -934,7 +934,7 @@ export function createVerifyTool(runtime) {
|
|
|
934
934
|
},
|
|
935
935
|
phases: {
|
|
936
936
|
type: 'object',
|
|
937
|
-
description: '
|
|
937
|
+
description: '五步证据:planning(第一步问题梳理 + 第二步资源/工具/方案)、preparation(第三步准备与就绪证据)、execution(第四步执行步骤)、verification(第四步逐项验证与复盘)。',
|
|
938
938
|
properties: {
|
|
939
939
|
planning: {
|
|
940
940
|
type: 'object',
|
|
@@ -944,9 +944,20 @@ export function createVerifyTool(runtime) {
|
|
|
944
944
|
constraints: { type: 'array', items: { type: 'string' }, description: '约束条件' },
|
|
945
945
|
unknowns: { type: 'array', items: { type: 'string' }, description: '未知或待确认项' },
|
|
946
946
|
approach: { type: 'array', items: { type: 'string' }, description: '第二轮 · 方法流程步骤:基于第一轮全部结果理清的具体一步步执行、完美完成任务的方法、流程和步骤(每一步做什么、产出什么、如何证明)' },
|
|
947
|
-
approachBasis: { type: 'array', items: { type: 'string' }, description: '
|
|
947
|
+
approachBasis: { type: 'array', items: { type: 'string' }, description: '第二步依据(必填):第二步的资源、工具、方案如何基于第一步完成好的所有结果——第一步的哪些事实/约束/矛盾决定了第二步的哪些资源/工具/步骤' },
|
|
948
|
+
resources: { type: 'array', items: { type: 'string' }, description: '第二步 · 资源研究:完成本任务需要哪些资源(数据/文件/权限/人/知识/时间),逐项写清用途与获取方式' },
|
|
949
|
+
tools: { type: 'array', items: { type: 'string' }, description: '第二步 · 工具研究:需要哪些工具、每个工具用来做什么、为什么选它' },
|
|
948
950
|
},
|
|
949
|
-
required: ['problemAnalysis', 'approach', 'approachBasis'],
|
|
951
|
+
required: ['problemAnalysis', 'approach', 'approachBasis', 'resources', 'tools'],
|
|
952
|
+
},
|
|
953
|
+
preparation: {
|
|
954
|
+
type: 'object',
|
|
955
|
+
description: '第三步 · 准备:把第二步研究出的资源、工具、实施方案真正备齐,并给出可复核的就绪证据。',
|
|
956
|
+
properties: {
|
|
957
|
+
prepared: { type: 'array', items: { type: 'string' }, description: '已准备好的资源/工具清单:准备了什么、在哪里、是否可用' },
|
|
958
|
+
evidence: { type: 'array', items: { type: 'string' }, description: '就绪证据:命令输出/文件路径/配置项/版本号/引用,与 prepared 一一对应' },
|
|
959
|
+
},
|
|
960
|
+
required: ['prepared', 'evidence'],
|
|
950
961
|
},
|
|
951
962
|
execution: {
|
|
952
963
|
type: 'object',
|
|
@@ -988,7 +999,7 @@ export function createVerifyTool(runtime) {
|
|
|
988
999
|
required: ['allPassed', 'checks', 'retrospective'],
|
|
989
1000
|
},
|
|
990
1001
|
},
|
|
991
|
-
required: ['planning', 'execution', 'verification'],
|
|
1002
|
+
required: ['planning', 'preparation', 'execution', 'verification'],
|
|
992
1003
|
},
|
|
993
1004
|
},
|
|
994
1005
|
required: ['phases'],
|
|
@@ -1854,7 +1865,7 @@ export function apply(ctx, config = {}) {
|
|
|
1854
1865
|
}
|
|
1855
1866
|
export const meta = {
|
|
1856
1867
|
name,
|
|
1857
|
-
version: '3.0.
|
|
1868
|
+
version: '3.0.3',
|
|
1858
1869
|
promptOrder: PROMPT_ORDER,
|
|
1859
1870
|
routes: ['/dsh-workplan/plans', '/dsh-workplan/vendor/chart.umd.js'],
|
|
1860
1871
|
};
|
package/lib/plan.js
CHANGED
|
@@ -1805,7 +1805,7 @@ function flushPreHeadNotices(session) {
|
|
|
1805
1805
|
return;
|
|
1806
1806
|
preHeadNoticeQueue.delete(session);
|
|
1807
1807
|
for (const message of queue)
|
|
1808
|
-
session.append('user/message', message, { surfaceOp: 'append' });
|
|
1808
|
+
session.append('user/message', toJsonSafe(message), { surfaceOp: 'append' });
|
|
1809
1809
|
}
|
|
1810
1810
|
/*
|
|
1811
1811
|
* [2.5.5][治本] 头落地自动补发保险丝:旧实现只在「下一次 appendUserMessage」
|
|
@@ -1925,6 +1925,10 @@ const DURABLE_ENVELOPE_KINDS = new Set([
|
|
|
1925
1925
|
* - 本轮结算 finishRound 之前。
|
|
1926
1926
|
* 回放侧 parseUpdateMessages 把汇总消息里的 updates 数组按序逐条返回,语义与
|
|
1927
1927
|
* 逐条落盘完全等价(reconstructFromSession 仍是唯一的应用者)。
|
|
1928
|
+
*
|
|
1929
|
+
* [T3 写入失败限流] 合并落盘失败的重试策略:同批缓冲首次失败只记一次错误
|
|
1930
|
+
* (failed 闩锁),此后所有周期重试时机一律跳过该批,避免错误刷屏与无效重试;
|
|
1931
|
+
* 该批缓冲收到新台账更新时闩锁自动复位,重试恢复(缓冲本体始终保留,不丢台账)。
|
|
1928
1932
|
*/
|
|
1929
1933
|
export const PENDING_UPDATE_COUNT_LIMIT = 100;
|
|
1930
1934
|
export const PENDING_UPDATE_SIZE_LIMIT = 200_000;
|
|
@@ -1979,6 +1983,9 @@ function tryBufferWorkplanUpdate(session, message) {
|
|
|
1979
1983
|
if (!buffer.planId && typeof durable.planId === 'string')
|
|
1980
1984
|
buffer.planId = durable.planId;
|
|
1981
1985
|
buffer.updates.push(durable);
|
|
1986
|
+
/* [T3 写入失败限流] 新台账更新到来即恢复该批的重试资格(此前可能因首次落盘
|
|
1987
|
+
* 失败而被限流停掉)。 */
|
|
1988
|
+
buffer.failed = false;
|
|
1982
1989
|
try {
|
|
1983
1990
|
buffer.size += JSON.stringify(durable).length;
|
|
1984
1991
|
}
|
|
@@ -2007,6 +2014,10 @@ export function flushPendingWorkplanUpdates(session) {
|
|
|
2007
2014
|
const buffer = pendingUpdateBuffers.get(session);
|
|
2008
2015
|
if (!buffer || buffer.updates.length === 0)
|
|
2009
2016
|
return undefined;
|
|
2017
|
+
/* [T3 写入失败限流] 同批缓冲首次落盘失败后已记录一次错误并停止周期重试:
|
|
2018
|
+
* 这里直接跳过,下一次 tryBufferWorkplanUpdate 收到新更新会复位 failed。 */
|
|
2019
|
+
if (buffer.failed)
|
|
2020
|
+
return undefined;
|
|
2010
2021
|
const updates = buffer.updates;
|
|
2011
2022
|
const planId = buffer.planId || (typeof updates[updates.length - 1]?.planId === 'string' ? updates[updates.length - 1].planId : '');
|
|
2012
2023
|
const tail = updates
|
|
@@ -2028,7 +2039,7 @@ export function flushPendingWorkplanUpdates(session) {
|
|
|
2028
2039
|
flushingUpdateSessions.add(session);
|
|
2029
2040
|
try {
|
|
2030
2041
|
const appended = appendUserMessage(session, message);
|
|
2031
|
-
/* 只有真正落盘才清空缓冲:append
|
|
2042
|
+
/* 只有真正落盘才清空缓冲:append 抛错时保留缓冲,台账不静默消失。 */
|
|
2032
2043
|
if (pendingUpdateBuffers.get(session) === buffer)
|
|
2033
2044
|
pendingUpdateBuffers.delete(session);
|
|
2034
2045
|
const timer = pendingUpdateTimers.get(session);
|
|
@@ -2038,10 +2049,86 @@ export function flushPendingWorkplanUpdates(session) {
|
|
|
2038
2049
|
}
|
|
2039
2050
|
return appended;
|
|
2040
2051
|
}
|
|
2052
|
+
catch (error) {
|
|
2053
|
+
/* [T3 写入失败限流] 同批缓冲首次失败:只记一次错误并置 failed 闩锁,此后
|
|
2054
|
+
* 周期重试(定时补发 / pre-step 合并 / 结算合并)一律跳过该批;缓冲收到新
|
|
2055
|
+
* 台账更新时 failed 复位,重试自动恢复。缓冲本体保留,不丢台账。 */
|
|
2056
|
+
buffer.failed = true;
|
|
2057
|
+
console.warn(`[dsh-workplan] 进度归档合并落盘失败(该批 ${updates.length} 条台账已停止周期重试,新台账更新到来时自动恢复):${error instanceof Error ? error.message : String(error)}`);
|
|
2058
|
+
return undefined;
|
|
2059
|
+
}
|
|
2041
2060
|
finally {
|
|
2042
2061
|
flushingUpdateSessions.delete(session);
|
|
2043
2062
|
}
|
|
2044
2063
|
}
|
|
2064
|
+
/**
|
|
2065
|
+
* [T2][治本·JSON 净化] 把任意进度数据递归净化为纯 JSON(可通过宿主
|
|
2066
|
+
* snapshotAppend / snapshotJsonValue 的 JSON.stringify+parse 往返校验)。
|
|
2067
|
+
* 语义约定(全部边界类型均有确定行为):
|
|
2068
|
+
* - 循环引用(WeakSet 检测)→ 占位字符串 "[Circular]"
|
|
2069
|
+
* - undefined / 函数 / symbol → 对象属性剔除该键;数组元素置 null
|
|
2070
|
+
* - NaN / ±Infinity → null
|
|
2071
|
+
* - Date → ISO 字符串
|
|
2072
|
+
* - Map → 普通对象(键转字符串);Set → 数组
|
|
2073
|
+
* - 其它对象递归净化自有可枚举属性
|
|
2074
|
+
* 纯 JSON 输入(仅 null/boolean/number有限值/string/array/object)经净化后语义不变。
|
|
2075
|
+
*/
|
|
2076
|
+
export function toJsonSafe(value, seen) {
|
|
2077
|
+
if (value === null)
|
|
2078
|
+
return null;
|
|
2079
|
+
const t = typeof value;
|
|
2080
|
+
if (t === 'string' || t === 'boolean')
|
|
2081
|
+
return value;
|
|
2082
|
+
if (t === 'number')
|
|
2083
|
+
return Number.isFinite(value) ? value : null;
|
|
2084
|
+
if (t === 'undefined' || t === 'function' || t === 'symbol')
|
|
2085
|
+
return undefined;
|
|
2086
|
+
if (t === 'bigint')
|
|
2087
|
+
return String(value);
|
|
2088
|
+
if (value instanceof Date)
|
|
2089
|
+
return value.toISOString();
|
|
2090
|
+
const set = seen ?? new WeakSet();
|
|
2091
|
+
if (set.has(value))
|
|
2092
|
+
return '[Circular]';
|
|
2093
|
+
set.add(value);
|
|
2094
|
+
try {
|
|
2095
|
+
if (value instanceof Map) {
|
|
2096
|
+
const out = {};
|
|
2097
|
+
for (const [k, v] of value) {
|
|
2098
|
+
const sv = toJsonSafe(v, set);
|
|
2099
|
+
if (sv !== undefined)
|
|
2100
|
+
out[String(k)] = sv;
|
|
2101
|
+
}
|
|
2102
|
+
return out;
|
|
2103
|
+
}
|
|
2104
|
+
if (value instanceof Set) {
|
|
2105
|
+
const out = [];
|
|
2106
|
+
for (const v of value) {
|
|
2107
|
+
const sv = toJsonSafe(v, set);
|
|
2108
|
+
out.push(sv === undefined ? null : sv);
|
|
2109
|
+
}
|
|
2110
|
+
return out;
|
|
2111
|
+
}
|
|
2112
|
+
if (Array.isArray(value)) {
|
|
2113
|
+
const out = [];
|
|
2114
|
+
for (const v of value) {
|
|
2115
|
+
const sv = toJsonSafe(v, set);
|
|
2116
|
+
out.push(sv === undefined ? null : sv);
|
|
2117
|
+
}
|
|
2118
|
+
return out;
|
|
2119
|
+
}
|
|
2120
|
+
const out = {};
|
|
2121
|
+
for (const k of Object.keys(value)) {
|
|
2122
|
+
const sv = toJsonSafe(value[k], set);
|
|
2123
|
+
if (sv !== undefined)
|
|
2124
|
+
out[k] = sv;
|
|
2125
|
+
}
|
|
2126
|
+
return out;
|
|
2127
|
+
}
|
|
2128
|
+
finally {
|
|
2129
|
+
set.delete(value);
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2045
2132
|
export function appendUserMessage(session, payload, source, opts) {
|
|
2046
2133
|
if (!session || typeof session.append !== 'function')
|
|
2047
2134
|
return undefined;
|
|
@@ -2122,7 +2209,9 @@ export function appendUserMessage(session, payload, source, opts) {
|
|
|
2122
2209
|
return undefined;
|
|
2123
2210
|
}
|
|
2124
2211
|
flushPreHeadNotices(session);
|
|
2125
|
-
|
|
2212
|
+
/* [T2][治本] 写入前净化为纯 JSON:NaN/undefined/Date/Map/Set/循环引用等
|
|
2213
|
+
* 一律转为可序列化值,杜绝宿主 snapshotJsonValue 校验抛错导致的重试刷屏。 */
|
|
2214
|
+
return session.append('user/message', toJsonSafe(message), { surfaceOp: 'append' });
|
|
2126
2215
|
}
|
|
2127
2216
|
/*
|
|
2128
2217
|
* [2.2.5][T5] 分解期间进度文案与回报器(T3 交互规范 §3 C2/C3、§4 频率规则)。
|
|
@@ -3854,7 +3943,7 @@ export function adjudicateResult({ output, strict = true, expectedAcceptance = [
|
|
|
3854
3943
|
acceptance,
|
|
3855
3944
|
artifacts,
|
|
3856
3945
|
needs,
|
|
3857
|
-
error:
|
|
3946
|
+
error: `五步证据不完整(未按「任务梳理→资源工具方案研究→准备→执行验证→JSON 交付」回报):${phaseCheck.errors.slice(0, 6).join(';')}`,
|
|
3858
3947
|
phases: null,
|
|
3859
3948
|
};
|
|
3860
3949
|
}
|
|
@@ -6460,7 +6549,7 @@ phaseZeroContinuation = '', }) {
|
|
|
6460
6549
|
'',
|
|
6461
6550
|
'结果回传(必填):在汇报的最后附上一个结构化结果块,主 Agent 会按它逐项核对,不再只依赖自述。',
|
|
6462
6551
|
EVIDENCE_MARKER_BEGIN,
|
|
6463
|
-
'{"status":"done","blockedReason":"","phases":{"planning":{"problemAnalysis":["要解决的问题 1(含现状/约束/未知/主要矛盾)"],"constraints":["..."],"unknowns":["..."],"approach":["第 1 步:做什么 → 产出什么 → 如何证明"]},"execution":{"steps":["实际执行的步骤"],"deviations":[]},"verification":{"allPassed":true,"checks":[{"criterion":"A1","method":"怎么验证","evidence":"命令输出/文件/引用"}],"requirementCheck":"逐条核对用户原要求的结果","retrospective":{"problems":["本次遇到的问题(现象+根因)"],"detours":["走过的弯路/返工/无效尝试;确实没有就写 []"],"resolutions":["最终是如何解决的"],"prevention":["以后如何预防再犯:遇到…先…"]}}},"acceptance":[{"criterion":"A1 把上面的验收标准原文抄在这里","result":"pass","evidence":"用命令输出、文件路径或引用证明"}],"artifacts":[{"kind":"file","ref":"相对工作目录的路径"}],"needs":[],"question":"","options":[],"timeSpentMinutes":0,"finalEstimateMinutes":0}',
|
|
6552
|
+
'{"status":"done","blockedReason":"","phases":{"planning":{"problemAnalysis":["要解决的问题 1(含现状/约束/未知/主要矛盾)"],"constraints":["..."],"unknowns":["..."],"resources":["完成本任务需要的资源:数据/文件/权限/人/知识/时间(逐项写用途与获取方式)"],"tools":["需要的工具及用途(为什么选它)"],"approach":["第 1 步:做什么 → 产出什么 → 如何证明"]},"preparation":{"prepared":["已备齐的资源/工具:准备了什么、在哪里、是否可用"],"evidence":["每项就绪证据:命令输出/文件路径/配置项/版本号/引用"]},"execution":{"steps":["实际执行的步骤"],"deviations":[]},"verification":{"allPassed":true,"checks":[{"criterion":"A1","method":"怎么验证","evidence":"命令输出/文件/引用"}],"requirementCheck":"逐条核对用户原要求的结果","retrospective":{"problems":["本次遇到的问题(现象+根因)"],"detours":["走过的弯路/返工/无效尝试;确实没有就写 []"],"resolutions":["最终是如何解决的"],"prevention":["以后如何预防再犯:遇到…先…"]}}},"acceptance":[{"criterion":"A1 把上面的验收标准原文抄在这里","result":"pass","evidence":"用命令输出、文件路径或引用证明"}],"artifacts":[{"kind":"file","ref":"相对工作目录的路径"}],"needs":[],"question":"","options":[],"timeSpentMinutes":0,"finalEstimateMinutes":0}',
|
|
6464
6553
|
EVIDENCE_MARKER_END,
|
|
6465
6554
|
'- [2.2.9] 盘上结算备份(必做):发送结果块之前,先把同一份 JSON 写入 reports/wp-settlement-<你的子任务 ID>.json(相对工作目录)。收尾消息因异常(error/截断/超时)丢失时,宿主会自动采纳该备份结算,避免「已完成的工作」被误判为「缺失回报」而受阻并级联冻结下游。[2.5.2][T4b] 备份 JSON 顶层必须带 planId 与 subtaskId(childId 若已知也带上),且必须是本次执行新写(覆盖同名旧文件):宿主采纳前会校验新鲜度(文件修改时间不早于本次尝试开始时间)与归属(planId/subtaskId 必须匹配本计划/本子任务),陈旧或跨计划的备份会被拒绝采纳并留审计痕。',
|
|
6466
6555
|
'- status 只能是 done / blocked / partial;partial 会被当作受阻处理。',
|
package/lib/runtime.js
CHANGED
|
@@ -6997,21 +6997,21 @@ export function createWorkplanRuntime(ctx, options = {}) {
|
|
|
6997
6997
|
const expectedAcceptance = Array.isArray(found?.subtask?.acceptance) ? found.subtask.acceptance : [];
|
|
6998
6998
|
const rawPhases = isRecord(args?.phases)
|
|
6999
6999
|
? args.phases
|
|
7000
|
-
: { planning: args?.planning, execution: args?.execution, verification: args?.verification };
|
|
7000
|
+
: { planning: args?.planning, preparation: args?.preparation, execution: args?.execution, verification: args?.verification };
|
|
7001
7001
|
const check = validatePhaseEvidence(rawPhases, expectedAcceptance);
|
|
7002
7002
|
if (!check.ok || !check.phases) {
|
|
7003
7003
|
const gate = phaseGateFromErrors(check.errors);
|
|
7004
7004
|
return {
|
|
7005
7005
|
ok: false,
|
|
7006
7006
|
passed: false,
|
|
7007
|
-
code: gate === 'phase-1-
|
|
7007
|
+
code: gate === 'phase-1-3' ? 'PHASE_GATE' : 'VERIFICATION_INCOMPLETE',
|
|
7008
7008
|
phase: gate,
|
|
7009
7009
|
planId: record.plan.planId,
|
|
7010
7010
|
subtaskId: row.subtaskId,
|
|
7011
7011
|
gaps: check.errors,
|
|
7012
|
-
error: gate === 'phase-1-
|
|
7013
|
-
?
|
|
7014
|
-
:
|
|
7012
|
+
error: gate === 'phase-1-3'
|
|
7013
|
+
? `核验缺少前几步证据:先完成「梳理任务 → 研究资源工具方案 → 准备到位 → 执行」并按步写全证据,再提交验证核验。${check.errors.slice(0, 5).join(';')}`
|
|
7014
|
+
: `验证核验未通过:${check.errors.slice(0, 5).join(';')}`,
|
|
7015
7015
|
};
|
|
7016
7016
|
}
|
|
7017
7017
|
return {
|
|
@@ -7021,7 +7021,7 @@ export function createWorkplanRuntime(ctx, options = {}) {
|
|
|
7021
7021
|
planId: record.plan.planId,
|
|
7022
7022
|
subtaskId: row.subtaskId,
|
|
7023
7023
|
summary: phaseSummaryLine(check.phases),
|
|
7024
|
-
message: '
|
|
7024
|
+
message: '插件核验通过:前四步证据齐全、验证全部通过。现在把同一份 phases 写进结果块,并按第五步以 JSON mode 交回本部门负责人。',
|
|
7025
7025
|
};
|
|
7026
7026
|
}
|
|
7027
7027
|
/**
|
package/lib/three-phase.js
CHANGED
|
@@ -43,7 +43,7 @@ import { diceSimilarity } from './v3-contract.js';
|
|
|
43
43
|
/** 三阶段顺序不可颠倒;这里也是结果块里 `phases` 的键名。 */
|
|
44
44
|
export const THREE_PHASE_IDS = Object.freeze(['planning', 'execution', 'verification']);
|
|
45
45
|
/** [2.5.1] 契约版本 2:规划阶段升级为两轮深度思考协议(新增必填 approachBasis)。 */
|
|
46
|
-
export const THREE_PHASE_VERSION =
|
|
46
|
+
export const THREE_PHASE_VERSION = 3;
|
|
47
47
|
/**
|
|
48
48
|
* 「全面、全盘、深入」无法由代码度量,但可以给一个不可忽略的下限:
|
|
49
49
|
* 第一轮任务深研与第二轮方法、流程、步骤各至少 40 个字符,避免一个词就冒充
|
|
@@ -52,6 +52,10 @@ export const THREE_PHASE_VERSION = 2;
|
|
|
52
52
|
export const MIN_PLANNING_PROBLEM_CHARS = 40;
|
|
53
53
|
export const MIN_PLANNING_APPROACH_CHARS = 40;
|
|
54
54
|
export const MIN_PLANNING_BASIS_CHARS = 20;
|
|
55
|
+
/** [3.1.0] 第二步资源与工具、第三步准备与就绪证据的下限(合计字符数)。 */
|
|
56
|
+
export const MIN_RESOURCE_CHARS = 20;
|
|
57
|
+
export const MIN_TOOL_CHARS = 10;
|
|
58
|
+
export const MIN_PREPARATION_CHARS = 20;
|
|
55
59
|
export const MAX_PHASE_LIST_ITEMS = 20;
|
|
56
60
|
export const MAX_PHASE_ITEM_CHARS = 800;
|
|
57
61
|
export const MAX_PHASE_TOTAL_CHARS = 6000;
|
|
@@ -153,13 +157,16 @@ export function validatePhaseEvidence(value, expectedAcceptance = []) {
|
|
|
153
157
|
return {
|
|
154
158
|
ok: false,
|
|
155
159
|
phases: null,
|
|
156
|
-
errors: ['phases 缺失:必须提交 planning
|
|
160
|
+
errors: ['phases 缺失:必须提交 planning(第一、二步)/ preparation(第三步)/ execution(第四步)/ verification(第四步验证)四组证据,第五步用 report / departmentSummary 交付'],
|
|
157
161
|
failedPhase: 'shape',
|
|
158
162
|
};
|
|
159
163
|
}
|
|
160
164
|
const planningRaw = isRecord(value.planning) ? value.planning : null;
|
|
161
165
|
if (!planningRaw)
|
|
162
|
-
fail('planning', 'phases.planning
|
|
166
|
+
fail('planning', 'phases.planning 缺失(第一步 · 任务梳理 + 第二步 · 资源/工具/实施方案研究:先全面、全盘、深入梳理研究自己的任务,再基于其结果研究需要哪些资源、哪些工具、具体实施方案)');
|
|
167
|
+
const preparationRaw = isRecord(value.preparation) ? value.preparation : null;
|
|
168
|
+
if (!preparationRaw)
|
|
169
|
+
fail('preparation', 'phases.preparation 缺失(第三步 · 准备:把第二步研究出的资源、工具、实施方案真正备齐,并给出就绪证据)');
|
|
163
170
|
const executionRaw = isRecord(value.execution) ? value.execution : null;
|
|
164
171
|
if (!executionRaw)
|
|
165
172
|
fail('execution', 'phases.execution 缺失(阶段二:基于第二轮理清的方法、流程、步骤执行)');
|
|
@@ -181,6 +188,14 @@ export function validatePhaseEvidence(value, expectedAcceptance = []) {
|
|
|
181
188
|
required: !!planningRaw,
|
|
182
189
|
minItems: 1,
|
|
183
190
|
}),
|
|
191
|
+
resources: readTextList(planningRaw?.resources, 'phases.planning.resources', errors, {
|
|
192
|
+
required: !!planningRaw,
|
|
193
|
+
minItems: 1,
|
|
194
|
+
}),
|
|
195
|
+
tools: readTextList(planningRaw?.tools, 'phases.planning.tools', errors, {
|
|
196
|
+
required: !!planningRaw,
|
|
197
|
+
minItems: 1,
|
|
198
|
+
}),
|
|
184
199
|
};
|
|
185
200
|
if (errors.some((item) => item.startsWith('phases.planning.problemAnalysis')))
|
|
186
201
|
failedPhase ||= 'planning';
|
|
@@ -195,6 +210,30 @@ export function validatePhaseEvidence(value, expectedAcceptance = []) {
|
|
|
195
210
|
if (planning.approachBasis.length > 0 && totalChars(planning.approachBasis) < MIN_PLANNING_BASIS_CHARS) {
|
|
196
211
|
fail('planning', `phases.planning.approachBasis 太薄(合计 ${totalChars(planning.approachBasis)} 字,至少 ${MIN_PLANNING_BASIS_CHARS} 字):要写清第二轮的方法、流程、步骤如何基于第一轮梳理、研究、思考完成好的所有结果`);
|
|
197
212
|
}
|
|
213
|
+
if (planning.resources.length > 0 && totalChars(planning.resources) < MIN_RESOURCE_CHARS) {
|
|
214
|
+
fail('planning', `phases.planning.resources 太薄(合计 ${totalChars(planning.resources)} 字,至少 ${MIN_RESOURCE_CHARS} 字):第二步要逐项写清完成本任务需要哪些资源(数据/文件/权限/人/知识/时间),缺一项就会在执行中卡住`);
|
|
215
|
+
}
|
|
216
|
+
if (planning.tools.length > 0 && totalChars(planning.tools) < MIN_TOOL_CHARS) {
|
|
217
|
+
fail('planning', `phases.planning.tools 太薄(合计 ${totalChars(planning.tools)} 字,至少 ${MIN_TOOL_CHARS} 字):第二步要逐项写清需要哪些工具、每个工具用来做什么、为什么选它`);
|
|
218
|
+
}
|
|
219
|
+
const preparation = {
|
|
220
|
+
prepared: readTextList(preparationRaw?.prepared, 'phases.preparation.prepared', errors, {
|
|
221
|
+
required: !!preparationRaw,
|
|
222
|
+
minItems: 1,
|
|
223
|
+
}),
|
|
224
|
+
evidence: readTextList(preparationRaw?.evidence, 'phases.preparation.evidence', errors, {
|
|
225
|
+
required: !!preparationRaw,
|
|
226
|
+
minItems: 1,
|
|
227
|
+
}),
|
|
228
|
+
};
|
|
229
|
+
if (errors.some((item) => item.startsWith('phases.preparation')))
|
|
230
|
+
failedPhase ||= 'preparation';
|
|
231
|
+
if (preparation.prepared.length > 0 && totalChars(preparation.prepared) < MIN_PREPARATION_CHARS) {
|
|
232
|
+
fail('preparation', `phases.preparation.prepared 太薄(合计 ${totalChars(preparation.prepared)} 字,至少 ${MIN_PREPARATION_CHARS} 字):第三步要把第二步研究出的资源与工具真正备齐,逐项写清准备了什么、在哪里、是否可用`);
|
|
233
|
+
}
|
|
234
|
+
if (preparation.evidence.length > 0 && totalChars(preparation.evidence) < MIN_PREPARATION_CHARS) {
|
|
235
|
+
fail('preparation', `phases.preparation.evidence 太薄(合计 ${totalChars(preparation.evidence)} 字,至少 ${MIN_PREPARATION_CHARS} 字):每一项就绪状态都要有可复核的证据(命令输出/文件路径/配置项/版本号/引用)`);
|
|
236
|
+
}
|
|
198
237
|
const execution = {
|
|
199
238
|
steps: readTextList(executionRaw?.steps, 'phases.execution.steps', errors, {
|
|
200
239
|
required: !!executionRaw,
|
|
@@ -260,6 +299,7 @@ export function validatePhaseEvidence(value, expectedAcceptance = []) {
|
|
|
260
299
|
const phases = {
|
|
261
300
|
version: THREE_PHASE_VERSION,
|
|
262
301
|
planning,
|
|
302
|
+
preparation,
|
|
263
303
|
execution,
|
|
264
304
|
verification,
|
|
265
305
|
};
|
|
@@ -269,6 +309,10 @@ export function validatePhaseEvidence(value, expectedAcceptance = []) {
|
|
|
269
309
|
...planning.unknowns,
|
|
270
310
|
...planning.approach,
|
|
271
311
|
...planning.approachBasis,
|
|
312
|
+
...planning.resources,
|
|
313
|
+
...planning.tools,
|
|
314
|
+
...preparation.prepared,
|
|
315
|
+
...preparation.evidence,
|
|
272
316
|
...execution.steps,
|
|
273
317
|
...execution.deviations,
|
|
274
318
|
verification.requirementCheck,
|
|
@@ -285,20 +329,22 @@ export function validatePhaseEvidence(value, expectedAcceptance = []) {
|
|
|
285
329
|
* still in phase 1 or 2, where the plugin is disabled by the user's rule.
|
|
286
330
|
*/
|
|
287
331
|
export function phaseGateFromErrors(errors) {
|
|
288
|
-
return errors.some((item) => /^phases(\.| 缺失)/.test(item) && /planning|execution/.test(item))
|
|
289
|
-
? 'phase-1-
|
|
332
|
+
return errors.some((item) => /^phases(\.| 缺失)/.test(item) && /planning|preparation|execution/.test(item))
|
|
333
|
+
? 'phase-1-3'
|
|
290
334
|
: 'verification';
|
|
291
335
|
}
|
|
292
336
|
/** One-line, model-readable summary of what the three phases contain. */
|
|
293
337
|
export function phaseSummaryLine(phases) {
|
|
294
338
|
const deviations = phases.execution.deviations.length;
|
|
295
339
|
return [
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
340
|
+
`第一步 任务梳理(${phases.planning.problemAnalysis.length} 条)`,
|
|
341
|
+
`第二步 资源/工具/方案研究(资源 ${phases.planning.resources.length} 项 / 工具 ${phases.planning.tools.length} 项 / 方法 ${phases.planning.approach.length} 步 / 依据 ${phases.planning.approachBasis.length} 条)`,
|
|
342
|
+
`第三步 准备(已备 ${phases.preparation.prepared.length} 项 / 就绪证据 ${phases.preparation.evidence.length} 条)`,
|
|
343
|
+
`第四步 执行与验证(执行 ${phases.execution.steps.length} 步${deviations ? ` / 偏离 ${deviations} 处` : ''};验证 ${phases.verification.checks.length} 项${phases.verification.allPassed ? ',全部通过' : ',未全部通过'};`
|
|
299
344
|
+ `复盘 ${phases.verification.retrospective.problems.length} 个问题 / `
|
|
300
345
|
+ `${phases.verification.retrospective.detours.length} 条弯路 / `
|
|
301
346
|
+ `${phases.verification.retrospective.prevention.length} 条防再犯规则)`,
|
|
347
|
+
'第五步 JSON 交付(report / departmentSummary,只含关键信息)',
|
|
302
348
|
].join(';');
|
|
303
349
|
}
|
|
304
350
|
/**
|
|
@@ -310,26 +356,29 @@ export function phaseSummaryLine(phases) {
|
|
|
310
356
|
*/
|
|
311
357
|
export function threePhasePromptLines() {
|
|
312
358
|
return [
|
|
313
|
-
'
|
|
314
|
-
'
|
|
315
|
-
'
|
|
316
|
-
'
|
|
317
|
-
'
|
|
318
|
-
'
|
|
319
|
-
'
|
|
320
|
-
'
|
|
321
|
-
'
|
|
322
|
-
'
|
|
359
|
+
'五步工作法(用户 2026-11-17 强制要求,取代旧的三阶段口径;五个步骤必须按顺序执行,前一步没有完成并写好证据之前,禁止进入下一步):',
|
|
360
|
+
'【第一步 · 任务梳理(部门负责人、相关领域全球顶尖专家执行自己的任务时同一口径)】',
|
|
361
|
+
' 先全面、全盘、深入梳理、研究、思考自己的任务:逐条写清任务目标与验收标准、现状与已知事实、约束条件、未知/待确认项、主要矛盾、工作边界与依赖,结果写入 phases.planning.problemAnalysis(约束写 constraints,未知写 unknowns)。',
|
|
362
|
+
'【第二步 · 资源、工具与实施方案研究】',
|
|
363
|
+
' 基于第一步完成好的所有结果,再全面、全盘、深入地梳理、研究、思考:完成本任务需要哪些资源(数据/文件/权限/人/知识/时间)写入 phases.planning.resources;需要哪些工具、每个工具用来做什么写入 phases.planning.tools;具体实施方案写成自己该具体如何一步步以最高效率执行、确保完美完成自己任务的方法、流程和步骤(每一步做什么、产出什么、依赖什么、风险与对策、如何证明做对了,以及全程如何少走弯路:先查历史教训、先验证再动手、不重复试错)写入 phases.planning.approach;同时把第二步如何基于第一步全部结果逐条对应写入 phases.planning.approachBasis。',
|
|
364
|
+
' 自检:任何一条验收标准或用户原要求没有落在第二步的资源、工具与实施方案上,就回到第一步重做。',
|
|
365
|
+
'【第三步 · 准备】',
|
|
366
|
+
' 基于第二步的全部结果,把需要的资源、工具、实施方案真正准备到位,而不是「打算用」:逐项写清准备了什么、在哪里、是否可用,写入 phases.preparation.prepared;每一项就绪状态都必须给出可复核的证据(命令输出/文件路径/配置项/版本号/引用),写入 phases.preparation.evidence。缺资源、缺工具、缺证据时,先补齐或如实上报受阻,不得带着缺口进入第四步。',
|
|
367
|
+
'【第四步 · 执行与验证】',
|
|
368
|
+
' 基于第三步备齐的成果和既定实施方案,开始具体执行,严格按 phases.planning.approach 落地;出现新事实需要偏离时,必须记录偏离原因、证据与调整后的做法,不得静默改道,执行步骤写入 phases.execution.steps。',
|
|
369
|
+
' 执行完成后逐条验证验收标准与用户原要求:每条都要有可复核的证据(命令输出/文件/引用);验证未通过不得报 done,无法确认写 unverified;结果写入 phases.verification。',
|
|
370
|
+
'【第四步收尾 · 自我学习复盘(强制)】',
|
|
323
371
|
' 报 done 之前必须把 phases.verification.retrospective 写全,四项缺一不可:',
|
|
324
372
|
' 1) problems:本次全过程遇到的所有问题(现象 + 根因),至少 1 条;',
|
|
325
373
|
' 2) detours:走过的弯路、返工与无效尝试(确实没有就写空数组 [],不要编造);',
|
|
326
374
|
' 3) resolutions:最终是如何解决上述问题的,至少 1 条,可与 problems 一一对应;',
|
|
327
375
|
' 4) prevention:以后如何预防再犯,至少 1 条,必须写成「遇到…先…」的可执行硬规则。',
|
|
328
|
-
'
|
|
329
|
-
'
|
|
330
|
-
'
|
|
331
|
-
' -
|
|
332
|
-
' -
|
|
376
|
+
'【第五步 · JSON mode 结构化交付给本部门负责人】',
|
|
377
|
+
' 执行完美完成后,必须把成果以 JSON mode 结构化交回本部门负责人:专家写入 report 对象(只允许 keyResults / keyInfo / importantInfo / leadRequirements 四个字符串数组字段,只写关键信息、关键成果、重要信息和负责人要求的东西,禁止过程流水账与重复表述);部门负责人写入 departmentSummary 对象(keyResults / keyInfo / importantInfo / sources,汇总本部门全部专家汇报,sources 必须覆盖全部已派发专家)。成果块必须放在 <!-- WORKPLAN_EVIDENCE:START --> 与 <!-- WORKPLAN_EVIDENCE:END --> 之间,且是合法 JSON,不得用散文代替。',
|
|
378
|
+
'插件使用说明(五步证据门禁):',
|
|
379
|
+
' - 第一、二、三步:先把问题梳理、资源/工具/实施方案、准备与就绪证据写全;此时不要调用 dsh_workplan_verify,它会因缺少前几步证据返回 PHASE_GATE 与待补项(这是证据门禁,不是禁用插件)。',
|
|
380
|
+
' - 第四步:可以调用 dsh_workplan_verify 让插件做最终核验:提交 planning / preparation / execution / verification 证据,插件返回 passed 或仍需补齐的 gaps;未通过先修复再回报。遇阻时可用 dsh_workplan_escalate 上报,它是安全通道,不属于五步产物。',
|
|
381
|
+
' - 结果块里的 phases 是必填项:缺 planning / preparation / execution / verification 任一组、内容为空、或验证未全部通过,插件都会判为未完成,不能用 done 收尾;第五步缺 report / departmentSummary 同样判为未完成。',
|
|
333
382
|
];
|
|
334
383
|
}
|
|
335
384
|
/**
|
package/package.json
CHANGED
package/src/comm-format.ts
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
* 专家结果查 F10,部门负责人结果查 F11,未声明层级时两条都不查
|
|
35
35
|
* (历史回放与其它调用点零回归)。
|
|
36
36
|
*/
|
|
37
|
-
export const COMM_FORMAT_VERSION =
|
|
37
|
+
export const COMM_FORMAT_VERSION = 3
|
|
38
38
|
|
|
39
39
|
/** 单条不合规项。 */
|
|
40
40
|
export interface CommFormatViolation {
|
|
@@ -70,8 +70,8 @@ export const COMM_FORMAT_SPEC = Object.freeze({
|
|
|
70
70
|
description: '证据块必须是合法 JSON 对象,顶层必须含 status 字段,取值只能是 done / blocked / partial',
|
|
71
71
|
rationale: 'status 是交付门禁的入口条件,缺失或非法则无法判定完成与否' }),
|
|
72
72
|
Object.freeze({ id: 'F3', category: 'phases',
|
|
73
|
-
description: '
|
|
74
|
-
rationale: '
|
|
73
|
+
description: '必须包含五步工作法证据:phases.planning(第一步问题梳理 problemAnalysis + 第二步资源 resources / 工具 tools / 方法流程步骤 approach / 依据 approachBasis)、phases.preparation(第三步准备与就绪证据)、phases.execution(第四步实际执行步骤)、phases.verification(第四步逐项验证与复盘);第五步交付由 F10/F11 的 report / departmentSummary 承载',
|
|
74
|
+
rationale: '五步是质量闭环的基础,缺任一步等于跳过对应质控环节' }),
|
|
75
75
|
Object.freeze({ id: 'F4', category: 'acceptance',
|
|
76
76
|
description: '验收结果必须逐条回应计划的验收标准(A1、A2…),且每条 result=pass 必须附带具体证据(命令输出/文件路径/引用),禁止空证据 pass',
|
|
77
77
|
rationale: '空证据 pass 是自述而非验证,交付门禁只认可证据' }),
|
|
@@ -165,14 +165,15 @@ export function checkCommFormatCompliance(
|
|
|
165
165
|
const phases = parsed.phases
|
|
166
166
|
if (!phases || typeof phases !== 'object') {
|
|
167
167
|
violations.push({ ruleId: 'F3', category: 'phases',
|
|
168
|
-
message: '缺少 phases 对象:planning / execution / verification
|
|
168
|
+
message: '缺少 phases 对象:planning / preparation / execution / verification 证据全部缺失' })
|
|
169
169
|
} else {
|
|
170
170
|
const missing: string[] = []
|
|
171
|
-
if (!phases.planning || typeof phases.planning !== 'object') missing.push('planning
|
|
172
|
-
if (!phases.
|
|
173
|
-
if (!phases.
|
|
171
|
+
if (!phases.planning || typeof phases.planning !== 'object') missing.push('planning(第一步问题梳理 + 第二步资源/工具/方案)')
|
|
172
|
+
if (!phases.preparation || typeof phases.preparation !== 'object') missing.push('preparation(第三步准备与就绪证据)')
|
|
173
|
+
if (!phases.execution || typeof phases.execution !== 'object') missing.push('execution(第四步实际执行步骤)')
|
|
174
|
+
if (!phases.verification || typeof phases.verification !== 'object') missing.push('verification(第四步逐项验证与复盘)')
|
|
174
175
|
if (missing.length > 0) {
|
|
175
|
-
violations.push({ ruleId: 'F3', category: 'phases', message:
|
|
176
|
+
violations.push({ ruleId: 'F3', category: 'phases', message: `五步证据缺失:${missing.join('、')}` })
|
|
176
177
|
}
|
|
177
178
|
}
|
|
178
179
|
|
package/src/host.ts
CHANGED
|
@@ -84,7 +84,7 @@ export const inject = ['tools', 'systemPrompt', 'llm', 'subagents', 'sessions']
|
|
|
84
84
|
export const PROMPT_ORDER = 40
|
|
85
85
|
|
|
86
86
|
const PROMPT_SECTION = [
|
|
87
|
-
'
|
|
87
|
+
'本会话已启用自动任务分解。系统会在每个新用户任务的第一个模型步骤前生成计划,并先把计划显示在对话里;看到【任务分解】计划消息后,若插件未自动派发或需要续跑/重试,再调用 dsh_workplan_dispatch(默认 wait 等结果;预计较久时用 mode:"async" 先开跑)。若只收到「任务分解已在后台生成中」而尚未看到【任务分解】,不要手动派发,先告知用户正在分配并等待计划落地。',
|
|
88
88
|
/*
|
|
89
89
|
* [3.0.0] 用户 2026-11-14 十三条要求的提示词侧双保险(代码侧同源门禁见
|
|
90
90
|
* v3-contract / comm-format / llm-rules / runtime)。文案不做发挥,只写
|
|
@@ -94,7 +94,7 @@ const PROMPT_SECTION = [
|
|
|
94
94
|
'3.0.0 任务书质量要求(用户要求 3/6):插件派给部门负责人的每个子任务都携带 qualityRequirements(结果质量要求),部门负责人派给专家的每条任务也必须携带 qualityRequirements。负责人→专家缺它平台直接拒绝派发(DELEGATE_QUALITY_REQUIREMENTS_MISSING);主 Agent→部门负责人缺它则该子任务在派发时被直接拒发(DISPATCH_QUALITY_REQUIREMENTS_MISSING,不启动部门 Agent),须 replan 补齐后重派。你审阅计划时先看每个子任务是否写了清楚的质量要求。',
|
|
95
95
|
'3.0.0 极简任务(用户要求 5,用户裁决 A=硬门槛):部门负责人派出的每条任务必须简单到像 1+1=2——一个动作、一个主产物、一项可独立验收,单句、≤300 字符、不含「并且/同时/另外/还要/以及/分别/顺便」等并列词;不满足即被拒绝并给出拆分提示(DELEGATE_TASK_NOT_ATOMIC)。',
|
|
96
96
|
'3.0.0 角色与汇报(用户要求 7/8/9/10/11/12):部门组员角色已取消,只保留部门负责人与全球顶尖专家(role 只允许 expert);专家完成后必须以 JSON 汇报(证据块里的 report:keyResults/keyInfo/importantInfo/leadRequirements,精简、禁止重复,F10);部门负责人必须全面汇总本部门全部专家汇报后,以 JSON 交回主 Agent(departmentSummary:keyResults/keyInfo/importantInfo/sources,精简、禁止累赘重复,F11);等所有部门的汇总都交回后,由你再全面、深入整理汇总成最终成果交付给用户(用户要求 12)。',
|
|
97
|
-
'3.0.
|
|
97
|
+
'3.0.3 版本(用户要求 13):本插件当前版本为 3.0.3。涉及版本号的对外表述一律写 3.0.3。',
|
|
98
98
|
/*
|
|
99
99
|
* [2.5.1] 主 Agent 两轮深度思考协议(用户 2026-11-11 补充要求):部门三层
|
|
100
100
|
* 执行者已有结算/再分配双门禁,主 Agent 自己也必须做到同一协议——提示词
|
|
@@ -1032,7 +1032,7 @@ export function createVerifyTool(runtime: any) {
|
|
|
1032
1032
|
},
|
|
1033
1033
|
phases: {
|
|
1034
1034
|
type: 'object',
|
|
1035
|
-
description: '
|
|
1035
|
+
description: '五步证据:planning(第一步问题梳理 + 第二步资源/工具/方案)、preparation(第三步准备与就绪证据)、execution(第四步执行步骤)、verification(第四步逐项验证与复盘)。',
|
|
1036
1036
|
properties: {
|
|
1037
1037
|
planning: {
|
|
1038
1038
|
type: 'object',
|
|
@@ -1042,9 +1042,20 @@ export function createVerifyTool(runtime: any) {
|
|
|
1042
1042
|
constraints: { type: 'array', items: { type: 'string' }, description: '约束条件' },
|
|
1043
1043
|
unknowns: { type: 'array', items: { type: 'string' }, description: '未知或待确认项' },
|
|
1044
1044
|
approach: { type: 'array', items: { type: 'string' }, description: '第二轮 · 方法流程步骤:基于第一轮全部结果理清的具体一步步执行、完美完成任务的方法、流程和步骤(每一步做什么、产出什么、如何证明)' },
|
|
1045
|
-
approachBasis: { type: 'array', items: { type: 'string' }, description: '
|
|
1045
|
+
approachBasis: { type: 'array', items: { type: 'string' }, description: '第二步依据(必填):第二步的资源、工具、方案如何基于第一步完成好的所有结果——第一步的哪些事实/约束/矛盾决定了第二步的哪些资源/工具/步骤' },
|
|
1046
|
+
resources: { type: 'array', items: { type: 'string' }, description: '第二步 · 资源研究:完成本任务需要哪些资源(数据/文件/权限/人/知识/时间),逐项写清用途与获取方式' },
|
|
1047
|
+
tools: { type: 'array', items: { type: 'string' }, description: '第二步 · 工具研究:需要哪些工具、每个工具用来做什么、为什么选它' },
|
|
1046
1048
|
},
|
|
1047
|
-
required: ['problemAnalysis', 'approach', 'approachBasis'],
|
|
1049
|
+
required: ['problemAnalysis', 'approach', 'approachBasis', 'resources', 'tools'],
|
|
1050
|
+
},
|
|
1051
|
+
preparation: {
|
|
1052
|
+
type: 'object',
|
|
1053
|
+
description: '第三步 · 准备:把第二步研究出的资源、工具、实施方案真正备齐,并给出可复核的就绪证据。',
|
|
1054
|
+
properties: {
|
|
1055
|
+
prepared: { type: 'array', items: { type: 'string' }, description: '已准备好的资源/工具清单:准备了什么、在哪里、是否可用' },
|
|
1056
|
+
evidence: { type: 'array', items: { type: 'string' }, description: '就绪证据:命令输出/文件路径/配置项/版本号/引用,与 prepared 一一对应' },
|
|
1057
|
+
},
|
|
1058
|
+
required: ['prepared', 'evidence'],
|
|
1048
1059
|
},
|
|
1049
1060
|
execution: {
|
|
1050
1061
|
type: 'object',
|
|
@@ -1086,7 +1097,7 @@ export function createVerifyTool(runtime: any) {
|
|
|
1086
1097
|
required: ['allPassed', 'checks', 'retrospective'],
|
|
1087
1098
|
},
|
|
1088
1099
|
},
|
|
1089
|
-
required: ['planning', 'execution', 'verification'],
|
|
1100
|
+
required: ['planning', 'preparation', 'execution', 'verification'],
|
|
1090
1101
|
},
|
|
1091
1102
|
},
|
|
1092
1103
|
required: ['phases'],
|
|
@@ -1998,7 +2009,7 @@ export function apply(ctx: any, config: WorkplanConfig = {}) {
|
|
|
1998
2009
|
|
|
1999
2010
|
export const meta = {
|
|
2000
2011
|
name,
|
|
2001
|
-
version: '3.0.
|
|
2012
|
+
version: '3.0.3',
|
|
2002
2013
|
promptOrder: PROMPT_ORDER,
|
|
2003
2014
|
routes: ['/dsh-workplan/plans', '/dsh-workplan/vendor/chart.umd.js'],
|
|
2004
2015
|
}
|
package/src/plan.ts
CHANGED
|
@@ -1883,7 +1883,7 @@ function flushPreHeadNotices(session: any) {
|
|
|
1883
1883
|
// 头未就绪绝不补发(否则又把通知写到 head 之前);等 head 落地后的下一次写入再补。
|
|
1884
1884
|
if (!surfaceHeadExists(session)) return
|
|
1885
1885
|
preHeadNoticeQueue.delete(session)
|
|
1886
|
-
for (const message of queue) session.append('user/message', message, { surfaceOp: 'append' })
|
|
1886
|
+
for (const message of queue) session.append('user/message', toJsonSafe(message), { surfaceOp: 'append' })
|
|
1887
1887
|
}
|
|
1888
1888
|
|
|
1889
1889
|
/*
|
|
@@ -2008,6 +2008,10 @@ const DURABLE_ENVELOPE_KINDS = new Set([
|
|
|
2008
2008
|
* - 本轮结算 finishRound 之前。
|
|
2009
2009
|
* 回放侧 parseUpdateMessages 把汇总消息里的 updates 数组按序逐条返回,语义与
|
|
2010
2010
|
* 逐条落盘完全等价(reconstructFromSession 仍是唯一的应用者)。
|
|
2011
|
+
*
|
|
2012
|
+
* [T3 写入失败限流] 合并落盘失败的重试策略:同批缓冲首次失败只记一次错误
|
|
2013
|
+
* (failed 闩锁),此后所有周期重试时机一律跳过该批,避免错误刷屏与无效重试;
|
|
2014
|
+
* 该批缓冲收到新台账更新时闩锁自动复位,重试恢复(缓冲本体始终保留,不丢台账)。
|
|
2011
2015
|
*/
|
|
2012
2016
|
export const PENDING_UPDATE_COUNT_LIMIT = 100
|
|
2013
2017
|
export const PENDING_UPDATE_SIZE_LIMIT = 200_000
|
|
@@ -2018,6 +2022,12 @@ interface PendingUpdateBuffer {
|
|
|
2018
2022
|
updates: any[]
|
|
2019
2023
|
size: number
|
|
2020
2024
|
dropped: number
|
|
2025
|
+
/**
|
|
2026
|
+
* [T3 写入失败限流] 同批缓冲首次落盘失败后置 true:此后周期重试(定时补发 /
|
|
2027
|
+
* pre-step 合并 / 结算合并)一律跳过该批,只记一次错误;缓冲收到新台账更新时
|
|
2028
|
+
* 自动复位为 false,恢复重试。
|
|
2029
|
+
*/
|
|
2030
|
+
failed?: boolean
|
|
2021
2031
|
}
|
|
2022
2032
|
|
|
2023
2033
|
const pendingUpdateBuffers = new WeakMap<object, PendingUpdateBuffer>()
|
|
@@ -2066,6 +2076,9 @@ function tryBufferWorkplanUpdate(session: any, message: any) {
|
|
|
2066
2076
|
const buffer = pendingBufferOf(session)
|
|
2067
2077
|
if (!buffer.planId && typeof durable.planId === 'string') buffer.planId = durable.planId
|
|
2068
2078
|
buffer.updates.push(durable)
|
|
2079
|
+
/* [T3 写入失败限流] 新台账更新到来即恢复该批的重试资格(此前可能因首次落盘
|
|
2080
|
+
* 失败而被限流停掉)。 */
|
|
2081
|
+
buffer.failed = false
|
|
2069
2082
|
try {
|
|
2070
2083
|
buffer.size += JSON.stringify(durable).length
|
|
2071
2084
|
} catch {
|
|
@@ -2091,6 +2104,9 @@ export function flushPendingWorkplanUpdates(session: any) {
|
|
|
2091
2104
|
if (!session || typeof session !== 'object') return undefined
|
|
2092
2105
|
const buffer = pendingUpdateBuffers.get(session)
|
|
2093
2106
|
if (!buffer || buffer.updates.length === 0) return undefined
|
|
2107
|
+
/* [T3 写入失败限流] 同批缓冲首次落盘失败后已记录一次错误并停止周期重试:
|
|
2108
|
+
* 这里直接跳过,下一次 tryBufferWorkplanUpdate 收到新更新会复位 failed。 */
|
|
2109
|
+
if (buffer.failed) return undefined
|
|
2094
2110
|
const updates = buffer.updates
|
|
2095
2111
|
const planId = buffer.planId || (typeof updates[updates.length - 1]?.planId === 'string' ? updates[updates.length - 1].planId : '')
|
|
2096
2112
|
const tail = updates
|
|
@@ -2111,7 +2127,7 @@ export function flushPendingWorkplanUpdates(session: any) {
|
|
|
2111
2127
|
flushingUpdateSessions.add(session)
|
|
2112
2128
|
try {
|
|
2113
2129
|
const appended = appendUserMessage(session, message)
|
|
2114
|
-
/* 只有真正落盘才清空缓冲:append
|
|
2130
|
+
/* 只有真正落盘才清空缓冲:append 抛错时保留缓冲,台账不静默消失。 */
|
|
2115
2131
|
if (pendingUpdateBuffers.get(session) === buffer) pendingUpdateBuffers.delete(session)
|
|
2116
2132
|
const timer = pendingUpdateTimers.get(session)
|
|
2117
2133
|
if (timer) {
|
|
@@ -2119,11 +2135,77 @@ export function flushPendingWorkplanUpdates(session: any) {
|
|
|
2119
2135
|
pendingUpdateTimers.delete(session)
|
|
2120
2136
|
}
|
|
2121
2137
|
return appended
|
|
2138
|
+
} catch (error) {
|
|
2139
|
+
/* [T3 写入失败限流] 同批缓冲首次失败:只记一次错误并置 failed 闩锁,此后
|
|
2140
|
+
* 周期重试(定时补发 / pre-step 合并 / 结算合并)一律跳过该批;缓冲收到新
|
|
2141
|
+
* 台账更新时 failed 复位,重试自动恢复。缓冲本体保留,不丢台账。 */
|
|
2142
|
+
buffer.failed = true
|
|
2143
|
+
console.warn(`[dsh-workplan] 进度归档合并落盘失败(该批 ${updates.length} 条台账已停止周期重试,新台账更新到来时自动恢复):${error instanceof Error ? error.message : String(error)}`)
|
|
2144
|
+
return undefined
|
|
2122
2145
|
} finally {
|
|
2123
2146
|
flushingUpdateSessions.delete(session)
|
|
2124
2147
|
}
|
|
2125
2148
|
}
|
|
2126
2149
|
|
|
2150
|
+
/**
|
|
2151
|
+
* [T2][治本·JSON 净化] 把任意进度数据递归净化为纯 JSON(可通过宿主
|
|
2152
|
+
* snapshotAppend / snapshotJsonValue 的 JSON.stringify+parse 往返校验)。
|
|
2153
|
+
* 语义约定(全部边界类型均有确定行为):
|
|
2154
|
+
* - 循环引用(WeakSet 检测)→ 占位字符串 "[Circular]"
|
|
2155
|
+
* - undefined / 函数 / symbol → 对象属性剔除该键;数组元素置 null
|
|
2156
|
+
* - NaN / ±Infinity → null
|
|
2157
|
+
* - Date → ISO 字符串
|
|
2158
|
+
* - Map → 普通对象(键转字符串);Set → 数组
|
|
2159
|
+
* - 其它对象递归净化自有可枚举属性
|
|
2160
|
+
* 纯 JSON 输入(仅 null/boolean/number有限值/string/array/object)经净化后语义不变。
|
|
2161
|
+
*/
|
|
2162
|
+
export function toJsonSafe(value: any, seen?: WeakSet<object>): any {
|
|
2163
|
+
if (value === null) return null
|
|
2164
|
+
const t = typeof value
|
|
2165
|
+
if (t === 'string' || t === 'boolean') return value
|
|
2166
|
+
if (t === 'number') return Number.isFinite(value) ? value : null
|
|
2167
|
+
if (t === 'undefined' || t === 'function' || t === 'symbol') return undefined
|
|
2168
|
+
if (t === 'bigint') return String(value)
|
|
2169
|
+
if (value instanceof Date) return value.toISOString()
|
|
2170
|
+
const set: WeakSet<object> = seen ?? new WeakSet<object>()
|
|
2171
|
+
if (set.has(value)) return '[Circular]'
|
|
2172
|
+
set.add(value)
|
|
2173
|
+
try {
|
|
2174
|
+
if (value instanceof Map) {
|
|
2175
|
+
const out: Record<string, any> = {}
|
|
2176
|
+
for (const [k, v] of value) {
|
|
2177
|
+
const sv = toJsonSafe(v, set)
|
|
2178
|
+
if (sv !== undefined) out[String(k)] = sv
|
|
2179
|
+
}
|
|
2180
|
+
return out
|
|
2181
|
+
}
|
|
2182
|
+
if (value instanceof Set) {
|
|
2183
|
+
const out: any[] = []
|
|
2184
|
+
for (const v of value) {
|
|
2185
|
+
const sv = toJsonSafe(v, set)
|
|
2186
|
+
out.push(sv === undefined ? null : sv)
|
|
2187
|
+
}
|
|
2188
|
+
return out
|
|
2189
|
+
}
|
|
2190
|
+
if (Array.isArray(value)) {
|
|
2191
|
+
const out: any[] = []
|
|
2192
|
+
for (const v of value) {
|
|
2193
|
+
const sv = toJsonSafe(v, set)
|
|
2194
|
+
out.push(sv === undefined ? null : sv)
|
|
2195
|
+
}
|
|
2196
|
+
return out
|
|
2197
|
+
}
|
|
2198
|
+
const out: Record<string, any> = {}
|
|
2199
|
+
for (const k of Object.keys(value)) {
|
|
2200
|
+
const sv = toJsonSafe(value[k], set)
|
|
2201
|
+
if (sv !== undefined) out[k] = sv
|
|
2202
|
+
}
|
|
2203
|
+
return out
|
|
2204
|
+
} finally {
|
|
2205
|
+
set.delete(value)
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2127
2209
|
export function appendUserMessage(session: any, payload: any, source?: any, opts?: { deferUntilHead?: boolean; allowBanned?: boolean }) {
|
|
2128
2210
|
if (!session || typeof session.append !== 'function') return undefined
|
|
2129
2211
|
let message = payload
|
|
@@ -2197,7 +2279,9 @@ export function appendUserMessage(session: any, payload: any, source?: any, opts
|
|
|
2197
2279
|
return undefined
|
|
2198
2280
|
}
|
|
2199
2281
|
flushPreHeadNotices(session)
|
|
2200
|
-
|
|
2282
|
+
/* [T2][治本] 写入前净化为纯 JSON:NaN/undefined/Date/Map/Set/循环引用等
|
|
2283
|
+
* 一律转为可序列化值,杜绝宿主 snapshotJsonValue 校验抛错导致的重试刷屏。 */
|
|
2284
|
+
return session.append('user/message', toJsonSafe(message), { surfaceOp: 'append' })
|
|
2201
2285
|
}
|
|
2202
2286
|
|
|
2203
2287
|
/*
|
|
@@ -3974,7 +4058,7 @@ export function adjudicateResult({ output, strict = true, expectedAcceptance = [
|
|
|
3974
4058
|
acceptance,
|
|
3975
4059
|
artifacts,
|
|
3976
4060
|
needs,
|
|
3977
|
-
error:
|
|
4061
|
+
error: `五步证据不完整(未按「任务梳理→资源工具方案研究→准备→执行验证→JSON 交付」回报):${phaseCheck.errors.slice(0, 6).join(';')}`,
|
|
3978
4062
|
phases: null,
|
|
3979
4063
|
}
|
|
3980
4064
|
}
|
|
@@ -6604,7 +6688,7 @@ export function buildChildPrompt({
|
|
|
6604
6688
|
'',
|
|
6605
6689
|
'结果回传(必填):在汇报的最后附上一个结构化结果块,主 Agent 会按它逐项核对,不再只依赖自述。',
|
|
6606
6690
|
EVIDENCE_MARKER_BEGIN,
|
|
6607
|
-
'{"status":"done","blockedReason":"","phases":{"planning":{"problemAnalysis":["要解决的问题 1(含现状/约束/未知/主要矛盾)"],"constraints":["..."],"unknowns":["..."],"approach":["第 1 步:做什么 → 产出什么 → 如何证明"]},"execution":{"steps":["实际执行的步骤"],"deviations":[]},"verification":{"allPassed":true,"checks":[{"criterion":"A1","method":"怎么验证","evidence":"命令输出/文件/引用"}],"requirementCheck":"逐条核对用户原要求的结果","retrospective":{"problems":["本次遇到的问题(现象+根因)"],"detours":["走过的弯路/返工/无效尝试;确实没有就写 []"],"resolutions":["最终是如何解决的"],"prevention":["以后如何预防再犯:遇到…先…"]}}},"acceptance":[{"criterion":"A1 把上面的验收标准原文抄在这里","result":"pass","evidence":"用命令输出、文件路径或引用证明"}],"artifacts":[{"kind":"file","ref":"相对工作目录的路径"}],"needs":[],"question":"","options":[],"timeSpentMinutes":0,"finalEstimateMinutes":0}',
|
|
6691
|
+
'{"status":"done","blockedReason":"","phases":{"planning":{"problemAnalysis":["要解决的问题 1(含现状/约束/未知/主要矛盾)"],"constraints":["..."],"unknowns":["..."],"resources":["完成本任务需要的资源:数据/文件/权限/人/知识/时间(逐项写用途与获取方式)"],"tools":["需要的工具及用途(为什么选它)"],"approach":["第 1 步:做什么 → 产出什么 → 如何证明"]},"preparation":{"prepared":["已备齐的资源/工具:准备了什么、在哪里、是否可用"],"evidence":["每项就绪证据:命令输出/文件路径/配置项/版本号/引用"]},"execution":{"steps":["实际执行的步骤"],"deviations":[]},"verification":{"allPassed":true,"checks":[{"criterion":"A1","method":"怎么验证","evidence":"命令输出/文件/引用"}],"requirementCheck":"逐条核对用户原要求的结果","retrospective":{"problems":["本次遇到的问题(现象+根因)"],"detours":["走过的弯路/返工/无效尝试;确实没有就写 []"],"resolutions":["最终是如何解决的"],"prevention":["以后如何预防再犯:遇到…先…"]}}},"acceptance":[{"criterion":"A1 把上面的验收标准原文抄在这里","result":"pass","evidence":"用命令输出、文件路径或引用证明"}],"artifacts":[{"kind":"file","ref":"相对工作目录的路径"}],"needs":[],"question":"","options":[],"timeSpentMinutes":0,"finalEstimateMinutes":0}',
|
|
6608
6692
|
EVIDENCE_MARKER_END,
|
|
6609
6693
|
'- [2.2.9] 盘上结算备份(必做):发送结果块之前,先把同一份 JSON 写入 reports/wp-settlement-<你的子任务 ID>.json(相对工作目录)。收尾消息因异常(error/截断/超时)丢失时,宿主会自动采纳该备份结算,避免「已完成的工作」被误判为「缺失回报」而受阻并级联冻结下游。[2.5.2][T4b] 备份 JSON 顶层必须带 planId 与 subtaskId(childId 若已知也带上),且必须是本次执行新写(覆盖同名旧文件):宿主采纳前会校验新鲜度(文件修改时间不早于本次尝试开始时间)与归属(planId/subtaskId 必须匹配本计划/本子任务),陈旧或跨计划的备份会被拒绝采纳并留审计痕。',
|
|
6610
6694
|
'- status 只能是 done / blocked / partial;partial 会被当作受阻处理。',
|
package/src/runtime.ts
CHANGED
|
@@ -7168,21 +7168,21 @@ export function createWorkplanRuntime(ctx: any, options: WorkplanRuntimeOptions
|
|
|
7168
7168
|
const expectedAcceptance = Array.isArray(found?.subtask?.acceptance) ? found.subtask.acceptance : []
|
|
7169
7169
|
const rawPhases = isRecord(args?.phases)
|
|
7170
7170
|
? args.phases
|
|
7171
|
-
: { planning: args?.planning, execution: args?.execution, verification: args?.verification }
|
|
7171
|
+
: { planning: args?.planning, preparation: args?.preparation, execution: args?.execution, verification: args?.verification }
|
|
7172
7172
|
const check = validatePhaseEvidence(rawPhases, expectedAcceptance)
|
|
7173
7173
|
if (!check.ok || !check.phases) {
|
|
7174
7174
|
const gate = phaseGateFromErrors(check.errors)
|
|
7175
7175
|
return {
|
|
7176
7176
|
ok: false,
|
|
7177
7177
|
passed: false,
|
|
7178
|
-
code: gate === 'phase-1-
|
|
7178
|
+
code: gate === 'phase-1-3' ? 'PHASE_GATE' : 'VERIFICATION_INCOMPLETE',
|
|
7179
7179
|
phase: gate,
|
|
7180
7180
|
planId: record.plan.planId,
|
|
7181
7181
|
subtaskId: row.subtaskId,
|
|
7182
7182
|
gaps: check.errors,
|
|
7183
|
-
error: gate === 'phase-1-
|
|
7184
|
-
?
|
|
7185
|
-
:
|
|
7183
|
+
error: gate === 'phase-1-3'
|
|
7184
|
+
? `核验缺少前几步证据:先完成「梳理任务 → 研究资源工具方案 → 准备到位 → 执行」并按步写全证据,再提交验证核验。${check.errors.slice(0, 5).join(';')}`
|
|
7185
|
+
: `验证核验未通过:${check.errors.slice(0, 5).join(';')}`,
|
|
7186
7186
|
}
|
|
7187
7187
|
}
|
|
7188
7188
|
return {
|
|
@@ -7192,7 +7192,7 @@ export function createWorkplanRuntime(ctx: any, options: WorkplanRuntimeOptions
|
|
|
7192
7192
|
planId: record.plan.planId,
|
|
7193
7193
|
subtaskId: row.subtaskId,
|
|
7194
7194
|
summary: phaseSummaryLine(check.phases),
|
|
7195
|
-
message: '
|
|
7195
|
+
message: '插件核验通过:前四步证据齐全、验证全部通过。现在把同一份 phases 写进结果块,并按第五步以 JSON mode 交回本部门负责人。',
|
|
7196
7196
|
}
|
|
7197
7197
|
}
|
|
7198
7198
|
|
package/src/three-phase.ts
CHANGED
|
@@ -45,7 +45,7 @@ import { diceSimilarity } from './v3-contract.js'
|
|
|
45
45
|
/** 三阶段顺序不可颠倒;这里也是结果块里 `phases` 的键名。 */
|
|
46
46
|
export const THREE_PHASE_IDS = Object.freeze(['planning', 'execution', 'verification'] as const)
|
|
47
47
|
/** [2.5.1] 契约版本 2:规划阶段升级为两轮深度思考协议(新增必填 approachBasis)。 */
|
|
48
|
-
export const THREE_PHASE_VERSION =
|
|
48
|
+
export const THREE_PHASE_VERSION = 3
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* 「全面、全盘、深入」无法由代码度量,但可以给一个不可忽略的下限:
|
|
@@ -55,6 +55,10 @@ export const THREE_PHASE_VERSION = 2
|
|
|
55
55
|
export const MIN_PLANNING_PROBLEM_CHARS = 40
|
|
56
56
|
export const MIN_PLANNING_APPROACH_CHARS = 40
|
|
57
57
|
export const MIN_PLANNING_BASIS_CHARS = 20
|
|
58
|
+
/** [3.1.0] 第二步资源与工具、第三步准备与就绪证据的下限(合计字符数)。 */
|
|
59
|
+
export const MIN_RESOURCE_CHARS = 20
|
|
60
|
+
export const MIN_TOOL_CHARS = 10
|
|
61
|
+
export const MIN_PREPARATION_CHARS = 20
|
|
58
62
|
export const MAX_PHASE_LIST_ITEMS = 20
|
|
59
63
|
export const MAX_PHASE_ITEM_CHARS = 800
|
|
60
64
|
export const MAX_PHASE_TOTAL_CHARS = 6000
|
|
@@ -70,6 +74,10 @@ export type PlanningPhase = {
|
|
|
70
74
|
problemAnalysis: string[]
|
|
71
75
|
constraints: string[]
|
|
72
76
|
unknowns: string[]
|
|
77
|
+
/** [3.1.0] 第二步 · 资源研究:完成本任务需要哪些资源(数据、文件、权限、人、知识、时间)。 */
|
|
78
|
+
resources: string[]
|
|
79
|
+
/** [3.1.0] 第二步 · 工具研究:完成本任务需要哪些工具,以及每个工具用来做什么。 */
|
|
80
|
+
tools: string[]
|
|
73
81
|
/** [2.5.1] 第二轮 · 基于第一轮全部结果理清的方法、流程、步骤(一步步执行的路径)。 */
|
|
74
82
|
approach: string[]
|
|
75
83
|
/**
|
|
@@ -80,6 +88,17 @@ export type PlanningPhase = {
|
|
|
80
88
|
approachBasis: string[]
|
|
81
89
|
}
|
|
82
90
|
|
|
91
|
+
/**
|
|
92
|
+
* [3.1.0] 第三步 · 准备工作:把第二步研究出的资源与工具真正备齐(不是「打算用」,
|
|
93
|
+
* 而是「已就绪」)。每条都要有可复核的就绪证据,缺证据的资源不得进入执行。
|
|
94
|
+
*/
|
|
95
|
+
export type PreparationPhase = {
|
|
96
|
+
/** 已准备好的资源/工具清单:每一项写清准备了什么、在哪里、是否可用。 */
|
|
97
|
+
prepared: string[]
|
|
98
|
+
/** 就绪证据:命令输出、文件路径、配置项、版本号或引用;与 prepared 一一对应。 */
|
|
99
|
+
evidence: string[]
|
|
100
|
+
}
|
|
101
|
+
|
|
83
102
|
export type ExecutionPhase = {
|
|
84
103
|
steps: string[]
|
|
85
104
|
deviations: string[]
|
|
@@ -102,6 +121,7 @@ export type VerificationPhase = {
|
|
|
102
121
|
export type ThreePhases = {
|
|
103
122
|
version: number
|
|
104
123
|
planning: PlanningPhase
|
|
124
|
+
preparation: PreparationPhase
|
|
105
125
|
execution: ExecutionPhase
|
|
106
126
|
verification: VerificationPhase
|
|
107
127
|
}
|
|
@@ -111,7 +131,7 @@ export type PhaseValidation = {
|
|
|
111
131
|
phases: ThreePhases | null
|
|
112
132
|
errors: string[]
|
|
113
133
|
/** 错误落在哪个阶段:'planning' | 'execution' | 'verification' | 'shape' */
|
|
114
|
-
failedPhase: 'planning' | 'execution' | 'verification' | 'shape' | null
|
|
134
|
+
failedPhase: 'planning' | 'preparation' | 'execution' | 'verification' | 'shape' | null
|
|
115
135
|
}
|
|
116
136
|
|
|
117
137
|
function isRecord(value: any): value is Record<string, any> {
|
|
@@ -213,12 +233,14 @@ export function validatePhaseEvidence(value: any, expectedAcceptance: any = []):
|
|
|
213
233
|
return {
|
|
214
234
|
ok: false,
|
|
215
235
|
phases: null,
|
|
216
|
-
errors: ['phases 缺失:必须提交 planning
|
|
236
|
+
errors: ['phases 缺失:必须提交 planning(第一、二步)/ preparation(第三步)/ execution(第四步)/ verification(第四步验证)四组证据,第五步用 report / departmentSummary 交付'],
|
|
217
237
|
failedPhase: 'shape',
|
|
218
238
|
}
|
|
219
239
|
}
|
|
220
240
|
const planningRaw = isRecord(value.planning) ? value.planning : null
|
|
221
|
-
if (!planningRaw) fail('planning', 'phases.planning
|
|
241
|
+
if (!planningRaw) fail('planning', 'phases.planning 缺失(第一步 · 任务梳理 + 第二步 · 资源/工具/实施方案研究:先全面、全盘、深入梳理研究自己的任务,再基于其结果研究需要哪些资源、哪些工具、具体实施方案)')
|
|
242
|
+
const preparationRaw = isRecord(value.preparation) ? value.preparation : null
|
|
243
|
+
if (!preparationRaw) fail('preparation', 'phases.preparation 缺失(第三步 · 准备:把第二步研究出的资源、工具、实施方案真正备齐,并给出就绪证据)')
|
|
222
244
|
const executionRaw = isRecord(value.execution) ? value.execution : null
|
|
223
245
|
if (!executionRaw) fail('execution', 'phases.execution 缺失(阶段二:基于第二轮理清的方法、流程、步骤执行)')
|
|
224
246
|
const verificationRaw = isRecord(value.verification) ? value.verification : null
|
|
@@ -239,6 +261,14 @@ export function validatePhaseEvidence(value: any, expectedAcceptance: any = []):
|
|
|
239
261
|
required: !!planningRaw,
|
|
240
262
|
minItems: 1,
|
|
241
263
|
}),
|
|
264
|
+
resources: readTextList(planningRaw?.resources, 'phases.planning.resources', errors, {
|
|
265
|
+
required: !!planningRaw,
|
|
266
|
+
minItems: 1,
|
|
267
|
+
}),
|
|
268
|
+
tools: readTextList(planningRaw?.tools, 'phases.planning.tools', errors, {
|
|
269
|
+
required: !!planningRaw,
|
|
270
|
+
minItems: 1,
|
|
271
|
+
}),
|
|
242
272
|
}
|
|
243
273
|
if (errors.some((item) => item.startsWith('phases.planning.problemAnalysis'))) failedPhase ||= 'planning'
|
|
244
274
|
if (errors.some((item) => item.startsWith('phases.planning.approach'))) failedPhase ||= 'planning'
|
|
@@ -252,6 +282,31 @@ export function validatePhaseEvidence(value: any, expectedAcceptance: any = []):
|
|
|
252
282
|
fail('planning', `phases.planning.approachBasis 太薄(合计 ${totalChars(planning.approachBasis)} 字,至少 ${MIN_PLANNING_BASIS_CHARS} 字):要写清第二轮的方法、流程、步骤如何基于第一轮梳理、研究、思考完成好的所有结果`)
|
|
253
283
|
}
|
|
254
284
|
|
|
285
|
+
if (planning.resources.length > 0 && totalChars(planning.resources) < MIN_RESOURCE_CHARS) {
|
|
286
|
+
fail('planning', `phases.planning.resources 太薄(合计 ${totalChars(planning.resources)} 字,至少 ${MIN_RESOURCE_CHARS} 字):第二步要逐项写清完成本任务需要哪些资源(数据/文件/权限/人/知识/时间),缺一项就会在执行中卡住`)
|
|
287
|
+
}
|
|
288
|
+
if (planning.tools.length > 0 && totalChars(planning.tools) < MIN_TOOL_CHARS) {
|
|
289
|
+
fail('planning', `phases.planning.tools 太薄(合计 ${totalChars(planning.tools)} 字,至少 ${MIN_TOOL_CHARS} 字):第二步要逐项写清需要哪些工具、每个工具用来做什么、为什么选它`)
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const preparation: PreparationPhase = {
|
|
293
|
+
prepared: readTextList(preparationRaw?.prepared, 'phases.preparation.prepared', errors, {
|
|
294
|
+
required: !!preparationRaw,
|
|
295
|
+
minItems: 1,
|
|
296
|
+
}),
|
|
297
|
+
evidence: readTextList(preparationRaw?.evidence, 'phases.preparation.evidence', errors, {
|
|
298
|
+
required: !!preparationRaw,
|
|
299
|
+
minItems: 1,
|
|
300
|
+
}),
|
|
301
|
+
}
|
|
302
|
+
if (errors.some((item) => item.startsWith('phases.preparation'))) failedPhase ||= 'preparation'
|
|
303
|
+
if (preparation.prepared.length > 0 && totalChars(preparation.prepared) < MIN_PREPARATION_CHARS) {
|
|
304
|
+
fail('preparation', `phases.preparation.prepared 太薄(合计 ${totalChars(preparation.prepared)} 字,至少 ${MIN_PREPARATION_CHARS} 字):第三步要把第二步研究出的资源与工具真正备齐,逐项写清准备了什么、在哪里、是否可用`)
|
|
305
|
+
}
|
|
306
|
+
if (preparation.evidence.length > 0 && totalChars(preparation.evidence) < MIN_PREPARATION_CHARS) {
|
|
307
|
+
fail('preparation', `phases.preparation.evidence 太薄(合计 ${totalChars(preparation.evidence)} 字,至少 ${MIN_PREPARATION_CHARS} 字):每一项就绪状态都要有可复核的证据(命令输出/文件路径/配置项/版本号/引用)`)
|
|
308
|
+
}
|
|
309
|
+
|
|
255
310
|
const execution: ExecutionPhase = {
|
|
256
311
|
steps: readTextList(executionRaw?.steps, 'phases.execution.steps', errors, {
|
|
257
312
|
required: !!executionRaw,
|
|
@@ -318,6 +373,7 @@ export function validatePhaseEvidence(value: any, expectedAcceptance: any = []):
|
|
|
318
373
|
const phases: ThreePhases = {
|
|
319
374
|
version: THREE_PHASE_VERSION,
|
|
320
375
|
planning,
|
|
376
|
+
preparation,
|
|
321
377
|
execution,
|
|
322
378
|
verification,
|
|
323
379
|
}
|
|
@@ -327,6 +383,10 @@ export function validatePhaseEvidence(value: any, expectedAcceptance: any = []):
|
|
|
327
383
|
...planning.unknowns,
|
|
328
384
|
...planning.approach,
|
|
329
385
|
...planning.approachBasis,
|
|
386
|
+
...planning.resources,
|
|
387
|
+
...planning.tools,
|
|
388
|
+
...preparation.prepared,
|
|
389
|
+
...preparation.evidence,
|
|
330
390
|
...execution.steps,
|
|
331
391
|
...execution.deviations,
|
|
332
392
|
verification.requirementCheck,
|
|
@@ -343,9 +403,9 @@ export function validatePhaseEvidence(value: any, expectedAcceptance: any = []):
|
|
|
343
403
|
* Used by `dsh_workplan_verify`: planning/execution gaps mean the caller is
|
|
344
404
|
* still in phase 1 or 2, where the plugin is disabled by the user's rule.
|
|
345
405
|
*/
|
|
346
|
-
export function phaseGateFromErrors(errors: string[]): 'phase-1-
|
|
347
|
-
return errors.some((item) => /^phases(\.| 缺失)/.test(item) && /planning|execution/.test(item))
|
|
348
|
-
? 'phase-1-
|
|
406
|
+
export function phaseGateFromErrors(errors: string[]): 'phase-1-3' | 'verification' {
|
|
407
|
+
return errors.some((item) => /^phases(\.| 缺失)/.test(item) && /planning|preparation|execution/.test(item))
|
|
408
|
+
? 'phase-1-3'
|
|
349
409
|
: 'verification'
|
|
350
410
|
}
|
|
351
411
|
|
|
@@ -353,12 +413,14 @@ export function phaseGateFromErrors(errors: string[]): 'phase-1-2' | 'verificati
|
|
|
353
413
|
export function phaseSummaryLine(phases: ThreePhases): string {
|
|
354
414
|
const deviations = phases.execution.deviations.length
|
|
355
415
|
return [
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
416
|
+
`第一步 任务梳理(${phases.planning.problemAnalysis.length} 条)`,
|
|
417
|
+
`第二步 资源/工具/方案研究(资源 ${phases.planning.resources.length} 项 / 工具 ${phases.planning.tools.length} 项 / 方法 ${phases.planning.approach.length} 步 / 依据 ${phases.planning.approachBasis.length} 条)`,
|
|
418
|
+
`第三步 准备(已备 ${phases.preparation.prepared.length} 项 / 就绪证据 ${phases.preparation.evidence.length} 条)`,
|
|
419
|
+
`第四步 执行与验证(执行 ${phases.execution.steps.length} 步${deviations ? ` / 偏离 ${deviations} 处` : ''};验证 ${phases.verification.checks.length} 项${phases.verification.allPassed ? ',全部通过' : ',未全部通过'};`
|
|
359
420
|
+ `复盘 ${phases.verification.retrospective.problems.length} 个问题 / `
|
|
360
421
|
+ `${phases.verification.retrospective.detours.length} 条弯路 / `
|
|
361
422
|
+ `${phases.verification.retrospective.prevention.length} 条防再犯规则)`,
|
|
423
|
+
'第五步 JSON 交付(report / departmentSummary,只含关键信息)',
|
|
362
424
|
].join(';')
|
|
363
425
|
}
|
|
364
426
|
|
|
@@ -371,26 +433,29 @@ export function phaseSummaryLine(phases: ThreePhases): string {
|
|
|
371
433
|
*/
|
|
372
434
|
export function threePhasePromptLines(): string[] {
|
|
373
435
|
return [
|
|
374
|
-
'
|
|
375
|
-
'
|
|
376
|
-
'
|
|
377
|
-
'
|
|
378
|
-
'
|
|
379
|
-
'
|
|
380
|
-
'
|
|
381
|
-
'
|
|
382
|
-
'
|
|
383
|
-
'
|
|
436
|
+
'五步工作法(用户 2026-11-17 强制要求,取代旧的三阶段口径;五个步骤必须按顺序执行,前一步没有完成并写好证据之前,禁止进入下一步):',
|
|
437
|
+
'【第一步 · 任务梳理(部门负责人、相关领域全球顶尖专家执行自己的任务时同一口径)】',
|
|
438
|
+
' 先全面、全盘、深入梳理、研究、思考自己的任务:逐条写清任务目标与验收标准、现状与已知事实、约束条件、未知/待确认项、主要矛盾、工作边界与依赖,结果写入 phases.planning.problemAnalysis(约束写 constraints,未知写 unknowns)。',
|
|
439
|
+
'【第二步 · 资源、工具与实施方案研究】',
|
|
440
|
+
' 基于第一步完成好的所有结果,再全面、全盘、深入地梳理、研究、思考:完成本任务需要哪些资源(数据/文件/权限/人/知识/时间)写入 phases.planning.resources;需要哪些工具、每个工具用来做什么写入 phases.planning.tools;具体实施方案写成自己该具体如何一步步以最高效率执行、确保完美完成自己任务的方法、流程和步骤(每一步做什么、产出什么、依赖什么、风险与对策、如何证明做对了,以及全程如何少走弯路:先查历史教训、先验证再动手、不重复试错)写入 phases.planning.approach;同时把第二步如何基于第一步全部结果逐条对应写入 phases.planning.approachBasis。',
|
|
441
|
+
' 自检:任何一条验收标准或用户原要求没有落在第二步的资源、工具与实施方案上,就回到第一步重做。',
|
|
442
|
+
'【第三步 · 准备】',
|
|
443
|
+
' 基于第二步的全部结果,把需要的资源、工具、实施方案真正准备到位,而不是「打算用」:逐项写清准备了什么、在哪里、是否可用,写入 phases.preparation.prepared;每一项就绪状态都必须给出可复核的证据(命令输出/文件路径/配置项/版本号/引用),写入 phases.preparation.evidence。缺资源、缺工具、缺证据时,先补齐或如实上报受阻,不得带着缺口进入第四步。',
|
|
444
|
+
'【第四步 · 执行与验证】',
|
|
445
|
+
' 基于第三步备齐的成果和既定实施方案,开始具体执行,严格按 phases.planning.approach 落地;出现新事实需要偏离时,必须记录偏离原因、证据与调整后的做法,不得静默改道,执行步骤写入 phases.execution.steps。',
|
|
446
|
+
' 执行完成后逐条验证验收标准与用户原要求:每条都要有可复核的证据(命令输出/文件/引用);验证未通过不得报 done,无法确认写 unverified;结果写入 phases.verification。',
|
|
447
|
+
'【第四步收尾 · 自我学习复盘(强制)】',
|
|
384
448
|
' 报 done 之前必须把 phases.verification.retrospective 写全,四项缺一不可:',
|
|
385
449
|
' 1) problems:本次全过程遇到的所有问题(现象 + 根因),至少 1 条;',
|
|
386
450
|
' 2) detours:走过的弯路、返工与无效尝试(确实没有就写空数组 [],不要编造);',
|
|
387
451
|
' 3) resolutions:最终是如何解决上述问题的,至少 1 条,可与 problems 一一对应;',
|
|
388
452
|
' 4) prevention:以后如何预防再犯,至少 1 条,必须写成「遇到…先…」的可执行硬规则。',
|
|
389
|
-
'
|
|
390
|
-
'
|
|
391
|
-
'
|
|
392
|
-
' -
|
|
393
|
-
' -
|
|
453
|
+
'【第五步 · JSON mode 结构化交付给本部门负责人】',
|
|
454
|
+
' 执行完美完成后,必须把成果以 JSON mode 结构化交回本部门负责人:专家写入 report 对象(只允许 keyResults / keyInfo / importantInfo / leadRequirements 四个字符串数组字段,只写关键信息、关键成果、重要信息和负责人要求的东西,禁止过程流水账与重复表述);部门负责人写入 departmentSummary 对象(keyResults / keyInfo / importantInfo / sources,汇总本部门全部专家汇报,sources 必须覆盖全部已派发专家)。成果块必须放在 <!-- WORKPLAN_EVIDENCE:START --> 与 <!-- WORKPLAN_EVIDENCE:END --> 之间,且是合法 JSON,不得用散文代替。',
|
|
455
|
+
'插件使用说明(五步证据门禁):',
|
|
456
|
+
' - 第一、二、三步:先把问题梳理、资源/工具/实施方案、准备与就绪证据写全;此时不要调用 dsh_workplan_verify,它会因缺少前几步证据返回 PHASE_GATE 与待补项(这是证据门禁,不是禁用插件)。',
|
|
457
|
+
' - 第四步:可以调用 dsh_workplan_verify 让插件做最终核验:提交 planning / preparation / execution / verification 证据,插件返回 passed 或仍需补齐的 gaps;未通过先修复再回报。遇阻时可用 dsh_workplan_escalate 上报,它是安全通道,不属于五步产物。',
|
|
458
|
+
' - 结果块里的 phases 是必填项:缺 planning / preparation / execution / verification 任一组、内容为空、或验证未全部通过,插件都会判为未完成,不能用 done 收尾;第五步缺 report / departmentSummary 同样判为未完成。',
|
|
394
459
|
]
|
|
395
460
|
}
|
|
396
461
|
|