Architecture
The code is split into small modules on purpose.
That is partly for code health, but mostly because this package gets worse fast if search, fetch, browser rendering, and research orchestration all blur together.
Main boundaries
src/extension.tswires the package into Pisrc/tools/contains thin Pi-facing tool adapterssrc/search/holds search backend logicsrc/fetch/handles HTTP and headless fetch logicsrc/extract/handles readable-content extractionsrc/orchestration/handles bounded research flowsrc/cache/holds small cache helperssrc/types.tsdefines shared contracts
Why the split exists
web_search should stay about discovery.
web_fetch should stay about plain HTTP reads.
web_fetch_headless should stay explicit.
web_explore should stay the higher-level research path.
Once those responsibilities start leaking into each other, the package becomes harder to reason about and easier to lie with by accident.
Keeping the boundaries explicit makes failures easier to understand and makes it easier to change one part without quietly changing the meaning of another.