@onkernel/sdk 0.119.0 → 0.121.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/CHANGELOG.md +20 -0
- package/client.d.mts +2 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -2
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/auth/connections.d.mts +1 -1
- package/resources/auth/connections.d.mts.map +1 -1
- package/resources/auth/connections.d.ts +1 -1
- package/resources/auth/connections.d.ts.map +1 -1
- package/resources/browser-pools.d.mts +4 -4
- package/resources/browser-pools.d.mts.map +1 -1
- package/resources/browser-pools.d.ts +4 -4
- package/resources/browser-pools.d.ts.map +1 -1
- package/resources/browsers/browsers.d.mts +59 -11
- package/resources/browsers/browsers.d.mts.map +1 -1
- package/resources/browsers/browsers.d.ts +59 -11
- package/resources/browsers/browsers.d.ts.map +1 -1
- package/resources/browsers/browsers.js +2 -2
- package/resources/browsers/browsers.js.map +1 -1
- package/resources/browsers/browsers.mjs +2 -2
- package/resources/browsers/browsers.mjs.map +1 -1
- package/resources/browsers/index.d.mts +2 -2
- package/resources/browsers/index.d.mts.map +1 -1
- package/resources/browsers/index.d.ts +2 -2
- package/resources/browsers/index.d.ts.map +1 -1
- package/resources/browsers/index.js +4 -4
- package/resources/browsers/index.js.map +1 -1
- package/resources/browsers/index.mjs +1 -1
- package/resources/browsers/index.mjs.map +1 -1
- package/resources/browsers/playwright/executors.d.mts +95 -0
- package/resources/browsers/playwright/executors.d.mts.map +1 -0
- package/resources/browsers/playwright/executors.d.ts +95 -0
- package/resources/browsers/playwright/executors.d.ts.map +1 -0
- package/resources/browsers/playwright/executors.js +57 -0
- package/resources/browsers/playwright/executors.js.map +1 -0
- package/resources/browsers/playwright/executors.mjs +53 -0
- package/resources/browsers/playwright/executors.mjs.map +1 -0
- package/resources/browsers/playwright/index.d.mts +3 -0
- package/resources/browsers/playwright/index.d.mts.map +1 -0
- package/resources/browsers/playwright/index.d.ts +3 -0
- package/resources/browsers/playwright/index.d.ts.map +1 -0
- package/resources/browsers/playwright/index.js +9 -0
- package/resources/browsers/playwright/index.js.map +1 -0
- package/resources/browsers/playwright/index.mjs +4 -0
- package/resources/browsers/playwright/index.mjs.map +1 -0
- package/resources/browsers/playwright/playwright.d.mts +149 -0
- package/resources/browsers/playwright/playwright.d.mts.map +1 -0
- package/resources/browsers/playwright/playwright.d.ts +149 -0
- package/resources/browsers/playwright/playwright.d.ts.map +1 -0
- package/resources/browsers/playwright/playwright.js +76 -0
- package/resources/browsers/playwright/playwright.js.map +1 -0
- package/resources/browsers/playwright/playwright.mjs +71 -0
- package/resources/browsers/playwright/playwright.mjs.map +1 -0
- package/resources/browsers/playwright.d.mts +1 -68
- package/resources/browsers/playwright.d.mts.map +1 -1
- package/resources/browsers/playwright.d.ts +1 -68
- package/resources/browsers/playwright.d.ts.map +1 -1
- package/resources/browsers/playwright.js +2 -29
- package/resources/browsers/playwright.js.map +1 -1
- package/resources/browsers/playwright.mjs +1 -27
- package/resources/browsers/playwright.mjs.map +1 -1
- package/resources/browsers/telemetry.d.mts +17 -15
- package/resources/browsers/telemetry.d.mts.map +1 -1
- package/resources/browsers/telemetry.d.ts +17 -15
- package/resources/browsers/telemetry.d.ts.map +1 -1
- package/resources/config-registry/config-registry.d.mts +3 -16
- package/resources/config-registry/config-registry.d.mts.map +1 -1
- package/resources/config-registry/config-registry.d.ts +3 -16
- package/resources/config-registry/config-registry.d.ts.map +1 -1
- package/resources/config-registry/config-registry.js.map +1 -1
- package/resources/config-registry/config-registry.mjs.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/invocations.d.mts +1 -1
- package/resources/invocations.d.mts.map +1 -1
- package/resources/invocations.d.ts +1 -1
- package/resources/invocations.d.ts.map +1 -1
- package/resources/proxies.d.mts +33 -113
- package/resources/proxies.d.mts.map +1 -1
- package/resources/proxies.d.ts +33 -113
- package/resources/proxies.d.ts.map +1 -1
- package/resources/proxies.js +6 -8
- package/resources/proxies.js.map +1 -1
- package/resources/proxies.mjs +6 -8
- package/resources/proxies.mjs.map +1 -1
- package/resources/search/search.d.mts +4 -2
- package/resources/search/search.d.mts.map +1 -1
- package/resources/search/search.d.ts +4 -2
- package/resources/search/search.d.ts.map +1 -1
- package/resources/search/search.js.map +1 -1
- package/resources/search/search.mjs.map +1 -1
- package/resources/vaults/items.d.mts +42 -42
- package/resources/vaults/items.d.mts.map +1 -1
- package/resources/vaults/items.d.ts +42 -42
- package/resources/vaults/items.d.ts.map +1 -1
- package/src/client.ts +2 -0
- package/src/resources/auth/connections.ts +1 -1
- package/src/resources/browser-pools.ts +4 -4
- package/src/resources/browsers/browsers.ts +69 -9
- package/src/resources/browsers/index.ts +8 -1
- package/src/resources/browsers/playwright/executors.ts +123 -0
- package/src/resources/browsers/playwright/index.ts +10 -0
- package/src/resources/browsers/playwright/playwright.ts +186 -0
- package/src/resources/browsers/playwright.ts +1 -87
- package/src/resources/browsers/telemetry.ts +17 -14
- package/src/resources/config-registry/config-registry.ts +2 -17
- package/src/resources/index.ts +1 -0
- package/src/resources/invocations.ts +1 -1
- package/src/resources/proxies.ts +27 -119
- package/src/resources/search/search.ts +4 -2
- package/src/resources/vaults/items.ts +43 -45
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { APIResource } from "../../../core/resource.js";
|
|
2
|
+
import { APIPromise } from "../../../core/api-promise.js";
|
|
3
|
+
import { RequestOptions } from "../../../internal/request-options.js";
|
|
4
|
+
/**
|
|
5
|
+
* Execute Playwright code against the browser instance and manage the executors it runs in.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Executors extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Lists the default executor first, then the named executors created by POST
|
|
10
|
+
* /browsers/{id_or_name}/playwright/execute. Each entry reports whether a call is
|
|
11
|
+
* running on it and, for named executors, the target ID and URL of the tab it
|
|
12
|
+
* owns. Returns 404 for a browser whose image predates executors.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const executorList =
|
|
17
|
+
* await client.browsers.playwright.executors.list(
|
|
18
|
+
* 'htzv5orfit78e1m2biiifpbv',
|
|
19
|
+
* );
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
list(idOrName: string, options?: RequestOptions): APIPromise<ExecutorList>;
|
|
23
|
+
/**
|
|
24
|
+
* Stops the executor's process. A call running on it fails with an error saying
|
|
25
|
+
* the executor was deleted. By default the executor's tab is closed too. The name
|
|
26
|
+
* can be reused; the next call with it creates a new executor and tab.
|
|
27
|
+
*
|
|
28
|
+
* The default executor is restarted instead of removed: its process is stopped, a
|
|
29
|
+
* call running on it fails with an error saying the executor was restarted, and
|
|
30
|
+
* queued and later calls run on a new process. It owns no tab, so 'close_tab' has
|
|
31
|
+
* no effect on it.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* await client.browsers.playwright.executors.delete(
|
|
36
|
+
* 'checkout',
|
|
37
|
+
* { id_or_name: 'htzv5orfit78e1m2biiifpbv' },
|
|
38
|
+
* );
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
delete(name: string, params: ExecutorDeleteParams, options?: RequestOptions): APIPromise<void>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A Playwright executor on the browser
|
|
45
|
+
*/
|
|
46
|
+
export interface Executor {
|
|
47
|
+
/**
|
|
48
|
+
* Whether a call is running on the executor
|
|
49
|
+
*/
|
|
50
|
+
busy: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* When the executor was created
|
|
53
|
+
*/
|
|
54
|
+
created_at: string;
|
|
55
|
+
/**
|
|
56
|
+
* When the most recent call on the executor started
|
|
57
|
+
*/
|
|
58
|
+
last_used_at: string;
|
|
59
|
+
/**
|
|
60
|
+
* Name of a Playwright executor. Calls with the same name run in the same
|
|
61
|
+
* executor, one at a time; the first call with a new name creates it. Calls on
|
|
62
|
+
* different executors run concurrently. 'default' names the executor that runs
|
|
63
|
+
* calls without a name.
|
|
64
|
+
*/
|
|
65
|
+
name: string;
|
|
66
|
+
/**
|
|
67
|
+
* CDP page target ID of the executor's tab, once it has one. The default executor
|
|
68
|
+
* owns no tab.
|
|
69
|
+
*/
|
|
70
|
+
target_id?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Current URL of the executor's tab, when it is open
|
|
73
|
+
*/
|
|
74
|
+
url?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The default executor followed by the named executors
|
|
78
|
+
*/
|
|
79
|
+
export interface ExecutorList {
|
|
80
|
+
executors: Array<Executor>;
|
|
81
|
+
}
|
|
82
|
+
export interface ExecutorDeleteParams {
|
|
83
|
+
/**
|
|
84
|
+
* Path param: Browser session ID or name
|
|
85
|
+
*/
|
|
86
|
+
id_or_name: string;
|
|
87
|
+
/**
|
|
88
|
+
* Query param: Close the executor's tab. Defaults to true.
|
|
89
|
+
*/
|
|
90
|
+
close_tab?: boolean;
|
|
91
|
+
}
|
|
92
|
+
export declare namespace Executors {
|
|
93
|
+
export { type Executor as Executor, type ExecutorList as ExecutorList, type ExecutorDeleteParams as ExecutorDeleteParams, };
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=executors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executors.d.ts","sourceRoot":"","sources":["../../../src/resources/browsers/playwright/executors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,kCAA+B;AACrD,OAAO,EAAE,UAAU,EAAE,qCAAkC;AAEvD,OAAO,EAAE,cAAc,EAAE,6CAA0C;AAGnE;;GAEG;AACH,qBAAa,SAAU,SAAQ,WAAW;IACxC;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,YAAY,CAAC;IAI1E;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;CAQ/F;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IAEd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC;IACjC,OAAO,EACL,KAAK,QAAQ,IAAI,QAAQ,EACzB,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Executors = void 0;
|
|
5
|
+
const resource_1 = require("../../../core/resource.js");
|
|
6
|
+
const headers_1 = require("../../../internal/headers.js");
|
|
7
|
+
const path_1 = require("../../../internal/utils/path.js");
|
|
8
|
+
/**
|
|
9
|
+
* Execute Playwright code against the browser instance and manage the executors it runs in.
|
|
10
|
+
*/
|
|
11
|
+
class Executors extends resource_1.APIResource {
|
|
12
|
+
/**
|
|
13
|
+
* Lists the default executor first, then the named executors created by POST
|
|
14
|
+
* /browsers/{id_or_name}/playwright/execute. Each entry reports whether a call is
|
|
15
|
+
* running on it and, for named executors, the target ID and URL of the tab it
|
|
16
|
+
* owns. Returns 404 for a browser whose image predates executors.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const executorList =
|
|
21
|
+
* await client.browsers.playwright.executors.list(
|
|
22
|
+
* 'htzv5orfit78e1m2biiifpbv',
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
list(idOrName, options) {
|
|
27
|
+
return this._client.get((0, path_1.path) `/browsers/${idOrName}/playwright/executors`, options);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Stops the executor's process. A call running on it fails with an error saying
|
|
31
|
+
* the executor was deleted. By default the executor's tab is closed too. The name
|
|
32
|
+
* can be reused; the next call with it creates a new executor and tab.
|
|
33
|
+
*
|
|
34
|
+
* The default executor is restarted instead of removed: its process is stopped, a
|
|
35
|
+
* call running on it fails with an error saying the executor was restarted, and
|
|
36
|
+
* queued and later calls run on a new process. It owns no tab, so 'close_tab' has
|
|
37
|
+
* no effect on it.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* await client.browsers.playwright.executors.delete(
|
|
42
|
+
* 'checkout',
|
|
43
|
+
* { id_or_name: 'htzv5orfit78e1m2biiifpbv' },
|
|
44
|
+
* );
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
delete(name, params, options) {
|
|
48
|
+
const { id_or_name, close_tab } = params;
|
|
49
|
+
return this._client.delete((0, path_1.path) `/browsers/${id_or_name}/playwright/executors/${name}`, {
|
|
50
|
+
query: { close_tab },
|
|
51
|
+
...options,
|
|
52
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.Executors = Executors;
|
|
57
|
+
//# sourceMappingURL=executors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executors.js","sourceRoot":"","sources":["../../../src/resources/browsers/playwright/executors.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAqD;AAErD,0DAAyD;AAEzD,0DAAoD;AAEpD;;GAEG;AACH,MAAa,SAAU,SAAQ,sBAAW;IACxC;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,QAAgB,EAAE,OAAwB;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,aAAa,QAAQ,uBAAuB,EAAE,OAAO,CAAC,CAAC;IACrF,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,IAAY,EAAE,MAA4B,EAAE,OAAwB;QACzE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,aAAa,UAAU,yBAAyB,IAAI,EAAE,EAAE;YACrF,KAAK,EAAE,EAAE,SAAS,EAAE;YACpB,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AA7CD,8BA6CC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../../core/resource.mjs";
|
|
3
|
+
import { buildHeaders } from "../../../internal/headers.mjs";
|
|
4
|
+
import { path } from "../../../internal/utils/path.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* Execute Playwright code against the browser instance and manage the executors it runs in.
|
|
7
|
+
*/
|
|
8
|
+
export class Executors extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Lists the default executor first, then the named executors created by POST
|
|
11
|
+
* /browsers/{id_or_name}/playwright/execute. Each entry reports whether a call is
|
|
12
|
+
* running on it and, for named executors, the target ID and URL of the tab it
|
|
13
|
+
* owns. Returns 404 for a browser whose image predates executors.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const executorList =
|
|
18
|
+
* await client.browsers.playwright.executors.list(
|
|
19
|
+
* 'htzv5orfit78e1m2biiifpbv',
|
|
20
|
+
* );
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
list(idOrName, options) {
|
|
24
|
+
return this._client.get(path `/browsers/${idOrName}/playwright/executors`, options);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Stops the executor's process. A call running on it fails with an error saying
|
|
28
|
+
* the executor was deleted. By default the executor's tab is closed too. The name
|
|
29
|
+
* can be reused; the next call with it creates a new executor and tab.
|
|
30
|
+
*
|
|
31
|
+
* The default executor is restarted instead of removed: its process is stopped, a
|
|
32
|
+
* call running on it fails with an error saying the executor was restarted, and
|
|
33
|
+
* queued and later calls run on a new process. It owns no tab, so 'close_tab' has
|
|
34
|
+
* no effect on it.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* await client.browsers.playwright.executors.delete(
|
|
39
|
+
* 'checkout',
|
|
40
|
+
* { id_or_name: 'htzv5orfit78e1m2biiifpbv' },
|
|
41
|
+
* );
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
delete(name, params, options) {
|
|
45
|
+
const { id_or_name, close_tab } = params;
|
|
46
|
+
return this._client.delete(path `/browsers/${id_or_name}/playwright/executors/${name}`, {
|
|
47
|
+
query: { close_tab },
|
|
48
|
+
...options,
|
|
49
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=executors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executors.mjs","sourceRoot":"","sources":["../../../src/resources/browsers/playwright/executors.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,mCAA+B;AAErD,OAAO,EAAE,YAAY,EAAE,sCAAkC;AAEzD,OAAO,EAAE,IAAI,EAAE,yCAAqC;AAEpD;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,WAAW;IACxC;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,QAAgB,EAAE,OAAwB;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,QAAQ,uBAAuB,EAAE,OAAO,CAAC,CAAC;IACrF,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,IAAY,EAAE,MAA4B,EAAE,OAAwB;QACzE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,aAAa,UAAU,yBAAyB,IAAI,EAAE,EAAE;YACrF,KAAK,EAAE,EAAE,SAAS,EAAE;YACpB,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Executors, type Executor, type ExecutorList, type ExecutorDeleteParams } from "./executors.mjs";
|
|
2
|
+
export { Playwright, type ExecutorLimitError, type Tab, type PlaywrightExecuteResponse, type PlaywrightExecuteParams, } from "./playwright.mjs";
|
|
3
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/resources/browsers/playwright/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,KAAK,oBAAoB,EAAE,wBAAoB;AACrG,OAAO,EACL,UAAU,EACV,KAAK,kBAAkB,EACvB,KAAK,GAAG,EACR,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,GAC7B,yBAAqB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Executors, type Executor, type ExecutorList, type ExecutorDeleteParams } from "./executors.js";
|
|
2
|
+
export { Playwright, type ExecutorLimitError, type Tab, type PlaywrightExecuteResponse, type PlaywrightExecuteParams, } from "./playwright.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/browsers/playwright/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,KAAK,oBAAoB,EAAE,uBAAoB;AACrG,OAAO,EACL,UAAU,EACV,KAAK,kBAAkB,EACvB,KAAK,GAAG,EACR,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,GAC7B,wBAAqB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Playwright = exports.Executors = void 0;
|
|
5
|
+
var executors_1 = require("./executors.js");
|
|
6
|
+
Object.defineProperty(exports, "Executors", { enumerable: true, get: function () { return executors_1.Executors; } });
|
|
7
|
+
var playwright_1 = require("./playwright.js");
|
|
8
|
+
Object.defineProperty(exports, "Playwright", { enumerable: true, get: function () { return playwright_1.Playwright; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/browsers/playwright/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,4CAAqG;AAA5F,sGAAA,SAAS,OAAA;AAClB,8CAMsB;AALpB,wGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/resources/browsers/playwright/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,SAAS,EAA+D,wBAAoB;AACrG,OAAO,EACL,UAAU,GAKX,yBAAqB"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { APIResource } from "../../../core/resource.mjs";
|
|
2
|
+
import * as ExecutorsAPI from "./executors.mjs";
|
|
3
|
+
import { Executor, ExecutorDeleteParams, ExecutorList, Executors } from "./executors.mjs";
|
|
4
|
+
import { APIPromise } from "../../../core/api-promise.mjs";
|
|
5
|
+
import { RequestOptions } from "../../../internal/request-options.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* Execute Playwright code against the browser instance and manage the executors it runs in.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Playwright extends APIResource {
|
|
10
|
+
executors: ExecutorsAPI.Executors;
|
|
11
|
+
/**
|
|
12
|
+
* Execute arbitrary Playwright code in a fresh execution context against the
|
|
13
|
+
* browser. The code runs in the same VM as the browser, minimizing latency and
|
|
14
|
+
* maximizing throughput. It has access to 'page', 'context', 'browser', and
|
|
15
|
+
* 'webmcp' variables. Use 'webmcp.listTools()' to discover browser-wide WebMCP
|
|
16
|
+
* tools and 'webmcp.invokeTool(toolRef, input?, { timeoutSec? })' to invoke an
|
|
17
|
+
* exact registration. It can `return` a value, and this value is returned in the
|
|
18
|
+
* response.
|
|
19
|
+
*
|
|
20
|
+
* Every call runs in an executor: a dedicated Node.js process with its own browser
|
|
21
|
+
* connection. Calls on different executors run concurrently; calls on the same
|
|
22
|
+
* executor run one at a time. A timeout, crash, or blocked event loop in one
|
|
23
|
+
* executor does not affect other executors. After a timeout the executor keeps its
|
|
24
|
+
* process and drops its browser connection, so code abandoned by the timeout
|
|
25
|
+
* cannot keep driving the browser. After a crash or a blocked event loop, the next
|
|
26
|
+
* call on that executor starts a fresh process.
|
|
27
|
+
*
|
|
28
|
+
* Calls without 'executor' run in the executor named 'default', which always
|
|
29
|
+
* exists and is the same as passing 'executor: "default"'. In the default
|
|
30
|
+
* executor, 'page' is bound to an active tab reported by Chrome. In single-window
|
|
31
|
+
* sessions, this is the foreground tab. When multiple browser windows are open,
|
|
32
|
+
* Chrome reports one active tab per window and the selected window is unspecified.
|
|
33
|
+
* 'context' is the BrowserContext that owns the selected page. Use
|
|
34
|
+
* 'browser.contexts()' to select a context or page explicitly.
|
|
35
|
+
*
|
|
36
|
+
* Pass any other name to run the call in a named executor. The first call with a
|
|
37
|
+
* new name creates it. Each named executor owns a tab: its first call opens a new
|
|
38
|
+
* background tab in the default browser context, and 'page' is bound to that tab
|
|
39
|
+
* on every later call while it stays open. Opening it does not change the active
|
|
40
|
+
* tab of an existing window. If the tab is closed, the next call opens a new one
|
|
41
|
+
* and reports 'tab.created: true'. Executor code can still reach other tabs
|
|
42
|
+
* through 'context' and 'browser'; ownership only decides what 'page' is bound to.
|
|
43
|
+
* Use named executors to drive several tabs of one browser in parallel.
|
|
44
|
+
*
|
|
45
|
+
* A browser can have at most 8 named executors; the default executor does not
|
|
46
|
+
* count. A call that would create another returns 409 with the current executors;
|
|
47
|
+
* delete one with DELETE /browsers/{id_or_name}/playwright/executors/{name}. Named
|
|
48
|
+
* executors are not removed automatically while the browser runs; when it shuts
|
|
49
|
+
* down, they are removed and their tabs closed.
|
|
50
|
+
*
|
|
51
|
+
* A named call to a browser whose image predates executors fails with 400 instead
|
|
52
|
+
* of running on the active tab; calls without 'executor' keep working on every
|
|
53
|
+
* image.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const response = await client.browsers.playwright.execute(
|
|
58
|
+
* 'htzv5orfit78e1m2biiifpbv',
|
|
59
|
+
* { code: 'code' },
|
|
60
|
+
* );
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
execute(idOrName: string, body: PlaywrightExecuteParams, options?: RequestOptions): APIPromise<PlaywrightExecuteResponse>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Returned when a call would create a named executor beyond the per-browser limit
|
|
67
|
+
*/
|
|
68
|
+
export interface ExecutorLimitError {
|
|
69
|
+
/**
|
|
70
|
+
* The default executor and the named executors that already exist
|
|
71
|
+
*/
|
|
72
|
+
executors: Array<ExecutorsAPI.Executor>;
|
|
73
|
+
/**
|
|
74
|
+
* Human-readable error description
|
|
75
|
+
*/
|
|
76
|
+
message: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The tab 'page' was bound to for this call. Absent if the call failed before
|
|
80
|
+
* binding a tab.
|
|
81
|
+
*/
|
|
82
|
+
export interface Tab {
|
|
83
|
+
/**
|
|
84
|
+
* Whether this call opened the tab. For a named executor this happens on its first
|
|
85
|
+
* call and after its previous tab was closed. For the default executor it happens
|
|
86
|
+
* only when the browser had no open page.
|
|
87
|
+
*/
|
|
88
|
+
created: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* CDP page target ID of the tab
|
|
91
|
+
*/
|
|
92
|
+
target_id: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Result of Playwright code execution
|
|
96
|
+
*/
|
|
97
|
+
export interface PlaywrightExecuteResponse {
|
|
98
|
+
/**
|
|
99
|
+
* Whether the code executed successfully
|
|
100
|
+
*/
|
|
101
|
+
success: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Error message if execution failed
|
|
104
|
+
*/
|
|
105
|
+
error?: string;
|
|
106
|
+
/**
|
|
107
|
+
* The value returned by the code (if any)
|
|
108
|
+
*/
|
|
109
|
+
result?: unknown;
|
|
110
|
+
/**
|
|
111
|
+
* Standard error from the execution
|
|
112
|
+
*/
|
|
113
|
+
stderr?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Standard output from the execution
|
|
116
|
+
*/
|
|
117
|
+
stdout?: string;
|
|
118
|
+
/**
|
|
119
|
+
* The tab 'page' was bound to for this call. Absent if the call failed before
|
|
120
|
+
* binding a tab.
|
|
121
|
+
*/
|
|
122
|
+
tab?: Tab;
|
|
123
|
+
}
|
|
124
|
+
export interface PlaywrightExecuteParams {
|
|
125
|
+
/**
|
|
126
|
+
* TypeScript/JavaScript code to execute. The code has access to 'page', 'context',
|
|
127
|
+
* and 'browser' variables. It runs within a function, so you can use a return
|
|
128
|
+
* statement at the end to return a value. This value is returned as the `result`
|
|
129
|
+
* property in the response. Example: "await page.goto('https://example.com');
|
|
130
|
+
* return await page.title();"
|
|
131
|
+
*/
|
|
132
|
+
code: string;
|
|
133
|
+
/**
|
|
134
|
+
* Name of a Playwright executor. Calls with the same name run in the same
|
|
135
|
+
* executor, one at a time; the first call with a new name creates it. Calls on
|
|
136
|
+
* different executors run concurrently. 'default' names the executor that runs
|
|
137
|
+
* calls without a name.
|
|
138
|
+
*/
|
|
139
|
+
executor?: string;
|
|
140
|
+
/**
|
|
141
|
+
* Maximum execution time in seconds. Default is 60.
|
|
142
|
+
*/
|
|
143
|
+
timeout_sec?: number;
|
|
144
|
+
}
|
|
145
|
+
export declare namespace Playwright {
|
|
146
|
+
export { type ExecutorLimitError as ExecutorLimitError, type Tab as Tab, type PlaywrightExecuteResponse as PlaywrightExecuteResponse, type PlaywrightExecuteParams as PlaywrightExecuteParams, };
|
|
147
|
+
export { Executors as Executors, type Executor as Executor, type ExecutorList as ExecutorList, type ExecutorDeleteParams as ExecutorDeleteParams, };
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=playwright.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwright.d.mts","sourceRoot":"","sources":["../../../src/resources/browsers/playwright/playwright.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,mCAA+B;AACrD,OAAO,KAAK,YAAY,wBAAoB;AAC5C,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,YAAY,EAAE,SAAS,EAAE,wBAAoB;AACtF,OAAO,EAAE,UAAU,EAAE,sCAAkC;AACvD,OAAO,EAAE,cAAc,EAAE,8CAA0C;AAGnE;;GAEG;AACH,qBAAa,UAAW,SAAQ,WAAW;IACzC,SAAS,EAAE,YAAY,CAAC,SAAS,CAA4C;IAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmDG;IACH,OAAO,CACL,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,yBAAyB,CAAC;CAGzC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAExC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,GAAG;IAClB;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC;CACX;AAED,MAAM,WAAW,uBAAuB;IACtC;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,MAAM,CAAC,OAAO,WAAW,UAAU,CAAC;IAClC,OAAO,EACL,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,GAAG,IAAI,GAAG,EACf,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;IAEF,OAAO,EACL,SAAS,IAAI,SAAS,EACtB,KAAK,QAAQ,IAAI,QAAQ,EACzB,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { APIResource } from "../../../core/resource.js";
|
|
2
|
+
import * as ExecutorsAPI from "./executors.js";
|
|
3
|
+
import { Executor, ExecutorDeleteParams, ExecutorList, Executors } from "./executors.js";
|
|
4
|
+
import { APIPromise } from "../../../core/api-promise.js";
|
|
5
|
+
import { RequestOptions } from "../../../internal/request-options.js";
|
|
6
|
+
/**
|
|
7
|
+
* Execute Playwright code against the browser instance and manage the executors it runs in.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Playwright extends APIResource {
|
|
10
|
+
executors: ExecutorsAPI.Executors;
|
|
11
|
+
/**
|
|
12
|
+
* Execute arbitrary Playwright code in a fresh execution context against the
|
|
13
|
+
* browser. The code runs in the same VM as the browser, minimizing latency and
|
|
14
|
+
* maximizing throughput. It has access to 'page', 'context', 'browser', and
|
|
15
|
+
* 'webmcp' variables. Use 'webmcp.listTools()' to discover browser-wide WebMCP
|
|
16
|
+
* tools and 'webmcp.invokeTool(toolRef, input?, { timeoutSec? })' to invoke an
|
|
17
|
+
* exact registration. It can `return` a value, and this value is returned in the
|
|
18
|
+
* response.
|
|
19
|
+
*
|
|
20
|
+
* Every call runs in an executor: a dedicated Node.js process with its own browser
|
|
21
|
+
* connection. Calls on different executors run concurrently; calls on the same
|
|
22
|
+
* executor run one at a time. A timeout, crash, or blocked event loop in one
|
|
23
|
+
* executor does not affect other executors. After a timeout the executor keeps its
|
|
24
|
+
* process and drops its browser connection, so code abandoned by the timeout
|
|
25
|
+
* cannot keep driving the browser. After a crash or a blocked event loop, the next
|
|
26
|
+
* call on that executor starts a fresh process.
|
|
27
|
+
*
|
|
28
|
+
* Calls without 'executor' run in the executor named 'default', which always
|
|
29
|
+
* exists and is the same as passing 'executor: "default"'. In the default
|
|
30
|
+
* executor, 'page' is bound to an active tab reported by Chrome. In single-window
|
|
31
|
+
* sessions, this is the foreground tab. When multiple browser windows are open,
|
|
32
|
+
* Chrome reports one active tab per window and the selected window is unspecified.
|
|
33
|
+
* 'context' is the BrowserContext that owns the selected page. Use
|
|
34
|
+
* 'browser.contexts()' to select a context or page explicitly.
|
|
35
|
+
*
|
|
36
|
+
* Pass any other name to run the call in a named executor. The first call with a
|
|
37
|
+
* new name creates it. Each named executor owns a tab: its first call opens a new
|
|
38
|
+
* background tab in the default browser context, and 'page' is bound to that tab
|
|
39
|
+
* on every later call while it stays open. Opening it does not change the active
|
|
40
|
+
* tab of an existing window. If the tab is closed, the next call opens a new one
|
|
41
|
+
* and reports 'tab.created: true'. Executor code can still reach other tabs
|
|
42
|
+
* through 'context' and 'browser'; ownership only decides what 'page' is bound to.
|
|
43
|
+
* Use named executors to drive several tabs of one browser in parallel.
|
|
44
|
+
*
|
|
45
|
+
* A browser can have at most 8 named executors; the default executor does not
|
|
46
|
+
* count. A call that would create another returns 409 with the current executors;
|
|
47
|
+
* delete one with DELETE /browsers/{id_or_name}/playwright/executors/{name}. Named
|
|
48
|
+
* executors are not removed automatically while the browser runs; when it shuts
|
|
49
|
+
* down, they are removed and their tabs closed.
|
|
50
|
+
*
|
|
51
|
+
* A named call to a browser whose image predates executors fails with 400 instead
|
|
52
|
+
* of running on the active tab; calls without 'executor' keep working on every
|
|
53
|
+
* image.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const response = await client.browsers.playwright.execute(
|
|
58
|
+
* 'htzv5orfit78e1m2biiifpbv',
|
|
59
|
+
* { code: 'code' },
|
|
60
|
+
* );
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
execute(idOrName: string, body: PlaywrightExecuteParams, options?: RequestOptions): APIPromise<PlaywrightExecuteResponse>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Returned when a call would create a named executor beyond the per-browser limit
|
|
67
|
+
*/
|
|
68
|
+
export interface ExecutorLimitError {
|
|
69
|
+
/**
|
|
70
|
+
* The default executor and the named executors that already exist
|
|
71
|
+
*/
|
|
72
|
+
executors: Array<ExecutorsAPI.Executor>;
|
|
73
|
+
/**
|
|
74
|
+
* Human-readable error description
|
|
75
|
+
*/
|
|
76
|
+
message: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The tab 'page' was bound to for this call. Absent if the call failed before
|
|
80
|
+
* binding a tab.
|
|
81
|
+
*/
|
|
82
|
+
export interface Tab {
|
|
83
|
+
/**
|
|
84
|
+
* Whether this call opened the tab. For a named executor this happens on its first
|
|
85
|
+
* call and after its previous tab was closed. For the default executor it happens
|
|
86
|
+
* only when the browser had no open page.
|
|
87
|
+
*/
|
|
88
|
+
created: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* CDP page target ID of the tab
|
|
91
|
+
*/
|
|
92
|
+
target_id: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Result of Playwright code execution
|
|
96
|
+
*/
|
|
97
|
+
export interface PlaywrightExecuteResponse {
|
|
98
|
+
/**
|
|
99
|
+
* Whether the code executed successfully
|
|
100
|
+
*/
|
|
101
|
+
success: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Error message if execution failed
|
|
104
|
+
*/
|
|
105
|
+
error?: string;
|
|
106
|
+
/**
|
|
107
|
+
* The value returned by the code (if any)
|
|
108
|
+
*/
|
|
109
|
+
result?: unknown;
|
|
110
|
+
/**
|
|
111
|
+
* Standard error from the execution
|
|
112
|
+
*/
|
|
113
|
+
stderr?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Standard output from the execution
|
|
116
|
+
*/
|
|
117
|
+
stdout?: string;
|
|
118
|
+
/**
|
|
119
|
+
* The tab 'page' was bound to for this call. Absent if the call failed before
|
|
120
|
+
* binding a tab.
|
|
121
|
+
*/
|
|
122
|
+
tab?: Tab;
|
|
123
|
+
}
|
|
124
|
+
export interface PlaywrightExecuteParams {
|
|
125
|
+
/**
|
|
126
|
+
* TypeScript/JavaScript code to execute. The code has access to 'page', 'context',
|
|
127
|
+
* and 'browser' variables. It runs within a function, so you can use a return
|
|
128
|
+
* statement at the end to return a value. This value is returned as the `result`
|
|
129
|
+
* property in the response. Example: "await page.goto('https://example.com');
|
|
130
|
+
* return await page.title();"
|
|
131
|
+
*/
|
|
132
|
+
code: string;
|
|
133
|
+
/**
|
|
134
|
+
* Name of a Playwright executor. Calls with the same name run in the same
|
|
135
|
+
* executor, one at a time; the first call with a new name creates it. Calls on
|
|
136
|
+
* different executors run concurrently. 'default' names the executor that runs
|
|
137
|
+
* calls without a name.
|
|
138
|
+
*/
|
|
139
|
+
executor?: string;
|
|
140
|
+
/**
|
|
141
|
+
* Maximum execution time in seconds. Default is 60.
|
|
142
|
+
*/
|
|
143
|
+
timeout_sec?: number;
|
|
144
|
+
}
|
|
145
|
+
export declare namespace Playwright {
|
|
146
|
+
export { type ExecutorLimitError as ExecutorLimitError, type Tab as Tab, type PlaywrightExecuteResponse as PlaywrightExecuteResponse, type PlaywrightExecuteParams as PlaywrightExecuteParams, };
|
|
147
|
+
export { Executors as Executors, type Executor as Executor, type ExecutorList as ExecutorList, type ExecutorDeleteParams as ExecutorDeleteParams, };
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=playwright.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwright.d.ts","sourceRoot":"","sources":["../../../src/resources/browsers/playwright/playwright.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,kCAA+B;AACrD,OAAO,KAAK,YAAY,uBAAoB;AAC5C,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,YAAY,EAAE,SAAS,EAAE,uBAAoB;AACtF,OAAO,EAAE,UAAU,EAAE,qCAAkC;AACvD,OAAO,EAAE,cAAc,EAAE,6CAA0C;AAGnE;;GAEG;AACH,qBAAa,UAAW,SAAQ,WAAW;IACzC,SAAS,EAAE,YAAY,CAAC,SAAS,CAA4C;IAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmDG;IACH,OAAO,CACL,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,yBAAyB,CAAC;CAGzC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAExC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,GAAG;IAClB;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC;CACX;AAED,MAAM,WAAW,uBAAuB;IACtC;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,MAAM,CAAC,OAAO,WAAW,UAAU,CAAC;IAClC,OAAO,EACL,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,GAAG,IAAI,GAAG,EACf,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;IAEF,OAAO,EACL,SAAS,IAAI,SAAS,EACtB,KAAK,QAAQ,IAAI,QAAQ,EACzB,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Playwright = void 0;
|
|
5
|
+
const tslib_1 = require("../../../internal/tslib.js");
|
|
6
|
+
const resource_1 = require("../../../core/resource.js");
|
|
7
|
+
const ExecutorsAPI = tslib_1.__importStar(require("./executors.js"));
|
|
8
|
+
const executors_1 = require("./executors.js");
|
|
9
|
+
const path_1 = require("../../../internal/utils/path.js");
|
|
10
|
+
/**
|
|
11
|
+
* Execute Playwright code against the browser instance and manage the executors it runs in.
|
|
12
|
+
*/
|
|
13
|
+
class Playwright extends resource_1.APIResource {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.executors = new ExecutorsAPI.Executors(this._client);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Execute arbitrary Playwright code in a fresh execution context against the
|
|
20
|
+
* browser. The code runs in the same VM as the browser, minimizing latency and
|
|
21
|
+
* maximizing throughput. It has access to 'page', 'context', 'browser', and
|
|
22
|
+
* 'webmcp' variables. Use 'webmcp.listTools()' to discover browser-wide WebMCP
|
|
23
|
+
* tools and 'webmcp.invokeTool(toolRef, input?, { timeoutSec? })' to invoke an
|
|
24
|
+
* exact registration. It can `return` a value, and this value is returned in the
|
|
25
|
+
* response.
|
|
26
|
+
*
|
|
27
|
+
* Every call runs in an executor: a dedicated Node.js process with its own browser
|
|
28
|
+
* connection. Calls on different executors run concurrently; calls on the same
|
|
29
|
+
* executor run one at a time. A timeout, crash, or blocked event loop in one
|
|
30
|
+
* executor does not affect other executors. After a timeout the executor keeps its
|
|
31
|
+
* process and drops its browser connection, so code abandoned by the timeout
|
|
32
|
+
* cannot keep driving the browser. After a crash or a blocked event loop, the next
|
|
33
|
+
* call on that executor starts a fresh process.
|
|
34
|
+
*
|
|
35
|
+
* Calls without 'executor' run in the executor named 'default', which always
|
|
36
|
+
* exists and is the same as passing 'executor: "default"'. In the default
|
|
37
|
+
* executor, 'page' is bound to an active tab reported by Chrome. In single-window
|
|
38
|
+
* sessions, this is the foreground tab. When multiple browser windows are open,
|
|
39
|
+
* Chrome reports one active tab per window and the selected window is unspecified.
|
|
40
|
+
* 'context' is the BrowserContext that owns the selected page. Use
|
|
41
|
+
* 'browser.contexts()' to select a context or page explicitly.
|
|
42
|
+
*
|
|
43
|
+
* Pass any other name to run the call in a named executor. The first call with a
|
|
44
|
+
* new name creates it. Each named executor owns a tab: its first call opens a new
|
|
45
|
+
* background tab in the default browser context, and 'page' is bound to that tab
|
|
46
|
+
* on every later call while it stays open. Opening it does not change the active
|
|
47
|
+
* tab of an existing window. If the tab is closed, the next call opens a new one
|
|
48
|
+
* and reports 'tab.created: true'. Executor code can still reach other tabs
|
|
49
|
+
* through 'context' and 'browser'; ownership only decides what 'page' is bound to.
|
|
50
|
+
* Use named executors to drive several tabs of one browser in parallel.
|
|
51
|
+
*
|
|
52
|
+
* A browser can have at most 8 named executors; the default executor does not
|
|
53
|
+
* count. A call that would create another returns 409 with the current executors;
|
|
54
|
+
* delete one with DELETE /browsers/{id_or_name}/playwright/executors/{name}. Named
|
|
55
|
+
* executors are not removed automatically while the browser runs; when it shuts
|
|
56
|
+
* down, they are removed and their tabs closed.
|
|
57
|
+
*
|
|
58
|
+
* A named call to a browser whose image predates executors fails with 400 instead
|
|
59
|
+
* of running on the active tab; calls without 'executor' keep working on every
|
|
60
|
+
* image.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const response = await client.browsers.playwright.execute(
|
|
65
|
+
* 'htzv5orfit78e1m2biiifpbv',
|
|
66
|
+
* { code: 'code' },
|
|
67
|
+
* );
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
execute(idOrName, body, options) {
|
|
71
|
+
return this._client.post((0, path_1.path) `/browsers/${idOrName}/playwright/execute`, { body, ...options });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.Playwright = Playwright;
|
|
75
|
+
Playwright.Executors = executors_1.Executors;
|
|
76
|
+
//# sourceMappingURL=playwright.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwright.js","sourceRoot":"","sources":["../../../src/resources/browsers/playwright/playwright.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,wDAAqD;AACrD,qEAA4C;AAC5C,8CAAsF;AAGtF,0DAAoD;AAEpD;;GAEG;AACH,MAAa,UAAW,SAAQ,sBAAW;IAA3C;;QACE,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA6D/E,CAAC;IA3DC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmDG;IACH,OAAO,CACL,QAAgB,EAChB,IAA6B,EAC7B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,aAAa,QAAQ,qBAAqB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjG,CAAC;CACF;AA9DD,gCA8DC;AA+FD,UAAU,CAAC,SAAS,GAAG,qBAAS,CAAC"}
|