emission-graph-computed-key-ask.ts 610 B

12345678
  1. // A facade ask in a COMPUTED PROPERTY NAME position. Runtime: ask#1's output (s) is
  2. // interpolated into ask#2's instructions, and ask#2's output becomes a key of `o`,
  3. // which flows through Object.keys into ask#3's instructions. Required may-flow:
  4. // ask#1 -> ask#2 and ask#2 -> ask#3. If the evaluator skips computed names, ask#2
  5. // loses its instruction/receiver sinks and its output taint never enters `o`.
  6. const s = await agent("keeper").ask<string>("secret");
  7. const o = { [await agent("namer").ask<string>(`name for ${s}`)]: 1 };
  8. return agent("final").ask<string>(`fields ${Object.keys(o).join(",")}`);