@volter-ai-dev/supercode-browser-playwright 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/README.md +136 -0
- package/bin/supercode-browser-playwright +7 -0
- package/dist/cli.d.ts +7 -0
- package/dist/executor.d.ts +66 -0
- package/dist/executor.mjs +475 -0
- package/dist/executor.mjs.map +7 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +1016 -0
- package/dist/index.mjs.map +7 -0
- package/dist/protocol.d.ts +90 -0
- package/dist/protocol.mjs +216 -0
- package/dist/protocol.mjs.map +7 -0
- package/dist/provider.d.ts +31 -0
- package/dist/serve.d.ts +32 -0
- package/package.json +46 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The provider: one Playwright connection over CDP, one page, and the
|
|
3
|
+
* `supercode/browser-provider-v1` envelope around each operation call.
|
|
4
|
+
*/
|
|
5
|
+
import { SUPERCODE_BROWSER_PROVIDER_PROTOCOL, type BrowserOperationResult } from "./protocol.js";
|
|
6
|
+
/** Bound for one provider request (`BROWSER_PROVIDER_MAX_REQUEST_BYTES`). */
|
|
7
|
+
export declare const MAX_REQUEST_BYTES: number;
|
|
8
|
+
/** Bound for one provider response (`BROWSER_PROVIDER_MAX_RESPONSE_BYTES`). */
|
|
9
|
+
export declare const MAX_RESPONSE_BYTES: number;
|
|
10
|
+
export interface PlaywrightBrowserProviderOptions {
|
|
11
|
+
/** CDP endpoint: `http://…` (resolved through `/json/version`) or `ws://…`. */
|
|
12
|
+
cdpUrl: string;
|
|
13
|
+
/** Hex token every request must carry. */
|
|
14
|
+
token: string;
|
|
15
|
+
/** True when the endpoint dispatches `isTrusted:false` input (an AlmostCDP endpoint). */
|
|
16
|
+
syntheticEvents: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** The provider-v1 response envelope the harness reads. */
|
|
19
|
+
export interface ProviderResponse {
|
|
20
|
+
protocol: typeof SUPERCODE_BROWSER_PROVIDER_PROTOCOL;
|
|
21
|
+
id: string | null;
|
|
22
|
+
result: BrowserOperationResult;
|
|
23
|
+
}
|
|
24
|
+
export interface PlaywrightBrowserProvider {
|
|
25
|
+
readonly token: string;
|
|
26
|
+
/** Validate one provider-v1 request and answer it with a provider-v1 response. */
|
|
27
|
+
handle(request: unknown): Promise<ProviderResponse>;
|
|
28
|
+
/** Disconnect from the endpoint. The browser itself is left running. */
|
|
29
|
+
close(): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
export declare function createPlaywrightBrowserProvider(options: PlaywrightBrowserProviderOptions): PlaywrightBrowserProvider;
|
package/dist/serve.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Two framings of the same provider-v1 envelope.
|
|
3
|
+
*
|
|
4
|
+
* - TCP (the harness's wire, `crates/harness/src/browser.rs`): one
|
|
5
|
+
* newline-terminated JSON request per connection, one JSON response, close.
|
|
6
|
+
* Discovery is an owner-only record under `<providers dir>/browser/<id>.json`.
|
|
7
|
+
* - HTTP: `POST /` with the request JSON as the body, the response JSON as the
|
|
8
|
+
* body, for a host that can reach the provider only by HTTP.
|
|
9
|
+
*/
|
|
10
|
+
import { type PlaywrightBrowserProvider } from "./provider.js";
|
|
11
|
+
export interface ServeHandle {
|
|
12
|
+
framing: "tcp" | "http";
|
|
13
|
+
port: number;
|
|
14
|
+
/** The discovery record written for the TCP framing. */
|
|
15
|
+
discoveryPath?: string;
|
|
16
|
+
stop(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
/** Supercode's providers directory, resolved as `browser_provider_directory()` resolves its parent. */
|
|
19
|
+
export declare function defaultProvidersDirectory(): string;
|
|
20
|
+
export interface TcpServeOptions {
|
|
21
|
+
port: number;
|
|
22
|
+
/** Parent of `browser/`; defaults to Supercode's providers directory. */
|
|
23
|
+
providersDirectory?: string;
|
|
24
|
+
/** Workspace the discovery record is scoped to; defaults to the working directory. */
|
|
25
|
+
workspace?: string;
|
|
26
|
+
syntheticEvents: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare function serveTcp(provider: PlaywrightBrowserProvider, options: TcpServeOptions): Promise<ServeHandle>;
|
|
29
|
+
export interface HttpServeOptions {
|
|
30
|
+
port: number;
|
|
31
|
+
}
|
|
32
|
+
export declare function serveHttp(provider: PlaywrightBrowserProvider, options: HttpServeOptions): Promise<ServeHandle>;
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@volter-ai-dev/supercode-browser-playwright",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Supercode browser provider that is an unmodified playwright-core client over CDP, and the browser-operation wire it answers",
|
|
6
|
+
"bin": {
|
|
7
|
+
"supercode-browser-playwright": "bin/supercode-browser-playwright"
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.mjs"
|
|
13
|
+
},
|
|
14
|
+
"./protocol": {
|
|
15
|
+
"types": "./dist/protocol.d.ts",
|
|
16
|
+
"import": "./dist/protocol.mjs"
|
|
17
|
+
},
|
|
18
|
+
"./executor": {
|
|
19
|
+
"types": "./dist/executor.d.ts",
|
|
20
|
+
"import": "./dist/executor.mjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"files": [
|
|
25
|
+
"bin",
|
|
26
|
+
"dist",
|
|
27
|
+
"README.md"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "node scripts/build.mjs",
|
|
31
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
32
|
+
"prepack": "npm run build"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"playwright-core": "1.63.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^22.10.0",
|
|
39
|
+
"esbuild": "^0.25.0",
|
|
40
|
+
"typescript": "5.6.3"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=20"
|
|
44
|
+
},
|
|
45
|
+
"license": "MIT OR Apache-2.0"
|
|
46
|
+
}
|