flatmap-inline-two-asks.ts 419 B

12345678910
  1. // flatMap with an inline callback returning an array literal of two asks per element.
  2. // Both asks are placed within=fan-out#1, both receive the element, and both flow to
  3. // the join and the sink.
  4. const paths = await files.glob("src/**/*.ts");
  5. const nodes = paths.flatMap((p) => [
  6. agent("a").ask<string>(`summarize ${p}`),
  7. agent("b").ask<string>(`lint ${p}`),
  8. ]);
  9. const out = await Promise.all(nodes);
  10. return out;