dsh-workplan 2.1.5 → 2.2.7
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 +408 -1
- package/README.en.md +5 -2
- package/README.md +5 -2
- package/client.js +148 -3
- package/docs/dsh-workplan_T4_runtime.patch +508 -0
- package/docs/release-record-2.2.6-20261109-T5.md +64 -0
- package/docs/release-records/release-notes-2.2.6-T3.md +128 -0
- package/docs/release-records/release-steps-20261106.md +1 -1
- package/docs/release-records/version-freeze-20261109-T2.md +37 -0
- package/lib/client.js +148 -3
- package/lib/comm-format.js +17 -0
- package/lib/host.js +95 -17
- package/lib/notice-channel.js +290 -0
- package/lib/plan.js +668 -39
- package/lib/replan.js +35 -4
- package/lib/runtime.js +1918 -116
- package/lib/supersede.js +2 -2
- package/lib/understanding.js +8 -2
- package/lib/watchdog.js +52 -1
- package/package.json +3 -2
- package/scripts/repair-malformed-user-messages.mjs +312 -0
- package/src/client.ts +155 -2
- package/src/comm-format.ts +17 -0
- package/src/host.ts +90 -12
- package/src/notice-channel.ts +328 -0
- package/src/plan.ts +699 -30
- package/src/replan.ts +32 -1
- package/src/runtime.ts +1966 -118
- package/src/supersede.ts +2 -1
- package/src/understanding.ts +10 -2
- package/src/watchdog.ts +80 -1
- package/README.zh.md +0 -239
package/lib/replan.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* `closure:'replanned'`。展示层据此渲染「已重规划 → 修订 rN」并灰化,计数与
|
|
16
16
|
* 调度器则把它排除(见 plan.ts 的 `isReplannedStatus`、`definedSubtaskCount`)。
|
|
17
17
|
*/
|
|
18
|
-
import { DEPARTMENTS, MAX_STAGES, MAX_SUBTASKS, PLAN_VERSION, applyStatus, flattenSubtasks, isRecord, makeUserMessage, messageText, truncate, } from './plan.js';
|
|
18
|
+
import { DEPARTMENTS, MAX_STAGES, MAX_SUBTASKS, PLAN_VERSION, REASONING_EFFORTS, applyStatus, flattenSubtasks, isRecord, makeUserMessage, messageText, truncate, } from './plan.js';
|
|
19
19
|
export const REPLAN_MARKER_BEGIN = '<!-- DSH-WORKPLAN-REPLAN:BEGIN -->';
|
|
20
20
|
export const REPLAN_MARKER_END = '<!-- DSH-WORKPLAN-REPLAN:END -->';
|
|
21
21
|
export const REPLAN_ACTIONS = Object.freeze(['cancel', 'replace', 'add']);
|
|
@@ -145,13 +145,26 @@ const REPLACEMENT_FIELDS = [
|
|
|
145
145
|
'outputs',
|
|
146
146
|
'acceptance',
|
|
147
147
|
'risk',
|
|
148
|
+
// [2.2.0][T13b/推理等级] 替换行可显式改档位;未给时 mergeReplacement 继承旧行。
|
|
149
|
+
// [2.2.7][T4/五档+G1] 档位合法集合 = REASONING_EFFORTS(low / medium / high /
|
|
150
|
+
// xhigh / max),入口校验见 replanFieldError 的 reasoningEffort 分支——非法值
|
|
151
|
+
// 在 replan 期即拒绝,不再透传到计划对象、派发期才被静默回落。
|
|
152
|
+
'reasoningEffort',
|
|
148
153
|
];
|
|
149
154
|
/** 用调用方给的替换内容覆盖旧子任务的同名字段;未给字段原样继承。 */
|
|
150
155
|
function mergeReplacement(old, replacement, id, reason) {
|
|
151
156
|
const next = clone(old);
|
|
152
157
|
for (const key of REPLACEMENT_FIELDS) {
|
|
153
|
-
if (replacement?.[key]
|
|
154
|
-
|
|
158
|
+
if (replacement?.[key] === undefined)
|
|
159
|
+
continue;
|
|
160
|
+
/*
|
|
161
|
+
* [2.2.7][T4/G1] reasoningEffort 显式 null 按「缺失」处理(与 plan.ts
|
|
162
|
+
* readSubtasks 的 hasEffort 语义对齐):替换行继承旧行档位,
|
|
163
|
+
* 不用 null 覆盖,避免派发期回落 high 与「继承旧行」语义分叉。
|
|
164
|
+
*/
|
|
165
|
+
if (key === 'reasoningEffort' && replacement[key] === null)
|
|
166
|
+
continue;
|
|
167
|
+
next[key] = clone(replacement[key]);
|
|
155
168
|
}
|
|
156
169
|
next.id = id;
|
|
157
170
|
delete next.supersededAt;
|
|
@@ -206,6 +219,19 @@ function replanFieldError(raw) {
|
|
|
206
219
|
return `${key} 最长 ${max} 字符`;
|
|
207
220
|
return null;
|
|
208
221
|
};
|
|
222
|
+
/*
|
|
223
|
+
* [2.2.7][T4/五档+G1] reasoningEffort 入口白名单(replace/add 两路共用本函数):
|
|
224
|
+
* 与 plan.ts readSubtasks 语义对齐——缺失/显式 null 合法(replace 继承旧行、
|
|
225
|
+
* add 留给派发期回落 high),非缺失值必须是 REASONING_EFFORTS 五档之一
|
|
226
|
+
* (low / medium / high / xhigh / max),非法值拒绝、不改写。补上此校验前,
|
|
227
|
+
* 任意字符串可透传进计划对象,直到派发期才被 runtime 白名单静默回落。
|
|
228
|
+
*/
|
|
229
|
+
const effort = raw?.reasoningEffort;
|
|
230
|
+
const effortError = effort === undefined || effort === null
|
|
231
|
+
? null
|
|
232
|
+
: typeof effort !== 'string' || !REASONING_EFFORTS.includes(effort)
|
|
233
|
+
? 'reasoningEffort 必须是 low / medium / high / xhigh / max 之一(缺失合法:replace 继承旧行、add 派发期回落;非法值拒绝,不改写)'
|
|
234
|
+
: null;
|
|
209
235
|
return list('dependsOn', 12, 16)
|
|
210
236
|
?? list('method', 12, 800)
|
|
211
237
|
?? list('inputs', 12, 800)
|
|
@@ -214,7 +240,8 @@ function replanFieldError(raw) {
|
|
|
214
240
|
?? one('role', 200)
|
|
215
241
|
?? one('title', 200)
|
|
216
242
|
?? one('objective', 2000)
|
|
217
|
-
?? one('risk', 1000)
|
|
243
|
+
?? one('risk', 1000)
|
|
244
|
+
?? effortError;
|
|
218
245
|
}
|
|
219
246
|
export function planReplan(plan, changes, options = {}) {
|
|
220
247
|
const planId = String(options.planId ?? plan?.planId ?? '');
|
|
@@ -391,6 +418,10 @@ export function planReplan(plan, changes, options = {}) {
|
|
|
391
418
|
? raw.acceptance.map((item) => truncate(String(item), 800))
|
|
392
419
|
: ['复述完成的工作并给出可核对证据'],
|
|
393
420
|
risk: truncate(String(raw.risk ?? '需求变更后新增,原计划未覆盖'), 1000),
|
|
421
|
+
// [2.2.0][T13b/推理等级] 只登记字段名:显式档位经 replanFieldError 五档白名单
|
|
422
|
+
// 校验后原样透传(low / medium / high / xhigh / max);缺失时本行不经
|
|
423
|
+
// readSubtasks,由派发期 runtime 回落 DEFAULT_REASONING_EFFORT(high)。
|
|
424
|
+
...(typeof raw.reasoningEffort === 'string' ? { reasoningEffort: raw.reasoningEffort } : {}),
|
|
394
425
|
insertedBy: 'replan',
|
|
395
426
|
replannedReason: truncate(String(raw.reason ?? reason), MAX_REPLAN_REASON_CHARS),
|
|
396
427
|
};
|