@roll-agent/browser-use-agent 0.12.1 → 0.14.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 +94 -1
- package/dist/auto-window-layout.d.ts +21 -0
- package/dist/browser-foreground.d.ts +10 -0
- package/dist/browser-instance-pool.d.ts +29 -0
- package/dist/diagnostics/effective-env.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/pages/zhipin/semantic-refs.d.ts +1 -0
- package/dist/runtime-config.d.ts +320 -0
- package/dist/runtime-holder.d.ts +10 -1
- package/dist/tools/browser-instance-input.d.ts +8 -0
- package/dist/tools/browser-instance-platform.d.ts +3 -0
- package/dist/tools/browser-ref-schemas.d.ts +12 -12
- package/dist/tools/browser-status.d.ts +24 -0
- package/dist/tools/click-ref.d.ts +2 -2
- package/dist/tools/type-ref.d.ts +2 -2
- package/dist/tools/zhipin-get-username.d.ts +1 -1
- package/package.json +2 -2
- package/references/env.yaml +7 -4
- package/references/zhipin-workflows.md +28 -5
|
@@ -35,6 +35,7 @@ export declare function rememberZhipinCandidateRefs(candidates: readonly ZhipinC
|
|
|
35
35
|
export declare function rememberZhipinRecommendJobRefs(jobs: readonly ZhipinRecommendJobRefSource[]): ZhipinRecommendJobRefTarget[];
|
|
36
36
|
export declare function clearZhipinCandidateRefsForTests(): void;
|
|
37
37
|
export declare function clearZhipinRecommendJobRefsForTests(): void;
|
|
38
|
+
export declare function runWithZhipinSemanticRefScopeForTests<T>(scope: string, run: () => T): T;
|
|
38
39
|
export declare function resolveZhipinCandidateRefTarget(candidateRef: string): ZhipinCandidateRefTarget;
|
|
39
40
|
export declare function resolveZhipinRecommendJobRefTarget(jobRef: string): ZhipinRecommendJobRefTarget;
|
|
40
41
|
export declare function resolveZhipinCandidateTargets(input: {
|
package/dist/runtime-config.d.ts
CHANGED
|
@@ -1,2 +1,322 @@
|
|
|
1
1
|
import type { BrowserRuntimeConfig } from "@roll-agent/browser";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare const BrowserInstanceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
4
|
+
platform: z.ZodOptional<z.ZodEnum<["zhipin", "yupao"]>>;
|
|
5
|
+
mode: z.ZodDefault<z.ZodEnum<["managed-cdp", "remote-cdp", "existing-session"]>>;
|
|
6
|
+
headless: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
cdpUrl: z.ZodOptional<z.ZodString>;
|
|
8
|
+
cdpHost: z.ZodDefault<z.ZodString>;
|
|
9
|
+
cdpPort: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
channel: z.ZodDefault<z.ZodEnum<["chrome", "chromium", "msedge"]>>;
|
|
11
|
+
executablePath: z.ZodOptional<z.ZodString>;
|
|
12
|
+
userDataDir: z.ZodString;
|
|
13
|
+
sessionsDir: z.ZodOptional<z.ZodString>;
|
|
14
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
15
|
+
profileName: z.ZodOptional<z.ZodString>;
|
|
16
|
+
windowBounds: z.ZodOptional<z.ZodObject<{
|
|
17
|
+
x: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
y: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
x?: number | undefined;
|
|
23
|
+
y?: number | undefined;
|
|
24
|
+
width?: number | undefined;
|
|
25
|
+
height?: number | undefined;
|
|
26
|
+
}, {
|
|
27
|
+
x?: number | undefined;
|
|
28
|
+
y?: number | undefined;
|
|
29
|
+
width?: number | undefined;
|
|
30
|
+
height?: number | undefined;
|
|
31
|
+
}>>;
|
|
32
|
+
trackingAgentId: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
35
|
+
cdpHost: string;
|
|
36
|
+
channel: "chrome" | "chromium" | "msedge";
|
|
37
|
+
userDataDir: string;
|
|
38
|
+
headless?: boolean | undefined;
|
|
39
|
+
profileName?: string | undefined;
|
|
40
|
+
cdpUrl?: string | undefined;
|
|
41
|
+
cdpPort?: number | undefined;
|
|
42
|
+
executablePath?: string | undefined;
|
|
43
|
+
args?: string[] | undefined;
|
|
44
|
+
windowBounds?: {
|
|
45
|
+
x?: number | undefined;
|
|
46
|
+
y?: number | undefined;
|
|
47
|
+
width?: number | undefined;
|
|
48
|
+
height?: number | undefined;
|
|
49
|
+
} | undefined;
|
|
50
|
+
sessionsDir?: string | undefined;
|
|
51
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
52
|
+
trackingAgentId?: string | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
userDataDir: string;
|
|
55
|
+
mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
|
|
56
|
+
headless?: boolean | undefined;
|
|
57
|
+
profileName?: string | undefined;
|
|
58
|
+
cdpUrl?: string | undefined;
|
|
59
|
+
cdpHost?: string | undefined;
|
|
60
|
+
cdpPort?: number | undefined;
|
|
61
|
+
channel?: "chrome" | "chromium" | "msedge" | undefined;
|
|
62
|
+
executablePath?: string | undefined;
|
|
63
|
+
args?: string[] | undefined;
|
|
64
|
+
windowBounds?: {
|
|
65
|
+
x?: number | undefined;
|
|
66
|
+
y?: number | undefined;
|
|
67
|
+
width?: number | undefined;
|
|
68
|
+
height?: number | undefined;
|
|
69
|
+
} | undefined;
|
|
70
|
+
sessionsDir?: string | undefined;
|
|
71
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
72
|
+
trackingAgentId?: string | undefined;
|
|
73
|
+
}>, {
|
|
74
|
+
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
75
|
+
cdpHost: string;
|
|
76
|
+
channel: "chrome" | "chromium" | "msedge";
|
|
77
|
+
userDataDir: string;
|
|
78
|
+
headless?: boolean | undefined;
|
|
79
|
+
profileName?: string | undefined;
|
|
80
|
+
cdpUrl?: string | undefined;
|
|
81
|
+
cdpPort?: number | undefined;
|
|
82
|
+
executablePath?: string | undefined;
|
|
83
|
+
args?: string[] | undefined;
|
|
84
|
+
windowBounds?: {
|
|
85
|
+
x?: number | undefined;
|
|
86
|
+
y?: number | undefined;
|
|
87
|
+
width?: number | undefined;
|
|
88
|
+
height?: number | undefined;
|
|
89
|
+
} | undefined;
|
|
90
|
+
sessionsDir?: string | undefined;
|
|
91
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
92
|
+
trackingAgentId?: string | undefined;
|
|
93
|
+
}, {
|
|
94
|
+
userDataDir: string;
|
|
95
|
+
mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
|
|
96
|
+
headless?: boolean | undefined;
|
|
97
|
+
profileName?: string | undefined;
|
|
98
|
+
cdpUrl?: string | undefined;
|
|
99
|
+
cdpHost?: string | undefined;
|
|
100
|
+
cdpPort?: number | undefined;
|
|
101
|
+
channel?: "chrome" | "chromium" | "msedge" | undefined;
|
|
102
|
+
executablePath?: string | undefined;
|
|
103
|
+
args?: string[] | undefined;
|
|
104
|
+
windowBounds?: {
|
|
105
|
+
x?: number | undefined;
|
|
106
|
+
y?: number | undefined;
|
|
107
|
+
width?: number | undefined;
|
|
108
|
+
height?: number | undefined;
|
|
109
|
+
} | undefined;
|
|
110
|
+
sessionsDir?: string | undefined;
|
|
111
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
112
|
+
trackingAgentId?: string | undefined;
|
|
113
|
+
}>;
|
|
114
|
+
export declare const BrowserInstancesConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
115
|
+
defaultInstance: z.ZodOptional<z.ZodString>;
|
|
116
|
+
instances: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
|
|
117
|
+
platform: z.ZodOptional<z.ZodEnum<["zhipin", "yupao"]>>;
|
|
118
|
+
mode: z.ZodDefault<z.ZodEnum<["managed-cdp", "remote-cdp", "existing-session"]>>;
|
|
119
|
+
headless: z.ZodOptional<z.ZodBoolean>;
|
|
120
|
+
cdpUrl: z.ZodOptional<z.ZodString>;
|
|
121
|
+
cdpHost: z.ZodDefault<z.ZodString>;
|
|
122
|
+
cdpPort: z.ZodOptional<z.ZodNumber>;
|
|
123
|
+
channel: z.ZodDefault<z.ZodEnum<["chrome", "chromium", "msedge"]>>;
|
|
124
|
+
executablePath: z.ZodOptional<z.ZodString>;
|
|
125
|
+
userDataDir: z.ZodString;
|
|
126
|
+
sessionsDir: z.ZodOptional<z.ZodString>;
|
|
127
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
128
|
+
profileName: z.ZodOptional<z.ZodString>;
|
|
129
|
+
windowBounds: z.ZodOptional<z.ZodObject<{
|
|
130
|
+
x: z.ZodOptional<z.ZodNumber>;
|
|
131
|
+
y: z.ZodOptional<z.ZodNumber>;
|
|
132
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
134
|
+
}, "strip", z.ZodTypeAny, {
|
|
135
|
+
x?: number | undefined;
|
|
136
|
+
y?: number | undefined;
|
|
137
|
+
width?: number | undefined;
|
|
138
|
+
height?: number | undefined;
|
|
139
|
+
}, {
|
|
140
|
+
x?: number | undefined;
|
|
141
|
+
y?: number | undefined;
|
|
142
|
+
width?: number | undefined;
|
|
143
|
+
height?: number | undefined;
|
|
144
|
+
}>>;
|
|
145
|
+
trackingAgentId: z.ZodOptional<z.ZodString>;
|
|
146
|
+
}, "strip", z.ZodTypeAny, {
|
|
147
|
+
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
148
|
+
cdpHost: string;
|
|
149
|
+
channel: "chrome" | "chromium" | "msedge";
|
|
150
|
+
userDataDir: string;
|
|
151
|
+
headless?: boolean | undefined;
|
|
152
|
+
profileName?: string | undefined;
|
|
153
|
+
cdpUrl?: string | undefined;
|
|
154
|
+
cdpPort?: number | undefined;
|
|
155
|
+
executablePath?: string | undefined;
|
|
156
|
+
args?: string[] | undefined;
|
|
157
|
+
windowBounds?: {
|
|
158
|
+
x?: number | undefined;
|
|
159
|
+
y?: number | undefined;
|
|
160
|
+
width?: number | undefined;
|
|
161
|
+
height?: number | undefined;
|
|
162
|
+
} | undefined;
|
|
163
|
+
sessionsDir?: string | undefined;
|
|
164
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
165
|
+
trackingAgentId?: string | undefined;
|
|
166
|
+
}, {
|
|
167
|
+
userDataDir: string;
|
|
168
|
+
mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
|
|
169
|
+
headless?: boolean | undefined;
|
|
170
|
+
profileName?: string | undefined;
|
|
171
|
+
cdpUrl?: string | undefined;
|
|
172
|
+
cdpHost?: string | undefined;
|
|
173
|
+
cdpPort?: number | undefined;
|
|
174
|
+
channel?: "chrome" | "chromium" | "msedge" | undefined;
|
|
175
|
+
executablePath?: string | undefined;
|
|
176
|
+
args?: string[] | undefined;
|
|
177
|
+
windowBounds?: {
|
|
178
|
+
x?: number | undefined;
|
|
179
|
+
y?: number | undefined;
|
|
180
|
+
width?: number | undefined;
|
|
181
|
+
height?: number | undefined;
|
|
182
|
+
} | undefined;
|
|
183
|
+
sessionsDir?: string | undefined;
|
|
184
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
185
|
+
trackingAgentId?: string | undefined;
|
|
186
|
+
}>, {
|
|
187
|
+
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
188
|
+
cdpHost: string;
|
|
189
|
+
channel: "chrome" | "chromium" | "msedge";
|
|
190
|
+
userDataDir: string;
|
|
191
|
+
headless?: boolean | undefined;
|
|
192
|
+
profileName?: string | undefined;
|
|
193
|
+
cdpUrl?: string | undefined;
|
|
194
|
+
cdpPort?: number | undefined;
|
|
195
|
+
executablePath?: string | undefined;
|
|
196
|
+
args?: string[] | undefined;
|
|
197
|
+
windowBounds?: {
|
|
198
|
+
x?: number | undefined;
|
|
199
|
+
y?: number | undefined;
|
|
200
|
+
width?: number | undefined;
|
|
201
|
+
height?: number | undefined;
|
|
202
|
+
} | undefined;
|
|
203
|
+
sessionsDir?: string | undefined;
|
|
204
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
205
|
+
trackingAgentId?: string | undefined;
|
|
206
|
+
}, {
|
|
207
|
+
userDataDir: string;
|
|
208
|
+
mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
|
|
209
|
+
headless?: boolean | undefined;
|
|
210
|
+
profileName?: string | undefined;
|
|
211
|
+
cdpUrl?: string | undefined;
|
|
212
|
+
cdpHost?: string | undefined;
|
|
213
|
+
cdpPort?: number | undefined;
|
|
214
|
+
channel?: "chrome" | "chromium" | "msedge" | undefined;
|
|
215
|
+
executablePath?: string | undefined;
|
|
216
|
+
args?: string[] | undefined;
|
|
217
|
+
windowBounds?: {
|
|
218
|
+
x?: number | undefined;
|
|
219
|
+
y?: number | undefined;
|
|
220
|
+
width?: number | undefined;
|
|
221
|
+
height?: number | undefined;
|
|
222
|
+
} | undefined;
|
|
223
|
+
sessionsDir?: string | undefined;
|
|
224
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
225
|
+
trackingAgentId?: string | undefined;
|
|
226
|
+
}>>>;
|
|
227
|
+
}, "strip", z.ZodTypeAny, {
|
|
228
|
+
instances: Record<string, {
|
|
229
|
+
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
230
|
+
cdpHost: string;
|
|
231
|
+
channel: "chrome" | "chromium" | "msedge";
|
|
232
|
+
userDataDir: string;
|
|
233
|
+
headless?: boolean | undefined;
|
|
234
|
+
profileName?: string | undefined;
|
|
235
|
+
cdpUrl?: string | undefined;
|
|
236
|
+
cdpPort?: number | undefined;
|
|
237
|
+
executablePath?: string | undefined;
|
|
238
|
+
args?: string[] | undefined;
|
|
239
|
+
windowBounds?: {
|
|
240
|
+
x?: number | undefined;
|
|
241
|
+
y?: number | undefined;
|
|
242
|
+
width?: number | undefined;
|
|
243
|
+
height?: number | undefined;
|
|
244
|
+
} | undefined;
|
|
245
|
+
sessionsDir?: string | undefined;
|
|
246
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
247
|
+
trackingAgentId?: string | undefined;
|
|
248
|
+
}>;
|
|
249
|
+
defaultInstance?: string | undefined;
|
|
250
|
+
}, {
|
|
251
|
+
instances?: Record<string, {
|
|
252
|
+
userDataDir: string;
|
|
253
|
+
mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
|
|
254
|
+
headless?: boolean | undefined;
|
|
255
|
+
profileName?: string | undefined;
|
|
256
|
+
cdpUrl?: string | undefined;
|
|
257
|
+
cdpHost?: string | undefined;
|
|
258
|
+
cdpPort?: number | undefined;
|
|
259
|
+
channel?: "chrome" | "chromium" | "msedge" | undefined;
|
|
260
|
+
executablePath?: string | undefined;
|
|
261
|
+
args?: string[] | undefined;
|
|
262
|
+
windowBounds?: {
|
|
263
|
+
x?: number | undefined;
|
|
264
|
+
y?: number | undefined;
|
|
265
|
+
width?: number | undefined;
|
|
266
|
+
height?: number | undefined;
|
|
267
|
+
} | undefined;
|
|
268
|
+
sessionsDir?: string | undefined;
|
|
269
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
270
|
+
trackingAgentId?: string | undefined;
|
|
271
|
+
}> | undefined;
|
|
272
|
+
defaultInstance?: string | undefined;
|
|
273
|
+
}>, {
|
|
274
|
+
instances: Record<string, {
|
|
275
|
+
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
276
|
+
cdpHost: string;
|
|
277
|
+
channel: "chrome" | "chromium" | "msedge";
|
|
278
|
+
userDataDir: string;
|
|
279
|
+
headless?: boolean | undefined;
|
|
280
|
+
profileName?: string | undefined;
|
|
281
|
+
cdpUrl?: string | undefined;
|
|
282
|
+
cdpPort?: number | undefined;
|
|
283
|
+
executablePath?: string | undefined;
|
|
284
|
+
args?: string[] | undefined;
|
|
285
|
+
windowBounds?: {
|
|
286
|
+
x?: number | undefined;
|
|
287
|
+
y?: number | undefined;
|
|
288
|
+
width?: number | undefined;
|
|
289
|
+
height?: number | undefined;
|
|
290
|
+
} | undefined;
|
|
291
|
+
sessionsDir?: string | undefined;
|
|
292
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
293
|
+
trackingAgentId?: string | undefined;
|
|
294
|
+
}>;
|
|
295
|
+
defaultInstance?: string | undefined;
|
|
296
|
+
}, {
|
|
297
|
+
instances?: Record<string, {
|
|
298
|
+
userDataDir: string;
|
|
299
|
+
mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
|
|
300
|
+
headless?: boolean | undefined;
|
|
301
|
+
profileName?: string | undefined;
|
|
302
|
+
cdpUrl?: string | undefined;
|
|
303
|
+
cdpHost?: string | undefined;
|
|
304
|
+
cdpPort?: number | undefined;
|
|
305
|
+
channel?: "chrome" | "chromium" | "msedge" | undefined;
|
|
306
|
+
executablePath?: string | undefined;
|
|
307
|
+
args?: string[] | undefined;
|
|
308
|
+
windowBounds?: {
|
|
309
|
+
x?: number | undefined;
|
|
310
|
+
y?: number | undefined;
|
|
311
|
+
width?: number | undefined;
|
|
312
|
+
height?: number | undefined;
|
|
313
|
+
} | undefined;
|
|
314
|
+
sessionsDir?: string | undefined;
|
|
315
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
316
|
+
trackingAgentId?: string | undefined;
|
|
317
|
+
}> | undefined;
|
|
318
|
+
defaultInstance?: string | undefined;
|
|
319
|
+
}>;
|
|
320
|
+
export type BrowserInstancesConfig = z.infer<typeof BrowserInstancesConfigSchema>;
|
|
2
321
|
export declare function loadRuntimeConfigFromEnv(env?: NodeJS.ProcessEnv): BrowserRuntimeConfig;
|
|
322
|
+
export declare function loadBrowserInstancesConfigFromEnv(env?: NodeJS.ProcessEnv): BrowserInstancesConfig | undefined;
|
package/dist/runtime-holder.d.ts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import { BrowserRuntime, BrowserContextManager, SessionStore } from "@roll-agent/browser";
|
|
2
2
|
import type { BrowserRuntimeConfig } from "@roll-agent/browser";
|
|
3
|
-
|
|
3
|
+
import { BrowserInstancePool, type BrowserRuntimeBundle } from "./browser-instance-pool.ts";
|
|
4
|
+
import type { BrowserInstancesConfig } from "./runtime-config.ts";
|
|
5
|
+
export declare function initRuntime(config: BrowserRuntimeConfig, instancesConfig?: BrowserInstancesConfig): Promise<void>;
|
|
4
6
|
export declare function getRuntime(): BrowserRuntime;
|
|
5
7
|
export declare function getContextManager(): BrowserContextManager;
|
|
6
8
|
export declare function getSessionStore(): SessionStore;
|
|
7
9
|
export declare function setReplyAuthorityKeysLoaded(loaded: boolean): void;
|
|
8
10
|
export declare function getReplyAuthorityKeysLoaded(): boolean;
|
|
11
|
+
export declare function getBrowserInstancePoolOrUndefined(): BrowserInstancePool | undefined;
|
|
12
|
+
export declare function getBrowserInstancePool(): BrowserInstancePool;
|
|
13
|
+
export declare function ensureCurrentBundleStarted(): Promise<void>;
|
|
14
|
+
export declare function isConfiguredMultiBrowserInstancePool(): boolean;
|
|
15
|
+
export declare function resolveRecruitmentTrackingAgentId(defaultAgentId?: string): string | undefined;
|
|
16
|
+
export declare function getCurrentBrowserBundle(): BrowserRuntimeBundle;
|
|
9
17
|
export declare function setRuntimeStateForTests(state: {
|
|
10
18
|
readonly runtime?: BrowserRuntime;
|
|
11
19
|
readonly contextManager?: BrowserContextManager;
|
|
12
20
|
readonly sessionStore?: SessionStore;
|
|
21
|
+
readonly instancePool?: BrowserInstancePool;
|
|
13
22
|
}): void;
|
|
14
23
|
export declare function shutdownRuntime(): Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AnyToolDefinition } from "@roll-agent/sdk";
|
|
2
|
+
import type { Platform } from "@roll-agent/browser";
|
|
3
|
+
export interface BrowserInstanceToolOptions {
|
|
4
|
+
readonly startRuntime?: boolean;
|
|
5
|
+
readonly expectedPlatform?: Platform;
|
|
6
|
+
}
|
|
7
|
+
export declare function inferExpectedPlatformFromToolName(toolName: string): Platform | undefined;
|
|
8
|
+
export declare function withBrowserInstanceInput(tool: AnyToolDefinition, options?: BrowserInstanceToolOptions): AnyToolDefinition;
|
|
@@ -11,22 +11,22 @@ export declare const BrowserElementRefTargetSchema: z.ZodObject<{
|
|
|
11
11
|
frameId: z.ZodOptional<z.ZodString>;
|
|
12
12
|
disabled: z.ZodBoolean;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
14
16
|
ref: string;
|
|
15
17
|
role: string;
|
|
16
18
|
name: string;
|
|
17
19
|
disabled: boolean;
|
|
18
|
-
x: number;
|
|
19
|
-
y: number;
|
|
20
20
|
resolvedBy: "backend_node_id" | "role_name_nth";
|
|
21
21
|
backendNodeId?: number | undefined;
|
|
22
22
|
frameId?: string | undefined;
|
|
23
23
|
}, {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
24
26
|
ref: string;
|
|
25
27
|
role: string;
|
|
26
28
|
name: string;
|
|
27
29
|
disabled: boolean;
|
|
28
|
-
x: number;
|
|
29
|
-
y: number;
|
|
30
30
|
resolvedBy: "backend_node_id" | "role_name_nth";
|
|
31
31
|
backendNodeId?: number | undefined;
|
|
32
32
|
frameId?: string | undefined;
|
|
@@ -46,22 +46,22 @@ export declare const BrowserElementRefActionOutputSchema: z.ZodObject<{
|
|
|
46
46
|
frameId: z.ZodOptional<z.ZodString>;
|
|
47
47
|
disabled: z.ZodBoolean;
|
|
48
48
|
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
49
51
|
ref: string;
|
|
50
52
|
role: string;
|
|
51
53
|
name: string;
|
|
52
54
|
disabled: boolean;
|
|
53
|
-
x: number;
|
|
54
|
-
y: number;
|
|
55
55
|
resolvedBy: "backend_node_id" | "role_name_nth";
|
|
56
56
|
backendNodeId?: number | undefined;
|
|
57
57
|
frameId?: string | undefined;
|
|
58
58
|
}, {
|
|
59
|
+
x: number;
|
|
60
|
+
y: number;
|
|
59
61
|
ref: string;
|
|
60
62
|
role: string;
|
|
61
63
|
name: string;
|
|
62
64
|
disabled: boolean;
|
|
63
|
-
x: number;
|
|
64
|
-
y: number;
|
|
65
65
|
resolvedBy: "backend_node_id" | "role_name_nth";
|
|
66
66
|
backendNodeId?: number | undefined;
|
|
67
67
|
frameId?: string | undefined;
|
|
@@ -69,12 +69,12 @@ export declare const BrowserElementRefActionOutputSchema: z.ZodObject<{
|
|
|
69
69
|
}, "strip", z.ZodTypeAny, {
|
|
70
70
|
ref: string;
|
|
71
71
|
target: {
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
72
74
|
ref: string;
|
|
73
75
|
role: string;
|
|
74
76
|
name: string;
|
|
75
77
|
disabled: boolean;
|
|
76
|
-
x: number;
|
|
77
|
-
y: number;
|
|
78
78
|
resolvedBy: "backend_node_id" | "role_name_nth";
|
|
79
79
|
backendNodeId?: number | undefined;
|
|
80
80
|
frameId?: string | undefined;
|
|
@@ -84,12 +84,12 @@ export declare const BrowserElementRefActionOutputSchema: z.ZodObject<{
|
|
|
84
84
|
}, {
|
|
85
85
|
ref: string;
|
|
86
86
|
target: {
|
|
87
|
+
x: number;
|
|
88
|
+
y: number;
|
|
87
89
|
ref: string;
|
|
88
90
|
role: string;
|
|
89
91
|
name: string;
|
|
90
92
|
disabled: boolean;
|
|
91
|
-
x: number;
|
|
92
|
-
y: number;
|
|
93
93
|
resolvedBy: "backend_node_id" | "role_name_nth";
|
|
94
94
|
backendNodeId?: number | undefined;
|
|
95
95
|
frameId?: string | undefined;
|
|
@@ -6,6 +6,7 @@ export declare const browserStatus: import("@roll-agent/sdk").ToolDefinition<{},
|
|
|
6
6
|
maxPageContentBytes?: number | undefined;
|
|
7
7
|
maxSnapshotNodes?: number | undefined;
|
|
8
8
|
actionPolicy?: "log" | "deny" | "confirm" | undefined;
|
|
9
|
+
foregroundPolicy?: "when-minimized" | "always" | "never" | undefined;
|
|
9
10
|
};
|
|
10
11
|
running: boolean;
|
|
11
12
|
activeSessions: {
|
|
@@ -13,6 +14,7 @@ export declare const browserStatus: import("@roll-agent/sdk").ToolDefinition<{},
|
|
|
13
14
|
pagesOpen: number;
|
|
14
15
|
hasLoginState: boolean | null;
|
|
15
16
|
loginStateSource: "snapshot" | "profile" | "none" | "unknown";
|
|
17
|
+
browserInstance?: string | undefined;
|
|
16
18
|
currentUrl?: string | undefined;
|
|
17
19
|
}[];
|
|
18
20
|
replyAuthorityKeysLoaded: boolean;
|
|
@@ -32,4 +34,26 @@ export declare const browserStatus: import("@roll-agent/sdk").ToolDefinition<{},
|
|
|
32
34
|
present: boolean;
|
|
33
35
|
fingerprint?: string | undefined;
|
|
34
36
|
}>;
|
|
37
|
+
defaultInstanceId?: string | undefined;
|
|
38
|
+
primaryInstanceId?: string | undefined;
|
|
39
|
+
instances?: {
|
|
40
|
+
id: string;
|
|
41
|
+
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
42
|
+
profile: {
|
|
43
|
+
exists: boolean;
|
|
44
|
+
writable: boolean;
|
|
45
|
+
userDataDir?: string | undefined;
|
|
46
|
+
};
|
|
47
|
+
cdp: {
|
|
48
|
+
endpoint: string;
|
|
49
|
+
versionReachable: boolean;
|
|
50
|
+
listReachable: boolean;
|
|
51
|
+
port?: number | undefined;
|
|
52
|
+
};
|
|
53
|
+
tracking: {
|
|
54
|
+
source: "instance" | "default-env" | "missing";
|
|
55
|
+
agentIdFingerprint?: string | undefined;
|
|
56
|
+
};
|
|
57
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
58
|
+
}[] | undefined;
|
|
35
59
|
}>;
|
|
@@ -7,12 +7,12 @@ export declare const clickRef: import("@roll-agent/sdk").ToolDefinition<{
|
|
|
7
7
|
}, {
|
|
8
8
|
ref: string;
|
|
9
9
|
target: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
10
12
|
ref: string;
|
|
11
13
|
role: string;
|
|
12
14
|
name: string;
|
|
13
15
|
disabled: boolean;
|
|
14
|
-
x: number;
|
|
15
|
-
y: number;
|
|
16
16
|
resolvedBy: "backend_node_id" | "role_name_nth";
|
|
17
17
|
backendNodeId?: number | undefined;
|
|
18
18
|
frameId?: string | undefined;
|
package/dist/tools/type-ref.d.ts
CHANGED
|
@@ -9,12 +9,12 @@ export declare const typeRef: import("@roll-agent/sdk").ToolDefinition<{
|
|
|
9
9
|
}, {
|
|
10
10
|
ref: string;
|
|
11
11
|
target: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
12
14
|
ref: string;
|
|
13
15
|
role: string;
|
|
14
16
|
name: string;
|
|
15
17
|
disabled: boolean;
|
|
16
|
-
x: number;
|
|
17
|
-
y: number;
|
|
18
18
|
resolvedBy: "backend_node_id" | "role_name_nth";
|
|
19
19
|
backendNodeId?: number | undefined;
|
|
20
20
|
frameId?: string | undefined;
|
|
@@ -11,8 +11,8 @@ export declare function setZhipinGetUsernameDepsForTests(override: Partial<Zhipi
|
|
|
11
11
|
export declare const zhipinGetUsername: import("@roll-agent/sdk").ToolDefinition<{}, {
|
|
12
12
|
success: boolean;
|
|
13
13
|
username: string;
|
|
14
|
-
error?: string | undefined;
|
|
15
14
|
source?: string | undefined;
|
|
15
|
+
error?: string | undefined;
|
|
16
16
|
usedSelector?: string | undefined;
|
|
17
17
|
usedStrategy?: string | undefined;
|
|
18
18
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roll-agent/browser-use-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"zod": "^3.25.76",
|
|
48
48
|
"@roll-agent/reply-authority-client": "0.1.2",
|
|
49
49
|
"@roll-agent/sdk": "0.2.0",
|
|
50
|
-
"@roll-agent/browser": "0.
|
|
50
|
+
"@roll-agent/browser": "0.7.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/node": "^22.0.0"
|
package/references/env.yaml
CHANGED
|
@@ -9,7 +9,7 @@ required:
|
|
|
9
9
|
purpose: Reply Authority Service 公钥分发端点;`zhipin_send_prepared_reply` 启动预热和本地 Ed25519 验签都依赖它
|
|
10
10
|
example: https://reply-authority.duliday.com/.well-known/reply-authority-keys
|
|
11
11
|
- name: RECRUITMENT_EVENTS_DEFAULT_AGENT_ID
|
|
12
|
-
purpose: 单 browser-use 实例 / 单 Boss 账号部署下的默认招聘业务 Agent ID
|
|
12
|
+
purpose: 单 browser-use 实例 / 单 Boss 账号部署下的默认招聘业务 Agent ID;多 browser.instances 下仅作为实例缺少 trackingAgentId 时的 fallback;招聘事件默认启用,上报时必须有可解析归因
|
|
13
13
|
example: zhipin-shanghai-kfc-001
|
|
14
14
|
- name: RECRUITMENT_EVENTS_API_TOKEN
|
|
15
15
|
purpose: 招聘事件 Open API Bearer token;公开 npm 包不内置兜底 token,必须由部署环境提供
|
|
@@ -24,13 +24,16 @@ optional:
|
|
|
24
24
|
default: https://huajune.duliday.com
|
|
25
25
|
example: https://example.com
|
|
26
26
|
- name: BROWSER_SECURITY_JSON
|
|
27
|
-
purpose: 浏览器安全策略 JSON;可配置 domainAllowlist、maxPageContentBytes、maxSnapshotNodes、actionPolicy
|
|
28
|
-
default: '{"domainAllowlist":[],"maxPageContentBytes":102400,"maxSnapshotNodes":500,"actionPolicy":"log"}'
|
|
29
|
-
example: '{"domainAllowlist":["zhipin.com"],"maxPageContentBytes":102400,"maxSnapshotNodes":500,"actionPolicy":"log"}'
|
|
27
|
+
purpose: 浏览器安全策略 JSON;可配置 domainAllowlist、maxPageContentBytes、maxSnapshotNodes、actionPolicy、foregroundPolicy;foregroundPolicy 默认 when-minimized,无需显式配置
|
|
28
|
+
default: '{"domainAllowlist":[],"maxPageContentBytes":102400,"maxSnapshotNodes":500,"actionPolicy":"log","foregroundPolicy":"when-minimized"}'
|
|
29
|
+
example: '{"domainAllowlist":["zhipin.com"],"maxPageContentBytes":102400,"maxSnapshotNodes":500,"actionPolicy":"log","foregroundPolicy":"when-minimized"}'
|
|
30
30
|
- name: BROWSER_USE_POLICY_JSON
|
|
31
31
|
purpose: browser-use 工具级业务策略 JSON;可按 exact tool name 配置 log、deny、confirm
|
|
32
32
|
default: '{"approvalTtlMs":300000,"tools":{}}'
|
|
33
33
|
example: '{"approvalTtlMs":300000,"tools":{"zhipin_send_prepared_reply":{"policy":"confirm"}}}'
|
|
34
|
+
- name: BROWSER_INSTANCES_JSON
|
|
35
|
+
purpose: Roll core 注入的多浏览器实例声明 JSON;由 `browser.instances` 派生,包含每个实例的 profile、CDP 端口、session 目录、可选 profileName/windowBounds 和招聘事件归因 ID;orchestrator 不应手工拼接,手工配置时必须保持 cdpPort/userDataDir 唯一
|
|
36
|
+
example: '{"defaultInstance":"boss-a","instances":{"boss-a":{"platform":"zhipin","mode":"managed-cdp","cdpPort":9222,"userDataDir":"/tmp/roll-browser/profiles/boss-a","profileName":"boss-a","windowBounds":{"x":0,"y":0,"width":680,"height":1000},"trackingAgentId":"zhipin-boss-a"}}}'
|
|
34
37
|
- name: BROWSER_VISUAL_CURSOR
|
|
35
38
|
purpose: 在可见浏览器页面内显示 browser-use 的页内虚拟指针和点击波纹;默认开启,设为 `"false"` 可关闭
|
|
36
39
|
default: "true"
|
|
@@ -4,6 +4,29 @@
|
|
|
4
4
|
|
|
5
5
|
`conversationId` / `candidateId` 是跨 tool 的稳定主键,`index` 只表示当前 DOM 快照。
|
|
6
6
|
|
|
7
|
+
## 多账号 browserInstance 作用域
|
|
8
|
+
|
|
9
|
+
多 Boss 账号托管时,`browserInstance` 是账号/profile 路由键。orchestrator 必须把它贯穿同一账号任务的所有 browser-use 调用。
|
|
10
|
+
|
|
11
|
+
作用域规则:
|
|
12
|
+
|
|
13
|
+
1. 同一个账号线程固定一个 `browserInstance`,例如 `boss-a`。
|
|
14
|
+
2. 该线程中的 `zhipin_*`、`browser_snapshot`、`click_ref`、`type_ref`、`list_pages`、`select_page` 都显式传同一个 `browserInstance`。
|
|
15
|
+
3. `conversationId` / `candidateId` 是业务主键,但不替代 `browserInstance`;同一个候选会话仍必须在正确账号 profile 中执行。
|
|
16
|
+
4. `pageId`、`@eN`、`@cN`、`@jN`、`jobRef`、`candidateRef`、`preparedReplyId` 只在产生它们的 `browserInstance` 内有效。
|
|
17
|
+
5. 多实例没有 `browser.defaultInstance` 时,不传 `browserInstance` 的调用会返回 `needs_input`。
|
|
18
|
+
6. 不要把 `boss-a` 生成的 `preparedReplyId` 交给 `boss-b` 发送;发送工具会校验当前页面目标和招聘者绑定。
|
|
19
|
+
|
|
20
|
+
示例:
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"browserInstance": "boss-a",
|
|
25
|
+
"conversationId": "610630074-0",
|
|
26
|
+
"maxMessages": 100
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
7
30
|
## BOSS 页面入口
|
|
8
31
|
|
|
9
32
|
`navigate_active_tab(url)` 是通用 native CDP 导航工具,但不能直接跳转 BOSS `/web/chat/*` 后台路径。
|
|
@@ -25,10 +48,9 @@
|
|
|
25
48
|
推荐做法:
|
|
26
49
|
|
|
27
50
|
1. `zhipin_read_messages` 记录 `conversationId + candidateId + candidateName`。
|
|
28
|
-
2. `
|
|
29
|
-
3. `
|
|
30
|
-
4. `
|
|
31
|
-
5. `zhipin_send_reply(signedEnvelope)`。
|
|
51
|
+
2. `zhipin_generate_reply_preview({ browserInstance, conversationId })`。
|
|
52
|
+
3. `zhipin_send_prepared_reply({ browserInstance, preparedReplyId })`。
|
|
53
|
+
4. 发送后用 `zhipin_read_messages({ browserInstance, onlyUnread:true })` 或目标会话读取做验证。
|
|
32
54
|
|
|
33
55
|
## 推荐岗位筛选
|
|
34
56
|
|
|
@@ -120,7 +142,7 @@ recommend-list -> 推荐牛人列表,默认向下滚动,去重主键 candid
|
|
|
120
142
|
|
|
121
143
|
## Reply Authority
|
|
122
144
|
|
|
123
|
-
`
|
|
145
|
+
`zhipin_send_prepared_reply` 只接受 `zhipin_generate_reply_preview` 生成的 `preparedReplyId`,内部再取回 Reply Authority Service 签发的 envelope 并完成验签。
|
|
124
146
|
|
|
125
147
|
发送前校验:
|
|
126
148
|
|
|
@@ -130,6 +152,7 @@ recommend-list -> 推荐牛人列表,默认向下滚动,去重主键 candid
|
|
|
130
152
|
4. replay `jti` 是否已消费。
|
|
131
153
|
5. 当前选中聊天是否匹配 `conversationId + candidateId`。
|
|
132
154
|
6. 当前登录招聘者是否匹配 `recruiterBinding`。
|
|
155
|
+
7. 当前 `browserInstance` 是否仍是生成 `preparedReplyId` 的账号/profile 作用域。
|
|
133
156
|
|
|
134
157
|
`generate_reply` 的 `target` 两种模式:
|
|
135
158
|
|