[IAB] Agent 创建的标签固定 1280×720 视口,非 16:9 窗格被黑边框死,建议默认继承窗格尺寸
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- desktop
Research direction
Start by reading packages/shared/src/browser-use/command-metadata.ts and the agent tab creation path that applies DEFAULT_AGENT_BROWSER_VIEWPORT; compare it with the free-size path for user-opened tabs. Check docs/viewport.md and control-browser/SKILL.md for the stated viewport behavior. Done when agent-created tabs adapt to the pane as proposed while screenshots retain a deterministic 1280×720 fallback.
Written by the indexing model from the issue text.
Description
环境
- ZCode Desktop(macOS arm64,darwin 27.0.0)
- browser-use 插件 v0.5.1(官方内置)
现象
在 ZCode 内置浏览器(IAB)里:
- 用户手动打开的标签:free-size,视口跟随窗格尺寸,拖动分隔条实时自适应 ✅
- agent 通过 browser-use
tabs.new()创建的标签:一律固定 1280×720(16:9),在非 16:9 的窗格(实测 1186×984)中上下出现大片黑边,且不随窗格拖动变化 ❌
同一面板、同一会话内两种来源的标签行为不一致,用户观感是"面板比例被写死了"。
根因(源码已定位)
packages/shared/src/browser-use/command-metadata.ts:
/** Agent 创建或打开的新页面使用的固定逻辑 viewport;不属于人类浏览器显示偏好。 */
export const DEFAULT_AGENT_BROWSER_VIEWPORT = {
width: 1280,
height: 720,
} as const;
agent 建标签即套用该常量。注释表明这是刻意设计(给自动化一个确定性逻辑视口),但显示层没有做适配,导致逻辑视口的宽高比直接变成视觉上的黑边框死。
与官方文档矛盾
- browser-use 插件自带文档
docs/viewport.md:"Use an explicit viewport only for responsive or device-size testing. Otherwise keep the normal IAB viewport." —— 正常 IAB 视口恰恰不是 1280×720。 - browser-use skill 文档(
control-browser/SKILL.md):"IAB automatically opens the target tab in free-size mode" —— 实际 agent 建的标签并非 free-size。
影响
- agent 打开页面给用户看(调研结果、仓库、文档)是该插件的核心日常场景,黑边观感差;
- 现有 workaround 是 agent 每次
setViewportSize()对齐窗格实测尺寸,但那是固定值,用户拖动窗格后即失配,需反复手动对齐; tab.close()后重开仍会回到 1280×720,无法从外部根治。
建议
保留 1280×720 作为截图/自动化的确定性 fallback,但显示层二选一:
- agent 标签默认继承窗格逻辑尺寸(与用户手开标签行为一致);或
- 保持固定逻辑视口,但渲染时按窗格比例 fit(避免黑边),仅 screenshot 走 1280×720 逻辑坐标。
备注
ZCode 主仓库(zai-org/ZCode)issues 已关闭,故投递至本仓库,烦请维护者转交对应团队。如需更多实测数据(视口读数、页面 innerWidth/innerHeight 对照)可随时补充。
TL;DR: Tabs created by the agent via browser-use get a hardcoded 1280×720 logical viewport (DEFAULT_AGENT_BROWSER_VIEWPORT), which letterboxes the pane at any non-16:9 size, while user-opened tabs are free-size. Suggest inheriting the pane's logical size by default (or fit-rendering) and keeping 1280×720 only as the deterministic screenshot fallback.
- Dominant language
- Python
- Stars
- 103
- Forks
- 78
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from zai-org/zcode-plugins
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
zai-org/zcode-plugins#107 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
zai-org/zcode-plugins#106 ·
Maintainers usually reply within 1 day
-
video-agent-kit (0.4.3): hooks invoke python3, which doesn't exist on Windows — SessionStart/UserPromptSubmit/Stop hooks fail on every triggerPossibly taken @dvd233 claimed this 27 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
zai-org/zcode-plugins#14 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
zai-org/zcode-plugins#109 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 18/100
zai-org/zcode-plugins#105 · 1 reaction ·
Maintainers usually reply within 1 day
All issues in zai-org/zcode-plugins
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
eclipse-score/inc_someip_gateway#356 ·
Maintainers usually reply within 2 days
-
[BUG]: `GitHubRestAdapter.check_user_permission` and `has_write_access` raise `TypeError` (missing `params`), silently disabling the inactivity lifecyclePossibly taken @tarunagnihotri534 claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
AOSSIE-Org/Gitcord-GithubDiscordBot#167 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
mihai-vlc/sublime-jsfmt#56 ·
-
comp/cli comp/plugins P2 type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
NousResearch/hermes-agent#141917 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
riscv/riscv-opcodes#441 ·