@xiaoqiong0v0/opencode-browser-tool 1.12.0 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/i18n/en.js CHANGED
@@ -4,7 +4,7 @@ const en = {
4
4
  "tool.cli.arg.args": "Command line string: \"<command> [--flag value ...]\", e.g. \"navigate --url https://...\" (\"help\" lists all)",
5
5
  "cli.header": "bt_cli — browser automation CLI",
6
6
  "cli.usage": "Usage: bt_cli({ args })\n args single command line string: \"<command> [--flag value ...]\"",
7
- "cli.usage.flags": "Global flag:\n --private-session use the caller's own session instance (default: share the root session's instance and data dir; once used by a sub-session it stays private)",
7
+ "cli.usage.flags": "Global flag:\n --private-session use the caller's own session instance (default: shared with the main session; once used by a sub-session it stays private)",
8
8
  "cli.commands": "Commands:",
9
9
  "cli.examples": "Examples:",
10
10
  "cli.example.1": "bt_cli({ args: \"help\" })",
@@ -53,16 +53,16 @@ const en = {
53
53
  "cli.cmd.upload_file": "Upload a file to an input; optional --timeout ms (100-60000) caps this call's wait budget, timeout errors explicitly",
54
54
  "cli.cmd.screenshot": "Take a screenshot (returns image attachment; with --selector it scrolls the element into view first); optional --timeout ms (100-60000) caps this call's wait budget, timeout errors explicitly",
55
55
  "cli.cmd.evaluate": "Execute JS in the page and return the result. Items run in order, one at a time: @file:<path> reads a script file (workspace dir or plugin tmp only), anything else is inline JS; stops at the first failure unless --continue-on-error. --script \"...\" runs a single script and cannot be combined with positional items; optional --timeout ms (100-60000) caps each script's wait budget",
56
- "cli.cmd.inject": "Persistent inject rules: JS that runs when a document finishes loading and the tab URL matches. Sub-actions: add --match <glob|re:...> [--file <path>]... [--text <code>]... [--order N] [--disabled] (files from the workspace dir or plugin tmp, ≤256 KiB each; converted to text so Rust never sees paths); list; remove|enable|disable --id <id>; clear; test --url <url> (match only, executes nothing). Rules live in the session data dir (sessions/<profile>/<sid>/inject/rules.json), at most 20 rules / 256 KiB per rule, executed in ascending --order; a rule auto-disables after 3 consecutive failures",
56
+ "cli.cmd.inject": "Persistent inject rules: JS that runs when a document finishes loading and the tab URL matches. Sub-actions: add --match <glob|re:...> [--file <path>]... [--text <code>]... [--order N] [--disabled] (files from the workspace dir or plugin tmp, ≤256 KiB each); list; remove|enable|disable --id <id>; clear; test --url <url> (match only, executes nothing). Rules are saved with the session and cleared when it ends; at most 20 rules / 256 KiB per rule, executed in ascending --order; a rule auto-disables after 3 consecutive failures",
57
57
  "cli.cmd.get_visible_text": "Get visible page text",
58
58
  "cli.cmd.get_visible_html": "Get page HTML structure",
59
- "cli.cmd.console_logs": "Get buffered console logs (--type, --group burst|none, --phase, --search, --limit, --tab, --include-internal, --clear; --no-dedupe = --group=none; --tab N = the 0-based index printed by list_tabs, so --tab 0 is the first tab); entries show (xN)/phase/source, exceptions include the stack's first line; browser-internal logs (violation/deprecation, e.g. [DOM] Password field) are hidden unless --include-internal",
59
+ "cli.cmd.console_logs": "Get buffered console logs (--type, --group burst|none, --phase, --search, --limit, --tab, --include-internal, --clear; --no-dedupe = --group=none; --tab N = the 0-based index printed by list_tabs, so --tab 0 is the first tab); entries show (xN)/phase/source, exceptions include the stack's first line; the browser's own advisory logs (e.g. form/rendering warnings) are hidden unless --include-internal",
60
60
  "cli.cmd.network_logs": "Get buffered network requests (--type, --status 2xx|3xx|4xx|5xx|N, --failed, --search, --group burst|key|none, --phase load|interactive|action:<cmd>, --limit, --tab (0-based), --include-headers, --reveal-secrets, --clear; --no-dedupe = --group=none; --tab N = the 0-based index printed by list_tabs, so --tab 0 is the first tab)",
61
61
  "cli.cmd.go_back": "Go back in history",
62
62
  "cli.cmd.go_forward": "Go forward in history",
63
- "cli.cmd.resize": "Resize the page content area (viewport, not the OS window; window height = content + 72px toolbar; min 360x360, smaller values are clamped)",
63
+ "cli.cmd.resize": "Resize the page content area (viewport; the OS window adjusts accordingly, based on the content area; min 360x360, smaller values are clamped)",
64
64
  "cli.cmd.set_device": "Apply device preset (no name = list presets; preset sizes are content-area/viewport sizes)",
65
- "cli.cmd.devtools": "Open/close devtools (open/close/toggle)",
65
+ "cli.cmd.devtools": "Open/close devtools (open/close/toggle); closing is not supported on some platforms",
66
66
  "cli.cmd.reload": "Reload the current page",
67
67
  "cli.cmd.open_window": "Open the browser window",
68
68
  "cli.cmd.close": "Close the browser",
@@ -81,8 +81,8 @@ const en = {
81
81
  "cli.cmd.scroll_to_element": "Scroll until element is visible; optional --timeout ms (100-60000) caps this call's wait budget, timeout errors explicitly",
82
82
  "cli.cmd.get_dropdown_options": "List dropdown options; optional --timeout ms (100-60000) caps this call's wait budget, timeout errors explicitly",
83
83
  "cli.cmd.custom_user_agent": "Set a custom User-Agent",
84
- "cli.cmd.expect_response": "Start expecting an HTTP response pattern",
85
- "cli.cmd.assert_response": "Check if expected response matched",
84
+ "cli.cmd.expect_response": "Record the expected response URL pattern as a starting point (non-blocking; use assert_response afterwards to check for a match after that point)",
85
+ "cli.cmd.assert_response": "Check whether a response matching the pattern appeared after the starting point and return the latest one; a clear message is returned when nothing matched",
86
86
  "cli.cmd.get_accessibility_tree": "Get the accessibility tree; optional --timeout ms (100-60000) caps this call's wait budget, timeout errors explicitly",
87
87
  "cli.cmd.list_records": "List annotation records in the panel",
88
88
  "cli.cmd.read_record_content": "Read an annotation record by id",
@@ -138,8 +138,8 @@ const en = {
138
138
  "cli.out.device_applied": "Device preset applied: {name} ({w}x{h} content)\nUser-Agent: {ua}",
139
139
  "cli.out.devtools_open": "Devtools opened",
140
140
  "cli.out.devtools_closed": "Devtools closed",
141
- // Windows/wry cannot actually close DevTools: report it instead of claiming success
142
- "cli.out.devtools_unsupported": "Closing DevTools is not supported on this platform (wry limitation); toggle it with F12",
141
+ // Some platforms cannot actually close DevTools: report it instead of claiming success
142
+ "cli.out.devtools_unsupported": "Closing DevTools is not supported on this platform; toggle it with F12",
143
143
  "cli.out.reload": "Page reloaded: {url}",
144
144
  // Fallback when the backend response carries no url (no last-navigated URL on the tab) — keeps output from showing undefined
145
145
  "cli.out.reload_nourl": "Page reloaded",
@@ -152,7 +152,7 @@ const en = {
152
152
  "cli.out.click_switch_tab": "Clicked {sel}, current URL: {url}",
153
153
  "cli.out.iframe_click": "Clicked in iframe",
154
154
  "cli.out.iframe_fill": "Filled in iframe",
155
- "cli.out.status.not_running": "Browser is not running.\nbt-shell: {bin}\nCall open_window when needed (other tools will not reopen it automatically).",
155
+ "cli.out.status.not_running": "Browser is not running.\nCall open_window when needed (other tools will not reopen it automatically).",
156
156
  "cli.out.status.installing": "Installing {list}.",
157
157
  "cli.out.status.not_open": "The browser is running but has no window. Call open_window to open one.",
158
158
  "cli.out.status.open": "Browser is open\nTitle: {title}\nURL: {url}\nTabs: {n}",
@@ -167,7 +167,7 @@ const en = {
167
167
  "cli.out.scroll_to_element": "Scrolled to element",
168
168
  "cli.out.dropdown_none": "Select not found or no options: {sel}",
169
169
  "cli.out.ua_set": "User-Agent set",
170
- "cli.out.expect_response": "Now expecting response matching: {url}. Use command=assert_response to check.",
170
+ "cli.out.expect_response": "Marked start point for matching: {url}. Use assert_response later to check for a match.",
171
171
  "cli.out.assert_matched": "Response matched: {url} ({status})",
172
172
  "cli.out.assert_none": "No response yet",
173
173
  "cli.out.no_ax": "(no accessibility info)",
@@ -198,7 +198,7 @@ const en = {
198
198
  "bin.disabled": "bt-shell auto-download is disabled (BT_SHELL_NO_DOWNLOAD=1); set BT_SHELL_PATH to a binary (expected path is in the plugin log)",
199
199
  "bin.unsupported": "bt-shell does not support this platform yet: {reason}",
200
200
  "bin.not_ready": "bt-shell is not ready yet, retry later",
201
- "bin.release_not_found": "No Release asset found for this version (tag={tag}); for a plugin-only change make sure the binary is still attached to the x.Y.0 Release, and for Rust changes bump the minor version and create/update that Release first",
201
+ "bin.release_not_found": "No usable browser engine found (no release for this platform/version); set BT_SHELL_PATH to point at a local file, or BT_SHELL_DOWNLOAD_BASE to change the mirror",
202
202
  // ---- client-layer errors surfaced to the model ----
203
203
  "client.service_timeout": "Browser service not ready (timed out). bt-shell is managed automatically by the plugin. Retry via bt_cli later (e.g. open_window).",
204
204
  "client.attach_timeout": "External bt-shell at {url} is not ready (timed out). Check BT_SHELL_URL/BT_SHELL_PORT and that the shell is running.",
@@ -210,8 +210,8 @@ const en = {
210
210
  "client.spawn_failed": "Failed to start the bt-shell process (retry via bt_cli later)",
211
211
  "client.session_closed_during_start": "A close request was received while the browser was starting; that instance was terminated. Call open_window if you need it again.",
212
212
  "client.attach_gone": "Attached external bt-shell at {url} is gone (attach mode does not own that process; restart the shell yourself).",
213
- "client.attach_need_token": "Attach mode requires an auth token: set BT_SHELL_TOKEN and start the external bt-shell with the same token (--token <token>, or the same environment variable).",
214
- "client.attach_bad_token": "External bt-shell refused authentication: BT_SHELL_TOKEN does not match the --token/BT_SHELL_TOKEN the shell was started with.",
213
+ "client.attach_need_token": "Attach mode requires an auth token: set BT_SHELL_TOKEN and start the external shell with the same token.",
214
+ "client.attach_bad_token": "External shell refused authentication: the token does not match the one the shell was started with.",
215
215
  "client.browser_closed": "Browser is closed. Call open_window to open it first, then retry.",
216
216
  "tool.set_media_mode.desc": "Switch camera/microphone mode: 'simulate' (fake devices, default) or 'real' (real devices, falls back to simulate if unavailable). Call without mode to query the current mode.",
217
217
  "tool.set_media_mode.arg.mode": "Mode: simulate or real (omit to query current)",
package/dist/i18n/zh.js CHANGED
@@ -4,7 +4,7 @@ const zh = {
4
4
  "tool.cli.arg.args": "命令行字符串:\"<command> [--flag 值 ...]\",如 \"navigate --url https://...\"(\"help\" 列出全部)",
5
5
  "cli.header": "bt_cli — 浏览器自动化 CLI",
6
6
  "cli.usage": "用法: bt_cli({ args })\n args 单个命令行字符串: \"<command> [--flag 值 ...]\"",
7
- "cli.usage.flags": "全局 flag:\n --private-session 使用调用者自己的会话实例(默认与根会话共用同一实例与数据目录;同一子会话首次使用后会保持私有)",
7
+ "cli.usage.flags": "全局 flag:\n --private-session 使用调用者自己的会话实例(默认与主会话共用;同一子会话首次使用后保持私有)",
8
8
  "cli.commands": "子命令:",
9
9
  "cli.examples": "示例:",
10
10
  "cli.example.1": "bt_cli({ args: \"help\" })",
@@ -53,16 +53,16 @@ const zh = {
53
53
  "cli.cmd.upload_file": "上传文件到输入框;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
54
54
  "cli.cmd.screenshot": "截取页面/元素截图(返回图片;--selector 会先滚动到元素再截取);可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
55
55
  "cli.cmd.evaluate": "在页面执行 JS 并返回结果。按顺序逐项执行:@file:<路径> 读取脚本文件(仅限工作区目录或插件临时目录),其余为内联 JS;默认遇错即停,--continue-on-error 继续执行后续项。--script \"...\" 为单个脚本,不能与位置参数项同时使用;可选 --timeout ms(100~60000)限定每个脚本的等待上限",
56
- "cli.cmd.inject": "持久注入规则:文档加载完成且当前标签 URL 命中时执行指定 JS。子动作:add --match <glob|re:...> [--file <路径>]... [--text <代码>]... [--order N] [--disabled](文件只允许工作区目录或插件临时目录,单条 ≤256 KiB;内容转成 text 发送,Rust 不接触路径);list;remove|enable|disable --id <id>;clear;test --url <url>(只算命中、不执行)。规则存于会话数据目录(sessions/<profile>/<sid>/inject/rules.json),最多 20 条、单条 ≤256 KiB,按 --order 升序执行;连续失败 3 次自动禁用",
56
+ "cli.cmd.inject": "持久注入规则:文档加载完成且当前标签 URL 命中时执行指定 JS。子动作:add --match <glob|re:...> [--file <路径>]... [--text <代码>]... [--order N] [--disabled](文件只允许工作区目录或插件临时目录,单条 ≤256 KiB);list;remove|enable|disable --id <id>;clear;test --url <url>(只算命中、不执行)。规则随会话保存,会话结束后清理;最多 20 条、单条 ≤256 KiB,按 --order 升序执行;连续失败 3 次自动禁用",
57
57
  "cli.cmd.get_visible_text": "获取页面可见文本",
58
58
  "cli.cmd.get_visible_html": "获取页面 HTML 结构",
59
- "cli.cmd.console_logs": "获取缓冲的控制台日志(--type、--group burst|none、--phase、--search、--limit、--tab、--include-internal、--clear;--no-dedupe 等价 --group=none;--tab N 取 list_tabs 打印的 0 基索引,即 --tab 0 是第一个标签);条目带 (xN)/phase/source,异常附 stack 首行;浏览器内部日志(violation/deprecation,如 [DOM] Password field)默认不显示,加 --include-internal 才显示",
59
+ "cli.cmd.console_logs": "获取缓冲的控制台日志(--type、--group burst|none、--phase、--search、--limit、--tab、--include-internal、--clear;--no-dedupe 等价 --group=none;--tab N 取 list_tabs 打印的 0 基索引,即 --tab 0 是第一个标签);条目带 (xN)/phase/source,异常附 stack 首行;浏览器自身的提示性日志(如表单/渲染告警)默认不显示,加 --include-internal 才显示",
60
60
  "cli.cmd.network_logs": "获取缓冲的网络请求(--type、--status 2xx|3xx|4xx|5xx|N、--failed、--search、--group burst|key|none、--phase load|interactive|action:<cmd>、--limit、--tab(0 基索引)、--include-headers、--reveal-secrets、--clear;--no-dedupe 等价 --group=none;--tab N 取 list_tabs 打印的 0 基索引,即 --tab 0 是第一个标签)",
61
61
  "cli.cmd.go_back": "浏览器后退",
62
62
  "cli.cmd.go_forward": "浏览器前进",
63
- "cli.cmd.resize": "调整页面内容区尺寸(视口,非 OS 窗口;自动折算窗口高+工具栏 72px;下限 360×360,低于下限会被钳制)",
63
+ "cli.cmd.resize": "调整页面内容区尺寸(视口;OS 窗口会同步调整,以内容区为准;下限 360×360,低于下限会被钳制)",
64
64
  "cli.cmd.set_device": "应用设备预设(不带 name 列出预设;预设尺寸为内容区(视口)尺寸)",
65
- "cli.cmd.devtools": "打开/关闭开发者工具(open/close/toggle)",
65
+ "cli.cmd.devtools": "打开/关闭开发者工具(open/close/toggle);部分平台不支持关闭",
66
66
  "cli.cmd.reload": "刷新当前页面",
67
67
  "cli.cmd.open_window": "打开浏览器窗口",
68
68
  "cli.cmd.close": "关闭浏览器",
@@ -81,8 +81,8 @@ const zh = {
81
81
  "cli.cmd.scroll_to_element": "滚动到元素可见;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
82
82
  "cli.cmd.get_dropdown_options": "列出下拉框选项;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
83
83
  "cli.cmd.custom_user_agent": "设置自定义 User-Agent",
84
- "cli.cmd.expect_response": "开始监听 HTTP 响应模式",
85
- "cli.cmd.assert_response": "检查期望响应是否匹配",
84
+ "cli.cmd.expect_response": "记录期望的响应 URL 模式作为起点(不阻塞;之后用 assert_response 检查该起点之后是否有匹配)",
85
+ "cli.cmd.assert_response": "检查起点之后是否出现过匹配 pattern 的响应,返回最近一条;未命中给明确提示",
86
86
  "cli.cmd.get_accessibility_tree": "获取可访问性树;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
87
87
  "cli.cmd.list_records": "列出面板批注记录",
88
88
  "cli.cmd.read_record_content": "按 id 读取批注记录",
@@ -138,10 +138,10 @@ const zh = {
138
138
  "cli.out.device_applied": "已应用设备预设: {name}({w}x{h} 内容区)\nUser-Agent: {ua}",
139
139
  "cli.out.devtools_open": "开发者工具已打开",
140
140
  "cli.out.devtools_closed": "开发者工具已关闭",
141
- // Windows(wry)无法真正关闭 DevTools:如实反馈,提示用 F12 手动切换
142
- "cli.out.devtools_unsupported": "当前平台不支持关闭 DevTools(wry 限制);可用 F12 手动切换",
141
+ // 部分平台无法真正关闭 DevTools:如实反馈,提示用 F12 手动切换
142
+ "cli.out.devtools_unsupported": "当前平台不支持关闭 DevTools;可用 F12 手动切换",
143
143
  "cli.out.reload": "页面已刷新: {url}",
144
- // 后端返回体无 url(Rust 侧标签无最后导航 URL)时的降级文案,避免输出 undefined
144
+ // 后端返回体无 url(后端标签没有最后导航 URL)时的降级文案,避免输出 undefined
145
145
  "cli.out.reload_nourl": "页面已刷新",
146
146
  "cli.out.open_window": "浏览器窗口已打开",
147
147
  "cli.out.close_already": "浏览器已关闭",
@@ -152,7 +152,7 @@ const zh = {
152
152
  "cli.out.click_switch_tab": "已点击 {sel},当前 URL: {url}",
153
153
  "cli.out.iframe_click": "已在 iframe 内点击",
154
154
  "cli.out.iframe_fill": "已在 iframe 内填写",
155
- "cli.out.status.not_running": "浏览器未运行。\nbt-shell: {bin}\n需要时请调用 open_window 打开(其它工具不会自动重开)。",
155
+ "cli.out.status.not_running": "浏览器未运行。\n需要时请调用 open_window 打开(其它工具不会自动重开)。",
156
156
  "cli.out.status.installing": "正在安装 {list}。",
157
157
  "cli.out.status.not_open": "浏览器在运行但没有窗口。请调用 open_window 打开。",
158
158
  "cli.out.status.open": "浏览器已打开\n标题: {title}\nURL: {url}\n标签数: {n}",
@@ -167,7 +167,7 @@ const zh = {
167
167
  "cli.out.scroll_to_element": "已滚动到元素",
168
168
  "cli.out.dropdown_none": "未找到 select 或无可选项: {sel}",
169
169
  "cli.out.ua_set": "User-Agent 已设置",
170
- "cli.out.expect_response": "开始监听匹配: {url}。用 command=assert_response 检查。",
170
+ "cli.out.expect_response": "已记录匹配起点: {url}。之后用 assert_response 检查是否出现匹配。",
171
171
  "cli.out.assert_matched": "响应匹配: {url}({status})",
172
172
  "cli.out.assert_none": "尚无响应",
173
173
  "cli.out.no_ax": "(无可访问性信息)",
@@ -198,7 +198,7 @@ const zh = {
198
198
  "bin.disabled": "bt-shell 自动下载已禁用(BT_SHELL_NO_DOWNLOAD=1);请设置 BT_SHELL_PATH 指定二进制(期望路径见插件日志)",
199
199
  "bin.unsupported": "bt-shell 暂不支持当前平台:{reason}",
200
200
  "bin.not_ready": "bt-shell 尚未就绪,请稍后重试",
201
- "bin.release_not_found": "未找到该版本对应的 Release 资产(tag={tag});若这是纯插件改动请确认二进制产物仍在 x.Y.0 的 Release 中,若动了 Rust 需先升中间版本号并新开/更新对应 Release",
201
+ "bin.release_not_found": "未找到可用的浏览器内核(该平台/版本暂无发布);可设置 BT_SHELL_PATH 指定本地文件,或配置 BT_SHELL_DOWNLOAD_BASE 换源",
202
202
  // ---- client 层抛给模型的错误 ----
203
203
  "client.service_timeout": "浏览器服务未就绪(超时)。bt-shell 由插件自动管理;请稍后经 bt_cli 重试(如 open_window)。",
204
204
  "client.attach_timeout": "外部 bt-shell 在 {url} 未就绪(超时)。请检查 BT_SHELL_URL/BT_SHELL_PORT,且 shell 正在运行。",
@@ -210,8 +210,8 @@ const zh = {
210
210
  "client.spawn_failed": "bt-shell 进程启动失败(请稍后经 bt_cli 重试)",
211
211
  "client.session_closed_during_start": "启动期间已收到关闭指令,该浏览器实例已终止。如需使用请调用 open_window。",
212
212
  "client.attach_gone": "附着的外部 bt-shell 在 {url} 已断开(附着模式不接管进程,请自行重启该 shell)。",
213
- "client.attach_need_token": "附着模式需要鉴权令牌:请设置环境变量 BT_SHELL_TOKEN,并让外部 bt-shell 用同一令牌启动(启动参数 --token <token>,或设置同值的 BT_SHELL_TOKEN)。",
214
- "client.attach_bad_token": "外部 shell 拒绝鉴权:BT_SHELL_TOKEN 与 shell 启动时的 --token/BT_SHELL_TOKEN 不一致。",
213
+ "client.attach_need_token": "附着模式需要鉴权令牌:请设置环境变量 BT_SHELL_TOKEN,外部 shell 需用同一令牌启动。",
214
+ "client.attach_bad_token": "外部 shell 拒绝鉴权:令牌与 shell 启动时使用的不一致。",
215
215
  "client.browser_closed": "浏览器已关闭。请先调用 open_window 打开后再试。",
216
216
  "tool.set_media_mode.desc": "切换摄像头/麦克风模式:simulate(模拟设备,默认)或 real(真实设备,无设备自动回退模拟)。不带参数时查询当前模式。",
217
217
  "tool.set_media_mode.arg.mode": "模式:simulate 或 real(省略则查询当前)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiaoqiong0v0/opencode-browser-tool",
3
- "version": "1.12.0",
3
+ "version": "1.12.1",
4
4
  "description": "opencode 浏览器工具插件:WebView2 外壳渲染 + 零注入视觉元素选取面板",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {