callback-named-map-phased.ts 647 B

1234567891011
  1. // Callback invocation family: a NAMED callback to `.map` inside a phase. The value-based
  2. // candidate applies `review` per element, so its ask sits in phase#1's `fanout` region as an
  3. // inlined `call`, carries `within=fan-out#1`, and the summarizer in phase#2 comes after it —
  4. // not before it, which is what the old end-of-walk sweep claimed.
  5. phase("scan");
  6. const paths = await files.glob("src/**/*.ts");
  7. const review = (p: string) => agent("reviewer").ask<string>(`review ${p}`);
  8. const out = await Promise.all(paths.map(review));
  9. phase("report");
  10. const s = await agent("summarizer").ask<string>(`summarize ${JSON.stringify(out)}`);
  11. return s;