// 桥客户端:通过常驻桥执行表达式,避免每次都新开 Chrome 连接 const BRIDGE = 'http://127.0.0.1:65177'; export async function evalViaBridge(expr, { urlMatch = 'baijiahao.baidu.com', save = null } = {}) { const r = await fetch(BRIDGE + '/eval', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ expr, urlMatch, save }), }); const j = await r.json(); if (!j.ok) throw new Error(j.error); return j.value; } export async function health() { const r = await fetch(BRIDGE + '/health'); return r.json(); }