Skip to content

feat(browser): 对话的 Agent 直接操作侧栏浏览器标签页(关联 #212) - #250

Merged
freedomkk-qfeng merged 27 commits into
ECNU:mainfrom
JunieXD:feat/212-sidebar-browser-agent
Nov 5, 2026
Merged

freedomkk-qfeng merged 27 commits into
ECNU:mainfrom
JunieXD:feat/212-sidebar-browser-agent

Conversation

@JunieXD

@JunieXD JunieXD commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

目标

实现 #212 的第一步:桌面版里,对话自己的 Agent 直接操作该对话右侧侧栏里的浏览器标签页。用户能看到每一步,点“停止”即可接手,登录态与侧栏共享;对话不在电脑屏幕上时(例如用手机远程接入),Agent 新开的网页在后台打开。Agent 把网页读成文字、一个网页上的动作一次做完,只在有风险的步骤前确认。子 Agent、Web 与 CLI 仍用原来的独立浏览器,新的读页和操作工具在那里同样可用。

做法

  • Electron 主进程提供一个只监听本机的 CDP 端点,路径带随机密钥和会话 ID。每个对话看到的“浏览器”只包含它自己的标签页,命令经 webContents.debugger 转给对应的 <webview>(与 automation-browser.mjs 同一思路)。
  • 密钥经环境变量 EDUWORK_SIDEBAR_BROWSER_SECRET 只交给 Host,browser-upstream 读取后立即从环境中删除;连接地址经 PLAYWRIGHT_MCP_CDP_ENDPOINT 交给 Playwright MCP,不出现在进程参数里。
  • 官方 provider 的 mountSessionMcp 对所有 Agent 用同一组参数,所以 browser-upstream 按 Agent 挂同一个 Playwright MCP:主 Agent 连侧栏,子 Agent 照旧 --isolated。官方支持按 Agent 传参后可删掉这一层(代码注释已写明)。
  • 渲染层(browser-upstream 新增的 client)把 guest 和“对话、标签页”对应起来,替 Agent 开关标签页(对话不在屏幕上时开后台页面),在被操作的标签页上显示标记和“停止”按钮,并把 Agent 点击时被带走的焦点还给用户。
  • 读页与操作:browser-upstream 新增 browser_read、browser_act 两个工具,以嵌套工具调用使用同一个 Playwright MCP。browser_read 在网页里运行一段脚本,把用户看得到的内容读成文字,能用的链接、按钮、输入框就地编号;browser_act 按编号依次执行一批输入、点击、选择、按键等动作,网页换页时提前停下,返回此时的网页。原来模型每个动作一轮,每轮还要再读一次 MCP 写进工作区的快照文件;现在 MCP 不写快照(--snapshot-mode none、--timeout-settle 0),一个网页上的操作通常一轮完成。Playwright MCP 原有的工具仍保留,用于标签页、截图、上传和网页对话框。Web 与 CLI 没有侧栏,所有 Agent 都用与子 Agent 相同的独立浏览器挂载,同样不写快照(官方 provider 没有这个参数)。

改动要点

  • 隔离:页面级会话只放行 Playwright 用到的域,拒绝 Target.*、Browser.* 和读写 Cookie 的方法(Cookie 属于整个工作区分区,不属于单个页面);带 Origin 的连接和错误密钥被拒绝;同一对话的新连接替换旧连接,旧连接的回复不会发到新连接。
  • 键盘:Chromium 会把页面级 CDP 按键送到应用窗口当前聚焦的元素,所以键盘输入跟随页面焦点进入跨站 iframe 的子会话,否则用 guest 自己的输入接口,不会打进聊天输入框。
  • 后台绘制:Agent 工作期间关闭主窗口和这个对话各标签页的后台节流(只关窗口时,窗口被别的应用挡住后标签页不再出画面,Agent 的点击全部超时),并让隐藏的标签页、收起的侧栏和后台对话里的标签页在窗口内、所有内容下方以 1% 不透明度继续绘制(完全透明时,界面布局一变合成器就不再绘制它,截图会卡住);Agent 空闲(没有在途命令 15 秒)后恢复。
  • 后台页面:上游只给显示在屏幕上的对话挂载新标签页。对话不在屏幕上时(用户在看其他对话,或经 [Feature] 开放远程接入协议与 Web 客户端 #116 远程接入用手机操作),渲染层用桌面端给侧栏用的同一套 guest 租约(dshDesktop.browser.acquire,存储键与该对话的侧栏相同)在窗口内看不见的位置开一个 <webview> 交给 Agent:登录状态与侧栏相同,主进程对侧栏 guest 的偏好、导航、弹窗和权限规则同样生效;Agent 关闭浏览器或断开时关闭,还没开好的也会释放。[Feature 提案] 侧栏浏览器人机同页:Agent 直接操作右侧浏览器 #212 写的是“远程接入沿用无头浏览器”,这里没有照做:Host 分不出一条消息来自手机还是电脑(DSH 记录 owner 的消息时不区分连接),同一对话也可能中途换设备;按对话是否显示在屏幕上判断能覆盖这两种情况,也去掉了原来“后台对话新开标签页直接报错”的限制。
  • 接手:Agent 操作的标签页上盖一层标记(蓝框和“Agent 正在操作 · 停止”)。Agent 操作网页期间,用户在这个标签页上的点击、滚动和键盘输入都进不了网页,焦点也会移出网页,避免双方同时操作。Agent 提问等用户回答时(例如请用户登录),或约 15 秒没有再操作网页,标记隐去,用户可以在网页上操作;点“停止”(等同输入框的停止键)或等这一轮结束也可接手。Agent 自己的输入直接送到 guest,不受影响。[Feature 提案] 侧栏浏览器人机同页:Agent 直接操作右侧浏览器 #212 写的是“用户直接在页面上操作即视为接手”:Agent 操作期间网页仍锁着;标记隐去时用户在网页上点过或输入过,Agent 下一次操作一步也不执行,先看网页现在的样子(见“操作前核对”)。
  • 侧栏展开:用户看得到 Agent 操作时展开一次,包括用户回到一个 Agent 正在工作的对话时;用户收起后保持收起。
  • 新标签页:上游侧栏在 guest 就绪时自己加载地址。这次加载被别的导航打断时(网页加载完之前用户或 Agent 点了链接、跳转了地址),Electron 传回渲染层的错误不带 code,上游认不出是 ERR_ABORTED;离开一个还在加载的网页时,Electron 还会让下一次加载带着这次中断一起失败。两种情况上游都会在已正常打开的网页上显示“页面加载失败”。现在桌面端让被打断的加载正常结束(上游本来就忽略这种中断)。Agent 新开的标签页和网页弹出的新窗口,在侧栏的网页替换掉起始空白页后交给 Agent,网页上有图片一直加载不完也不会卡住。
  • 焦点:Agent 点击或切换标签页后,焦点回到操作前的位置(正在输入的消息、或另一个对话里用户正在用的网页);多个对话的点击重叠时按同一批、以第一次点击前的位置为准。
  • 网页背景:Electron 的 <webview> 默认背景透明,没设背景的网页会透出应用底色(深色主题下默认的黑字看不清),Agent 截到的则是透明 PNG,模型看到一片黑。现在侧栏网页和 Chrome 一样使用浏览器自己的背景(没声明配色的网页为白色);空白页和上游的占位文字仍随应用主题深浅。
  • 确认:参照 Codex 浏览器插件的做法,浏览器步骤不再逐次确认,用户的请求本身就包括打开网页、点链接、填写和翻页(main 上每次点击、输入都要确认)。应用只在这些操作前自己确认:在网页里运行脚本、上传或拖放文件、确认网页弹出的对话框、关闭浏览器,以及打开本机或内网地址(Agent 在所在的内网网站上点它的链接不再确认,自己输入的内网地址仍要确认);截图等结果带文件名保存到工作区时按会话的文件权限处理,只读会话才确认。提交申请或报名、发送消息、付款、删除、填写学号手机号等个人信息之前,Agent 用 browser_act 的 confirm 请用户确认:一件事在第一个这类步骤前问一次,写明网站和数据,提示里列出将执行的每一步,应用自己要确认的内容(例如链接进入内网地址)也写在这一次里;确认后,表单后面的页面、网页自己的“确定吗”和最终提交不再问。这种确认在完全访问模式下也会出现。提示按工具参数写明具体操作,例如“允许智能体打开本机或内网地址 http://127.0.0.1:8080/”;认不出的工具仍要确认;新标签页的地址和导航一样只允许 HTTP(S)。
  • 读页:元素名称先用网页给的名称(aria-labelledby、aria-label、<label>),没有时才用旁边的短文字;输入框写明已填的内容和网页声明的要求(类型、取值范围、长度),密码只说明是否已填;很长的网页读滚动位置附近的部分(过长的段落按显示位置分成多行),并说明还往哪个方向延续;图表等大块 canvas/SVG 标出位置,提示用不带文件名的截图查看;网页弹出模态对话框时只显示对话框;折叠菜单里的链接列在最后。会换页的链接按地址打开(目标是新窗口时在新标签页打开),不执行网页自己的点击处理,所以确认范围与直接打开该地址相同。网页内容包在 <untrusted_web_content> 里交给模型。
  • 操作前核对:browser_act 执行第一步前先确认浏览器还在读过的那个文档上(同一地址重新加载、表单提交回同一地址也算换了),要操作的控件仍是读到的那个(单页应用把按钮改作他用也算变了;网页没给名称的输入框按它所在的框里、它前面显示的文字核对(复选框、单选框取框里所有文字),这些文字有任何改动都算变,字段后面的字数统计、倒计时或提示变化不算),每步之后同样核对;读过之后用户在网页上点过或输入过(桌面侧栏里包括 iframe 中的,由主进程计数,Agent 自己的输入不算),第一步前就停下。不是就停下并返回当前网页,例如用户接手后换了页面、改了选项。Agent 自己调用会离开当前页面的 MCP 工具(切换标签页、导航等)或读页失败后,读过的页面作废,要先重新读。
  • 截图:Playwright MCP 带文件名截图时只保存、不返回图片,模型曾因此在整个磁盘上查找这个文件。现在结果补一句该文件在工作区里的完整路径。
  • 技能说明(SKILL.md):每次只看下一步需要的内容;网页上有链接就点链接,不自己拼地址,只有确定的地址(网站首页、百科条目、带检索条件的搜索地址)可以直接打开,打不开就回到网页上继续;网页已经显示答案或办成的结果就停下。
  • 文档:browser-upstream 的中英文 README 和给模型的提示词说明桌面侧栏的行为、读页与操作工具、限制和确认范围。

验证

  • 新增 Electron 测试 dsh-electron/tests/sidebar-browser.test.mjs(11 组),已接入 validate-pinned-dsh-source 的 Windows/macOS 矩阵;替身侧栏按上游的首次挂载规则、首次加载方式和收起样式实现,替身桌面端按上游的 guest 租约实现。覆盖:只操作本对话的标签页、新标签页交出时机、键盘不进应用窗口、隐藏标签页/收起侧栏/后台对话、从未在电脑上显示的对话用后台页面(输入、白底、弹窗、存储键、断开后关闭)、后台页面还没开好时 Agent 断开、锁定与停止、Agent 提问时放开锁、这个对话各标签页的后台节流、用户在网页(含跨站 iframe)里的按下和按键在 Agent 下一个命令之前计入且不算 Agent 自己的输入、回到对话时展开一次、多个对话同时操作、连接与页面隔离。每个修复都临时改回旧逻辑确认测试会失败。本机 macOS 用固定的 Electron 44.0.0 全部通过(合并 main 后用 DSH 0.2.1-rc.5 的运行时重跑,仍全部通过);Windows 11 虚拟机(Electron 44.0.0 win32-x64,x64 仿真)上 3b52910 的 10 组全部通过,之后新增的一组没有在虚拟机上跑,由 CI 的 Windows 矩阵运行。
  • 桌面冒烟 probe-native-desktop:侧栏 guest 打开没设背景的网页时为不透明白色;从一直加载不完的网页离开时,这次加载和下一次加载都正常结束。改回旧逻辑时两项都失败(全透明像素;两次加载都报失败)。本机通过。
  • browser-upstream/test/sidebar.test.mjs:启动参数与环境变量,后台页面的存储键等工作区列表到达、Agent 断开时停止等待(4 项)。
  • browser-upstream/test/permission.test.mjs(3 组):确认范围(只在风险步骤前确认、从别的网站进入内网、文件保存跟随文件权限)、各工具的提示文案与最终拒绝。page.test.mjs(6 组,其中四组在 Chromium 里运行页面脚本)和 read-act.test.mjs(10 组):编号、名称来源、看不见的元素、密码、画出来的内容、遮罩和模态对话框、字段要求、Shadow DOM、同一地址重新加载、长网页按滚动位置读;批量执行、换页时停下、网页或控件已不是读过的那个时不执行、读过之后用户用过网页时不执行、自己调用 MCP 工具后读过的页面作废、只有点所在内网网站的链接免确认、链接按地址打开、confirm 的提示(含内网地址)、带文件名截图的路径说明。这三个文件要用已装配产品的依赖,在本机运行,连同 sidebar.test.mjs(含没有侧栏时的启动参数)共 23 项全部通过(DSH 0.2.1-rc.5);CI 未包含。其中两个文件用合成的内网地址测确认分类,源码回执把它们登记为已审查,与 tool-browser 的测试相同。scripts/test/plugin-locale.test.mjs 经官方 ApprovalPanel 渲染中文提示,通过。
  • 合并 main 后的本机 macOS 候选包 0.4.10-dev.20261104.1(DSH 0.2.1-rc.5),真实产品:
    • 学校模型 ecnu-plus 真实对话:Agent 打开本机测试页、在 Name 框输入“小王”、点击 Greet 并报告结果,用一次 browser_read、一次 browser_act 完成,11 秒。只有一次确认“允许智能体打开本机或内网地址 http://127.0.0.1:…/”;运行中被操作的标签页始终被标记覆盖,这一轮结束后标记立即隐去。
    • 合成模型(本地假模型,按固定步骤调用浏览器工具):这一轮运行时,用户在被操作的标签页上点击、输入都进不了网页;点标记上的“停止”后这一轮结束,用户随即能在网页里输入;一轮正常结束时标记立即隐去(6 项)。用户发出消息后立即切到别的对话(相当于手机远程接入时电脑上没显示这个对话),Agent 在后台页面完成填写和点击,回复正常,侧栏没有多出标签页(2 项)。
    • installer-cleanup.test.mjs(main 和本 PR 都改了这个文件)33 项通过。
    • 浏览器任务(学校模型 ecnu-max;测试脚本代用户点“允许一次”、选推荐项回答提问;按结果评分):只说目的的 14 个任务在 71de768 和本 PR 最终提交 3b52910 上各跑一轮,28 次中 24 次按网页上的结果判定通过,平均 32.6 秒、8.5 步(这一时段学校模型响应较慢,秒数不与下面 rc.3 上的对比直接比较)。另外 4 次也已办成,之后模型离开了结果页:场地借用两次办成后去“我的事务”核对;设置保存后模型认出是演示网站,刷新后合成网站不保留设置;付款停在二维码页请用户扫码,测试脚本代用户选了“已扫码支付成功”,模型见页面不跳转便去查源码。预约、报名、借场地每次提交前都问了用户一次(多数用 confirm,个别用提问卡,有一次两者都用了)。写明网址和步骤的 9 个任务:71de768 上 8/9(未通过的一次是测试脚本在确认卡弹出时误判这一轮已结束,脚本已修正),3b52910 上 9/9。
    • 3b52910 之后的修复(候选包换入本分支的插件、客户端和主进程代码):Agent 用提问卡问用户时标记隐去,用户在网页上打开了另一个开关,Agent 随后的 browser_act 一步也没执行,重新读页后完成设置,并在回复里说明了用户改过的开关;同一流程中另一窗口挡住应用,Agent 每次点击约 0.2 秒完成(修复前都超时);网页上的跨站 iframe 改变了主页面按钮的操作对象,用户在 Agent 提问时点了 iframe 里的按钮,Agent 随后要点的“删除”没有执行,Agent 看到对象已变,转而再问用户。写明网址和步骤的任务在修复过程中的三个版本上各 8/8 通过(华东师大官网新闻一项因本机暂时连不上 www.ecnu.edu.cn 未跑),只说目的的 14 个任务办成 13 个(未办成的也是要上华东师大官网的新闻任务)。最终提交只改了网页没给名称的输入框的核对规则,用插件测试验证,未再跑真实任务。
  • 浏览器任务对比(真实产品,DSH 0.2.1-rc.3 的 0.4.9-dev 包换入各版本插件,学校模型 ecnu-max,同一时段交替运行;测试脚本代用户点“允许一次”、选推荐项回答提问):
    • 写明网址和步骤的 7 个任务(合成校园网站 3 个、公开网站只读查询 4 个):本 PR 原来逐个调用 MCP 工具与读页和操作相比,7/7 都完成,平均用时 35.2 → 20.0 秒,模型回合 12.1 → 5.1,模型读入 token 307K → 123K,读快照文件 2.1 → 0 次。改为只在风险步骤前确认后,每个任务要点的“允许”从约 4 次降到 0.6 次,剩下的是从别的网站进入本机测试网站和报名前的确认。
    • 只说目的的 14 个任务:10 个开局时侧栏已开着合成的办事大厅(模拟用户自己打开并登录),话里不给网址和步骤,例如“这周五下午我想和 5 个同学在图书馆讨论课题,帮我约个研讨室”,要自己算日期、在几十个服务里找到入口、避开约满的时段;另外 4 个不开网页,由模型决定用不用浏览器。按结果评分(网页上出现办成的提示,或答案正确),不规定路径:28 次全部办成(其中 2 次办成后又离开结果页去核对),平均 11.5 秒、7.5 步;预约、报名、借场地都只确认一次,付款停在二维码页交给用户扫码。
  • 0.4.9-dev 包(DSH 0.2.1-rc.3)上做过、本次改动未涉及的产品级检查:
    • 直连端点的产品级检查(17 项,0.4.9-dev.20261028.2):Agent 新开标签页、在未选中的标签页、收起的侧栏(保持收起)、后台对话的两个标签页里填写和点击;后台截图(包括前台侧栏收起再展开之后);对话不在屏幕上时新开的网页成为后台页面(约 0.1 秒交出,可填写、点击、截图,侧栏不多标签页,用户焦点不变),Agent 断开后关闭;新标签页的首页 1.5 秒才返回时,Agent 拿到的已是该网页而不是起始空白页,随即导航也不出现“页面加载失败”;网页弹出的新窗口里有图片一直加载不完时,约 0.1 秒交给 Agent,Agent 随即跳转或点击其中的链接都不出现“页面加载失败”(改动前这样的新窗口一直不交给 Agent);用户在同一对话或另一对话里输入时草稿和焦点不变;没有运行中的一轮时,用户点进网页后焦点留在网页,包括另一个对话侧栏里用户正在用的网页;空闲后标记清除。
    • 手动验收(0.4.9-dev.20261027.5,ecnu-plus):在本机测试页和真实公开网页(未登录)上,输入、点击、新开标签页都正常;侧栏全程显示 Agent 正在操作的页面,没有出现“页面加载失败”。
  • 未验证:Windows 真机(只有 CI 和虚拟机;读页与操作的真实任务只在 macOS 上跑过)、Web 与 CLI 里的真实浏览器任务(启动参数与子 Agent 相同,有单测)、经中继的完整手机远程接入(电脑端只看对话是否显示在屏幕上,已用上面“用户切走”的对话覆盖)、真实网站登录和提交(提交只在合成网站上测过)、长时间运行。

已知限制

  • 后台页面在电脑上看不到,也不能接手;需要用户操作的步骤,Agent 会请用户在电脑上打开这个对话,在侧栏里完成(登录状态共享)。侧栏标签页里的链接弹出的新窗口仍由上游处理,对话不在屏幕上时要等用户回来才加载。
  • 应用重启后上游把侧栏网页显示为“恢复页面”占位,Agent 看不到这些标签页,会另开新标签页。
  • 从别的网站进入本机或内网地址、上传文件等仍逐次确认,DSH 目前只有“允许一次”。提交、付款这类结果要不要请用户确认,由模型按技能说明和 confirm 参数的说明判断,应用本身认不出哪个按钮是提交;测试中这类任务每次都确认了,但不能保证每个网站上都如此。
  • browser_read 不读 iframe 里的内容,只标出 iframe 并提示改用 browser_snapshot;开放的 Shadow DOM 可以读到。
  • 网页在输入框前面(复选框旁边)新加文字时,即使只是“必填”这类提示,browser_act 也会停下、重新看网页再继续:脚本分不出加的是提示,还是“禁止”这类改变用途的词。
  • 用户在网页上的操作:桌面侧栏里主进程能看到每个 frame 里的按下和按键;没有按下和按键的输入(例如从别处拖入文字)只在顶层文档里察觉;子 Agent、Web 与 CLI 的独立浏览器只察觉顶层文档里的输入。
  • 读页和操作前的核对都由运行在网页里的脚本完成,防的是正常的页面变化(用户接手、重新加载、单页应用改了控件),不防恶意网页:网页能伪造这些核对用的标记,也本来就决定自己的按钮做什么。
  • 维护:渲染层依赖上游侧栏的 DOM 结构(data-sidebar-right-*、data-sidebar-browser-frame、dock 容器)、桌面端 dshDesktop.browser 的租约接口和存储键规则,以及 Chromium 在 1% 不透明度下继续绘制的行为;升级 DSH 或 Electron 时要重跑 sidebar-browser.test.mjs 并在真实产品上复验。browser_act 从 Playwright MCP 工具结果里的标签页列表判断是否开了新标签页,升级 Playwright MCP 时要重跑 read-act.test.mjs 和真实产品上的任务。

关联 #212

In the desktop app the conversation's own Agent now uses Playwright MCP
against the browser tabs in that conversation's right sidebar, so the
user watches every step, shares logins and can take over. Subagents,
Web and CLI keep the isolated browser.

- dsh-electron: a loopback CDP endpoint per conversation behind a secret
  that only the Host receives; pages cannot reach other targets, the
  application window or cookie storage; keyboard input follows focus
  into cross-site frames; hidden, collapsed and background tabs keep
  painting while the Agent works.
- dsh-electron: Sidebar pages paint the browser's own background, as in
  Chrome, instead of letting the application show through; the Agent's
  screenshots of a page without a background are no longer transparent.
- browser-upstream: per-Agent Playwright MCP launch, sidebar guidance,
  and the renderer half that opens tabs, marks the tab being driven and
  returns focus to where the user was.
- browser-upstream approvals name the action: the element to click, the
  text to type, the address to open. Reading pages, switching tabs and
  opening public pages no longer ask.
- Electron test with a stand-in sidebar following upstream's mount and
  collapse rules, wired into validate-pinned-dsh-source.
A popup or a tab the user opened reached the Agent while its guest still
showed the blank start the Sidebar navigates away from, so Playwright saw
an already loaded blank page and could attach mid-navigation. bind now
waits, for every new tab, until the Sidebar's page replaced the blank
start, taking over the wait Target.createTarget did.

Waiting for the whole load is no longer needed. The Sidebar reported a
page failed when the user or the Agent navigated during its load, as the
abort's code does not cross IPC, and Electron also failed the next load
with the abort of the page it left. The desktop bridge lets such aborted
loads end, so a page with an image that never finishes neither holds the
tab back nor shows the failure banner.

The installer startup checks import the built native-desktop.mjs, which
now loads the sidebar broker; stub it there as the other adapters are.
@JunieXD JunieXD changed the title feat(browser): let a conversation's Agent drive its sidebar browser tabs feat(browser): 对话的 Agent 直接操作侧栏浏览器标签页(关联 #212) Oct 27, 2026
On Windows, nothing written to stdin reaches Electron's main process and
Electron writes a blank line to stdout before the app does, so the
sidebar browser test never got the fixture's replies and its setup timed
out. The test and its Electron app now exchange messages over Node's IPC
channel, which works on Windows and macOS.
@JunieXD
JunieXD marked this pull request as ready for review October 27, 2026 13:40
JunieXD and others added 24 commits October 28, 2026 22:50
…the Agent

A desktop Host connected every conversation's Agent to the desktop Sidebar,
which loads a new tab only for the conversation on screen. A conversation
driven from a phone through remote access, or one the user had left, could
not open a page, not even its first.

While the conversation is not on screen, the renderer now opens the Agent's
new page as a background guest, out of sight. It takes a lease from the
desktop as the Sidebar does, in the storage of the conversation's Sidebar
tabs, so the page shares their logins and gets the same guest rules. Such
pages close when the Agent's connection ends, including ones still opening.

While the Agent's turn runs, the tab it acts on is covered by its marker,
now with a Stop button that cancels the turn like the composer's. The user's
clicks and keys reach the page once the turn ends or they stop it, so the
user and the Agent never act on it at once.

The Sidebar now opens once per connection where the user sees the Agent at
work, including on returning to the conversation, instead of spending that
on a show the user could not see.
browser_read returns the page as text, with every element the user can
use numbered in place; browser_act runs every action the Agent can decide
from that page through its Playwright MCP tools, stops once the page
moves on, and returns the page as it is then. One approval covers a
batch. MCP no longer writes a snapshot file into the workspace after each
action or waits a fixed settle time.
A screenshot without a file name comes back to the Agent like a page read
and is kept in MCP's own output folder, so it no longer asks. Saving a
screenshot, snapshot or log into the workspace under a name follows the
session's file access, as the Agent's own file writes do: it asks only
in read-only sessions, and the approval names the file.
A canvas or SVG the size of a chart has no text to read, so browser_read
names it and says a screenshot shows it, instead of leaving the Agent to
dig the numbers out of the page's scripts.
A link that loads another page is opened by its address, as browser_read
opens one, in a new tab when the link targets one. None of the page's own
click handlers run, so the action asks only as opening that address
does: a public page opens without asking. The Agent goes on in a new tab
the page itself opens once a response lists it, so the wait for a late
link tab goes.
…the answer

The browser skill asks the Agent to look only at what its next step
needs, and to follow a link the page shows rather than type an address
it guesses. It opens an address itself only when it is sure of it, such
as a site's home page or a search with its terms, and goes on from the
page when that address does not show what it needs. Once the page shows
the answer or the outcome the user asked for, it stops there.
browser_read's url and browser_act's description say the same where the
Agent chooses between them.
Browser steps run without asking, as in Codex's and Magentic-UI's
browsers: the user's request covers opening pages, following links and
filling in fields. The application still asks by itself before a script
runs in the page, files leave the computer, a page's dialog is accepted,
the browser closes, or the Agent goes into a local or private network
from another site; links within that network no longer ask.

For the steps browser_act's confirm lists, such as submitting an
application, sending a message, paying, deleting or entering personal
data, the Agent asks the user through it even when the user asked for
the step. It asks once for the whole outcome, with all its data, at its
first such step, and the approval lists every action it will take; the
further pages of the form, the page's own "are you sure" and the final
submit then go through without asking again.
A screenshot taken with a file name does not come back in the result:
Playwright MCP only saves it in the workspace. The result now gives the
file's full path, so the Agent opens it with read_image instead of
searching the disk for it, and the browser skill says to give a file
name only when the user wants the picture kept.
Brings in DSH rc.5 and the Mulan PSL v2 license. The browser approval
tests that classify synthetic private addresses are recorded in the
receipt as reviewed, as tool-browser's test is.
The browser adapter's README, in both languages, now covers browser_read
and browser_act, and the confirmations as they are: the application asks
only before risky steps, and the Agent asks through browser_act's
confirm before an outcome the user must confirm.
Clicking a page element no longer asks, so the locale test renders the
approval for running a script in the page instead.
Without the desktop Sidebar, every Agent's Playwright MCP server is now
mounted the way subagents' already are, with an isolated browser and
without action snapshots or settle waits, which the official provider
has no option for. browser_read and browser_act then work alike in the
desktop app, Web and CLI. The Sidebar guidance is added only with a
Sidebar.
- A browser tool the Agent calls itself, other than one that only
  looks, and a read that fails leave no page read: browser_act asks for
  a new read, and a private address no longer counts as entered from the
  same site because of a page the Agent has since left.
- browser_act first checks that the browser is still on the document it
  read, as after the user took over, and runs nothing otherwise. Each
  read tags its document, so a reload or a form posted back to the same
  address stops a batch too, and numbered elements in shadow roots are
  found.
- With confirm, the one confirmation also names what the application
  would ask about itself, such as a link into a private network.
- A page longer than the read budget is read around where it is scrolled
  to, and the result says which way it goes on.
- A field is called by the name the page gives it (aria-labelledby,
  aria-label, a label) before a caption shown with it, and a caption too
  long to be one is passed over instead of leaving the field unnamed.
- The same-site exception for a private address now holds only for
  browser_act, which checks before its first action that the browser is
  still on the page read. Opening a private address with browser_read or
  an MCP tool always asks, as the user may have left that site.
- Each read records what every numbered element is and says, apart from
  what a field holds; browser_act runs nothing on an element the page has
  since put to another use, as a single-page app reusing a button does.
- The reading window drops only lines wholly above the viewport, so a
  block or card reaching into it stays, and a single line is cut at 4,000
  characters so one block cannot take the whole budget.
- These checks run in the page's own world: they tell ordinary changes
  apart, not a page that forges them.
- browser_act's check names a control with the same code as the page
  read, so a button's value or an aria-labelledby text that changes is a
  different control too, compared in any case, as showing a hidden menu
  can change the case of its text.
- A line grown past 2,000 characters goes on in a new one, and a long run
  of text is read in pieces placed where they are drawn, instead of being
  cut at 4,000 characters: the end of a long paragraph or a row of cards,
  scrolled to, is read.
…ething

The page lock now lifts while the conversation's current turn has an
ask_user_question call without a result, as when the Agent asks the user
to sign in, read from the session's own events rather than from the
cards the composer shows. A question that timed out has its result and
the Agent goes on; a hidden card still waits; an approval keeps the page
the Agent's. The READMEs now say the lock also lifts once the Agent has
not used the page for a while, as it always has.
The page read now notes the user's own input from then on, trusted
pointer, key and input events, and browser_act's check before its first
step runs nothing once there was any, and shows the page as it is: the
user may have chosen another option, as while the Agent asked them
something or waited on an approval. Between its own steps the Agent's
input is its own, and every read starts over.

A field without a name of its own goes by the text before it in its box
again, a checkbox's after it, and the check compares that name, so a
field whose caption or placeholder now asks for something else stops
the actions, while a message the page adds after it does not.
…d window

Each Sidebar guest has its own background throttling, apart from the
window's. With only the window's turned off while an Agent works, a
window covered by another app stopped its guests' animation frames, and
every click the Agent made timed out waiting for the page to be stable.
The guests of a conversation whose Agent works, and any that arrive
meanwhile, are no longer throttled until it rests.
The page script only hears its own document, so a press in an iframe,
as on a widget that changes what the page's button acts on, went
unnoticed. The main process now sees every press and key the user gives
a Sidebar guest, in any of its frames (before-mouse-event,
before-input-event), tells it from the Agent's input, which it relays
itself, and counts it in the page's top document through the debugger
session the Agent's commands use, so the count is there before any
command the Agent sends after it. The page's own count of trusted input
goes on, installed once per document apart from the count. A read
records the count, and browser_act's check before its first step
compares it.
… shows it

A field without a name of its own was known by all the text before it in
its own box, or after it for a checkbox, as the DOM holds it: hidden
text counted, a checkbox captioned in the cell before it had no name,
and a caption over 20 characters was not compared at all. Its caption is
now the text the read shows with it, shown or not as the read decides,
in the nearest box holding no other field that has a letter or digit in
it: before it, or anywhere in the box for a checkbox or radio. The check
compares the whole caption, however long, and the field's own names
(label, placeholder, title, name): any change to the caption counts, as
a word the page adds may be a message such as "required" or one that
turns the field to another use; what comes after a text field, such as a
count or a countdown, and the same text split another way do not. The
shown name is the caption up to 20 characters, without a required star,
else the placeholder.
@freedomkk-qfeng
freedomkk-qfeng merged commit 29a4acd into ECNU:main Nov 5, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants