functions-summaries-spread-actuals.ts 602 B

12345678910111213
  1. // Spread actual over a tracked tuple: f(...pair) runs f("clean", secret) — b IS
  2. // secret at runtime and flows into ask#2. The analyzer evaluates the spread as ONE
  3. // actual at index 0 (collapsed pair), so param b's placeholder (index 1) resolves
  4. // to nothing — probing positional resolution of spread actuals.
  5. const judge = agent("judge");
  6. const secret = await agent("s").ask<string>("make secret");
  7. function f(a: string, b: string): Node<string> {
  8. log(a);
  9. return judge.ask<string>(`judge ${b}`);
  10. }
  11. const pair: [string, string] = ["clean", secret];
  12. const out = await f(...pair);
  13. return out;