alias-write.ts 553 B

12345678910
  1. // Aliasing store (heap fix): `alias` and `box` are the SAME object, so a write through
  2. // the alias is visible through the original. `alias.f = secret` mutates box.f; the
  3. // reader ask then interpolates box.f. Bindings alias, they never snapshot.
  4. // Expected: source -> ask#1, ask#1 -> ask#2 (secret through the shared field), ask#2 -> sink.
  5. const box: { f: string } = { f: "" };
  6. const alias = box;
  7. const secret = await agent("writer").ask<string>("secret");
  8. alias.f = secret;
  9. const out = await agent("reader").ask<string>(`use ${box.f}`);
  10. return out;