control-flow-optional-calls.ts 373 B

1234567
  1. // Optional calls on facade functions: `planner.ask?.()`, `planner?.ask()`,
  2. // `files.read?.()` are still direct calls at runtime — they must be sited and flow.
  3. const planner = agent("planner");
  4. const a = await planner.ask?.("collect paths");
  5. const b = await planner?.ask(`pick one of ${a}`);
  6. const text = await files.read?.(b);
  7. return agent("act").ask(`done: ${text}`);