@oya-ai/browser 0.1.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/dist/index.cjs +361 -0
- package/dist/index.d.cts +548 -0
- package/dist/index.d.ts +548 -0
- package/dist/index.js +332 -0
- package/package.json +29 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,548 @@
|
|
|
1
|
+
/** The one HTTP path. Everything else in this package is a wrapper over it. */
|
|
2
|
+
declare class Http {
|
|
3
|
+
readonly baseUrl: string;
|
|
4
|
+
readonly apiKey: string;
|
|
5
|
+
private readonly timeoutMs;
|
|
6
|
+
private readonly fetchImpl;
|
|
7
|
+
constructor(baseUrl: string, apiKey: string, timeoutMs: number, fetchImpl: typeof globalThis.fetch);
|
|
8
|
+
request<T>(method: string, path: string, body?: unknown, timeoutMs?: number, headers?: Record<string, string>): Promise<T>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Everything the API returns or accepts, in one place. */
|
|
12
|
+
/** Where a browser comes from. Configuration, not something a caller must know. */
|
|
13
|
+
type Provider = 'oya-cloud' | 'oya-selfhosted' | 'browseruse' | 'browserbase' | 'steel' | 'anchor' | 'cdp';
|
|
14
|
+
interface StartOptions {
|
|
15
|
+
/** Reuse this value when retrying the same logical creation. */
|
|
16
|
+
idempotencyKey?: string;
|
|
17
|
+
/** Wait for capacity for up to five minutes; zero rejects immediately. */
|
|
18
|
+
queueMs?: number;
|
|
19
|
+
budgetUsd?: number;
|
|
20
|
+
governed?: boolean;
|
|
21
|
+
policy?: {
|
|
22
|
+
allowedHosts?: string[];
|
|
23
|
+
humanHosts?: string[];
|
|
24
|
+
region?: string;
|
|
25
|
+
redactRecording?: boolean;
|
|
26
|
+
};
|
|
27
|
+
priority?: 'low' | 'normal' | 'high';
|
|
28
|
+
/** Saved login profile. Defaults to the desktop's default profile. */
|
|
29
|
+
profile?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Which identity to run as. A persona is one device: fingerprint, cookie jar
|
|
32
|
+
* and proxy bound together and stable for its life.
|
|
33
|
+
* 'default' — this key's own persona (the default)
|
|
34
|
+
* 'auto' — the least recently used persona under its concurrency cap
|
|
35
|
+
* <id> — a specific persona
|
|
36
|
+
*/
|
|
37
|
+
persona?: 'default' | 'auto' | (string & {});
|
|
38
|
+
/** Solve CAPTCHAs as they appear rather than waiting to be asked. */
|
|
39
|
+
captcha?: 'auto' | 'off';
|
|
40
|
+
/** Override the key's configured provider for this browser only. */
|
|
41
|
+
provider?: Provider;
|
|
42
|
+
/** Required only for the 'cdp' provider. */
|
|
43
|
+
wsUrl?: string;
|
|
44
|
+
name?: string;
|
|
45
|
+
/** How long to wait for a cloud browser to dial in. Default 120s. */
|
|
46
|
+
readyTimeoutMs?: number;
|
|
47
|
+
}
|
|
48
|
+
interface StartResult {
|
|
49
|
+
id: string;
|
|
50
|
+
provider: string;
|
|
51
|
+
persona: string;
|
|
52
|
+
status: 'ready' | 'starting';
|
|
53
|
+
/** Point Playwright, Puppeteer or browser-use at this. */
|
|
54
|
+
cdpUrl?: string;
|
|
55
|
+
note?: string;
|
|
56
|
+
}
|
|
57
|
+
interface Element {
|
|
58
|
+
id: number;
|
|
59
|
+
type: string;
|
|
60
|
+
/** Visible label, capped at 80 characters by the analyzer. */
|
|
61
|
+
text?: string;
|
|
62
|
+
href?: string;
|
|
63
|
+
value?: string;
|
|
64
|
+
checked?: boolean;
|
|
65
|
+
disabled?: boolean;
|
|
66
|
+
visible: boolean;
|
|
67
|
+
tag?: string;
|
|
68
|
+
/** The element's DOM `id`. Usually the most stable handle a site offers. */
|
|
69
|
+
domId?: string;
|
|
70
|
+
ariaLabel?: string;
|
|
71
|
+
/** `data-testid`, when the site ships one. */
|
|
72
|
+
testId?: string;
|
|
73
|
+
name?: string;
|
|
74
|
+
placeholder?: string;
|
|
75
|
+
/** Action of the enclosing form. */
|
|
76
|
+
formName?: string;
|
|
77
|
+
}
|
|
78
|
+
interface Analysis {
|
|
79
|
+
/** The page as markdown. */
|
|
80
|
+
markdown: string;
|
|
81
|
+
elements: Element[];
|
|
82
|
+
viewport?: {
|
|
83
|
+
width: number;
|
|
84
|
+
height: number;
|
|
85
|
+
};
|
|
86
|
+
scroll?: {
|
|
87
|
+
x: number;
|
|
88
|
+
y: number;
|
|
89
|
+
};
|
|
90
|
+
truncated?: boolean;
|
|
91
|
+
}
|
|
92
|
+
interface CaptchaResult {
|
|
93
|
+
present: boolean;
|
|
94
|
+
solved: boolean;
|
|
95
|
+
/** 'provider' when the vendor solved it, 'solver' when we did, 'none' otherwise. */
|
|
96
|
+
method: 'provider' | 'solver' | 'none';
|
|
97
|
+
type?: string;
|
|
98
|
+
/** Invisible reCAPTCHA v3 scores the visit passively; there is nothing on screen to clear. */
|
|
99
|
+
invisible?: boolean;
|
|
100
|
+
sitekey?: string | null;
|
|
101
|
+
error?: string;
|
|
102
|
+
}
|
|
103
|
+
interface MfaResult {
|
|
104
|
+
present: boolean;
|
|
105
|
+
completed: boolean;
|
|
106
|
+
method?: 'totp' | 'email' | 'sms' | 'handoff' | 'none';
|
|
107
|
+
filled?: boolean;
|
|
108
|
+
submitted?: boolean;
|
|
109
|
+
/** Open this to finish by hand when nothing automated can. */
|
|
110
|
+
liveViewUrl?: string | null;
|
|
111
|
+
error?: string;
|
|
112
|
+
}
|
|
113
|
+
interface Fingerprint {
|
|
114
|
+
platform: string;
|
|
115
|
+
timezone: string;
|
|
116
|
+
locale: string;
|
|
117
|
+
screen: string;
|
|
118
|
+
webgl: string;
|
|
119
|
+
hardwareConcurrency: number;
|
|
120
|
+
deviceMemory: number;
|
|
121
|
+
canvasSeed: number;
|
|
122
|
+
}
|
|
123
|
+
/** Device choices made at creation. Fixed for the persona's life. */
|
|
124
|
+
interface PersonaPrefs {
|
|
125
|
+
platform?: 'Win32' | 'MacIntel' | 'Linux x86_64';
|
|
126
|
+
timezone?: string;
|
|
127
|
+
locale?: string;
|
|
128
|
+
}
|
|
129
|
+
interface PersonaInfo {
|
|
130
|
+
id: string;
|
|
131
|
+
name: string;
|
|
132
|
+
isDefault: boolean;
|
|
133
|
+
activeBrowsers: number;
|
|
134
|
+
maxConcurrent: number | null;
|
|
135
|
+
proxy: {
|
|
136
|
+
geo: string | null;
|
|
137
|
+
} | null;
|
|
138
|
+
/** The proxy it is actually on, once assigned or pinned. */
|
|
139
|
+
exit: {
|
|
140
|
+
id: string;
|
|
141
|
+
label: string;
|
|
142
|
+
geo: string | null;
|
|
143
|
+
healthy: boolean;
|
|
144
|
+
} | null;
|
|
145
|
+
prefs: PersonaPrefs | null;
|
|
146
|
+
fingerprint: Fingerprint;
|
|
147
|
+
mfa: {
|
|
148
|
+
configured: boolean;
|
|
149
|
+
type?: string;
|
|
150
|
+
};
|
|
151
|
+
login: {
|
|
152
|
+
cookies: number;
|
|
153
|
+
sites: string[];
|
|
154
|
+
updatedAt: string | null;
|
|
155
|
+
};
|
|
156
|
+
createdAt: string;
|
|
157
|
+
lastUsedAt: string | null;
|
|
158
|
+
}
|
|
159
|
+
type Health = 'ok' | 'stale' | 'errors' | 'dead';
|
|
160
|
+
interface Activity {
|
|
161
|
+
ts: string;
|
|
162
|
+
action: string;
|
|
163
|
+
summary: string;
|
|
164
|
+
ok: boolean;
|
|
165
|
+
ms: number;
|
|
166
|
+
error?: string;
|
|
167
|
+
}
|
|
168
|
+
interface StopResult {
|
|
169
|
+
id: string;
|
|
170
|
+
ok: boolean;
|
|
171
|
+
provider?: string | null;
|
|
172
|
+
sandboxRemoved?: boolean | null;
|
|
173
|
+
error?: string;
|
|
174
|
+
}
|
|
175
|
+
type MfaConfig = {
|
|
176
|
+
type: 'totp';
|
|
177
|
+
secret: string;
|
|
178
|
+
} | {
|
|
179
|
+
type: 'email' | 'sms';
|
|
180
|
+
url: string;
|
|
181
|
+
headers?: Record<string, string>;
|
|
182
|
+
pattern?: string;
|
|
183
|
+
timeoutMs?: number;
|
|
184
|
+
};
|
|
185
|
+
interface BrowserInfo {
|
|
186
|
+
id: string;
|
|
187
|
+
name: string;
|
|
188
|
+
clientType: 'oya' | 'cdp';
|
|
189
|
+
provider: string | null;
|
|
190
|
+
persona: string | null;
|
|
191
|
+
personaName: string | null;
|
|
192
|
+
health: Health;
|
|
193
|
+
connectedAt: string;
|
|
194
|
+
lastSeen: string;
|
|
195
|
+
currentUrl: string;
|
|
196
|
+
commands: number;
|
|
197
|
+
errors: number;
|
|
198
|
+
pending: number;
|
|
199
|
+
lastCommandAt: string | null;
|
|
200
|
+
lastError: string | null;
|
|
201
|
+
}
|
|
202
|
+
interface BrowserDetail extends BrowserInfo {
|
|
203
|
+
activity: Activity[];
|
|
204
|
+
}
|
|
205
|
+
interface OyaOptions {
|
|
206
|
+
/** Defaults to OYA_API_KEY. */
|
|
207
|
+
apiKey?: string;
|
|
208
|
+
/** Defaults to OYA_BASE_URL, then https://browser.getoya.ai. */
|
|
209
|
+
baseUrl?: string;
|
|
210
|
+
/** Per-request timeout. Navigation gets its own, longer budget. */
|
|
211
|
+
timeoutMs?: number;
|
|
212
|
+
fetch?: typeof globalThis.fetch;
|
|
213
|
+
}
|
|
214
|
+
declare class OyaError extends Error {
|
|
215
|
+
readonly status: number;
|
|
216
|
+
readonly body: unknown;
|
|
217
|
+
constructor(message: string, status: number, body: unknown);
|
|
218
|
+
}
|
|
219
|
+
type ControlRole = 'viewer' | 'operator' | 'administrator';
|
|
220
|
+
/** What a human holding the control lease may send. Mirrors the server's allowlist. */
|
|
221
|
+
type HumanInputAction = 'click' | 'type' | 'press_key' | 'scroll' | 'click_coordinates' | 'double_click' | 'drag' | 'mouse_move' | 'scroll_at' | 'type_text' | 'keyboard_type' | 'navigate' | 'back' | 'forward' | 'reload' | 'screenshot' | 'analyze' | 'read_page';
|
|
222
|
+
interface ControlSession {
|
|
223
|
+
id: string;
|
|
224
|
+
project: string;
|
|
225
|
+
provider: string;
|
|
226
|
+
persona: string | null;
|
|
227
|
+
state: 'queued' | 'provisioning' | 'ready' | 'disconnected' | 'stopping' | 'cleanup_pending' | 'stopped' | 'failed' | 'unknown_outcome';
|
|
228
|
+
managed: boolean;
|
|
229
|
+
createdAt: number;
|
|
230
|
+
updatedAt: number;
|
|
231
|
+
costUsd: number;
|
|
232
|
+
control: {
|
|
233
|
+
mode: 'agent' | 'human' | 'paused';
|
|
234
|
+
expiresAt?: number;
|
|
235
|
+
};
|
|
236
|
+
cleanupError?: string;
|
|
237
|
+
}
|
|
238
|
+
interface ProjectSettings {
|
|
239
|
+
recordingDays: number;
|
|
240
|
+
auditDays: number;
|
|
241
|
+
budgetUsd: number | null;
|
|
242
|
+
maxConcurrent: number | null;
|
|
243
|
+
rates: Record<string, number>;
|
|
244
|
+
policy: Record<string, unknown>;
|
|
245
|
+
}
|
|
246
|
+
interface ControlEvent {
|
|
247
|
+
id: number;
|
|
248
|
+
project: string;
|
|
249
|
+
type: string;
|
|
250
|
+
sessionId: string | null;
|
|
251
|
+
at: number;
|
|
252
|
+
detail: Record<string, unknown>;
|
|
253
|
+
}
|
|
254
|
+
interface ControlCredential {
|
|
255
|
+
id: string;
|
|
256
|
+
label: string;
|
|
257
|
+
role: ControlRole;
|
|
258
|
+
expiresAt: number | null;
|
|
259
|
+
revokedAt: number | null;
|
|
260
|
+
}
|
|
261
|
+
interface ControlOverview {
|
|
262
|
+
/** costUsd: estimated lifetime spend, metered from rate cards. */
|
|
263
|
+
project: {
|
|
264
|
+
id: string;
|
|
265
|
+
name: string;
|
|
266
|
+
settings: ProjectSettings;
|
|
267
|
+
costUsd?: number;
|
|
268
|
+
};
|
|
269
|
+
sessions: ControlSession[];
|
|
270
|
+
events: ControlEvent[];
|
|
271
|
+
draining: boolean;
|
|
272
|
+
credentials?: ControlCredential[];
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* One running browser.
|
|
277
|
+
*
|
|
278
|
+
* Element ids come from `analyze()` and are only valid until the page changes —
|
|
279
|
+
* the same contract the agent tools use. `click(13)` after a navigation is a
|
|
280
|
+
* bug; call `analyze()` again.
|
|
281
|
+
*/
|
|
282
|
+
declare class Browser {
|
|
283
|
+
private readonly http;
|
|
284
|
+
private readonly autoCaptcha;
|
|
285
|
+
readonly id: string;
|
|
286
|
+
readonly provider: string;
|
|
287
|
+
readonly persona: string;
|
|
288
|
+
/** Point Playwright, Puppeteer or browser-use here. */
|
|
289
|
+
readonly cdpUrl?: string;
|
|
290
|
+
constructor(http: Http, info: StartResult, autoCaptcha: boolean);
|
|
291
|
+
private command;
|
|
292
|
+
goto(url: string): Promise<void>;
|
|
293
|
+
/** The page as markdown plus numbered elements to act on. */
|
|
294
|
+
analyze(): Promise<Analysis>;
|
|
295
|
+
/** Only the visible elements, which is what an agent almost always wants. */
|
|
296
|
+
elements(): Promise<Element[]>;
|
|
297
|
+
click(elementId: number | string): Promise<void>;
|
|
298
|
+
type(elementId: number | string, text: string): Promise<{
|
|
299
|
+
suggestions_visible?: boolean;
|
|
300
|
+
}>;
|
|
301
|
+
private elementId;
|
|
302
|
+
pressKey(key: string): Promise<void>;
|
|
303
|
+
/** `at` aims the wheel at an inner scroller (a results panel, a chat pane) instead of the page. */
|
|
304
|
+
scroll(direction: 'up' | 'down' | 'top' | 'bottom', amount?: number, at?: {
|
|
305
|
+
x: number;
|
|
306
|
+
y: number;
|
|
307
|
+
}): Promise<void>;
|
|
308
|
+
waitFor(selector: string, timeout?: number): Promise<void>;
|
|
309
|
+
/** A `data:image/…;base64,` URL. PNG or JPEG depending on the driver. */
|
|
310
|
+
screenshot(): Promise<string>;
|
|
311
|
+
url(): Promise<string>;
|
|
312
|
+
tabs(): Promise<Array<{
|
|
313
|
+
id: string;
|
|
314
|
+
url: string;
|
|
315
|
+
title: string;
|
|
316
|
+
active: boolean;
|
|
317
|
+
}>>;
|
|
318
|
+
openTab(url?: string): Promise<string>;
|
|
319
|
+
switchTab(tabId: string): Promise<void>;
|
|
320
|
+
closeTab(tabId: string): Promise<void>;
|
|
321
|
+
/**
|
|
322
|
+
* Detect and clear a CAPTCHA. Providers that solve natively are left to do
|
|
323
|
+
* it; everything else goes to the configured solver.
|
|
324
|
+
*/
|
|
325
|
+
solveCaptcha(): Promise<CaptchaResult>;
|
|
326
|
+
/**
|
|
327
|
+
* Answer an MFA prompt with the persona's configured factor. When nothing can
|
|
328
|
+
* answer it, `liveViewUrl` is where a person finishes by hand.
|
|
329
|
+
*/
|
|
330
|
+
completeMfa(): Promise<MfaResult>;
|
|
331
|
+
/** Natural-language control, using this key's configured model. */
|
|
332
|
+
ask(prompt: string): Promise<string>;
|
|
333
|
+
/**
|
|
334
|
+
* Watch it work: an SSE stream of JPEG frames. EventSource cannot set
|
|
335
|
+
* headers, so the key travels as a query parameter — treat the URL itself as
|
|
336
|
+
* a credential.
|
|
337
|
+
*/
|
|
338
|
+
liveViewUrl(): string;
|
|
339
|
+
/** Counters, health and the last 50 things this browser did. */
|
|
340
|
+
status(): Promise<BrowserDetail>;
|
|
341
|
+
/**
|
|
342
|
+
* Stop it, whatever it is: a cloud sandbox is destroyed so billing ends, a
|
|
343
|
+
* CDP session is handed back to its provider, a desktop browser disconnects.
|
|
344
|
+
*/
|
|
345
|
+
stop(): Promise<StopResult>;
|
|
346
|
+
/** `await using browser = await oya.browser.start()` stops it however the block exits, errors included. */
|
|
347
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
348
|
+
/** @deprecated use stop() — close() only dropped the socket, and a cloud browser redialled. */
|
|
349
|
+
close(): Promise<void>;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* @oya-ai/browser — thousands of browsers, one API.
|
|
354
|
+
*
|
|
355
|
+
* import { Oya } from '@oya-ai/browser';
|
|
356
|
+
*
|
|
357
|
+
* const oya = new Oya(); // OYA_API_KEY
|
|
358
|
+
* const browser = await oya.browser.start({ persona: 'auto', captcha: 'auto' });
|
|
359
|
+
* await browser.goto('https://example.com');
|
|
360
|
+
*
|
|
361
|
+
* Which provider actually runs the browser — Oya Cloud, your own machines,
|
|
362
|
+
* Browser Use, Browserbase, Steel, Anchor, or a CDP URL you hand us — is
|
|
363
|
+
* configuration on your API key, not something this code has to know.
|
|
364
|
+
*/
|
|
365
|
+
|
|
366
|
+
declare class Oya {
|
|
367
|
+
private readonly http;
|
|
368
|
+
constructor(options?: OyaOptions);
|
|
369
|
+
readonly browser: {
|
|
370
|
+
/** Start a browser and wait until it can take commands. */
|
|
371
|
+
start: (options?: StartOptions) => Promise<Browser>;
|
|
372
|
+
/** Reattach to a browser that is already running. */
|
|
373
|
+
get: (id: string) => Promise<Browser>;
|
|
374
|
+
list: () => Promise<BrowserInfo[]>;
|
|
375
|
+
/** Stop some (`ids`) or every browser on this key. Each reports separately. */
|
|
376
|
+
stop: (ids: string[] | "all") => Promise<{
|
|
377
|
+
stopped: number;
|
|
378
|
+
results: StopResult[];
|
|
379
|
+
}>;
|
|
380
|
+
stopAll: () => Promise<number>;
|
|
381
|
+
};
|
|
382
|
+
/** Durable operational controls, including disconnected and cleanup-pending sessions. */
|
|
383
|
+
readonly control: {
|
|
384
|
+
overview: () => Promise<ControlOverview>;
|
|
385
|
+
sessions: () => Promise<ControlSession[]>;
|
|
386
|
+
session: (id: string) => Promise<ControlSession>;
|
|
387
|
+
settings: (changes: Partial<ProjectSettings>) => Promise<ControlOverview["project"]>;
|
|
388
|
+
cancel: (id: string) => Promise<ControlSession>;
|
|
389
|
+
stop: (id: string, force?: boolean) => Promise<StopResult>;
|
|
390
|
+
takeover: (id: string, action: "acquire" | "release" | "resume") => Promise<ControlSession["control"]>;
|
|
391
|
+
input: (id: string, action: HumanInputAction, params: Record<string, unknown>) => Promise<unknown>;
|
|
392
|
+
recover: (id: string, replace?: boolean) => Promise<unknown>;
|
|
393
|
+
ticket: (id: string) => Promise<{
|
|
394
|
+
ticket: string;
|
|
395
|
+
expiresIn: number;
|
|
396
|
+
}>;
|
|
397
|
+
events: (after?: number) => Promise<{
|
|
398
|
+
events: ControlEvent[];
|
|
399
|
+
cursor: number;
|
|
400
|
+
}>;
|
|
401
|
+
createCredential: (options: {
|
|
402
|
+
role: ControlRole;
|
|
403
|
+
label?: string;
|
|
404
|
+
expiresAt?: number;
|
|
405
|
+
}) => Promise<ControlCredential & {
|
|
406
|
+
token: string;
|
|
407
|
+
}>;
|
|
408
|
+
revokeCredential: (id: string) => Promise<{
|
|
409
|
+
ok: boolean;
|
|
410
|
+
}>;
|
|
411
|
+
members: () => Promise<{
|
|
412
|
+
owner: string | null;
|
|
413
|
+
members: {
|
|
414
|
+
userId: string;
|
|
415
|
+
role: ControlRole;
|
|
416
|
+
}[];
|
|
417
|
+
}>;
|
|
418
|
+
inviteMember: (role?: ControlRole) => Promise<{
|
|
419
|
+
code: string;
|
|
420
|
+
expiresIn: number;
|
|
421
|
+
}>;
|
|
422
|
+
removeMember: (userId: string) => Promise<{
|
|
423
|
+
ok: boolean;
|
|
424
|
+
}>;
|
|
425
|
+
createWebhook: (url: string, types?: string[]) => Promise<{
|
|
426
|
+
id: string;
|
|
427
|
+
secret: string;
|
|
428
|
+
}>;
|
|
429
|
+
removeWebhook: (id: string) => Promise<{
|
|
430
|
+
ok: boolean;
|
|
431
|
+
}>;
|
|
432
|
+
replayDelivery: (id: string) => Promise<{
|
|
433
|
+
ok: boolean;
|
|
434
|
+
}>;
|
|
435
|
+
};
|
|
436
|
+
readonly personas: {
|
|
437
|
+
list: () => Promise<PersonaInfo[]>;
|
|
438
|
+
get: (id: string) => Promise<PersonaInfo>;
|
|
439
|
+
/**
|
|
440
|
+
* Create an identity. The device — platform, timezone, locale — is chosen
|
|
441
|
+
* here and fixed for its life; `preview()` shows what a choice produces.
|
|
442
|
+
*/
|
|
443
|
+
create: (options?: {
|
|
444
|
+
name?: string;
|
|
445
|
+
prefs?: PersonaPrefs;
|
|
446
|
+
proxy?: {
|
|
447
|
+
geo?: string;
|
|
448
|
+
};
|
|
449
|
+
maxConcurrent?: number | null;
|
|
450
|
+
}) => Promise<PersonaInfo>;
|
|
451
|
+
/** Name, concurrency cap and proxy hint. Never the device — clone for that. */
|
|
452
|
+
update: (id: string, changes: {
|
|
453
|
+
name?: string;
|
|
454
|
+
maxConcurrent?: number | null;
|
|
455
|
+
proxy?: {
|
|
456
|
+
geo?: string;
|
|
457
|
+
} | null;
|
|
458
|
+
}) => Promise<PersonaInfo>;
|
|
459
|
+
/** A new persona of the same kind of device: same choices, fresh identity, empty jar. */
|
|
460
|
+
clone: (id: string, options?: {
|
|
461
|
+
name?: string;
|
|
462
|
+
}) => Promise<PersonaInfo>;
|
|
463
|
+
/** The fingerprint these choices would produce. Persists nothing. */
|
|
464
|
+
preview: (prefs?: PersonaPrefs) => Promise<Fingerprint>;
|
|
465
|
+
/** Platforms, and the timezones and locales each may coherently claim. */
|
|
466
|
+
options: () => Promise<{
|
|
467
|
+
platforms: string[];
|
|
468
|
+
timezones: Record<string, string[]>;
|
|
469
|
+
locales: Record<string, string[]>;
|
|
470
|
+
}>;
|
|
471
|
+
/** Pin the persona to one of your proxies, or `null` to let assignment happen at connect. */
|
|
472
|
+
pinProxy: (id: string, proxyId: string | null) => Promise<{
|
|
473
|
+
ok: boolean;
|
|
474
|
+
proxy: {
|
|
475
|
+
id: string;
|
|
476
|
+
label: string;
|
|
477
|
+
} | null;
|
|
478
|
+
}>;
|
|
479
|
+
remove: (id: string) => Promise<void>;
|
|
480
|
+
/** Store the second factor for this identity. Sealed at rest, never read back. */
|
|
481
|
+
setMfa: (id: string, config: MfaConfig) => Promise<{
|
|
482
|
+
configured: boolean;
|
|
483
|
+
type: string;
|
|
484
|
+
}>;
|
|
485
|
+
clearMfa: (id: string) => Promise<void>;
|
|
486
|
+
};
|
|
487
|
+
/** This key's settings: LLM credentials, browser provider, solver. */
|
|
488
|
+
readonly config: {
|
|
489
|
+
get: <T = Record<string, unknown>>() => Promise<T>;
|
|
490
|
+
set: <T = Record<string, unknown>>(values: Record<string, unknown>) => Promise<T>;
|
|
491
|
+
};
|
|
492
|
+
/** Saved profiles. `personas` is retained as an alias for existing clients. */
|
|
493
|
+
readonly profiles: {
|
|
494
|
+
list: () => Promise<PersonaInfo[]>;
|
|
495
|
+
get: (id: string) => Promise<PersonaInfo>;
|
|
496
|
+
/**
|
|
497
|
+
* Create an identity. The device — platform, timezone, locale — is chosen
|
|
498
|
+
* here and fixed for its life; `preview()` shows what a choice produces.
|
|
499
|
+
*/
|
|
500
|
+
create: (options?: {
|
|
501
|
+
name?: string;
|
|
502
|
+
prefs?: PersonaPrefs;
|
|
503
|
+
proxy?: {
|
|
504
|
+
geo?: string;
|
|
505
|
+
};
|
|
506
|
+
maxConcurrent?: number | null;
|
|
507
|
+
}) => Promise<PersonaInfo>;
|
|
508
|
+
/** Name, concurrency cap and proxy hint. Never the device — clone for that. */
|
|
509
|
+
update: (id: string, changes: {
|
|
510
|
+
name?: string;
|
|
511
|
+
maxConcurrent?: number | null;
|
|
512
|
+
proxy?: {
|
|
513
|
+
geo?: string;
|
|
514
|
+
} | null;
|
|
515
|
+
}) => Promise<PersonaInfo>;
|
|
516
|
+
/** A new persona of the same kind of device: same choices, fresh identity, empty jar. */
|
|
517
|
+
clone: (id: string, options?: {
|
|
518
|
+
name?: string;
|
|
519
|
+
}) => Promise<PersonaInfo>;
|
|
520
|
+
/** The fingerprint these choices would produce. Persists nothing. */
|
|
521
|
+
preview: (prefs?: PersonaPrefs) => Promise<Fingerprint>;
|
|
522
|
+
/** Platforms, and the timezones and locales each may coherently claim. */
|
|
523
|
+
options: () => Promise<{
|
|
524
|
+
platforms: string[];
|
|
525
|
+
timezones: Record<string, string[]>;
|
|
526
|
+
locales: Record<string, string[]>;
|
|
527
|
+
}>;
|
|
528
|
+
/** Pin the persona to one of your proxies, or `null` to let assignment happen at connect. */
|
|
529
|
+
pinProxy: (id: string, proxyId: string | null) => Promise<{
|
|
530
|
+
ok: boolean;
|
|
531
|
+
proxy: {
|
|
532
|
+
id: string;
|
|
533
|
+
label: string;
|
|
534
|
+
} | null;
|
|
535
|
+
}>;
|
|
536
|
+
remove: (id: string) => Promise<void>;
|
|
537
|
+
/** Store the second factor for this identity. Sealed at rest, never read back. */
|
|
538
|
+
setMfa: (id: string, config: MfaConfig) => Promise<{
|
|
539
|
+
configured: boolean;
|
|
540
|
+
type: string;
|
|
541
|
+
}>;
|
|
542
|
+
clearMfa: (id: string) => Promise<void>;
|
|
543
|
+
};
|
|
544
|
+
usage(): Promise<unknown>;
|
|
545
|
+
private waitUntilConnected;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export { type Activity, type Analysis, Browser, type BrowserDetail, type BrowserInfo, type CaptchaResult, type ControlCredential, type ControlEvent, type ControlOverview, type ControlRole, type ControlSession, type Element, type Fingerprint, type Health, type HumanInputAction, type MfaConfig, type MfaResult, Oya, OyaError, type OyaOptions, type PersonaInfo, type PersonaPrefs, type ProjectSettings, type Provider, type StartOptions, type StartResult, type StopResult, Oya as default };
|