emission-graph-computed-elem-read-ask.ts 821 B

12345678910
  1. // A facade ask in the KEY position of an element-access READ (`o[<ask>]`). Runtime: ask#1's
  2. // output (s) is interpolated into ask#2's instructions (the key expression), so ask#1 -> ask#2
  3. // is a required may-flow edge and ask#2 runs on the "picker" lane. The read RESULT does NOT
  4. // carry the key's taint (the value stored at a key does not textually contain the key — the
  5. // same convention as a ternary condition), so ask#3 reads a literal-only value. If the
  6. // evaluator skips the key expression, ask#2 loses its instruction/receiver sinks entirely.
  7. const s = await agent("keeper").ask<string>("secret");
  8. const table: Record<string, string> = { a: "alpha", b: "beta" };
  9. const picked = table[await agent("picker").ask<string>(`pick a key using ${s}`)];
  10. return agent("final").ask<string>(`use ${picked ?? "none"}`);