order-stored-promise-late-await.ts 608 B

12345678910
  1. // A promise stored in a variable and awaited much later. Phase 1 cannot resolve which
  2. // steps settle at `await held`, so the barrier WIDENS over everything in flight and
  3. // the edges it produces into the following step are `maybe` (here: ask#1 -> ask#3).
  4. // Phase 2 (await-site taint sets) resolves it exactly — an intended snapshot change.
  5. const slow = agent("slow");
  6. const held = slow.ask<string>("slow one");
  7. const quick = await agent("quick").ask<string>("quick one");
  8. const later = await held;
  9. const summary = await agent("summarizer").ask<string>("wrap up");
  10. return `${quick} ${later} ${summary}`;