map-set.ts 528 B

12345678910
  1. // Library mutator Map.set (heap fix): `m.set(k, secret)` folds secret into the map's
  2. // live value, and `m.get(k)` (an unknown library call) reads the receiver whole, so the
  3. // secret rides out at whole-container granularity into the reader ask.
  4. // Expected: source -> ask#1, ask#1 -> ask#2, ask#2 -> sink.
  5. const m = new Map<string, string>();
  6. const secret = await agent("writer").ask<string>("secret");
  7. m.set("k", secret);
  8. const got = m.get("k") ?? "";
  9. const out = await agent("reader").ask<string>(`use ${got}`);
  10. return out;