@roll-agent/browser-use-agent 0.16.1 → 0.17.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.
@@ -1,8 +1,45 @@
1
+ import type { AgentLLM, AgentLogger } from "@roll-agent/sdk";
2
+ import { type CandidateLocationSignal } from "@roll-agent/reply-authority-client";
3
+ export declare const LocationSignalAnalysisPathValues: readonly ["llm", "fallback", "profile_only"];
4
+ export type LocationSignalAnalysisPath = (typeof LocationSignalAnalysisPathValues)[number];
5
+ export declare const LocationSignalInquiryTypeValues: readonly ["location_inquiry", "non_location_inquiry"];
6
+ export type LocationSignalInquiryType = (typeof LocationSignalInquiryTypeValues)[number];
7
+ export type LocationSignalResolution = {
8
+ readonly signals: readonly CandidateLocationSignal[];
9
+ readonly analysisPath: LocationSignalAnalysisPath;
10
+ readonly inquiryType?: LocationSignalInquiryType;
11
+ };
12
+ export type LocationSignalMessage = {
13
+ readonly index: number;
14
+ readonly sender: "candidate" | "recruiter" | "system";
15
+ readonly content: string;
16
+ };
17
+ type LocationSignalEvidenceInput = {
18
+ readonly latestCandidateMessage: string;
19
+ readonly recentMessages: readonly LocationSignalMessage[];
20
+ readonly expectedLocation: string;
21
+ readonly communicationPosition: string;
22
+ };
23
+ type ResolveLocationSignalsInput = {
24
+ readonly llm: AgentLLM;
25
+ readonly logger?: Pick<AgentLogger, "warn"> | undefined;
26
+ readonly messages: readonly LocationSignalMessage[];
27
+ readonly expectedLocation: string;
28
+ readonly communicationPosition: string;
29
+ readonly timeoutMs?: number | undefined;
30
+ };
31
+ export declare function resolveLocationSignalsFromLlmText(input: LocationSignalEvidenceInput & {
32
+ readonly llmText: string;
33
+ }): CandidateLocationSignal[];
34
+ export declare function resolveLocationSignals(input: ResolveLocationSignalsInput): Promise<LocationSignalResolution>;
35
+ export declare function clearLocationSignalResolutionCacheForTest(): void;
36
+ export declare function resolveLocationSignalsWithLlm(input: ResolveLocationSignalsInput): Promise<CandidateLocationSignal[]>;
1
37
  export declare function resolvePreferredBrand(communicationPosition: string): string | undefined;
2
38
  export declare function resolveExpectedSignals(expectedJobText: string): {
3
39
  expectedLocation: string;
4
40
  expectedPosition: string;
5
41
  };
42
+ export declare function formatLocationSignalsVisualLabel(resolution: LocationSignalResolution | readonly CandidateLocationSignal[]): string;
6
43
  export declare function resolveConversationSignals(input: {
7
44
  communicationPosition: string;
8
45
  expectedJobText: string;
@@ -12,3 +49,4 @@ export declare function resolveConversationSignals(input: {
12
49
  expectedPosition: string;
13
50
  preferredBrand?: string;
14
51
  };
52
+ export {};
@@ -4,7 +4,7 @@ type NativePreviewTarget = {
4
4
  export declare class NativeReplyPreviewVisualSession {
5
5
  private readonly target;
6
6
  constructor(target: NativePreviewTarget);
7
- begin(label: string): Promise<boolean>;
7
+ begin(label: string, locationSummary?: string): Promise<boolean>;
8
8
  updateStatus(label: string): Promise<boolean>;
9
9
  updateDraft(draftText: string, provisional: boolean): Promise<boolean>;
10
10
  complete(label: string, finalReply: string): Promise<boolean>;
@@ -4,7 +4,7 @@ import { openZhipinNativePagePort } from "../pages/zhipin/native-page.ts";
4
4
  import type { ZhipinNativePagePort } from "../pages/zhipin/native-page.ts";
5
5
  import { savePreparedReply } from "../reply-authority/prepared-reply-store.ts";
6
6
  import { NativeReplyPreviewVisualSession } from "../reply-authority/reply-preview-visual.ts";
7
- type NativeVisualActivitySessionLike = Pick<NativeVisualActivitySession, "begin" | "highlightSelector" | "succeed" | "fail">;
7
+ type NativeVisualActivitySessionLike = Pick<NativeVisualActivitySession, "begin" | "highlightSelector" | "succeed" | "fail" | "clear">;
8
8
  type ReplyPreviewVisualSessionLike = Pick<NativeReplyPreviewVisualSession, "begin" | "updateStatus" | "updateDraft" | "complete" | "fail">;
9
9
  type ZhipinGenerateReplyPreviewDeps = {
10
10
  readonly openNativePagePort: typeof openZhipinNativePagePort;
@@ -18,18 +18,18 @@ export declare const zhipinGenerateReplyPreview: import("@roll-agent/sdk").ToolD
18
18
  index?: number | undefined;
19
19
  conversationId?: string | undefined;
20
20
  candidateName?: string | undefined;
21
- maxMessages?: number | undefined;
22
21
  reasoning?: {
23
22
  enabled: boolean;
24
23
  effort?: "high" | "low" | "medium" | undefined;
25
24
  scope?: "all" | "reply" | undefined;
26
25
  } | undefined;
26
+ maxMessages?: number | undefined;
27
27
  }, {
28
28
  success: boolean;
29
29
  error?: string | undefined;
30
+ confidence?: number | undefined;
30
31
  requestId?: string | undefined;
31
32
  suggestedReply?: string | undefined;
32
- confidence?: number | undefined;
33
33
  stage?: string | undefined;
34
34
  preparedReplyId?: string | undefined;
35
35
  expiresAt?: number | undefined;
@@ -33,6 +33,13 @@ export declare const zhipinGetCandidateInfo: import("@roll-agent/sdk").ToolDefin
33
33
  recruiterMessages: number;
34
34
  systemMessages: number;
35
35
  };
36
+ locationSignals: {
37
+ source: "candidate_message" | "conversation_history" | "candidate_expected_location" | "communication_position";
38
+ text: string;
39
+ confidence: number;
40
+ city?: string | undefined;
41
+ intent?: "nearby_store" | "store_address" | "expected_area" | undefined;
42
+ }[];
36
43
  chatMessages: {
37
44
  index: number;
38
45
  content: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roll-agent/browser-use-agent",
3
- "version": "0.16.1",
3
+ "version": "0.17.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "zod": "^3.25.76",
48
- "@roll-agent/reply-authority-client": "0.1.2",
48
+ "@roll-agent/reply-authority-client": "0.2.0",
49
49
  "@roll-agent/sdk": "0.2.0",
50
50
  "@roll-agent/browser": "0.9.0"
51
51
  },
@@ -140,6 +140,49 @@ recommend-list -> 推荐牛人列表,默认向下滚动,去重主键 candid
140
140
  - 没有分隔符时不输出。
141
141
  - 禁止用通用岗位名或 `zhipin_get_candidate_list.company` 伪造品牌。
142
142
 
143
+ ## locationSignals
144
+
145
+ `zhipin_get_candidate_info` 和 `zhipin_generate_reply_preview` 会在读取聊天记录后输出/透传结构化地点证据 `locationSignals`,供下游 Reply Authority 做 geocode 与门店/岗位距离匹配。
146
+
147
+ 字段形状(与 `@roll-agent/reply-authority-client` 契约一致):
148
+
149
+ ```json
150
+ {
151
+ "text": "人民广场",
152
+ "source": "candidate_message",
153
+ "city": "上海",
154
+ "intent": "nearby_store",
155
+ "confidence": 0.93
156
+ }
157
+ ```
158
+
159
+ `source` 取值:
160
+
161
+ | `source` | 含义 |
162
+ | --- | --- |
163
+ | `candidate_message` | 候选人消息中的地点片段(最高优先级) |
164
+ | `conversation_history` | 近几轮对话中的地点引用 |
165
+ | `candidate_expected_location` | 候选人资料里的期望城市/区域(弱信号) |
166
+ | `communication_position` | 沟通岗位文本中可确认的城市/门店片段 |
167
+
168
+ `intent` 常见取值:`nearby_store`(附近门店/岗位)、`store_address`(门店地址)、`expected_area`(期望区域)。
169
+
170
+ 抽取规则:
171
+
172
+ 1. browser-use 通过指挥官 LLM 抽取,并在超时或失败时回退到规则匹配;`text` 必须来自输入原文,不改写成下游门店名。
173
+ 2. 多轮对话会扫描全部候选人消息(去重),避免「历史问过地点、最新一句非地点」时丢失证据。
174
+ 3. `candidateInfo.expectedLocation` 只作城市边界弱信号(confidence 通常 ≤ 0.6),不能替代候选人本轮追问的具体 POI。
175
+ 4. 问候/职位介绍类消息可能跳过 LLM 抽取,仅保留 `expectedLocation` 弱信号。
176
+ 5. orchestrator 不要自行构造或改写 `locationSignals`;需要地点证据时调用 `zhipin_get_candidate_info` 或 `zhipin_generate_reply_preview`,由工具自动填充。
177
+
178
+ 边界:
179
+
180
+ - browser-use **不**调用外部地图、**不**做 geocode、**不**计算门店距离。
181
+ - 岗位/门店事实源仍是下游同步的岗位配置;外部地图 POI 不能当作门店或岗位事实。
182
+ - `smart-reply-agent.generate_reply` 只校验 schema 并原样转发 `locationSignals`,不做地点推断。
183
+
184
+ `zhipin_generate_reply_preview` 会把非空 `locationSignals` 写入 Reply Authority stream input;`zhipin_get_candidate_info` 在 output 中返回同结构数组,便于编排器先读证据再决定是否生成回复。
185
+
143
186
  ## Reply Authority
144
187
 
145
188
  `zhipin_send_prepared_reply` 只接受 `zhipin_generate_reply_preview` 生成的 `preparedReplyId`,内部再取回 Reply Authority Service 签发的 envelope 并完成验签。