feat(tasks): review sourced requirements against current original evidence

This commit is contained in:
Agent Workbench Dev
2026-11-04 10:36:50 +08:00
parent ce3afb2f0d
commit 785dd0c54d
70 changed files with 6103 additions and 7 deletions
+14 -1
View File
@@ -377,7 +377,7 @@ return async (request, response) => {
}
}
if (method === 'POST' && workerForProject(store, session.projectId)
&& /^(?:mcp|engines|research|workspaces|delivery|browser|browsing|preview|task-plans|task-proofs|file-results|task-checkpoints|collaborations|evaluations)(?:\/|-|$)/.test(action)) throw workerConflict('受限子任务只开放原目标的读取、范围内改动和已审批检查;此操作请返回父项目。');
&& /^(?:mcp|engines|research|workspaces|delivery|browser|browsing|preview|task-plans|task-proofs|requirements|requirement-proofs|file-results|task-checkpoints|collaborations|evaluations)(?:\/|-|$)/.test(action)) throw workerConflict('受限子任务只开放原目标的读取、范围内改动和已审批检查;此操作请返回父项目。');
if (method === 'GET' && action === 'evaluations') return json(response,runtime.evaluationManager().view(session));
if (method === 'POST' && action === 'evaluations') {
const batch=await runtime.evaluationManager().plan(session,await body(request));
@@ -518,6 +518,19 @@ return async (request, response) => {
if (session.taskId !== taskId || session.runId !== runId) throw Object.assign(new Error('核对期间任务已变化,请刷新当前计划。'), { status: 409 });
return json(response, plan);
}
if (method === 'GET' && action === 'requirements') {
if (url.searchParams.get('taskId') !== session.taskId) throw Object.assign(new Error('所选任务已变化,请刷新要求与证据。'), { status: 409 });
return json(response, await runtime.requirementReview().inspect(session, { candidates: true }));
}
if (method === 'POST' && ['requirements', 'requirement-proofs'].includes(action)) {
const { taskId, runId, ...input } = await body(request);
if (!taskId || !runId || taskId !== session.taskId || runId !== session.runId) throw Object.assign(new Error('原任务或运行已变化,未修改其他任务要求。'), { status: 409 });
const manager = runtime.requirementReview();
const result = action === 'requirements' ? await manager.save(session, input) : await manager.verify(session, input);
const requirements = await manager.inspect(session, { candidates: true });
if (taskId !== session.taskId || runId !== session.runId) throw Object.assign(new Error('保存结果属于原任务,请刷新当前任务。'), { status: 409 });
return json(response, { session: store.publicSession(session), requirements, ...(action === 'requirement-proofs' ? { verification: result } : {}) });
}
if (method === 'GET' && action === 'file-results') return json(response, runtime.fileResults().inspect(session, { path: url.searchParams.get('path') }));
if (method === 'POST' && ['file-results', 'file-results/complete'].includes(action)) {
const { taskId, runId, ...input } = await body(request);