refactor: establish Brain-centered architecture and frontend/backend separation foundations
Related Issue
Closes #
Description
This PR delivers the current Brain + Web separation milestone.
It continues the ongoing refactor toward a Brain-centered architecture, where runtime capabilities are determined by the Brain environment rather than by client type. The goal of this phase is to preserve the existing Desktop experience while making Web + Local Brain a supported path built on shared, Brain-facing abstractions instead of Electron-specific assumptions.
Within that scope, this PR has three primary outcomes:
- it strengthens the Brain-side architecture around routing, session handling, Hands resolution, capability detection, and resource abstraction
- it advances frontend separation so shared web/desktop flows use Host and Brain-facing paths instead of depending directly on Electron-only globals
- it folds several high-impact regressions discovered during the refactor back into the new architecture, so the milestone improves behavior without adding more legacy branching
Concretely, this PR moves the codebase further toward the target architecture described in the refactor work:
- Brain capabilities are determined by deployment environment, not by client channel
- shared frontend code should not depend directly on Electron-only globals
- browser, file, and session flows should be routed through Brain / Hands abstractions
- Desktop remains backward compatible while Web gains first-class support
Notable user-facing improvements included in this PR:
- web login now returns users to the web app instead of redirecting into an Electron-only flow
Browser > CDP Browser Connectionnow works indev:webby using Brain APIs in web mode- browser connection handling is normalized around endpoint-based state, keeping Local Brain as the default behavior today while preparing the path for future Hands-based browser resource expansion
- task execution now reuses an existing connected CDP endpoint instead of resetting browser state unnecessarily
- Agent Folder rendering now handles duplicate filenames correctly when multiple tasks generate files with the same name
This PR should be reviewed as a refactor milestone rather than as a collection of isolated bug fixes. The fixes included here are intentionally integrated into the Brain/Web separation work so the resulting behavior stays aligned with the target architecture.
Out of scope for this PR:
- making RemoteHands the default runtime path
- changing the default Local Brain deployment model
- completing future cluster / worker orchestration beyond the extension points needed for this refactor phase
Testing Evidence (REQUIRED)
- [ ] I have included human-verified testing evidence in this PR.
- [ ] This PR includes frontend/UI changes, and I attached screenshot(s) or screen recording(s).
- [ ] No frontend/UI changes in this PR.
What is the purpose of this pull request?
- [ ] Bug fix
- [x] New Feature
- [ ] Documentation update
- [x] Other
Contribution Guidelines Acknowledgement
- [x] I have read and agree to the Eigent Contribution Guideline
Thanks all for the detailed review. @bytecii @a7m-1st I addressed the actionable, low-risk items in this PR:
- Fixed file link generation for Windows-style separators (
\) by normalizing relative paths to POSIX style before URL encoding, so/files/streamlinks open/render correctly. - Changed
workspace_rootinBrainCapabilitiestoPath(instead ofstr) to reduce downstream path-resolution risk. - Removed an unused constant in
sandbox_hands.py. - Updated logger initialization in
hands_resolver.pytologging.getLogger(__name__).
For broader architecture suggestions (enum refactor, larger file-transfer redesign, filesystem caching/perf strategy, and env-scoping redesign for multi-tenant server mode), I suggest handling them in follow-up PRs to keep this refactor PR focused and reviewable.