@oya-ai/browser 1.0.106 → 1.0.110
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/README.md +4 -0
- package/dist/index.cjs +18 -1
- package/dist/index.d.cts +45 -1
- package/dist/index.d.ts +45 -1
- package/dist/index.js +18 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -468,6 +468,10 @@ const oya = new Oya({
|
|
|
468
468
|
| `remove(id)` | Delete persona and associated cookie jar |
|
|
469
469
|
| `setMfa(id, config)` | Store TOTP secret (sealed at rest with AES-256-GCM) |
|
|
470
470
|
| `clearMfa(id)` | Remove MFA secret from persona |
|
|
471
|
+
| `cookies(id, format?)` | Export the persona's logins; `'playwright'` fits `addCookies()` |
|
|
472
|
+
| `importCookies(id, cookies)` | Merge cookies into the jar (from a file, a script, anywhere) |
|
|
473
|
+
| `copyCookies(from, to)` | Copy one persona's logins into another |
|
|
474
|
+
| `clearCookies(id)` | Forget every cookie: signs the persona out everywhere |
|
|
471
475
|
|
|
472
476
|
### Proxies (`oya.proxies`)
|
|
473
477
|
|
package/dist/index.cjs
CHANGED
|
@@ -694,11 +694,28 @@ var loginCalls = (http) => ({
|
|
|
694
694
|
await http().request("DELETE", `/api/personas/${id}/credentials?domain=${encodeURIComponent(domain)}`);
|
|
695
695
|
}
|
|
696
696
|
});
|
|
697
|
+
var jarPath = (id) => `/api/pool/cookies?persona=${encodeURIComponent(id)}`;
|
|
698
|
+
var jarCalls = (http) => ({
|
|
699
|
+
/** Every cookie in the jar; `format: 'playwright'` is ready for `context.addCookies()`. */
|
|
700
|
+
cookies: async (id, format = "json") => (await http().request("GET", `${jarPath(id)}&format=${format}`)).cookies,
|
|
701
|
+
/** Merge cookies into the jar. The persona's browsers pick them up on their next visit to each site. */
|
|
702
|
+
importCookies: (id, list) => http().request("PUT", jarPath(id), { cookies: list })
|
|
703
|
+
});
|
|
704
|
+
var cookieCalls = (http) => ({
|
|
705
|
+
...jarCalls(http),
|
|
706
|
+
/** Copy every login of persona `from` into persona `to`, which keeps its own device. */
|
|
707
|
+
copyCookies: async (from, to) => jarCalls(http).importCookies(to, await jarCalls(http).cookies(from)),
|
|
708
|
+
/** Forget every cookie in the jar: signs the persona out everywhere. */
|
|
709
|
+
clearCookies: async (id) => {
|
|
710
|
+
await http().request("DELETE", jarPath(id));
|
|
711
|
+
}
|
|
712
|
+
});
|
|
697
713
|
var personaApi = (http) => ({
|
|
698
714
|
...identityCalls(http),
|
|
699
715
|
...deviceCalls(http),
|
|
700
716
|
...mfaCalls(http),
|
|
701
|
-
...loginCalls(http)
|
|
717
|
+
...loginCalls(http),
|
|
718
|
+
...cookieCalls(http)
|
|
702
719
|
});
|
|
703
720
|
|
|
704
721
|
// src/api/config.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -689,6 +689,31 @@ interface SiteCredentials {
|
|
|
689
689
|
/** The password; stored sealed and never returned. */
|
|
690
690
|
password: string;
|
|
691
691
|
}
|
|
692
|
+
/** A cookie in a persona's jar. */
|
|
693
|
+
interface Cookie {
|
|
694
|
+
/** The cookie's name. */
|
|
695
|
+
name: string;
|
|
696
|
+
/** Its value: a session, so treat it as a secret. */
|
|
697
|
+
value: string;
|
|
698
|
+
/** The domain it is sent to; a leading dot includes subdomains. */
|
|
699
|
+
domain: string;
|
|
700
|
+
/** The path it is sent to. `/` when omitted. */
|
|
701
|
+
path?: string;
|
|
702
|
+
/** Sent over HTTPS only. */
|
|
703
|
+
secure?: boolean;
|
|
704
|
+
/** Hidden from page scripts. */
|
|
705
|
+
httpOnly?: boolean;
|
|
706
|
+
/** `Strict`, `Lax` or `None` (Playwright), or `strict`, `lax`, `no_restriction` (Chrome extensions). */
|
|
707
|
+
sameSite?: string;
|
|
708
|
+
/** When it expires, in seconds since the epoch. A session cookie has none. */
|
|
709
|
+
expirationDate?: number;
|
|
710
|
+
/** The same, as Playwright and Puppeteer spell it; `-1` for a session cookie. */
|
|
711
|
+
expires?: number;
|
|
712
|
+
/** Whether it is sent to this exact host only. */
|
|
713
|
+
hostOnly?: boolean;
|
|
714
|
+
}
|
|
715
|
+
/** The formats a jar is exported in: as stored, or ready for Playwright's `context.addCookies()`. */
|
|
716
|
+
type CookieFormat = 'json' | 'playwright';
|
|
692
717
|
|
|
693
718
|
/**
|
|
694
719
|
* Types for the durable control plane: sessions and their lifecycle, human
|
|
@@ -991,6 +1016,17 @@ interface SiteLogins {
|
|
|
991
1016
|
/** Usernames only. */
|
|
992
1017
|
credentials: SiteLogin[];
|
|
993
1018
|
}
|
|
1019
|
+
/** `PUT /api/pool/cookies`: what an import did. */
|
|
1020
|
+
interface CookiesImported {
|
|
1021
|
+
/** The persona the cookies went to. */
|
|
1022
|
+
persona: string;
|
|
1023
|
+
/** Cookies merged into the jar. */
|
|
1024
|
+
imported: number;
|
|
1025
|
+
/** Cookies left out: no name, value or domain, or already expired. */
|
|
1026
|
+
skipped: number;
|
|
1027
|
+
/** Cookies in the jar afterwards. */
|
|
1028
|
+
total: number;
|
|
1029
|
+
}
|
|
994
1030
|
|
|
995
1031
|
/**
|
|
996
1032
|
* The shapes Browser's methods take and return that are not part of the
|
|
@@ -1316,6 +1352,10 @@ declare class Oya {
|
|
|
1316
1352
|
};
|
|
1317
1353
|
/** Identities: fingerprint, cookie jar and proxy bound together, plus their stored factors and logins. */
|
|
1318
1354
|
readonly personas: {
|
|
1355
|
+
copyCookies: (from: string, to: string) => Promise<CookiesImported>;
|
|
1356
|
+
clearCookies: (id: string) => Promise<void>;
|
|
1357
|
+
cookies: (id: string, format?: CookieFormat) => Promise<Cookie[]>;
|
|
1358
|
+
importCookies: (id: string, list: Cookie[]) => Promise<CookiesImported>;
|
|
1319
1359
|
setCredentials: (id: string, config: SiteCredentials) => Promise<CredentialsSaved>;
|
|
1320
1360
|
credentials: (id: string) => Promise<SiteLogins>;
|
|
1321
1361
|
clearCredentials: (id: string, domain: string) => Promise<void>;
|
|
@@ -1348,6 +1388,10 @@ declare class Oya {
|
|
|
1348
1388
|
};
|
|
1349
1389
|
/** Saved profiles. `personas` is retained as an alias for existing clients. */
|
|
1350
1390
|
readonly profiles: {
|
|
1391
|
+
copyCookies: (from: string, to: string) => Promise<CookiesImported>;
|
|
1392
|
+
clearCookies: (id: string) => Promise<void>;
|
|
1393
|
+
cookies: (id: string, format?: CookieFormat) => Promise<Cookie[]>;
|
|
1394
|
+
importCookies: (id: string, list: Cookie[]) => Promise<CookiesImported>;
|
|
1351
1395
|
setCredentials: (id: string, config: SiteCredentials) => Promise<CredentialsSaved>;
|
|
1352
1396
|
credentials: (id: string) => Promise<SiteLogins>;
|
|
1353
1397
|
clearCredentials: (id: string, domain: string) => Promise<void>;
|
|
@@ -1369,4 +1413,4 @@ declare class Oya {
|
|
|
1369
1413
|
private waitUntilConnected;
|
|
1370
1414
|
}
|
|
1371
1415
|
|
|
1372
|
-
export { type Activity, type Analysis, type AnalyzeOptions, type AttentionRequest, type Block, Browser, type BrowserDetail, type BrowserInfo, type CaptchaResult, type CaptchaSolver, type Config, type ConfigUpdate, type ControlCredential, type ControlEvent, type ControlOverview, type ControlRole, type ControlSession, type Element, type FileValue, type Fingerprint, type Health, type HumanInputAction, type LlmProvider, MAX_FILE_BYTES, type MfaConfig, type MfaResult, Oya, OyaError, type OyaOptions, type PageFormat, type PersonaInfo, type PersonaPrefs, type PlayResult, type Playbook, type PlaybookSummary, type ProjectSettings, type Provider, type ProxyCreate, type ProxyInfo, Run, type RunData, type RunInfo, type RunResult, type SiteCredentials, type StartOptions, type StartResult, type StopResult, type SubmitOptions, Oya as default, file };
|
|
1416
|
+
export { type Activity, type Analysis, type AnalyzeOptions, type AttentionRequest, type Block, Browser, type BrowserDetail, type BrowserInfo, type CaptchaResult, type CaptchaSolver, type Config, type ConfigUpdate, type ControlCredential, type ControlEvent, type ControlOverview, type ControlRole, type ControlSession, type Cookie, type CookieFormat, type Element, type FileValue, type Fingerprint, type Health, type HumanInputAction, type LlmProvider, MAX_FILE_BYTES, type MfaConfig, type MfaResult, Oya, OyaError, type OyaOptions, type PageFormat, type PersonaInfo, type PersonaPrefs, type PlayResult, type Playbook, type PlaybookSummary, type ProjectSettings, type Provider, type ProxyCreate, type ProxyInfo, Run, type RunData, type RunInfo, type RunResult, type SiteCredentials, type StartOptions, type StartResult, type StopResult, type SubmitOptions, Oya as default, file };
|
package/dist/index.d.ts
CHANGED
|
@@ -689,6 +689,31 @@ interface SiteCredentials {
|
|
|
689
689
|
/** The password; stored sealed and never returned. */
|
|
690
690
|
password: string;
|
|
691
691
|
}
|
|
692
|
+
/** A cookie in a persona's jar. */
|
|
693
|
+
interface Cookie {
|
|
694
|
+
/** The cookie's name. */
|
|
695
|
+
name: string;
|
|
696
|
+
/** Its value: a session, so treat it as a secret. */
|
|
697
|
+
value: string;
|
|
698
|
+
/** The domain it is sent to; a leading dot includes subdomains. */
|
|
699
|
+
domain: string;
|
|
700
|
+
/** The path it is sent to. `/` when omitted. */
|
|
701
|
+
path?: string;
|
|
702
|
+
/** Sent over HTTPS only. */
|
|
703
|
+
secure?: boolean;
|
|
704
|
+
/** Hidden from page scripts. */
|
|
705
|
+
httpOnly?: boolean;
|
|
706
|
+
/** `Strict`, `Lax` or `None` (Playwright), or `strict`, `lax`, `no_restriction` (Chrome extensions). */
|
|
707
|
+
sameSite?: string;
|
|
708
|
+
/** When it expires, in seconds since the epoch. A session cookie has none. */
|
|
709
|
+
expirationDate?: number;
|
|
710
|
+
/** The same, as Playwright and Puppeteer spell it; `-1` for a session cookie. */
|
|
711
|
+
expires?: number;
|
|
712
|
+
/** Whether it is sent to this exact host only. */
|
|
713
|
+
hostOnly?: boolean;
|
|
714
|
+
}
|
|
715
|
+
/** The formats a jar is exported in: as stored, or ready for Playwright's `context.addCookies()`. */
|
|
716
|
+
type CookieFormat = 'json' | 'playwright';
|
|
692
717
|
|
|
693
718
|
/**
|
|
694
719
|
* Types for the durable control plane: sessions and their lifecycle, human
|
|
@@ -991,6 +1016,17 @@ interface SiteLogins {
|
|
|
991
1016
|
/** Usernames only. */
|
|
992
1017
|
credentials: SiteLogin[];
|
|
993
1018
|
}
|
|
1019
|
+
/** `PUT /api/pool/cookies`: what an import did. */
|
|
1020
|
+
interface CookiesImported {
|
|
1021
|
+
/** The persona the cookies went to. */
|
|
1022
|
+
persona: string;
|
|
1023
|
+
/** Cookies merged into the jar. */
|
|
1024
|
+
imported: number;
|
|
1025
|
+
/** Cookies left out: no name, value or domain, or already expired. */
|
|
1026
|
+
skipped: number;
|
|
1027
|
+
/** Cookies in the jar afterwards. */
|
|
1028
|
+
total: number;
|
|
1029
|
+
}
|
|
994
1030
|
|
|
995
1031
|
/**
|
|
996
1032
|
* The shapes Browser's methods take and return that are not part of the
|
|
@@ -1316,6 +1352,10 @@ declare class Oya {
|
|
|
1316
1352
|
};
|
|
1317
1353
|
/** Identities: fingerprint, cookie jar and proxy bound together, plus their stored factors and logins. */
|
|
1318
1354
|
readonly personas: {
|
|
1355
|
+
copyCookies: (from: string, to: string) => Promise<CookiesImported>;
|
|
1356
|
+
clearCookies: (id: string) => Promise<void>;
|
|
1357
|
+
cookies: (id: string, format?: CookieFormat) => Promise<Cookie[]>;
|
|
1358
|
+
importCookies: (id: string, list: Cookie[]) => Promise<CookiesImported>;
|
|
1319
1359
|
setCredentials: (id: string, config: SiteCredentials) => Promise<CredentialsSaved>;
|
|
1320
1360
|
credentials: (id: string) => Promise<SiteLogins>;
|
|
1321
1361
|
clearCredentials: (id: string, domain: string) => Promise<void>;
|
|
@@ -1348,6 +1388,10 @@ declare class Oya {
|
|
|
1348
1388
|
};
|
|
1349
1389
|
/** Saved profiles. `personas` is retained as an alias for existing clients. */
|
|
1350
1390
|
readonly profiles: {
|
|
1391
|
+
copyCookies: (from: string, to: string) => Promise<CookiesImported>;
|
|
1392
|
+
clearCookies: (id: string) => Promise<void>;
|
|
1393
|
+
cookies: (id: string, format?: CookieFormat) => Promise<Cookie[]>;
|
|
1394
|
+
importCookies: (id: string, list: Cookie[]) => Promise<CookiesImported>;
|
|
1351
1395
|
setCredentials: (id: string, config: SiteCredentials) => Promise<CredentialsSaved>;
|
|
1352
1396
|
credentials: (id: string) => Promise<SiteLogins>;
|
|
1353
1397
|
clearCredentials: (id: string, domain: string) => Promise<void>;
|
|
@@ -1369,4 +1413,4 @@ declare class Oya {
|
|
|
1369
1413
|
private waitUntilConnected;
|
|
1370
1414
|
}
|
|
1371
1415
|
|
|
1372
|
-
export { type Activity, type Analysis, type AnalyzeOptions, type AttentionRequest, type Block, Browser, type BrowserDetail, type BrowserInfo, type CaptchaResult, type CaptchaSolver, type Config, type ConfigUpdate, type ControlCredential, type ControlEvent, type ControlOverview, type ControlRole, type ControlSession, type Element, type FileValue, type Fingerprint, type Health, type HumanInputAction, type LlmProvider, MAX_FILE_BYTES, type MfaConfig, type MfaResult, Oya, OyaError, type OyaOptions, type PageFormat, type PersonaInfo, type PersonaPrefs, type PlayResult, type Playbook, type PlaybookSummary, type ProjectSettings, type Provider, type ProxyCreate, type ProxyInfo, Run, type RunData, type RunInfo, type RunResult, type SiteCredentials, type StartOptions, type StartResult, type StopResult, type SubmitOptions, Oya as default, file };
|
|
1416
|
+
export { type Activity, type Analysis, type AnalyzeOptions, type AttentionRequest, type Block, Browser, type BrowserDetail, type BrowserInfo, type CaptchaResult, type CaptchaSolver, type Config, type ConfigUpdate, type ControlCredential, type ControlEvent, type ControlOverview, type ControlRole, type ControlSession, type Cookie, type CookieFormat, type Element, type FileValue, type Fingerprint, type Health, type HumanInputAction, type LlmProvider, MAX_FILE_BYTES, type MfaConfig, type MfaResult, Oya, OyaError, type OyaOptions, type PageFormat, type PersonaInfo, type PersonaPrefs, type PlayResult, type Playbook, type PlaybookSummary, type ProjectSettings, type Provider, type ProxyCreate, type ProxyInfo, Run, type RunData, type RunInfo, type RunResult, type SiteCredentials, type StartOptions, type StartResult, type StopResult, type SubmitOptions, Oya as default, file };
|
package/dist/index.js
CHANGED
|
@@ -662,11 +662,28 @@ var loginCalls = (http) => ({
|
|
|
662
662
|
await http().request("DELETE", `/api/personas/${id}/credentials?domain=${encodeURIComponent(domain)}`);
|
|
663
663
|
}
|
|
664
664
|
});
|
|
665
|
+
var jarPath = (id) => `/api/pool/cookies?persona=${encodeURIComponent(id)}`;
|
|
666
|
+
var jarCalls = (http) => ({
|
|
667
|
+
/** Every cookie in the jar; `format: 'playwright'` is ready for `context.addCookies()`. */
|
|
668
|
+
cookies: async (id, format = "json") => (await http().request("GET", `${jarPath(id)}&format=${format}`)).cookies,
|
|
669
|
+
/** Merge cookies into the jar. The persona's browsers pick them up on their next visit to each site. */
|
|
670
|
+
importCookies: (id, list) => http().request("PUT", jarPath(id), { cookies: list })
|
|
671
|
+
});
|
|
672
|
+
var cookieCalls = (http) => ({
|
|
673
|
+
...jarCalls(http),
|
|
674
|
+
/** Copy every login of persona `from` into persona `to`, which keeps its own device. */
|
|
675
|
+
copyCookies: async (from, to) => jarCalls(http).importCookies(to, await jarCalls(http).cookies(from)),
|
|
676
|
+
/** Forget every cookie in the jar: signs the persona out everywhere. */
|
|
677
|
+
clearCookies: async (id) => {
|
|
678
|
+
await http().request("DELETE", jarPath(id));
|
|
679
|
+
}
|
|
680
|
+
});
|
|
665
681
|
var personaApi = (http) => ({
|
|
666
682
|
...identityCalls(http),
|
|
667
683
|
...deviceCalls(http),
|
|
668
684
|
...mfaCalls(http),
|
|
669
|
-
...loginCalls(http)
|
|
685
|
+
...loginCalls(http),
|
|
686
|
+
...cookieCalls(http)
|
|
670
687
|
});
|
|
671
688
|
|
|
672
689
|
// src/api/config.ts
|
package/package.json
CHANGED