@bobfrankston/rmfmail 1.2.136 → 1.2.139

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client/app.js CHANGED
@@ -3671,6 +3671,37 @@ onWsEvent((event) => {
3671
3671
  }).catch((e) => console.error("openComposeFromMailto failed:", e?.message || e));
3672
3672
  break;
3673
3673
  }
3674
+ case "debugEval": {
3675
+ // --debug-server /api/eval: the daemon pushes {id, code}; we
3676
+ // evaluate in the live page and answer via debugEvalResult. This
3677
+ // is the "drive the app yourself" hook — lets an agent inspect
3678
+ // the real DOM (elementFromPoint, computed styles, scroll state)
3679
+ // without devtools. Only the daemon can push events on this
3680
+ // channel, and only --debug-server exposes the endpoint.
3681
+ const { id, code } = event;
3682
+ if (!id || typeof code !== "string")
3683
+ break;
3684
+ (async () => {
3685
+ const { debugEvalResult } = await import("./lib/api-client.js");
3686
+ try {
3687
+ const fn = new Function(`return (async () => (${code}))();`);
3688
+ let v = await fn();
3689
+ // DOM nodes / circular structures can't ride JSON — fall
3690
+ // back to their string form rather than failing the call.
3691
+ try {
3692
+ JSON.stringify(v);
3693
+ }
3694
+ catch {
3695
+ v = String(v);
3696
+ }
3697
+ await debugEvalResult(id, v);
3698
+ }
3699
+ catch (e) {
3700
+ await debugEvalResult(id, undefined, e?.message || String(e));
3701
+ }
3702
+ })().catch((e) => console.error(`[debug-eval] reply failed: ${e?.message || e}`));
3703
+ break;
3704
+ }
3674
3705
  case "popoutAction": {
3675
3706
  // Toolbar click inside a NATIVE popout window (msger, spawned by
3676
3707
  // the daemon). That window has no IPC bridge and can't host