Xuehao Xu 169002a4c9
feat(workflows): add Phase 2 approvals, immutable artifacts and configuration evidence (#6920)
* feat(workflows): add versioned approvals and run configuration evidence

* docs: trim repeated setup guidance to respect inherited size limit

* docs: leave room in inherited agent guidance

* test(channels): align Buzz capability expectation with upstream registry

* fix(workflows): fence file consumers and preserve review access

* fix(runtime): reuse assembly evidence key at run admission
2026-10-17 09:41:15 +08:00

18 lines
1.6 KiB
JavaScript

// Return complete report text, not mutable file links, for exact-output review.
const evidence = await agent({stepId:'evidence',agentRef:args.complianceAgent,task:{product:args.product,referenceDate:args.referenceDate}});
await humanCheckpoint({stepId:'confirm-evidence',sourceStepId:'evidence',artifactVersion:evidence.artifactVersion});
const findings = await agent({stepId:'ingredients',agentRef:args.ingredientAgent,task:{formula:args.formula,evidence:evidence.output}});
await humanCheckpoint({stepId:'confirm-findings',sourceStepId:'ingredients',artifactVersion:findings.artifactVersion});
let report, feedback;
for (let attempt=0; attempt<2; attempt++) {
report = await agent({stepId:`report-${attempt}`,agentRef:args.reportAgent,task:{instruction:'Return the complete report as Markdown in the output, not a file link.',evidence:evidence.output,findings:findings.output,previous:report?.output??null,feedback:feedback??null}});
const review = await agent({stepId:`review-${attempt}`,agentRef:args.reviewerAgent,task:{report:report.output,instruction:'Return JSON with verdict ready or needs_revision and reasons.'}});
if(review.output?.verdict==='ready') {
await humanCheckpoint({stepId:'confirm-final-report',sourceStepId:`report-${attempt}`,artifactVersion:report.artifactVersion});
return {status:'human_confirmed_report',report:report.output,artifactVersion:report.artifactVersion};
}
if(review.output?.verdict!=='needs_revision')throw Error('Unexpected reviewer verdict');
feedback=review.output;
}
return {status:'revision_required',report:report.output};