@ai-ecoverse/slicc-cdp 1.5.4 → 1.7.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 +43 -3
- package/bin/curlwright.wasm +0 -0
- package/bin/playwright-cli.wasm +0 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
`@ai-ecoverse/slicc-cdp` publishes `playwright-cli` and `curlwright`, Rust clients for an already-running Chrome. They speak Chrome DevTools Protocol JSON. The package root exports `CDPClient` and `connect`, one browser DevTools socket.
|
|
4
4
|
|
|
5
|
+
`playwright-cli` is a playwright-cli-compatible command for SLICC and not affiliated with Microsoft Playwright.
|
|
6
|
+
|
|
5
7
|
## playwright-cli
|
|
6
8
|
|
|
7
|
-
The binary is `crates/playwright-cli`.
|
|
9
|
+
The binary is `crates/playwright-cli`. Host `open` launches a browser into `<config>/slicc/seven-profiles/<id>` when no debugger is already connected, and inside slicc it only opens a tab. It does not invent a debugger path.
|
|
8
10
|
|
|
9
11
|
Connect, in order: `--cdp`, else `SLICC_CDP_URL`, else `GET http://127.0.0.1:9222/json/version` and dial the returned `webSocketDebuggerUrl`. A `ws://` URL is dialed as given. An `http://` URL is discovery. On the native build a `wss://` URL is dialed as given. The WASI build has no TLS, so `wss://` and `https://` fail there. `--runtime <name>` is appended to the query of the URL that is opened and is not interpreted.
|
|
10
12
|
|
|
11
13
|
One browser WebSocket. `Target.attachToTarget` uses `{targetId, flatten: true}`. Later page commands send that `sessionId` at the top level. There is no `/devtools/page/<id>` socket.
|
|
12
14
|
|
|
13
|
-
Implemented commands: `open`, `close`, `goto`, `snapshot`, `click`, `fill`, `type`, `press`, `screenshot`, `eval`, `tab-list`, `tab-new`, `tab-select`, `tab-close`. `snapshot` prints ARIA refs such as `e1` and iframe refs such as `f1e5`. Other names from the command manifest print `playwright-cli <command>: not implemented yet` and exit non-zero. `--help` lists those names under "Not implemented yet". It does not yet match upstream help for the whole shared set.
|
|
15
|
+
Implemented commands: `open`, `close`, `goto`, `snapshot`, `click`, `fill`, `type`, `press`, `screenshot`, `eval`, `tab-list`, `tab-new`, `tab-select`, `tab-close`, `list`. `snapshot` prints ARIA refs such as `e1` and iframe refs such as `f1e5`. Other names from the command manifest print `playwright-cli <command>: not implemented yet` and exit non-zero. `--help` lists those names under "Not implemented yet". It does not yet match upstream help for the whole shared set.
|
|
14
16
|
|
|
15
17
|
A non-2xx discovery response prints the status and the body and exits non-zero. A server close frame prints `websocket closed <code> <reason>` and exits non-zero. After that frame is visible, the client does not write to the socket again. `--version` and `-V` print `playwright-cli` plus the `package.json` version.
|
|
16
18
|
|
|
@@ -20,10 +22,48 @@ A non-2xx discovery response prints the status and the body and exits non-zero.
|
|
|
20
22
|
|
|
21
23
|
## Kernel commands
|
|
22
24
|
|
|
23
|
-
`slicc.abi` is `wasi`. The commands are `playwright-cli` (`bin/playwright-cli.wasm`) and `curlwright` (`bin/curlwright.wasm`). `npm run build:wasm` builds both for `wasm32-wasip1` and copies them there. The release workflow runs that before publish. Do not commit the wasm. On that target, TCP comes from the
|
|
25
|
+
`slicc.abi` is `wasi`. The commands are `playwright-cli` (`bin/playwright-cli.wasm`) and `curlwright` (`bin/curlwright.wasm`). `npm run build:wasm` builds both for `wasm32-wasip1` and copies them there. The release workflow runs that before publish. Do not commit the wasm. On that target, TCP comes from the `wasix-net` 0.1 crate on crates.io.
|
|
24
26
|
|
|
25
27
|
Inside the kernel the browser socket is `SLICC_CDP_URL`: `ws://127.0.0.1:9222/devtools/browser/<id>` from slicc-kernel. Port 9222 accepts connections only from inside the kernel.
|
|
26
28
|
|
|
27
29
|
## Package
|
|
28
30
|
|
|
29
31
|
Node ≥ 24. `npm run lint` runs `slicc-lint`. Releases use semantic-release on `main`. Git `package.json` stays `0.0.0`. The published version is the release tag.
|
|
32
|
+
|
|
33
|
+
## Install and run
|
|
34
|
+
|
|
35
|
+
`cargo install slicc-cdp` installs the `playwright-cli` command. `cargo install curlwright` installs `curlwright`. Host builds run on macOS, Linux, and Windows. TLS there is `native-tls` (Secure Transport, OpenSSL, or SChannel). The `slicc-cdp` crate needs Rust 1.88. `curlwright` and `slicc-cdp-client` need Rust 1.83.
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
cargo install slicc-cdp
|
|
39
|
+
cargo install curlwright
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`@ai-ecoverse/slicc-cdp` on npm is the SLICC package. It ships `bin/playwright-cli.wasm` and `bin/curlwright.wasm`, built for `wasm32-wasip1`. Those builds have no TLS, so `wss://` and `https://` fail in the kernel. The same commands exist there; the Cargo install is the host build, not those wasm files.
|
|
43
|
+
|
|
44
|
+
Host `open` launches a browser into `<config>/slicc/seven-profiles/<id>` when no debugger is already connected, and inside slicc it only opens a tab. `curlwright` does not launch a browser. You can still start Chrome with `--remote-debugging-port` and a non-default `--user-data-dir`, then pass that HTTP endpoint as `--cdp`. Chrome 136 and later ignore the debugging port on the default profile, and an already-open Chrome ignores a second launch. `--headless` is optional: leave it off to open a window. The examples use port 9333.
|
|
45
|
+
|
|
46
|
+
macOS:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --headless --remote-debugging-port=9333 --user-data-dir=/tmp/chrome-cdp
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Linux:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
google-chrome --headless --remote-debugging-port=9333 --user-data-dir=/tmp/chrome-cdp
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
playwright-cli --cdp http://127.0.0.1:9333 open https://example.com
|
|
60
|
+
playwright-cli --cdp http://127.0.0.1:9333 snapshot
|
|
61
|
+
playwright-cli --cdp http://127.0.0.1:9333 tab-list
|
|
62
|
+
playwright-cli list
|
|
63
|
+
curlwright --cdp http://127.0.0.1:9333 https://example.com/
|
|
64
|
+
curlwright --cdp http://127.0.0.1:9333 -I https://example.com/
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`playwright-cli list` prints `connected`, `debug ports`, and `launchable`. An empty section is the line `none`. It does not launch a browser. `playwright-cli list --json` prints one JSON document and no text sections.
|
|
68
|
+
|
|
69
|
+
`--cdp` still wins over `SLICC_CDP_URL`, which wins over discovery at `http://127.0.0.1:9222/json/version`. A crate installed from crates.io prints its crate version. In this repository, and in the npm wasm builds, `--version` prints the `package.json` version. The release workflow writes that version into the crate manifests before `cargo publish`, and only after semantic-release has published the npm package. Git keeps the crate versions at `0.0.0`.
|
package/bin/curlwright.wasm
CHANGED
|
Binary file
|
package/bin/playwright-cli.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-cdp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "SLICC's CDP layer: client, browser API, transports, HAR, and ARIA snapshot",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -47,22 +47,22 @@
|
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
|
-
"prepare": "lefthook install",
|
|
51
|
-
"build:wasm": "cargo build --release --target wasm32-wasip1 -p
|
|
50
|
+
"prepare": "lefthook install && node scripts/allow-crate-readmes.mjs",
|
|
51
|
+
"build:wasm": "cargo build --release --target wasm32-wasip1 -p slicc-cdp -p curlwright && mkdir -p bin && cp target/wasm32-wasip1/release/playwright-cli.wasm bin/playwright-cli.wasm && cp target/wasm32-wasip1/release/curlwright.wasm bin/curlwright.wasm",
|
|
52
52
|
"prepublishOnly": "npm run build:wasm",
|
|
53
53
|
"lint": "slicc-lint",
|
|
54
54
|
"typecheck": "node --check src/index.js && node --check src/cdp-client.js && node --check src/connect.js && node --check src/page.js && node --check packages/sliccy-browser/src/browser.js && node --check packages/sliccy-browser/src/fetch-script.js && node --check packages/sliccy-browser/src/ws-router.js",
|
|
55
55
|
"format": "biome check --write .",
|
|
56
56
|
"test": "true",
|
|
57
|
-
"test:integration": "PATH=\"$HOME/.cargo/bin:$PATH\" cargo build -p
|
|
57
|
+
"test:integration": "PATH=\"$HOME/.cargo/bin:$PATH\" cargo build -p slicc-cdp -p curlwright && PATH=\"$HOME/.cargo/bin:$PATH\" cargo build --target wasm32-wasip1 -p slicc-cdp -p curlwright && npx playwright-core install chromium && node --test --test-timeout=180000 test/integration/*.test.mjs",
|
|
58
58
|
"test:unit": "mcr -c node_modules/@ai-ecoverse/slicc-shared-web/mcr.config.mjs node --test 'test/unit/**/*.test.mjs'",
|
|
59
59
|
"trust": "npx fledgling sync -y --skip-publish",
|
|
60
60
|
"trust:dry": "npx fledgling sync --dry-run -y --skip-publish",
|
|
61
61
|
"release": "semantic-release"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@ai-ecoverse/slicc-kernel": "1.
|
|
65
|
-
"@ai-ecoverse/slicc-shared-web": "1.12.
|
|
64
|
+
"@ai-ecoverse/slicc-kernel": "1.60.1",
|
|
65
|
+
"@ai-ecoverse/slicc-shared-web": "1.12.3",
|
|
66
66
|
"@biomejs/biome": "2.5.15",
|
|
67
67
|
"lefthook": "2.1.16",
|
|
68
68
|
"playwright-core": "1.63.0",
|