Files
my-pi/pi-chrome/README.md
T
云服务部-叶林立andDevin <158243242+devin-ai-integration[bot]@users.noreply.github.com> 56cbc83296 refactor: 移除 context-mode,Chrome 快照改为直接返回
context-mode 的 ctx_execute 系工具以真实 shell 执行且权限为 allow,绕过了
bash 策略与 protectedWrites;其每轮注入、独立 MCP 子进程与 skills 也与组合包
提示词单一所有权冲突。大输出职责已由 pi-overflow(入口截断)与
pi-compaction(压力遮蔽)承担:
- 删除 context-mode 依赖、wrapper/过滤器、skills,以及 ctx_* 的权限、
  tools.jsonc、路由规则、tool-search 常驻与 4 个分组
- better-sqlite3@12 仅为 context-mode 传递依赖,随之移除根 allowScripts
- pi-chrome:按用户决定移除快照隐私规则与 .pi/chrome-context 临时文件机制,
  快照 JSON 直接作为工具结果返回、details 只留小型元数据,超长由 pi-overflow
  截断并用 overflow_query 提取;授权生命周期不变

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-21 20:45:33 -07:00

5.0 KiB

pi-chrome

Let Pi use your existing signed-in Chrome profile after explicit authorization.

MIT · 0 runtime deps · loopback-only bridge (127.0.0.1:17318) · inspectable unpacked Chrome extension. Review extensions/chrome-profile-bridge/browser-extension/ before loading. Verify setup with /chrome doctor.

You:    "Find my open GitHub PR tab, summarize review state, and screenshot failing CI."
Agent:  chrome_tab(list) → chrome_snapshot(...) → overflow_query(jsonPath) → chrome_screenshot(...)
        ✓ 3 reviewers, 1 change requested, CI red on iOS. Saved → .pi/chrome-screenshots/ci.png
You:    [keeps coding — agent never asked you to log in]

pi-chrome runs through a small Chrome extension inside the Chrome profile you already use — including sites where you're already signed in. Agents can inspect or control Chrome only after you run /chrome authorize in current Pi session.


Install

pi install npm:pi-chrome

In Pi:

/chrome onboard

This opens chrome://extensions and copies bundled extension path. In Chrome Extensions:

  1. Turn on Developer mode.
  2. Click Load unpacked.
  3. Open path field with Cmd+Shift+G on macOS or Ctrl+L on Windows/Linux.
  4. Paste copied path.
  5. Press Enter.

Reload Pi so installed package loads:

/reload

Check bridge:

/chrome doctor

You should see:

✓ Chrome is connected (...)

Authorize current session:

/chrome authorize
/chrome doctor

Second doctor run should show all checks passing.


What it can do

  • Read and summarize pages you're already signed into.
  • Click, type, fill forms, scroll, drag, tap, and upload files.
  • Capture screenshots for bugs, PRs, and demos.
  • Inspect console logs and captured fetch/XMLHttpRequest responses.
  • Manage tabs without taking over your active window.

Tool parameters and gotchas are documented inline in Pi.

Snapshots and pi-overflow

In this maintained build, chrome_snapshot and actions with includeSnapshot=true return the full structured page snapshot as JSON directly in the tool result. chrome_find returns only up to 20 compact ranked matches.

Large snapshots are bounded by the bundle's pi-overflow extension: the result keeps a bounded view and the full original is stored, marked with [pi-overflow id=…]. Extract the uids, text, or state you need with overflow_query — a jsonPath such as elements[0].uid or summary.focused, or a regex search — instead of taking another snapshot. Any page interaction makes earlier snapshots stale, so take a fresh one (or pass includeSnapshot=true on the action) when the page has changed.


Safety model

Chrome control is locked by default. Authorize per Pi session:

/chrome authorize          # 15 minutes
/chrome authorize 30m      # custom duration
/chrome authorize indefinite
/chrome revoke             # lock again
/chrome status

Safety properties:

  • Extension runs in your real Chrome profile and has broad tab/scripting permissions. Install only from trusted package source.
  • Pi side binds to 127.0.0.1:17318 only; no default network exposure.
  • Bridge rejects browser-origin command requests, so ordinary web pages cannot drive it through CORS.
  • Each Pi session gets its own automation target; user tabs/windows are not closed by cleanup.
  • /chrome revoke closes only calling session's automation target.

Security details: SECURITY.md. Architecture details: docs/ARCHITECTURE.md.


Commands

/chrome onboard             # guided setup
/chrome doctor              # connectivity + version + eval checks
/chrome status              # connection + auth + background state
/chrome authorize [duration]
/chrome revoke
/chrome background on       # default: don't steal focus
/chrome background off      # foreground/watch mode
/chrome background status

If loaded extension is older than installed pi-chrome, /chrome doctor tells you to reload it from chrome://extensions.


Limits

pi-chrome works best on web-page workflows exposed through DOM, screenshots, tabs, network, console, and Chrome input. It is not full OS automation.

Current limits include native Chrome/OS surfaces, print/save dialogs, permission bubbles, password-manager prompts, cross-origin iframe DOM access, CAPTCHA/bot challenges, passkeys/security keys/biometrics, rich multitouch/pinch/stylus gestures, and arbitrary desktop apps.

For strict-CSP pages, use screenshots + coordinate input when snapshot/evaluate paths are blocked.


Docs


License

MIT. See LICENSE.