7 Commits

Author SHA1 Message Date
8ball bf30e64d59 v3.6.8: search extraction polls in-page until organics hydrate (engines serve a redirect shell first on datacenter exits), bing default engine - native web_search returns sources 2026-11-08 23:44:15 +03:30
8ball 7fdd0fc543 v3.6.7: unwrap Bing ck/a and Google url= link wrappers before the own-domain filter, so native web_search returns organic sources 2026-11-08 23:39:00 +03:30
8ball 0cb2daa402 v3.6.6: search extraction parses both nestings (Bing a-in-h2, Google h3-in-a) so native web_search returns sources 2026-11-08 23:35:23 +03:30
8ball cb6c077541 v3.6.5: release marker - native fixes merged upstream, local install rebuilt from main 2026-11-08 23:32:28 +03:30
8ball a2afeff8e0 Merge branch 'native-fixes': Firefox/BiDi protocol fixes, shared UX, portability on top of v3.6.4 (17 fix signatures, conflict resolved keeping both sides) 2026-11-08 23:26:02 +03:30
DeepSeek Harness Agent 0ed41d1f2f native-fixes: rebase browser-engine + shared fixes onto v3.6.4
Re-applies the reviewed fixes on top of upstream v3.6.4 (db71dd9), keeping the
new v3.6.4 logic intact: transparent-proxy rejection (directEgressOf), Edge
startup-boost survivor-proof restartSession (with a Firefox safety guard so
proxy relaunch never taskkills every Firefox window), and deploy-script
hardening.

Contents (unchanged from the previously reviewed branch, only rebased):
- Firefox/WebDriver BiDi: per-code-point typing, named-key table + always keyUp
  (Enter/Delete/PageUp/Escape), newTab create+navigate, readyState polling in
  waitForLoad, explicit session.end on detach, protocol browser.close before
  restart/dispose (no orphan browsers / "Maximum number of active sessions"),
  proxy relaunch + -proxy-server host:port, engine-scoped relaunch (Firefox
  refuses), attach guard for a browser this process already drives.
- Shared: Space key, shadow-DOM click{text}/type{into}, aria-label-first names,
  click{index} re-resolve + scrollIntoView.
- Native portability carried in: asar-aware schemastery loader, home-relative
  probe path, close action no longer leaking its session before Browser.close.
2026-11-08 21:54:19 +03:30
8ball db71dd9999 v3.6.4: reject transparent proxies (echo == own network), Edge startup-boost policy + survivor-proof restart so proxy flags always apply, deploy script hardening - browser-side routing proven at proxy exit 2026-11-08 21:39:11 +03:30
4 changed files with 83 additions and 23 deletions
+2 -1
View File
@@ -63,9 +63,10 @@ Browser discovery is cross-platform — Windows, Linux (apt **and** snap paths,
- **auto** — probes every candidate by fetching an IP echo **through** it (ladder: checkip.amazonaws.com → ifconfig.me → ipinfo.io, so a single rate-limited echo service can't fake a failure), picks the fastest working proxy, restarts the browser onto it, and reports the verified exit IP/country. - **auto** — probes every candidate by fetching an IP echo **through** it (ladder: checkip.amazonaws.com → ifconfig.me → ipinfo.io, so a single rate-limited echo service can't fake a failure), picks the fastest working proxy, restarts the browser onto it, and reports the verified exit IP/country.
- **set** — installs a list verbatim. One hop is handed to the browser directly (`--proxy-server`); two or more are **chained** through an in-kit local CONNECT forwarder (browser → 127.0.0.1 → hop1 → hop2 → … → origin), verified end-to-end before the switch — a rejected chain falls back to the fastest single hop (or errors, in `set`). - **set** — installs a list verbatim. One hop is handed to the browser directly (`--proxy-server`); two or more are **chained** through an in-kit local CONNECT forwarder (browser → 127.0.0.1 → hop1 → hop2 → … → origin), verified end-to-end before the switch — a rejected chain falls back to the fastest single hop (or errors, in `set`).
- **status** — live re-probe of the current route; **clear** — direct traffic again. `chainTo` adds one chained hop behind the auto-pick. - **status** — live re-probe of the current route; **clear** — direct traffic again. `chainTo` adds one chained hop behind the auto-pick. Switching routes force-closes any survivor browser process (Edge startup-boost / profile handoff) before relaunch, so the new proxy state can never be silently lost — logins survive, windows reopen.
- The `proxyChain` setting preloads a chain into every launch; the native web seam (`web_fetch` / `web_search`) rides the same route. - The `proxyChain` setting preloads a chain into every launch; the native web seam (`web_fetch` / `web_search`) rides the same route.
- **Fully built in** — no system/v2ray proxy anywhere in the path: probes use raw sockets, and launched browsers get explicit proxy state (`--proxy-server` when routing; `--no-proxy-server` / `network.proxy.type:0` when direct, with `HTTP(S)_PROXY`/`ALL_PROXY` stripped from the launch environment). A local v2ray can never silently capture the browser. - **Fully built in** — no system/v2ray proxy anywhere in the path: probes use raw sockets, and launched browsers get explicit proxy state (`--proxy-server` when routing; `--no-proxy-server` / `network.proxy.type:0` when direct, with `HTTP(S)_PROXY`/`ALL_PROXY` stripped from the launch environment). A local v2ray can never silently capture the browser.
- A candidate whose echo comes back **with your own egress IP** is rejected as *transparent* — a route that doesn't change your exit is a no-op, not a proxy. `setup.mjs` also disables Edge's startup boost (registry policy) so background Edge processes can't re-grab the debug port with stale, proxy-less flags.
A proxy counts as *working* only when an echo comes back through it — no blind trust in proxy-list sites. A proxy counts as *working* only when an echo comes back through it — no blind trust in proxy-list sites.
+64 -21
View File
@@ -669,12 +669,23 @@ async function echoLadder(hops) {
} }
return null; return null;
} }
let directEgress;
async function directEgressOf() {
// node fetch never reads HTTP_PROXY/v2ray — this is the machine's true exit.
if (directEgress === undefined) {
directEgress = null;
try { const r = await fetch('http://checkip.amazonaws.com/', { signal: AbortSignal.timeout(7000) }); directEgress = (await r.text()).trim().split(/\s/)[0] || null; } catch { /* offline */ }
}
return directEgress;
}
async function probeCandidate(h) { async function probeCandidate(h) {
const t0 = Date.now(); const t0 = Date.now();
const e = await echoLadder([h]); const [e, own] = await Promise.all([echoLadder([h]), directEgressOf()]);
return e if (!e) return { ok: false, reason: 'no echo (dead or blocking)', ms: Date.now() - t0 };
? { ok: true, ip: e.ip, country: e.country, as: e.org, ms: Date.now() - t0 } if (own && (e.ip === own || e.ip.startsWith(own.split('.').slice(0, 2).join('.') + '.'))) {
: { ok: false, reason: 'no echo (dead or blocking)', ms: Date.now() - t0 }; return { ok: false, reason: `transparent (exit ${e.ip} is your own network — routing through it changes nothing)`, ms: Date.now() - t0 };
}
return { ok: true, ip: e.ip, country: e.country, as: e.org, ms: Date.now() - t0 };
} }
const pipeBoth = (a, b) => { const pipeBoth = (a, b) => {
@@ -763,7 +774,7 @@ async function egressVia(hops) {
async function restartSession() { async function restartSession() {
const la = session && session.launchArgs ? session.launchArgs : null; const la = session && session.launchArgs ? session.launchArgs : null;
if (!session || session.attached || !la) return false; if (!session || session.attached || !la) return false;
const { child, ws, engine } = session; const { child, ws, engine, kind } = session;
// Close the browser itself before dropping the socket: for Firefox the spawn // Close the browser itself before dropping the socket: for Firefox the spawn
// handle is only the Windows launcher, so killing it can orphan the browser // handle is only the Windows launcher, so killing it can orphan the browser
// and leave Firefox's single BiDi session registered (the next session.new // and leave Firefox's single BiDi session registered (the next session.new
@@ -773,8 +784,24 @@ async function restartSession() {
session = null; session = null;
try { ws.close(); } catch { /* gone */ } try { ws.close(); } catch { /* gone */ }
if (child && child.exitCode === null) child.kill(); if (child && child.exitCode === null) child.kill();
const t0 = Date.now(); const port = la.port || effectivePort(la);
while (await probePort(la.port || effectivePort(la)) && Date.now() - t0 < 10000) await new Promise((r) => setTimeout(r, 500)); const waitFree = async (ms) => {
const t0 = Date.now();
while (await probePort(port) && Date.now() - t0 < ms) await new Promise((r) => setTimeout(r, 400));
return !(await probePort(port));
};
if (!(await waitFree(6000))) {
// A survivor browser (Edge startup-boost, profile handoff, leftover window)
// retook the port without our new flags — a fresh spawn would merge into it
// and silently lose proxy routing. For Chromium, kill instances of this
// browser kind (same semantics as relaunch:true; logins survive, windows
// reopen). Firefox refuses: taskkill would close every Firefox window.
if (kind === 'firefox') return false;
const exe = kind === 'chrome' ? 'chrome' : 'msedge';
const killCmd = process.platform === 'win32' ? `taskkill /IM ${exe}.exe /F` : `pkill -9 -x ${exe}`;
await new Promise((r) => exec(killCmd, () => r()));
if (!(await waitFree(8000))) return false;
}
await doLaunch(la); await doLaunch(la);
return true; return true;
} }
@@ -1340,27 +1367,43 @@ const FETCH_EXTRACT = `(async () => {
return { url: location.href, status, text: document.body ? document.body.innerText : '' }; return { url: location.href, status, text: document.body ? document.body.innerText : '' };
})()`; })()`;
const SEARCH_EXTRACT = `(() => { const SEARCH_EXTRACT = `(async () => {
const parse = () => {
const clean = (s) => String(s || '').replace(/\\s+/g, ' ').trim(); const clean = (s) => String(s || '').replace(/\\s+/g, ' ').trim();
const out = []; const seen = new Set(); const out = []; const seen = new Set();
// Engine-agnostic organic parse: a result headline is a heading inside a const selfUrl = (u) => /^https?:\\/\\/(?:www\\.)?(?:bing|google|duckduckgo)\\./i.test(u);
// link on Google and Bing alike — layout class names drift, this doesn't. // Organic result headlines come in both directions now: heading inside the
for (const a of document.querySelectorAll('a[href]')) { // link (Google: a > h3) AND link inside the heading (Bing: h2 > a). Match
const heading = a.querySelector('h2, h3'); // both — engine class names drift, the heading/link nesting does not.
if (!heading) continue; for (const node of document.querySelectorAll('h2 a, h3 a, a h2, a h3')) {
let url = a.href; if (out.length >= 20) break;
if (url.startsWith('/url?')) { const m = url.match(/[?&]url=([^&]+)/); if (m) { try { url = decodeURIComponent(m[1]); } catch {} } } const link = node.matches('a') ? node : node.closest('a');
if (!/^https?:/i.test(url) || seen.has(url)) continue; if (!link) continue;
const title = clean(heading.innerText); let url = link.href;
// Engines wrap organic URLs: Google /url?url=..., Bing /ck/a?u=a1<base64>.
// Unwrap first — then apply the own-domain filter, or the wrappers eat
// every real result.
{ const m = url.match(/[?&]u=([^&]+)/); if (m) { let v = m[1]; if (v.startsWith('a1')) v = v.slice(2); try { const d = atob(v.replace(/-/g, '+').replace(/_/g, '/')); if (/^https?:/i.test(d)) url = d; } catch {} } }
{ const m = url.match(/[?&](?:url|q)=([^&]+)/); if (m) { try { const d = decodeURIComponent(m[1]); if (/^https?:/i.test(d)) url = d; } catch {} } }
if (!/^https?:/i.test(url) || seen.has(url) || selfUrl(url)) continue;
const title = clean(link.innerText);
if (!title || title.length < 4) continue; if (!title || title.length < 4) continue;
const box = a.closest('li,div.g,div.tF2Cxc,li.b_algo') || a.parentElement; const box = link.closest('li,div.g,div.tF2Cxc,li.b_algo,div.b_title,div[class*=result]') || link.parentElement;
let snippet = box ? clean(box.innerText) : ''; let snippet = box ? clean(box.innerText) : '';
if (snippet.startsWith(title)) snippet = snippet.slice(title.length).trim(); if (snippet.startsWith(title)) snippet = snippet.slice(title.length).trim();
seen.add(url); seen.add(url);
out.push({ url, title: title.slice(0, 200), ...(snippet ? { snippet: snippet.slice(0, 400) } : {}) }); out.push({ url, title: title.slice(0, 200), ...(snippet ? { snippet: snippet.slice(0, 400) } : {}) });
if (out.length >= 20) break;
} }
return { sources: out, page: { url: location.href, title: clean(document.title) } }; return { sources: out, page: { url: location.href, title: clean(document.title) } };
};
// Engines serving datacenter exits hand back a redirect shell first
// (Bing: &rdr=1&rdrig=…) and hydrate organics after readyState — poll
// in-page until real results exist (max ~6s) instead of parsing the shell.
for (let i = 0; i < 12; i++) {
const r = parse();
if (r.sources.length || i >= 11) return r;
await new Promise((res) => setTimeout(res, 500));
}
})()`; })()`;
const edgeFetchProvider = { const edgeFetchProvider = {
@@ -1382,7 +1425,7 @@ const edgeSearchProvider = {
async search(request, signal) { async search(request, signal) {
const n = Math.min(Math.max(request.maxResults ?? 10, 1), 20); const n = Math.min(Math.max(request.maxResults ?? 10, 1), 20);
const q = encodeURIComponent(request.query); const q = encodeURIComponent(request.query);
const engine = cfgVal('searchEngine', 'google') === 'bing' ? 'bing' : 'google'; const engine = cfgVal('searchEngine', 'bing') === 'google' ? 'google' : 'bing';
const build = (e) => e === 'bing' const build = (e) => e === 'bing'
? `https://www.bing.com/search?q=${q}&count=${Math.min(n * 2, 30)}` ? `https://www.bing.com/search?q=${q}&count=${Math.min(n * 2, 30)}`
: `https://www.google.com/search?q=${q}&num=${Math.min(n * 2, 20)}`; : `https://www.google.com/search?q=${q}&num=${Math.min(n * 2, 20)}`;
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@local/edge-kit-easy", "name": "@local/edge-kit-easy",
"version": "3.6.1", "version": "3.6.8",
"private": true, "private": true,
"type": "module", "type": "module",
"description": "Edge Kit Browser — human-style browsing for agents in Edge, Chrome, or Firefox: see, click, type, video understanding, gameplay; live-attach-first over CDP/BiDi with a native settings page and the native web seam", "description": "Edge Kit Browser — human-style browsing for agents in Edge, Chrome, or Firefox: see, click, type, video understanding, gameplay; live-attach-first over CDP/BiDi with a native settings page and the native web seam",
+16
View File
@@ -10,6 +10,7 @@ import fs from 'node:fs/promises';
import os from 'node:os'; import os from 'node:os';
import net from 'node:net'; import net from 'node:net';
import path from 'node:path'; import path from 'node:path';
import { execSync } from 'node:child_process';
const P = process.platform; const P = process.platform;
const HOME = os.homedir(); const HOME = os.homedir();
@@ -76,6 +77,21 @@ for (const port of [9444, 9445, 9446]) {
else warn(`debug port ${port} busy — a browser already holds it; the kit will attach to it (relaunch:true takes over)`); else warn(`debug port ${port} busy — a browser already holds it; the kit will attach to it (relaunch:true takes over)`);
} }
/* 4b. Edge startup-boost survivor background processes re-spawn with stale
* command lines and silently swallow the kit's proxy flag on relaunch.
* The enterprise policy kills them for good. */
if (P === 'win32') {
try {
execSync('reg query "HKCU\\Software\\Policies\\Microsoft\\Edge" /v StartupBoostEnabled', { stdio: 'pipe' });
ok('Edge startup-boost already governed by policy');
} catch {
try {
execSync('reg add "HKCU\\Software\\Policies\\Microsoft\\Edge" /v StartupBoostEnabled /t REG_DWORD /d 0 /f', { stdio: 'pipe' });
ok('disabled Edge startup boost (policy) — survivor processes can no longer drop proxy flags');
} catch { warn('could not write Edge StartupBoostEnabled policy — restarts may race a background Edge'); }
}
}
/* 5. Direct egress — proves there is an internet path WITHOUT any system/v2ray /* 5. Direct egress — proves there is an internet path WITHOUT any system/v2ray
* proxy (node fetch never reads HTTP_PROXY). Geo-restricted hosts (Iran) * proxy (node fetch never reads HTTP_PROXY). Geo-restricted hosts (Iran)
* often have no open HTTP echo without VPN but can reach proxies directly * often have no open HTTP echo without VPN but can reach proxies directly