may-set-branch-form-parity.ts 788 B

1234567891011121314
  1. // The BRANCH form of `may-set-oneshot-ternary`: `cond ? a.ask(p) : b.ask(p)` where that
  2. // fixture writes `(cond ? a : b).ask(p)`. The two are the same program, and refactoring
  3. // invariance is what lane expansion exists to deliver — so they must agree on certainty:
  4. // two `maybe` steps, one per lane, with `maybe` edges into them. This fixture is the guard
  5. // for that parity, and it is what fixes expansion's edge rule to endpoint inheritance
  6. // re-applied rather than a preserved edge certainty.
  7. const fast = agent("fast");
  8. const careful = agent("careful");
  9. const brief = await agent("triage").ask<string>("classify this request");
  10. const answer =
  11. brief.length > 8
  12. ? await careful.ask<string>(`handle ${brief}`)
  13. : await fast.ask<string>(`handle ${brief}`);
  14. return answer;