conditional-receiver-may-set.ts 528 B

12345678910
  1. // Conditional receiver: `(flag ? a : b).ask(...)` — the receiver resolves to a MAY
  2. // set {actor#1, actor#2}. The ask carries actors=actor#1,actor#2, so in the actor
  3. // projection the seed asks feed both candidates inexactly and the shared-actor `a`
  4. // produces a self-edge (a asked at both the seed site and the routed site).
  5. const a = agent("alpha");
  6. const b = agent("beta");
  7. const seed = await a.ask<string>("seed");
  8. const flag = seed.length > 3;
  9. const out = await (flag ? a : b).ask<string>(`route ${seed}`);
  10. return out;