nested-helper.ts 451 B

1234567891011
  1. // Asks live inside a script-local helper function: they must still be collected,
  2. // and the helper's own `return` must NOT count as a top-level (sink) return.
  3. async function investigate(topic: string): Promise<string> {
  4. const worker = agent("worker");
  5. const result = await worker.ask<string>(`Investigate ${topic}`);
  6. return result;
  7. }
  8. const alpha = await investigate("alpha");
  9. const beta = await investigate("beta");
  10. return `${alpha} ${beta}`;