惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
U
Unit 42
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
J
Java Code Geeks
D
DataBreaches.Net
B
Blog RSS Feed
D
Docker
L
LangChain Blog
aimingoo的专栏
aimingoo的专栏
F
Fortinet All Blogs
Y
Y Combinator Blog
A
About on SuperTechFans
V
V2EX
罗磊的独立博客
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
MongoDB | Blog
MongoDB | Blog
博客园 - 【当耐特】
Last Week in AI
Last Week in AI
S
SegmentFault 最新的问题
月光博客
月光博客
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
阮一峰的网络日志
阮一峰的网络日志

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
How I Built a Chrome Extension That Brings AI to Every Te...
李思敏 · 2026-05-09 · via DEV Community
Cover image for How I Built a Chrome Extension That Brings AI to Every Text Field

李思敏

The Problem: Context Switching Kills Productivity

As a developer, I found myself constantly switching between my browser tabs — writing code in GitHub, drafting emails in Gmail, editing documents in Notion — and copy-pasting every snippet into ChatGPT for help. This context switching wasn't just annoying; it was destroying my flow state.

I'd estimate I was losing 15-20 minutes every single hour just jumping between tabs.

So I built AIType — a free Chrome extension that puts AI directly into every text field on every website. Triple-tap the space bar, and AI is right there.

AIType feature overview

The Tech Stack

  • Framework: WXT — modern Chrome Extension build tool
  • LLM Integration: Custom streaming client supporting both OpenAI-compatible APIs and a free built-in backend
  • Storage: chrome.storage.local for configuration and conversation history
  • Content Script: Injected into all frames, with careful Shadow DOM handling

Key Technical Challenges

1. MV3 Service Worker Lifecycle

Manifest V3 service workers can be terminated after ~30 seconds of inactivity. This was tricky for maintaining long-running streaming connections. The solution was a keepalive ping system.

2. Shadow DOM Handling

Many modern sites (like Reddit, GitHub commit messages) use Shadow DOM for encapsulation. The composedPath() API was key to making triggers work across Shadow DOM boundaries.

3. Streaming Text into Input Fields

Different input types require different approaches:

  • Standard elements: use setRangeText()
  • ContentEditable elements (Notion): use DOM Range API
  • Monaco Editor (VS Code in browser): inject via editor.executeEdits()

AIType in action

4. Port Management Across Frames

With allFrames: true, managing which port belongs to which frame was essential.

The @Directives System

One of the most powerful features is the @directives system. Users can type commands right in their text:

  • @translate @ja — Translate to Japanese
  • @summary @200 — Summarize long text
  • @polish — Make text more professional
  • @expand @300 — Elaborate on a brief idea
  • @qa — Ask questions about the selected text

These are parsed from the input before sending to the LLM, making the whole experience feel like magic.

Zero Setup, 100% Free

No API keys. No account creation. No subscriptions. Just install and go.

Try It Out

If this sounds useful, install it for free from the Chrome Web Store:

https://chromewebstore.google.com/detail/aitype/kiphgjgjeblmjpibmeapmdamgpkjfdjj

Full disclosure: I built this extension. It's completely free with no ads, no tracking, and no subscriptions. Built with TypeScript, WXT, and a lot of coffee.