Files
my-pi/pi-chrome
云服务部-叶林立andDevin <158243242+devin-ai-integration[bot]@users.noreply.github.com> 2a6bf8c929 feat(pi-overflow): 新增统一的新工具结果展示截断扩展
此前截断分散在多层且互相冲突:Pi bash 保留尾部 50KB,RTK 兜底截断又只留
开头 12000 字符(砍掉报错与完整输出路径),pi-chrome 截开头 30K,web_fetch
各 provider 不一致。新扩展统一负责"新结果给模型看多少":
- capture.ts 最先加载暂存原文,index.ts 最后加载(system-prompt 之前)
- 超过 24K 字符时原文落盘 <agentDir>/my-pi/pi-overflow/(700/600、原子写),
  优先取 bash fullOutputPath 完整文件;模型看到 头 + 中段信号行 + 尾 的有界
  视图,行号基于落盘原文、结尾永远可见
- overflow_query:按 id 正则搜索、行区间、jsonPath 只读查询,id 校验防穿越
- 收编:RTK truncate 默认关闭、删除 pi-chrome truncateText、web_fetch 默认
  每页 20000(上限 100000)、web_search max_results 限定 1–20
- pi-compaction 遮蔽带 details.overflow.id 的结果时在占位符提示 overflow_query
- 登记 tools.jsonc / routing / 权限 allow / tool-search 常驻与分组

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

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

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(...) → ctx_execute_file(capture) → 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.

Session-local snapshots and Context Mode

In this maintained build, chrome_snapshot, chrome_find, and actions with includeSnapshot=true keep the full structured page snapshot out of the normal tool result. They atomically save only the latest capture for each target under:

.pi/chrome-context/<session-hash>/<target-hash>/snapshot.json

The tool returns a workspace-relative path plus bounded metadata. Analyze that path immediately with ctx_execute_file and print only the uids, text, or state needed for the next browser action. Do not use read or cat on the capture, because that would put the raw page back into model context.

Captures are deliberately ephemeral: a successful page interaction invalidates the old target capture, and session shutdown, /chrome revoke, or authorization expiry removes the session files. chrome_find still returns up to 20 compact ranked matches for direct use while storing the full capture privately.


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.