feat: add reviewed Task Git delivery and verified evidence reports

This commit is contained in:
Agent Workbench Dev
2026-10-29 16:41:03 +08:00
parent 3781591f97
commit 73758985ee
50 changed files with 1964 additions and 69 deletions
+30 -2
View File
@@ -71,7 +71,7 @@ return async (request, response) => {
eventCursor: store.eventCursor, storage: store.storageInfo(), runtimeRoot: appDirectory,
environment: executionEnvironment(),
projects: store.projects, sessions: store.listSessions(), exampleProjectId: exampleProject?.id ?? null,
capabilities: { fileChanges: 'review', commands: 'per-call-approval', recovery: 'durable-tool-results', model: 'chat-completions-compatible', execution: 'task-run-step', events: 'persistent-cursor', artifacts: 'sha256-verified', checks: 'npm-script-jobs', projectInspection: 'bounded-source-and-git' },
capabilities: { fileChanges: 'review', commands: 'per-call-approval', recovery: 'durable-tool-results', model: 'chat-completions-compatible', execution: 'task-run-step', events: 'persistent-cursor', artifacts: 'sha256-verified', checks: 'npm-script-jobs', projectInspection: 'bounded-source-and-git', gitDelivery: 'reviewed-local-snapshot', deliveryReports: 'evidence-json-markdown' },
});
if (method === 'GET' && route === '/api/diagnostics') {
const selected = url.searchParams.get('session');
@@ -103,6 +103,12 @@ return async (request, response) => {
if (method === 'GET' && artifactMatch) {
const artifact = store.owned('artifact', artifactMatch[1], url.searchParams.get('session'));
const text = store.artifactStore.read(artifact), offset = cursorNumber(url.searchParams.get('offset'));
if (url.searchParams.get('download') === '1') {
const extension = artifact.mediaType === 'application/json' ? '.json' : artifact.mediaType === 'text/markdown' ? '.md' : '.txt';
response.writeHead(200, { 'Content-Type': artifact.mediaType + '; charset=utf-8', 'Cache-Control': 'no-store',
'X-Content-Type-Options': 'nosniff', 'Content-Disposition': 'attachment; filename="agent-workbench-' + artifact.kind + '-' + artifact.id + extension + '"' });
response.end(text); return;
}
const limit = Math.min(64000, url.searchParams.has('limit') ? cursorNumber(url.searchParams.get('limit')) : 16000);
return json(response, { ...artifact, content: text.slice(offset, offset + limit), offset, totalCharacters: text.length, truncated: offset + limit < text.length });
}
@@ -130,6 +136,28 @@ return async (request, response) => {
const session = store.session(id);
if (method === 'GET' && !action) return json(response, store.publicSession(session));
if (method === 'GET' && action === 'execution') return json(response, store.executionSnapshot(session));
if (method === 'POST' && action === 'delivery-plans') {
const input = await body(request);
await runtime.gitDelivery().plan(session, input);
return json(response, store.publicSession(session), 201);
}
if (method === 'POST' && action === 'delivery-jobs') {
const input = await body(request);
await runtime.gitDelivery().start(session, input.planId);
return json(response, store.publicSession(session), 202);
}
const deliveryJob = action.match(/^delivery-jobs\/([a-f0-9-]+)(?:\/(stop|reconcile))?$/);
if (deliveryJob && method === 'GET' && !deliveryJob[2]) return json(response, store.owned('delivery_job', deliveryJob[1], id));
if (deliveryJob && method === 'POST' && deliveryJob[2]) {
await body(request);
if (deliveryJob[2] === 'stop') await runtime.gitDelivery().stop(id, deliveryJob[1]);
else await runtime.gitDelivery().reconcile(session, deliveryJob[1]);
return json(response, store.publicSession(session));
}
if (method === 'POST' && action === 'delivery-reports') {
await body(request); await runtime.gitDelivery().report(session);
return json(response, store.publicSession(session), 201);
}
if (method === 'POST' && action === 'check-plans') {
const input = await body(request);
if (runtime.isActive(id)) throw Object.assign(new Error('任务或检查正在执行,请等待结束后再准备检查。'), { status: 409 });
@@ -201,7 +229,7 @@ return async (request, response) => {
}
if (method === 'POST' && action === 'proposals') {
const input = await body(request);
if (runtime.checks?.projectActive(session.projectId)) throw Object.assign(new Error('工程检查正在执行,请等待结束后再编辑文件。'), { status: 409 });
if (runtime.checks?.projectActive(session.projectId) || runtime.deliveries?.projectActive(session.projectId)) throw Object.assign(new Error('工程检查或Git交付正在执行,请等待结束后再编辑文件。'), { status: 409 });
proposeFile(store, session, input);
return json(response, store.publicSession(session), 201);
}