dsh-workplan 2.0.4 → 2.1.1
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 +98 -0
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/docs/cc/AGD-OPS-SECURE-OPERATION.md +3 -1
- package/docs/release-record-2.1.0-20261106.md +95 -0
- package/lib/comm-format.js +184 -0
- package/lib/host.js +1 -1
- package/lib/plan.js +268 -12
- package/lib/runtime.js +70 -3
- package/package.json +1 -1
- package/src/comm-format.ts +215 -0
- package/src/host.ts +1 -1
- package/src/plan.ts +269 -12
- package/src/runtime.ts +69 -3
package/src/runtime.ts
CHANGED
|
@@ -971,7 +971,13 @@ function settleFromOutput(record: any, subtask: any, output: any, guard: Subtask
|
|
|
971
971
|
? { closure: 'done', blockedKind: null }
|
|
972
972
|
: {
|
|
973
973
|
closure: 'blocked',
|
|
974
|
-
|
|
974
|
+
/*
|
|
975
|
+
* [2.1.0] 沟通交流格式退回是独立的受阻类型:工作本身可能已完成,
|
|
976
|
+
* 只是结果格式不合规,须退回重交。看板与主 Agent 据此区分
|
|
977
|
+
* 「做错了」与「交错了」;退回通知(不合规条目清单)已在
|
|
978
|
+
* error 字段里,由 adjudicateResult 写入。
|
|
979
|
+
*/
|
|
980
|
+
blockedKind: verdict.blockedKind === 'comm-format' ? 'comm-format' : 'failed',
|
|
975
981
|
}),
|
|
976
982
|
}, guard)
|
|
977
983
|
if (verdict.status === 'blocked') {
|
|
@@ -1039,6 +1045,40 @@ async function executeSubtask(ctx: any, record: any, stage: any, subtask: any, o
|
|
|
1039
1045
|
? options.attemptOffset
|
|
1040
1046
|
: 1
|
|
1041
1047
|
let lastFailure: any = options.priorFailure ?? null
|
|
1048
|
+
/*
|
|
1049
|
+
* [2.1.0] 格式退回通知必须在下一次激活送达部门人员(用户 2026-11-06 的
|
|
1050
|
+
* 强制要求:不符合要求立刻退回,通知其重新检查格式后重交)。
|
|
1051
|
+
*
|
|
1052
|
+
* 结果被 `adjudicateResult` 判为 blocked/comm-format 后,退回通知(不合规
|
|
1053
|
+
* 条目清单)落在状态行 error 里;主 Agent 把该行复位为 in_progress 后
|
|
1054
|
+
* blockedKind 保留(只有 settle 的 assigned/done 写入才会清它)。这里据此
|
|
1055
|
+
* 把退回通知作为 COMM_FORMAT_REJECTED 的上次失败原因带回子提示词,部门
|
|
1056
|
+
* 人员重跑时能看到「退回原因 + 逐条修正要求」,而不是从零重做、把同一
|
|
1057
|
+
* 格式错误再交一次。
|
|
1058
|
+
*/
|
|
1059
|
+
if (!lastFailure) {
|
|
1060
|
+
const rejectedRow = Array.isArray(record.statuses)
|
|
1061
|
+
? record.statuses.find((item: any) => item?.subtaskId === subtask.id)
|
|
1062
|
+
: null
|
|
1063
|
+
if (rejectedRow?.blockedKind === 'comm-format' && typeof rejectedRow?.error === 'string' && rejectedRow.error.trim() !== '') {
|
|
1064
|
+
lastFailure = {
|
|
1065
|
+
attempt: 1,
|
|
1066
|
+
code: 'COMM_FORMAT_REJECTED',
|
|
1067
|
+
message: rejectedRow.error,
|
|
1068
|
+
}
|
|
1069
|
+
} else if (record.commFormatRejections && typeof record.commFormatRejections === 'object') {
|
|
1070
|
+
/*
|
|
1071
|
+
* [2.1.0] 续跑路径:受阻行已被 `resetBlockedStatuses` 重置,退回原因
|
|
1072
|
+
* 保存在本轮的 `commFormatRejections` 里(见 dispatchPlan 的重置前置抄写)。
|
|
1073
|
+
* 消费一次即删,避免同一条退回通知被后续任意一次重试重复带上。
|
|
1074
|
+
*/
|
|
1075
|
+
const stored = record.commFormatRejections[String(subtask.id)]
|
|
1076
|
+
if (typeof stored === 'string' && stored.trim() !== '') {
|
|
1077
|
+
lastFailure = { attempt: 1, code: 'COMM_FORMAT_REJECTED', message: stored }
|
|
1078
|
+
delete record.commFormatRejections[String(subtask.id)]
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1042
1082
|
/*
|
|
1043
1083
|
* [1.8.6] The interrupt has to outlive the thrown error.
|
|
1044
1084
|
*
|
|
@@ -1116,7 +1156,11 @@ async function executeSubtask(ctx: any, record: any, stage: any, subtask: any, o
|
|
|
1116
1156
|
cwd: options.cwd,
|
|
1117
1157
|
conversationContext,
|
|
1118
1158
|
statuses: record.statuses,
|
|
1119
|
-
|
|
1159
|
+
/*
|
|
1160
|
+
* [2.1.0] 不再用 attempt>1 做门槛:被格式退回的行复位后第 1 次
|
|
1161
|
+
* 激活也必须带上退回通知,否则「退回」只是写了一行状态。
|
|
1162
|
+
*/
|
|
1163
|
+
previousFailure: lastFailure ?? null,
|
|
1120
1164
|
lessonsBrief,
|
|
1121
1165
|
}),
|
|
1122
1166
|
}],
|
|
@@ -1770,7 +1814,29 @@ export async function dispatchPlan(ctx: any, record: any, options: any) {
|
|
|
1770
1814
|
*/
|
|
1771
1815
|
const repairing = record.phase === 'blocked'
|
|
1772
1816
|
if (repairing) record.resumeCount = Number(record.resumeCount ?? 0) + 1
|
|
1817
|
+
/*
|
|
1818
|
+
* [2.1.0] 格式退回通知必须先抄下来,再重置受阻行。
|
|
1819
|
+
*
|
|
1820
|
+
* 用户 2026-11-06 的要求是「不符合要求立刻退回,通知其重新检查格式」。
|
|
1821
|
+
* `resetBlockedStatuses` 会把受阻行清成待跑(blockedKind / error 一并清掉),
|
|
1822
|
+
* 于是 executeSubtask 再也看不到「上一次是格式退回」,退回通知永远送不到
|
|
1823
|
+
* 部门人员——退回就只剩状态行上一个记号。这里在重置前把退回原因按子任务
|
|
1824
|
+
* 抄进本轮记录,由 executeSubtask 消费并随提示词发回;重置后这条信息仍
|
|
1825
|
+
* 生效于下一次激活,消费一次即删,不会污染后续无关重试。
|
|
1826
|
+
*/
|
|
1827
|
+
const rejectedForRedo: Array<[string, string]> = []
|
|
1828
|
+
for (const row of Array.isArray(record.statuses) ? record.statuses : []) {
|
|
1829
|
+
if (row?.blockedKind === 'comm-format' && typeof row?.error === 'string' && row.error.trim() !== '') {
|
|
1830
|
+
rejectedForRedo.push([String(row.subtaskId), row.error])
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1773
1833
|
record.statuses = resetBlockedStatuses(record.statuses)
|
|
1834
|
+
if (rejectedForRedo.length > 0) {
|
|
1835
|
+
record.commFormatRejections = {
|
|
1836
|
+
...(record.commFormatRejections && typeof record.commFormatRejections === 'object' ? record.commFormatRejections : {}),
|
|
1837
|
+
...Object.fromEntries(rejectedForRedo),
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1774
1840
|
// A resume produces a new durable outcome; without clearing this flag the
|
|
1775
1841
|
// second result message was never written and a page refresh replayed the
|
|
1776
1842
|
// stale blocked state.
|
|
@@ -5290,7 +5356,7 @@ export function createWorkplanRuntime(ctx: any, options: WorkplanRuntimeOptions
|
|
|
5290
5356
|
* 不打印正文、非零退出。交互式会话维持原样(只 steer,不抛错)。
|
|
5291
5357
|
*/
|
|
5292
5358
|
/*
|
|
5293
|
-
* [2.0
|
|
5359
|
+
* [2.1.0] U1=B:交互式会话放行,但必须留痕。
|
|
5294
5360
|
*
|
|
5295
5361
|
* 旧行为是 `return` 了事——用户看到回合正常结束,却没有任何地方写着
|
|
5296
5362
|
* 「这个回合其实是没通过门禁被放出来的」。B 方案不动「不硬拦」这个
|