diff --git a/.codex/skills/release/SKILL.md b/.codex/skills/release/SKILL.md index 495a671..c7c1e59 100644 --- a/.codex/skills/release/SKILL.md +++ b/.codex/skills/release/SKILL.md @@ -6,7 +6,7 @@ description: Build, package and release anonymous-browser, or update its deploym # Package and release 1. Use Node 22, run `npm ci` and `npm run build`. -2. Run `npm pack` and inspect its file list. Install the tarball into a temporary consumer. Check CommonJS and ESM imports, HumanJS's pinned Patchright resolution and `ffmpeg-static` installation. +2. Run `npm pack` and inspect its file list. Install the tarball into a temporary consumer. Check CommonJS and ESM imports, compile temporary consumers with strict NodeNext settings, and verify HumanJS's pinned Patchright resolution and `ffmpeg-static` installation. 3. Build the Dockerfile on Linux amd64. Use temporary local diagnostic pages for browser validation; do not add tests unless requested. Do not use real posting, voting or private accounts as public fixtures. 4. Keep README, examples and this skill aligned when lifecycle, releases or deployment behavior changes. Keep credentials and raw profile diagnostics outside this public repository. 5. Bump package.json and package-lock.json together. Commit the reviewed change, then push a matching `vX.Y.Z` tag. The CI workflow builds and checks the installable tarball and Docker image before creating the GitHub release with SHA-256 checksums. No npm token is needed. @@ -15,3 +15,5 @@ description: Build, package and release anonymous-browser, or update its deploym Consumers pin the release tarball URL and commit their npm lockfile. Use runtime secrets for GoLogin credentials. Compartment owns the consuming application; this package does not deploy itself or provide a remote browser server. Consumer rollouts follow the consuming repository's deployment procedure. The GoLogin/Patchright/HumanJS versions are deliberately pinned. Review the postinstall patch before upgrades. Never run an automatic major dependency upgrade to suppress audit findings. Keep compatibility limitations and validation evidence current in README. + +For GoLogin 3.0.4 / Patchright 1.63.0, retain the restored-session assignment, request-interception promise patch, safe Orbita downloader and owned-process shutdown. The SDK still ignores `restoreLastSession: false` in constructor options and does not wait for process exit when saving. Keep GoLogin types out of public declarations: its published declarations currently contain invalid imports. Recheck these facts before removing workarounds during a future upgrade. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ab2de8..599659c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: const humanRequire = createRequire(packageRequire.resolve('@humanjs/playwright/package.json')); const driver = humanRequire('playwright/package.json'); assert.equal(driver.name, 'patchright'); - assert.equal(driver.version, '1.62.3'); + assert.equal(driver.version, packageRequire('./package.json').dependencies.patchright); assert.equal(packageRequire('patchright').chromium, humanRequire('playwright').chromium); assert(fs.existsSync(humanRequire('ffmpeg-static'))); NODE diff --git a/README.md b/README.md index 740ffa3..9e3c6e5 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,12 @@ A TypeScript library for GoLogin profiles controlled through Patchright, with Hu Requires Node.js 22 or later. Linux amd64 is the container target; macOS is available for local development. Automatic Orbita preparation supports Linux and macOS. ```sh -npm install --save-exact https://github.com/lugovsky/anonymous-browser/releases/download/v0.1.0/lugovsky-anonymous-browser-0.1.0.tgz +npm install --save-exact https://github.com/lugovsky/anonymous-browser/releases/download/v0.2.0/lugovsky-anonymous-browser-0.2.0.tgz ``` Commit your application's `package-lock.json`. GitHub release assets are publicly downloadable without npm or GitHub credentials. This package is distributed as an npm-compatible tarball; it is not published to the npm registry. -Installation runs a version-guarded Patchright patch and HumanJS installs `ffmpeg-static`, which downloads a platform-specific binary. Do not disable installation scripts. If your application already depends on `playwright`, set it to `npm:patchright@1.62.3` so HumanJS resolves the same driver. The installer checks this condition. +Installation runs a version-guarded Patchright patch and HumanJS installs `ffmpeg-static`, which downloads a platform-specific binary. Do not disable installation scripts. If your application already depends on `playwright`, set it to `npm:patchright@1.63.0` so HumanJS resolves the same driver. The installer checks this condition. ## Use @@ -68,7 +68,7 @@ Session options: - Downloads GoLogin's Orbita to `~/.gologin/browser` and reuses the cached version. `prepareOrbita()` can warm this cache. No separate Playwright browser distribution is installed. - Attaches with `noDefaults: true`, `isLocal: true` and a 30-second CDP deadline. Uses the existing default context without setting a viewport or replacing the profile's fingerprint or proxy. - Keeps the established container flags: `--no-sandbox`, `--disable-setuid-sandbox`, `--disable-dev-shm-usage`, `--disable-gpu`, plus `--headless=new` when headless. Extra flags can change browser behavior; keep them consistent across consumers. -- Disables restored tabs for unattended headless sessions. GoLogin 2.2.8 ignores a constructor option of `false`, so the wrapper sets the instance property before launch. +- Disables restored tabs for unattended headless sessions. GoLogin 3.0.4 still ignores a constructor option of `false`, so the wrapper sets the instance property before launch. - Closes task pages, sends browser-level CDP `Browser.close`, and waits five seconds for the owned process. If needed, signals only that child with SIGTERM and then SIGKILL, allowing five seconds each. - Restores saved window placement and calls GoLogin's profile-saving `stop()` only after process exit. If the process remains alive, skips profile saving and file removal. Driver disconnection is attempted in final cleanup. - Retries a connection failure once only after successful failed-launch cleanup. Never retries application operations. @@ -105,11 +105,11 @@ This is an in-process library. It does not expose a remote browser-control serve ## Compatibility and releases -The initial compatibility baseline is GoLogin `2.2.8`, Patchright `1.62.3`, HumanJS Playwright `0.11.0`, with `playwright` aliased to `npm:patchright@1.62.3`. Patchright does not officially support GoLogin; this is a maintained integration, not a guarantee of anonymity or undetectability. The pinned GoLogin dependency tree includes npm audit advisories; dependency upgrades need separate compatibility review. +The current compatibility baseline is GoLogin `3.0.4`, Patchright `1.63.0`, HumanJS Playwright `0.11.0`, with `playwright` aliased to `npm:patchright@1.63.0`. Patchright does not officially support GoLogin; this is a maintained integration, not a guarantee of anonymity or undetectability. The pinned GoLogin dependency tree includes npm audit advisories; dependency upgrades need separate compatibility review. The postinstall patch joins Patchright's request-interception initialization promise to page initialization. This prevents a closed CDP session from producing an unhandled rejection during startup. It does not repair an unresponsive restored tab. Version and source checks deliberately fail when an upgrade needs review. -CI compiles the package, installs its tarball in a fresh consumer, checks CommonJS/ESM imports and driver resolution, and builds the Linux Docker image. See [initial validation](docs/validation.md) for the Linux browser diagnostic and its limits. Browser/profile compatibility requires separate diagnostics with disposable profiles; CI does not contain GoLogin credentials or run live website actions. +CI compiles the package, installs its tarball in a fresh consumer, checks CommonJS/ESM imports and driver resolution, and builds the Linux Docker image. See [release validation](docs/validation.md) for the Linux browser diagnostic and its limits. Browser/profile compatibility requires separate diagnostics with disposable profiles; CI does not contain GoLogin credentials or run live website actions. To release, update the package and lockfile version, commit and push, then push the matching `vX.Y.Z` tag. The [workflow](.github/workflows/ci.yml) waits for package and container checks and creates a public GitHub release containing the tarball and `SHA256SUMS`. Consumers upgrade by changing their pinned URL and lockfile through their normal review/deployment flow. Roll back by restoring the previous dependency version. diff --git a/THIRD_PARTY.md b/THIRD_PARTY.md index 8a0bf3f..7380af4 100644 --- a/THIRD_PARTY.md +++ b/THIRD_PARTY.md @@ -2,8 +2,8 @@ This package's source is MIT licensed. Dependencies retain their own licenses: -- GoLogin Node SDK 2.2.8: GPL-3.0. -- Patchright 1.62.3, derived from Playwright: Apache-2.0. +- GoLogin Node SDK 3.0.4: GPL-3.0. +- Patchright 1.63.0, derived from Playwright: Apache-2.0. - HumanJS Playwright 0.11.0 and HumanJS Core: MIT. - `ffmpeg-static`, installed by HumanJS: GPL-3.0-or-later; downloaded FFmpeg binaries have their own build-specific licensing. See that dependency's documentation before redistributing binaries. - Orbita is downloaded from GoLogin separately at runtime and remains subject to GoLogin's terms. It is not included in the release tarball. diff --git a/docs/validation.md b/docs/validation.md index 692f09a..2faf555 100644 --- a/docs/validation.md +++ b/docs/validation.md @@ -1,4 +1,22 @@ -# Initial release validation +# Release validation + +## v0.2.0 — dependency upgrade + +Validated on 2026-09-09 with Node 22.23.2, Linux amd64, Orbita 151, GoLogin 3.0.4, Patchright 1.63.0 and HumanJS Playwright 0.11.0. These were the latest npm releases of the three libraries at validation time. + +- Compilation, packed-package CommonJS/ESM imports and HumanJS's Patchright driver identity passed. Fresh TypeScript consumers compiled with strict NodeNext settings without `skipLibCheck`. +- The Docker build, Linux runtime imports and FFmpeg executable passed. +- The local browser diagnostic retained the existing default context, null viewport override and sampled fingerprint values from v0.1.0. Offscreen shadow-DOM clearing, accented multiline typing, emoji paste and PNG capture passed. +- Owned-process shutdown completed before SDK cleanup; operation results were preserved and repeated closure remained idempotent. +- A forced CDP initialization timeout retried once and failed with `BrowserLaunchError`, with zero unhandled rejections and clean process exit. The same diagnostic using unpatched Patchright 1.63.0 produced two unhandled request-interception rejections. The startup patch remains necessary. +- A disposable GoLogin profile completed a real save/restart cycle. A locally intercepted page wrote a persistent cookie and local storage; both were present after profile upload and a fresh launch. Both shutdowns completed before SDK saving, and the disposable profile was deleted. No live website actions were performed. +- GoLogin's `restoreLastSession: false` constructor option still evaluated to `true`. Its built-in archive extractor failed against a temporary cache path containing spaces. Retain the instance assignment and safe downloader. + +Removed the ambient GoLogin declaration shim and duplicate constructor definition. Constructor options now use the SDK declarations. A small internal lifecycle interface remains because the SDK omits process-ownership fields and its published declarations contain invalid imports; those declarations do not leak into this package's consumer types. + +The dependency tree decreased by 37 installed packages, including removal of `request` and `requestretry`. npm audit findings fell from 34 to 28 (2 low, 16 moderate, 8 high, 2 critical). The remaining advisories require separate dependency remediation. Headed mode, ARM execution and application-specific workflows are outside this upgrade's diagnostics. + +## v0.1.0 validation Validated on 2026-09-09 with Node 22.23.2, Linux amd64, Orbita 151, GoLogin 2.2.8, Patchright 1.62.3 and HumanJS Playwright 0.11.0. diff --git a/package-lock.json b/package-lock.json index b8faeab..da30a8b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,19 @@ { "name": "@lugovsky/anonymous-browser", - "version": "0.1.0", + "version": "0.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@lugovsky/anonymous-browser", - "version": "0.1.0", + "version": "0.2.0", "hasInstallScript": true, "license": "MIT", "dependencies": { "@humanjs/playwright": "0.11.0", - "gologin": "2.2.8", - "patchright": "1.62.3", - "playwright": "npm:patchright@1.62.3" + "gologin": "3.0.4", + "patchright": "1.63.0", + "playwright": "npm:patchright@1.63.0" }, "devDependencies": { "@types/node": "^22.19.0", @@ -915,22 +915,6 @@ "node": ">=8" } }, - "node_modules/ajv": { - "version": "6.15.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", - "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -1032,24 +1016,6 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, - "node_modules/asn1": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", - "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", - "license": "MIT", - "dependencies": { - "safer-buffer": "~2.1.0" - } - }, - "node_modules/assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", - "license": "MIT", - "engines": { - "node": ">=0.8" - } - }, "node_modules/async": { "version": "2.6.4", "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", @@ -1086,21 +1052,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, - "node_modules/aws4": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.13.2.tgz", - "integrity": "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw==", - "license": "MIT" - }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -1127,15 +1078,6 @@ ], "license": "MIT" }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", - "license": "BSD-3-Clause", - "dependencies": { - "tweetnacl": "^0.14.3" - } - }, "node_modules/bindings": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", @@ -1482,18 +1424,6 @@ "node": ">= 6.9.0" } }, - "node_modules/dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0" - }, - "engines": { - "node": ">=0.10" - } - }, "node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", @@ -1745,16 +1675,6 @@ "node": ">= 0.4" } }, - "node_modules/ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", - "license": "MIT", - "dependencies": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -1851,12 +1771,6 @@ "node": ">=6" } }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "license": "MIT" - }, "node_modules/extract-zip": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz", @@ -1932,27 +1846,6 @@ "safe-buffer": "~5.1.0" } }, - "node_modules/extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", - "engines": [ - "node >=0.6.0" - ], - "license": "MIT" - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "license": "MIT" - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "license": "MIT" - }, "node_modules/fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", @@ -2008,15 +1901,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, "node_modules/form-data": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.5.tgz", @@ -2063,20 +1947,6 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "license": "ISC" }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -2157,15 +2027,6 @@ "node": ">=0.10.0" } }, - "node_modules/getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0" - } - }, "node_modules/github-from-package": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", @@ -2216,9 +2077,9 @@ } }, "node_modules/gologin": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/gologin/-/gologin-2.2.8.tgz", - "integrity": "sha512-vLOYq3RxLyewh7C5SuheIWPonfJwrVaDJmjkcrlXuMtbK5rTKpkhqTF1gLOxAqnRWdGlmlKHglX6XIlrb9zUyQ==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/gologin/-/gologin-3.0.4.tgz", + "integrity": "sha512-0KbFwt1GZY+vfQbVWE9+Nv+ZV9Qy9WYl7lZamEsU/Xiv/2LxlWIOuyDjzGanOJ7gteTsVp81IpbxrM8Utvwj3g==", "license": "GPL-3.0", "dependencies": { "@sentry/node": "^9.24.0", @@ -2228,10 +2089,9 @@ "decompress": "^4.2.1", "decompress-unzip": "^4.0.1", "form-data": "^3.0.0", + "https-proxy-agent": "^7.0.6", "progress": "^2.0.3", "puppeteer-core": "^2.1.1", - "request": "^2.88.2", - "requestretry": "^4.1.0", "rimraf": "^3.0.2", "socks-proxy-agent": "^8.0.3", "sqlite": "^4.0.23", @@ -2241,6 +2101,28 @@ "node": ">=20.0.0" } }, + "node_modules/gologin/node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/gologin/node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/gopd": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", @@ -2259,29 +2141,6 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "license": "ISC" }, - "node_modules/har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", - "license": "ISC", - "engines": { - "node": ">=4" - } - }, - "node_modules/har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "deprecated": "this library is no longer supported", - "license": "MIT", - "dependencies": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/has-property-descriptors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", @@ -2377,21 +2236,6 @@ "integrity": "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==", "license": "MIT" }, - "node_modules/http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - }, - "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" - } - }, "node_modules/https-proxy-agent": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", @@ -2593,12 +2437,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", - "license": "MIT" - }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -2612,51 +2450,6 @@ "license": "ISC", "optional": true }, - "node_modules/isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", - "license": "MIT" - }, - "node_modules/jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", - "license": "MIT" - }, - "node_modules/json-schema": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", - "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", - "license": "(AFL-2.1 OR BSD-3-Clause)" - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "license": "MIT" - }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", - "license": "ISC" - }, - "node_modules/jsprim": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", - "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", - "license": "MIT", - "dependencies": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.4.0", - "verror": "1.10.0" - }, - "engines": { - "node": ">=0.6.0" - } - }, "node_modules/lazystream": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz", @@ -3116,15 +2909,6 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, - "node_modules/oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -3165,27 +2949,24 @@ "integrity": "sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==" }, "node_modules/patchright": { - "version": "1.62.3", - "resolved": "https://registry.npmjs.org/patchright/-/patchright-1.62.3.tgz", - "integrity": "sha512-TMpWzcZVWUmOe1251PHWpk0gTP2d7+mvS00h1CLL2IQAUKX7UexKfPqEjdKkH8F2TT5AlyrSbwZKr5lu1dThAQ==", + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/patchright/-/patchright-1.63.0.tgz", + "integrity": "sha512-WVXhmNhAJ5I+CmcHEu/I3KMKhOlQaKS1XJsk+5nRIypKJ3Dq9IaQP29p4vB3I1FWCTarUXVRj02Na30wGcuztQ==", "license": "Apache-2.0", "dependencies": { - "patchright-core": "1.62.3" + "patchright-core": "1.63.0" }, "bin": { "patchright": "cli.js" }, "engines": { "node": ">=20" - }, - "optionalDependencies": { - "fsevents": "2.3.2" } }, "node_modules/patchright-core": { - "version": "1.62.3", - "resolved": "https://registry.npmjs.org/patchright-core/-/patchright-core-1.62.3.tgz", - "integrity": "sha512-RQf0M2THMf4TL9HNNUxdYbd4Oe3DOVPni6G/bJYsEpD9F1cgqEpWiTJIh+pfuK9JwGRo4Du6lzagJosMUXbh/Q==", + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/patchright-core/-/patchright-core-1.63.0.tgz", + "integrity": "sha512-nuRJVTMVKoOFzY8vmwFqJZR3F0trUCKiPzDSgCOPq/yHHTefm9czILV23dXJsi5mvS7sCy7U1CqG7edA/21DtQ==", "license": "Apache-2.0", "bin": { "patchright-core": "cli.js" @@ -3215,12 +2996,6 @@ "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", "license": "MIT" }, - "node_modules/performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", - "license": "MIT" - }, "node_modules/pg-int8": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", @@ -3284,21 +3059,18 @@ }, "node_modules/playwright": { "name": "patchright", - "version": "1.62.3", - "resolved": "https://registry.npmjs.org/patchright/-/patchright-1.62.3.tgz", - "integrity": "sha512-TMpWzcZVWUmOe1251PHWpk0gTP2d7+mvS00h1CLL2IQAUKX7UexKfPqEjdKkH8F2TT5AlyrSbwZKr5lu1dThAQ==", + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/patchright/-/patchright-1.63.0.tgz", + "integrity": "sha512-WVXhmNhAJ5I+CmcHEu/I3KMKhOlQaKS1XJsk+5nRIypKJ3Dq9IaQP29p4vB3I1FWCTarUXVRj02Na30wGcuztQ==", "license": "Apache-2.0", "dependencies": { - "patchright-core": "1.62.3" + "patchright-core": "1.63.0" }, "bin": { "patchright": "cli.js" }, "engines": { "node": ">=20" - }, - "optionalDependencies": { - "fsevents": "2.3.2" } }, "node_modules/possible-typed-array-names": { @@ -3418,18 +3190,6 @@ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", "license": "MIT" }, - "node_modules/psl": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz", - "integrity": "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==", - "license": "MIT", - "dependencies": { - "punycode": "^2.3.1" - }, - "funding": { - "url": "https://github.com/sponsors/lupomontero" - } - }, "node_modules/pump": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz", @@ -3440,15 +3200,6 @@ "once": "^1.3.1" } }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/puppeteer-core": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-2.1.1.tgz", @@ -3505,15 +3256,6 @@ "rimraf": "bin.js" } }, - "node_modules/qs": { - "version": "6.5.5", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.5.tgz", - "integrity": "sha512-mzR4sElr1bfCaPJe7m8ilJ6ZXdDaGoObcYR0ZHSsktM/Lt21MVHj5De30GQH2eiZ1qGRTO7LCAzQsUeXTNexWQ==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.6" - } - }, "node_modules/rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", @@ -3543,66 +3285,6 @@ "node": ">= 6" } }, - "node_modules/request": { - "version": "2.88.2", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", - "license": "Apache-2.0", - "dependencies": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/request/node_modules/form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, - "node_modules/requestretry": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/requestretry/-/requestretry-4.1.2.tgz", - "integrity": "sha512-N1WAp+8eOy8NfsVBChcSxNCKvPY1azOpliQ4Sby4WDe0HFEhdKywlNZeROMBQ+BI3Jpc0eNOT1KVFGREawtahA==", - "license": "MIT", - "dependencies": { - "extend": "^3.0.2", - "lodash": "^4.17.15", - "when": "^3.7.7" - }, - "peerDependencies": { - "request": "2.*.*" - } - }, "node_modules/require-in-the-middle": { "version": "7.5.2", "resolved": "https://registry.npmjs.org/require-in-the-middle/-/require-in-the-middle-7.5.2.tgz", @@ -3688,7 +3370,8 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/seek-bzip": { "version": "1.0.6", @@ -3874,31 +3557,6 @@ } } }, - "node_modules/sshpk": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz", - "integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==", - "license": "MIT", - "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - }, - "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/ssri": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz", @@ -4078,19 +3736,6 @@ "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", "license": "MIT" }, - "node_modules/tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "license": "BSD-3-Clause", - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -4103,12 +3748,6 @@ "node": "*" } }, - "node_modules/tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", - "license": "Unlicense" - }, "node_modules/typed-array-buffer": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", @@ -4179,51 +3818,12 @@ "imurmurhash": "^0.1.4" } }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "license": "BSD-2-Clause", - "dependencies": { - "punycode": "^2.1.0" - } - }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "license": "MIT" }, - "node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).", - "license": "MIT", - "bin": { - "uuid": "bin/uuid" - } - }, - "node_modules/verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", - "engines": [ - "node >=0.6.0" - ], - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "node_modules/when": { - "version": "3.7.8", - "resolved": "https://registry.npmjs.org/when/-/when-3.7.8.tgz", - "integrity": "sha512-5cZ7mecD3eYcMiCH4wtRPA5iFJZ50BJYDfckI5RRpQiktMiYTcn0ccLTZOvcbBume+1304fQztxeNzNS9Gvrnw==", - "license": "MIT" - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 954809f..325a906 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lugovsky/anonymous-browser", - "version": "0.1.0", + "version": "0.2.0", "description": "GoLogin, Patchright and HumanJS browser sessions for Node.js", "license": "MIT", "author": "Vladimir Lugovsky", @@ -24,9 +24,9 @@ }, "dependencies": { "@humanjs/playwright": "0.11.0", - "gologin": "2.2.8", - "patchright": "1.62.3", - "playwright": "npm:patchright@1.62.3" + "gologin": "3.0.4", + "patchright": "1.63.0", + "playwright": "npm:patchright@1.63.0" }, "devDependencies": { "@types/node": "^22.19.0", diff --git a/scripts/patch-patchright.cjs b/scripts/patch-patchright.cjs index ea28372..3de47df 100644 --- a/scripts/patch-patchright.cjs +++ b/scripts/patch-patchright.cjs @@ -2,16 +2,17 @@ const { readFileSync, writeFileSync } = require("node:fs"); const { dirname, join } = require("node:path"); const { createRequire } = require("node:module"); -// Patchright 1.62.3 starts interception without awaiting it in CRPage's +// Patchright 1.63.0 still starts interception without awaiting it in CRPage's // constructor. A closed CDP session then rejects outside page initialization. +const PATCHRIGHT_VERSION = "1.63.0"; const driverRequire = createRequire(require.resolve("patchright/package.json")); const packagePath = driverRequire.resolve("patchright-core/package.json"); const humanRequire = createRequire(require.resolve("@humanjs/playwright/package.json")); const humanDriver = humanRequire("playwright/package.json"); -if (humanDriver.name !== "patchright" || humanDriver.version !== "1.62.3") { - throw new Error('HumanJS must resolve Patchright 1.62.3. Set the consumer dependency "playwright" to "npm:patchright@1.62.3" and reinstall.'); +if (humanDriver.name !== "patchright" || humanDriver.version !== PATCHRIGHT_VERSION) { + throw new Error(`HumanJS must resolve Patchright ${PATCHRIGHT_VERSION}. Set the consumer dependency "playwright" to "npm:patchright@${PATCHRIGHT_VERSION}" and reinstall.`); } -if (JSON.parse(readFileSync(packagePath, "utf8")).version !== "1.62.3") { +if (JSON.parse(readFileSync(packagePath, "utf8")).version !== PATCHRIGHT_VERSION) { throw new Error("Review the Patchright startup patch before changing its pinned version"); } const bundlePath = join(dirname(packagePath), "lib/coreBundle.js"); diff --git a/src/gologin.d.ts b/src/gologin.d.ts deleted file mode 100644 index 918c2cf..0000000 --- a/src/gologin.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module "gologin"; diff --git a/src/lifecycle.ts b/src/lifecycle.ts index 87d8672..6bbd9d8 100644 --- a/src/lifecycle.ts +++ b/src/lifecycle.ts @@ -6,6 +6,7 @@ import { prepareOrbita } from "./orbita.js"; import type { CleanupResult, Logger, SessionOptions } from "./types.js"; import { applyWindowPlacement, captureWindowPlacement, restoreWindowPlacement, type WindowPlacementSnapshot } from "./window-placement.js"; +// Keep SDK implementation details out of the package's public declarations. interface GoLoginProfile { processSpawned: ChildProcess | null; restoreLastSession: boolean; @@ -15,14 +16,6 @@ interface GoLoginProfile { stopAndCommit(options: { posting: boolean }): Promise; } -type GoLoginConstructor = new (options: { - token: string; - profile_id: string; - executablePath: string; - browserMajorVersion: number; - extra_params: string[]; -}) => GoLoginProfile; - export class BrowserLaunchError extends Error { constructor(error: unknown) { super(errorFrom(error).message, { cause: error }); @@ -88,7 +81,7 @@ export class ProfileLifecycle { export async function launchProfile( apiToken: string, options: SessionOptions, log: Logger, ): Promise<{ lifecycle: ProfileLifecycle; context: BrowserContext }> { - const { default: GoLogin } = await import("gologin") as { default: GoLoginConstructor }; + const { default: GoLogin } = await import("gologin"); const orbita = options.orbita ?? await prepareOrbita(); const headless = options.headless ?? true; const extraArgs = [ @@ -101,8 +94,8 @@ export async function launchProfile( token: apiToken, profile_id: options.profileId, executablePath: orbita.executablePath, browserMajorVersion: orbita.majorVersion, extra_params: [...extraArgs], - }); - // GoLogin 2.2.8 replaces a constructor option of false with true. + }) as GoLoginProfile & InstanceType; + // GoLogin 3.0.4 still replaces a constructor option of false with true. profile.restoreLastSession = options.restoreLastSession ?? !headless; const lifecycle = new ProfileLifecycle(profile); try {