@roll-agent/browser-use-agent 0.10.0 → 0.11.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 +27 -24
- 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/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-status.d.ts +19 -3
- 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/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 +1 -1
- package/dist/tools/zhipin-get-candidate-list.d.ts +1 -1
- 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/SKILL.md
CHANGED
|
@@ -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,7 +27,7 @@ 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 激活。 |
|
|
@@ -51,8 +53,8 @@ metadata:
|
|
|
51
53
|
| `zhipin_open_chat_page()` | native CDP | 点击左侧导航切回「沟通」。 |
|
|
52
54
|
| `zhipin_open_chat(conversationId?, candidateName?, index?, preferUnread?)` | native CDP | 打开目标聊天;匹配优先级为 `conversationId` > `candidateName` > `index`。 |
|
|
53
55
|
| `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
|
|
56
|
+
| `zhipin_generate_reply_preview(conversationId?, candidateName?, index?, maxMessages?, reasoning?)` | native CDP | 读取聊天上下文,调用 Reply Authority SSE 流式生成回复,并在浏览器内展示阶段与临时草稿;可用 `reasoning` 控制是否请求 thinking/reasoning;返回 `preparedReplyId`,不返回 `signedEnvelope`。 |
|
|
57
|
+
| `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
58
|
| `zhipin_exchange_wechat(conversationId?, candidateName?, index?)` | native CDP | 点击「换微信」和确认弹窗,优先按 `conversationId` 定位聊天。 |
|
|
57
59
|
| `zhipin_get_username()` | native CDP | 读取当前登录招聘者用户名;用于 `recruiterUsername` / `recruiterBinding` 链路。 |
|
|
58
60
|
|
|
@@ -88,27 +90,28 @@ metadata:
|
|
|
88
90
|
3. 调 `zhipin_open_chat`、`zhipin_get_candidate_info`、`zhipin_exchange_wechat` 时优先传 `conversationId`。
|
|
89
91
|
4. 生成聊天回复优先调用 `zhipin_generate_reply_preview(conversationId)`;它会打开目标聊天、在浏览器内展示 Reply Authority SSE 的阶段、工具执行状态和临时草稿,不需要先额外调用 `zhipin_open_chat`。
|
|
90
92
|
5. `draft.delta` 只能展示,不能发送;真正可发送内容只来自 Reply Authority `final` 事件生成的内部签名结果。
|
|
91
|
-
6. 发送回复只能调用 `zhipin_send_prepared_reply(preparedReplyId)
|
|
93
|
+
6. 发送回复只能调用 `zhipin_send_prepared_reply(preparedReplyId, toolActionApproval?, browserActionApproval?)`;主输入只能使用 `preparedReplyId`,确认重试时可原样带回 `needs_confirmation` 返回的 approval;不要构造裸文本发送路径,也不要保存或传递 `signedEnvelope`。
|
|
92
94
|
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.
|
|
95
|
+
8. 需要更强推理时,可给 `zhipin_generate_reply_preview` 传 `reasoning:{enabled:true, effort:"low"|"medium"|"high", scope:"reply"|"all"}`;不传则沿用 Reply Authority Service 默认策略。
|
|
96
|
+
9. `preferredBrand` 只来自 `zhipin_get_candidate_info` 对 `communicationPosition` 的连字符格式解析;不要用通用岗位名或候选人公司名伪造。
|
|
97
|
+
10. 推荐页岗位筛选优先调用 `zhipin_list_recommend_jobs()`;若返回 `canSwitch:false`,说明当前账号/页面没有可切换目标,不要继续盲试岗位名。
|
|
98
|
+
11. `jobRef` 来自 `zhipin_list_recommend_jobs` 输出,格式如 `@j1`;选择岗位时优先传 `zhipin_select_recommend_job({ jobRef })`。
|
|
99
|
+
12. `jobRef` 只对最近一次岗位下拉快照有意义;筛选、搜索、刷新或页面重开后先重新调用 `zhipin_list_recommend_jobs`。
|
|
100
|
+
13. 推荐页岗位筛选的稳定主键是 `zhipin_list_recommend_jobs` / `zhipin_select_recommend_job` 返回的 `value`;已知 `value` 时传 `jobValue`。
|
|
101
|
+
14. 推荐岗位只知道标题时传 `jobName`;`index` 只表示当前岗位下拉快照,不要在搜索、筛选、刷新或跨步骤后复用。
|
|
102
|
+
15. `zhipin_select_recommend_job` 返回 `status:"selected"` 或 `status:"already_selected"` 都表示目标岗位已生效。
|
|
103
|
+
16. `zhipin_select_recommend_job` 返回 `status:"not_found"` 时不要盲目重试;先调用 `zhipin_list_recommend_jobs`,再选择最接近岗位的 `jobRef` 或 `value`。
|
|
104
|
+
17. 只有明确需要重新点击已选中岗位项时才传 `forceClick:true`;默认不要传,避免无意义重复点击。
|
|
105
|
+
18. `zhipin_filter_recommend_candidates` 返回 `status:"requires_vip"` 时不要反复尝试绕过筛选 UI;当前账号没有权限使用该筛选,改为直接读取当前推荐列表或调整业务策略。
|
|
106
|
+
19. 聊天消息列表不产生 `candidateRef`;聊天回复链路使用 `conversationId` / `candidateId`,推荐候选人链路才使用 `candidateRef`。
|
|
107
|
+
20. 推荐候选人列表的 `candidateRef` 来自 `zhipin_get_candidate_list` 输出,格式如 `@c1`;后续 `zhipin_say_hello` / `zhipin_open_resume` 优先传它。
|
|
108
|
+
21. `candidateRef` 只对最近一次推荐列表快照有意义;筛选、搜索、滚动加载、刷新或页面重开后先重新调用 `zhipin_get_candidate_list`。
|
|
109
|
+
22. 不要自行构造 `jobRef` / `candidateRef`;只能传本 Agent 刚返回的 ref。
|
|
110
|
+
23. 调 `zhipin_say_hello` 前,先从 `zhipin_get_candidate_list` 结果中过滤 `buttonText:"打招呼"` 的候选人;`buttonText` 为空通常表示已经打过招呼。
|
|
111
|
+
24. 如果业务有年龄、资格或岗位匹配约束,必须先按 `age` / `expectedPosition` / `tags` 等列表字段过滤;不要把刚读到的全部 `candidateRefs` 盲目提交。
|
|
112
|
+
25. `zhipin_say_hello({ candidateRefs })` 支持同一快照内连续提交多个 ref;若返回“候选人引用已过期”,说明 BOSS 列表已重排,重新执行 `zhipin_get_candidate_list` 后只重试剩余目标。
|
|
113
|
+
26. 高频连续 tool call 可用 `roll run --batch-stdin --json` 批量提交,但每项仍要显式声明 `agent` / `tool` / `input`,不要假设 batch 自动传递上一步输出。
|
|
114
|
+
27. 不要用 `navigate_active_tab` 直接跳转 `https://www.zhipin.com/web/chat/*`;聊天页用 `zhipin_open_chat_page()`,推荐页用 `zhipin_open_recommend_page()`。
|
|
112
115
|
|
|
113
116
|
## 典型链路
|
|
114
117
|
|
|
@@ -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>;
|