How muhammadtalha-prog/ia-agent-chrome-extension works
Purpose and Runtime
IA Agent is a Chromium browser extension that migrates an active AI-chat conversation between ChatGPT, Gemini, and Claude. It extracts source-page history, asks DeepSeek to produce a structured handoff summary, then inserts that summary into a target chat editor.
The extension is defined by manifest.json and runs across extension UI pages, a background context, and page-injected content scripts.
User Entry Points
The toolbar popup is the main migration control surface: popup.html, popup.js, and popup.css. Users initiate capture/migration and navigate to settings from this UI.
Configuration is managed separately through options.html and options.js, where the DeepSeek API key, selected model, and system prompt are persisted in Chrome local storage.
Browser Integration Layer
content.js executes in supported AI-chat pages. It is responsible for page-specific DOM interaction: extracting visible user/assistant conversation history from source tabs and finding/focusing a prompt editor on target tabs for summary injection.
This is the principal boundary between extension code and third-party chat UIs; selectors and extraction behavior must tolerate changing ChatGPT, Gemini, and Claude DOM structures.
Orchestration and Messaging
background.js is the extension-level coordinator. It receives work requests from the popup/content contexts, accesses persisted settings, manages tab-level operations, and coordinates the capture → compile → inject sequence.
Control flows cross Chrome extension messaging boundaries rather than sharing in-memory state directly:
1. Popup requests migration.
2. Background identifies source/target tabs and requests extraction through the content script.
3. Background sends captured history to DeepSeek.
4. Background returns or forwards the compiled context for target-page injection.
Context Compilation Service
DeepSeek is the sole external service. background.js calls its completion API using the configured deepseek-chat or deepseek-reasoner model and a configurable system prompt.
The intended output is a migration block covering task, progress, finalized code/snippets, and next steps. API credentials remain browser-local via Chrome storage; requests go directly from the extension to DeepSeek rather than through an application backend.
Persistence and Fallback Behavior
Chrome local storage is the durable boundary for user configuration, notably the API key, model choice, and system prompt, managed by options.js and consumed by background.js.
When no API key is configured, the product supports a simulated mode so the UI and migration workflow can be exercised without a live DeepSeek call.
Auxiliary Validation
test_api.js is an independent Node CLI check for DeepSeek credentials and connectivity. It validates the external API outside the browser-extension runtime and is not part of the installed extension execution path.
Main entry points: background.js Migration Coordinator · manifest.json Extension Manifest · content.js Chat Page Adapter · popup.html Migration Popup
Components 13
Extension UI
- Migration Popup · Starts capture and migration flows.
popup.html - Popup Controller
popup.js - Popup Styles
popup.css - Settings Page · Edits DeepSeek configuration.
options.html - Settings Controller
options.js
Extension Runtime
- Extension Manifest · Declares extension pages, background context, and content scripts.
manifest.json - Migration Coordinator · Coordinates tab operations, messaging, compilation, and injection.
background.js - Chat Page Adapter · Extracts histories and injects summaries through chat-page DOMs.
content.js - Simulated Compilation · Allows migration workflow without a configured API key.
Browser & Chat Pages
- Chrome Local Storage · Persists API key, model, and system prompt locally.
- ChatGPT / Gemini / Claude Tabs · Source conversation and target prompt editor surfaces.
External Service
- DeepSeek Completion API · Compiles captured history into a structured migration block.
- DeepSeek CLI Check · Independently validates DeepSeek credentials and connectivity.
test_api.js
Connections 17
- Extension Manifest → Migration Popup: declares
- Extension Manifest → Settings Page: declares
- Extension Manifest → Migration Coordinator: declares
- Extension Manifest → Chat Page Adapter: injects into
- Migration Popup → Popup Controller: runs
- Popup Styles → Migration Popup: styles
- Settings Page → Settings Controller: runs
- Settings Controller → Chrome Local Storage: saves settings
- Popup Controller → Migration Coordinator: requests migration
- Migration Coordinator → Chrome Local Storage: loads settings
- Migration Coordinator → Chat Page Adapter: requests extract / inject · Chrome extension messaging boundary.
- Chat Page Adapter → ChatGPT / Gemini / Claude Tabs: reads history; writes editor
- Migration Coordinator → DeepSeek Completion API: sends history for compilation · Uses configured model and system prompt.
- DeepSeek Completion API → Migration Coordinator: returns migration block
- Migration Coordinator → Simulated Compilation: falls back without API key
- Simulated Compilation → Chat Page Adapter: supplies simulated context
- DeepSeek CLI Check → DeepSeek Completion API: validates connectivity · Outside installed extension runtime.