dsh-team-bots 0.2.393 → 0.2.395
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/package.json
CHANGED
|
@@ -387,7 +387,13 @@ export const sessionMethods = {
|
|
|
387
387
|
// ② 任务亲和(DSHBOTS-286/289,ADR §5.2-3):未终态任务按 runs 归属回原会话——含
|
|
388
388
|
// dm_reply 经 sessionTaskFor 解析出的任务(executeRun 已把任务行透传进来)与结转后
|
|
389
389
|
// alias 行上的旧任务流量;终态任务不享亲和,落下方控制面单绑定。
|
|
390
|
-
|
|
390
|
+
// 总监侧运行(review/handle,owner_task 运行族)除外:亲和按 assignee 归属解析,会把
|
|
391
|
+
// 总监的核验/受阻处置运行开进成员任务会话——绑定属成员(ownerContextFor 按绑定行判
|
|
392
|
+
// 身份,总监专权工具 403,与 D-306 治的验收错位同款),且总监话语混进成员任务上下文。
|
|
393
|
+
// 一律落 ③ 总监自己的 (owner,project) 控制面绑定。
|
|
394
|
+
const affinity = (run?.kind === 'review' || run?.kind === 'handle')
|
|
395
|
+
? undefined
|
|
396
|
+
: this.taskAffinityBinding(task)
|
|
391
397
|
if (affinity) {
|
|
392
398
|
const resolved = await this.ctx.sessionController.resolveAgent(affinity.session_id)
|
|
393
399
|
if (!resolved?.error) {
|
|
@@ -15,9 +15,36 @@ export const taskReviewMethods = {
|
|
|
15
15
|
const { project, actor } = this.ownerContextFor(sessionId)
|
|
16
16
|
if (!['accept', 'return'].includes(input.decision)) throw badRequest('验收结果只能是 accept 或 return')
|
|
17
17
|
const task = this.resolveBotTask(project, input.task)
|
|
18
|
+
// 验收机械闸(DSHBOTS-318)只拦真验收动作(in_review 卡):非待验收状态保持既有
|
|
19
|
+
// 校验顺序,仍由 applyReview 抛 in_review conflict,闸不抢跑。
|
|
20
|
+
if (task.status === 'in_review') this.assertReviewSubagentVerified(sessionId, input.comment)
|
|
18
21
|
return this.applyReview(task, project, input.decision, input.comment, actor)
|
|
19
22
|
},
|
|
20
23
|
|
|
24
|
+
// 验收机械闸(DSHBOTS-318):把「验收必须经由子代理」从提示约束升级为机械约束——
|
|
25
|
+
// owner bot 的 team_review_task 前置校验调用方当前活跃运行的子代理账目
|
|
26
|
+
// (run_events 的 subagent_spawned),无账目即拒绝;comment 显式注明「兜底验收」
|
|
27
|
+
// 放行(对应 router 硬流程第 4 条:子代理失败重试一次仍失败时 director 兜底)。
|
|
28
|
+
// 仅机器人路径:微信管理员/看板 owner 走 applyReview,不经过本闸。
|
|
29
|
+
assertReviewSubagentVerified(sessionId, comment) {
|
|
30
|
+
if (comment?.includes('兜底验收')) return
|
|
31
|
+
const run = this.store.get(
|
|
32
|
+
"SELECT id FROM runs WHERE session_id = ? AND status IN ('running', 'queued') ORDER BY queued_at DESC LIMIT 1",
|
|
33
|
+
sessionId,
|
|
34
|
+
)
|
|
35
|
+
const ledger = run && this.store.get(
|
|
36
|
+
"SELECT id FROM run_events WHERE run_id = ? AND type = 'subagent_spawned' LIMIT 1",
|
|
37
|
+
run.id,
|
|
38
|
+
)
|
|
39
|
+
if (ledger) return
|
|
40
|
+
// DSHBOTS-269 失败语义引导:拒绝文案 = 原因 + 正确下一步。
|
|
41
|
+
throw badRequest(
|
|
42
|
+
'当前运行没有子代理账目(subagent_spawned),验收必须先经子代理核验:'
|
|
43
|
+
+ '先派验收子代理(subagent/subagent_fork)做范围比对/目标测试/红线预测,把结论作为 comment;'
|
|
44
|
+
+ '如需 director 兜底,在 comment 里注明「兜底验收」。',
|
|
45
|
+
)
|
|
46
|
+
},
|
|
47
|
+
|
|
21
48
|
/** 验收/退回的共用流程:owner Bot 会话与微信管理员共用。 */
|
|
22
49
|
async applyReview(task, project, decision, comment, actor) {
|
|
23
50
|
const identifier = `${project.key}-${task.number}`
|