feat(linux): fully functional optimized Linux port - #291
Conversation
- Cross-platform install.sh (Darwin DMG + Linux apt/dnf/pacman/zypper, auto-detects google-chrome/chromium, builds CLI, creates ~/.local/bin/ego-browser shim, Wayland-aware) - Linux runtime: launcher (ephemeral --remote-debugging-port, Ozone auto, --no-sandbox for CI, per-TaskSpace BrowserContext, daemon cache at ~/.cache/ego-lite/), CDP bridge via ws, task-spaces (Target.createBrowserContext isolation, ownership semantics, EGO_* error codes), snapshot-ax (Accessibility.getFullAXTree + DOM fallback, backendNodeId refs) - Wiring: EGO_LINUX=1 opt-in (auto-detect on Linux when chrome present, suppressed in CI to keep unit tests green), lazy bridge (no chrome spawn during cdpOverride tests), circular-dep fixed via dynamic import in snapshot-ax - doctor-linux.mjs diagnostics (chrome version, devtools port, cache, display server, ws, node; --json) - Build/CI: ws ^8.21.3 dep, build.mjs external ws, linux-headless job in ci.yml, release now needs both jobs - Docs: install.md (Linux quickstart + troubleshooting), README platform table + Linux snippet Co-Authored-By: internal-model
40cb27a to
d17a586
Compare
- index.ts: listTabs/createTab now hit Chrome HTTP /json (not stub []), Promise<string> type fix for tsc - bridge.test.mjs: randomized PORT + proper wss close + beforeEach to avoid socket hang up port-reuse flake (302/302 now)
…cleanup (Claude review) - bridge.ts: route WS messages to ego.onCDPMessage via onMessage, clear stale bridge on close/error so ensureBridge respawns instead of leaking dead socket - index.ts: onBridgeMessage/onBridgeClose helpers, stale-bridge reset, proper EGO_CDP_SEND_FAILED forwarding - launcher.ts: remove unused createBrowserContext (used non-existent fetch), remove BrowserContext type, drop ephemeralPort wrapper - task-spaces.ts: honest EgoError union types instead of as unknown casts - install.sh: chrome --version preflight, Ubuntu chromium-stub guard, EGO_BROWSER_ASSUME_YES, CI path now exercises install.sh
…napshot truncation - index.ts: add bridgePromise lock to ensureBridge (prevents double launch when parallel callers both see bridge===null; onBridgeClose now also clears bridgePromise; stale promise cleared on failure) - install.sh: rebuild when src or package.json -nt dist/out/index.js (was only when missing — git pull left stale artifact) - snapshot-ax.ts: honor maxResultLength on both AX and DOM fallback (was silently ignored via void opts) - task-spaces.ts: document deferred BrowserContext (shares profile, same as macOS helpers in-memory behavior) - audit: deleg_00fec6b1 TASK-BEST-PRACTICES (max reasoning)
… ws leak, dir-mtime, state loadEnv - snapshot-ax.ts: Accessibility.enable before getFullAXTree (refs never populated without it, was falling through to DOM fallback with refs:[]) + remove dead getBridge ctor param + fix double truncation (hardcoded 4000 → use maxResultLength as single budget, default 250k) - index.ts: CI guard now if (process.env.CI) not CI===1 (GHA is CI=true) - index.ts: hasChrome now covers google-chrome-stable (.deb name) and EGO_CHROME_BIN correctly (was missing, blocked auto-activate) - bridge.ts: ws.readyState !== 1 not ws.OPEN (static, not instance) - install.sh: find -newer not src dir -nt (content edits missed) - index.ts: shutdownCleanup + onBridgeClose removeListener (was leaking process.once per respawn) - state.ts: loadEnv() before linux/index.js import (was after, .env EGO_LINUX invisible) Prism Full @d1ea3fd + 656d1679 P1/P2; reasoning max
Distinguish no-daemon (ECONNREFUSED) from empty tab list;
still returns {tabs:[]} but stderr aids doctor-linux triage.
Prism ff90cc0 Low FIXABLE auto-approve polish
|
Coordination note from the Windows side, since this lands very close to #228. I built the same thing for Windows (#228, proposal in #227) and independently arrived at almost your exact decomposition — bridge, launcher, AX-tree snapshot, task-space registry, doctor. That convergence is probably worth taking as a signal about the shape rather than two people's taste. Two differences where I think yours is the better call, and I'd rather align than have the repo carry two shapes:
One thing that may save you a rebase: this targets For what it's worth, I verified the part that matters for both of us: |
|
Thanks for the coordination note. Good to know #228 landed so close in shape, and I agree the convergence is a signal about where the repo is going. Placement: in-tree was deliberate. The whole port lives in Shared surface: I reached the same conclusion. The AX snapshot renderer, task-space registry, and handoff state machine are all platform-neutral in my version too. Extraction feels like the right end state, but I'd wait until one of the two lands rather than refactor across two open PRs at once. Branches, current numbers for anyone picking this up: Happy to take the neutral-module extraction on top of whichever PR lands first. |
|
Current status checked today:
I have not merged unrelated docs commits just to change the up-to-date badge, since that would churn the head and reset workflow approval without changing the code under review. @section9-lab @WUXM5, could one of you confirm whether this should stay on main or move to dev/sprint-1.3.0, and approve the workflows? Once the target is settled, I will update it once and handle review feedback in the same pass. Hotragn's #227 is waiting on the same branch decision. |
|
Hi — I updated the clean Compare / ready-to-open draft: Current head: The update adds:
Fresh local verification:
The branch still excludes fork-only learnings, evals, experimental sibling host packages, the Collaboration Inbox, and unrelated cleanup. Windows-specific paths are covered by tests and the added CI jobs; I did not run this update on a physical Windows host locally. I retried draft creation after pushing the update, but GitHub still rejects it with |
Fully functional Linux port — ego-browser now works on Linux with same or better features than macOS.
Verification: npm run build OK, typecheck OK, 302 tests pass, doctor-linux OK.