heap-aliasing-map-agent-context.ts 517 B

1234567891011
  1. // Actor label through a Map: both asks run on the SAME actor at runtime (the map
  2. // stores and returns the writer), so the asks are context-related.
  3. // Expected: ask#1 actors include actor#1; context edge ask#1 -. ask#2; ask#1 ->
  4. // ask#2 data (`one` in ask#2's instructions); ask#2 -> sink.
  5. const writer = agent("writer");
  6. const m = new Map<string, Agent>();
  7. m.set("w", writer);
  8. const got = m.get("w")!;
  9. const one = await got.ask<string>("draft");
  10. const two = await writer.ask<string>(`review ${one}`);
  11. return two;