feat: add reviewed Task Git delivery and verified evidence reports
This commit is contained in:
+25
-1
@@ -86,7 +86,16 @@ export class Store extends EventEmitter {
|
||||
}
|
||||
|
||||
ensureStorage(options = {}) {
|
||||
if (this.storage?.database) return;
|
||||
if (this.storage?.database) {
|
||||
const missing = CORE_KINDS.filter(kind => !this.core?.[kind]);
|
||||
if (missing.length) {
|
||||
const next = { ...this.core };
|
||||
for (const kind of missing) next[kind] = new Map();
|
||||
for (const record of this.storage.load().records) if (missing.includes(record.kind)) next[record.kind].set(record.value.id, record.value);
|
||||
this.core = next;
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.core = Object.fromEntries(CORE_KINDS.map(kind => [kind, new Map()]));
|
||||
this.persistedSessions = new Map();
|
||||
this.artifactStore = new ArtifactStore(this.directory);
|
||||
@@ -182,6 +191,17 @@ export class Store extends EventEmitter {
|
||||
if (task) task.verification = { status: job.status, checkJobId: job.id };
|
||||
changed = true;
|
||||
}
|
||||
for (const job of this.core.delivery_job.values()) if (job.sessionId === session.id && ['queued', 'preparing', 'prepared', 'publishing', 'committed'].includes(job.status)) {
|
||||
job.requiresVerification = !!job.lockPath || !!job.referenceAttempted;
|
||||
job.status = job.requiresVerification ? 'unknown' : 'interrupted'; job.finishedAt = now();
|
||||
job.summary = job.requiresVerification ? '提交进程中断,先核对实际Git结果和本次索引锁;不会重放提交。' : '提交尚未进入执行,恢复不会自动运行。';
|
||||
changed = true;
|
||||
}
|
||||
for (const job of this.core.delivery_job.values()) if (job.sessionId === session.id && job.status === 'reporting') {
|
||||
job.status = 'completed'; job.requiresVerification = false; job.finishedAt = now();
|
||||
job.reportError = 'Git提交和索引已经核对,进程在报告生成前退出;可以重新生成报告。';
|
||||
changed = true;
|
||||
}
|
||||
for (const event of session.events ?? []) {
|
||||
if (['running', 'waiting', 'retrying'].includes(event.phase)) {
|
||||
const invocation = [...this.core.tool.values()].find(item => item.sessionId === session.id && item.callId === event.toolCallId);
|
||||
@@ -445,6 +465,10 @@ export class Store extends EventEmitter {
|
||||
requiresVerification: tools.filter(value => value.requiresVerification).map(value => ({ id: value.id, tool: value.tool, callId: value.callId, state: value.state })) },
|
||||
artifacts, checks: jobs,
|
||||
plans: [...this.core.check_plan.values()].filter(value => value.sessionId === session.id && value.taskId === task?.id).slice(-5),
|
||||
deliveries: [...this.core.delivery_job.values()].filter(value => value.sessionId === session.id && (value.taskId === task?.id || value.requiresVerification)).slice(-10),
|
||||
deliveryPlans: [...this.core.delivery_plan.values()].filter(value => value.sessionId === session.id && value.taskId === task?.id).slice(-3).map(({ snapshot, ...value }) => ({
|
||||
...value, baseline: { head: snapshot.head, branch: snapshot.branch, reference: snapshot.reference },
|
||||
})),
|
||||
accountedTaskTokens: accountedTokens(task?.usage),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user