yunti-browser-runtime 0.1.2 → 0.2.0

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 CHANGED
@@ -38,18 +38,42 @@ yunti-browser-runtime/
38
38
 
39
39
  ## 快速启动
40
40
 
41
+ 推荐作为 MCP 工具接入 Agent,由 Agent 自动启动本地 bridge:
42
+
41
43
  ```bash
42
- cd yunti-browser-runtime
43
- npm install
44
- npm run bridge
44
+ npm install -g yunti-browser-runtime
45
+ yunti-browser-runtime print-config -- --agent codex --human
45
46
  ```
46
47
 
47
- 安装为 npm 包后,也可以使用 CLI:
48
+ 把输出的 MCP 配置加入 Agent 后,加载浏览器扩展并刷新任意 `http` / `https` 页面即可。
49
+ 默认不需要填写 token,不需要打开扩展 popup,也不需要保存设置。
50
+
51
+ 需要独立调试 bridge 时,可以手动运行:
48
52
 
49
53
  ```bash
50
54
  yunti-browser-runtime bridge
55
+ ```
56
+
57
+ 需要查看本地运行时状态时,可以打开可选控制台:
58
+
59
+ ```bash
60
+ yunti-browser-runtime console
61
+ ```
62
+
63
+ 然后访问:
64
+
65
+ ```text
66
+ http://127.0.0.1:48887/console
67
+ ```
68
+
69
+ 控制台只展示连接页面、pending/queued 任务、最近工具 activity 和诊断数量等脱敏摘要;
70
+ 它不是必选 hub,也不会改变 Agent 的 MCP 使用路径。
71
+ `yunti-browser-runtime doctor` 的人类可读摘要也会打印这个控制台 URL。
72
+
73
+ 其他常用 CLI:
74
+
75
+ ```bash
51
76
  yunti-browser-runtime doctor
52
- yunti-browser-runtime print-config -- --agent codex --human
53
77
  yunti-browser-runtime package-extension
54
78
  ```
55
79
 
@@ -92,19 +116,25 @@ npm run doctor:json
92
116
  2. 执行:npm install -g yunti-browser-runtime
93
117
  3. 执行:yunti-browser-runtime print-config -- --agent 当前Agent名称 --human
94
118
  4. 根据输出,把 MCP server 配置加入当前 Agent 的 MCP 配置。
95
- 5. 执行:yunti-browser-runtime bridge
119
+ 5. 告诉我:当前 Agent 启动 MCP server 后会自动启动本地 bridge,一般不需要单独运行 bridge。
96
120
  6. 引导我打开 Chrome/Edge 的扩展管理页,开启开发者模式,手动加载扩展目录:
97
121
  $(npm root -g)/yunti-browser-runtime/extension
98
- 7. 告诉我扩展里默认 bridge URL 是 http://127.0.0.1:48887,本地默认不需要 token,也不需要保存设置。
122
+ 7. 告诉我:扩展默认 bridge URL 是 http://127.0.0.1:48887,本地默认不需要 token,不需要打开 popup,也不需要保存设置。
99
123
  8. 打开任意 http/https 页面并刷新。
100
124
  9. 执行:yunti-browser-runtime doctor
101
125
  10. 如果 doctor 正常,再调用 yunti_list_browser_targets 或 yunti_get_tool_usage_hints 验证你能看到浏览器页面。
102
126
 
103
- 注意:Chrome 扩展不能由 npm 静默安装,必须由我手动在浏览器扩展页加载。你要一步步告诉我点哪里、复制什么、检查什么。
127
+ 注意:Chrome 扩展不能由 npm 静默安装,必须由我手动在浏览器扩展页加载。扩展加载完成后默认立即可用,不要要求我填写 token、打开 popup 或保存设置;除非 doctor 明确提示 bridge 未运行,才让我单独执行 yunti-browser-runtime bridge。
104
128
  ```
105
129
 
106
130
  ## 安装浏览器扩展
107
131
 
132
+ npm 全局安装后,扩展目录通常是:
133
+
134
+ ```bash
135
+ $(npm root -g)/yunti-browser-runtime/extension
136
+ ```
137
+
108
138
  开发加载方式:
109
139
 
110
140
  1. 打开 `chrome://extensions` 或 `edge://extensions`。
@@ -112,11 +142,12 @@ npm run doctor:json
112
142
  3. 点击“加载已解压的扩展程序”。
113
143
  4. 选择本项目的 `extension/` 目录。
114
144
  5. 打开任意 `http` 或 `https` 页面。
115
- 6. 刷新目标页面,确认页面已连接。
145
+ 6. 刷新目标页面即可连接。
116
146
 
117
- 扩展默认使用 `http://127.0.0.1:48887`,本地安装不需要 token,也不需要保存设置。
118
- 扩展 popup 只用于自定义 bridge URL、页面匹配或可选 token。扩展只负责把页面注册到
119
- 本地 bridge,并执行 Agent 发来的浏览器动作。
147
+ 扩展默认使用 `http://127.0.0.1:48887`,本地安装不需要 token,不需要打开 popup,
148
+ 也不需要保存设置。扩展 popup 首屏只显示连接状态;自定义 bridge URL、页面匹配或
149
+ 可选 token 都收在高级设置里。扩展只负责把页面注册到本地 bridge,并执行 Agent
150
+ 发来的浏览器动作。
120
151
 
121
152
  也可以生成 zip 包用于分发或归档:
122
153
 
@@ -125,6 +156,8 @@ npm run package:extension
125
156
  ```
126
157
 
127
158
  输出文件位于 `dist/yunti-browser-runtime-extension-<version>.zip`,zip 内只包含扩展运行所需文件。
159
+ 浏览器商店分发前的权限、隐私和素材准备清单见
160
+ [扩展分发准备度](docs/EXTENSION_DISTRIBUTION.md)。
128
161
 
129
162
  ## 给 Agent 注册 MCP
130
163
 
@@ -206,6 +239,7 @@ cp -R skills/yunti-browser-runtime ~/.codex/skills/
206
239
  - [工具指南](docs/TOOL_GUIDE.md)
207
240
  - [权限和隐私说明](docs/SECURITY.md)
208
241
  - [发布运行手册](docs/RELEASE.md)
242
+ - [0.2.0 发布清单](docs/RELEASE_0_2_0_CHECKLIST.md)
209
243
  - [发布阻塞处理](docs/PUBLISHING_BLOCKERS.md)
210
244
  - [项目初衷](docs/PROJECT_INTENT.md)
211
245
  - [项目状态](docs/PROJECT_STATUS.md)
@@ -280,7 +314,10 @@ token。
280
314
 
281
315
  ## 发布状态与后续事项
282
316
 
283
- - `yunti-browser-runtime@0.1.2` 已发布到官方 npm registry。
284
- - `0.1.2` 将扩展 popup 的 token 移入高级设置,并补充可复制给 Agent 的安装引导。
317
+ - 当前稳定发布版本:`yunti-browser-runtime@0.1.3`。
318
+ - 当前分支正在收口 `0.2.0` npm/unpacked extension 发布候选版本;`0.2.0`
319
+ 增强了 `yunti_observe_page`、fresh uid 操作闭环、结构化恢复诊断、DOM/diagnostic
320
+ 脱敏和可选本地控制台。
285
321
  - 发布后验证命令:`npm run release:verify-published`。
286
- - 如要上架浏览器扩展商店,需要再次审查 broad host permissions。
322
+ - 浏览器扩展商店版本不阻塞 `0.2.0` npm 发布;如要上架商店,需要沿
323
+ `docs/EXTENSION_PERMISSION_STRATEGY.md` 另行设计 store-candidate 权限 UX。
@@ -16,6 +16,10 @@ const commands = {
16
16
  script: join(rootDir, "mcp", "server.js"),
17
17
  env: { YUNTI_BROWSER_BRIDGE_ONLY: "1" },
18
18
  },
19
+ console: {
20
+ script: join(rootDir, "mcp", "server.js"),
21
+ env: { YUNTI_BROWSER_BRIDGE_ONLY: "1" },
22
+ },
19
23
  doctor: {
20
24
  script: join(rootDir, "scripts", "doctor.js"),
21
25
  env: {},
@@ -73,6 +77,7 @@ Usage:
73
77
  Commands:
74
78
  mcp Start the stdio MCP server (default)
75
79
  bridge Start only the local HTTP bridge
80
+ console Start the bridge and print the optional local console URL
76
81
  doctor Run install and bridge diagnostics
77
82
  print-config Print MCP configuration for an agent
78
83
  package-extension Build the browser extension zip
@@ -80,6 +85,7 @@ Commands:
80
85
  Examples:
81
86
  yunti-browser-runtime
82
87
  yunti-browser-runtime bridge
88
+ yunti-browser-runtime console
83
89
  yunti-browser-runtime doctor
84
90
  yunti-browser-runtime print-config -- --agent codex --human
85
91
  yunti-browser-runtime package-extension`)
@@ -0,0 +1,41 @@
1
+ # Action Result Coverage
2
+
3
+ This document is the durable P6.2 action result coverage matrix. It exists so
4
+ future context compaction or thread handoff cannot blur which browser action
5
+ surfaces already expose structured result fields.
6
+
7
+ Compatibility rule: every action path must keep its historical fields while
8
+ adding structured fields such as `action`, `target`, `ok`, `code`,
9
+ `recoverable`, `recoveryHint`, and `nextStepHint` where useful.
10
+
11
+ ## Coverage Matrix
12
+
13
+ | Tool | Covered success paths | Covered failure diagnostics | Compatibility fields preserved | Remaining validation |
14
+ | --- | --- | --- | --- | --- |
15
+ | `yunti_click` | uid, coordinate, selector | stale uid, missing uid, selector failure via content result | `clicked`, `uid`, `selector`, `x`, `y`, `method`, `element`, `browserSessionId` | Real-browser observe-click-observe closure pending |
16
+ | `yunti_hover` | uid, coordinate, selector | stale uid, missing uid, selector failure via content result | `hovered`, `uid`, `selector`, `x`, `y`, `method`, `element`, `browserSessionId` | Real-browser hover menu closure pending |
17
+ | `yunti_fill` | uid keyboard, uid select, uid contenteditable, selector | stale uid, missing uid, selector failure, non-editable, hidden, disabled, readonly, option miss, value not applied | `filled`, `uid`, `selector`, `method`, `value`, `valueLength`, `element`, `before`, `after`, `browserSessionId` | Real-browser controlled input closure pending |
18
+ | `yunti_select` | selector value, uid value, uid text | selector failure, uid failure, option miss, disabled option, non-select target | `selected`, `uid`, `selector`, `value`, `text`, `selectedIndex`, `element`, `browserSessionId` | Real-browser async option closure pending |
19
+ | `yunti_fill_form` | aggregate success, partial failure | per-field fill/select failure aggregation | `filled`, `failed`, `results`, `browserSessionId` | Real-browser multi-field form closure pending |
20
+ | `yunti_wait_for` | text, selector, urlContains | timeout | `found`, `text`, `selector`, `condition`, `value`, `waitedMs`, `browserSessionId` | Real-browser async wait closure pending |
21
+ | `yunti_scroll` | document, uid container, coordinate container, coordinate document fallback | uid missing, uid stale, coordinate unavailable, no movement, partial movement, document fallback hint | `scrolled`, `deltaX`, `deltaY`, `target`, `before`, `after`, `moved`, `browserSessionId` | Real-browser nested panel closure pending |
22
+ | `yunti_type_text` | uid, selector | stale uid, missing uid, selector failure via content result | `typed`, `uid`, `selector`, `text`, `textLength`, `method`, `mode`, `element`, `browserSessionId` | Real-browser text editor closure pending |
23
+ | `yunti_press_key` | uid, selector | stale uid, missing uid, selector failure via content result | `pressed`, `uid`, `selector`, `key`, `element`, `valueChanged`, `browserSessionId` | Real-browser shortcut closure pending |
24
+ | `yunti_upload_file` | uid, selector | stale uid, missing uid, selector failure via CDP/content path | `uploaded`, `uid`, `selector`, `fileCount`, `filePaths`, `browserSessionId` | Real-browser file input closure pending |
25
+ | `yunti_drag` | coordinate | coordinate argument validation, CDP dispatch failure via tool error | `dragged`, `from`, `to`, `steps`, `browserSessionId` | Real-browser drag target closure pending |
26
+
27
+ ## Coverage Gate
28
+
29
+ - Last audited phase: P6.2.7.
30
+ - Required automated check: `npm run check:action-results`.
31
+ - Required release gate: `npm run release:check` runs the coverage check.
32
+ - Real browser closure: Pending until Playwright/Chromium is installed in the
33
+ validation environment.
34
+ - Real browser command: `YUNTI_E2E=1 npm run test:e2e`.
35
+
36
+ ## Next Coverage Work
37
+
38
+ P6.2.7 closes the structured action result coverage audit. The next engineering
39
+ slice should not add another manual coverage checklist unless a new action tool
40
+ or result contract is introduced. Prefer moving to real-browser closure
41
+ validation or P6.3 agent workflow contracts.
@@ -0,0 +1,97 @@
1
+ # Agent Workflow Contract
2
+
3
+ This document is the P6.3.1 default operating contract for agents using Yunti
4
+ Browser Runtime. It is intentionally tool-level and LLM-agnostic: Yunti stays
5
+ the browser operation layer, while the agent remains responsible for task
6
+ planning and user judgment.
7
+
8
+ ## Default Loop
9
+
10
+ Use this loop for normal page work:
11
+
12
+ 1. Call `yunti_get_tool_usage_hints` when the tool contract is uncertain.
13
+ 2. Call `yunti_list_browser_targets` and choose the intended
14
+ `browserSessionId`.
15
+ 3. Call `yunti_observe_page` for the current page state.
16
+ 4. Act with a fresh uid when possible.
17
+ 5. If the page is loading or changing, call `yunti_wait_for`.
18
+ 6. After every wait or action, call `yunti_observe_page` again.
19
+ 7. Verify the result using observe, snapshot, evaluate, screenshot, network, or
20
+ console tools before assuming the task is done.
21
+ 8. If a uid/session/action result is stale or recoverable, follow
22
+ `code`, `recoveryHint`, and `nextStepHint` before retrying.
23
+
24
+ ## Recovery Rules
25
+
26
+ - Stale route: call `yunti_list_browser_targets` and use the latest
27
+ `browserSessionId`.
28
+ - Stale uid: call `yunti_observe_page` again and use a fresh uid.
29
+ - Async UI: call `yunti_wait_for`, then `yunti_observe_page`, then continue
30
+ with a fresh uid.
31
+ - Scroll uncertainty: prefer fresh `scrollableContainers[]` uids, inspect
32
+ `moved`, `edgeHint`, `partialMovement`, and `recoveryHint`.
33
+ - Fill/select uncertainty: inspect `fillable`, `readOnly`, `disabled`,
34
+ `fillBlockReason`, `selectedValue`, `selectedText`, and `options[]` before
35
+ retrying.
36
+ - Timeout: treat `WAIT_TIMEOUT` as a signal to observe and adjust the condition,
37
+ not proof that the user task failed.
38
+ - Coordinates/selectors: use them as recovery or debugging paths when fresh
39
+ uids are unavailable.
40
+
41
+ ## Confirmation Boundary
42
+
43
+ Ask the user for explicit confirmation before:
44
+
45
+ - submitting forms that change production data;
46
+ - deleting, approving, purchasing, publishing, or sending messages;
47
+ - uploading sensitive files;
48
+ - exposing or copying secrets, credentials, cookies, auth headers, tokens, or
49
+ private keys;
50
+ - taking an action whose effect cannot be verified from page state.
51
+
52
+ ## Copyable Prompt
53
+
54
+ ```text
55
+ Please operate my browser through Yunti Browser Runtime.
56
+
57
+ Follow this workflow:
58
+ 1. Call yunti_get_tool_usage_hints if tool usage is uncertain.
59
+ 2. Call yunti_list_browser_targets and choose the intended browserSessionId.
60
+ 3. Use yunti_observe_page before page actions.
61
+ 4. Prefer fresh uids from yunti_observe_page for click, hover, fill, select,
62
+ scroll, type, press, upload, and drag operations.
63
+ 5. After each action, verify by observing again or using snapshot, evaluate,
64
+ screenshot, network, or console tools.
65
+ 6. For async rendering, validation, navigation, option loading, or infinite
66
+ scroll, call yunti_wait_for, then yunti_observe_page, then continue with a
67
+ fresh uid.
68
+ 7. If a result has ok=false, code, recoveryHint, or nextStepHint, follow that
69
+ guidance before retrying. Do not blindly repeat the same action.
70
+ 8. Use selector or coordinate fallback only when fresh uids are unavailable or
71
+ as an explicit recovery/debugging path.
72
+ 9. Before submitting, deleting, approving, purchasing, publishing, uploading
73
+ sensitive files, or changing production data, ask me for confirmation.
74
+ 10. Do not expose raw cookies, passwords, auth headers, tokens, private keys, or
75
+ other secrets. Remember that DOM observation redaction does not redact
76
+ screenshots.
77
+ ```
78
+
79
+ ## Minimal Use Case Index
80
+
81
+ The concrete P6.3.2 minimal use cases are maintained in
82
+ [Tool Guide](TOOL_GUIDE.md#minimal-use-cases) and mirrored in the packaged
83
+ skill:
84
+
85
+ - Click
86
+ - Fill Form
87
+ - Scroll To Find
88
+ - Switch Tab
89
+ - Wait For Async Result
90
+
91
+ ## Non-Goals
92
+
93
+ - Do not move a built-in LLM loop into Yunti Runtime.
94
+ - Do not replace fine-grained `yunti_*` tools with a single opaque task runner.
95
+ - Do not require a mandatory hub tab or side panel for the default local path.
96
+ - Do not remove CDP, screenshots, network, console, tab control, upload, or
97
+ diagnostic capabilities while improving page-level workflows.