@roll-agent/browser-use-agent 0.10.0 → 0.12.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/SKILL.md +75 -25
- package/dist/browser-action-approval.d.ts +14 -0
- package/dist/browser-security.d.ts +20 -0
- package/dist/browser-use-policy.d.ts +56 -0
- package/dist/diagnostics/effective-env.d.ts +1 -1
- package/dist/element-ref-store.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/pages/platform-page.d.ts +2 -2
- package/dist/pages/yupao/chat.d.ts +2 -2
- package/dist/pages/yupao/navigation.d.ts +4 -4
- package/dist/reply-authority/prepared-reply-store.d.ts +2 -0
- package/dist/reply-authority/schemas.d.ts +2 -2
- package/dist/runtime-config.d.ts +2 -0
- package/dist/tool-action-approval.d.ts +35 -0
- package/dist/tools/browser-dom-action-candidates.d.ts +8 -0
- package/dist/tools/browser-native-page.d.ts +6 -0
- package/dist/tools/browser-ref-schemas.d.ts +99 -0
- package/dist/tools/browser-ref-visual.d.ts +5 -0
- package/dist/tools/browser-snapshot.d.ts +33 -0
- package/dist/tools/browser-status.d.ts +19 -3
- package/dist/tools/click-ref.d.ts +22 -0
- package/dist/tools/list-pages.d.ts +1 -1
- package/dist/tools/navigate-active-tab.d.ts +4 -1
- package/dist/tools/open-platform.d.ts +4 -1
- package/dist/tools/select-page.d.ts +1 -1
- package/dist/tools/type-ref.d.ts +24 -0
- package/dist/tools/yupao-send-reply.d.ts +3 -0
- package/dist/tools/zhipin-diagnose-browser-state.d.ts +7 -7
- package/dist/tools/zhipin-generate-reply-preview.d.ts +5 -0
- package/dist/tools/zhipin-get-candidate-info.d.ts +2 -2
- package/dist/tools/zhipin-open-chat-page.d.ts +1 -1
- package/dist/tools/zhipin-open-recommend-page.d.ts +1 -1
- package/dist/tools/zhipin-send-prepared-reply.d.ts +12 -0
- package/package.json +4 -4
- package/references/env.yaml +8 -0
- package/references/generic-browser-refs.md +151 -0
package/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: browser-use-agent
|
|
3
|
-
description: 浏览器操控 Agent
|
|
3
|
+
description: 浏览器操控 Agent。控制浏览器操作招聘平台:读取消息、打开聊天、发送签名回复、换微信、滚动动态列表、查看推荐列表、筛选候选人、打招呼、查看简历;也提供通用 AX snapshot、@eN element ref 点击/输入,以及 BOSS直聘 native CDP / Playwright attach 风控诊断。
|
|
4
4
|
metadata:
|
|
5
5
|
roll-env-file: references/env.yaml
|
|
6
6
|
---
|
|
@@ -14,7 +14,9 @@ metadata:
|
|
|
14
14
|
- 先启动 `browser-use-agent` HTTP 常驻服务;浏览器 session 跨调用持久。
|
|
15
15
|
- 通过 Roll 调用本 Agent 时,先用 `roll skills get browser-use-agent --include-references --json` 读取当前说明和 `references/*`,再用 `roll agent tools browser-use-agent --json` 读取真实 schema。
|
|
16
16
|
- 完整 `inputSchema` 以 `roll agent tools browser-use-agent --json` 为准。
|
|
17
|
-
- `REPLY_AUTHORITY_KEYS_URL`
|
|
17
|
+
- `REPLY_AUTHORITY_URL` / `REPLY_AUTHORITY_BEARER_TOKEN` 是生成智能回复预览的必填环境变量;`REPLY_AUTHORITY_KEYS_URL` 是发送预备回复前验签的必填环境变量。`roll doctor` 会通过 `references/env.yaml` 和 `browser_status.effectiveEnvSources` 检查它们是否声明并在运行态生效。
|
|
18
|
+
- `BROWSER_SECURITY_JSON` 可选配置浏览器硬安全策略;`browser_status.security` 会返回实际加载后的 `domainAllowlist`、`maxPageContentBytes`、`maxSnapshotNodes` 和 `actionPolicy`。Boss 日常编排建议使用 `actionPolicy:"log"`,`confirm/deny` 只作为高级调试模式。
|
|
19
|
+
- `BROWSER_USE_POLICY_JSON` 可选配置 browser-use 工具级业务策略;日常推荐只把 `zhipin_send_prepared_reply` 配为 `confirm`。
|
|
18
20
|
- 长任务前或状态异常时先跑 `roll doctor --fix-plan --json`;仅对配置迁移、`agents.dataDir`、孤儿 runtime 元数据这类安全项才使用 `roll doctor --fix --json`。
|
|
19
21
|
- 页内反馈默认开启:
|
|
20
22
|
- `BROWSER_VISUAL_CURSOR`:native CDP 点击/拖拽/滚动前显示同源虚拟鼠标轨迹和点击波纹;简历弹窗等 Playwright-backed 工具仍使用旧虚拟指针。
|
|
@@ -25,11 +27,55 @@ metadata:
|
|
|
25
27
|
|
|
26
28
|
| Tool | 用途 |
|
|
27
29
|
| --- | --- |
|
|
28
|
-
| `browser_status()` | 查询浏览器 runtime、session、Reply Authority
|
|
30
|
+
| `browser_status()` | 查询浏览器 runtime、session、Reply Authority 公钥预加载状态、视觉反馈开关、安全策略和 env 指纹。 |
|
|
29
31
|
| `open_platform(platform)` | 通过 native CDP 打开并聚焦招聘平台主页;登录前不触发 Playwright attach。 |
|
|
30
32
|
| `list_pages(platform?)` | 通过 native CDP 列出浏览器页面和 `pageId`。 |
|
|
31
33
|
| `select_page(platform, pageId)` | 将指定页面绑定为平台活跃页;登录前优先走 native target 激活。 |
|
|
32
34
|
| `navigate_active_tab(url)` | 通过 native CDP 打开/导航页面;不触发 Playwright attach,不支持直接跳转 BOSS `/web/chat/*` 后台路径。 |
|
|
35
|
+
| `browser_snapshot(pageId?, maxDepth?, maxNodes?, interactiveOnly?)` | 读取当前或指定页面的 Accessibility Tree;默认只返回可交互节点,并为可交互节点生成 `@eN`;也会补充有限的非语义 DOM 可操作短文本,例如 `span` 渲染的 tab/filter 标签,并递归内联同 target iframe 中的可操作 AX 节点。 |
|
|
36
|
+
| `click_ref(ref, pageId?, browserActionApproval?)` | 点击 `browser_snapshot` 返回的 `@eN`;优先用 `backendNodeId`,失效时用 `role/name/nth` fallback;iframe 子节点会携带并复用 `frameId`。 |
|
|
37
|
+
| `type_ref(ref, text, clear?, pageId?, browserActionApproval?)` | 向 `browser_snapshot` 返回的 `@eN` 输入文本;`clear:true` 会先清空当前控件;iframe 子节点会携带并复用 `frameId`。 |
|
|
38
|
+
|
|
39
|
+
## 通用页面操作编排
|
|
40
|
+
|
|
41
|
+
这组三个通用工具用于“没有专用业务 tool 的可访问控件操作”,不是 BOSS 专用工具的替代品。
|
|
42
|
+
|
|
43
|
+
工具选择优先级:
|
|
44
|
+
|
|
45
|
+
| 场景 | 首选 | 兜底 |
|
|
46
|
+
| --- | --- | --- |
|
|
47
|
+
| BOSS 已建模业务链路,例如读消息、打开聊天、换微信、打招呼、筛选候选人 | `zhipin_*` 专用 tool | 只有专用 tool 缺失或无法覆盖新按钮时,才使用 `browser_snapshot` + `click_ref` / `type_ref` |
|
|
48
|
+
| 通用网页上点击语义明确的按钮、链接、输入框 | `browser_snapshot` 找 `role/name`,再用 `click_ref` / `type_ref` | 操作后重新 `browser_snapshot` 或用业务 read tool 验证 |
|
|
49
|
+
| 页面、tab、平台选择 | `list_pages` + `select_page` 或平台专用 opener | 不要直接猜内部 URL |
|
|
50
|
+
| 风控或底层行为诊断 | `zhipin_diagnose_browser_state` | 正常业务路径不要默认诊断 |
|
|
51
|
+
|
|
52
|
+
两阶段流程:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
观察阶段:
|
|
56
|
+
list_pages/select_page # 仅多页面或目标页不明确时
|
|
57
|
+
-> browser_snapshot(interactiveOnly=true)
|
|
58
|
+
-> orchestrator 按 role/name/disabled 选择 @eN
|
|
59
|
+
|
|
60
|
+
动作阶段:
|
|
61
|
+
click_ref(@eN) 或 type_ref(@eN, text, clear?)
|
|
62
|
+
-> 若 actionPolicy=confirm,原样带回 browserActionApproval 重试
|
|
63
|
+
-> 重新 browser_snapshot 或调用业务 read tool 验证页面状态
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
关键规则:
|
|
67
|
+
|
|
68
|
+
1. `@eN` 只来自最近一次 `browser_snapshot`,只能用于同一 `pageId` 的后续 `click_ref` / `type_ref`。
|
|
69
|
+
2. `@eN` 不等同于 BOSS 推荐页的 `@cN` / `@jN`;`@cN`、`@jN` 只服务对应 `zhipin_*` 工具。
|
|
70
|
+
3. 不要自行构造 `@eN`;只能传 `browser_snapshot.snapshot.refs[].ref`。
|
|
71
|
+
4. 选择目标时优先匹配 `role + name`,并排除 `disabled:true` 的节点;若目标是非语义短文本控件,使用 `role:"clickable"` / `role:"focusable"` / `role:"editable"`、可见文案和 `properties.domActionable:true` 判断。
|
|
72
|
+
5. 如果 `refs[]` 或 `nodes[]` 中出现 `frameId`,说明该 ref 来自 iframe 子 frame;orchestrator 只需要继续传 `ref` 和必要的 `pageId`,不要手工传或改写 `frameId`。
|
|
73
|
+
6. `snapshot.truncated:true` 表示节点达到 `maxNodes` 上限;先缩小 `maxDepth`、指定 `pageId` 或切到更明确页面后再决策。
|
|
74
|
+
7. 页面导航、刷新、弹窗出现、列表重排、筛选变化后,先重新 `browser_snapshot`,不要复用旧 `@eN`。
|
|
75
|
+
8. `browser_snapshot` 是 AX 语义快照,不是完整 HTML、截图或网络状态;需要业务数据时仍应使用对应 read tool。
|
|
76
|
+
9. 当前 iframe 支持是同 target / 同 CDP session 内递归内联;递归受 `maxNodes`、frame 去重和 CDP frame 可解析性限制。跨 target / OOPIF iframe 需要 Native CDP session multiplexing,当前不承诺覆盖。
|
|
77
|
+
|
|
78
|
+
通用页面操作细节见 `references/generic-browser-refs.md`。
|
|
33
79
|
|
|
34
80
|
## 调试 Tools
|
|
35
81
|
|
|
@@ -51,8 +97,8 @@ metadata:
|
|
|
51
97
|
| `zhipin_open_chat_page()` | native CDP | 点击左侧导航切回「沟通」。 |
|
|
52
98
|
| `zhipin_open_chat(conversationId?, candidateName?, index?, preferUnread?)` | native CDP | 打开目标聊天;匹配优先级为 `conversationId` > `candidateName` > `index`。 |
|
|
53
99
|
| `zhipin_get_candidate_info(conversationId?, candidateName?, index?, maxMessages?)` | native CDP | 提取候选人资料、聊天记录、`conversationId`、`candidateId` 和页面职位信号。 |
|
|
54
|
-
| `zhipin_generate_reply_preview(conversationId?, candidateName?, index?, maxMessages?)` | native CDP | 读取聊天上下文,调用 Reply Authority SSE
|
|
55
|
-
| `zhipin_send_prepared_reply(preparedReplyId)` | native CDP | 发送 `zhipin_generate_reply_preview` 生成的预备回复;内部取回并验签 envelope
|
|
100
|
+
| `zhipin_generate_reply_preview(conversationId?, candidateName?, index?, maxMessages?, reasoning?)` | native CDP | 读取聊天上下文,调用 Reply Authority SSE 流式生成回复,并在浏览器内展示阶段与临时草稿;可用 `reasoning` 控制是否请求 thinking/reasoning;返回 `preparedReplyId`,不返回 `signedEnvelope`。 |
|
|
101
|
+
| `zhipin_send_prepared_reply(preparedReplyId, toolActionApproval?, browserActionApproval?)` | native CDP | 发送 `zhipin_generate_reply_preview` 生成的预备回复;内部取回并验签 envelope;若 `BROWSER_USE_POLICY_JSON.tools.zhipin_send_prepared_reply.policy="confirm"`,首次调用返回 `needs_confirmation`,确认后带 `toolActionApproval` 重试;若同时启用 `BROWSER_SECURITY_JSON.actionPolicy="confirm"`,还需按返回的 `browserActionApproval` 再次重试。 |
|
|
56
102
|
| `zhipin_exchange_wechat(conversationId?, candidateName?, index?)` | native CDP | 点击「换微信」和确认弹窗,优先按 `conversationId` 定位聊天。 |
|
|
57
103
|
| `zhipin_get_username()` | native CDP | 读取当前登录招聘者用户名;用于 `recruiterUsername` / `recruiterBinding` 链路。 |
|
|
58
104
|
|
|
@@ -88,27 +134,30 @@ metadata:
|
|
|
88
134
|
3. 调 `zhipin_open_chat`、`zhipin_get_candidate_info`、`zhipin_exchange_wechat` 时优先传 `conversationId`。
|
|
89
135
|
4. 生成聊天回复优先调用 `zhipin_generate_reply_preview(conversationId)`;它会打开目标聊天、在浏览器内展示 Reply Authority SSE 的阶段、工具执行状态和临时草稿,不需要先额外调用 `zhipin_open_chat`。
|
|
90
136
|
5. `draft.delta` 只能展示,不能发送;真正可发送内容只来自 Reply Authority `final` 事件生成的内部签名结果。
|
|
91
|
-
6. 发送回复只能调用 `zhipin_send_prepared_reply(preparedReplyId)
|
|
137
|
+
6. 发送回复只能调用 `zhipin_send_prepared_reply(preparedReplyId, toolActionApproval?, browserActionApproval?)`;主输入只能使用 `preparedReplyId`,确认重试时可原样带回 `needs_confirmation` 返回的 approval;不要构造裸文本发送路径,也不要保存或传递 `signedEnvelope`。
|
|
92
138
|
7. `zhipin_send_prepared_reply` 会校验 envelope 的 `conversationId + candidateId + recruiterBinding`,当前页面目标或招聘者不一致时拒绝。
|
|
93
|
-
8. `
|
|
94
|
-
9.
|
|
95
|
-
10.
|
|
96
|
-
11. `jobRef`
|
|
97
|
-
12.
|
|
98
|
-
13.
|
|
99
|
-
14.
|
|
100
|
-
15. `zhipin_select_recommend_job` 返回 `status:"
|
|
101
|
-
16.
|
|
102
|
-
17.
|
|
103
|
-
18.
|
|
104
|
-
19.
|
|
105
|
-
20. `candidateRef`
|
|
106
|
-
21.
|
|
107
|
-
22.
|
|
108
|
-
23.
|
|
109
|
-
24. `
|
|
110
|
-
25.
|
|
111
|
-
26.
|
|
139
|
+
8. 需要更强推理时,可给 `zhipin_generate_reply_preview` 传 `reasoning:{enabled:true, effort:"low"|"medium"|"high", scope:"reply"|"all"}`;不传则沿用 Reply Authority Service 默认策略。
|
|
140
|
+
9. `preferredBrand` 只来自 `zhipin_get_candidate_info` 对 `communicationPosition` 的连字符格式解析;不要用通用岗位名或候选人公司名伪造。
|
|
141
|
+
10. 推荐页岗位筛选优先调用 `zhipin_list_recommend_jobs()`;若返回 `canSwitch:false`,说明当前账号/页面没有可切换目标,不要继续盲试岗位名。
|
|
142
|
+
11. `jobRef` 来自 `zhipin_list_recommend_jobs` 输出,格式如 `@j1`;选择岗位时优先传 `zhipin_select_recommend_job({ jobRef })`。
|
|
143
|
+
12. `jobRef` 只对最近一次岗位下拉快照有意义;筛选、搜索、刷新或页面重开后先重新调用 `zhipin_list_recommend_jobs`。
|
|
144
|
+
13. 推荐页岗位筛选的稳定主键是 `zhipin_list_recommend_jobs` / `zhipin_select_recommend_job` 返回的 `value`;已知 `value` 时传 `jobValue`。
|
|
145
|
+
14. 推荐岗位只知道标题时传 `jobName`;`index` 只表示当前岗位下拉快照,不要在搜索、筛选、刷新或跨步骤后复用。
|
|
146
|
+
15. `zhipin_select_recommend_job` 返回 `status:"selected"` 或 `status:"already_selected"` 都表示目标岗位已生效。
|
|
147
|
+
16. `zhipin_select_recommend_job` 返回 `status:"not_found"` 时不要盲目重试;先调用 `zhipin_list_recommend_jobs`,再选择最接近岗位的 `jobRef` 或 `value`。
|
|
148
|
+
17. 只有明确需要重新点击已选中岗位项时才传 `forceClick:true`;默认不要传,避免无意义重复点击。
|
|
149
|
+
18. `zhipin_filter_recommend_candidates` 返回 `status:"requires_vip"` 时不要反复尝试绕过筛选 UI;当前账号没有权限使用该筛选,改为直接读取当前推荐列表或调整业务策略。
|
|
150
|
+
19. 聊天消息列表不产生 `candidateRef`;聊天回复链路使用 `conversationId` / `candidateId`,推荐候选人链路才使用 `candidateRef`。
|
|
151
|
+
20. 推荐候选人列表的 `candidateRef` 来自 `zhipin_get_candidate_list` 输出,格式如 `@c1`;后续 `zhipin_say_hello` / `zhipin_open_resume` 优先传它。
|
|
152
|
+
21. `candidateRef` 只对最近一次推荐列表快照有意义;筛选、搜索、滚动加载、刷新或页面重开后先重新调用 `zhipin_get_candidate_list`。
|
|
153
|
+
22. 不要自行构造 `jobRef` / `candidateRef`;只能传本 Agent 刚返回的 ref。
|
|
154
|
+
23. 调 `zhipin_say_hello` 前,先从 `zhipin_get_candidate_list` 结果中过滤 `buttonText:"打招呼"` 的候选人;`buttonText` 为空通常表示已经打过招呼。
|
|
155
|
+
24. 如果业务有年龄、资格或岗位匹配约束,必须先按 `age` / `expectedPosition` / `tags` 等列表字段过滤;不要把刚读到的全部 `candidateRefs` 盲目提交。
|
|
156
|
+
25. `zhipin_say_hello({ candidateRefs })` 支持同一快照内连续提交多个 ref;若返回“候选人引用已过期”,说明 BOSS 列表已重排,重新执行 `zhipin_get_candidate_list` 后只重试剩余目标。
|
|
157
|
+
26. 高频连续 tool call 可用 `roll run --batch-stdin --json` 批量提交,但每项仍要显式声明 `agent` / `tool` / `input`,不要假设 batch 自动传递上一步输出。
|
|
158
|
+
27. 不要用 `navigate_active_tab` 直接跳转 `https://www.zhipin.com/web/chat/*`;聊天页用 `zhipin_open_chat_page()`,推荐页用 `zhipin_open_recommend_page()`。
|
|
159
|
+
28. BOSS 已有专用工具能表达业务意图时,不要为了“看见按钮”而绕开专用工具改用 `click_ref` / `type_ref`。
|
|
160
|
+
29. 对 BOSS 未建模按钮,例如新出现的“交换电话”,可以先用 `browser_snapshot` 找到对应 `@eN`,再 `click_ref`;弹窗确认类二次动作必须重新 snapshot 后再点击。
|
|
112
161
|
|
|
113
162
|
## 典型链路
|
|
114
163
|
|
|
@@ -132,4 +181,5 @@ zhipin_open_recommend_page
|
|
|
132
181
|
|
|
133
182
|
- `references/zhipin-diagnostics.md`:BOSS native CDP / attach 诊断阶段、推进顺序和返回字段。
|
|
134
183
|
- `references/zhipin-workflows.md`:聊天主键、动态列表、`preferredBrand`、Reply Authority 编排细节。
|
|
184
|
+
- `references/generic-browser-refs.md`:通用 AX snapshot、`@eN` ref、点击/输入闭环和边界条件。
|
|
135
185
|
- `references/env.yaml`:运行所需环境变量声明。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BrowserActionApproval, BrowserActionApprovalValidationInput, BrowserActionPreflightDetails } from "@roll-agent/browser";
|
|
2
|
+
export type BrowserActionApprovalRequest = {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly expiresAt: string;
|
|
5
|
+
readonly action: string;
|
|
6
|
+
readonly target: string;
|
|
7
|
+
readonly url?: string;
|
|
8
|
+
readonly retryInput: {
|
|
9
|
+
readonly browserActionApproval: BrowserActionApproval;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare function createBrowserActionApprovalRequest(details: BrowserActionPreflightDetails, nowMs?: number): BrowserActionApprovalRequest;
|
|
13
|
+
export declare function approveBrowserAction(input: BrowserActionApprovalValidationInput): boolean;
|
|
14
|
+
export declare function resetBrowserActionApprovalsForTests(): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StructuredToolError } from "@roll-agent/sdk";
|
|
2
|
+
import type { AgentContext } from "@roll-agent/sdk";
|
|
3
|
+
import { type BrowserActionApproval, type BrowserActionPolicyOptions, type BrowserRuntime } from "@roll-agent/browser";
|
|
4
|
+
export type BrowserActionGuardResult = {
|
|
5
|
+
readonly approvedByConfirmation: boolean;
|
|
6
|
+
};
|
|
7
|
+
type BrowserActionPolicyOptionsInput = {
|
|
8
|
+
readonly approval?: BrowserActionApproval | undefined;
|
|
9
|
+
readonly approvedByConfirmation?: boolean;
|
|
10
|
+
readonly logActions?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function createBrowserActionPolicyOptions(ctx: AgentContext, runtime: BrowserRuntime, input?: BrowserActionPolicyOptionsInput): BrowserActionPolicyOptions;
|
|
13
|
+
export declare function assertBrowserActionAllowed(ctx: AgentContext, runtime: BrowserRuntime, input: {
|
|
14
|
+
readonly action: string;
|
|
15
|
+
readonly target: string;
|
|
16
|
+
readonly url?: string;
|
|
17
|
+
readonly approval?: BrowserActionApproval;
|
|
18
|
+
}): BrowserActionGuardResult;
|
|
19
|
+
export declare function toStructuredBrowserActionError(error: unknown): StructuredToolError | undefined;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { AgentContext } from "@roll-agent/sdk";
|
|
2
|
+
import type { BrowserSecurityConfig } from "@roll-agent/browser";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { type ToolActionApproval, type ToolActionApprovalSubject } from "./tool-action-approval.ts";
|
|
5
|
+
export declare const BROWSER_USE_TOOL_POLICIES: readonly ["log", "deny", "confirm"];
|
|
6
|
+
export declare const BrowserUseToolPolicySchema: z.ZodEnum<["log", "deny", "confirm"]>;
|
|
7
|
+
export type BrowserUseToolPolicy = z.infer<typeof BrowserUseToolPolicySchema>;
|
|
8
|
+
export declare const BROWSER_USE_TOOL_POLICY_SUPPORTED_TOOLS: readonly ["zhipin_send_prepared_reply"];
|
|
9
|
+
export declare const BROWSER_USE_POLICY_WARNING_CODES: readonly ["unknown_tool_policy", "double_confirmation", "browser_action_policy_not_recommended"];
|
|
10
|
+
export declare const BrowserUsePolicyWarningSchema: z.ZodObject<{
|
|
11
|
+
code: z.ZodEnum<["unknown_tool_policy", "double_confirmation", "browser_action_policy_not_recommended"]>;
|
|
12
|
+
message: z.ZodString;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
code: "unknown_tool_policy" | "double_confirmation" | "browser_action_policy_not_recommended";
|
|
15
|
+
message: string;
|
|
16
|
+
}, {
|
|
17
|
+
code: "unknown_tool_policy" | "double_confirmation" | "browser_action_policy_not_recommended";
|
|
18
|
+
message: string;
|
|
19
|
+
}>;
|
|
20
|
+
export type BrowserUsePolicyWarning = z.infer<typeof BrowserUsePolicyWarningSchema>;
|
|
21
|
+
export declare const BrowserUsePolicyConfigSchema: z.ZodObject<{
|
|
22
|
+
approvalTtlMs: z.ZodDefault<z.ZodNumber>;
|
|
23
|
+
tools: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
24
|
+
policy: z.ZodEnum<["log", "deny", "confirm"]>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
policy: "log" | "deny" | "confirm";
|
|
27
|
+
}, {
|
|
28
|
+
policy: "log" | "deny" | "confirm";
|
|
29
|
+
}>>>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
tools: Record<string, {
|
|
32
|
+
policy: "log" | "deny" | "confirm";
|
|
33
|
+
}>;
|
|
34
|
+
approvalTtlMs: number;
|
|
35
|
+
}, {
|
|
36
|
+
tools?: Record<string, {
|
|
37
|
+
policy: "log" | "deny" | "confirm";
|
|
38
|
+
}> | undefined;
|
|
39
|
+
approvalTtlMs?: number | undefined;
|
|
40
|
+
}>;
|
|
41
|
+
export type BrowserUsePolicyConfig = z.infer<typeof BrowserUsePolicyConfigSchema>;
|
|
42
|
+
export declare function loadBrowserUsePolicyFromEnv(env?: NodeJS.ProcessEnv): BrowserUsePolicyConfig;
|
|
43
|
+
export declare function setBrowserUsePolicy(policy: BrowserUsePolicyConfig): void;
|
|
44
|
+
export declare function getBrowserUsePolicy(): BrowserUsePolicyConfig;
|
|
45
|
+
export declare function resetBrowserUsePolicyForTests(): void;
|
|
46
|
+
export declare function collectBrowserUsePolicyWarnings(input: {
|
|
47
|
+
readonly browserSecurity: BrowserSecurityConfig;
|
|
48
|
+
readonly toolPolicy?: BrowserUsePolicyConfig;
|
|
49
|
+
}): BrowserUsePolicyWarning[];
|
|
50
|
+
export declare function assertBrowserUseToolAllowed(ctx: AgentContext, input: {
|
|
51
|
+
readonly subject: ToolActionApprovalSubject;
|
|
52
|
+
readonly approval?: ToolActionApproval;
|
|
53
|
+
readonly deferApprovalConsumption?: boolean;
|
|
54
|
+
}): {
|
|
55
|
+
readonly consumeApproval: () => void;
|
|
56
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const BROWSER_USE_DECLARED_ENV_KEYS: readonly ["REPLY_AUTHORITY_URL", "REPLY_AUTHORITY_BEARER_TOKEN", "REPLY_AUTHORITY_KEYS_URL", "RECRUITMENT_EVENTS_ENABLED", "RECRUITMENT_EVENTS_API_BASE_URL", "RECRUITMENT_EVENTS_API_TOKEN", "RECRUITMENT_EVENTS_DEFAULT_AGENT_ID", "BROWSER_VISUAL_CURSOR", "BROWSER_VISUAL_ACTIVITY"];
|
|
2
|
+
export declare const BROWSER_USE_DECLARED_ENV_KEYS: readonly ["REPLY_AUTHORITY_URL", "REPLY_AUTHORITY_BEARER_TOKEN", "REPLY_AUTHORITY_KEYS_URL", "RECRUITMENT_EVENTS_ENABLED", "RECRUITMENT_EVENTS_API_BASE_URL", "RECRUITMENT_EVENTS_API_TOKEN", "RECRUITMENT_EVENTS_DEFAULT_AGENT_ID", "BROWSER_SECURITY_JSON", "BROWSER_USE_POLICY_JSON", "BROWSER_VISUAL_CURSOR", "BROWSER_VISUAL_ACTIVITY"];
|
|
3
3
|
export declare const EffectiveEnvSourceSchema: z.ZodObject<{
|
|
4
4
|
present: z.ZodBoolean;
|
|
5
5
|
fingerprint: z.ZodOptional<z.ZodString>;
|