@xiaoqiong0v0/opencode-browser-tool 1.11.1 → 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/README.md +116 -22
- package/dist/client.js +14 -1
- package/dist/config/index.js +144 -1
- package/dist/i18n/en.js +54 -15
- package/dist/i18n/zh.js +55 -16
- package/dist/index.js +399 -18
- package/dist/util/eval-items.js +181 -0
- package/dist/util/inject-rules.js +227 -0
- package/dist/util/log-format.js +248 -0
- package/dist/util/type-text.js +57 -0
- package/package.json +1 -1
package/dist/i18n/en.js
CHANGED
|
@@ -4,19 +4,42 @@ 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:
|
|
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\" })",
|
|
11
11
|
"cli.example.2": "bt_cli({ args: \"navigate --url https://example.com\" })",
|
|
12
12
|
"cli.example.3": "bt_cli({ args: \"click --selector #submit\" })",
|
|
13
13
|
"cli.example.4": "bt_cli({ args: \"fill --selector #q --value \\\"hello world\\\"\" })",
|
|
14
|
+
"cli.example.5": "bt_cli({ args: \"evaluate \\\"1+1\\\" @file:scripts/hook.js\" })",
|
|
14
15
|
"cli.unknown": "Unknown command: {cmd}",
|
|
15
16
|
"cli.invalid_args": "Invalid args for {cmd}: {msg}",
|
|
16
17
|
"cli.err.flag_not_number": "Flag --{flag} needs a number, got: {v}",
|
|
17
18
|
"cli.err.timeout_invalid": "--timeout must be a positive integer in ms (100-60000), got: {v}",
|
|
18
19
|
"cli.err.profile_invalid_name": "Invalid profile name: {name}. Use 1-64 chars, no / \\ : or < > \" | ? *, must not start with a dot, and must not be a Windows reserved name (CON/PRN/AUX/NUL/COM1-9/LPT1-9).",
|
|
19
20
|
"cli.err.file_outside_tmp": "Refusing to read @file outside the plugin temp directory: {path}",
|
|
21
|
+
"cli.err.eval_script_conflict": "evaluate: --script cannot be combined with positional items (use one or the other; positional order defines execution order)",
|
|
22
|
+
"cli.err.eval_no_items": "evaluate: no script given. Pass inline JS text or @file:<path> items (or --script \"...\" for a single script)",
|
|
23
|
+
"cli.err.eval_file_outside": "evaluate: refusing to read @file outside the workspace / plugin temp directories: {path}",
|
|
24
|
+
"cli.err.eval_file_too_large": "evaluate: @file exceeds the per-file limit of {kb} KiB: {path}",
|
|
25
|
+
"cli.err.eval_total_too_large": "evaluate: @file scripts exceed the total limit of {kb} KiB: {path}",
|
|
26
|
+
"cli.err.eval_not_a_file": "not a regular file",
|
|
27
|
+
"cli.err.inject_match_required": "inject add: --match is required (glob with * wildcards, e.g. \"*example.com*\", or \"re:<regex>\")",
|
|
28
|
+
"cli.err.inject_no_items": "inject add: no content given. Pass at least one --file <path> or --text <code>",
|
|
29
|
+
"cli.err.inject_file_outside": "inject add: refusing to read --file outside the workspace / plugin temp directories: {path}",
|
|
30
|
+
"cli.err.inject_file_too_large": "inject add: --file exceeds the per-file limit of {kb} KiB: {path}",
|
|
31
|
+
"cli.err.inject_rule_too_large": "inject add: this rule's items exceed the limit of {kb} KiB: {path}",
|
|
32
|
+
"cli.err.inject_items_too_large": "inject add: this rule's items exceed the limit of {kb} KiB (split the code across several rules)",
|
|
33
|
+
"cli.err.inject_read_failed": "inject add: cannot read --file: {path}: {msg}",
|
|
34
|
+
"cli.err.inject_id_required": "inject: --id is required for remove / enable / disable",
|
|
35
|
+
"cli.err.inject_url_required": "inject test: --url is required",
|
|
36
|
+
"cli.err.inject_unknown_action": "inject: unknown action \"{action}\". Use add / list / remove / clear / enable / disable / test",
|
|
37
|
+
"cli.err.type_text_required": "type: --text is required and must be non-empty (pass inline text or @file:<path>)",
|
|
38
|
+
"cli.err.type_text_too_large": "type: text exceeds the limit of {kb} KiB (split it into several type calls)",
|
|
39
|
+
"cli.err.type_file_outside": "type: refusing to read @file outside the workspace / plugin temp directories: {path}",
|
|
40
|
+
"cli.err.type_file_too_large": "type: @file exceeds the per-file limit of {kb} KiB: {path}",
|
|
41
|
+
"cli.err.type_file_total_too_large": "type: @file exceeds the total limit of {kb} KiB: {path}",
|
|
42
|
+
"cli.err.type_read_failed": "type: cannot read @file: {path}: {msg}",
|
|
20
43
|
"cli.failed": "Command {cmd} failed: {msg}",
|
|
21
44
|
"cli.cmd.navigate": "Navigate browser to a URL",
|
|
22
45
|
"cli.cmd.click": "Click an element; optional --timeout ms (100-60000) caps this call's wait budget, timeout errors explicitly",
|
|
@@ -26,17 +49,20 @@ const en = {
|
|
|
26
49
|
"cli.cmd.hover": "Hover over an element; optional --timeout ms (100-60000) caps this call's wait budget, timeout errors explicitly",
|
|
27
50
|
"cli.cmd.drag": "Drag element to a target; optional --timeout ms (100-60000) caps this call's wait budget, timeout errors explicitly",
|
|
28
51
|
"cli.cmd.press_key": "Press a keyboard key; optional --timeout ms (100-60000) caps this call's wait budget, timeout errors explicitly",
|
|
52
|
+
"cli.cmd.type": "Insert text at the current focus WITHOUT clearing existing content (use this for xterm/terminal/contenteditable; use fill for form replacement). --selector focuses that element first; --enter presses Enter after inserting; --text accepts @file:<path> (workspace dir or plugin tmp only, content never enters the model context); optional --timeout ms (100-60000) caps this call's wait budget",
|
|
29
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",
|
|
30
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",
|
|
31
|
-
"cli.cmd.evaluate": "Execute JS in the page
|
|
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); 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",
|
|
32
57
|
"cli.cmd.get_visible_text": "Get visible page text",
|
|
33
58
|
"cli.cmd.get_visible_html": "Get page HTML structure",
|
|
34
|
-
"cli.cmd.console_logs": "Get
|
|
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
|
+
"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)",
|
|
35
61
|
"cli.cmd.go_back": "Go back in history",
|
|
36
62
|
"cli.cmd.go_forward": "Go forward in history",
|
|
37
|
-
"cli.cmd.resize": "Resize the page content area (viewport
|
|
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)",
|
|
38
64
|
"cli.cmd.set_device": "Apply device preset (no name = list presets; preset sizes are content-area/viewport sizes)",
|
|
39
|
-
"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",
|
|
40
66
|
"cli.cmd.reload": "Reload the current page",
|
|
41
67
|
"cli.cmd.open_window": "Open the browser window",
|
|
42
68
|
"cli.cmd.close": "Close the browser",
|
|
@@ -55,8 +81,8 @@ const en = {
|
|
|
55
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",
|
|
56
82
|
"cli.cmd.get_dropdown_options": "List dropdown options; optional --timeout ms (100-60000) caps this call's wait budget, timeout errors explicitly",
|
|
57
83
|
"cli.cmd.custom_user_agent": "Set a custom User-Agent",
|
|
58
|
-
"cli.cmd.expect_response": "
|
|
59
|
-
"cli.cmd.assert_response": "Check
|
|
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",
|
|
60
86
|
"cli.cmd.get_accessibility_tree": "Get the accessibility tree; optional --timeout ms (100-60000) caps this call's wait budget, timeout errors explicitly",
|
|
61
87
|
"cli.cmd.list_records": "List annotation records in the panel",
|
|
62
88
|
"cli.cmd.read_record_content": "Read an annotation record by id",
|
|
@@ -83,6 +109,9 @@ const en = {
|
|
|
83
109
|
"cli.out.hover": "Hovered",
|
|
84
110
|
"cli.out.drag": "Dragged",
|
|
85
111
|
"cli.out.press_key": "Pressed: {key}",
|
|
112
|
+
"cli.out.type": "typed {n} char(s) into {target}",
|
|
113
|
+
"cli.out.type.focused": "focused element",
|
|
114
|
+
"cli.out.type.enter": " + Enter",
|
|
86
115
|
"cli.out.upload_file": "Uploaded",
|
|
87
116
|
"cli.out.screenshot": "Screenshot taken{where}",
|
|
88
117
|
"cli.out.screenshot.element": " (element: {sel})",
|
|
@@ -90,7 +119,17 @@ const en = {
|
|
|
90
119
|
"cli.out.no_visible_text": "(no visible text)",
|
|
91
120
|
"cli.out.no_visible_html": "(no visible html)",
|
|
92
121
|
"cli.out.html_truncated": "…(truncated at maxLength={n})",
|
|
93
|
-
"cli.out.
|
|
122
|
+
"cli.out.console_empty": "(no console logs — the page may have produced none, may have navigated (logs are per tab and kept across navigation), or the logs may be in another tab; try --tab or list_tabs)",
|
|
123
|
+
"cli.out.network_empty": "(no network requests — the page may have made none, may have navigated, or the requests may be in another tab (also check whether --clear just emptied the stream); try --tab or list_tabs)",
|
|
124
|
+
// ---- Log stream formatting fragments (technical tokens stay identical across languages) ----
|
|
125
|
+
"cli.out.inject_empty": "No inject rules yet. Add one with: inject add --match \"*host*\" --file hook.js",
|
|
126
|
+
"cli.out.inject_removed": "inject: removed {id} ({n} rule(s) left)",
|
|
127
|
+
"cli.out.inject_enabled": "inject: enabled {id} ({n} rule(s) total)",
|
|
128
|
+
"cli.out.inject_disabled": "inject: disabled {id} ({n} rule(s) total)",
|
|
129
|
+
"cli.out.inject_cleared": "inject: all rules cleared (add new ones with `inject add`)",
|
|
130
|
+
"cli.log.failed": "failed: {reason}",
|
|
131
|
+
"cli.log.failed_unknown": "request failed",
|
|
132
|
+
"cli.log.dropped": "({n} dropped by buffer limit)",
|
|
94
133
|
"cli.out.go_back": "Went back, current URL: {url}",
|
|
95
134
|
"cli.out.go_forward": "Went forward, current URL: {url}",
|
|
96
135
|
"cli.out.resize": "Resized content to {w}x{h}",
|
|
@@ -99,8 +138,8 @@ const en = {
|
|
|
99
138
|
"cli.out.device_applied": "Device preset applied: {name} ({w}x{h} content)\nUser-Agent: {ua}",
|
|
100
139
|
"cli.out.devtools_open": "Devtools opened",
|
|
101
140
|
"cli.out.devtools_closed": "Devtools closed",
|
|
102
|
-
//
|
|
103
|
-
"cli.out.devtools_unsupported": "Closing DevTools is not supported on this platform
|
|
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",
|
|
104
143
|
"cli.out.reload": "Page reloaded: {url}",
|
|
105
144
|
// Fallback when the backend response carries no url (no last-navigated URL on the tab) — keeps output from showing undefined
|
|
106
145
|
"cli.out.reload_nourl": "Page reloaded",
|
|
@@ -113,7 +152,7 @@ const en = {
|
|
|
113
152
|
"cli.out.click_switch_tab": "Clicked {sel}, current URL: {url}",
|
|
114
153
|
"cli.out.iframe_click": "Clicked in iframe",
|
|
115
154
|
"cli.out.iframe_fill": "Filled in iframe",
|
|
116
|
-
"cli.out.status.not_running": "Browser is not running.\
|
|
155
|
+
"cli.out.status.not_running": "Browser is not running.\nCall open_window when needed (other tools will not reopen it automatically).",
|
|
117
156
|
"cli.out.status.installing": "Installing {list}.",
|
|
118
157
|
"cli.out.status.not_open": "The browser is running but has no window. Call open_window to open one.",
|
|
119
158
|
"cli.out.status.open": "Browser is open\nTitle: {title}\nURL: {url}\nTabs: {n}",
|
|
@@ -128,7 +167,7 @@ const en = {
|
|
|
128
167
|
"cli.out.scroll_to_element": "Scrolled to element",
|
|
129
168
|
"cli.out.dropdown_none": "Select not found or no options: {sel}",
|
|
130
169
|
"cli.out.ua_set": "User-Agent set",
|
|
131
|
-
"cli.out.expect_response": "
|
|
170
|
+
"cli.out.expect_response": "Marked start point for matching: {url}. Use assert_response later to check for a match.",
|
|
132
171
|
"cli.out.assert_matched": "Response matched: {url} ({status})",
|
|
133
172
|
"cli.out.assert_none": "No response yet",
|
|
134
173
|
"cli.out.no_ax": "(no accessibility info)",
|
|
@@ -159,7 +198,7 @@ const en = {
|
|
|
159
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)",
|
|
160
199
|
"bin.unsupported": "bt-shell does not support this platform yet: {reason}",
|
|
161
200
|
"bin.not_ready": "bt-shell is not ready yet, retry later",
|
|
162
|
-
"bin.release_not_found": "No
|
|
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",
|
|
163
202
|
// ---- client-layer errors surfaced to the model ----
|
|
164
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).",
|
|
165
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.",
|
|
@@ -171,8 +210,8 @@ const en = {
|
|
|
171
210
|
"client.spawn_failed": "Failed to start the bt-shell process (retry via bt_cli later)",
|
|
172
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.",
|
|
173
212
|
"client.attach_gone": "Attached external bt-shell at {url} is gone (attach mode does not own that process; restart the shell yourself).",
|
|
174
|
-
"client.attach_need_token": "Attach mode requires an auth token: set BT_SHELL_TOKEN and start the external
|
|
175
|
-
"client.attach_bad_token": "External
|
|
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.",
|
|
176
215
|
"client.browser_closed": "Browser is closed. Call open_window to open it first, then retry.",
|
|
177
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.",
|
|
178
217
|
"tool.set_media_mode.arg.mode": "Mode: simulate or real (omit to query current)",
|
package/dist/i18n/zh.js
CHANGED
|
@@ -4,19 +4,42 @@ 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\" })",
|
|
11
11
|
"cli.example.2": "bt_cli({ args: \"navigate --url https://example.com\" })",
|
|
12
12
|
"cli.example.3": "bt_cli({ args: \"click --selector #submit\" })",
|
|
13
13
|
"cli.example.4": "bt_cli({ args: \"fill --selector #q --value \\\"hello world\\\"\" })",
|
|
14
|
+
"cli.example.5": "bt_cli({ args: \"evaluate \\\"1+1\\\" @file:scripts/hook.js\" })",
|
|
14
15
|
"cli.unknown": "未知命令: {cmd}",
|
|
15
16
|
"cli.invalid_args": "参数无效 {cmd}: {msg}",
|
|
16
17
|
"cli.err.flag_not_number": "参数 --{flag} 需要数字,收到:{v}",
|
|
17
18
|
"cli.err.timeout_invalid": "--timeout 须为正整数(毫秒,100~60000),收到:{v}",
|
|
18
19
|
"cli.err.profile_invalid_name": "配置名无效:{name}。要求 1~64 个字符,不含 / \\ : 及 < > \" | ? *,不以点开头,且不是 Windows 保留名(CON/PRN/AUX/NUL/COM1-9/LPT1-9)。",
|
|
19
20
|
"cli.err.file_outside_tmp": "拒绝读取插件临时目录之外的 @file: {path}",
|
|
21
|
+
"cli.err.eval_script_conflict": "evaluate: --script 不能与位置参数项同时使用(二选一;只给 --script 即单个脚本,多个项由位置参数顺序决定执行顺序)",
|
|
22
|
+
"cli.err.eval_no_items": "evaluate: 缺少脚本。请传内联 JS 文本或 @file:<路径> 项(单个脚本也可以用 --script \"...\")",
|
|
23
|
+
"cli.err.eval_file_outside": "evaluate: 拒绝读取工作区 / 插件临时目录之外的 @file: {path}",
|
|
24
|
+
"cli.err.eval_file_too_large": "evaluate: @file 超过单文件上限 {kb} KiB: {path}",
|
|
25
|
+
"cli.err.eval_total_too_large": "evaluate: @file 脚本合计超过上限 {kb} KiB: {path}",
|
|
26
|
+
"cli.err.eval_not_a_file": "不是普通文件",
|
|
27
|
+
"cli.err.inject_match_required": "inject add: 必须给 --match(glob 用 * 通配,如 \"*example.com*\";或用 \"re:<正则>\")",
|
|
28
|
+
"cli.err.inject_no_items": "inject add: 没有内容。至少给一个 --file <路径> 或 --text <代码>",
|
|
29
|
+
"cli.err.inject_file_outside": "inject add: 拒绝读取工作区 / 插件临时目录之外的 --file: {path}",
|
|
30
|
+
"cli.err.inject_file_too_large": "inject add: --file 超过单文件上限 {kb} KiB: {path}",
|
|
31
|
+
"cli.err.inject_rule_too_large": "inject add: 该规则的 items 合计超过上限 {kb} KiB: {path}",
|
|
32
|
+
"cli.err.inject_items_too_large": "inject add: 该规则的 items 合计超过上限 {kb} KiB(请拆成多条规则)",
|
|
33
|
+
"cli.err.inject_read_failed": "inject add: 读取 --file 失败: {path}: {msg}",
|
|
34
|
+
"cli.err.inject_id_required": "inject: remove / enable / disable 必须给 --id",
|
|
35
|
+
"cli.err.inject_url_required": "inject test: 必须给 --url",
|
|
36
|
+
"cli.err.inject_unknown_action": "inject: 未知子动作 \"{action}\"。可用 add / list / remove / clear / enable / disable / test",
|
|
37
|
+
"cli.err.type_text_required": "type: 必须提供非空的 --text(可直接给文本,或用 @file:<路径>)",
|
|
38
|
+
"cli.err.type_text_too_large": "type: 文本超过上限 {kb} KiB(请拆成多次 type 调用)",
|
|
39
|
+
"cli.err.type_file_outside": "type: 拒绝读取工作区 / 插件临时目录之外的 @file: {path}",
|
|
40
|
+
"cli.err.type_file_too_large": "type: @file 超过单文件上限 {kb} KiB: {path}",
|
|
41
|
+
"cli.err.type_file_total_too_large": "type: @file 合计超过上限 {kb} KiB: {path}",
|
|
42
|
+
"cli.err.type_read_failed": "type: 无法读取 @file: {path}: {msg}",
|
|
20
43
|
"cli.failed": "命令 {cmd} 失败: {msg}",
|
|
21
44
|
"cli.cmd.navigate": "导航浏览器到 URL",
|
|
22
45
|
"cli.cmd.click": "点击页面元素;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
@@ -26,17 +49,20 @@ const zh = {
|
|
|
26
49
|
"cli.cmd.hover": "悬停到元素;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
27
50
|
"cli.cmd.drag": "拖拽元素到目标;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
28
51
|
"cli.cmd.press_key": "按下键盘按键;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
52
|
+
"cli.cmd.type": "向当前焦点插入文本(不清空已有内容;xterm/终端/contenteditable 用这个,表单替换用 fill)。--selector 先聚焦该元素;--enter 插入后再回车;--text 支持 @file:<路径>(仅限工作区目录或插件临时目录,内容不进模型上下文);可选 --timeout ms(100~60000)限定本次等待上限",
|
|
29
53
|
"cli.cmd.upload_file": "上传文件到输入框;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
30
54
|
"cli.cmd.screenshot": "截取页面/元素截图(返回图片;--selector 会先滚动到元素再截取);可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
31
|
-
"cli.cmd.evaluate": "在页面执行 JS
|
|
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);list;remove|enable|disable --id <id>;clear;test --url <url>(只算命中、不执行)。规则随会话保存,会话结束后清理;最多 20 条、单条 ≤256 KiB,按 --order 升序执行;连续失败 3 次自动禁用",
|
|
32
57
|
"cli.cmd.get_visible_text": "获取页面可见文本",
|
|
33
58
|
"cli.cmd.get_visible_html": "获取页面 HTML 结构",
|
|
34
|
-
"cli.cmd.console_logs": "
|
|
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
|
+
"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 是第一个标签)",
|
|
35
61
|
"cli.cmd.go_back": "浏览器后退",
|
|
36
62
|
"cli.cmd.go_forward": "浏览器前进",
|
|
37
|
-
"cli.cmd.resize": "
|
|
63
|
+
"cli.cmd.resize": "调整页面内容区尺寸(视口;OS 窗口会同步调整,以内容区为准;下限 360×360,低于下限会被钳制)",
|
|
38
64
|
"cli.cmd.set_device": "应用设备预设(不带 name 列出预设;预设尺寸为内容区(视口)尺寸)",
|
|
39
|
-
"cli.cmd.devtools": "打开/关闭开发者工具(open/close/toggle
|
|
65
|
+
"cli.cmd.devtools": "打开/关闭开发者工具(open/close/toggle);部分平台不支持关闭",
|
|
40
66
|
"cli.cmd.reload": "刷新当前页面",
|
|
41
67
|
"cli.cmd.open_window": "打开浏览器窗口",
|
|
42
68
|
"cli.cmd.close": "关闭浏览器",
|
|
@@ -55,8 +81,8 @@ const zh = {
|
|
|
55
81
|
"cli.cmd.scroll_to_element": "滚动到元素可见;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
56
82
|
"cli.cmd.get_dropdown_options": "列出下拉框选项;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
57
83
|
"cli.cmd.custom_user_agent": "设置自定义 User-Agent",
|
|
58
|
-
"cli.cmd.expect_response": "
|
|
59
|
-
"cli.cmd.assert_response": "
|
|
84
|
+
"cli.cmd.expect_response": "记录期望的响应 URL 模式作为起点(不阻塞;之后用 assert_response 检查该起点之后是否有匹配)",
|
|
85
|
+
"cli.cmd.assert_response": "检查起点之后是否出现过匹配 pattern 的响应,返回最近一条;未命中给明确提示",
|
|
60
86
|
"cli.cmd.get_accessibility_tree": "获取可访问性树;可选 --timeout ms(100~60000)限定本次等待上限,超时明确报错",
|
|
61
87
|
"cli.cmd.list_records": "列出面板批注记录",
|
|
62
88
|
"cli.cmd.read_record_content": "按 id 读取批注记录",
|
|
@@ -83,6 +109,9 @@ const zh = {
|
|
|
83
109
|
"cli.out.hover": "已悬停",
|
|
84
110
|
"cli.out.drag": "已拖拽",
|
|
85
111
|
"cli.out.press_key": "已按键: {key}",
|
|
112
|
+
"cli.out.type": "已输入 {n} 个字符到 {target}",
|
|
113
|
+
"cli.out.type.focused": "当前焦点元素",
|
|
114
|
+
"cli.out.type.enter": " + Enter",
|
|
86
115
|
"cli.out.upload_file": "已上传",
|
|
87
116
|
"cli.out.screenshot": "截图完成{where}",
|
|
88
117
|
"cli.out.screenshot.element": "(元素: {sel})",
|
|
@@ -90,7 +119,17 @@ const zh = {
|
|
|
90
119
|
"cli.out.no_visible_text": "(无可见文本)",
|
|
91
120
|
"cli.out.no_visible_html": "(无可见 HTML)",
|
|
92
121
|
"cli.out.html_truncated": "…(已在 maxLength={n} 处截断)",
|
|
93
|
-
"cli.out.
|
|
122
|
+
"cli.out.console_empty": "(无控制台日志——可能页面没有产生日志、页面已导航(日志按标签保留、跨导航不清空)、或日志在其它标签;可试 --tab 或 list_tabs)",
|
|
123
|
+
"cli.out.network_empty": "(无网络请求——可能页面没有发起请求、页面已导航、或请求在其它标签(也请确认是否刚用 --clear 清空);可试 --tab 或 list_tabs)",
|
|
124
|
+
// ---- 日志流格式化片段(技术标记两种语言保持一致) ----
|
|
125
|
+
"cli.out.inject_empty": "尚无注入规则。添加示例: inject add --match \"*host*\" --file hook.js",
|
|
126
|
+
"cli.out.inject_removed": "inject: 已删除 {id}(剩余 {n} 条)",
|
|
127
|
+
"cli.out.inject_enabled": "inject: 已启用 {id}(共 {n} 条)",
|
|
128
|
+
"cli.out.inject_disabled": "inject: 已禁用 {id}(共 {n} 条)",
|
|
129
|
+
"cli.out.inject_cleared": "inject: 已清空全部规则(用 `inject add` 新增)",
|
|
130
|
+
"cli.log.failed": "失败: {reason}",
|
|
131
|
+
"cli.log.failed_unknown": "请求失败",
|
|
132
|
+
"cli.log.dropped": "(缓冲上限丢弃 {n} 条)",
|
|
94
133
|
"cli.out.go_back": "已后退,当前 URL: {url}",
|
|
95
134
|
"cli.out.go_forward": "已前进,当前 URL: {url}",
|
|
96
135
|
"cli.out.resize": "内容区已调整为 {w}x{h}",
|
|
@@ -99,10 +138,10 @@ const zh = {
|
|
|
99
138
|
"cli.out.device_applied": "已应用设备预设: {name}({w}x{h} 内容区)\nUser-Agent: {ua}",
|
|
100
139
|
"cli.out.devtools_open": "开发者工具已打开",
|
|
101
140
|
"cli.out.devtools_closed": "开发者工具已关闭",
|
|
102
|
-
//
|
|
103
|
-
"cli.out.devtools_unsupported": "当前平台不支持关闭 DevTools
|
|
141
|
+
// 部分平台无法真正关闭 DevTools:如实反馈,提示用 F12 手动切换
|
|
142
|
+
"cli.out.devtools_unsupported": "当前平台不支持关闭 DevTools;可用 F12 手动切换",
|
|
104
143
|
"cli.out.reload": "页面已刷新: {url}",
|
|
105
|
-
// 后端返回体无 url
|
|
144
|
+
// 后端返回体无 url(后端标签没有最后导航 URL)时的降级文案,避免输出 undefined
|
|
106
145
|
"cli.out.reload_nourl": "页面已刷新",
|
|
107
146
|
"cli.out.open_window": "浏览器窗口已打开",
|
|
108
147
|
"cli.out.close_already": "浏览器已关闭",
|
|
@@ -113,7 +152,7 @@ const zh = {
|
|
|
113
152
|
"cli.out.click_switch_tab": "已点击 {sel},当前 URL: {url}",
|
|
114
153
|
"cli.out.iframe_click": "已在 iframe 内点击",
|
|
115
154
|
"cli.out.iframe_fill": "已在 iframe 内填写",
|
|
116
|
-
"cli.out.status.not_running": "浏览器未运行。\
|
|
155
|
+
"cli.out.status.not_running": "浏览器未运行。\n需要时请调用 open_window 打开(其它工具不会自动重开)。",
|
|
117
156
|
"cli.out.status.installing": "正在安装 {list}。",
|
|
118
157
|
"cli.out.status.not_open": "浏览器在运行但没有窗口。请调用 open_window 打开。",
|
|
119
158
|
"cli.out.status.open": "浏览器已打开\n标题: {title}\nURL: {url}\n标签数: {n}",
|
|
@@ -128,7 +167,7 @@ const zh = {
|
|
|
128
167
|
"cli.out.scroll_to_element": "已滚动到元素",
|
|
129
168
|
"cli.out.dropdown_none": "未找到 select 或无可选项: {sel}",
|
|
130
169
|
"cli.out.ua_set": "User-Agent 已设置",
|
|
131
|
-
"cli.out.expect_response": "
|
|
170
|
+
"cli.out.expect_response": "已记录匹配起点: {url}。之后用 assert_response 检查是否出现匹配。",
|
|
132
171
|
"cli.out.assert_matched": "响应匹配: {url}({status})",
|
|
133
172
|
"cli.out.assert_none": "尚无响应",
|
|
134
173
|
"cli.out.no_ax": "(无可访问性信息)",
|
|
@@ -159,7 +198,7 @@ const zh = {
|
|
|
159
198
|
"bin.disabled": "bt-shell 自动下载已禁用(BT_SHELL_NO_DOWNLOAD=1);请设置 BT_SHELL_PATH 指定二进制(期望路径见插件日志)",
|
|
160
199
|
"bin.unsupported": "bt-shell 暂不支持当前平台:{reason}",
|
|
161
200
|
"bin.not_ready": "bt-shell 尚未就绪,请稍后重试",
|
|
162
|
-
"bin.release_not_found": "
|
|
201
|
+
"bin.release_not_found": "未找到可用的浏览器内核(该平台/版本暂无发布);可设置 BT_SHELL_PATH 指定本地文件,或配置 BT_SHELL_DOWNLOAD_BASE 换源",
|
|
163
202
|
// ---- client 层抛给模型的错误 ----
|
|
164
203
|
"client.service_timeout": "浏览器服务未就绪(超时)。bt-shell 由插件自动管理;请稍后经 bt_cli 重试(如 open_window)。",
|
|
165
204
|
"client.attach_timeout": "外部 bt-shell 在 {url} 未就绪(超时)。请检查 BT_SHELL_URL/BT_SHELL_PORT,且 shell 正在运行。",
|
|
@@ -171,8 +210,8 @@ const zh = {
|
|
|
171
210
|
"client.spawn_failed": "bt-shell 进程启动失败(请稍后经 bt_cli 重试)",
|
|
172
211
|
"client.session_closed_during_start": "启动期间已收到关闭指令,该浏览器实例已终止。如需使用请调用 open_window。",
|
|
173
212
|
"client.attach_gone": "附着的外部 bt-shell 在 {url} 已断开(附着模式不接管进程,请自行重启该 shell)。",
|
|
174
|
-
"client.attach_need_token": "附着模式需要鉴权令牌:请设置环境变量 BT_SHELL_TOKEN
|
|
175
|
-
"client.attach_bad_token": "外部 shell
|
|
213
|
+
"client.attach_need_token": "附着模式需要鉴权令牌:请设置环境变量 BT_SHELL_TOKEN,外部 shell 需用同一令牌启动。",
|
|
214
|
+
"client.attach_bad_token": "外部 shell 拒绝鉴权:令牌与 shell 启动时使用的不一致。",
|
|
176
215
|
"client.browser_closed": "浏览器已关闭。请先调用 open_window 打开后再试。",
|
|
177
216
|
"tool.set_media_mode.desc": "切换摄像头/麦克风模式:simulate(模拟设备,默认)或 real(真实设备,无设备自动回退模拟)。不带参数时查询当前模式。",
|
|
178
217
|
"tool.set_media_mode.arg.mode": "模式:simulate 或 real(省略则查询当前)",
|