dsh-workplan 3.0.2 → 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 CHANGED
@@ -1,3 +1,7 @@
1
+ ## 3.0.3 — 2026-11-17
2
+
3
+ - release v3.0.3: latest source + version publish
4
+
1
5
  ## 3.0.2 — 2026-11-17
2
6
 
3
7
  - **修复**:GitHub Actions Release 流水线补齐 `NPM_TOKEN` secret + `gh release create` 幂等(已存在则 upload --clobber),npm 发布不再 ENEEDAUTH/E403。
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
  [![verify](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml/badge.svg)](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml)
6
- [![version](https://img.shields.io/badge/version-3.0.2-blue.svg)](https://github.com/abbaababa/dsh-workplan/releases/tag/v3.0.2)
6
+ [![version](https://img.shields.io/badge/version-3.0.3-blue.svg)](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.2
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
  [![verify](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml/badge.svg)](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml)
6
- [![version](https://img.shields.io/badge/version-3.0.2-blue.svg)](https://github.com/abbaababa/dsh-workplan/releases/tag/v3.0.2)
6
+ [![version](https://img.shields.io/badge/version-3.0.3-blue.svg)](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.2
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
  [![verify](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml/badge.svg)](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml)
6
- [![version](https://img.shields.io/badge/version-3.0.2-blue.svg)](https://github.com/abbaababa/dsh-workplan/releases/tag/v3.0.2)
6
+ [![version](https://img.shields.io/badge/version-3.0.3-blue.svg)](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.2
72
+ dsh plugin --profile web add dsh-workplan@3.0.3
73
73
  ```
74
74
 
75
75
  装完**重启一次 DSH Web**(或重新载入当前页面)让插件生效。
@@ -27,7 +27,7 @@ import { checkDepartmentSummary, checkExpertReport, renderDepartmentSummarySpec,
27
27
  * 专家结果查 F10,部门负责人结果查 F11,未声明层级时两条都不查
28
28
  * (历史回放与其它调用点零回归)。
29
29
  */
30
- export const COMM_FORMAT_VERSION = 2;
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: '必须包含三阶段证据:phases.planning(两轮深度思考:第一轮任务深研 problemAnalysis + 第二轮方法流程步骤 approach + 第二轮依据 approachBasis)、phases.execution(实际执行步骤)、phases.verification(逐项验证)',
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: `三阶段证据缺失:${missing.join('、')}` });
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
- '本会话已启用自动任务分解。系统会在每个新用户任务的第一个模型步骤前生成计划,并先把计划显示在对话里;收到【任务分解】后,必须先调用 dsh_workplan_dispatch(默认 wait 等结果;预计较久时用 mode:"async" 先开跑),再做任何其他工具调用或回答。',
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.2 版本(用户要求 13):本插件当前版本为 3.0.2。涉及版本号的对外表述一律写 3.0.2。',
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: '三阶段证据:planning(问题梳理 + 可执行思路)、execution(执行步骤)、verification(逐项验证)。',
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.2',
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
@@ -3943,7 +3943,7 @@ export function adjudicateResult({ output, strict = true, expectedAcceptance = [
3943
3943
  acceptance,
3944
3944
  artifacts,
3945
3945
  needs,
3946
- error: `三阶段证据不完整(未按「规划→执行→验证」回报):${phaseCheck.errors.slice(0, 6).join(';')}`,
3946
+ error: `五步证据不完整(未按「任务梳理→资源工具方案研究→准备→执行验证→JSON 交付」回报):${phaseCheck.errors.slice(0, 6).join(';')}`,
3947
3947
  phases: null,
3948
3948
  };
3949
3949
  }
@@ -6549,7 +6549,7 @@ phaseZeroContinuation = '', }) {
6549
6549
  '',
6550
6550
  '结果回传(必填):在汇报的最后附上一个结构化结果块,主 Agent 会按它逐项核对,不再只依赖自述。',
6551
6551
  EVIDENCE_MARKER_BEGIN,
6552
- '{"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}',
6553
6553
  EVIDENCE_MARKER_END,
6554
6554
  '- [2.2.9] 盘上结算备份(必做):发送结果块之前,先把同一份 JSON 写入 reports/wp-settlement-<你的子任务 ID>.json(相对工作目录)。收尾消息因异常(error/截断/超时)丢失时,宿主会自动采纳该备份结算,避免「已完成的工作」被误判为「缺失回报」而受阻并级联冻结下游。[2.5.2][T4b] 备份 JSON 顶层必须带 planId 与 subtaskId(childId 若已知也带上),且必须是本次执行新写(覆盖同名旧文件):宿主采纳前会校验新鲜度(文件修改时间不早于本次尝试开始时间)与归属(planId/subtaskId 必须匹配本计划/本子任务),陈旧或跨计划的备份会被拒绝采纳并留审计痕。',
6555
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-2' ? 'PHASE_GATE' : 'VERIFICATION_INCOMPLETE',
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-2'
7013
- ? `阶段三核验缺少前两阶段证据:先完成「梳理问题 → 形成可执行思路」并实际执行,再提交阶段三核验。${check.errors.slice(0, 5).join(';')}`
7014
- : `阶段三核验未通过:${check.errors.slice(0, 5).join(';')}`,
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: '插件核验通过:三阶段证据齐全、验证全部通过。现在把同一份 phases 写进结果块并提交。',
7024
+ message: '插件核验通过:前四步证据齐全、验证全部通过。现在把同一份 phases 写进结果块,并按第五步以 JSON mode 交回本部门负责人。',
7025
7025
  };
7026
7026
  }
7027
7027
  /**
@@ -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 = 2;
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 / execution / verification 三阶段证据'],
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-2'
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
- `阶段一 规划 · 两轮深度思考(第一轮任务深研 ${phases.planning.problemAnalysis.length} 条 / 第二轮方法流程步骤 ${phases.planning.approach.length} 步 / 第二轮依据 ${phases.planning.approachBasis.length} 条)`,
297
- `阶段二 执行(${phases.execution.steps.length} 步${deviations ? ` / 偏离 ${deviations} 处` : ''})`,
298
- `阶段三 验证(${phases.verification.checks.length} 项${phases.verification.allPassed ? ',全部通过' : ',未全部通过'};`
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
- ' 第一轮 · 任务深研:先全面、全盘、深入梳理、研究、思考自己的任务——逐条写清任务目标与验收标准、现状与已知事实、约束条件、未知/待确认项、主要矛盾、工作边界与依赖,结果写入 phases.planning.problemAnalysis;',
316
- ' 第二轮 · 理清方法流程步骤:基于刚才第一轮完成好的所有结果,再全面、全盘、深入地开展梳理、研究和思考,理清自己的思路,理清自己该具体如何一步步以最高效率执行、确保完美完成自己任务的方法、流程和步骤——每一步做什么、产出什么、依赖什么、风险与对策、如何证明做对了,并写清全程如何少走弯路(先查历史教训记忆、先验证再动手、不重复同样的试错),结果写入 phases.planning.approach;同时把第二轮如何基于第一轮全部结果写入 phases.planning.approachBasis(逐条对应:第一轮的哪些事实/约束/矛盾决定了第二轮的哪些方法/流程/步骤);',
317
- ' 自检:任何一条验收标准或用户原要求没有落在第二轮的方法、流程、步骤上,就回到第一轮重做;两轮深度思考没有完成并写全(problemAnalysis + approach + approachBasis)之前,不得进入阶段二。',
318
- '【阶段二 · 执行阶段】',
319
- ' 最后,基于刚才第二轮理清楚的所有方法、流程、步骤,开始具体的执行工作:严格按 phases.planning.approach 执行。出现新事实需要偏离时,必须记录偏离原因、证据与调整后的做法,不得静默改道。',
320
- '【阶段三 · 验证阶段】',
321
- ' 执行完成后逐条验证验收标准与用户原要求:每条都要有可复核的证据(命令输出/文件/引用);验证未通过不得报 done,无法确认写 unverified。',
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
- ' - 阶段一、二:先把两轮深度思考产物(第一轮任务深研 problemAnalysis、第二轮方法流程步骤 approach、第二轮依据 approachBasis)与执行记录写全;此时不要调用 dsh_workplan_verify,它会因缺少前两阶段证据返回 PHASE_GATE 与待补项(这是证据门禁,不是禁用插件)。',
331
- ' - 阶段三:可以调用 dsh_workplan_verify 让插件做最终核验:提交 planning / execution / verification 三阶段证据,插件返回 passed 或仍需补齐的 gaps;未通过先修复再回报。遇阻时可用 dsh_workplan_escalate 上报,它是安全通道,不属于三阶段产物。',
332
- ' - 结果块里的 phases 是必填项:缺任一阶段、内容为空、或验证未全部通过,插件都会判为未完成,不能用 done 收尾。',
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-workplan",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "Automatic task decomposition, real department subagents, and a responsive workplan dashboard for DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,7 +34,7 @@ import {
34
34
  * 专家结果查 F10,部门负责人结果查 F11,未声明层级时两条都不查
35
35
  * (历史回放与其它调用点零回归)。
36
36
  */
37
- export const COMM_FORMAT_VERSION = 2
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: '必须包含三阶段证据:phases.planning(两轮深度思考:第一轮任务深研 problemAnalysis + 第二轮方法流程步骤 approach + 第二轮依据 approachBasis)、phases.execution(实际执行步骤)、phases.verification(逐项验证)',
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.execution || typeof phases.execution !== 'object') missing.push('execution(实际执行步骤)')
173
- if (!phases.verification || typeof phases.verification !== 'object') missing.push('verification(逐项验证与复盘)')
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: `三阶段证据缺失:${missing.join('、')}` })
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
- '本会话已启用自动任务分解。系统会在每个新用户任务的第一个模型步骤前生成计划,并先把计划显示在对话里;收到【任务分解】后,必须先调用 dsh_workplan_dispatch(默认 wait 等结果;预计较久时用 mode:"async" 先开跑),再做任何其他工具调用或回答。',
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.2 版本(用户要求 13):本插件当前版本为 3.0.2。涉及版本号的对外表述一律写 3.0.2。',
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: '三阶段证据:planning(问题梳理 + 可执行思路)、execution(执行步骤)、verification(逐项验证)。',
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.2',
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
@@ -4058,7 +4058,7 @@ export function adjudicateResult({ output, strict = true, expectedAcceptance = [
4058
4058
  acceptance,
4059
4059
  artifacts,
4060
4060
  needs,
4061
- error: `三阶段证据不完整(未按「规划→执行→验证」回报):${phaseCheck.errors.slice(0, 6).join(';')}`,
4061
+ error: `五步证据不完整(未按「任务梳理→资源工具方案研究→准备→执行验证→JSON 交付」回报):${phaseCheck.errors.slice(0, 6).join(';')}`,
4062
4062
  phases: null,
4063
4063
  }
4064
4064
  }
@@ -6688,7 +6688,7 @@ export function buildChildPrompt({
6688
6688
  '',
6689
6689
  '结果回传(必填):在汇报的最后附上一个结构化结果块,主 Agent 会按它逐项核对,不再只依赖自述。',
6690
6690
  EVIDENCE_MARKER_BEGIN,
6691
- '{"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}',
6692
6692
  EVIDENCE_MARKER_END,
6693
6693
  '- [2.2.9] 盘上结算备份(必做):发送结果块之前,先把同一份 JSON 写入 reports/wp-settlement-<你的子任务 ID>.json(相对工作目录)。收尾消息因异常(error/截断/超时)丢失时,宿主会自动采纳该备份结算,避免「已完成的工作」被误判为「缺失回报」而受阻并级联冻结下游。[2.5.2][T4b] 备份 JSON 顶层必须带 planId 与 subtaskId(childId 若已知也带上),且必须是本次执行新写(覆盖同名旧文件):宿主采纳前会校验新鲜度(文件修改时间不早于本次尝试开始时间)与归属(planId/subtaskId 必须匹配本计划/本子任务),陈旧或跨计划的备份会被拒绝采纳并留审计痕。',
6694
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-2' ? 'PHASE_GATE' : 'VERIFICATION_INCOMPLETE',
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-2'
7184
- ? `阶段三核验缺少前两阶段证据:先完成「梳理问题 → 形成可执行思路」并实际执行,再提交阶段三核验。${check.errors.slice(0, 5).join(';')}`
7185
- : `阶段三核验未通过:${check.errors.slice(0, 5).join(';')}`,
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: '插件核验通过:三阶段证据齐全、验证全部通过。现在把同一份 phases 写进结果块并提交。',
7195
+ message: '插件核验通过:前四步证据齐全、验证全部通过。现在把同一份 phases 写进结果块,并按第五步以 JSON mode 交回本部门负责人。',
7196
7196
  }
7197
7197
  }
7198
7198
 
@@ -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 = 2
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 / execution / verification 三阶段证据'],
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-2' | 'verification' {
347
- return errors.some((item) => /^phases(\.| 缺失)/.test(item) && /planning|execution/.test(item))
348
- ? 'phase-1-2'
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
- `阶段一 规划 · 两轮深度思考(第一轮任务深研 ${phases.planning.problemAnalysis.length} 条 / 第二轮方法流程步骤 ${phases.planning.approach.length} 步 / 第二轮依据 ${phases.planning.approachBasis.length} 条)`,
357
- `阶段二 执行(${phases.execution.steps.length} 步${deviations ? ` / 偏离 ${deviations} 处` : ''})`,
358
- `阶段三 验证(${phases.verification.checks.length} 项${phases.verification.allPassed ? ',全部通过' : ',未全部通过'};`
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
- ' 第一轮 · 任务深研:先全面、全盘、深入梳理、研究、思考自己的任务——逐条写清任务目标与验收标准、现状与已知事实、约束条件、未知/待确认项、主要矛盾、工作边界与依赖,结果写入 phases.planning.problemAnalysis;',
377
- ' 第二轮 · 理清方法流程步骤:基于刚才第一轮完成好的所有结果,再全面、全盘、深入地开展梳理、研究和思考,理清自己的思路,理清自己该具体如何一步步以最高效率执行、确保完美完成自己任务的方法、流程和步骤——每一步做什么、产出什么、依赖什么、风险与对策、如何证明做对了,并写清全程如何少走弯路(先查历史教训记忆、先验证再动手、不重复同样的试错),结果写入 phases.planning.approach;同时把第二轮如何基于第一轮全部结果写入 phases.planning.approachBasis(逐条对应:第一轮的哪些事实/约束/矛盾决定了第二轮的哪些方法/流程/步骤);',
378
- ' 自检:任何一条验收标准或用户原要求没有落在第二轮的方法、流程、步骤上,就回到第一轮重做;两轮深度思考没有完成并写全(problemAnalysis + approach + approachBasis)之前,不得进入阶段二。',
379
- '【阶段二 · 执行阶段】',
380
- ' 最后,基于刚才第二轮理清楚的所有方法、流程、步骤,开始具体的执行工作:严格按 phases.planning.approach 执行。出现新事实需要偏离时,必须记录偏离原因、证据与调整后的做法,不得静默改道。',
381
- '【阶段三 · 验证阶段】',
382
- ' 执行完成后逐条验证验收标准与用户原要求:每条都要有可复核的证据(命令输出/文件/引用);验证未通过不得报 done,无法确认写 unverified。',
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
- ' - 阶段一、二:先把两轮深度思考产物(第一轮任务深研 problemAnalysis、第二轮方法流程步骤 approach、第二轮依据 approachBasis)与执行记录写全;此时不要调用 dsh_workplan_verify,它会因缺少前两阶段证据返回 PHASE_GATE 与待补项(这是证据门禁,不是禁用插件)。',
392
- ' - 阶段三:可以调用 dsh_workplan_verify 让插件做最终核验:提交 planning / execution / verification 三阶段证据,插件返回 passed 或仍需补齐的 gaps;未通过先修复再回报。遇阻时可用 dsh_workplan_escalate 上报,它是安全通道,不属于三阶段产物。',
393
- ' - 结果块里的 phases 是必填项:缺任一阶段、内容为空、或验证未全部通过,插件都会判为未完成,不能用 done 收尾。',
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