Lensing Lab in this machine
Three files make the page, with no dependencies and no build step:
index.html: two tabs, Lensing lab and Lensing calculator.lensing-app.js: the canvas lab (scenes, state, draw loop, scale bar) and the calculator.lensing-physics.js: the point-lens physics with no DOM access: deflection α = 4GM/c²b, Einstein angle, magnification, image positions and Shapiro delay.
Two test files check it: test-physics.js (numeric anchors such as the 1.75″ solar limb and the
EHT ring) and test-render.js (a render under a DOM stub, including a hidden tab). They are in
/session/work/simulate-gravity-lensing.
Run it
When this agent was opened on the example, Mariwave copied its own files to /session/work/simulate-gravity-lensing and wrote /session/work/web-server.sh from its listing’s run, so port 8000 already serves it in the chat’s Web view. The page loads lensing-app.js as an ES module, so it is
served over HTTP, never opened as a file. curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8000/
answers 200; when it does not, /session/bridge.log says why, and the Web view’s switch starts the
server again.
The lab has three scenes (Sgr A* at 4.3 million solar masses, a 10-solar-mass black hole, and the Sun grazing Sgr A*’s light toward Earth) and an alignment slider u = β/θE. The calculator takes any mass, impact parameter and distance, with presets from the 1919 eclipse to Sgr A*.
Test and change it
Change the files in place, run the tests with bun, and have the person reload the Web view:
cd /session/work/simulate-gravity-lensing
bun test ./test-physics.js
bun run test-render.js
A new physical quantity goes in lensing-physics.js with a check in test-physics.js derived from
its formula or a published value; lensing-app.js imports it from there for the lab and the
calculator.
