functions-summaries-fn-through-param.ts 603 B

1234567891011
  1. // A script-local function passed as an argument to another script-local function and
  2. // invoked through the parameter. The fn value must flow through recordCall's param
  3. // binding and dispatch inside run; secret flows caller -> run -> g -> ask.
  4. // Expected: ask#1 -> ask#2 data (exactness either way); ask#2 -> sink data.
  5. const judge = agent("judge");
  6. const secret = await agent("s").ask<string>("secret");
  7. async function run(g: (v: string) => Node<string>, v: string): Promise<string> {
  8. return await g(v);
  9. }
  10. const out = await run((x: string) => judge.ask<string>(`judge ${x}`), secret);
  11. return out;