callback-then-in-phase.ts 554 B

123456789
  1. // Callback invocation family: a `.then` continuation registered inside a phase. Once-deferred
  2. // per the registry: the body inlines at the call as a skippable `choice > branch > call`
  3. // (it runs iff the receiver fulfils), opened by a LOCAL may-settle of the receiver's step, so
  4. // writer precedes editor; phase membership is phase#2, where the continuation is registered.
  5. phase("draft");
  6. const draft = agent("writer").ask<string>("draft");
  7. phase("edit");
  8. const edited = await draft.then((t) => agent("editor").ask<string>(`edit ${t}`));
  9. return edited;