Repository navigation
✨ sctl Browser 第 5 期原始 CDP - #7
Merged
Merged
Conversation
…DP 失败),只是收不到下载事件;扩展另需列出可附加标签页与目标 ID、给出真实 User-Agent
…全部标签页;之后 page/debug/cdp send 返回 ENDPOINT_CONNECTED,Reclaim 恢复
…WS 地址、Host/Origin/密钥检查与单客户端、连上先交出 sctl 标签页并标记端点所有、断开先关弹框再断开且保留标签页后收回、close/60 分钟/忘记/daemon 退出失效;/control/cdp/*、sctl cdp endpoint|status|close、MCP cdp_endpoint/cdp_close 及文档
…vior 空操作、close 只断开、Target 发现/自动附加/getTargets/getTargetInfo/上下文/新建/关闭/激活/附加/分离),附加的标签页先开焦点模拟,页面与子会话命令按序转发、事件按会话转回、标签页增删改转成目标事件,不支持的功能与扩展错误映射为 CDP 错误;按 Playwright/Puppeteer 真实握手回放测试;mcp.md 与两份 README 补连接示例与限制
… 改述端点现在的行为(浏览器级命令由 sctl 模拟、会话命令转发、不支持的功能返回点名功能的 CDP 错误)
…dge.ResolvePairedBrowser,未点名时仍只选在线实例),protocol.md 改述;威胁模型补原始 cdp send 的范围与 contentTrust,AGENTS.md 无审批例外补 sctl cdp,architecture.md 补 Browser 用到的 own 与 tabs.activate
…经主机名连到 daemon 时 cdp endpoint/status 回答 INVALID_REQUEST 而不是给出必被 Host 检查拒绝的地址;扩展 debugger.open 找不到目标时清除标记、与 daemon 断开时清除全部端点标记;删除只被测试用到的 Browser.InstanceID;protocol.md 同步
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
sctl Browser 第 5 期:原始 CDP。
chromium.connectOverCDP()与 Puppeteerconnect()可以直接连上用户正在用的浏览器。--remote-debugging-port重启。spec:
docs/specs/2026-10-08-raw-cdp.mdconnectOverCDP失败。改动
sctl cdp send <Method> [--params JSON],MCPcdp_sendtabId与contentTrust。Page/Runtime/Network/Log.disable、Emulation.setFocusEmulationEnabled、Target.setAutoAttach、Target.detachFromTarget。其余命令原样发送。Fetch.enable、Debugger.pause的后果和恢复办法:Fetch.disable、Debugger.resume或page detach。Page.handleJavaScriptDialog。sctl cdp endpoint|status|close,MCPcdp_endpoint/cdp_closehttp://<daemon>/cdp/<密钥>(Playwright)和ws://…/devtools/browser/<id>(Puppeteer)两种地址。close、daemon 退出、连续 60 分钟没有客户端、browsers forget(浏览器离线时也生效)。page/debug/cdp send返回新错误码ENDPOINT_CONNECTED(退出码 3)。不操作页面的命令照常执行。internal/daemon/cdpendpoint)chrome.debugger只能附加标签页,所以Browser.*与Target.*由 sctl 模拟。Browser.getVersion返回真实 UA。setDownloadBehavior回答成功但不起作用。Browser.close只断开客户端,不关闭浏览器。debugger.targets、userAgent、open、close、own,以及通知debugger.tabCreated、tabUpdated、tabRemoved。端点占用的标签页不受 10 分钟兜底断开影响,与 daemon 断开时清除。ENDPOINT_CONNECTED,只对浏览器扩展这一对端生成。给 ScriptCat 的生成 TS 逐字节不变。没有新增浏览器权限,最低版本仍为 Chrome 125。验证
自动化检查(交付树
249a5b6)go build、go vet、go test ./... -race -count=1、golangci-lint(0 issues)、make protocol-check全部 exit 0。审查
cdp status/close仍能查看并撤销点名浏览器的端点;补威胁模型与 AGENTS。attachToTarget改为返回错误。Browser.InstanceID。真机验证
browser.close()不关浏览器,标签页(包括客户端新开的)保留,断开后 sctl 命令恢复。page/debug/cdp send返回ENDPOINT_CONNECTED,tabs list与 ScriptCat 照常。Host: evil.example与带 Origin 的请求 403。sctl cdp close:三种情况都正确收回。Permission denied),在 153 上可以。cdp send的校验、拒绝列表、Chrome 错误、TIMEOUT、PAYLOAD_TOO_LARGE、弹框期间发送,以及Debugger.pause/resume恢复都成立;MCP 三个工具都成立。未在真机上观察(均有单元测试覆盖)
已知限制