@cbxss/eoka 0.0.0-stage → 0.1.0-beta.1
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 +539 -2
- package/dist/LICENSE +21 -0
- package/dist/browser-install-diagnostics.d.ts +1 -0
- package/dist/browser-install-diagnostics.js +21 -0
- package/dist/browser-install-engine.d.ts +10 -0
- package/dist/browser-install-engine.js +286 -0
- package/dist/browser-install-inventory.d.ts +25 -0
- package/dist/browser-install-inventory.js +101 -0
- package/dist/browser-install-worker.d.ts +21 -0
- package/dist/browser-install-worker.js +65 -0
- package/dist/browser-install.d.ts +22 -0
- package/dist/browser-install.js +7 -0
- package/dist/browser.d.ts +59 -0
- package/dist/browser.js +445 -0
- package/dist/client.d.ts +11 -0
- package/dist/client.js +1 -0
- package/dist/errors.d.ts +33 -0
- package/dist/errors.js +44 -0
- package/dist/generated/protocol.d.ts +3901 -0
- package/dist/generated/protocol.js +2 -0
- package/dist/generated/schema-bundle.json +18868 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +11 -0
- package/dist/install-errors.d.ts +4 -0
- package/dist/install-errors.js +6 -0
- package/dist/operations.d.ts +22 -0
- package/dist/operations.js +87 -0
- package/dist/page.d.ts +77 -0
- package/dist/page.js +250 -0
- package/dist/platform.d.ts +4 -0
- package/dist/platform.js +27 -0
- package/dist/recording.d.ts +27 -0
- package/dist/recording.js +124 -0
- package/dist/release-manifest.json +101 -0
- package/dist/release.d.ts +36 -0
- package/dist/release.js +76 -0
- package/dist/server-binary.d.ts +11 -0
- package/dist/server-binary.js +107 -0
- package/dist/transport.d.ts +89 -0
- package/dist/transport.js +737 -0
- package/examples/capture.mjs +36 -0
- package/examples/consume-schema.mjs +7 -0
- package/examples/explicit-paths.mjs +42 -0
- package/examples/install-browser.mjs +20 -0
- package/examples/offline.mjs +20 -0
- package/package.json +70 -4
package/README.md
CHANGED
|
@@ -1,3 +1,540 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @cbxss/eoka
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Node.js SDK for the eoka NDJSON browser sidecar. The source package remains private and unpublished; npm version `0.1.0-beta.1` is reserved for the qualified beta release and can be built and packed locally for integration testing. It supports **Node.js 24 LTS, starting at 24.21.0** (`^24.21.0`) and exports compiled ESM and TypeScript declarations. Node 22 and Current/non-LTS lines are outside the support policy. CommonJS `require` is not an export.
|
|
4
|
+
|
|
5
|
+
## Current scope and platform qualification
|
|
6
|
+
|
|
7
|
+
The SDK provides correlated subprocess transport, typed browser/page operations, durable operation handles, pinned full Chrome for Testing installation, verified native server resolution, PNG/JPEG/WebP capture, native MP4 recording, and bounded disposal. It does not provide deterministic scenario replay or video transcoding. Importing the package and installing with `--ignore-scripts` do not launch processes, download Chrome, or create a browser cache. There are no install lifecycle scripts, Cargo requirements, or package command-line binaries.
|
|
8
|
+
|
|
9
|
+
Managed targets are `linux-x64-gnu`, `linux-arm64-gnu`, `darwin-x64`, `darwin-arm64`, and `win32-x64`. Linux managed selection requires glibc >= 2.35 and rejects musl/Alpine; Windows arm64 and unknown combinations are rejected before downloads. GNU release artifacts are built on Ubuntu 22.04 and checked for GLIBC requirements no higher than 2.35. Arbitrary source-built or host-development binaries are not qualified by that result.
|
|
10
|
+
|
|
11
|
+
Both explicit server and Chrome paths are an expert override for managed platform checks, not a new support guarantee. Node.js support does not imply Bun, Deno, browser-side JavaScript, or drop-in Puppeteer compatibility. Packed npm consumption is verified; pnpm/Yarn and registry-backed publication remain separate gates.
|
|
12
|
+
|
|
13
|
+
## Managed launch and explicit preparation
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import { Browser, installBrowser } from "@cbxss/eoka";
|
|
17
|
+
|
|
18
|
+
await installBrowser({
|
|
19
|
+
browserCacheDir: "/opt/eoka/cache",
|
|
20
|
+
timeoutMs: 300000,
|
|
21
|
+
onProgress: ({ downloadedBytes, totalBytes, buildId }) => {
|
|
22
|
+
process.stderr.write(`${buildId}: ${downloadedBytes}/${totalBytes} bytes\n`);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const browser = await Browser.launch({
|
|
27
|
+
browserCacheDir: "/opt/eoka/cache",
|
|
28
|
+
download: "never",
|
|
29
|
+
sandbox: true,
|
|
30
|
+
timeoutMs: 30000,
|
|
31
|
+
});
|
|
32
|
+
try {
|
|
33
|
+
const page = await browser.newPage("data:text/html,%3Ctitle%3Eoffline%3C/title%3E");
|
|
34
|
+
console.log(await page.invoke("page.evaluate", { pageId: page.id, js: "document.title" }));
|
|
35
|
+
} finally {
|
|
36
|
+
await browser.close();
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`Browser.launch()` resolves its server **before** installing Chrome. Server precedence is `serverPath` > `EOKA_SERVER_BIN` > exact optional platform package. It never searches PATH, builds Rust, or downloads a server. Browser precedence is `executablePath` > `EOKA_CHROME_PATH` > the managed pin. There is no fallback to a system browser or a different build. `Browser.connect()` resolves/starts the server but does not install or access the managed Chrome cache.
|
|
41
|
+
|
|
42
|
+
`installBrowser` prepares only Chrome; it does not install system libraries or native server packages. Its options are `browserCacheDir`, `download` (`"auto"` by default or `"never"`), `signal`, `timeoutMs` (300000 ms by default), and `onProgress`. It returns `{ executablePath, cacheDir, buildId, platform, source }`, with `source: "cache"` or `"download"`. Cancellation/deadlines terminate the owned installer worker before cleaning its own staging resources. One launch deadline covers server resolution, Chrome installation, handshake, and native launch.
|
|
43
|
+
|
|
44
|
+
`onProgress` receives download byte counts without writing to stdout. Without a callback, the first actual download chunk emits one diagnostic to stderr; verified cache hits and imports remain silent.
|
|
45
|
+
|
|
46
|
+
## Cache, runtime, and offline operation
|
|
47
|
+
|
|
48
|
+
Cache root precedence is `browserCacheDir` > `EOKA_BROWSER_CACHE_DIR` > the per-user OS default:
|
|
49
|
+
|
|
50
|
+
| OS | Default cache root |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| Linux | `${XDG_CACHE_HOME}/eoka`, or `~/.cache/eoka` |
|
|
53
|
+
| macOS | `~/Library/Caches/eoka` |
|
|
54
|
+
| Windows | `${LOCALAPPDATA}/eoka/Cache`, or `~/AppData/Local/eoka/Cache` |
|
|
55
|
+
|
|
56
|
+
The installer keeps the complete distribution, including resources, libraries, and macOS bundle contents. It hashes the archive against the release pin, inventories the full installed tree, stages publication atomically, and coordinates concurrent installs per build. Cache validation detects missing/corrupt companion files as well as executable changes. Local writable inventory metadata is a same-user trust boundary, not protection against a malicious account that can replace both data and metadata.
|
|
57
|
+
|
|
58
|
+
Preinstall using the same platform/build and cache root as the eventual runtime. Preserve the **whole** cache entry and its metadata; copying just Chrome's executable is insufficient. A verified cache hit requires no network or writes, including on a read-only image. `download: "never"` fails with `BrowserNotInstalled` on an absent entry and does not repair corruption by downloading. Cache integrity failures are explicit. Default cache retention is persistent; `Browser.close()` never removes installed Chrome. Remove unused cache roots only as an explicit administrator action when no session is using them.
|
|
59
|
+
|
|
60
|
+
Runtime root precedence is `runtimeDir` > `EOKA_RUNTIME_DIR` > the OS temporary directory. Every launch gets a private child beneath that root. Child-only `TMPDIR`/`TMP`/`TEMP` direct native scratch work there without changing the Node process's environment. Keep runtime writable even when the browser cache is read-only. Owned child directories are cleaned only after owned-process termination is confirmed; uncertain termination retains the directory and reports its path through `RuntimeCleanupUncertain`. Caller roots, persistent `userDataDir` profiles, and the cache are not deleted. On POSIX keep the root short enough for Chrome's singleton Unix socket. Do not share persistent profiles concurrently; they contain cookies and other private session data.
|
|
61
|
+
|
|
62
|
+
From an installed SDK application, run the shipped examples directly:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
node node_modules/@cbxss/eoka/examples/install-browser.mjs /opt/eoka/cache
|
|
66
|
+
EOKA_RUNTIME_DIR=/tmp/eoka node node_modules/@cbxss/eoka/examples/offline.mjs /opt/eoka/cache
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The offline example uses a data URL, so its page also requires no network. `download: "never"` governs installation, not web page requests; use an OS/container network policy to prevent application traffic.
|
|
70
|
+
|
|
71
|
+
## Download pins, size, and proxy configuration
|
|
72
|
+
|
|
73
|
+
This source pins full Chrome for Testing **155.0.8059.39**, not ChromeDriver or a runtime-selected latest version. `releaseManifest` and `@cbxss/eoka/release-manifest.json` expose the release metadata. The archive SHA-256 values were computed from full HTTPS archives during controlled release preparation; they are reviewed integrity pins, **not vendor signatures**. Runtime installation uses those embedded pins and never looks up a hash or substitutes a mirror/build. Browser updates require a deliberate new release and fresh native gates.
|
|
74
|
+
|
|
75
|
+
Measured compressed archive sizes for this pin:
|
|
76
|
+
|
|
77
|
+
| Chrome platform | Bytes |
|
|
78
|
+
| --- | ---: |
|
|
79
|
+
| linux64 | 198195769 |
|
|
80
|
+
| linux-arm64 | 198202003 |
|
|
81
|
+
| mac-x64 | 203101743 |
|
|
82
|
+
| mac-arm64 | 192634606 |
|
|
83
|
+
| win64 | 207197429 |
|
|
84
|
+
|
|
85
|
+
Budget additional space for the expanded distribution, temporary archive/staging, and concurrent runtime profiles. The SDK does not download browser drivers.
|
|
86
|
+
|
|
87
|
+
The installer honors `HTTPS_PROXY`, `HTTP_PROXY`, `ALL_PROXY`, and `NO_PROXY` through its pinned proxy dependency. Configure them in the setup process environment, or in `serverEnv` for a launch-scoped child environment. Do not put proxy credentials in progress logs. Standard Node trust configuration such as `NODE_EXTRA_CA_CERTS` must be set before starting Node when an enterprise CA is required. TLS failures and hash mismatches fail closed; do not disable certificate verification.
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
HTTPS_PROXY=http://proxy.example:8080 NO_PROXY=localhost,127.0.0.1 \
|
|
91
|
+
node node_modules/@cbxss/eoka/examples/install-browser.mjs /opt/eoka/cache
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Linux libraries, sandbox, and containers
|
|
95
|
+
|
|
96
|
+
The SDK does not install privileged OS packages. Chrome requires its host libraries and fonts even in headless mode: NSS/NSPR, ATK/AT-SPI, CUPS, DRM/GBM, X11/XCB/Xcomposite/Xdamage/Xfixes/Xrandr, xkbcommon, ALSA, GLib, Cairo/Pango, and fonts. The native server's dependencies are artifact-specific; current Linux staging also needs OpenSSL 3 (`libssl.so.3` and `libcrypto.so.3`). Inspect actual release binaries and qualify the chosen distribution rather than treating this list as an ABI certification.
|
|
97
|
+
|
|
98
|
+
Sandboxing is enabled by default. Run as an unprivileged user with Chrome's sandbox requirements satisfied (including the host/container user-namespace and seccomp policy). A sandbox failure is an error; the SDK never retries with sandbox disabled. `sandbox: false` is an explicit security-reducing expert choice for a separately isolated environment, not the default container recipe.
|
|
99
|
+
|
|
100
|
+
Ubuntu 23.10+ can deny unprivileged user namespaces through AppArmor even when
|
|
101
|
+
Chrome itself is sandbox-enabled. An administrator must provide a narrowly
|
|
102
|
+
scoped executable-path policy for the owned Chrome runtime, as described in
|
|
103
|
+
[Chromium's AppArmor guidance](https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md).
|
|
104
|
+
Any process able to replace an executable at an allowed path gains that
|
|
105
|
+
permission; use a private runtime directory, not a broad `/tmp/**/chrome` rule.
|
|
106
|
+
The SDK neither installs privileged policies nor disables the host restriction.
|
|
107
|
+
ARM release CI uses a private per-job path exception, removes it afterward,
|
|
108
|
+
and checks Chrome's actual PID/network namespace and seccomp status.
|
|
109
|
+
|
|
110
|
+
For example, prepare a Linux x64 image with Node 24.21.0 and a distribution new enough for the **actual staged binary**. The following Debian trixie setup is a recipe to qualify, not a statement of completed container support. Supply the two locally staged tarballs described below as build inputs:
|
|
111
|
+
|
|
112
|
+
```dockerfile
|
|
113
|
+
FROM node:24.21.0-trixie
|
|
114
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
115
|
+
ca-certificates fonts-liberation libasound2t64 libatk-bridge2.0-0t64 libatk1.0-0t64 \
|
|
116
|
+
libcairo2 libcups2t64 libdbus-1-3 libdrm2 libgbm1 libglib2.0-0t64 libnspr4 \
|
|
117
|
+
libnss3 libpango-1.0-0 libssl3t64 libx11-6 libxcb1 libxcomposite1 libxdamage1 \
|
|
118
|
+
libxext6 libxfixes3 libxkbcommon0 libxrandr2 \
|
|
119
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
120
|
+
WORKDIR /app
|
|
121
|
+
RUN chown node:node /app
|
|
122
|
+
COPY --chown=node:node cbxss-eoka-0.1.0-beta.1.tgz cbxss-eoka-server-linux-x64-gnu-0.1.0-beta.1.tgz ./
|
|
123
|
+
USER node
|
|
124
|
+
RUN npm init -y && npm install --ignore-scripts --omit=optional --no-audit --no-fund \
|
|
125
|
+
./cbxss-eoka-server-linux-x64-gnu-0.1.0-beta.1.tgz ./cbxss-eoka-0.1.0-beta.1.tgz
|
|
126
|
+
ENV EOKA_BROWSER_CACHE_DIR=/app/browser-cache
|
|
127
|
+
ENV EOKA_RUNTIME_DIR=/tmp/eoka
|
|
128
|
+
RUN node node_modules/@cbxss/eoka/examples/install-browser.mjs
|
|
129
|
+
CMD ["node", "node_modules/@cbxss/eoka/examples/offline.mjs"]
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Network is needed during image preparation for npm dependencies and the pinned Chrome ZIP. Runtime can then be isolated with `docker run --init --network=none --read-only --tmpfs /tmp:rw,nosuid,size=1g IMAGE`, provided the host's sandbox policy permits Chrome. Use an init process to reap orphaned browser children. Preserve cache ownership/metadata in the image and keep `/tmp` writable. Adapt library names, resource limits, and sandbox policy to the deployment; never use an Alpine/musl base for managed mode.
|
|
133
|
+
|
|
134
|
+
## Build, source staging, and local consumption
|
|
135
|
+
|
|
136
|
+
This SDK and its five native packages share reserved npm version `0.1.0-beta.1`. The native server is pinned separately to `0.5.0`, published registry core to `0.7.0`, and the protocol to `1.3`; npm version equality is not wire compatibility. Release manifests accept exact semantic versions, including prereleases, but reject floating ranges, tags, and malformed versions. Packaged servers are checked against their name/version/platform, staged release metadata, actual binary digest, and expected handshake version. Explicit servers still must pass the protocol handshake.
|
|
137
|
+
|
|
138
|
+
The source manifest intentionally has no fabricated hashes for unprepared native artifacts. The source package omits native optional dependencies so a clean `npm ci` does not need unpublished packages. Staging derives all five exact native dependencies from the validated release manifest and adds them to the staged SDK's package metadata. Packing the source SDK alone is useful for import/type gates, but is **not** a ready managed server distribution. Missing native packages (including after `--omit=optional`) raise `ServerPackageMissing`; a present package with an unstaged SDK pin raises `ReleaseNotPrepared`. There is no compile/download fallback.
|
|
139
|
+
|
|
140
|
+
Run `mise install` at the repository root to install the pinned Node 24.21.0 toolchain. With mise activated, prepare local artifacts from this package directory without publishing:
|
|
141
|
+
|
|
142
|
+
```sh
|
|
143
|
+
npm ci --ignore-scripts --omit=optional
|
|
144
|
+
npm run build
|
|
145
|
+
npm run stage:release -- --artifacts /absolute/path/to/release-server-artifacts \
|
|
146
|
+
--output /absolute/path/to/new-stage --host-only
|
|
147
|
+
npm pack --ignore-scripts --pack-destination /absolute/path/to/tarballs \
|
|
148
|
+
/absolute/path/to/new-stage/platforms/linux-x64-gnu
|
|
149
|
+
npm pack --ignore-scripts --pack-destination /absolute/path/to/tarballs \
|
|
150
|
+
/absolute/path/to/new-stage/sdk
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Use the detected host ID in the platform path. `--host-only` is a local gate, not qualification of unbuilt targets: it marks the stage as development and embeds the Linux artifact's measured minimum glibc, which may exceed 2.35. Without that flag, staging requires all five target artifacts and rejects Linux binaries whose `readelf` GLIBC requirements exceed 2.35; repeated `--platform ID` selects specific preparation targets. Staging consumes existing server release binaries, computes their real digest/size, and writes matching SDK/platform metadata; it does not invoke Cargo or build alternate binaries. Use the same controlled artifacts as the server release and retain their provenance. Unstaged targets remain explicitly unavailable.
|
|
154
|
+
|
|
155
|
+
The artifact directory uses the existing server release asset names:
|
|
156
|
+
|
|
157
|
+
| Platform ID | Required server artifact |
|
|
158
|
+
| --- | --- |
|
|
159
|
+
| linux-x64-gnu | `eoka-server-linux-amd64` |
|
|
160
|
+
| linux-arm64-gnu | `eoka-server-linux-arm64` |
|
|
161
|
+
| darwin-x64 | `eoka-server-darwin-amd64` |
|
|
162
|
+
| darwin-arm64 | `eoka-server-darwin-arm64` |
|
|
163
|
+
| win32-x64 | `eoka-server-windows-amd64.exe` |
|
|
164
|
+
|
|
165
|
+
In a separate ESM application, install the matching native tarball as a direct dependency together with the staged SDK:
|
|
166
|
+
|
|
167
|
+
```sh
|
|
168
|
+
npm install --ignore-scripts --omit=optional \
|
|
169
|
+
/absolute/path/to/cbxss-eoka-server-linux-x64-gnu-0.1.0-beta.1.tgz \
|
|
170
|
+
/absolute/path/to/cbxss-eoka-0.1.0-beta.1.tgz
|
|
171
|
+
npm install --save-dev typescript@5.9.3 @types/node@24.19.2
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
The local direct dependency deliberately avoids relying on unpublished optional packages being available in a registry. A future qualified published release will install the exact matching optional package normally; do not omit it unless supplying an explicit server path. No publishing is performed or authorized by source staging.
|
|
175
|
+
|
|
176
|
+
Use `"type": "module"`, TypeScript `target: "ES2024"`, and `module`/`moduleResolution: "NodeNext"`. The root export supplies runtime SDK classes, installation APIs/errors, release/platform metadata, options, and common protocol types. `@cbxss/eoka/protocol` exposes the complete wire map. CommonJS consumers use dynamic `import()`. Runtime dependencies pin AJV `8.17.1`, `@puppeteer/browsers` `3.2.4`, `yauzl` `3.4.0`, and `proxy-agent` `8.0.1`; their engine requirements are compatible with the SDK's Node 24 LTS baseline.
|
|
177
|
+
|
|
178
|
+
## Explicit-path launch and verified receipts
|
|
179
|
+
|
|
180
|
+
```js
|
|
181
|
+
import { randomUUID } from "node:crypto";
|
|
182
|
+
import { Browser } from "@cbxss/eoka";
|
|
183
|
+
|
|
184
|
+
const browser = await Browser.launch({
|
|
185
|
+
serverPath: "/absolute/path/to/eoka-server",
|
|
186
|
+
executablePath: "/absolute/path/to/chrome",
|
|
187
|
+
headless: true,
|
|
188
|
+
sandbox: true,
|
|
189
|
+
viewport: { width: 1024, height: 768, deviceScaleFactor: 1 },
|
|
190
|
+
timeoutMs: 15000,
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
try {
|
|
194
|
+
const html = '<!doctype html><label>Name <input id="name"></label>';
|
|
195
|
+
const page = await browser.newPage(`data:text/html,${encodeURIComponent(html)}`);
|
|
196
|
+
const target = { query: { kind: "css", selector: "#name" } };
|
|
197
|
+
const operationId = randomUUID();
|
|
198
|
+
const receipt = await page.fill(target, "Ada", {
|
|
199
|
+
operationId,
|
|
200
|
+
timeoutMs: 10000,
|
|
201
|
+
actionOptions: {
|
|
202
|
+
expect: { kind: "value", target, value: "Ada" },
|
|
203
|
+
timeout_ms: 5000,
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
console.log({ operationId, receipt });
|
|
207
|
+
console.log(await page.invoke("page.evaluate", {
|
|
208
|
+
pageId: page.id,
|
|
209
|
+
js: '({name: document.querySelector("#name").value})',
|
|
210
|
+
}));
|
|
211
|
+
} finally {
|
|
212
|
+
await browser.close();
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
`fill`, `goto`, `select`, `hover`, and the other action conveniences resolve with an actual canonical `ActionReceipt` only after terminal verified completion. Admission is not completion. `click`, `type`, `pressKey`, `submit`, `drag`, and consequential actions passed to `perform` require an explicit `actionOptions.expect` before dispatch. Locator strings mean CSS selectors; generated `LocatorSpec` objects retain the canonical query/frame/index semantics.
|
|
217
|
+
|
|
218
|
+
`newPage(url)` and `goto(url)` verify a navigation commit, not DOM parsing or application readiness. Before parser-dependent reads, use `evaluate` to await `DOMContentLoaded` only while `document.readyState === "loading"`; resolve the promise to a JSON-compatible value such as `true`. `goto` accepts an explicit `actionOptions.expect` when navigation must also establish application readiness.
|
|
219
|
+
|
|
220
|
+
Run the included example after building:
|
|
221
|
+
|
|
222
|
+
```sh
|
|
223
|
+
npm run example -- /absolute/path/to/eoka-server /absolute/path/to/chrome
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Alternatively set `EOKA_SERVER_BIN` and `EOKA_CHROME_PATH`. Explicit options take precedence. Providing both paths bypasses managed installation/platform selection; no arbitrary system discovery is performed. `userDataDir` remains caller-owned. A temporary profile belongs to its owned session.
|
|
227
|
+
|
|
228
|
+
## Durable operations and uncertainty
|
|
229
|
+
|
|
230
|
+
```js
|
|
231
|
+
const operationId = randomUUID();
|
|
232
|
+
const operation = await page.perform(
|
|
233
|
+
{ kind: "fill", target, value: "Ada" },
|
|
234
|
+
{ operationId, actionOptions: { expect: { kind: "value", target, value: "Ada" } } },
|
|
235
|
+
);
|
|
236
|
+
const record = await operation.wait({ waitTimeoutMs: 1000, timeoutMs: 2000 });
|
|
237
|
+
console.log({ operationId, state: record.state, outcome: record.outcome, receipt: record.receipt });
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
`perform` returns an `Operation` after admission. `Operation.get`, `wait`, and `cancel` return canonical operation records. A bounded `wait` may return a still-running record; it does not assert success. `waitTimeoutMs` bounds the server wait, while `timeoutMs` and `signal` govern the local call. Cancellation is not rollback.
|
|
241
|
+
|
|
242
|
+
Get/cancel for an already-admitted operation remain responsive while an unrelated page request waits. Unknown IDs retain ordering behind earlier queued admissions. Operation lists are independent snapshots of currently admitted records, not barriers for queued mutations. These controls still obey the negotiated in-flight limit.
|
|
243
|
+
|
|
244
|
+
Persist a caller-known UUID before dispatch when recovery matters. After a lost response or local timeout, recover the same operation using `browser.operation(operationId).get()` or `page.operation(operationId).get()`. The operation must still exist in the same sidecar runtime; its ledger is not a restart-persistent store. Do not automatically replay an action with an unknown outcome.
|
|
245
|
+
|
|
246
|
+
```js
|
|
247
|
+
import { EokaError } from "@cbxss/eoka";
|
|
248
|
+
|
|
249
|
+
try {
|
|
250
|
+
await page.fill(target, "Ada", { operationId, timeoutMs: 1000 });
|
|
251
|
+
} catch (error) {
|
|
252
|
+
if (!(error instanceof EokaError)) throw error;
|
|
253
|
+
console.error({
|
|
254
|
+
code: error.code,
|
|
255
|
+
requestId: error.requestId,
|
|
256
|
+
operationId: error.operationId,
|
|
257
|
+
requestState: error.requestState,
|
|
258
|
+
receipt: error.receipt,
|
|
259
|
+
});
|
|
260
|
+
if (error.operationId) {
|
|
261
|
+
console.log(await browser.operation(error.operationId).get({ timeoutMs: 5000 }));
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
`EokaError` is the base for `ConfigurationError`, `InstallationError`, `TransportError`, `ProtocolError`, `ServerOperationError`, and `OperationError`. Installation errors expose stable codes including `UnsupportedPlatform`, `BrowserNotInstalled`, `IntegrityMismatch`, `InstallationFailed`, `InstallationAborted`, `InstallationTimeout`, `ServerPackageMissing`, `ServerPackageMismatch`, and `ReleaseNotPrepared`. Errors preserve available request/operation IDs, dispatch uncertainty, receipt, structured server data, stderr, and cause. `OperationError` also exposes the latest record. These fields are evidence, not a promise that dispatch was prevented. `ServerError` is a generated wire type, not the runtime exception class.
|
|
267
|
+
|
|
268
|
+
Stderr diagnostics retain bounded complete lines while redacting credentials, configured proxy secrets, and DevTools endpoint capability details. Truncated partial lines are discarded rather than exposed as potentially unredacted fragments.
|
|
269
|
+
|
|
270
|
+
When both an operation/lifecycle failure and its cleanup fail, the SDK reports an `AggregateError`. Its `cause` preserves the primary error (also `errors[0]`), including any `operationId`, request state, and receipt; inspect that cause when recovering an operation. The remaining `errors` preserve cleanup failures rather than replacing the original evidence.
|
|
271
|
+
|
|
272
|
+
## Typed reads and invocation
|
|
273
|
+
|
|
274
|
+
`Browser` and `Page` implement the generated `InvokeClient` contract:
|
|
275
|
+
|
|
276
|
+
```ts
|
|
277
|
+
import type { MethodResults } from "@cbxss/eoka";
|
|
278
|
+
import { protocolVersion } from "@cbxss/eoka/protocol";
|
|
279
|
+
|
|
280
|
+
const result: MethodResults["page.evaluate"] = await page.invoke(
|
|
281
|
+
"page.evaluate",
|
|
282
|
+
{ pageId: page.id, js: "({answer: 42, items: [1, null]})" },
|
|
283
|
+
{ timeoutMs: 5000 },
|
|
284
|
+
);
|
|
285
|
+
console.log(protocolVersion, result.result);
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
The method map is generated from the canonical sidecar schemas, including dynamic JSON evaluation results. Use `browser.supports(method)` and `browser.hasCapability(name)` to inspect the actual handshake rather than assuming every generated method is available on an older sidecar. `hello`, `sessionInfo`, `ownership`, and `browserVersion` expose negotiated/session metadata.
|
|
289
|
+
|
|
290
|
+
Page conveniences cover text/content/title/URL, element reads/waits, evaluation/execution, screenshots, viewport, browser state, and agent observation/steps. `page.fetch` is the legacy unbounded response API. Prefer `page.fetchBounded` for response-body reads: its default body budget is 8192 bytes and maximum is 1048576 bytes; inspect `truncated`, `bytesRead`, and `bodyOmitted` along with the body/status/headers. The `boundedFetch` capability indicates sidecar support. A bounded read is not the same as a complete response.
|
|
291
|
+
|
|
292
|
+
## Screenshots and native recording
|
|
293
|
+
|
|
294
|
+
```js
|
|
295
|
+
const image = await page.screenshot({
|
|
296
|
+
format: "webp",
|
|
297
|
+
quality: 80,
|
|
298
|
+
clip: { x: 0, y: 0, width: 640, height: 360 },
|
|
299
|
+
timeoutMs: 10000,
|
|
300
|
+
});
|
|
301
|
+
const screenshot = await page.screenshotToFile({
|
|
302
|
+
path: "./captures/page.png",
|
|
303
|
+
fullPage: true,
|
|
304
|
+
});
|
|
305
|
+
const recording = await page.record({
|
|
306
|
+
path: "./captures/session.mp4",
|
|
307
|
+
maxWidth: 1280,
|
|
308
|
+
maxHeight: 720,
|
|
309
|
+
fps: 30,
|
|
310
|
+
});
|
|
311
|
+
console.log(recording.id, await recording.status());
|
|
312
|
+
const video = await recording.stop({ timeoutMs: 60000 });
|
|
313
|
+
console.log(screenshot.path, screenshot.bytes, video.path, video.container);
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Create destination directories first. Relative paths resolve once in the Node caller, not in the sidecar's working directory. File output stages privately beside the destination, flushes/closes, and publishes without overwriting an existing file; there is no overwrite option. An `Artifact` contains `path`, `bytes`, and `mimeType`; completed videos also report `container: "mp4"`. No video Buffer/base64 API is offered.
|
|
317
|
+
|
|
318
|
+
Returned artifact paths are canonical and may use Windows' `\\?\` namespace
|
|
319
|
+
prefix. Compare filesystem identity, not the spelling of the requested path.
|
|
320
|
+
|
|
321
|
+
`screenshot()` returns a PNG Buffer by default and still accepts the original `{signal, timeoutMs}` call options. `format` supports `png`, `jpeg`, and `webp` where Chrome supports them. `quality` is an integer from 0 through 100 for JPEG/WebP and is invalid for PNG. `clip` uses nonnegative CSS-pixel positions and positive sizes. `fullPage` and `clip` are mutually exclusive. Viewport `deviceScaleFactor` is the only render-scale control. Full-page dimensions depend on current layout and Chrome's image limits; prefer a fixed viewport/crop for deterministic output. In-memory screenshots are bounded to 16 MiB raw bytes; `ScreenshotTooLarge` directs callers to `screenshotToFile`, with no automatic retry or fallback.
|
|
322
|
+
|
|
323
|
+
Direct file output bypasses the 16 MiB sidecar response limit, not Chrome's image limits or the core's 64 MiB CDP message/frame budget (which includes base64 encoding and JSON). It is not an unbounded streaming screenshot API.
|
|
324
|
+
|
|
325
|
+
Capture dispatch requires negotiated methods and capabilities: `screenshotOptions`, `screenshotFile`, and `nativeRecording`. Native recording additionally requires a ready active page and an encoder supported by the actual Chrome build. Unsupported recording raises `RecordingUnsupported`; the SDK never switches engines/browser versions. Video is silent native MP4 with Chrome-selected codec, not a promise of H.264. FFmpeg is not an SDK runtime dependency. `fps` is an integral ceiling from 1 through 120, not deterministic fixed-rate playback; optional `maxWidth`/`maxHeight` are positive integers no greater than 2147483647. Screenshot crops/quality are not recording options.
|
|
326
|
+
|
|
327
|
+
Chrome 155.0.8059.39 can emit duplicate MP4 decoding timestamps, including
|
|
328
|
+
zero-duration prefixes and terminal tails. The sidecar validates the fragmented
|
|
329
|
+
MP4 before publication and applies bounded, lossless timing corrections.
|
|
330
|
+
Within a fragment, a run of `k` explicit zero durations becomes `k` one-tick
|
|
331
|
+
durations; the following duration decreases by `k` and must remain positive.
|
|
332
|
+
The run endpoint and later timestamps remain unchanged. A duplicate final sample
|
|
333
|
+
starting a new fragment advances by one tick, with its duration reduced by one
|
|
334
|
+
tick and matching fragment decode/index times corrected.
|
|
335
|
+
Encoded packets, sample count, file length and the final presentation endpoint
|
|
336
|
+
are preserved; clean recordings stay byte-identical.
|
|
337
|
+
|
|
338
|
+
This changes container timing metadata, not the codec or encoded frames. It
|
|
339
|
+
requires neither a Chrome fork nor FFmpeg. Unsupported or malformed containers,
|
|
340
|
+
insufficient donor duration and unresolved cross-fragment timing collisions
|
|
341
|
+
fail finalization without publishing a success-named file. Validation/repair uses the original
|
|
342
|
+
staging descriptor under a five-second deadline; failure retains partial-file
|
|
343
|
+
evidence. The core Rust raw-stream primitive remains unmodified Chrome output.
|
|
344
|
+
Release checks require strictly increasing finalized packet DTS and semantically
|
|
345
|
+
verified diagnostics, not merely a successful decoder exit. The
|
|
346
|
+
[qualification policy](#prerelease-qualification-and-publication) distinguishes
|
|
347
|
+
proven frame-rate-estimation advisories from failures without retiming the video.
|
|
348
|
+
|
|
349
|
+
`page.record` generates a UUID before dispatch, or accepts a caller-provided `recordingId`. There is one active recorder per target. A repeated start with the same ID and equivalent parameters recovers the existing record; changed parameters conflict instead of restarting. After a lost response use the ID rather than starting another recorder:
|
|
350
|
+
|
|
351
|
+
```js
|
|
352
|
+
import { RecordingError } from "@cbxss/eoka";
|
|
353
|
+
|
|
354
|
+
try {
|
|
355
|
+
const recording = await page.record({ path: "./captures/session.mp4" });
|
|
356
|
+
await recording.stop();
|
|
357
|
+
} catch (error) {
|
|
358
|
+
if (!(error instanceof RecordingError)) throw error;
|
|
359
|
+
const recording = browser.recording(error.recordingId);
|
|
360
|
+
const record = await recording.status();
|
|
361
|
+
console.log(record.state, record.failure?.stage, record.failure?.partialPath);
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
Recovery is scoped to the live sidecar session, not crash resume. `Recording.status()` returns the current `RecordingRecord`; `.record` retains the latest observed evidence. States are `running`, `finalizing`, `completed`, `cancelled`, and `failed`. Unknown IDs fail explicitly. `stop()` shares server-side finalization and fulfills only with a completed, published native artifact. Repeated/concurrent stop calls do not stop Chrome twice. Each local waiter has its own signal/deadline; aborting or timing out a waiter does **not** cancel the recorder or finalizer. Recover status or wait again. `cancel()` explicitly releases capture/stream resources and returns a terminal record, including `completed` if publication won the race or `failed` if cleanup failed.
|
|
366
|
+
|
|
367
|
+
A sidecar retains at most 1,024 distinct recording IDs and 16 MiB of cumulative
|
|
368
|
+
UTF-8 `recordingId`, `pageId`, and resolved `path` bytes. The byte limit bounds
|
|
369
|
+
retained start parameters, not exact process memory. Completed, cancelled, and
|
|
370
|
+
failed records keep their capacity; IDs are never evicted or reused. At capacity,
|
|
371
|
+
new IDs fail with `ServerBusy` before recording or file staging starts. Existing
|
|
372
|
+
IDs still recover, and changed parameters still conflict. Start a new
|
|
373
|
+
`Browser`/sidecar session for fresh capacity; stopping or cancelling does not
|
|
374
|
+
reset history.
|
|
375
|
+
|
|
376
|
+
`RecordingError` preserves `recordingId`, `record`, `failure`, `path`, `partialPath`, and `cleanupUncertain`, plus the normal request state/ID, cause, server data, and stderr evidence. Failed/cancelled stop outcomes are errors, never completed artifacts. A retained partial file is not the destination success name. Closing a tab/browser cancels unfinished recordings by default; explicitly await stop to save first. Disconnect/target-loss outcomes preserve honest failure/cleanup uncertainty; closing a borrowed session never kills the borrowed browser.
|
|
377
|
+
|
|
378
|
+
Error-carried recording records receive the same identity, output-path and completed-artifact checks as successful responses. Inconsistent records raise `Protocol`, retain the rejected wire evidence, and do not replace a handle's known record. Valid later evidence for the same failed terminal recording may still add partial-file or publication details.
|
|
379
|
+
|
|
380
|
+
`examples/capture.mjs OUTPUT_DIRECTORY [BROWSER_CACHE_DIRECTORY]` captures a local animated scene using an installed managed Chrome. It writes fresh screenshots and a silent native MP4 without requiring network or an alternate recorder. Existing output names intentionally fail instead of being replaced.
|
|
381
|
+
|
|
382
|
+
## Connect and cleanup
|
|
383
|
+
|
|
384
|
+
```js
|
|
385
|
+
const browser = await Browser.connect({
|
|
386
|
+
serverPath: "/absolute/path/to/eoka-server",
|
|
387
|
+
browserWSEndpoint: "ws://127.0.0.1:9222/devtools/browser/your-browser-id",
|
|
388
|
+
});
|
|
389
|
+
try {
|
|
390
|
+
console.log(browser.ownership, await browser.tabs());
|
|
391
|
+
} finally {
|
|
392
|
+
await browser.close();
|
|
393
|
+
}
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
`connect` borrows Chrome; closing the SDK stops its owned sidecar and detaches without closing the borrowed browser. `launch` owns its Chrome session. `close()` is idempotent and must be awaited; async disposal is also supported. Pending local calls are rejected when closing starts. Teardown requests graceful shutdown, then waits within `shutdownTimeoutMs` (45000 ms by default) before terminating the SDK-owned process tree: a private process group on POSIX, or the owned PID tree on Windows. This escalation does not target a separately running borrowed Chrome process.
|
|
397
|
+
|
|
398
|
+
Cleanup failures remain errors. The normal owned-Chrome cleanup path is graceful shutdown/sidecar EOF. Forced termination reports cleanup uncertainty: it cannot guarantee removal of runtime files or termination of descendants that left the owned process group/tree. Caller-owned profiles are never an SDK installation cache.
|
|
399
|
+
|
|
400
|
+
If `newPage` was dispatched before a local abort/deadline, the SDK retains its native completion so it can close the exact late-created tab. If that response does not arrive within the bounded cleanup deadline, it closes the owned sidecar and reports `CleanupUncertain`; a borrowed Chrome may retain an unknown tab. That uncertainty is also retained in `Browser.close()` failures and is not evidence that the tab was removed.
|
|
401
|
+
|
|
402
|
+
## Development checks
|
|
403
|
+
|
|
404
|
+
```sh
|
|
405
|
+
npm run generate:check
|
|
406
|
+
npm run typecheck
|
|
407
|
+
npm test
|
|
408
|
+
npm run test:consumer
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
`build` emits JavaScript/declarations (including the installer worker), the pinned release manifest, canonical runtime schema bundle, and license; it does not regenerate protocol outputs. SDK source builds reject unused locals, unused parameters, and switch fallthrough. `typecheck` checks accepted/rejected fixtures and the public SDK consumer against compiled exports. The packed-consumer regression installs with `--ignore-scripts --omit=optional`, checks silent/no-side-effect imports and actionable missing-server errors, compiles the public API consumer, and runs it. The native capture fixture checks the published MP4's file size and container signature rather than accepting a nonempty artifact count.
|
|
412
|
+
|
|
413
|
+
For the real outside-repository managed/offline consumer gate, supply a prepared stage and an already verified host Chrome cache:
|
|
414
|
+
|
|
415
|
+
```sh
|
|
416
|
+
EOKA_RELEASE_STAGE_DIR=/absolute/path/to/new-stage \
|
|
417
|
+
EOKA_BROWSER_CACHE_DIR=/absolute/path/to/cache npm run test:consumer
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
Without both variables the staged native/browser test is skipped; import/type tests are not evidence of a native browser launch. The native test packs/installs only local staged SDK/platform tarballs and launches with `download: "never"`. It exercises PNG/JPEG/WebP, DPR/crop/full-page dimensions, equivalent Buffer/file images, existing-file protection, native MP4 stop/recovery/repeated stop, and explicit cancel with no success-named partial. A deterministic 2500×2500 RGB-noise scene verifies that screenshots larger than 16 MiB raise `ScreenshotTooLarge` with direct-file guidance, remain usable through `screenshotToFile`, and do not disconnect the page. Container decoding/observed codec and duration require the separate ffprobe/ffmpeg release smoke; those tools are not SDK runtime dependencies. Actual no-network enforcement, sandbox, container, and all-platform qualification remain separate release gates.
|
|
421
|
+
|
|
422
|
+
From the repository root use `mise run node-build`, `node-check`, or `node-consumer`; `node-stage-release -- --artifacts DIR --output NEWDIR --host-only`, `node-install-browser -- CACHE`, and `node-offline -- CACHE` expose the preparation/offline workflows. `npm run example:schema` retains the generated-schema example.
|
|
423
|
+
|
|
424
|
+
`mise.toml` pins the development and CI runtime to Node 24.21.0; CI reads that configuration rather than maintaining another Node version. Node types are pinned to `@types/node` 24.19.2. SDK and consumer fixtures target ES2024. Native-package staging inherits the SDK's `engines` field. The Node CI job checks the committed schema projection, accepted/rejected consumers, runtime regressions, and packed imports without requiring Rust or Chrome; the full local `node-check` additionally checks the schema against the Rust exporter. Native gates still require the explicit environment above.
|
|
425
|
+
|
|
426
|
+
## Prerelease qualification and publication
|
|
427
|
+
|
|
428
|
+
Core `0.7.0` is published on crates.io. Reserved prerelease versions are
|
|
429
|
+
server/protocol crates `0.5.0`, wire protocol `1.3`, and SDK/native npm packages
|
|
430
|
+
`0.1.0-beta.1`. Source and ordinary staged packages remain private;
|
|
431
|
+
`--publication` is a separate, fail-closed staging mode.
|
|
432
|
+
|
|
433
|
+
`.github/workflows/qualify-node-release.yml` builds all five native targets and
|
|
434
|
+
qualifies installed tarballs outside the repository. GNU builds use Ubuntu 22.04
|
|
435
|
+
and enforce glibc ≤2.35; runtime checks use non-root hosted runners with Chrome's
|
|
436
|
+
sandbox enabled. Evidence includes fresh/cache/offline installation, artifact
|
|
437
|
+
rejection, verified input, image dimensions, finalized MP4 packet timestamps and
|
|
438
|
+
decode diagnostics, headed launch, owned cleanup, and borrowed-browser survival.
|
|
439
|
+
Failures retain recordings and diagnostics as workflow artifacts. FFmpeg/ffprobe
|
|
440
|
+
are qualification tools, not consumer dependencies.
|
|
441
|
+
|
|
442
|
+
The [lossless-repair preview](https://github.com/shrimp-software/eoka-tools/actions/runs/38612635401)
|
|
443
|
+
at tools `70b47e0ff27b271407c3073f5c1a389d87a5fd0a` and core
|
|
444
|
+
`9bae96b9cefa02794a4058ae54b67273ad453490` completed every runtime check on
|
|
445
|
+
Ubuntu 22.04 x64, Ubuntu 24.04 ARM64, macOS 15 x64/ARM64, and Windows 2025 x64.
|
|
446
|
+
All 50 one-attempt finalized recordings passed strict packet DTS and empty
|
|
447
|
+
decoder diagnostics; all 28 deterministic repair regressions passed on each
|
|
448
|
+
architecture. Image, sandbox, headed-launch and ownership checks also passed.
|
|
449
|
+
Those jobs ended **blocked** solely by the then-closed source readiness record.
|
|
450
|
+
The recording blocker is now cleared using that native evidence plus retained
|
|
451
|
+
defective-file repair/preservation proof, not passing live samples alone.
|
|
452
|
+
Registry-backed qualification and npm publication prerequisites remain separate.
|
|
453
|
+
Live recording still does not promise fixed-cadence export.
|
|
454
|
+
|
|
455
|
+
For local host-development evidence, not release qualification:
|
|
456
|
+
|
|
457
|
+
```sh
|
|
458
|
+
mise run node-qualify-release -- --stage /absolute/stage \
|
|
459
|
+
--cache /absolute/cache --output /absolute/evidence --preview
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
The workflow resolves `source_ref` to an immutable tools revision and builds
|
|
463
|
+
against published registry core `0.7.0`, without a sibling checkout or Cargo
|
|
464
|
+
patch. It checks every native build's core identity and exact source lockfile,
|
|
465
|
+
including registry checksum
|
|
466
|
+
`447a498ec28c34b2020be583617c70f89dc718228bb02db5750f72e4da333a1e`.
|
|
467
|
+
Local host-development staging and `--preview` remain separate from release
|
|
468
|
+
qualification and cannot authorize publication.
|
|
469
|
+
|
|
470
|
+
`scripts/publication-readiness.json` records unresolved release defects. Clearing
|
|
471
|
+
a recording blocker requires deterministic repair/preservation regressions and
|
|
472
|
+
fresh five-platform qualification, not passing samples alone. Every Chrome pin
|
|
473
|
+
update must pass the complete recording suite on each architecture and ten
|
|
474
|
+
single-attempt native captures: four short/default-rate clips, two short
|
|
475
|
+
120-fps clips, one 1-fps clip, two two-second clips, and one multi-fragment clip.
|
|
476
|
+
Both artifact collection and publication independently require the actual running
|
|
477
|
+
Chrome version to match the pin, the complete schedule, published MP4 records,
|
|
478
|
+
strictly increasing packet DTS, and successful full decoding. A `passed` summary
|
|
479
|
+
alone is insufficient. One known FFmpeg MOV input-rate-estimation diagnostic may
|
|
480
|
+
be retained as a VFR advisory only when its adjacent packet indices and exact
|
|
481
|
+
timestamps match the probe and the declared positive packet duration exactly
|
|
482
|
+
reaches the next timestamp. Missing or inexact timing evidence, unknown
|
|
483
|
+
diagnostics, and nonzero decoder exits remain fatal. Raw probe/decoder logs are
|
|
484
|
+
preserved, and collection/publication independently recompute advisory
|
|
485
|
+
classifications; labels alone cannot authorize release. Probe logging includes
|
|
486
|
+
warnings. There is no retry-to-pass, hidden warning filtering, or retiming to
|
|
487
|
+
satisfy a frame-rate heuristic. The private MP4 correction remains limited to
|
|
488
|
+
the documented native timing defects; changing Chrome's container layout requires
|
|
489
|
+
renewed qualification, not an implicit generic muxer or transcoder.
|
|
490
|
+
|
|
491
|
+
`publish-node.yml` is manual, restricted to an exact current protected `main`
|
|
492
|
+
commit, and publishes only `0.1.0-beta.1` under `next` with npm provenance.
|
|
493
|
+
It requires an existing `npm-prerelease` environment with required reviewers
|
|
494
|
+
and a single allowed deployment branch, `main`. By default it uses only npm
|
|
495
|
+
trusted publishing through OIDC, requires self-review to be disabled, and
|
|
496
|
+
requires all six scoped package names to exist with trusted publishers configured
|
|
497
|
+
for this repository, workflow, and environment. There is no automatic token fallback.
|
|
498
|
+
|
|
499
|
+
For the first release, explicitly dispatch with `bootstrap: true` and an
|
|
500
|
+
environment-scoped `NPM_BOOTSTRAP_TOKEN` secret. Use a short-lived npm granular
|
|
501
|
+
token authorized to create and publish these scoped packages, with the permissions
|
|
502
|
+
required for unattended publication under the account's 2FA policy. Never commit
|
|
503
|
+
the token or pass it as a workflow input. Bootstrap still requires environment
|
|
504
|
+
reviewer approval, but permits the owner to approve their own deployment; this
|
|
505
|
+
exception does not apply to normal OIDC publication.
|
|
506
|
+
|
|
507
|
+
Only the bootstrap publish step receives the token. Its temporary private npm
|
|
508
|
+
configuration contains an environment-variable reference, not the token value.
|
|
509
|
+
Package verification and the final registry installation remain credential-free.
|
|
510
|
+
Bootstrap accepts an absent name only when both public and authenticated registry
|
|
511
|
+
reads return 404; an existing private package or an authorization failure aborts.
|
|
512
|
+
Both modes retain GitHub OIDC provenance and the same qualification checks.
|
|
513
|
+
|
|
514
|
+
After the first successful release, configure npm trusted publishers for all six
|
|
515
|
+
packages, remove the bootstrap environment secret, revoke its npm token, and
|
|
516
|
+
restore `prevent_self_review: true` with an independent environment reviewer before
|
|
517
|
+
using normal publication. A bootstrap rerun after a partial upload still needs
|
|
518
|
+
the token and must follow the same-run recovery procedure below.
|
|
519
|
+
|
|
520
|
+
The publish job accepts only same-run, same-source qualified artifacts and
|
|
521
|
+
preflights all six registry versions before writing anything. Existing versions
|
|
522
|
+
are skipped only when their SHA-512 integrity matches the qualified tarball,
|
|
523
|
+
`next` already points at that version, npm registry signatures verify, and
|
|
524
|
+
keyless Sigstore provenance binds the exact artifact, source commit, protected
|
|
525
|
+
main workflow, manual event, and original workflow run. The pinned public Sigstore
|
|
526
|
+
verifier is release-tooling-only, not an SDK runtime dependency. Registry signature
|
|
527
|
+
checks use isolated installs with lifecycle scripts disabled; foreign-platform
|
|
528
|
+
packages are installed only for verification, never executed.
|
|
529
|
+
|
|
530
|
+
After a partial publication or lost publish response, rerun the failed jobs of
|
|
531
|
+
the **same workflow run**, retaining its qualified artifacts and unchanged current
|
|
532
|
+
`main` source. Verified existing uploads are preserved; only missing native
|
|
533
|
+
packages are published, followed by the SDK. Mismatched integrity, provenance,
|
|
534
|
+
tags, source, or unavailable registry evidence abort before any new upload.
|
|
535
|
+
There is no automatic publish retry or retagging. If source or artifacts changed,
|
|
536
|
+
do not bypass these checks: use a separately reviewed roll-forward release.
|
|
537
|
+
The final smoke checks a credential-free registry installation and provenance.
|
|
538
|
+
|
|
539
|
+
No tag, merge, or publication is part of PR preparation. Existing Rust publishing
|
|
540
|
+
workflows trigger on `main`; merging the version changes is a release action.
|
package/dist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shrimp Software
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sanitizeInstallationDiagnostic(message: string, env: NodeJS.ProcessEnv): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function sanitizeInstallationDiagnostic(message, env) {
|
|
2
|
+
for (const [key, value] of Object.entries(env)) {
|
|
3
|
+
if (!/proxy/i.test(key) || !value)
|
|
4
|
+
continue;
|
|
5
|
+
message = message.replaceAll(value, '[redacted proxy]');
|
|
6
|
+
try {
|
|
7
|
+
const proxy = new URL(value);
|
|
8
|
+
if (proxy.username || proxy.password) {
|
|
9
|
+
const username = decodeURIComponent(proxy.username);
|
|
10
|
+
const password = decodeURIComponent(proxy.password);
|
|
11
|
+
const credentials = [proxy.username, proxy.password, username, password, Buffer.from(`${username}:${password}`).toString('base64')];
|
|
12
|
+
for (const credential of credentials) {
|
|
13
|
+
if (credential)
|
|
14
|
+
message = message.replaceAll(credential, '[redacted]');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
catch { }
|
|
19
|
+
}
|
|
20
|
+
return message.replace(/(https?:\/\/)[^/\s@]+@/gi, '$1[redacted]@');
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChromePlatformRelease } from './release.js';
|
|
2
|
+
import type { PlatformId } from './platform.js';
|
|
3
|
+
import type { BrowserInstallation, InstallBrowserOptions } from './browser-install.js';
|
|
4
|
+
export interface InstallerRelease {
|
|
5
|
+
platform: PlatformId;
|
|
6
|
+
buildId: string;
|
|
7
|
+
pin: ChromePlatformRelease;
|
|
8
|
+
}
|
|
9
|
+
export declare function browserCacheDirectory(options: InstallBrowserOptions): string;
|
|
10
|
+
export declare function createBrowserInstaller(release: InstallerRelease): (options?: InstallBrowserOptions) => Promise<BrowserInstallation>;
|