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
@@ -0,0 +1,281 @@
1
+ import { type ChildProcess, type SpawnOptions } from "node:child_process";
2
+ import type { Browser, BrowserContext, BrowserContextOptions, LaunchOptions as PlaywrightLaunchOptions } from "playwright-core";
3
+ import { type DownloadOptions } from "./download.js";
4
+ import { type Identity } from "./identity.js";
5
+ import { type HumanizeOptions } from "./humanize.js";
6
+ import { fetchWidevine, seedWidevine } from "./widevine.js";
7
+ export { resolveFontPack, packFamilies, PACK_VERSION as FONT_PACK_VERSION } from "./fontpack.js";
8
+ import { type ShaderDialect } from "./shaderdialect.js";
9
+ import { type LaunchTicketOption } from "./launch-ticket.js";
10
+ import type { RuntimeOptions } from "./runtime-client.js";
11
+ export { RuntimeError, type RuntimeOptions } from "./runtime-client.js";
12
+ export { SdkError, SdkInputError, SdkTypeError, SdkRangeError, reportFields, type CodedError, type ErrorClass } from "./errors.js";
13
+ export type { DownloadOptions } from "./download.js";
14
+ export { checkInstall, verifyInstall } from "./download.js";
15
+ export { resolveGeo, type Geo } from "./geoip.js";
16
+ export type { HumanizeOptions } from "./humanize.js";
17
+ export { installHumanizeOnContext } from "./humanize.js";
18
+ export { mulberry32, hashSeed, gaussFrom, makePersona, clickHold, keyDwell, minJerk, planMove, dragDwell, clickPoint, planAmbient, type Rng, type Persona, type Point, type Step, type PlanOpts, type Box, type Viewport, } from "./motion.js";
19
+ export { RELEASE, RELEASE_PUBLIC_KEY } from "./release.js";
20
+ export { installRelease, installedRelease, verifyMinisign, ReleaseError, SignatureError, type InstallReleaseOptions, type InstallProgress, type InstallProgressCallback } from "./release-fetch.js";
21
+ export { fetchWidevine, seedWidevine } from "./widevine.js";
22
+ export { checkRenderCoherence, type RenderVerdict } from "./render.js";
23
+ export { setContent, type SetContentOptions } from "./content.js";
24
+ export { PersonaFileRejectedError, personaFileRejection, PERSONA_FILE_EXIT_CODE, PERSONA_FILE_REJECTED_CODE } from "./persona-rejected.js";
25
+ export { LaunchTicketRejectedError, LaunchTicketUnavailableError, launchTicketRejection, fetchLaunchTicket, discoverDaemon, resolveDaemonHome, inferEngineVersion, installedEngineVersion, resolveLaunchTicketArgs, hasLaunchTicketArg, LAUNCH_TICKET_SWITCH, LAUNCH_TICKET_ENV, LAUNCH_TICKET_EXIT_CODE, LAUNCH_TICKET_REJECTED_CODE, ENGINE_VERSION_ENV, type LaunchTicketOption, type DaemonLocation, } from "./launch-ticket.js";
26
+ export { assertPersonaProfileV2, parsePersonaProfileV2, validatePersonaProfileV2, InvalidPersonaProfileV2Error, WEBGL_PARAMETER_NAMES, WEBGPU_LIMIT_NAMES, type PersonaProfileV2, type PersonaProfileValidationError, type PersonaProfileValidationErrorCode, type PersonaProfileValidationResult, type PersonaMetadata, type PersonaCompatibility, type PersonaHardware, type PersonaDisplay, type PersonaLocale, type PersonaGraphics, type PersonaWebGL, type PersonaWebGLVersion, type PersonaWebGPU, type PersonaAudio, type PersonaFonts, type PersonaSpeech, type PersonaVoice, type PersonaMedia, type PersonaCodec, type PersonaMediaDevice, type WebGLParameterName, type WebGLValue, type WebGPULimitName, } from "./persona-profile-v2.js";
27
+ export { CHROMIUM_VERSION, CHROMIUM_MAJOR, CHROMIUM_UA_VERSION } from "./chromium-version.js";
28
+ export { migratePersonaBrowserMajor, needsMigration, personaBrowserMajor, PersonaMigrationError, MIGRATED_FIELDS, } from "./persona-migration.js";
29
+ export { selectPersonaTemplate, type PersonaTemplate, } from "./template-selection.js";
30
+ export { GENERATE_ALGORITHM, GENERATION_ORDER, PopulationModelError, loadPopulationModel, generatePersonaProfile, type PopulationModel, type PopulationModelValue, } from "./population-model.js";
31
+ export { IDENTITY_WRAPPER_VERSION, GENERATED_IDENTITY_WRAPPER_VERSION, TEMPLATE_SELECTION_ALGORITHM, GENERATE_ALGORITHM as GENERATE_IDENTITY_ALGORITHM, IdentityPersistenceError, resolveIdentityDirectory, identityFilename, loadOrCreateDeviceKey, validatePersistedIdentity, loadPersistedIdentity, createOrLoadIdentity, createOrLoadGeneratedIdentity, createOrLoadIssuedIdentity, ISSUED_IDENTITY_WRAPPER_VERSION, type IssuedIdentityRecord, type IssuedPersistedIdentity, type PersistedIdentity, type GeneratedPersistedIdentity, type AnyPersistedIdentity, type IdentityPersistenceOptions, } from "./identity-persistence.js";
32
+ export { CANVAS_NOISE_KEY_SWITCH, CANVAS_NOISE_KEY_LENGTH, CANVAS_NOISE_KEY_DOMAIN, canvasMode, isCanvasNoiseKey, newCanvasNoiseKey, deriveCanvasNoiseKey, canvasNoiseKeyFor, type CanvasMode, } from "./canvas.js";
33
+ export { canvasNoiseKeyOfIdentity } from "./identity.js";
34
+ export { assertPersonaProfileV4, isPersonaV4, PersonaV4SchemaError, type PersonaProfileV4 } from "./persona-profile-v4.js";
35
+ export { PROFILE_FILE_SWITCH, SDK_INFO_SWITCH, PROFILE_FILE_NAME, enginePersonaInfo, enginePersonaSchemas, parseSdkInfoSchemas, writePersonaProfileFile, type EnginePersonaInfo, } from "./profile-file.js";
36
+ export type { ClaimHints, ClaimLocale, ClaimBrand, ClaimHostGpuVendor } from "./claim-hints.js";
37
+ export { loadTemplateDirectory, loadCapturedProfile, resolveIdentity, prepareIdentityOptions, type Identity, type NativeIdentity, type CapturedIdentity, type SyntheticIdentity, type IdentityOverrides, type NetworkOverride, type ResolvedIdentity, type PreparedIdentityOptions, } from "./identity.js";
38
+ /** When true (and a proxy is set), resolve the proxy's exit-IP geo and auto-fill any unset
39
+ * `timezone` + `acceptLanguage` (+ `location`) so they match the proxy region. */
40
+ interface IdentityOption {
41
+ /** Strict public identity mode. Omitted means native. */
42
+ identity?: Identity;
43
+ /** Explicit identity switches. These take precedence over captured/synthetic profile fields. */
44
+ overrides?: import("./identity.js").IdentityOverrides;
45
+ }
46
+ /** Load unpacked extensions (emits --load-extension + --disable-extensions-except). */
47
+ interface ExtensionsOption {
48
+ /** Unpacked-extension directory paths. */
49
+ extensions?: string[];
50
+ /** Disable Privacy Sandbox APIs (Topics/FLEDGE/Shared Storage/Fenced Frames).
51
+ *
52
+ * Default `false` since 0.23.0 — real Google Chrome ships all of them, and the default persona
53
+ * (`brand: "chrome"`) claims to be Google Chrome, so disabling them was a coherence tell rather
54
+ * than a privacy win. Set `true` when the persona genuinely is de-Googled Chromium. */
55
+ disablePrivacySandbox?: boolean;
56
+ }
57
+ /** Profile-directory control for {@link launch}. */
58
+ interface EphemeralProfileOption {
59
+ /** Launch on a throwaway persistent profile that is deleted on close. Default `true` since
60
+ * 0.23.0 — incognito cannot load the Widevine CDM, which is itself a tell. Set `false` for the
61
+ * pre-0.23 incognito launch. */
62
+ ephemeralProfile?: boolean;
63
+ /** Keep a profile at this path instead of a throwaway one (delegates to
64
+ * {@link launchPersistentContext}; the directory is NOT deleted). */
65
+ userDataDir?: string;
66
+ }
67
+ /** Opt-in shader-dialect reporting (see ./shaderdialect.ts). */
68
+ interface ShaderDialectOption {
69
+ /** Report ANGLE's translated shader in this dialect for
70
+ * `WEBGL_debug_shaders.getTranslatedShaderSource()`.
71
+ *
72
+ * `"hlsl"` makes a Windows persona on a Linux host report HLSL, matching the Direct3D renderer
73
+ * string it already advertises — without it the Vulkan backend answers with SPIR-V and the two
74
+ * values contradict each other. Rendering is unaffected.
75
+ *
76
+ * OFF by default: the re-translation is a different code path from the one that rendered, so a
77
+ * shader the real backend accepts but the HLSL translator rejects falls back to the honest
78
+ * dialect. Turn it on if you hit this specific check. Requires engine support. */
79
+ shaderDialect?: ShaderDialect;
80
+ }
81
+ /** Opt-in SOCKS5 UDP relaying (see {@link socks5UdpArgs}). */
82
+ interface Socks5UdpOption {
83
+ /** Ask for WebRTC UDP to be relayed through the SOCKS5 proxy (UDP ASSOCIATE).
84
+ *
85
+ * NOT IMPLEMENTED BY THE ENGINE: the `--socks5-udp` switch this sends is ignored by every engine
86
+ * release so far, so setting it changes nothing. Non-proxied UDP stays denied and peer
87
+ * connections that need UDP still fail. Kept for compatibility until the engine supports it.
88
+ *
89
+ * Applies only to a `socks5://` proxy; ignored otherwise. */
90
+ socks5Udp?: boolean;
91
+ }
92
+ /** Options for {@link launch}: Playwright launch options plus local Ant0 Browser controls. */
93
+ /** Auto-wire the real Windows font pack on Linux for a persona. */
94
+ interface FontResolveOption {
95
+ /** On Linux, wire the real Windows font pack (see fontpack.ts) so a captured/synthetic persona
96
+ * renders real fonts with correct metrics (~200 families) instead of the handful a bare host
97
+ * ships. On by default; a no-op without a pack (falls back to the bundled clones). Windows hosts
98
+ * already have the fonts. */
99
+ resolveFonts?: boolean;
100
+ }
101
+ export interface LaunchOptions extends PlaywrightLaunchOptions, IdentityOption, ExtensionsOption, EphemeralProfileOption, HumanizeOptions, DownloadOptions, ShaderDialectOption, Socks5UdpOption, FontResolveOption, LaunchTicketOption {
102
+ }
103
+ /** Options for {@link launchPersistentContext}. */
104
+ export interface PersistentContextOptions extends PlaywrightLaunchOptions, BrowserContextOptions, IdentityOption, ExtensionsOption, HumanizeOptions, DownloadOptions, ShaderDialectOption, Socks5UdpOption, FontResolveOption, LaunchTicketOption {
105
+ /**
106
+ * Seed + enable the opt-in Widevine CDM in this profile so DRM/EME works
107
+ * (`requestMediaKeySystemAccess('com.widevine.alpha')` resolves) and the EME surface matches a
108
+ * real Chrome instead of being a no-Widevine tell. The CDM is fetched once from Google's
109
+ * component server (see {@link fetchWidevine}); ant0-browser never bundles Google's blob.
110
+ */
111
+ widevine?: boolean;
112
+ }
113
+ /** Resolve the installed default without fetching a ticket. The returned path is informational;
114
+ * launch/serve resolve again and retain native proof through their immediate spawn. */
115
+ export declare function executablePath(options?: {
116
+ executablePath?: string;
117
+ runtime?: RuntimeOptions;
118
+ engineVersion?: string;
119
+ } & DownloadOptions): Promise<string>;
120
+ /**
121
+ * Launch Ant0 Browser and return a Playwright browser handle backed by a REAL Chrome profile.
122
+ *
123
+ * PROFILE-BACKED BY DEFAULT (changed in 0.23.0). This used to be `chromium.launch()` — incognito,
124
+ * no profile directory. Incognito cannot load a component-updated CDM, so
125
+ * `requestMediaKeySystemAccess('com.widevine.alpha')` rejected and the EME surface was a
126
+ * no-Widevine tell on a build branded Google Chrome (measured against the live audit on 150-r10).
127
+ * It now launches a persistent context on a throwaway directory, so `widevine: true` works here.
128
+ *
129
+ * The directory is deleted when the context closes AND on process exit, so nothing is left behind
130
+ * and no state survives to the next launch — the incognito-like isolation callers relied on is
131
+ * preserved. Pass `userDataDir` to keep a profile, or `ephemeralProfile: false` to opt back out.
132
+ */
133
+ export declare function launch(options?: LaunchOptions): Promise<Browser>;
134
+ /**
135
+ * Launch Ant0 Browser with a persistent profile directory and return a Playwright
136
+ * {@link BrowserContext} (cookies, storage, etc. persist in `userDataDir`).
137
+ */
138
+ export declare function launchPersistentContext(userDataDir: string, options?: PersistentContextOptions): Promise<BrowserContext>;
139
+ export interface ServeOptions extends LaunchOptions {
140
+ /** CDP port (default: a free ephemeral port; pass 9222 for the conventional one). */
141
+ port?: number;
142
+ /** Bind address — keep it loopback (default 127.0.0.1) for stealth + safety. */
143
+ host?: string;
144
+ /** `--remote-allow-origins` value (default: the loopback origins only; "*" for trusted local use). */
145
+ allowOrigins?: string;
146
+ /** Persistent profile dir (default: a fresh temp dir, removed on close). */
147
+ userDataDir?: string;
148
+ /** Run headless (default true; false for a visible window). */
149
+ headless?: boolean;
150
+ /** How long to wait for the CDP endpoint to come up (ms; default 30000). */
151
+ readyTimeoutMs?: number;
152
+ /** Seed the Widevine CDM into the served profile (as `launchPersistentContext` does) and add the
153
+ * switches the engine needs to register it. Best-effort: a failure leaves DRM off. */
154
+ widevine?: boolean;
155
+ }
156
+ /**
157
+ * Everything {@link serve} resolves BEFORE it spawns the binary, for a supervisor that must own the
158
+ * child process itself (exit codes, stderr capture, SIGKILL fallback, pid) while launching exactly
159
+ * the stealth configuration `serve()` would: identity, fingerprint switches, proxy routing,
160
+ * extensions, font wiring, shader dialect, and the CDP switches.
161
+ */
162
+ export interface LaunchPlan {
163
+ /** Resolved binary path (after {@link executablePath} + the host-platform check). */
164
+ executable: string;
165
+ /** Engine args, then the CDP + first-run hygiene switches, then `about:blank` when the caller
166
+ * passed no URL positional — exactly what `serve()` passes to `spawn`. */
167
+ args: string[];
168
+ /** The environment `serve()` spawns with: `process.env`, then the font wiring, then the caller's
169
+ * `env` (a variable the caller sets to `undefined` is removed), then the shader dialect, then the launch ticket in
170
+ * `ANT0_LAUNCH` (the same value as the `--ant0-launch=` in `args`; a caller's own `ANT0_LAUNCH` or `--ant0-launch=` is
171
+ * never overwritten, and the one that is missing is filled from the other). Entries
172
+ * whose value is `undefined` or `null` are dropped; the rest are stringified. */
173
+ env: Record<string, string>;
174
+ /** Resolved profile directory. A fresh temp dir is created when the caller passed none. */
175
+ userDataDir: string;
176
+ /** True when the plan created `userDataDir`; the caller is then responsible for removing it. */
177
+ ownUserDataDir: boolean;
178
+ /** Resolved CDP bind address. */
179
+ host: string;
180
+ /** Resolved CDP port (a free ephemeral one when the caller passed none). */
181
+ port: number;
182
+ /** `http://host:port` — the CDP HTTP base once the browser is up. */
183
+ cdpUrl: string;
184
+ identityMode: "native" | "captured" | "synthetic";
185
+ headless: boolean;
186
+ /** Absolute path of the persona file written for a schema 4 persona (inside `userDataDir`), else
187
+ * undefined. The engine reads it once at startup: call {@link removePersonaFile} when the browser is
188
+ * up (or when the launch failed or the process exited). The next launch also removes a stale one. */
189
+ personaFile?: string;
190
+ /** Delete {@link personaFile}. Idempotent; a no-op without a schema 4 persona. */
191
+ removePersonaFile(): void;
192
+ /** Fresh verification for this spawn; use for automatic discovery. Raw fields are a snapshot. */
193
+ spawn?(options?: Pick<SpawnOptions, "stdio" | "detached" | "cwd">): Promise<ChildProcess>;
194
+ }
195
+ /**
196
+ * Stale tickets: unlike {@link serve}, a plan cannot retry for you. If your child exits 90 with `claim_expired` or
197
+ * `claim_stale` and the ticket was the SDK-fetched one (you passed no ticket of your own), build a fresh plan (or call
198
+ * `plan.spawn()` again, which fetches a new ticket) and respawn ONCE; do not retry any other reason.
199
+ *
200
+ * Resolve a {@link LaunchPlan} from {@link ServeOptions} without launching anything. This is the
201
+ * first half of {@link serve}; a supervisor spawns `plan.executable` with `plan.args` and
202
+ * `plan.env`, polls `plan.cdpUrl + "/json/version"` for readiness, and removes `plan.userDataDir`
203
+ * on exit when `plan.ownUserDataDir` is true. Side effects: may create the temp profile dir and,
204
+ * on Linux with a persona, resolve (and on first run download) the font pack.
205
+ *
206
+ * Spawn window: the plan carries a launch ticket that engines from ant0.11 accept only for about 5 minutes after it
207
+ * was issued. Spawn the plan promptly, and call `launchPlan` again for every (re)spawn; never respawn from an old plan.
208
+ */
209
+ export declare function launchPlan(options?: ServeOptions): Promise<LaunchPlan>;
210
+ /** Handle for a standing ant0-browser CDP endpoint. Use `.cdpUrl` with any CDP client.
211
+ *
212
+ * Cleanup: call `close()`. Ctrl+C / SIGTERM cleanup is the application's job (the SDK installs no
213
+ * signal handlers). If the process exits without it, an exit hook stops the browser (SIGTERM) and
214
+ * removes the temp profile dir `serve()` created; a `userDataDir` you passed is never deleted. */
215
+ export declare class Server {
216
+ private readonly proc;
217
+ readonly host: string;
218
+ readonly port: number;
219
+ private readonly userDataDir;
220
+ private readonly ownUdd;
221
+ /** @internal How long close() waits after SIGTERM before it falls back to SIGKILL. */
222
+ private readonly graceMs;
223
+ /** OS process id of the browser (undefined only if the spawn never produced one). */
224
+ readonly pid: number | undefined;
225
+ private closing;
226
+ private readonly entry;
227
+ constructor(proc: ChildProcess, host: string, port: number, userDataDir: string, ownUdd: boolean,
228
+ /** @internal How long close() waits after SIGTERM before it falls back to SIGKILL. */
229
+ graceMs?: number);
230
+ /** HTTP CDP base — pass to `connectOverCDP` / `puppeteer.connect({ browserURL })`. */
231
+ get cdpUrl(): string;
232
+ /** The browser-level WebSocket URL (for clients that want `connect({ browserWSEndpoint })`). */
233
+ wsUrl(): Promise<string | undefined>;
234
+ isAlive(): boolean;
235
+ /** Stop the browser (SIGTERM, SIGKILL only after a timeout), wait for it to exit, then remove the
236
+ * temp profile dir if serve() created it. The server stays registered for the exit hook until all
237
+ * of that has finished, so `srv.close(); process.exit(0)` without await still cleans up. */
238
+ close(): Promise<void>;
239
+ }
240
+ /**
241
+ * Launch Ant0 Browser with a RAW CDP endpoint and return a {@link Server}. Unlike {@link launch}, `serve`
242
+ * leaves a standing browser any client attaches to with no code change:
243
+ * ```ts
244
+ * const srv = await serve({ identity: { mode: "native" } });
245
+ * const browser = await chromium.connectOverCDP(srv.cdpUrl); // Playwright
246
+ * // or: await puppeteer.connect({ browserURL: srv.cdpUrl }); // Puppeteer
247
+ * // or: point browser-use / Crawl4AI / Stagehand at srv.cdpUrl
248
+ * await srv.close();
249
+ * ```
250
+ * Stays stealthy: the binary is launched **directly** (not through Playwright/Puppeteer), so the
251
+ * `--enable-automation` flag those frameworks add is never present and `navigator.webdriver` stays
252
+ * `false`; the engine's `Runtime.enable` patch (110) stops `Runtime.enable` from running page code
253
+ * (no console-argument serialization, live or replayed, so no getter, Proxy trap or `toString`
254
+ * fires), which removes the best-known CDP tell. It does not make an attached client
255
+ * undetectable: whatever the client itself adds (init scripts, exposed bindings, emulation
256
+ * overrides, other CDP domains) is still its own to hide; the port binds to loopback with an origin
257
+ * allowlist; attaching over CDP adds no launch flags, so the served persona is preserved end to end.
258
+ *
259
+ * First-run hygiene: Playwright's `launch()` passes `--no-first-run`, `--no-default-browser-check`
260
+ * and `--disable-search-engine-choice-screen` on its own; `serve()`/`launchPlan()` add the same
261
+ * three switches (plain UI switches, no `base::Feature` toggles, nothing a page can observe) and,
262
+ * when the caller passes no URL positional in `args`, open `about:blank`. Without them the
263
+ * ungoogled-chromium base opens `chrome://ungoogled-first-run` in the first tab.
264
+ *
265
+ * To own the child process yourself (a daemon supervising exit codes, stderr, kill escalation),
266
+ * call {@link launchPlan} with the same options and spawn from the returned plan instead.
267
+ */
268
+ export declare function serve(options?: ServeOptions): Promise<Server>;
269
+ declare const _default: {
270
+ launch: typeof launch;
271
+ launchPersistentContext: typeof launchPersistentContext;
272
+ serve: typeof serve;
273
+ launchPlan: typeof launchPlan;
274
+ Server: typeof Server;
275
+ executablePath: typeof executablePath;
276
+ fetchWidevine: typeof fetchWidevine;
277
+ seedWidevine: typeof seedWidevine;
278
+ RELEASE: import("./release.js").ReleaseInfo;
279
+ };
280
+ export default _default;
281
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAS,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIjF,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,aAAa,IAAI,uBAAuB,EA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