ant0-browser 0.0.0-stage → 0.2.0-beta.2

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.
Files changed (163) hide show
  1. package/LICENSE +35 -0
  2. package/README.md +208 -2
  3. package/dist/canvas.d.ts +55 -0
  4. package/dist/canvas.d.ts.map +1 -0
  5. package/dist/canvas.js +82 -0
  6. package/dist/canvas.js.map +1 -0
  7. package/dist/chromium-version.d.ts +22 -0
  8. package/dist/chromium-version.d.ts.map +1 -0
  9. package/dist/chromium-version.js +22 -0
  10. package/dist/chromium-version.js.map +1 -0
  11. package/dist/claim-hints.d.ts +36 -0
  12. package/dist/claim-hints.d.ts.map +1 -0
  13. package/dist/claim-hints.js +9 -0
  14. package/dist/claim-hints.js.map +1 -0
  15. package/dist/cleanup.d.ts +35 -0
  16. package/dist/cleanup.d.ts.map +1 -0
  17. package/dist/cleanup.js +106 -0
  18. package/dist/cleanup.js.map +1 -0
  19. package/dist/content.d.ts +11 -0
  20. package/dist/content.d.ts.map +1 -0
  21. package/dist/content.js +52 -0
  22. package/dist/content.js.map +1 -0
  23. package/dist/download.d.ts +24 -0
  24. package/dist/download.d.ts.map +1 -0
  25. package/dist/download.js +227 -0
  26. package/dist/download.js.map +1 -0
  27. package/dist/errors.d.ts +49 -0
  28. package/dist/errors.d.ts.map +1 -0
  29. package/dist/errors.js +53 -0
  30. package/dist/errors.js.map +1 -0
  31. package/dist/fingerprint.d.ts +218 -0
  32. package/dist/fingerprint.d.ts.map +1 -0
  33. package/dist/fingerprint.js +475 -0
  34. package/dist/fingerprint.js.map +1 -0
  35. package/dist/fontpack.d.ts +13 -0
  36. package/dist/fontpack.d.ts.map +1 -0
  37. package/dist/fontpack.js +150 -0
  38. package/dist/fontpack.js.map +1 -0
  39. package/dist/fonts.d.ts +15 -0
  40. package/dist/fonts.d.ts.map +1 -0
  41. package/dist/fonts.js +86 -0
  42. package/dist/fonts.js.map +1 -0
  43. package/dist/geoip.d.ts +45 -0
  44. package/dist/geoip.d.ts.map +1 -0
  45. package/dist/geoip.js +290 -0
  46. package/dist/geoip.js.map +1 -0
  47. package/dist/geometry.d.ts +32 -0
  48. package/dist/geometry.d.ts.map +1 -0
  49. package/dist/geometry.js +85 -0
  50. package/dist/geometry.js.map +1 -0
  51. package/dist/humanize.d.ts +20 -0
  52. package/dist/humanize.d.ts.map +1 -0
  53. package/dist/humanize.js +921 -0
  54. package/dist/humanize.js.map +1 -0
  55. package/dist/identity-persistence.d.ts +88 -0
  56. package/dist/identity-persistence.d.ts.map +1 -0
  57. package/dist/identity-persistence.js +381 -0
  58. package/dist/identity-persistence.js.map +1 -0
  59. package/dist/identity.d.ts +81 -0
  60. package/dist/identity.d.ts.map +1 -0
  61. package/dist/identity.js +370 -0
  62. package/dist/identity.js.map +1 -0
  63. package/dist/index.d.ts +281 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +790 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/launch-ticket.d.ts +191 -0
  68. package/dist/launch-ticket.d.ts.map +1 -0
  69. package/dist/launch-ticket.js +549 -0
  70. package/dist/launch-ticket.js.map +1 -0
  71. package/dist/launchopts.d.ts +266 -0
  72. package/dist/launchopts.d.ts.map +1 -0
  73. package/dist/launchopts.js +623 -0
  74. package/dist/launchopts.js.map +1 -0
  75. package/dist/motion.d.ts +106 -0
  76. package/dist/motion.d.ts.map +1 -0
  77. package/dist/motion.js +311 -0
  78. package/dist/motion.js.map +1 -0
  79. package/dist/motionscore.d.ts +57 -0
  80. package/dist/motionscore.d.ts.map +1 -0
  81. package/dist/motionscore.js +215 -0
  82. package/dist/motionscore.js.map +1 -0
  83. package/dist/native/linux-x64/PRODUCT-LICENSE.txt +28 -0
  84. package/dist/native/linux-x64/ant0_runtime.node +0 -0
  85. package/dist/native/windows-x64/PRODUCT-LICENSE.txt +28 -0
  86. package/dist/native/windows-x64/ant0_runtime.node +0 -0
  87. package/dist/persona-migration.d.ts +54 -0
  88. package/dist/persona-migration.d.ts.map +1 -0
  89. package/dist/persona-migration.js +97 -0
  90. package/dist/persona-migration.js.map +1 -0
  91. package/dist/persona-profile-v2.d.ts +169 -0
  92. package/dist/persona-profile-v2.d.ts.map +1 -0
  93. package/dist/persona-profile-v2.js +454 -0
  94. package/dist/persona-profile-v2.js.map +1 -0
  95. package/dist/persona-profile-v4.d.ts +61 -0
  96. package/dist/persona-profile-v4.d.ts.map +1 -0
  97. package/dist/persona-profile-v4.js +79 -0
  98. package/dist/persona-profile-v4.js.map +1 -0
  99. package/dist/persona-rejected.d.ts +36 -0
  100. package/dist/persona-rejected.d.ts.map +1 -0
  101. package/dist/persona-rejected.js +40 -0
  102. package/dist/persona-rejected.js.map +1 -0
  103. package/dist/population-model.d.ts +45 -0
  104. package/dist/population-model.d.ts.map +1 -0
  105. package/dist/population-model.js +245 -0
  106. package/dist/population-model.js.map +1 -0
  107. package/dist/profile-file.d.ts +201 -0
  108. package/dist/profile-file.d.ts.map +1 -0
  109. package/dist/profile-file.js +736 -0
  110. package/dist/profile-file.js.map +1 -0
  111. package/dist/release-fetch.d.ts +74 -0
  112. package/dist/release-fetch.d.ts.map +1 -0
  113. package/dist/release-fetch.js +395 -0
  114. package/dist/release-fetch.js.map +1 -0
  115. package/dist/release.d.ts +16 -0
  116. package/dist/release.d.ts.map +1 -0
  117. package/dist/release.js +26 -0
  118. package/dist/release.js.map +1 -0
  119. package/dist/render.d.ts +38 -0
  120. package/dist/render.d.ts.map +1 -0
  121. package/dist/render.js +104 -0
  122. package/dist/render.js.map +1 -0
  123. package/dist/runtime-client.d.ts +47 -0
  124. package/dist/runtime-client.d.ts.map +1 -0
  125. package/dist/runtime-client.js +327 -0
  126. package/dist/runtime-client.js.map +1 -0
  127. package/dist/runtime-launch.d.ts +22 -0
  128. package/dist/runtime-launch.d.ts.map +1 -0
  129. package/dist/runtime-launch.js +92 -0
  130. package/dist/runtime-launch.js.map +1 -0
  131. package/dist/scale.d.ts +29 -0
  132. package/dist/scale.d.ts.map +1 -0
  133. package/dist/scale.js +105 -0
  134. package/dist/scale.js.map +1 -0
  135. package/dist/shaderdialect.d.ts +33 -0
  136. package/dist/shaderdialect.d.ts.map +1 -0
  137. package/dist/shaderdialect.js +47 -0
  138. package/dist/shaderdialect.js.map +1 -0
  139. package/dist/speech-coherence.d.ts +52 -0
  140. package/dist/speech-coherence.d.ts.map +1 -0
  141. package/dist/speech-coherence.js +254 -0
  142. package/dist/speech-coherence.js.map +1 -0
  143. package/dist/template-selection.d.ts +14 -0
  144. package/dist/template-selection.d.ts.map +1 -0
  145. package/dist/template-selection.js +66 -0
  146. package/dist/template-selection.js.map +1 -0
  147. package/dist/warnings.d.ts +50 -0
  148. package/dist/warnings.d.ts.map +1 -0
  149. package/dist/warnings.js +273 -0
  150. package/dist/warnings.js.map +1 -0
  151. package/dist/webgl-coherence.d.ts +30 -0
  152. package/dist/webgl-coherence.d.ts.map +1 -0
  153. package/dist/webgl-coherence.js +98 -0
  154. package/dist/webgl-coherence.js.map +1 -0
  155. package/dist/webgpu-override.d.ts +14 -0
  156. package/dist/webgpu-override.d.ts.map +1 -0
  157. package/dist/webgpu-override.js +82 -0
  158. package/dist/webgpu-override.js.map +1 -0
  159. package/dist/widevine.d.ts +44 -0
  160. package/dist/widevine.d.ts.map +1 -0
  161. package/dist/widevine.js +203 -0
  162. package/dist/widevine.js.map +1 -0
  163. package/package.json +56 -4
package/LICENSE ADDED
@@ -0,0 +1,35 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, Ant0 Browser contributors
4
+ Copyright (c) 2026, Clearcote Labs and the Clearcote contributors
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ ---
32
+
33
+ The Clearcote notice above applies to source and patches imported into Ant0
34
+ Browser. Other upstream components (Chromium, ungoogled-chromium, and others)
35
+ are distributed under their respective licenses; see CREDITS.md.
package/README.md CHANGED
@@ -1,3 +1,209 @@
1
- # Temporary Holding Version
1
+ <img src="https://ant0.link/icon-192.png" width="64" alt="Ant0 Browser">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # Ant0 Browser SDK for Node.js
4
+
5
+ A Playwright-compatible SDK for launching a separately installed Ant0 Browser engine from Node.js.
6
+
7
+ [Node.js SDK guide](https://docs.ant0.link/sdk#node) · [Support](https://ant0.link/contact)
8
+
9
+ The `ant0-browser` package contains the SDK, not the browser engine, an Ant0 account or licence, or synthetic-identity assets. SDK code is BSD-3-Clause licensed; the engine is installed and licensed separately.
10
+
11
+ ## Before you install
12
+
13
+ **System requirements, Linux:** glibc 2.39 or newer (Ubuntu 24.04+, Debian 13+, Fedora 40+). Older distributions are not supported. This applies to the Ant0 application, the engine and the native bindings.
14
+
15
+ Direct SDK launches require all of the following:
16
+
17
+ 1. Install the Ant0 application and its licensed Ant0 Browser engine.
18
+ 2. Complete sign-in in the Ant0 application; its local `ant0d` daemon uses that signed-in, licensed state to provide launch tickets.
19
+ 3. Set `ANT0_BROWSER_BINARY` to the absolute path of that installation's engine executable before starting Node.js.
20
+
21
+ The SDK checks that the executable is an Ant0 build; stock Chrome or Chromium is not a substitute. SDK package version `0.2.0-beta.2` and the installed engine release version are independent.
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ npm install ant0-browser@0.2.0-beta.2
27
+ ```
28
+
29
+ This is a beta release, published under the npm `beta` dist-tag (`npm install ant0-browser@beta`); `npm install ant0-browser` (the `latest` tag) keeps installing the current stable release, 0.1.1, until a stable 0.2.0 ships.
30
+
31
+ ```bash
32
+ # pin the exact beta for reproducible installs
33
+ npm install --save-exact ant0-browser@0.2.0-beta.2
34
+ ```
35
+
36
+ Package metadata declares Node.js 18 or newer. See the qualification table below for tested environments.
37
+
38
+ ## Quick start
39
+
40
+ Save as `example.mjs` and run `node example.mjs`. The example uses native identity and needs no synthetic assets.
41
+
42
+ ```javascript
43
+ import { launch } from "ant0-browser";
44
+
45
+ const browser = await launch({ identity: { mode: "native" } });
46
+ try {
47
+ const page = await browser.newPage();
48
+ await page.goto("https://example.com");
49
+ console.log(await page.title());
50
+ } finally {
51
+ await browser.close();
52
+ }
53
+ ```
54
+
55
+ `launch()` creates a temporary profile by default and removes it when the browser closes or the process exits. Use `launchPersistentContext()` when you intentionally need a persistent profile.
56
+
57
+ ## API at a glance
58
+
59
+ | API | Use | Reference |
60
+ | --- | --- | --- |
61
+ | `launch(options?)` | Launch a Playwright browser with the selected identity. | [Node.js SDK](https://docs.ant0.link/sdk#node) |
62
+ | `launchPersistentContext(userDataDir, options?)` | Launch with an explicitly managed persistent profile. | [Node.js SDK](https://docs.ant0.link/sdk#node) |
63
+ | `serve(options?)` | Start the engine and expose a local CDP endpoint with process controls. | [Node.js SDK](https://docs.ant0.link/sdk#node) |
64
+ | `resolveGeo(proxy?, opts?)` | Optional exit-IP geolocation for identity settings. | [Network details](https://docs.ant0.link/sdk#network) |
65
+
66
+ Omitting `identity` selects native identity. Captured or synthetic identities and explicit overrides are also available; creating a new synthetic identity requires separately authorized local model or template assets. Those assets are not included in the package.
67
+
68
+ Optional `overrides: { audioProfile: { sampleRate, baseLatency, outputLatency } }` replaces individual audio fields for one launch (launch-only, never saved into the identity). The default is the real-world distribution of the population model; see `docs/FINGERPRINT-MODES.md`, section "Audio profile override".
69
+
70
+ Optional `overrides: { network: { rtt, downlink, effectiveType } }` sets the persona's base `navigator.connection` link for one launch (launch-only, never saved; engine ant0.7 or later); see `docs/FINGERPRINT-MODES.md`, section "Network (`navigator.connection`) override". Newly generated synthetic identities get a speech voice list in the persona's language; saved identities are not rewritten (same document, "Speech voices follow the persona language").
71
+
72
+ ## Screen scale and the window
73
+
74
+ When the SDK knows the persona's device pixel ratio (an explicit `devicePixelRatio`, `lightStealth`, or a v2 profile's `display.device_pixel_ratio`) it adds `--force-device-scale-factor=<ratio>`, so the page sees the persona's scale on a Linux host too. A Playwright `viewport` alone emulates scale 1, so the SDK adds the matching `deviceScaleFactor` unless you set your own. A headed window is kept on the real display: its size is clamped to the display divided by the scale. The display is read from `ANT0_DISPLAY_SIZE=WIDTHxHEIGHT` or, on Linux, `xrandr`/`xdpyinfo`; Windows and macOS are not detected, so pass your own window size there (your `--window-size`, `--start-maximized`, `--start-fullscreen` or `--kiosk` always wins). A persona the engine picks by itself, and a native identity, get no flag.
75
+
76
+ ## Playwright calls that do not work on Ant0
77
+
78
+ These fail or time out (27 of 62 calls tried): `page.setContent` (use `setContent` from this package), `exposeFunction` and `exposeBinding` on a page, context or frame, `page.on('console')`, `page.on('pageerror')`, and a raw CDP session that enables `Runtime` and waits for `consoleAPICalled`. Everything else tried works: navigation, `evaluate`, init scripts, dialogs, waits, locators, frames, `route`, popups, workers, `storageState`, screenshots, PDF, mouse and plain CDP sessions.
79
+
80
+ ```ts
81
+ import { setContent } from "ant0-browser";
82
+ await setContent(page, "<h1>hi</h1>", { waitUntil: "load" }); // load | domcontentloaded | networkidle | commit
83
+ ```
84
+
85
+ `canvasBridge` was removed with the engine's canvas bridge. An old value is ignored with a one-time note and never fails a launch.
86
+
87
+ ## Browser switches `launch()` does and does not pass
88
+
89
+ Playwright adds testing switches to every launch. `launch()` and `launchPersistentContext()` remove the ones a page can observe, so pages see what a normal Chrome window shows: `--hide-scrollbars` (scrollbars are drawn), `--disable-popup-blocking` (`window.open()` without a user gesture is blocked; a popup from a click still opens and `context.on("page")` fires), and the `HttpsUpgrades` and `BoundaryEventDispatchTracksNodeRemoval` feature disables (`http://` upgrades to `https://` when TLS answers and falls back to `http://` when it does not; boundary events after a node under the pointer is removed match Chrome). `HttpsFirstBalancedModeAutoEnable` stays disabled, so a host with no TLS still loads over `http://`. This does not hold when you ignore every Playwright default (`ignoreDefaultArgs: true`), when you ignore Playwright's exact `--disable-features=` default, or when the SDK cannot read Playwright's default feature lists (unreadable-defaults fallback); `http://` to a host with no TLS can then fail with `ERR_BLOCKED_BY_CLIENT`. A switch or feature you pass yourself in `args` is kept, and a feature you enable yourself with `--enable-features` (including `HttpsFirstBalancedModeAutoEnable`) is removed from the disabled list.
90
+
91
+ Known difference from stock Chrome: `launch()` keeps `--disable-back-forward-cache`. With the cache on, Playwright's default `page.goBack()` waits for a load event that never fires on a restored page and times out; `waitUntil: "commit"` works. `serve()` does not pass it and matches stock.
92
+
93
+ ## Profile storage
94
+
95
+ localStorage is pinned to the leveldb backend (the SDK always disables `DomStorageSqlite`, `DomStorageSqliteMigration` and `DomStorageSqliteNewDatabases`), so a caller's `--enable-features=DomStorageSqlite` is overridden: disable wins. On `launch()` and `launchPersistentContext()` the SDK skips the pin when it cannot read Playwright's default feature lists (old Playwright releases), because its `--disable-features` would then replace Playwright's whole disabled list; `serve()` and `launchPlan()` always pin.
96
+
97
+ ## serve() and launchPlan()
98
+
99
+ `serve()` and `launchPlan()` apply the same engine options as `launch()`: identity, `overrides`, `args`, `extensions`, `shaderDialect`, `widevine` (seeded into the served profile), `resolveFonts`, `env` (over `process.env` and the font wiring), `quiet`, the launch-ticket and runtime options, and a `proxy`'s `server` and `bypass` (a `--proxy-bypass-list` in `args` wins). `chromiumSandbox: false` adds `--no-sandbox`; the sandbox stays on by default. Playwright-only options (`humanize`, `showCursor`, context options, proxy `username`/`password`) are ignored, and a direct spawn has no `<-loopback>` proxy rule, so `localhost` stays direct.
100
+
101
+ A `launchPlan()` plan carries a launch ticket that engines from ant0.11 accept only for about 5 minutes after it was issued. Spawn the plan promptly, and call `launchPlan()` again for every (re)spawn; never respawn from an old plan.
102
+
103
+ `cacheDir` is accepted on every launch path and ignored; it prints a one-time note. To choose the download cache, use `executablePath({ cacheDir })`.
104
+
105
+ ## Proxy, network, and privacy
106
+
107
+ Proxy settings for browser launches are optional and follow Playwright's configuration. SOCKS5 username/password authentication is not supported by the engine; use an HTTP(S) proxy with credentials, an unauthenticated SOCKS5 proxy, or Ant0's local relay. GeoIP exit-IP lookups use an HTTP(S) proxy; SOCKS proxies are not supported for that lookup.
108
+
109
+ `socks5h://` is accepted and sent as `socks5://`; the engine resolves hostnames at the SOCKS5 proxy in both cases.
110
+
111
+ | Behavior | Network use |
112
+ | --- | --- |
113
+ | Launch-ticket handling | When needed, the SDK requests a ticket from the local `ant0d` daemon over loopback. |
114
+ | `resolveGeo()` | Only when called. The exit-IP lookup uses the configured proxy; GeoIP data may be fetched directly, and fallback providers may be contacted if the primary lookup is unavailable. |
115
+ | Release or optional assets | Only when the corresponding helper is used or an opt-in source is configured. |
116
+
117
+ See [SDK network details](https://docs.ant0.link/sdk#network) and the [Ant0 Privacy Policy](https://ant0.link/legal/privacy) for more information. `resolveGeo()` is optional; ordinary browser navigation follows the URLs your code opens.
118
+
119
+ ## Runtime and qualification
120
+
121
+ The package declares Node.js `>=18`. The table below is the qualification of the previous release; this beta is being requalified and its results are recorded in the release notes. The declared minimum is not a claim that every minimum-version/platform combination has been tested.
122
+
123
+ | Platform | Tested runtime |
124
+ | --- | --- |
125
+ | Linux | Node.js 24 |
126
+ | Windows | Node.js 24 |
127
+
128
+ Target engine for this release: `158.0.8127.18-ant0.11`.
129
+
130
+ ## Troubleshooting
131
+
132
+ | Symptom | Check |
133
+ | --- | --- |
134
+ | Engine not found or rejected | Confirm `ANT0_BROWSER_BINARY` points to the executable in an installed Ant0 engine release, not stock Chromium. |
135
+ | Launch-ticket rejection (engine exit code 90) | Start Ant0, sign in, and confirm its local daemon can issue a ticket for the installed engine release. The SDK version is not the engine version. |
136
+ | Temporary profile or socket path is too long | Set `TMPDIR` (POSIX) or `TEMP`/`TMP` (Windows) to a short, writable local directory before starting Node.js. |
137
+ | SOCKS5 proxy credentials are rejected | Use an HTTP(S) proxy, an unauthenticated SOCKS5 endpoint, or Ant0's local relay. |
138
+
139
+ ### Launch ticket in the environment
140
+
141
+ The SDK hands the engine its launch ticket twice, with the same value: as `--ant0-launch=<ticket>` in the engine's arguments, and as `ANT0_LAUNCH` in the environment of the engine process only. Engines that predate the environment variable read only the argument; newer ones read the environment first, so the ticket is not needed on the command line. The argument is dropped in a later release. This applies to `launch()`, `launchPersistentContext()`, `serve()` and `launchPlan()`. `launchPlan()` returns the plan the caller spawns itself; `plan.env` carries the entry, so pass `plan.env` and `plan.args` to your own spawn. The SDK never sets `ANT0_LAUNCH` in its own process (`process.env`); it is added to a copy of the environment that goes to the engine.
142
+
143
+ If you pass your own ticket, nothing is overwritten and nothing is refused. A ticket in your `env` option (`ANT0_LAUNCH`) or in your `args` (`--ant0-launch=`) counts as yours: the SDK then neither fetches nor adds another, and copies yours into the place that has none, so both match. If you set both and they differ, both are left as you set them (a newer engine uses the environment one and logs a line). Only those two count. An `ANT0_LAUNCH` that is merely set in your shell or in the SDK's own environment does nothing: it is never read as your ticket, never reaches the engine, and an engine launch that has no ticket of its own carries none. `--ant0-launch <ticket>` (with a space) is not parsed or mirrored: it is an ordinary argument left to the engine, which only reads the `=` form. On Windows the variable name is matched case-insensitively. **Stale tickets:** when the engine exits 90 with `claim_expired` or `claim_stale` and the SDK itself fetched the ticket from the daemon, `launch()`, `launchPersistentContext()` and `serve()` retry the launch once with a ticket fetched right before the respawn. A ticket you provided (the launch-ticket option, `--ant0-launch=` in your args, or `ANT0_LAUNCH` in your explicit env) and every other reason are never retried, and a second failure is raised as usual. `launchPlan()` returns a plan you spawn yourself, so it cannot retry: if your child exits 90 with one of those two reasons and you used the SDK-fetched ticket, call `launchPlan()` again (or `plan.spawn()` for a new ticket) and respawn once.
144
+
145
+ The ticket in the environment is a secret like the one in the arguments: it is removed from launch errors, and an `env` property on a wrapped error is dropped. Do not log the engine's environment. An engine that rejects a stale claim reports `claim_stale` (exit code 90), which the SDK treats like `claim_expired`.
146
+
147
+ ### Launch errors and secrets
148
+
149
+ Errors the SDK raises or re-raises for a failed launch have the launch ticket, the persona file path and the profile directory removed from their message, stack and string properties (the values the SDK itself passed are replaced exactly; the `--ant0-launch` and `--fingerprint-profile-file` switches are also matched by pattern), and carry no `cause`. This covers error messages and tracebacks only. A tool that captures local variables when an error happens (Sentry with local variables enabled, a debugger, a crash reporter) can still see the raw launch arguments in the SDK's frames. Keep such capture off for code that calls `launch()` or `serve()`, or scrub the `--ant0-launch`, `--fingerprint-profile-file` and `--user-data-dir` values in its hooks. A `--ant0-launch` value shorter than 16 characters is replaced only where it follows its switch or stands as a whole token, not anywhere in a text, so a short word cannot mangle the text around it. Only a malformed value that a user typed is that short; a minted ticket carries a 64-byte signature and is about 86 characters, so it is always replaced everywhere.
150
+
151
+ ### Engine damaged
152
+
153
+ **Symptom.** `launch()` raises `browser.proof_mismatch` (next action `reinstall_engine`).
154
+
155
+ **Cause.** The engine's signed proof is present and valid, but an installed file was changed, truncated or removed. `ant0 browsers ls` shows the release as failed and names the file.
156
+
157
+ **Fix.** Reinstall that release: `ant0 browsers rm <version>`, then `ant0 browsers install --release <version>`.
158
+
159
+ ### Engine not found
160
+
161
+ **Symptom.** `launch()` raises `browser.not_installed`, even though `ant0 browsers ls` shows the engine as installed.
162
+
163
+ **Cause.** The installed engine has no valid install proof (a signed record of its files, kept in `<home>/browsers/<version>/.provenance/`). Without it, the SDK will not use the engine automatically. The error code does not say which part failed; this is by design.
164
+
165
+ **Fix 1: write the proof for the installed engine.** Update the Ant0 desktop app to 0.3.22 or later, then run:
166
+
167
+ ```bash
168
+ ant0 browsers install --release <version> --repair-proof
169
+ ```
170
+
171
+ This never reinstalls the engine. It writes the proof only if every installed file matches the signed list.
172
+
173
+ **Fix 2: reinstall the engine** with the desktop app 0.3.22 or later. New installs write the proof automatically.
174
+
175
+ **Engines with no published proof** (for example the current stable `ant0.5`) cannot be found automatically. Pass the path to the browser yourself, using `executablePath` or the `ANT0_BROWSER_BINARY` environment variable:
176
+
177
+ ```js
178
+ const browser = await launch({ executablePath: "/path/to/ant0/chrome" });
179
+ ```
180
+
181
+ ### Unexpected file in the engine folder
182
+
183
+ **Symptom.** `launch()` raises `browser.unexpected_file` (next action `reinstall_engine`). The native runtime's own text names the file ("the engine folder has an unexpected file (`<name>`); repair or reinstall the engine"), but the SDK error carries the code and next action only, never the runtime's message.
184
+
185
+ **Cause.** The engine is installed, but its folder holds an entry that is not on the engine's signed file list (for example a log file written by something that ran inside it). The check is exact on purpose: no file name is accepted.
186
+
187
+ **Fix.** Reinstall that release (this also removes the extra entry): `ant0 browsers rm <version>`, then `ant0 browsers install --release <version>`. Not `browser.proof_mismatch`: that means a listed file was changed or removed.
188
+
189
+ ## Shutdown and cleanup
190
+
191
+ Ctrl+C / SIGTERM cleanup is the application's job: call `close()` (for example from your own `SIGINT` handler). The SDK installs no signal handlers, so it never changes how your process terminates.
192
+
193
+ What the exit hook guarantees: if the process exits without `close()` (including `srv.close(); process.exit(0)` without awaiting), one `exit` listener stops every running `serve()` browser and removes the temp profile directory `serve()` created. A browser that uses a throwaway temp profile gets SIGKILL (a graceful Chromium shutdown writes files back into the directory being removed); a browser using a `userDataDir` you passed in gets SIGTERM so it can shut down gracefully (unless `close()` has already sent it SIGTERM, in which case it is not signalled a second time, since a second SIGTERM would cut its graceful shutdown short), and that directory is never deleted. The hook is synchronous and bounded: it spends about 1 s per directory and about 3 s in total on removal retries, then gives up and accepts the leak. A process killed by a signal you did not handle does not run `exit` hooks, so nothing is cleaned up in that case.
194
+
195
+ On Windows there is no graceful SIGTERM: stopping a process is a hard terminate.
196
+
197
+ `close()` sends SIGTERM, waits for the browser to exit (SIGKILL only if it has not exited after a timeout), then removes the temp profile directory.
198
+
199
+ ## GeoIP attribution
200
+
201
+ Optional GeoIP uses the IP2Location LITE database ([ip2location.com](https://lite.ip2location.com)), includes GeoLite2 data created by MaxMind ([maxmind.com](https://www.maxmind.com/)), and includes IP geolocation by DB-IP ([db-ip.com](https://db-ip.com)). The merged `geoip-all-in-one` database is GPL-3.0; its data covers country, coordinates, and timezone.
202
+
203
+ ## More information
204
+
205
+ - [Node.js SDK guide and API reference](https://docs.ant0.link/sdk#node)
206
+ - [Identity options](https://docs.ant0.link/sdk#identity)
207
+ - [Network behavior](https://docs.ant0.link/sdk#network)
208
+ - [Support](https://ant0.link/contact)
209
+ - [Privacy Policy](https://ant0.link/legal/privacy)
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Canvas mode per profile, and the per-profile canvas noise key.
3
+ *
4
+ * Two modes:
5
+ * real this computer's genuine canvas output. Every profile on this computer shows the same
6
+ * canvas result. This is the default.
7
+ * noise a canvas result that is unique to the profile, stable across launches and across sites.
8
+ * Needs a 16-hex key; the engine takes it as `--fingerprint-noise-key=<key>`.
9
+ *
10
+ * Mapping of the options onto the mode (`canvasMode`):
11
+ *
12
+ * canvas canvasNoise fingerprintNoise mode
13
+ * "real" any any real
14
+ * "noise" any any noise (the key is required)
15
+ * unset any any real
16
+ *
17
+ * Only `canvas: "noise"` selects noise. The legacy `canvasNoise` and `fingerprintNoise` flags never do:
18
+ * on earlier releases `true` sent nothing and `false` sent `--disable-canvas-noise` /
19
+ * `--disable-fingerprint-noise`, and a profile that already existed must not change its fingerprint on
20
+ * upgrade. They keep exactly that behaviour; `true` now also gets the `canvas-noise-no-key` warning.
21
+ */
22
+ /** The engine switch that carries the key. One constant so the spelling is a one-line change. */
23
+ export declare const CANVAS_NOISE_KEY_SWITCH = "--fingerprint-noise-key";
24
+ /** The key is exactly this many lowercase hex characters (8 bytes), with no 0x prefix. */
25
+ export declare const CANVAS_NOISE_KEY_LENGTH = 16;
26
+ /** Domain separator for the key derived for older identity files (v1 and v2 wrappers), which store none. */
27
+ export declare const CANVAS_NOISE_KEY_DOMAIN = "ant0/canvas-noise-key/v1\0";
28
+ export type CanvasMode = "real" | "noise";
29
+ export interface CanvasOptions {
30
+ canvas?: CanvasMode;
31
+ canvasNoise?: boolean;
32
+ fingerprintNoise?: boolean;
33
+ }
34
+ /** True when `value` is a valid canvas noise key: 16 lowercase hex characters. */
35
+ export declare function isCanvasNoiseKey(value: unknown): value is string;
36
+ /** Throw unless `canvas` is undefined, "real" or "noise". */
37
+ export declare function assertCanvasOption(canvas: unknown): void;
38
+ /** Throw unless `key` is undefined or a valid canvas noise key. */
39
+ export declare function assertCanvasNoiseKey(key: unknown): void;
40
+ /** Resolve the canvas mode from the options (see the table at the top of this file). */
41
+ export declare function canvasMode(o: CanvasOptions): CanvasMode;
42
+ /** A fresh random canvas noise key (CSPRNG, 8 bytes as 16 lowercase hex). */
43
+ export declare function newCanvasNoiseKey(): string;
44
+ /** The key for an identity stored without one: the first 8 bytes of
45
+ * SHA-256("ant0/canvas-noise-key/v1\0" + identityKey), as 16 lowercase hex.
46
+ * `identityKey` is the string the caller gave as `identity.key` (the daemon: the profile's
47
+ * identity key); it is hashed as UTF-8. */
48
+ export declare function deriveCanvasNoiseKey(identityKey: string): string;
49
+ /** The canvas noise key of a persisted identity: its stored `canvas_noise_key`, else the key derived
50
+ * from `identityKey`. The wrapper does not record the identity key (its file name is an HMAC of it),
51
+ * so the caller passes it. */
52
+ export declare function canvasNoiseKeyFor(persisted: {
53
+ canvas_noise_key?: string;
54
+ } | null | undefined, identityKey: string): string;
55
+ //# sourceMappingURL=canvas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../src/canvas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH,iGAAiG;AACjG,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AACjE,0FAA0F;AAC1F,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,4GAA4G;AAC5G,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AAEpE,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AAG1C,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEhE;AAED,6DAA6D;AAC7D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAIxD;AAED,mEAAmE;AACnE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAIvD;AAED,wFAAwF;AACxF,wBAAgB,UAAU,CAAC,CAAC,EAAE,aAAa,GAAG,UAAU,CAIvD;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;2CAG2C;AAC3C,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAMhE;AAED;;8BAE8B;AAC9B,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,EAAE,WAAW,EAAE,MAAM,GAC/E,MAAM,CASR"}
package/dist/canvas.js ADDED
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Canvas mode per profile, and the per-profile canvas noise key.
3
+ *
4
+ * Two modes:
5
+ * real this computer's genuine canvas output. Every profile on this computer shows the same
6
+ * canvas result. This is the default.
7
+ * noise a canvas result that is unique to the profile, stable across launches and across sites.
8
+ * Needs a 16-hex key; the engine takes it as `--fingerprint-noise-key=<key>`.
9
+ *
10
+ * Mapping of the options onto the mode (`canvasMode`):
11
+ *
12
+ * canvas canvasNoise fingerprintNoise mode
13
+ * "real" any any real
14
+ * "noise" any any noise (the key is required)
15
+ * unset any any real
16
+ *
17
+ * Only `canvas: "noise"` selects noise. The legacy `canvasNoise` and `fingerprintNoise` flags never do:
18
+ * on earlier releases `true` sent nothing and `false` sent `--disable-canvas-noise` /
19
+ * `--disable-fingerprint-noise`, and a profile that already existed must not change its fingerprint on
20
+ * upgrade. They keep exactly that behaviour; `true` now also gets the `canvas-noise-no-key` warning.
21
+ */
22
+ import { createHash, randomBytes } from "node:crypto";
23
+ import { SdkInputError } from "./errors.js";
24
+ /** The engine switch that carries the key. One constant so the spelling is a one-line change. */
25
+ export const CANVAS_NOISE_KEY_SWITCH = "--fingerprint-noise-key";
26
+ /** The key is exactly this many lowercase hex characters (8 bytes), with no 0x prefix. */
27
+ export const CANVAS_NOISE_KEY_LENGTH = 16;
28
+ /** Domain separator for the key derived for older identity files (v1 and v2 wrappers), which store none. */
29
+ export const CANVAS_NOISE_KEY_DOMAIN = "ant0/canvas-noise-key/v1\0";
30
+ const KEY_RE = /^[0-9a-f]{16}$/;
31
+ /** True when `value` is a valid canvas noise key: 16 lowercase hex characters. */
32
+ export function isCanvasNoiseKey(value) {
33
+ return typeof value === "string" && KEY_RE.test(value);
34
+ }
35
+ /** Throw unless `canvas` is undefined, "real" or "noise". */
36
+ export function assertCanvasOption(canvas) {
37
+ if (canvas !== undefined && canvas !== "real" && canvas !== "noise") {
38
+ throw new SdkInputError("sdk.canvas_invalid", 'canvas must be "real" or "noise"');
39
+ }
40
+ }
41
+ /** Throw unless `key` is undefined or a valid canvas noise key. */
42
+ export function assertCanvasNoiseKey(key) {
43
+ if (key !== undefined && !isCanvasNoiseKey(key)) {
44
+ throw new SdkInputError("sdk.canvas_invalid", "canvasNoiseKey must be 16 lowercase hex characters");
45
+ }
46
+ }
47
+ /** Resolve the canvas mode from the options (see the table at the top of this file). */
48
+ export function canvasMode(o) {
49
+ assertCanvasOption(o.canvas);
50
+ if (o.canvas !== undefined)
51
+ return o.canvas;
52
+ return "real";
53
+ }
54
+ /** A fresh random canvas noise key (CSPRNG, 8 bytes as 16 lowercase hex). */
55
+ export function newCanvasNoiseKey() {
56
+ return randomBytes(8).toString("hex");
57
+ }
58
+ /** The key for an identity stored without one: the first 8 bytes of
59
+ * SHA-256("ant0/canvas-noise-key/v1\0" + identityKey), as 16 lowercase hex.
60
+ * `identityKey` is the string the caller gave as `identity.key` (the daemon: the profile's
61
+ * identity key); it is hashed as UTF-8. */
62
+ export function deriveCanvasNoiseKey(identityKey) {
63
+ if (typeof identityKey !== "string") {
64
+ throw new SdkInputError("sdk.canvas_invalid", "identityKey must be a string");
65
+ }
66
+ return createHash("sha256").update(CANVAS_NOISE_KEY_DOMAIN, "utf8").update(identityKey, "utf8")
67
+ .digest().subarray(0, 8).toString("hex");
68
+ }
69
+ /** The canvas noise key of a persisted identity: its stored `canvas_noise_key`, else the key derived
70
+ * from `identityKey`. The wrapper does not record the identity key (its file name is an HMAC of it),
71
+ * so the caller passes it. */
72
+ export function canvasNoiseKeyFor(persisted, identityKey) {
73
+ const stored = persisted?.canvas_noise_key;
74
+ if (stored !== undefined) {
75
+ if (!isCanvasNoiseKey(stored)) {
76
+ throw new SdkInputError("sdk.canvas_invalid", "stored canvas_noise_key is not 16 lowercase hex characters");
77
+ }
78
+ return stored;
79
+ }
80
+ return deriveCanvasNoiseKey(identityKey);
81
+ }
82
+ //# sourceMappingURL=canvas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canvas.js","sourceRoot":"","sources":["../src/canvas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,iGAAiG;AACjG,MAAM,CAAC,MAAM,uBAAuB,GAAG,yBAAyB,CAAC;AACjE,0FAA0F;AAC1F,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAC1C,4GAA4G;AAC5G,MAAM,CAAC,MAAM,uBAAuB,GAAG,4BAA4B,CAAC;AAGpE,MAAM,MAAM,GAAG,gBAAgB,CAAC;AAQhC,kFAAkF;AAClF,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,kBAAkB,CAAC,MAAe;IAChD,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QACpE,MAAM,IAAI,aAAa,CAAC,oBAAoB,EAAE,kCAAkC,CAAC,CAAC;IACpF,CAAC;AACH,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,oBAAoB,CAAC,GAAY;IAC/C,IAAI,GAAG,KAAK,SAAS,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,aAAa,CAAC,oBAAoB,EAAE,oDAAoD,CAAC,CAAC;IACtG,CAAC;AACH,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,UAAU,CAAC,CAAgB;IACzC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7B,IAAI,CAAC,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,CAAC,CAAC,MAAM,CAAC;IAC5C,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,iBAAiB;IAC/B,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC;AAED;;;2CAG2C;AAC3C,MAAM,UAAU,oBAAoB,CAAC,WAAmB;IACtD,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,IAAI,aAAa,CAAC,oBAAoB,EAAE,8BAA8B,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC;SAC5F,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED;;8BAE8B;AAC9B,MAAM,UAAU,iBAAiB,CAC/B,SAA2D,EAAE,WAAmB;IAEhF,MAAM,MAAM,GAAG,SAAS,EAAE,gBAAgB,CAAC;IAC3C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,aAAa,CAAC,oBAAoB,EAAE,4DAA4D,CAAC,CAAC;QAC9G,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO,oBAAoB,CAAC,WAAW,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Single source of truth for the Chromium version this SDK targets.
3
+ *
4
+ * GENERATED FILE — do not edit by hand. Regenerate with:
5
+ *
6
+ * python3 scripts/sync_chromium_version.py
7
+ *
8
+ * The values come from the repository's `UPSTREAM_REVISION` pin. The SDK ships as a
9
+ * standalone package and cannot read that file at runtime, so the pin is baked in here
10
+ * and `scripts/sync_chromium_version.py --check` re-verifies it against `UPSTREAM_REVISION`
11
+ * (run by the patch-integrity gate), which is what keeps the copy honest.
12
+ *
13
+ * See docs/UPGRADING.md: a routine engine bump is "change UPSTREAM_REVISION, run the sync
14
+ * script, re-apply, rebuild".
15
+ */
16
+ /** Full pinned Chromium version, e.g. `"154.0.8037.57"`. */
17
+ export declare const CHROMIUM_VERSION = "158.0.8127.18";
18
+ /** Major of {@link CHROMIUM_VERSION}, e.g. `154`. The identity contract's `browser_major`. */
19
+ export declare const CHROMIUM_MAJOR = 158;
20
+ /** The UA-reduction form Chromium reports, e.g. `"154.0.0.0"`. */
21
+ export declare const CHROMIUM_UA_VERSION = "158.0.0.0";
22
+ //# sourceMappingURL=chromium-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chromium-version.d.ts","sourceRoot":"","sources":["../src/chromium-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAEhD,8FAA8F;AAC9F,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,kEAAkE;AAClE,eAAO,MAAM,mBAAmB,cAAc,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Single source of truth for the Chromium version this SDK targets.
3
+ *
4
+ * GENERATED FILE — do not edit by hand. Regenerate with:
5
+ *
6
+ * python3 scripts/sync_chromium_version.py
7
+ *
8
+ * The values come from the repository's `UPSTREAM_REVISION` pin. The SDK ships as a
9
+ * standalone package and cannot read that file at runtime, so the pin is baked in here
10
+ * and `scripts/sync_chromium_version.py --check` re-verifies it against `UPSTREAM_REVISION`
11
+ * (run by the patch-integrity gate), which is what keeps the copy honest.
12
+ *
13
+ * See docs/UPGRADING.md: a routine engine bump is "change UPSTREAM_REVISION, run the sync
14
+ * script, re-apply, rebuild".
15
+ */
16
+ /** Full pinned Chromium version, e.g. `"154.0.8037.57"`. */
17
+ export const CHROMIUM_VERSION = "158.0.8127.18";
18
+ /** Major of {@link CHROMIUM_VERSION}, e.g. `154`. The identity contract's `browser_major`. */
19
+ export const CHROMIUM_MAJOR = 158;
20
+ /** The UA-reduction form Chromium reports, e.g. `"154.0.0.0"`. */
21
+ export const CHROMIUM_UA_VERSION = "158.0.0.0";
22
+ //# sourceMappingURL=chromium-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chromium-version.js","sourceRoot":"","sources":["../src/chromium-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEhD,8FAA8F;AAC9F,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAElC,kEAAkE;AAClE,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Hints a caller may send when it asks the cloud to issue an identity (contract ant0#53,
3
+ * docs/PHASE3-CONTRACT.md section 9, `POST /workspaces/:ws/profiles/claim` `hints`).
4
+ *
5
+ * The SDK has no request path to the daemon or the cloud for identities (the daemon owns the claim),
6
+ * so these are types only. The daemon passes the same shape through.
7
+ */
8
+ /** Browser brand a persona may present. */
9
+ export type ClaimBrand = "chrome" | "edge";
10
+ /** Vendor of the claiming host's real GPU. */
11
+ export type ClaimHostGpuVendor = "intel" | "nvidia" | "amd" | "apple";
12
+ /** Locale inputs for the persona, from the profile's proxy. Required when population model V2.2 is requested. */
13
+ export interface ClaimLocale {
14
+ /** BCP 47 tag of the OS language, e.g. "en-US". */
15
+ os_language: string;
16
+ /** IANA timezone, e.g. "America/New_York". */
17
+ timezone: string;
18
+ /** One to eight BCP 47 tags; the cloud moves `os_language` to the front when it is not first. */
19
+ languages?: string[];
20
+ }
21
+ export interface ClaimHints {
22
+ /** `windows`, `macos` or `linux`. */
23
+ os_family?: string;
24
+ browser_major?: number;
25
+ /** Population model version, `^[a-z0-9][a-z0-9._-]{0,63}$`. Fresh issuance only. */
26
+ model_version?: string;
27
+ brand?: ClaimBrand;
28
+ locale?: ClaimLocale;
29
+ /** Whether the claiming host presents its real GPU (default false). */
30
+ host_gpu?: boolean;
31
+ host_gpu_vendor?: ClaimHostGpuVendor;
32
+ /** The engine's `--ant0-sdk-info` `persona.capabilities`: at most 64 ids matching `^[a-z0-9_.]{1,64}$`, no
33
+ * duplicates. Sent with a model version; the newest model refuses a claim without it. */
34
+ engine_capabilities?: string[];
35
+ }
36
+ //# sourceMappingURL=claim-hints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim-hints.d.ts","sourceRoot":"","sources":["../src/claim-hints.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,2CAA2C;AAC3C,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC;AAC3C,8CAA8C;AAC9C,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;AAEtE,iHAAiH;AACjH,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,iGAAiG;IACjG,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oFAAoF;IACpF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,kBAAkB,CAAC;IACrC;6FACyF;IACzF,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Hints a caller may send when it asks the cloud to issue an identity (contract ant0#53,
3
+ * docs/PHASE3-CONTRACT.md section 9, `POST /workspaces/:ws/profiles/claim` `hints`).
4
+ *
5
+ * The SDK has no request path to the daemon or the cloud for identities (the daemon owns the claim),
6
+ * so these are types only. The daemon passes the same shape through.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=claim-hints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim-hints.js","sourceRoot":"","sources":["../src/claim-hints.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,35 @@
1
+ import type { ChildProcess } from "node:child_process";
2
+ /** Exit-time budget: at most about this long per temp dir ... */
3
+ export declare const EXIT_DIR_BUDGET_MS = 1000;
4
+ /** ... and about this long across all dirs in one exit. When it runs out we give up and accept the
5
+ * leak (an `exit` handler must not hang the process). */
6
+ export declare const EXIT_TOTAL_BUDGET_MS = 3000;
7
+ export interface Tracked {
8
+ proc: ChildProcess;
9
+ /** Set ONLY for a temp dir the SDK created itself (serve/plan). Never a caller-supplied or
10
+ * persistent profile dir, which is left alone even when the SDK launched the browser. */
11
+ ownDir?: string;
12
+ }
13
+ export declare const tracked: Set<Tracked>;
14
+ /** Sleep without spinning: Atomics.wait on a private SharedArrayBuffer blocks the thread. */
15
+ export declare function sleepSync(ms: number): void;
16
+ /** Injection points so the budget can be tested with a dir that cannot be removed. */
17
+ export interface ExitOps {
18
+ rm(dir: string): void;
19
+ exists(dir: string): boolean;
20
+ sleep(ms: number): void;
21
+ now(): number;
22
+ }
23
+ /** Runs inside the "exit" event, so it is SYNCHRONOUS (process.kill, fs.rmSync and a blocking sleep
24
+ * only; anything awaited or promise-based never runs there). Bounded: about EXIT_DIR_BUDGET_MS per
25
+ * dir and EXIT_TOTAL_BUDGET_MS in all. */
26
+ export declare function runExitCleanup(entries?: Iterable<Tracked>, ops?: ExitOps): void;
27
+ export declare function track(proc: ChildProcess, ownDir?: string): Tracked;
28
+ export declare function untrack(entry: Tracked): void;
29
+ /** Remove a profile dir we created. Retries because a browser that is still shutting down can
30
+ * recreate files for a moment; never throws. */
31
+ export declare function removeOwnDir(dir: string): Promise<void>;
32
+ /** Stop a child we spawned and wait until it has exited: SIGTERM first (a graceful shutdown, so a
33
+ * persistent profile keeps its writes), SIGKILL only as a fallback after `graceMs`. */
34
+ export declare function stopChild(proc: ChildProcess, graceMs?: number, killMs?: number): Promise<void>;
35
+ //# sourceMappingURL=cleanup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../src/cleanup.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,iEAAiE;AACjE,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC;yDACyD;AACzD,eAAO,MAAM,oBAAoB,OAAO,CAAC;AASzC,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,YAAY,CAAC;IACnB;6FACyF;IACzF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AACD,eAAO,MAAM,OAAO,cAAqB,CAAC;AAE1C,6FAA6F;AAC7F,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,sFAAsF;AACtF,MAAM,WAAW,OAAO;IACtB,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,GAAG,IAAI,MAAM,CAAC;CACf;AAkBD;;0CAE0C;AAC1C,wBAAgB,cAAc,CAAC,OAAO,GAAE,QAAQ,CAAC,OAAO,CAAW,EAAE,GAAG,GAAE,OAAiB,GAAG,IAAI,CAoBjG;AAKD,wBAAgB,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAKlE;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAG5C;AAED;gDACgD;AAChD,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK7D;AAED;uFACuF;AACvF,wBAAsB,SAAS,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,SAAO,EAAE,MAAM,SAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAUhG"}