What's missing
There's no way to read a page's console messages or network activity. When an agent needs to debug a front-end (not just operate it), this is the main blocker.
Today the only workaround is evaluate to inject JS hooks, which can't cover the common cases:
- Hooks must be injected before events fire — anything logged during initial load is already gone.
- Engine-level errors (failed resource loads / 404, CSP violations, mixed content) never go through
console.*, so JS hooks can't see them.
- No response status —
performance.getEntriesByType('resource') gives URLs + timing, not 404/500.
- Injected state is wiped on navigation.
Proposal
Two read-only commands, same category as snapshot:
bsk console --session <id> # console / log / uncaught-exception lines
bsk network --session <id> # network responses & failures, with status
Possible approach
The extension already attaches chrome.debugger and has an onEvent listener (the dialog handler in chromium-cdp.ts). The same path covers this:
- On attach, also enable
Runtime / Log / Network (best-effort).
- Buffer events per-tab (ring buffer):
- console:
Runtime.consoleAPICalled + Runtime.exceptionThrown + Log.entryAdded (the last captures engine-level errors).
- network:
Network.requestWillBeSent -> responseReceived / loadingFailed.
Same mechanism Playwright / Chrome DevTools MCP use.
Tried it locally
I patched a local build to confirm the approach. Against a test page emitting console logs, an uncaught exception, a missing resource, and 200/404/500/failed fetches, it captured all console levels, the engine-level Failed to load resource 404/500 errors, the uncaught exception with stack, and network entries with real status codes. So it really is just "enable two more CDP domains + buffer the events".
Is this something you'd want in the project?
中文
缺什么:现在没法读页面的 console 日志和网络请求。让 agent 调前端(不只是操作)时,这是主要卡点。
目前只能用 evaluate 注入 JS hook,但常见场景都覆盖不了:
- hook 必须在事件发生前注入,初始加载阶段的日志已经丢了;
- 引擎级报错(资源 404、CSP 违规、混合内容)不走
console.*,hook 看不到;
- 没有响应状态码——
performance 只给 URL+耗时,没有 404/500;
- 注入状态导航后清零。
建议:两条只读命令,和 snapshot 同类:
bsk console --session <id> # console / log / 未捕获异常
bsk network --session <id> # 网络响应与失败,带状态码
一种实现思路:扩展已经挂了 chrome.debugger、也有 onEvent 监听(chromium-cdp.ts 里的对话框处理)。同一条路就能覆盖:attach 时额外开 Runtime/Log/Network(best-effort),事件按 tab 进环形缓冲——console 用 consoleAPICalled+exceptionThrown+Log.entryAdded(最后一个抓引擎级报错),network 用 requestWillBeSent->responseReceived/loadingFailed。跟 Playwright / Chrome DevTools MCP 是同一套机制。
本地试过:改了个本地 build 确认可行,对一个会产生 console、未捕获异常、资源缺失、200/404/500/失败请求的测试页,抓到了各级 console、Failed to load resource 的 404/500 引擎级报错、带堆栈的未捕获异常、带真实状态码的网络记录。基本就是"多开两个 CDP 域 + buffer 事件"。
What's missing
There's no way to read a page's console messages or network activity. When an agent needs to debug a front-end (not just operate it), this is the main blocker.
Today the only workaround is
evaluateto inject JS hooks, which can't cover the common cases:console.*, so JS hooks can't see them.performance.getEntriesByType('resource')gives URLs + timing, not 404/500.Proposal
Two read-only commands, same category as
snapshot:Possible approach
The extension already attaches
chrome.debuggerand has anonEventlistener (the dialog handler inchromium-cdp.ts). The same path covers this:Runtime/Log/Network(best-effort).Runtime.consoleAPICalled+Runtime.exceptionThrown+Log.entryAdded(the last captures engine-level errors).Network.requestWillBeSent->responseReceived/loadingFailed.Same mechanism Playwright / Chrome DevTools MCP use.
Tried it locally
I patched a local build to confirm the approach. Against a test page emitting console logs, an uncaught exception, a missing resource, and 200/404/500/failed fetches, it captured all console levels, the engine-level
Failed to load resource404/500 errors, the uncaught exception with stack, and network entries with real status codes. So it really is just "enable two more CDP domains + buffer the events".Is this something you'd want in the project?
中文
缺什么:现在没法读页面的 console 日志和网络请求。让 agent 调前端(不只是操作)时,这是主要卡点。
目前只能用
evaluate注入 JS hook,但常见场景都覆盖不了:console.*,hook 看不到;performance只给 URL+耗时,没有 404/500;建议:两条只读命令,和
snapshot同类:一种实现思路:扩展已经挂了
chrome.debugger、也有onEvent监听(chromium-cdp.ts里的对话框处理)。同一条路就能覆盖:attach 时额外开Runtime/Log/Network(best-effort),事件按 tab 进环形缓冲——console 用consoleAPICalled+exceptionThrown+Log.entryAdded(最后一个抓引擎级报错),network 用requestWillBeSent->responseReceived/loadingFailed。跟 Playwright / Chrome DevTools MCP 是同一套机制。本地试过:改了个本地 build 确认可行,对一个会产生 console、未捕获异常、资源缺失、200/404/500/失败请求的测试页,抓到了各级 console、
Failed to load resource的 404/500 引擎级报错、带堆栈的未捕获异常、带真实状态码的网络记录。基本就是"多开两个 CDP 域 + buffer 事件"。