hole-open-mid-script.ts 881 B

123456789101112131415161718
  1. // An open hole between two phases (docs/analysis.md, "Sites", Hole sites): a step of kind
  2. // `hole` issued in the phase it stands in, a memberless phase of its own in the control-flow
  3. // phase table (so the rail can draw its station ahead of the run), its prompt a taint sink —
  4. // `survey` flows into it — and its result a value of type Plan from outside the run, in the
  5. // main agent's lane, flowing on into the executor.
  6. interface Survey {
  7. slowest: string;
  8. count: number;
  9. }
  10. interface Plan {
  11. groups: string[][];
  12. }
  13. phase("摸底");
  14. const survey = await agent("勘察员").ask<Survey>("列出最慢的测试文件");
  15. const plan = await hole<Plan>("决定分组", `最慢的是 ${survey.slowest},共 ${survey.count} 个文件;决定怎么分组`);
  16. phase("执行");
  17. const done = await agent("执行者").ask<string>(`按 ${plan.groups.length} 组执行`);
  18. return done;