@xiaoqiong0v0/opencode-browser-tool 1.7.0 → 1.10.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/README.md +45 -26
- package/dist/binary.js +27 -10
- package/dist/client.js +682 -200
- package/dist/config/index.js +96 -17
- package/dist/i18n/en.js +132 -48
- package/dist/i18n/index.js +15 -11
- package/dist/i18n/zh.js +132 -48
- package/dist/index.js +320 -177
- package/dist/notify-server.js +26 -7
- package/dist/util/sanitize.js +73 -0
- package/package.json +1 -1
package/dist/i18n/zh.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const zh = {
|
|
2
2
|
tool: {
|
|
3
|
-
"tool.cli.desc": "CLI 风格的浏览器自动化控制:单个字符串命令行,如 \"navigate --url https://...\" 或 \"help\"。省略列出全部命令。screenshot 带 --selector
|
|
3
|
+
"tool.cli.desc": "CLI 风格的浏览器自动化控制:单个字符串命令行,如 \"navigate --url https://...\" 或 \"help\"。省略列出全部命令。screenshot 带 --selector 会先自动滚动到元素再截取。浏览器进程由本工具自动管理;请勿直接执行 bt-shell 可执行文件(会造成多实例与文件锁冲突)。",
|
|
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 值 ...]\"",
|
|
@@ -12,25 +12,28 @@ const zh = {
|
|
|
12
12
|
"cli.example.4": "bt_cli({ args: \"fill --selector #q --value \\\"hello world\\\"\" })",
|
|
13
13
|
"cli.unknown": "未知命令: {cmd}",
|
|
14
14
|
"cli.invalid_args": "参数无效 {cmd}: {msg}",
|
|
15
|
+
"cli.err.timeout_invalid": "--timeout 须为正整数(毫秒,100~60000),收到:{v}",
|
|
16
|
+
"cli.err.profile_invalid_name": "配置名无效:{name}。要求 1~64 个字符,不含 / \\ : 及 < > \" | ? *,不以点开头,且不是 Windows 保留名(CON/PRN/AUX/NUL/COM1-9/LPT1-9)。",
|
|
17
|
+
"cli.err.file_outside_tmp": "拒绝读取插件临时目录之外的 @file: {path}",
|
|
15
18
|
"cli.failed": "命令 {cmd} 失败: {msg}",
|
|
16
19
|
"cli.cmd.navigate": "导航浏览器到 URL",
|
|
17
|
-
"cli.cmd.click": "
|
|
18
|
-
"cli.cmd.fill": "
|
|
19
|
-
"cli.cmd.clear": "
|
|
20
|
-
"cli.cmd.select": "
|
|
21
|
-
"cli.cmd.hover": "
|
|
22
|
-
"cli.cmd.drag": "
|
|
23
|
-
"cli.cmd.press_key": "
|
|
24
|
-
"cli.cmd.upload_file": "
|
|
25
|
-
"cli.cmd.screenshot": "截取页面/元素截图(返回图片;--selector
|
|
26
|
-
"cli.cmd.evaluate": "在页面执行 JS
|
|
20
|
+
"cli.cmd.click": "点击页面元素;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
21
|
+
"cli.cmd.fill": "填写输入框;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
22
|
+
"cli.cmd.clear": "清空输入框;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
23
|
+
"cli.cmd.select": "选择下拉框选项;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
24
|
+
"cli.cmd.hover": "悬停到元素;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
25
|
+
"cli.cmd.drag": "拖拽元素到目标;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
26
|
+
"cli.cmd.press_key": "按下键盘按键;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
27
|
+
"cli.cmd.upload_file": "上传文件到输入框;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
28
|
+
"cli.cmd.screenshot": "截取页面/元素截图(返回图片;--selector 会先滚动到元素再截取);可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
29
|
+
"cli.cmd.evaluate": "在页面执行 JS,返回结果;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
27
30
|
"cli.cmd.get_visible_text": "获取页面可见文本",
|
|
28
31
|
"cli.cmd.get_visible_html": "获取页面 HTML 结构",
|
|
29
32
|
"cli.cmd.console_logs": "获取浏览器控制台日志",
|
|
30
33
|
"cli.cmd.go_back": "浏览器后退",
|
|
31
34
|
"cli.cmd.go_forward": "浏览器前进",
|
|
32
|
-
"cli.cmd.resize": "
|
|
33
|
-
"cli.cmd.set_device": "应用设备预设(不带 name
|
|
35
|
+
"cli.cmd.resize": "调整页面内容区尺寸(视口,非 OS 窗口;自动折算窗口高+工具栏 72px;下限 360×360,低于下限会被钳制)",
|
|
36
|
+
"cli.cmd.set_device": "应用设备预设(不带 name 列出预设;预设尺寸为内容区(视口)尺寸)",
|
|
34
37
|
"cli.cmd.devtools": "打开/关闭开发者工具(open/close/toggle)",
|
|
35
38
|
"cli.cmd.reload": "刷新当前页面",
|
|
36
39
|
"cli.cmd.open_window": "打开浏览器窗口",
|
|
@@ -39,57 +42,138 @@ const zh = {
|
|
|
39
42
|
"cli.cmd.scroll": "滚动页面",
|
|
40
43
|
"cli.cmd.wait_for_selector": "等待元素出现",
|
|
41
44
|
"cli.cmd.click_and_switch_tab": "点击链接并切换到新标签",
|
|
42
|
-
"cli.cmd.iframe_click": "在 iframe
|
|
43
|
-
"cli.cmd.iframe_fill": "在 iframe
|
|
45
|
+
"cli.cmd.iframe_click": "在 iframe 内点击元素;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
46
|
+
"cli.cmd.iframe_fill": "在 iframe 内填写输入框;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
44
47
|
"cli.cmd.get_browser_status": "检查浏览器是否打开及当前页面",
|
|
45
48
|
"cli.cmd.list_tabs": "列出所有打开的标签",
|
|
46
49
|
"cli.cmd.switch_tab": "按索引切换标签",
|
|
47
50
|
"cli.cmd.new_tab": "打开新标签",
|
|
48
51
|
"cli.cmd.close_tab": "关闭标签(省略=当前)",
|
|
49
|
-
"cli.cmd.get_element_state": "
|
|
50
|
-
"cli.cmd.scroll_to_element": "
|
|
51
|
-
"cli.cmd.get_dropdown_options": "
|
|
52
|
+
"cli.cmd.get_element_state": "元素存在/可见/尺寸/状态;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
53
|
+
"cli.cmd.scroll_to_element": "滚动到元素可见;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
54
|
+
"cli.cmd.get_dropdown_options": "列出下拉框选项;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
52
55
|
"cli.cmd.custom_user_agent": "设置自定义 User-Agent",
|
|
53
56
|
"cli.cmd.expect_response": "开始监听 HTTP 响应模式",
|
|
54
57
|
"cli.cmd.assert_response": "检查期望响应是否匹配",
|
|
55
|
-
"cli.cmd.get_accessibility_tree": "
|
|
58
|
+
"cli.cmd.get_accessibility_tree": "获取可访问性树;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
56
59
|
"cli.cmd.list_records": "列出面板批注记录",
|
|
57
60
|
"cli.cmd.read_record_content": "按 id 读取批注记录",
|
|
58
61
|
"cli.cmd.fake_audio": "向 fake 麦克风注入音频(tone/seq/dtmf/noise/audio/ambient/stop)",
|
|
59
62
|
"cli.cmd.fake_video": "向 fake 摄像头注入画面(image/video/auto/stop)",
|
|
60
|
-
"cli.cmd.profile": "列出/切换/删除用户配置(--set <name>
|
|
63
|
+
"cli.cmd.profile": "列出/切换/删除用户配置(--set <name> 切换默认配置,影响后续新会话、不重启运行中的浏览器;--delete 删除非 default、非当前激活配置)",
|
|
61
64
|
"cli.cmd.exports": "显示导出目录 + Edge/Chrome 密码/书签导出引导",
|
|
62
65
|
"cli.cmd.lookup": "在密码 CSV 中查找站点,返回 @file: 路径(密码不进上下文)",
|
|
66
|
+
// ---- 诊断型 note(命令输出的追加说明) ----
|
|
67
|
+
"cli.note.degraded": " (已降级: {reason})",
|
|
68
|
+
"cli.note.not_ready": " ({ms}ms 内未就绪{rs})",
|
|
69
|
+
"cli.note.scroll_unstable": " ({ms}ms 内滚动位置未稳定)",
|
|
70
|
+
"cli.note.reached": " (元素到达: {where}, {ms}ms{why})",
|
|
71
|
+
"cli.note.beyond": " (元素大于视口,已越界截全)",
|
|
72
|
+
"cli.note.timeout_clamped": " (已按边界钳制为 {ms}ms)",
|
|
73
|
+
// ---- 命令结果文案 ----
|
|
74
|
+
"cli.out.navigate.install_failed": "安装失败:{error}。请重试。",
|
|
75
|
+
"cli.out.navigate.installing": "正在安装 {name}({progress})。请稍后重试。",
|
|
76
|
+
"cli.out.navigate.ok": "已导航到: {url}",
|
|
77
|
+
"cli.out.click": "已点击",
|
|
78
|
+
"cli.out.fill": "已填写",
|
|
79
|
+
"cli.out.clear": "已清空",
|
|
80
|
+
"cli.out.select": "已选择",
|
|
81
|
+
"cli.out.hover": "已悬停",
|
|
82
|
+
"cli.out.drag": "已拖拽",
|
|
83
|
+
"cli.out.press_key": "已按键: {key}",
|
|
84
|
+
"cli.out.upload_file": "已上传",
|
|
85
|
+
"cli.out.screenshot": "截图完成{where}",
|
|
86
|
+
"cli.out.screenshot.element": "(元素: {sel})",
|
|
87
|
+
"cli.out.screenshot.fullpage": "(整视口)",
|
|
88
|
+
"cli.out.no_visible_text": "(无可见文本)",
|
|
89
|
+
"cli.out.no_visible_html": "(无可见 HTML)",
|
|
90
|
+
"cli.out.html_truncated": "…(已在 maxLength={n} 处截断)",
|
|
91
|
+
"cli.out.no_logs": "(无日志)",
|
|
92
|
+
"cli.out.go_back": "已后退,当前 URL: {url}",
|
|
93
|
+
"cli.out.go_forward": "已前进,当前 URL: {url}",
|
|
94
|
+
"cli.out.resize": "内容区已调整为 {w}x{h}",
|
|
95
|
+
"cli.out.resize_clamped": "(已钳制到下限 360x360)",
|
|
96
|
+
"cli.out.device_list_header": "可用设备预设:",
|
|
97
|
+
"cli.out.device_applied": "已应用设备预设: {name}({w}x{h} 内容区)\nUser-Agent: {ua}",
|
|
98
|
+
"cli.out.devtools_open": "开发者工具已打开",
|
|
99
|
+
"cli.out.devtools_closed": "开发者工具已关闭",
|
|
100
|
+
// Windows(wry)无法真正关闭 DevTools:如实反馈,提示用 F12 手动切换
|
|
101
|
+
"cli.out.devtools_unsupported": "当前平台不支持关闭 DevTools(wry 限制);可用 F12 手动切换",
|
|
102
|
+
"cli.out.reload": "页面已刷新: {url}",
|
|
103
|
+
// 后端返回体无 url(Rust 侧标签无最后导航 URL)时的降级文案,避免输出 undefined
|
|
104
|
+
"cli.out.reload_nourl": "页面已刷新",
|
|
105
|
+
"cli.out.open_window": "浏览器窗口已打开",
|
|
106
|
+
"cli.out.close_already": "浏览器已关闭",
|
|
107
|
+
"cli.out.close_done": "浏览器已关闭",
|
|
108
|
+
"cli.out.notify_shown": "通知已显示",
|
|
109
|
+
"cli.out.scroll": "已向{dir}滚动 {n}px",
|
|
110
|
+
"cli.out.wait_appeared": "元素已出现",
|
|
111
|
+
"cli.out.click_switch_tab": "已点击 {sel},当前 URL: {url}",
|
|
112
|
+
"cli.out.iframe_click": "已在 iframe 内点击",
|
|
113
|
+
"cli.out.iframe_fill": "已在 iframe 内填写",
|
|
114
|
+
"cli.out.status.not_running": "浏览器未运行。\nbt-shell: {bin}\n需要时请调用 open_window 打开(其它工具不会自动重开)。",
|
|
115
|
+
"cli.out.status.installing": "正在安装 {list}。",
|
|
116
|
+
"cli.out.status.not_open": "浏览器在运行但没有窗口。请调用 open_window 打开。",
|
|
117
|
+
"cli.out.status.open": "浏览器已打开\n标题: {title}\nURL: {url}\n标签数: {n}",
|
|
118
|
+
"cli.out.tabs_none": "(无标签)",
|
|
119
|
+
"cli.out.tabs_header": "标签({n}):",
|
|
120
|
+
"cli.out.switch_tab": "已切换到标签 #{i}: {url}",
|
|
121
|
+
"cli.out.new_tab": "已打开新标签: {url}",
|
|
122
|
+
"cli.out.close_tab": "已关闭标签 #{i}",
|
|
123
|
+
"cli.out.close_tab_current": "已关闭当前标签",
|
|
124
|
+
"cli.out.element_not_found": "未找到元素: {sel}",
|
|
125
|
+
"cli.out.element_state": "元素 <{tag}>: {sel}\n可见: {visible}{text}\n矩形: {rect}",
|
|
126
|
+
"cli.out.scroll_to_element": "已滚动到元素",
|
|
127
|
+
"cli.out.dropdown_none": "未找到 select 或无可选项: {sel}",
|
|
128
|
+
"cli.out.ua_set": "User-Agent 已设置",
|
|
129
|
+
"cli.out.expect_response": "开始监听匹配: {url}。用 command=assert_response 检查。",
|
|
130
|
+
"cli.out.assert_matched": "响应匹配: {url}({status})",
|
|
131
|
+
"cli.out.assert_none": "尚无响应",
|
|
132
|
+
"cli.out.no_ax": "(无可访问性信息)",
|
|
133
|
+
"cli.out.no_records": "(无记录)",
|
|
134
|
+
"cli.out.record_not_found": "(记录 #{id} 不存在)",
|
|
135
|
+
"cli.out.record_image": "\n图片: {kb}KB base64",
|
|
136
|
+
"cli.out.record_image_saved": "\n图片: {kb}KB base64(已保存: {path})",
|
|
137
|
+
"cli.out.record_note_none": "(无说明)",
|
|
138
|
+
"cli.out.fake_audio": "模拟麦克风音频: {injected}",
|
|
139
|
+
"cli.out.fake_video": "模拟摄像头画面: {injected}",
|
|
140
|
+
"cli.out.profile_no_delete_default": "不能删除默认配置",
|
|
141
|
+
"cli.out.profile_no_delete_active": "不能删除当前激活配置;请先切换到其它配置(profile --set <name>)",
|
|
142
|
+
"cli.out.profile_not_found": "未找到配置: {name}",
|
|
143
|
+
"cli.out.profile_deleted": "已删除配置: {name}",
|
|
144
|
+
"cli.out.profile_switched": "已切换默认配置: {name}(仅影响后续新会话的浏览器;正在运行的会话不受影响)",
|
|
145
|
+
"cli.out.profiles_none": "(暂无配置)",
|
|
146
|
+
"cli.out.profiles_header": "配置:\n{list}\n\n当前: {active}\n切换: profile --set <name>(影响后续新会话,不重启运行中的浏览器)\n删除: profile --delete <name>(非 default、非当前激活)",
|
|
147
|
+
"cli.out.exports": "导出目录: {dir}\n\n如何从 Edge/Chrome 导出:\n 密码: 设置 → 个人资料 → 密码 → ⋯ → 导出密码(CSV)\n 书签: 设置 → 个人资料 → 书签 → ⋯ → 导出(HTML)\n把导出的文件放到上面的目录,然后模型可以直接读取。\n\n不把密码读进上下文的用法:\n lookup --csv <file.csv> --url <site>\n fill --selector <input> --value @file:<path>",
|
|
148
|
+
"cli.out.lookup_usage": "用法: lookup --csv <路径> --url <站点>",
|
|
149
|
+
"cli.out.lookup_found": "找到: {user} @ {url}\n用法: fill --selector <input> --value @file:{tmp}\n(密码在临时文件中,用完即删)",
|
|
150
|
+
"cli.out.lookup_none": "未找到匹配项: {url}",
|
|
151
|
+
"cli.out.media_mode": "媒体模式: {mode}",
|
|
152
|
+
"cli.read_file_failed": "无法读取 @file: {path}: {msg}",
|
|
153
|
+
// ---- 二进制状态(describeBinaryStatus;不含任何本机绝对路径) ----
|
|
154
|
+
"bin.ready": "bt-shell 已就绪",
|
|
155
|
+
"bin.downloading": "bt-shell 正在下载({progress}%)… 稍后重试",
|
|
156
|
+
"bin.failed": "bt-shell 下载失败:{reason};可用 BT_SHELL_DOWNLOAD_BASE 换源,或用 BT_SHELL_PATH 手动指定二进制",
|
|
157
|
+
"bin.disabled": "bt-shell 自动下载已禁用(BT_SHELL_NO_DOWNLOAD=1);请设置 BT_SHELL_PATH 指定二进制(期望路径见插件日志)",
|
|
158
|
+
"bin.unsupported": "bt-shell 暂不支持当前平台:{reason}",
|
|
159
|
+
"bin.not_ready": "bt-shell 尚未就绪,请稍后重试",
|
|
160
|
+
"bin.release_not_found": "未找到该版本对应的 Release 资产(tag={tag});若这是纯插件改动请确认二进制产物仍在 x.Y.0 的 Release 中,若动了 Rust 需先升中间版本号并新开/更新对应 Release",
|
|
161
|
+
// ---- client 层抛给模型的错误 ----
|
|
162
|
+
"client.service_timeout": "浏览器服务未就绪(超时)。bt-shell 由插件自动管理,请勿直接执行二进制文件;请稍后经 bt_cli 重试(如 open_window)。",
|
|
163
|
+
"client.attach_timeout": "外部 bt-shell 在 {url} 未就绪(超时)。请检查 BT_SHELL_URL/BT_SHELL_PORT,且 shell 正在运行。",
|
|
164
|
+
"client.not_configured": "服务未配置",
|
|
165
|
+
"client.service_error": "服务错误",
|
|
166
|
+
"client.auth_rejected": "本地浏览器 API 拒绝鉴权(HTTP 401/403)。请调用 open_window 重新打开浏览器。",
|
|
167
|
+
"client.bad_response": "浏览器服务返回了无法解析的响应(非 JSON)。未判定为已关闭,请重试该调用。",
|
|
168
|
+
"client.bt_shell_path_missing": "BT_SHELL_PATH 指向的二进制不存在(路径见环境变量配置)",
|
|
169
|
+
"client.spawn_failed": "bt-shell 进程启动失败(请稍后经 bt_cli 重试;勿直接执行二进制文件)",
|
|
170
|
+
"client.session_closed_during_start": "启动期间已收到关闭指令,该浏览器实例已终止。如需使用请调用 open_window。",
|
|
171
|
+
"client.attach_gone": "附着的外部 bt-shell 在 {url} 已断开(附着模式不接管进程,请自行重启该 shell)。",
|
|
172
|
+
"client.attach_need_token": "附着模式需要鉴权令牌:请设置环境变量 BT_SHELL_TOKEN,并让外部 bt-shell 用同一令牌启动(启动参数 --token <token>,或设置同值的 BT_SHELL_TOKEN)。",
|
|
173
|
+
"client.attach_bad_token": "外部 shell 拒绝鉴权:BT_SHELL_TOKEN 与 shell 启动时的 --token/BT_SHELL_TOKEN 不一致。",
|
|
174
|
+
"client.browser_closed": "浏览器已关闭。请先调用 open_window 打开后再试。",
|
|
63
175
|
"tool.set_media_mode.desc": "切换摄像头/麦克风模式:simulate(模拟设备,默认)或 real(真实设备,无设备自动回退模拟)。不带参数时查询当前模式。",
|
|
64
176
|
"tool.set_media_mode.arg.mode": "模式:simulate 或 real(省略则查询当前)",
|
|
65
177
|
},
|
|
66
|
-
panel: {
|
|
67
|
-
"panel.title": "工具面板",
|
|
68
|
-
"panel.pick_hint": "悬停高亮页面元素\n点击选中进行标注",
|
|
69
|
-
"panel.annotation_placeholder": "添加批注...",
|
|
70
|
-
"panel.action_none": "无操作",
|
|
71
|
-
"panel.action_click": "点击",
|
|
72
|
-
"panel.action_fill": "填写",
|
|
73
|
-
"panel.action_value_placeholder": "值...",
|
|
74
|
-
"panel.send": "发送",
|
|
75
|
-
"panel.send_all": "发送全部",
|
|
76
|
-
"panel.close": "关闭",
|
|
77
|
-
"panel.send_failed": "发送失败",
|
|
78
|
-
"panel.annotate": "批注",
|
|
79
|
-
"panel.screenshot_btn": "截图",
|
|
80
|
-
"panel.screenshot_sent": "截图已发送",
|
|
81
|
-
"panel.screenshot_note": "添加说明...",
|
|
82
|
-
"panel.screenshot_hint": "双击截取全屏",
|
|
83
|
-
"panel.screenshot_stored": "截图已保存",
|
|
84
|
-
"panel.screenshot_failed": "截图失败",
|
|
85
|
-
"panel.cancel": "取消",
|
|
86
|
-
"panel.confirm": "确认",
|
|
87
|
-
"panel.annotation_required": "请输入批注文字",
|
|
88
|
-
"panel.annotation_stored": "批注已保存",
|
|
89
|
-
"panel.no_records": "当前记录为空",
|
|
90
|
-
"panel.sent_records": "已发送 {n} 条记录",
|
|
91
|
-
"panel.send_records_failed": "发送失败",
|
|
92
|
-
"panel.delete": "删除",
|
|
93
|
-
},
|
|
94
178
|
};
|
|
95
179
|
export default zh;
|