heap-weak-update.ts 859 B

123456789101112131415
  1. // for...of pushing ask results into an outer array (a weak heap update), the array
  2. // then feeding the return. The loop reaches an ask, so it promotes to a fan-out
  3. // node; the element binding carries the fan-out label (additive: it also still
  4. // carries paths' world-read label). Expected:
  5. // source -> world-read#1, world-read#1 -> fan-out#1 (paths drive the loop)
  6. // fan-out#1 -> ask#1, world-read#1 -> ask#1 (element into the ask; additive)
  7. // ask#1 -> sink (only ask results are collected,
  8. // so fan-out does not reach the sink)
  9. const paths = await files.glob("src/**/*.ts");
  10. const results: string[] = [];
  11. for (const p of paths) {
  12. const r = await agent("worker").ask<string>(`process ${p}`);
  13. results.push(r);
  14. }
  15. return results.join("\n");