dsh-workplan 2.3.9 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +115 -0
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/client.js +68 -8
- package/docs/cc/ADV-FSP-FUNCTIONAL-SPEC.md +3 -3
- package/docs/cc/AVA-VULNERABILITY-ANALYSIS.md +3 -3
- package/lib/client.js +68 -8
- package/lib/comm-format.js +58 -6
- package/lib/criterion.js +215 -0
- package/lib/dept-journal.js +319 -0
- package/lib/host.js +167 -35
- package/lib/llm-rules.js +281 -24
- package/lib/plan.js +1415 -168
- package/lib/replan.js +50 -39
- package/lib/runtime.js +3098 -639
- package/lib/three-phase.js +106 -20
- package/lib/understanding.js +18 -3
- package/lib/v3-contract.js +431 -0
- package/lib/watchdog.js +6 -1
- package/package.json +2 -2
- package/src/client.ts +68 -8
- package/src/comm-format.ts +63 -5
- package/src/criterion.ts +262 -0
- package/src/dept-journal.ts +373 -0
- package/src/host.ts +168 -36
- package/src/llm-rules.ts +349 -27
- package/src/plan.ts +1416 -161
- package/src/replan.ts +48 -37
- package/src/runtime.ts +2518 -139
- package/src/three-phase.ts +147 -20
- package/src/understanding.ts +20 -3
- package/src/v3-contract.ts +470 -0
- package/src/watchdog.ts +6 -1
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [3.0.0] 用户 2026-11-14 十三条底层机制优化中「可由代码判定」的那部分契约。
|
|
3
|
+
*
|
|
4
|
+
* 单一事实源:两条会话固定文案、部门任务质量要求、极简任务硬门槛、专家精简
|
|
5
|
+
* JSON 汇报、部门负责人精简 JSON 汇总。渲染函数与校验函数同源,保证提示词里
|
|
6
|
+
* 写的规则与门禁实际执行的规则不可能分叉(与 2.x 的 comm-format / three-phase
|
|
7
|
+
* 同一哲学)。
|
|
8
|
+
*
|
|
9
|
+
* 纯函数、零依赖(不 import plan.ts,避免循环依赖),可被 host/plan/runtime/
|
|
10
|
+
* llm-rules 与测试同口径消费。
|
|
11
|
+
*/
|
|
12
|
+
/* ========================================================================== */
|
|
13
|
+
/* 1. 两条会话固定文案(用户要求 2、4) */
|
|
14
|
+
/* ========================================================================== */
|
|
15
|
+
/**
|
|
16
|
+
* 用户要求 2 的固定文案:从接收到用户任何任务开始,会话内必须输出这一句。
|
|
17
|
+
* 逐字冻结(含 6 个半角点),不得改写、不得拼接。
|
|
18
|
+
*/
|
|
19
|
+
export const STATUS_ASSIGNING_TEXT = '任务正在分配中,请稍等一下......';
|
|
20
|
+
/**
|
|
21
|
+
* 用户要求 4 的固定文案:用户任务分配完成后,会话内必须输出这一句。
|
|
22
|
+
* 逐字冻结(含 6 个半角点),不得改写、不得拼接。
|
|
23
|
+
*/
|
|
24
|
+
export const STATUS_ASSIGNED_TEXT = '任务已经完成分配,正在执行中......';
|
|
25
|
+
/* ========================================================================== */
|
|
26
|
+
/* 2. 部门任务质量要求(用户要求 3、6) */
|
|
27
|
+
/* ========================================================================== */
|
|
28
|
+
/** 单个子任务质量要求的条数上限(多则失控,与「精简」冲突)。 */
|
|
29
|
+
export const MAX_QUALITY_REQUIREMENTS = 8;
|
|
30
|
+
/** 单条质量要求的字符上限。 */
|
|
31
|
+
export const MAX_QUALITY_REQUIREMENT_CHARS = 400;
|
|
32
|
+
/** 质量要求的最少条数:至少一条可检查的质量要求,否则等于没交代。 */
|
|
33
|
+
export const MIN_QUALITY_REQUIREMENTS = 1;
|
|
34
|
+
/**
|
|
35
|
+
* 读取并消毒质量要求列表(数组或单个字符串)。
|
|
36
|
+
*
|
|
37
|
+
* 空字符串、非字符串一律丢弃;重复项按规范化文本去重;条数与长度按上限截断。
|
|
38
|
+
* 返回空数组表示「没有任何可用质量要求」,由调用方决定是拒绝还是回落。
|
|
39
|
+
*/
|
|
40
|
+
export function normalizeQualityRequirements(value) {
|
|
41
|
+
const raw = Array.isArray(value) ? value : (typeof value === 'string' ? [value] : []);
|
|
42
|
+
const seen = new Set();
|
|
43
|
+
const out = [];
|
|
44
|
+
for (const item of raw) {
|
|
45
|
+
if (typeof item !== 'string')
|
|
46
|
+
continue;
|
|
47
|
+
const text = item.replace(/\s+/g, ' ').trim();
|
|
48
|
+
if (text === '')
|
|
49
|
+
continue;
|
|
50
|
+
const key = text.toLowerCase();
|
|
51
|
+
if (seen.has(key))
|
|
52
|
+
continue;
|
|
53
|
+
seen.add(key);
|
|
54
|
+
out.push(text.length > MAX_QUALITY_REQUIREMENT_CHARS
|
|
55
|
+
? `${text.slice(0, MAX_QUALITY_REQUIREMENT_CHARS - 3)}...`
|
|
56
|
+
: text);
|
|
57
|
+
if (out.length >= MAX_QUALITY_REQUIREMENTS)
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 渲染「本次任务结果的质量要求」块(用户要求 3、6)。
|
|
64
|
+
*
|
|
65
|
+
* 主 Agent 派发给部门负责人、部门负责人派发给专家,都必须带这一块;
|
|
66
|
+
* 两处共用同一渲染,保证「负责人的要求」与「专家收到的要求」逐字一致。
|
|
67
|
+
*/
|
|
68
|
+
export function renderQualityRequirementsBlock(requirements, sourceLabel = '主 Agent') {
|
|
69
|
+
const list = normalizeQualityRequirements(requirements);
|
|
70
|
+
if (list.length === 0)
|
|
71
|
+
return '';
|
|
72
|
+
return [
|
|
73
|
+
`本次任务结果的质量要求(${sourceLabel}下达,属于验收的一部分,必须逐条达到,缺一不可):`,
|
|
74
|
+
...list.map((item, index) => ` ${index + 1}. ${item}`),
|
|
75
|
+
].join('\n');
|
|
76
|
+
}
|
|
77
|
+
/* ========================================================================== */
|
|
78
|
+
/* 2b. 主 Agent→部门负责人派发的质量要求硬闸(2026-11-15 用户裁决) */
|
|
79
|
+
/* ========================================================================== */
|
|
80
|
+
/**
|
|
81
|
+
* 质量闸生效时刻(2026-11-15 10:30 +08:00 部署本机制的会话时点)。
|
|
82
|
+
*
|
|
83
|
+
* 用户裁决:旧计划(在途/历史,无 qualityRequirements 字段)豁免、零回归;
|
|
84
|
+
* 只有 createdAt ≥ 该时刻的新计划在派发时才被本闸拦截。createdAt 缺失或
|
|
85
|
+
* 非法一律视为旧计划放行(与 criterion v2 的「不回溯」哲学一致)。
|
|
86
|
+
*/
|
|
87
|
+
export const QUALITY_GATE_ACTIVATED_AT = Date.parse('2026-11-15T02:30:00.000Z');
|
|
88
|
+
/** 该计划是否受「派发必须带质量要求」硬闸约束(true=新计划,拦截)。 */
|
|
89
|
+
export function isQualityGatePlan(plan) {
|
|
90
|
+
const createdAt = Number(plan?.createdAt ?? 0);
|
|
91
|
+
return Number.isFinite(createdAt) && createdAt > 0 && createdAt >= QUALITY_GATE_ACTIVATED_AT;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* 校验单条派发给部门负责人的子任务是否携带质量要求(用户裁决:缺即拒发)。
|
|
95
|
+
*
|
|
96
|
+
* 判据与 normalizeQualityRequirements 同口径:至少 1 条非空、去重后 ≤8 条、
|
|
97
|
+
* 每条 ≤400 字符;全部为空视为缺失。满足返回 ok:true(调用方照常派发)。
|
|
98
|
+
*/
|
|
99
|
+
export function checkSubtaskQualityRequirements(subtask) {
|
|
100
|
+
const item = (subtask ?? {});
|
|
101
|
+
if (normalizeQualityRequirements(item?.qualityRequirements).length >= MIN_QUALITY_REQUIREMENTS) {
|
|
102
|
+
return { ok: true };
|
|
103
|
+
}
|
|
104
|
+
const label = typeof item?.title === 'string' && item.title.trim() !== '' ? `「${item.title.trim()}」` : '';
|
|
105
|
+
return {
|
|
106
|
+
ok: false,
|
|
107
|
+
code: 'DISPATCH_QUALITY_REQUIREMENTS_MISSING',
|
|
108
|
+
error: `派发给部门负责人的子任务${label}(${String(item?.id ?? '?')})没有携带质量要求(qualityRequirements):`
|
|
109
|
+
+ '不带质量要求的任务直接拒发,该子任务不会启动部门 Agent。',
|
|
110
|
+
hint: '立刻用 dsh_workplan_replan 重新规划,为每个子任务补写 qualityRequirements'
|
|
111
|
+
+ '(至少 1 条可检查的质量要求:什么算合格、什么算不合格,每条 ≤400 字符),'
|
|
112
|
+
+ '然后重新调用 dsh_workplan_dispatch 派发;本次其余合格的子任务不受影响、正常执行。',
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/* ========================================================================== */
|
|
116
|
+
/* 3. 极简任务硬门槛(用户要求 5) */
|
|
117
|
+
/* ========================================================================== */
|
|
118
|
+
/** 单项任务书的字符上限:超过即判定「不是一个 1+1=2 的单项任务」。 */
|
|
119
|
+
export const MAX_ATOMIC_TASK_CHARS = 300;
|
|
120
|
+
/** 单项任务书的最短字符数(太短无法判断做什么;与函数注释、CHANGELOG 3.0.0 一致)。 */
|
|
121
|
+
export const MIN_ATOMIC_TASK_CHARS = 8;
|
|
122
|
+
/**
|
|
123
|
+
* 并列/多目标的强信号词。命中 1 个以上即视为「一个任务里塞了多件事」。
|
|
124
|
+
* 只收强信号(明显的并列连词与小标题分隔),不收「和」这类高频虚词,
|
|
125
|
+
* 避免把正常表述误判成多任务。
|
|
126
|
+
*/
|
|
127
|
+
const MULTI_GOAL_MARKERS = Object.freeze([
|
|
128
|
+
'并且', '同时', '另外', '还要', '以及', '分别', '顺便',
|
|
129
|
+
]);
|
|
130
|
+
/** 句末终止符:原子任务必须是单句。 */
|
|
131
|
+
const SENTENCE_TERMINATORS = [new RegExp('[。!?!?]', 'g')];
|
|
132
|
+
/**
|
|
133
|
+
* 极简任务硬门槛(用户要求 5,用户裁决 A:不满足即拒绝派发并强制拆小)。
|
|
134
|
+
*
|
|
135
|
+
* 判据全部可机械复算,不看语义:
|
|
136
|
+
* 1) 非空且长度在 8–300 字符之间;
|
|
137
|
+
* 2) 只有一句话(不出现第二个句末标点,不含分号分句);
|
|
138
|
+
* 3) 不含并列强信号词(并且/同时/另外/还要/以及/分别/顺便);
|
|
139
|
+
* 4) 必须带非空的质量要求(用户要求 6:交代清楚成果必须达到的要求和质量)。
|
|
140
|
+
*
|
|
141
|
+
* 返回的 hint 是可直接照做的拆小指令,不是一句「不合格」。
|
|
142
|
+
*/
|
|
143
|
+
export function checkAtomicAssignment(task, qualityRequirements) {
|
|
144
|
+
const text = String(task ?? '').replace(/\s+/g, ' ').trim();
|
|
145
|
+
if (text.length < MIN_ATOMIC_TASK_CHARS) {
|
|
146
|
+
return {
|
|
147
|
+
ok: false,
|
|
148
|
+
code: 'DELEGATE_TASK_NOT_ATOMIC',
|
|
149
|
+
error: `分到的任务太短(${text.length} 字符),必须写清「一个动作 + 一个主产物」(至少 ${MIN_ATOMIC_TASK_CHARS} 字符)。`,
|
|
150
|
+
hint: '把任务写成:对什么对象做什么动作 → 产出哪一个文件/结论。一条只做一件事。',
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
if (text.length > MAX_ATOMIC_TASK_CHARS) {
|
|
154
|
+
return {
|
|
155
|
+
ok: false,
|
|
156
|
+
code: 'DELEGATE_TASK_NOT_ATOMIC',
|
|
157
|
+
error: `分到的任务太长(${text.length} 字符 > ${MAX_ATOMIC_TASK_CHARS}),不是 1+1=2 的单项任务。`,
|
|
158
|
+
hint: '按「一个目标 / 一个主产物 / 一项可独立验收」拆成多条;每条只保留一个动作,其余另起一条。',
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
for (const pattern of SENTENCE_TERMINATORS) {
|
|
162
|
+
pattern.lastIndex = 0;
|
|
163
|
+
const matches = text.match(pattern);
|
|
164
|
+
if (matches && matches.length > 1) {
|
|
165
|
+
return {
|
|
166
|
+
ok: false,
|
|
167
|
+
code: 'DELEGATE_TASK_NOT_ATOMIC',
|
|
168
|
+
error: '分到的任务里出现了多个句子,说明塞进了多件事。',
|
|
169
|
+
hint: '一个任务只写一句话;其余句子各自拆成独立任务。',
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (/[;;]/.test(text)) {
|
|
174
|
+
return {
|
|
175
|
+
ok: false,
|
|
176
|
+
code: 'DELEGATE_TASK_NOT_ATOMIC',
|
|
177
|
+
error: '分到的任务用分号并列了多个子任务,不是单项任务。',
|
|
178
|
+
hint: '分号前、分号后各拆成一条独立任务,各自带质量要求。',
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
const hit = MULTI_GOAL_MARKERS.filter((marker) => text.includes(marker));
|
|
182
|
+
if (hit.length > 0) {
|
|
183
|
+
return {
|
|
184
|
+
ok: false,
|
|
185
|
+
code: 'DELEGATE_TASK_NOT_ATOMIC',
|
|
186
|
+
error: `分到的任务含并列词「${hit.join('、')}」,说明一个任务里有多件事。`,
|
|
187
|
+
hint: '把并列词前后的内容各拆成一条独立任务,每条只做一个动作。',
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
if (normalizeQualityRequirements(qualityRequirements).length < MIN_QUALITY_REQUIREMENTS) {
|
|
191
|
+
return {
|
|
192
|
+
ok: false,
|
|
193
|
+
code: 'DELEGATE_QUALITY_REQUIREMENTS_MISSING',
|
|
194
|
+
error: '分到的任务没有交代「成果必须达到的要求和质量」,专家无法判断做到什么程度算完成。',
|
|
195
|
+
hint: '为这条任务补 qualityRequirements(至少 1 条可检查的质量要求,例如「必须是可执行命令并附真实输出」)。',
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
return { ok: true };
|
|
199
|
+
}
|
|
200
|
+
/* ========================================================================== */
|
|
201
|
+
/* 4. 专家精简 JSON 汇报(用户要求 7) */
|
|
202
|
+
/* ========================================================================== */
|
|
203
|
+
/** 单个汇报数组的条数上限:精简的量化口径。 */
|
|
204
|
+
export const MAX_REPORT_ITEMS = 6;
|
|
205
|
+
/** 单条汇报文本的字符上限。 */
|
|
206
|
+
export const MAX_REPORT_ITEM_CHARS = 200;
|
|
207
|
+
/** 专家汇报的四个必填字段(与用户要求 7 的四个方向一一对应)。 */
|
|
208
|
+
export const EXPERT_REPORT_FIELDS = Object.freeze([
|
|
209
|
+
Object.freeze({ name: 'keyResults', label: '关键成果', description: '本次任务真正做出来的结果(做了什么、得出什么),至少 1 条' }),
|
|
210
|
+
Object.freeze({ name: 'keyInfo', label: '关键信息', description: '支撑上述成果的关键事实/数据/结论,可为空数组' }),
|
|
211
|
+
Object.freeze({ name: 'importantInfo', label: '重要信息', description: '负责人必须知道的风险、限制、未决项,可为空数组' }),
|
|
212
|
+
Object.freeze({ name: 'leadRequirements', label: '负责人要求的东西', description: '负责人点名要的东西(文件路径/结论/证据)逐条回应,至少 1 条' }),
|
|
213
|
+
]);
|
|
214
|
+
/** 部门汇总的必填字段(与用户要求 10 一一对应)。 */
|
|
215
|
+
export const DEPARTMENT_SUMMARY_FIELDS = Object.freeze([
|
|
216
|
+
Object.freeze({ name: 'keyResults', label: '关键成果', description: '本部门汇总后的关键成果,至少 1 条' }),
|
|
217
|
+
Object.freeze({ name: 'keyInfo', label: '关键信息', description: '支撑成果的关键事实/数据,可为空数组' }),
|
|
218
|
+
Object.freeze({ name: 'importantInfo', label: '重要信息', description: '主 Agent 必须知道的风险、限制、未决项,可为空数组' }),
|
|
219
|
+
Object.freeze({ name: 'sources', label: '覆盖的专家汇报', description: '逐条列明已汇总的专家:member + 其关键成果一句;必须覆盖本部门全部已派发专家' }),
|
|
220
|
+
]);
|
|
221
|
+
function normalizeReportLine(value) {
|
|
222
|
+
if (typeof value !== 'string')
|
|
223
|
+
return '';
|
|
224
|
+
return value.replace(/\s+/g, ' ').trim();
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* 去重检测(用户要求 10 的「禁止内容累赘和重复」)。
|
|
228
|
+
*
|
|
229
|
+
* 两种重复都算:
|
|
230
|
+
* 1) 同一条信息重复出现——完全相同,或一条完整包含另一条且短的一条不少于
|
|
231
|
+
* 12 字符;
|
|
232
|
+
* 2) 近义重复——按 bigram 的 Dice 系数 ≥ 0.85 判定(与 T7 契约文档同一阈值),
|
|
233
|
+
* 用于拦「换个说法写两遍」。
|
|
234
|
+
* 条目支持「去重键|内容」写法(T7 契约):去重键相同即视为同一条信息,
|
|
235
|
+
* 与内容是否一致无关。
|
|
236
|
+
*/
|
|
237
|
+
const DEDUPE_SIMILARITY_THRESHOLD = 0.85;
|
|
238
|
+
/** 拆出「去重键|内容」的去重键(没有分隔符时返回空串)。 */
|
|
239
|
+
export function entryDedupeKey(line) {
|
|
240
|
+
const index = line.indexOf('|');
|
|
241
|
+
if (index <= 0)
|
|
242
|
+
return '';
|
|
243
|
+
return line.slice(0, index).replace(/\s+/g, ' ').trim().toLowerCase();
|
|
244
|
+
}
|
|
245
|
+
/** bigram 集合(去掉空白与标点,中文按二字切片)。 */
|
|
246
|
+
function bigrams(text) {
|
|
247
|
+
const cleaned = text.toLowerCase().replace(/[\s\p{P}\p{S}]/gu, '');
|
|
248
|
+
const out = [];
|
|
249
|
+
for (let i = 0; i < cleaned.length - 1; i += 1)
|
|
250
|
+
out.push(cleaned.slice(i, i + 2));
|
|
251
|
+
if (out.length === 0 && cleaned.length === 1)
|
|
252
|
+
out.push(cleaned);
|
|
253
|
+
return out;
|
|
254
|
+
}
|
|
255
|
+
/** Dice 相似度:两个 bigram 多重集的重合程度(0–1)。 */
|
|
256
|
+
export function diceSimilarity(a, b) {
|
|
257
|
+
const left = bigrams(a);
|
|
258
|
+
const right = bigrams(b);
|
|
259
|
+
if (left.length === 0 || right.length === 0)
|
|
260
|
+
return a.trim() === b.trim() ? 1 : 0;
|
|
261
|
+
const counts = new Map();
|
|
262
|
+
for (const gram of left)
|
|
263
|
+
counts.set(gram, (counts.get(gram) ?? 0) + 1);
|
|
264
|
+
let overlap = 0;
|
|
265
|
+
for (const gram of right) {
|
|
266
|
+
const remaining = counts.get(gram) ?? 0;
|
|
267
|
+
if (remaining > 0) {
|
|
268
|
+
overlap += 1;
|
|
269
|
+
counts.set(gram, remaining - 1);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return (2 * overlap) / (left.length + right.length);
|
|
273
|
+
}
|
|
274
|
+
function duplicatePairs(lines) {
|
|
275
|
+
const found = [];
|
|
276
|
+
const normalized = lines.map((line) => line.toLowerCase());
|
|
277
|
+
const keys = lines.map(entryDedupeKey);
|
|
278
|
+
for (let i = 0; i < normalized.length; i += 1) {
|
|
279
|
+
for (let j = i + 1; j < normalized.length; j += 1) {
|
|
280
|
+
const a = normalized[i];
|
|
281
|
+
const b = normalized[j];
|
|
282
|
+
if (a === '')
|
|
283
|
+
continue;
|
|
284
|
+
if (keys[i] !== '' && keys[i] === keys[j]) {
|
|
285
|
+
found.push([lines[i], lines[j]]);
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
if (a === b) {
|
|
289
|
+
found.push([lines[i], lines[j]]);
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
const [short, long] = a.length <= b.length ? [a, b] : [b, a];
|
|
293
|
+
if (short.length >= 12 && long.includes(short)) {
|
|
294
|
+
found.push([lines[i], lines[j]]);
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
if (short.length >= 12 && diceSimilarity(a, b) >= DEDUPE_SIMILARITY_THRESHOLD) {
|
|
298
|
+
found.push([lines[i], lines[j]]);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return found;
|
|
303
|
+
}
|
|
304
|
+
function checkListField(container, name, violations, options) {
|
|
305
|
+
const raw = container[name];
|
|
306
|
+
if (!Array.isArray(raw)) {
|
|
307
|
+
violations.push(`缺少 ${name} 数组(${name} 必须是字符串数组)`);
|
|
308
|
+
return [];
|
|
309
|
+
}
|
|
310
|
+
const lines = raw.map(normalizeReportLine).filter((line) => line !== '');
|
|
311
|
+
if (lines.length < options.minItems) {
|
|
312
|
+
violations.push(`${name} 至少 ${options.minItems} 条非空内容,当前 ${lines.length} 条`);
|
|
313
|
+
}
|
|
314
|
+
if (lines.length > MAX_REPORT_ITEMS) {
|
|
315
|
+
violations.push(`${name} 最多 ${MAX_REPORT_ITEMS} 条(精简要求),当前 ${lines.length} 条,请合并去重`);
|
|
316
|
+
}
|
|
317
|
+
for (const line of lines) {
|
|
318
|
+
if (line.length > MAX_REPORT_ITEM_CHARS) {
|
|
319
|
+
violations.push(`${name} 有一条 ${line.length} 字符超上限(${MAX_REPORT_ITEM_CHARS}),请压缩成一句关键信息`);
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
const dups = duplicatePairs(lines);
|
|
324
|
+
if (dups.length > 0) {
|
|
325
|
+
violations.push(`${name} 内部有重复表述(例:「${dups[0][0].slice(0, 40)}」与「${dups[0][1].slice(0, 40)}」),禁止累赘重复`);
|
|
326
|
+
}
|
|
327
|
+
const across = options.dedupeAcross ?? [];
|
|
328
|
+
for (const other of across) {
|
|
329
|
+
const otherLines = (Array.isArray(container[other]) ? container[other] : [])
|
|
330
|
+
.map(normalizeReportLine).filter((line) => line !== '');
|
|
331
|
+
const crossDups = duplicatePairs([...lines, ...otherLines])
|
|
332
|
+
.filter((pair) => lines.includes(pair[0]) && otherLines.includes(pair[1]));
|
|
333
|
+
if (crossDups.length > 0) {
|
|
334
|
+
violations.push(`${name} 与 ${other} 有重复项(例:「${crossDups[0][0].slice(0, 40)}」),同一信息只写一次`);
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return lines;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* 校验专家精简 JSON 汇报(用户要求 7)。
|
|
342
|
+
*
|
|
343
|
+
* 只做结构/精简判定,不判语义真伪(诚信由 F9 与三阶段门禁兜底)。
|
|
344
|
+
*/
|
|
345
|
+
export function checkExpertReport(report) {
|
|
346
|
+
if (!report || typeof report !== 'object' || Array.isArray(report)) {
|
|
347
|
+
return { ok: false, code: 'REPORT_INVALID', violations: ['缺少 report 对象:专家成果必须以 JSON 汇报(keyResults/keyInfo/importantInfo/leadRequirements)'] };
|
|
348
|
+
}
|
|
349
|
+
const container = report;
|
|
350
|
+
const extra = Object.keys(container).filter((key) => !EXPERT_REPORT_FIELDS.some((field) => field.name === key));
|
|
351
|
+
const violations = [];
|
|
352
|
+
checkListField(container, 'keyResults', violations, { minItems: 1, dedupeAcross: ['keyInfo', 'importantInfo', 'leadRequirements'] });
|
|
353
|
+
checkListField(container, 'keyInfo', violations, { minItems: 0, dedupeAcross: ['keyResults', 'importantInfo', 'leadRequirements'] });
|
|
354
|
+
checkListField(container, 'importantInfo', violations, { minItems: 0, dedupeAcross: ['keyResults', 'keyInfo', 'leadRequirements'] });
|
|
355
|
+
checkListField(container, 'leadRequirements', violations, { minItems: 1, dedupeAcross: ['keyResults', 'keyInfo', 'importantInfo'] });
|
|
356
|
+
if (extra.length > 0) {
|
|
357
|
+
violations.push(`report 只允许 keyResults/keyInfo/importantInfo/leadRequirements 四个字段,多出:${extra.join('、')}`);
|
|
358
|
+
}
|
|
359
|
+
return violations.length === 0
|
|
360
|
+
? { ok: true, violations: [] }
|
|
361
|
+
: { ok: false, code: violations.some((v) => v.startsWith('缺少 report')) ? 'REPORT_INVALID' : 'REPORT_NOT_CONCISE', violations };
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* 校验部门负责人精简 JSON 汇总(用户要求 8、10、11)。
|
|
365
|
+
*
|
|
366
|
+
* @param summary 汇总对象
|
|
367
|
+
* @param expectedExperts 本部门已派发给专家的名单(按 member 名称);给空数组时
|
|
368
|
+
* 不做覆盖度核对(负责人亲自执行、无下级的情形)
|
|
369
|
+
*/
|
|
370
|
+
export function checkDepartmentSummary(summary, expectedExperts = []) {
|
|
371
|
+
if (!summary || typeof summary !== 'object' || Array.isArray(summary)) {
|
|
372
|
+
return { ok: false, code: 'DEPARTMENT_SUMMARY_INVALID', violations: ['缺少 departmentSummary 对象:部门汇总必须以 JSON 交回主 Agent(keyResults/keyInfo/importantInfo/sources)'] };
|
|
373
|
+
}
|
|
374
|
+
const container = summary;
|
|
375
|
+
const extra = Object.keys(container).filter((key) => !DEPARTMENT_SUMMARY_FIELDS.some((field) => field.name === key));
|
|
376
|
+
const violations = [];
|
|
377
|
+
checkListField(container, 'keyResults', violations, { minItems: 1, dedupeAcross: ['keyInfo', 'importantInfo'] });
|
|
378
|
+
checkListField(container, 'keyInfo', violations, { minItems: 0, dedupeAcross: ['keyResults', 'importantInfo'] });
|
|
379
|
+
checkListField(container, 'importantInfo', violations, { minItems: 0, dedupeAcross: ['keyResults', 'keyInfo'] });
|
|
380
|
+
const covered = checkListField(container, 'sources', violations, { minItems: 0 });
|
|
381
|
+
if (expectedExperts.length > 0) {
|
|
382
|
+
const joined = covered.join('\n').toLowerCase();
|
|
383
|
+
const missing = expectedExperts.filter((member) => member.trim() !== '' && !joined.includes(member.trim().toLowerCase()));
|
|
384
|
+
if (missing.length > 0) {
|
|
385
|
+
violations.push(`sources 未覆盖全部已派发专家,缺少:${missing.join('、')}(每条写「专家名:一句关键成果」)`);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
if (extra.length > 0) {
|
|
389
|
+
violations.push(`departmentSummary 只允许 keyResults/keyInfo/importantInfo/sources 四个字段,多出:${extra.join('、')}`);
|
|
390
|
+
}
|
|
391
|
+
return violations.length === 0
|
|
392
|
+
? { ok: true, violations: [] }
|
|
393
|
+
: { ok: false, code: 'DEPARTMENT_SUMMARY_NOT_CONCISE', violations };
|
|
394
|
+
}
|
|
395
|
+
/** 渲染专家汇报的 JSON 契约(嵌入专家任务书)。 */
|
|
396
|
+
export function renderExpertReportSpec() {
|
|
397
|
+
return [
|
|
398
|
+
'【专家成果汇报契约 · JSON mode · 用户强制要求 7】',
|
|
399
|
+
'完成后必须在证据块 JSON 里额外给出 report 字段,只写下面四项,禁止写长文、禁止前后重复:',
|
|
400
|
+
' "report": {',
|
|
401
|
+
' "keyResults": ["关键成果"],',
|
|
402
|
+
' "keyInfo": ["关键信息"],',
|
|
403
|
+
' "importantInfo": ["重要信息"],',
|
|
404
|
+
' "leadRequirements": ["负责人要求的东西"]',
|
|
405
|
+
' }',
|
|
406
|
+
...EXPERT_REPORT_FIELDS.map((field) => `- ${field.name}(${field.label}):${field.description}`),
|
|
407
|
+
`- 每个数组最多 ${MAX_REPORT_ITEMS} 条、每条最多 ${MAX_REPORT_ITEM_CHARS} 字符;同一信息只能出现一次(禁止累赘和重复)。`,
|
|
408
|
+
'- 门禁:缺 report、字段缺失、条数越界、单条超长、或出现重复项,结果一律退回重交(REPORT_INVALID / REPORT_NOT_CONCISE)。',
|
|
409
|
+
].join('\n');
|
|
410
|
+
}
|
|
411
|
+
/** 渲染部门汇总的 JSON 契约(嵌入部门负责人任务书)。 */
|
|
412
|
+
export function renderDepartmentSummarySpec() {
|
|
413
|
+
return [
|
|
414
|
+
'【部门汇总契约 · JSON mode · 用户强制要求 8/10/11】',
|
|
415
|
+
'你的结果除了常规证据块,必须额外给出 departmentSummary 字段:全面、深入整理汇总本部门全部专家汇报,只保留关键信息、关键成果、重要信息与主 Agent 要求的东西,禁止累赘和重复;汇总完成后直接交回主 Agent。',
|
|
416
|
+
' "departmentSummary": {',
|
|
417
|
+
' "keyResults": ["关键成果"],',
|
|
418
|
+
' "keyInfo": ["关键信息"],',
|
|
419
|
+
' "importantInfo": ["重要信息"],',
|
|
420
|
+
' "sources": ["专家名:一句关键成果"]',
|
|
421
|
+
' }',
|
|
422
|
+
...DEPARTMENT_SUMMARY_FIELDS.map((field) => `- ${field.name}(${field.label}):${field.description}`),
|
|
423
|
+
`- 每个数组最多 ${MAX_REPORT_ITEMS} 条、每条最多 ${MAX_REPORT_ITEM_CHARS} 字符;sources 必须覆盖本部门全部已派发专家,同一信息只能出现一次。`,
|
|
424
|
+
'- 门禁:缺 departmentSummary、字段缺失、未覆盖全部专家、或出现重复项,结果一律退回重交(DEPARTMENT_SUMMARY_INVALID / DEPARTMENT_SUMMARY_NOT_CONCISE)。',
|
|
425
|
+
].join('\n');
|
|
426
|
+
}
|
|
427
|
+
/** 去掉首尾空白并截断(与 plan.ts truncate 同语义,此处自带以保持零依赖)。 */
|
|
428
|
+
export function clipReportText(value, limit) {
|
|
429
|
+
const text = String(value ?? '').replace(/\s+/g, ' ').trim();
|
|
430
|
+
return text.length > limit ? `${text.slice(0, Math.max(0, limit - 3))}...` : text;
|
|
431
|
+
}
|
package/lib/watchdog.js
CHANGED
|
@@ -60,7 +60,12 @@ export function describeError(value) {
|
|
|
60
60
|
}
|
|
61
61
|
if (value instanceof Error) {
|
|
62
62
|
const message = typeof value.message === 'string' ? value.message.trim() : '';
|
|
63
|
-
|
|
63
|
+
const base = message !== '' ? message : (value.name || '未知失败');
|
|
64
|
+
// [2.5.5][T6] 堆栈留痕:毫秒级崩溃(如 TypeError reading 'id')旧实现只留
|
|
65
|
+
// message 一行,根因无法闭环(session-1513 缺口 G2)。附截断堆栈,durable
|
|
66
|
+
// 结果/看板可直接定位崩溃点。
|
|
67
|
+
const stack = typeof value.stack === 'string' ? value.stack.split('\n').slice(0, 6).join(' | ').trim() : '';
|
|
68
|
+
return stack ? `${base}[stack: ${stack.slice(0, 600)}]` : base;
|
|
64
69
|
}
|
|
65
70
|
if (typeof value === 'object') {
|
|
66
71
|
const record = value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-workplan",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
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",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"clean": "rm -rf dist dist-tests",
|
|
69
|
-
"build": "rm -rf dist && tsc -p tsconfig.json && cp dist/*.js lib/ && cp dist/client.js client.js",
|
|
69
|
+
"build": "rm -rf dist && tsc -p tsconfig.json && rm -f lib/*.js && cp dist/*.js lib/ && cp dist/client.js client.js",
|
|
70
70
|
"check": "tsc -p tsconfig.json --noEmit",
|
|
71
71
|
"test": "npm run build && rm -rf dist-tests && tsc -p tsconfig.test.json && node scripts/run-tests.mjs",
|
|
72
72
|
"verify": "npm run check && npm test",
|
package/src/client.ts
CHANGED
|
@@ -24,7 +24,6 @@ window.__ModuleLoader__.load({
|
|
|
24
24
|
"groupEnded": "已结束",
|
|
25
25
|
"groupLiveHint": "还没结束,正在或即将推进",
|
|
26
26
|
"groupDoneHint": "已全部完成并收尾",
|
|
27
|
-
"groupEndedHint": "这一轮已经停了,没有东西在跑;说「续跑」可继续推进",
|
|
28
27
|
"groupCollapse": "收起",
|
|
29
28
|
"groupExpand": "展开",
|
|
30
29
|
"groupNeeds": "需处理",
|
|
@@ -95,15 +94,16 @@ window.__ModuleLoader__.load({
|
|
|
95
94
|
"closed": "无需动作"
|
|
96
95
|
},
|
|
97
96
|
"handoffs": "跨部门需求",
|
|
98
|
-
"delegates": "
|
|
97
|
+
"delegates": "第三层(全球顶尖专家)",
|
|
99
98
|
"delegateExpert": "专家",
|
|
100
|
-
"delegateMember": "
|
|
99
|
+
"delegateMember": "专家",
|
|
101
100
|
"delegateStatus": {
|
|
102
101
|
"running": "执行中",
|
|
103
102
|
"done": "已完成",
|
|
104
103
|
"failed": "失败",
|
|
105
104
|
"timeout": "超时",
|
|
106
|
-
"rejected": "派发被拒"
|
|
105
|
+
"rejected": "派发被拒",
|
|
106
|
+
"blocked": "受阻"
|
|
107
107
|
},
|
|
108
108
|
"dept": {
|
|
109
109
|
"engineering": "工程研发",
|
|
@@ -247,6 +247,11 @@ window.__ModuleLoader__.load({
|
|
|
247
247
|
"noticeChannelAwaiting": "等待观测",
|
|
248
248
|
"noticeChannelNotObserved": "未观测到送达",
|
|
249
249
|
"reason": "原因",
|
|
250
|
+
"leaderEstimateFull": "负责人任务时长=全部下属开工预估之和:{minutes} 分钟({reported}/{expected} 已上报)|判据层完成目标 ≤10 分钟:达标须同时满足事前预估之和与事后单次尝试墙钟均 ≤10 分钟",
|
|
251
|
+
"leaderEstimatePartial": "下属开工预估部分和:{minutes} 分钟({reported}/{expected} 已上报{gaps})|预估未报齐只显示部分和,不得视为「简单判据达标」(判据层完成目标 ≤10 分钟)",
|
|
252
|
+
"leaderEstimateOver": "⚠ 超简单判据:事前预估 {minutes} 分钟 > 10 分钟完成目标——请事前拆分,或经用户明确批准并留痕(无留痕=未批准,不得视为达标)",
|
|
253
|
+
"leaderEstimateMissing": ",缺:{names}",
|
|
254
|
+
"leaderEstimateFailed": ",报送失败:{names}",
|
|
250
255
|
},
|
|
251
256
|
"en": {
|
|
252
257
|
"groupLive": "In progress",
|
|
@@ -307,6 +312,7 @@ window.__ModuleLoader__.load({
|
|
|
307
312
|
"paused": "Paused (budget spent)",
|
|
308
313
|
"degraded": "Planning failed",
|
|
309
314
|
"cancelled": "Cancelled",
|
|
315
|
+
"superseded": "Taken over by another plan",
|
|
310
316
|
"ended": "Ended (resumable)"
|
|
311
317
|
},
|
|
312
318
|
"status": {
|
|
@@ -330,7 +336,8 @@ window.__ModuleLoader__.load({
|
|
|
330
336
|
"done": "done",
|
|
331
337
|
"failed": "failed",
|
|
332
338
|
"timeout": "timeout",
|
|
333
|
-
"rejected": "rejected"
|
|
339
|
+
"rejected": "rejected",
|
|
340
|
+
"blocked": "blocked"
|
|
334
341
|
},
|
|
335
342
|
"dept": {
|
|
336
343
|
"engineering": "Engineering",
|
|
@@ -474,6 +481,11 @@ window.__ModuleLoader__.load({
|
|
|
474
481
|
"noticeChannelAwaiting": "Awaiting observation",
|
|
475
482
|
"noticeChannelNotObserved": "Delivery not observed",
|
|
476
483
|
"reason": "reason",
|
|
484
|
+
"leaderEstimateFull": "Leader task duration = sum of all delegate start estimates: {minutes} min ({reported}/{expected} reported) | Criterion layer: completion target <= 10 min, met only when both the ex-ante estimate sum and the ex-post single-attempt wall clock are <= 10 min",
|
|
485
|
+
"leaderEstimatePartial": "Partial sum of delegate start estimates: {minutes} min ({reported}/{expected} reported{gaps}) | Estimates incomplete: partial sum only, never a met criterion (completion target <= 10 min)",
|
|
486
|
+
"leaderEstimateOver": "OVER criterion: ex-ante estimate {minutes} min > 10 min completion target - split the work or obtain explicit user approval with an audit trail (no trail = not approved, never a met criterion)",
|
|
487
|
+
"leaderEstimateMissing": ", missing: {names}",
|
|
488
|
+
"leaderEstimateFailed": ", delivery failed: {names}",
|
|
477
489
|
}
|
|
478
490
|
}
|
|
479
491
|
|
|
@@ -1621,7 +1633,9 @@ window.__ModuleLoader__.load({
|
|
|
1621
1633
|
* - 计划定义:estimateMinutes(预估)、timeoutMs(协商上限)、reasoningEffort(推理等级);
|
|
1622
1634
|
* - 状态行:startedAt/deadlineAt(协商截止)、timeJournal(延期/预告历史)、
|
|
1623
1635
|
* timeNotice(开工预告)、timeWarning(到点预警)、noticeChannel(子→主通道是否送达)、
|
|
1624
|
-
* pendingAdjudication
|
|
1636
|
+
* pendingAdjudication(到点后的待裁决标记);
|
|
1637
|
+
* [T7] leaderEstimate(负责人时长聚合,服务端读时派生:全员 sent 表述完整等式,
|
|
1638
|
+
* 否则部分和+缺口名单;null/缺失整块不渲染,客户端严禁求和)。
|
|
1625
1639
|
*
|
|
1626
1640
|
* 客户端不推导状态机、不补造字段:任何字段缺失就少显示一行;全部缺失整块不渲染,
|
|
1627
1641
|
* 绝不出现 undefined / [object Object]。
|
|
@@ -1651,7 +1665,20 @@ window.__ModuleLoader__.load({
|
|
|
1651
1665
|
const warning = item?.timeWarning && typeof item.timeWarning === 'object' ? item.timeWarning : null
|
|
1652
1666
|
const channel = item?.noticeChannel && typeof item.noticeChannel === 'object' ? item.noticeChannel : null
|
|
1653
1667
|
const pending = item?.pendingAdjudication === true
|
|
1654
|
-
|
|
1668
|
+
/*
|
|
1669
|
+
* [T7][J2/J6] 负责人任务时长聚合:只渲染服务端下发的 leaderEstimate
|
|
1670
|
+
* (plan.ts deriveLeaderEstimate 读时派生,经 serialisePlan→derivePlanSnapshot
|
|
1671
|
+
* 同源下发)。客户端严禁求和、不推导状态机:reported===expected 仅作
|
|
1672
|
+
* 措辞选择(J1:全员 sent 才表述完整等式)。totalMinutes=0 合法(F3
|
|
1673
|
+
* 部分和 0),故用 ≥0 守卫而非 positiveNumber;字段缺失/null(J8 空
|
|
1674
|
+
* roster/replanned 旧行/越界 fail-closed)⇒ 不渲染本块。
|
|
1675
|
+
*/
|
|
1676
|
+
const leaderEstimate = item?.leaderEstimate && typeof item.leaderEstimate === 'object' ? item.leaderEstimate : null
|
|
1677
|
+
const leaderExpected = leaderEstimate && Number.isInteger(leaderEstimate.expected) && leaderEstimate.expected > 0 ? leaderEstimate.expected : null
|
|
1678
|
+
const leaderReported = leaderEstimate && Number.isInteger(leaderEstimate.reported) && leaderEstimate.reported >= 0 ? leaderEstimate.reported : null
|
|
1679
|
+
const leaderMinutes = leaderEstimate && Number.isFinite(Number(leaderEstimate.totalMinutes)) && Number(leaderEstimate.totalMinutes) >= 0 ? Number(leaderEstimate.totalMinutes) : null
|
|
1680
|
+
const leaderShown = leaderEstimate !== null && leaderExpected !== null && leaderReported !== null && leaderMinutes !== null
|
|
1681
|
+
if (!estimate && !ceiling && !deadlineAt && !notice && !warning && !channel && !pending && extensions.length === 0 && !leaderShown) {
|
|
1655
1682
|
return null
|
|
1656
1683
|
}
|
|
1657
1684
|
const remainingMs = deadlineAt ? Math.max(0, deadlineAt - Date.now()) : null
|
|
@@ -1693,6 +1720,29 @@ window.__ModuleLoader__.load({
|
|
|
1693
1720
|
notes.push(`${t('noticeChannel')}:${stateText}${reason}`)
|
|
1694
1721
|
}
|
|
1695
1722
|
if (pending) notes.push(`${t('pendingAdjudication')}:${t('pendingAdjudicationHint')}`)
|
|
1723
|
+
/*
|
|
1724
|
+
* [T7][J1 方案 A] 全员 sent(reported===expected)才表述完整等式
|
|
1725
|
+
* 「负责人任务时长=全部下属开工预估之和」;否则必须按「部分和(X/Y)」
|
|
1726
|
+
* 标注并如实列出缺口名单。名单 join 只是展示拼接,不是求和;数值全部
|
|
1727
|
+
* 来自服务端下发的 leaderEstimate,客户端不做任何算术。
|
|
1728
|
+
*/
|
|
1729
|
+
if (leaderShown) {
|
|
1730
|
+
const missingNames = Array.isArray(leaderEstimate.missing) ? leaderEstimate.missing.filter((name: any) => typeof name === 'string' && name !== '') : []
|
|
1731
|
+
const failedNames = Array.isArray(leaderEstimate.failed) ? leaderEstimate.failed.filter((name: any) => typeof name === 'string' && name !== '') : []
|
|
1732
|
+
const gaps = (missingNames.length > 0 ? fill(t('leaderEstimateMissing'), { names: missingNames.join('、') }) : '')
|
|
1733
|
+
+ (failedNames.length > 0 ? fill(t('leaderEstimateFailed'), { names: failedNames.join('、') }) : '')
|
|
1734
|
+
notes.push(leaderReported === leaderExpected
|
|
1735
|
+
? fill(t('leaderEstimateFull'), { minutes: leaderMinutes, reported: leaderReported, expected: leaderExpected })
|
|
1736
|
+
: fill(t('leaderEstimatePartial'), { minutes: leaderMinutes, reported: leaderReported, expected: leaderExpected, gaps }))
|
|
1737
|
+
/*
|
|
1738
|
+
* [SCv2-T4][Q4-B/C21] 超判据告警:只读服务端下发的布尔
|
|
1739
|
+
* leaderEstimateOverCriterion(normaliseStatusEntry 派生),客户端
|
|
1740
|
+
* 严禁自行算术(client.ts 既定约定)。部分和 >10 同样告警(AC-Q4-2)。
|
|
1741
|
+
*/
|
|
1742
|
+
if (item?.leaderEstimateOverCriterion === true) {
|
|
1743
|
+
notes.push(fill(t('leaderEstimateOver'), { minutes: leaderMinutes }))
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1696
1746
|
return h('div', { className: 'dsh-wp-time' },
|
|
1697
1747
|
h('div', { className: 'dsh-wp-time-title' }, t('timeNegotiation')),
|
|
1698
1748
|
facts.length > 0
|
|
@@ -1807,7 +1857,7 @@ window.__ModuleLoader__.load({
|
|
|
1807
1857
|
: null,
|
|
1808
1858
|
/*
|
|
1809
1859
|
* [2.3.9][T4b] 第三层派发看板(用户要求 4/5):部门负责人分配给
|
|
1810
|
-
*
|
|
1860
|
+
* 全球顶尖专家的每位下级、其推理等级(含越界钳制留痕)与实时状态
|
|
1811
1861
|
* 必须对用户与主 Agent 可见,否则「第三层派给了谁、跑没跑完」只存在
|
|
1812
1862
|
* 负责人子会话里。数据源 = 状态行 delegates(applyStatus 消毒 +
|
|
1813
1863
|
* durable workplan-update 回放,刷新/重启不丢),客户端不推导状态。
|
|
@@ -1821,7 +1871,17 @@ window.__ModuleLoader__.load({
|
|
|
1821
1871
|
+ `(${member?.role === 'expert' ? t('delegateExpert') : t('delegateMember')})`
|
|
1822
1872
|
+ `|${t('reasoningEffort')}:${String(member?.effort ?? '?')}`
|
|
1823
1873
|
+ (member?.requested && member.requested !== member.effort ? `(越界钳制自 ${String(member.requested)})` : '')
|
|
1874
|
+
+ (member?.selfEffort ? `|自配档 ${String(member.selfEffort)}${member?.selfEffortRequested && member.selfEffortRequested !== member.selfEffort ? `(钳制自 ${String(member.selfEffortRequested)})` : ''}` : '|自配档 待自配')
|
|
1824
1875
|
+ `|${t(`delegateStatus.${String(member?.status ?? 'running')}`)}`
|
|
1876
|
+
/*
|
|
1877
|
+
* [2.5.6] 第三层闭环可见性:叶子的「待指示/已给指示/已回应」
|
|
1878
|
+
* 与第一层同一套 closure 文案(服务端下发,客户端不推导),
|
|
1879
|
+
* 请示问题随待指示标记一并展示,负责人/用户一眼看到谁在等谁。
|
|
1880
|
+
*/
|
|
1881
|
+
+ (member?.escalation ? `|${t('closureEscalated')}${member.escalation.question ? `:${String(member.escalation.question)}` : ''}` : '')
|
|
1882
|
+
+ (member?.lastInstruction ? `|${t('closureInstructed')}` : '')
|
|
1883
|
+
+ (member?.closure === 'acknowledged' ? `|${t('closureAcknowledged')}` : '')
|
|
1884
|
+
+ (member?.instructionOverdue ? `|${t('closureNoAck')}` : '')
|
|
1825
1885
|
+ (member?.summary ? `:${String(member.summary)}` : ''),
|
|
1826
1886
|
)),
|
|
1827
1887
|
),
|