Chrome Extension Request Flow
From page capture to agent task delivery, explaining the extension's main flow, state, and design constraints
Chrome Extension Request Flow
The value of the Chrome Extension is not just “one more entry point”. It reduces the distance between seeing content and sending it to an agent.
The core problem it solves
Without the extension, the clumsy path for sending a page to an agent is usually:
- copy page content
- switch back to chat
- paste content
- add a task instruction
The extension removes that context-switch cost.
Main Flow
How the key modules are split
pageMarkdown.ts
Responsibilities:
- extract structured content from the page
- convert it into Markdown
- include title, source URL, capture time, and related metadata
It is not just a raw text copier. It is a best-effort page normalizer.
downcityApi.ts
Responsibilities:
- fetch agent list
- fetch chatKey and context candidates
- dispatch tasks
Key design points:
- prefer
sendBeacon - fall back to
keepalive fetch - do not wait for the final execution result, only ensure the request was sent
extension-popup/App.tsx
Responsibilities:
- organize the shortest sending path
- maintain per-page send history
- choose agent and chatKey
- trigger capture and dispatch
Why the Extension Popup does not wait for the result
Because the Extension Popup is a short-lived UI surface.
If the Extension Popup waits for full task completion, it creates three problems:
- Extension Popup state disappears when it closes
- users wait inside the extension instead of returning to their main workflow
- the extension starts taking on responsibilities that belong to the chat surface
So the current strategy is:
- the extension is responsible for dispatch
- users read results back in the normal chat or context surface
Why Extension Popup and Inline Composer both exist
Popup
Good for:
- explicit agent selection
- explicit task instructions
- viewing page-level send history
Content Script
Good for:
- quick ask on selected text
- near-page interaction in place
They are not duplicates. They remove friction in different situations.
Design constraints contributors should keep
- The extension is responsible for capture and dispatch, not for becoming a second Console UI
- Page capture should stay as structured as possible, not collapse into raw
innerText - The send path should optimize for successful dispatch, not for waiting on final execution
- Console address, agent selection, and chatKey selection should all fail gracefully when disconnected