hole-filled-no-phases.ts 674 B

12345678910111213
  1. // A filled hole without markers: the hole's own phase holds the fill's ask (`<hole id>/ask#1`),
  2. // named after the hole and standing between the two outer phases; the body's `return` is a
  3. // return from the hole, not a top-level return. The hole id is the key of its name.
  4. interface Verdict {
  5. pass: boolean;
  6. }
  7. phase("审阅");
  8. const findings = await agent("审阅者").ask<string>("审阅改动");
  9. const verdict = await hole<Verdict>("评判", `审阅结果:${findings}`, async () => {
  10. return await agent("裁判").ask<Verdict>(`据此裁定:${findings}`);
  11. });
  12. phase("收尾");
  13. return agent("记录员").ask<string>(`记录 ${verdict.pass ? "通过" : "退回"}`);