heap-aliasing-ternary-condition-ask.ts 525 B

1234567
  1. // The CONDITION of a ternary is a real expression: the judge ask inside it reads
  2. // `topic` (ask#1's output) at runtime, on every execution.
  3. // Expected: ask#1 -> ask#2 data (topic into judge's instructions); ask#2's actor
  4. // set = actor#2 (judge); ask#3 gets its instructions from a literal-only ternary.
  5. const topic = await agent("scout").ask<string>("pick a topic");
  6. const mode = (await agent("judge").ask<string>(`judge ${topic}`)) === "hot" ? "hot" : "cold";
  7. return agent("writer").ask<string>(`write a ${mode} take`);