clearcote 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -158,13 +158,40 @@ All optional. Anything not listed here is passed straight through to Playwright
158
158
  | `disableGpuFingerprint` | `--disable-gpu-fingerprint` | Turn off GPU/WebGL spoofing. |
159
159
  | `geoip` | _(directive)_ | `true` → resolve the proxy's exit-IP geo and auto-fill timezone/acceptLanguage/location/**webrtcIp**. |
160
160
  | `fingerprintProfile` | `--fingerprint-profile` | A real machine's captured fingerprint (file path / object / JSON string; the SDK gzip+base64-encodes it). Fields present override the seed-derived persona; absent fields fall back to `fingerprint`. |
161
+ | `canvasBridge` | `--canvas-bridge-*` | Forward canvas/WebGL readbacks to a remote real-GPU host so the pixels a page hashes match the GPU your persona claims. `{ url, auth?, mode?, allow?, deny?, fallback? }`; setting `url` auto-adds `--no-sandbox`. See [docs/CANVAS-BRIDGE.md](../../docs/CANVAS-BRIDGE.md). |
162
+
163
+ ## Saved profiles (`Profile`)
164
+
165
+ A `Profile` bundles a persona (seed, GPU, brand, …) **and** its `canvasBridge` config under one
166
+ name you can persist and re-launch — so the claimed GPU, the bridge endpoint, and the bridge's
167
+ GPU-keyed cache stay coherent because they travel together.
168
+
169
+ ```ts
170
+ import { Profile, launch } from "clearcote";
171
+
172
+ // save once
173
+ await new Profile("acct-1", {
174
+ fingerprint: "acct-1",
175
+ gpuVendor: "Google Inc. (Intel)",
176
+ gpuRenderer: "ANGLE (Intel, Intel(R) UHD Graphics ... D3D11)",
177
+ canvasBridge: { url: "ws://127.0.0.1:9099", auth: "user:secret" },
178
+ }).save();
179
+
180
+ // re-launch anywhere (explicit options override the saved ones)
181
+ const browser = await Profile.load("acct-1").launch({ headless: false });
182
+ // equivalently: await launch({ profile: "acct-1" });
183
+ ```
184
+
185
+ Profiles are JSON at `~/.clearcote/profiles/<name>.json` (set `CLEARCOTE_PROFILE_DIR` to relocate).
161
186
 
162
187
  ## API
163
188
 
164
- - `launch(options?)` → `Promise<Browser>` — launch and get a Playwright `Browser`.
189
+ - `launch(options?)` → `Promise<Browser>` — launch and get a Playwright `Browser`. Pass `profile` (a name, path, or `Profile`) to launch a saved persona.
165
190
  - `launchPersistentContext(userDataDir, options?)` → `Promise<BrowserContext>`.
166
191
  - `executablePath(options?)` → `Promise<string>` — resolve (download/verify if needed) the chrome.exe path, e.g. for raw `chromium.launch({ executablePath })`.
167
192
  - `download(options?)` → `Promise<string>` — pre-fetch + verify the binary without launching.
193
+ - `Profile` — `new Profile(name, options)`, `.save(path?)`, `Profile.load(name)`, `.launch(overrides?)`, `.launchPersistentContext(dir, overrides?)`.
194
+ - `listProfiles()` → `string[]`, `loadProfile(name)` → `Profile`.
168
195
  - `RELEASE` — the pinned release metadata (tag, version, sha256).
169
196
 
170
197
  ## Binary resolution & verification
@@ -66,7 +66,33 @@ export interface FingerprintOptions {
66
66
  * machine or incognito; set a realistic on-disk value (e.g. `250000` for ~244 GB).
67
67
  */
68
68
  storageQuota?: number;
69
+ /**
70
+ * Canvas bridge — forward canvas/WebGL readbacks to a remote real-GPU host so the pixels a page
71
+ * hashes are coherent with the GPU your persona claims. Setting `url` enables it and auto-adds
72
+ * `--no-sandbox` (the bridge opens its socket from the renderer process).
73
+ *
74
+ * Latency note: a synchronous readback over the bridge is a network round-trip on the renderer
75
+ * thread (a timing signal vs latency-aware detectors). Mitigations are built in — the engine
76
+ * prefetches+caches so deferred/animated/repeated reads don't block — and you can tune behavior
77
+ * here: `mode` restricts bridging to the origins where canvas coherence is actually scored, and
78
+ * `fallback: "local"` makes a cold cache miss serve the fast local render instead of stalling.
79
+ */
80
+ canvasBridge?: {
81
+ /** Bridge endpoint, "ws://host:port[/path]". Required to enable the bridge. */
82
+ url: string;
83
+ /** HTTP Basic credentials "user:secret"; must match the server. */
84
+ auth?: string;
85
+ /** Per-origin policy: "off" | "all" (default) | "allow" | "deny". */
86
+ mode?: "off" | "all" | "allow" | "deny";
87
+ /** eTLD+1 list bridged when mode="allow". */
88
+ allow?: string[];
89
+ /** eTLD+1 list NOT bridged when mode="deny". */
90
+ deny?: string[];
91
+ /** Cold cache-miss behavior: "block" (default) | "local" (never stall; render locally). */
92
+ fallback?: "block" | "local";
93
+ };
69
94
  }
95
+ export declare const FINGERPRINT_KEYS: (keyof FingerprintOptions)[];
70
96
  /** Split an options object into its fingerprint half and the remaining (Playwright) half. */
71
97
  export declare function splitFingerprintOptions<T extends FingerprintOptions>(options: T): {
72
98
  fingerprint: FingerprintOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"fingerprint.d.ts","sourceRoot":"","sources":["../src/fingerprint.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;IACzC,qDAAqD;IACrD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oCAAoC;IACpC,KAAK,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAChE,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;;;;;;OAaG;IACH,qBAAqB,CAAC,EAA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7F,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,kBAAkB,EAClE,OAAO,EAAE,CAAC,GACT;IAAE,WAAW,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,MAAM,kBAAkB,CAAC,CAAA;CAAE,CAW9E;AAED;;uEAEuE;AACvE,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAMrD;AAED;;sGAEsG;AACtG,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAU7E;AAED;8FAC8F;AAC9F,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,CAajG;AAED,oEAAoE;AACpE,wBAAgB,eAAe,CAAC,CAAC,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAgE/D"}
@@ -2,7 +2,7 @@
2
2
  // Switch names mirror components/ungoogled/ungoogled_switches.cc (see patches/000-fingerprint-switches.patch).
3
3
  import { gzipSync } from "node:zlib";
4
4
  import { existsSync, readFileSync } from "node:fs";
5
- const FINGERPRINT_KEYS = [
5
+ export const FINGERPRINT_KEYS = [
6
6
  "fingerprint",
7
7
  "platform",
8
8
  "platformVersion",
@@ -19,6 +19,7 @@ const FINGERPRINT_KEYS = [
19
19
  "fingerprintNoise",
20
20
  "fingerprintProfile",
21
21
  "storageQuota",
22
+ "canvasBridge",
22
23
  ];
23
24
  /** Split an options object into its fingerprint half and the remaining (Playwright) half. */
24
25
  export function splitFingerprintOptions(options) {
@@ -90,7 +91,10 @@ export function fingerprintArgs(o) {
90
91
  }
91
92
  };
92
93
  set("fingerprint", o.fingerprint);
93
- set("fingerprint-platform", o.platform);
94
+ // clearcote ships a Windows x64 binary and should always present a coherent Windows + Chrome
95
+ // identity by default; default the persona platform to Windows when the caller doesn't pass one
96
+ // (rather than a seed-derived OS that could vary). Override via platform: "linux" | "macos".
97
+ set("fingerprint-platform", o.platform ?? "windows");
94
98
  set("fingerprint-platform-version", o.platformVersion);
95
99
  // clearcote presents as Google Chrome (its UA says "Chrome/<v>"); default the UA-CH brand to
96
100
  // "chrome" so navigator.userAgentData advertises "Google Chrome", not bare "Chromium" (a
@@ -133,6 +137,24 @@ export function fingerprintArgs(o) {
133
137
  // back to the seed, so partial profiles stay coherent.
134
138
  if (o.fingerprintProfile)
135
139
  args.push(`--fingerprint-profile=${encodeProfile(o.fingerprintProfile)}`);
140
+ // Canvas bridge: forward canvas/WebGL readbacks to a remote real-GPU host. Enabling it
141
+ // (url set) requires --no-sandbox (the bridge opens its socket from the renderer process).
142
+ if (o.canvasBridge?.url) {
143
+ const cb = o.canvasBridge;
144
+ args.push(`--canvas-bridge-url=${cb.url}`);
145
+ if (cb.auth)
146
+ args.push(`--canvas-bridge-auth=${cb.auth}`);
147
+ if (cb.mode)
148
+ args.push(`--canvas-bridge-mode=${cb.mode}`);
149
+ if (cb.allow?.length)
150
+ args.push(`--canvas-bridge-allow=${cb.allow.join(",")}`);
151
+ if (cb.deny?.length)
152
+ args.push(`--canvas-bridge-deny=${cb.deny.join(",")}`);
153
+ if (cb.fallback)
154
+ args.push(`--canvas-bridge-fallback=${cb.fallback}`);
155
+ if (!args.includes("--no-sandbox"))
156
+ args.push("--no-sandbox");
157
+ }
136
158
  return args;
137
159
  }
138
160
  //# sourceMappingURL=fingerprint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fingerprint.js","sourceRoot":"","sources":["../src/fingerprint.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,+GAA+G;AAE/G,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAwEnD,MAAM,gBAAgB,GAAiC;IACrD,aAAa;IACb,UAAU;IACV,iBAAiB;IACjB,OAAO;IACP,cAAc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,CAAC,IAAI,EAAE,MAAM;YAAE,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5E,IAAI,EAAE,CAAC,QAAQ;YAAE,IAAI,CAAC,IAAI,CAAC,4BAA4B,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QACtE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3,10 +3,12 @@ import { type DownloadOptions } from "./download.js";
3
3
  import { type FingerprintOptions } from "./fingerprint.js";
4
4
  import { type HumanizeOptions } from "./humanize.js";
5
5
  import { type AgentOptions } from "./agent.js";
6
+ import { Profile } from "./profile.js";
6
7
  export type { FingerprintOptions } from "./fingerprint.js";
7
8
  export type { DownloadOptions } from "./download.js";
8
9
  export { resolveGeo, type Geo } from "./geoip.js";
9
10
  export type { HumanizeOptions } from "./humanize.js";
11
+ export { Profile, listProfiles, loadProfile, PROFILE_DIR, type ProfileOptions } from "./profile.js";
10
12
  export { runAgentTask, agentArgs, OPENROUTER_BASE_URL, type AgentOptions, type AgentTaskOptions, type AgentTaskResult, type AgentStep, } from "./agent.js";
11
13
  export { RELEASE } from "./release.js";
12
14
  /** When true (and a proxy is set), resolve the proxy's exit-IP geo and auto-fill any unset
@@ -14,11 +16,17 @@ export { RELEASE } from "./release.js";
14
16
  interface GeoipOption {
15
17
  geoip?: boolean;
16
18
  }
19
+ /** When set, launch a saved persona ({@link Profile}) — by name (under `CLEARCOTE_PROFILE_DIR`),
20
+ * by path, or a `Profile` instance. Its saved options form the base; any options passed alongside
21
+ * here override them. */
22
+ interface ProfileOption {
23
+ profile?: string | Profile;
24
+ }
17
25
  /** Options for {@link launch}: Playwright launch options + Clearcote fingerprint + agent + download options. */
18
- export interface LaunchOptions extends PlaywrightLaunchOptions, FingerprintOptions, AgentOptions, GeoipOption, HumanizeOptions, DownloadOptions {
26
+ export interface LaunchOptions extends PlaywrightLaunchOptions, FingerprintOptions, AgentOptions, GeoipOption, ProfileOption, HumanizeOptions, DownloadOptions {
19
27
  }
20
28
  /** Options for {@link launchPersistentContext}. */
21
- export interface PersistentContextOptions extends PlaywrightLaunchOptions, BrowserContextOptions, FingerprintOptions, AgentOptions, GeoipOption, HumanizeOptions, DownloadOptions {
29
+ export interface PersistentContextOptions extends PlaywrightLaunchOptions, BrowserContextOptions, FingerprintOptions, AgentOptions, GeoipOption, ProfileOption, HumanizeOptions, DownloadOptions {
22
30
  }
23
31
  /**
24
32
  * Resolve the Clearcote chrome.exe path, downloading + verifying it if needed.
@@ -60,6 +68,7 @@ export interface LaunchAgentOptions extends PersistentContextOptions {
60
68
  */
61
69
  export declare function launchAgent(options?: LaunchAgentOptions): Promise<BrowserContext>;
62
70
  import { runAgentTask } from "./agent.js";
71
+ import { listProfiles, loadProfile } from "./profile.js";
63
72
  declare const _default: {
64
73
  launch: typeof launch;
65
74
  launchPersistentContext: typeof launchPersistentContext;
@@ -67,6 +76,9 @@ declare const _default: {
67
76
  executablePath: typeof executablePath;
68
77
  download: typeof download;
69
78
  runAgentTask: typeof runAgentTask;
79
+ Profile: typeof Profile;
80
+ listProfiles: typeof listProfiles;
81
+ loadProfile: typeof loadProfile;
70
82
  RELEASE: import("./release.js").ReleaseInfo;
71
83
  };
72
84
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,aAAa,IAAI,uBAAuB,EACzC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAA4C,KAAK,kBAAkB,EAAE,MAAM,kBAA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AAG,OAAO,CAAC,cAAc,CAAC,CAI3F;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;;;;;;;;;;;;;AACzD,wBAWE"}
package/dist/index.js CHANGED
@@ -18,8 +18,10 @@ import { fingerprintArgs, splitFingerprintOptions } from "./fingerprint.js";
18
18
  import { resolveGeo } from "./geoip.js";
19
19
  import { installHumanize, installHumanizeOnContext } from "./humanize.js";
20
20
  import { agentArgs, splitAgentOptions } from "./agent.js";
21
+ import { resolveProfileOptions, Profile } from "./profile.js";
21
22
  import { RELEASE } from "./release.js";
22
23
  export { resolveGeo } from "./geoip.js";
24
+ export { Profile, listProfiles, loadProfile, PROFILE_DIR } from "./profile.js";
23
25
  export { runAgentTask, agentArgs, OPENROUTER_BASE_URL, } from "./agent.js";
24
26
  export { RELEASE } from "./release.js";
25
27
  /** Fill unset timezone/acceptLanguage/location/webrtcIp on `fp` from the proxy's exit-IP geo. */
@@ -62,7 +64,9 @@ export async function download(options = {}) {
62
64
  }
63
65
  /** Launch Clearcote and return a standard Playwright {@link Browser}. */
64
66
  export async function launch(options = {}) {
65
- const { executablePath: exeOption, args, geoip, humanize, showCursor, autoUpdate, cacheDir, quiet, ...rest } = options;
67
+ // profile= a saved persona: its options are the base, explicit options override.
68
+ const merged = options.profile ? { ...resolveProfileOptions(options.profile), ...options } : options;
69
+ const { profile: _profile, executablePath: exeOption, args, geoip, humanize, showCursor, autoUpdate, cacheDir, quiet, ...rest } = merged;
66
70
  const { fingerprint, rest: afterFp } = splitFingerprintOptions(rest);
67
71
  const { agent, rest: pwOptions } = splitAgentOptions(afterFp);
68
72
  if (geoip)
@@ -82,7 +86,8 @@ export async function launch(options = {}) {
82
86
  * {@link BrowserContext} (cookies, storage, etc. persist in `userDataDir`).
83
87
  */
84
88
  export async function launchPersistentContext(userDataDir, options = {}) {
85
- const { executablePath: exeOption, args, geoip, humanize, showCursor, autoUpdate, cacheDir, quiet, ...rest } = options;
89
+ const merged = options.profile ? { ...resolveProfileOptions(options.profile), ...options } : options;
90
+ const { profile: _profile, executablePath: exeOption, args, geoip, humanize, showCursor, autoUpdate, cacheDir, quiet, ...rest } = merged;
86
91
  const { fingerprint, rest: afterFp } = splitFingerprintOptions(rest);
87
92
  const { agent, rest: pwOptions } = splitAgentOptions(afterFp);
88
93
  if (geoip)
@@ -120,5 +125,17 @@ export async function launchAgent(options = {}) {
120
125
  return launchPersistentContext(dir, rest);
121
126
  }
122
127
  import { runAgentTask } from "./agent.js";
123
- export default { launch, launchPersistentContext, launchAgent, executablePath, download, runAgentTask, RELEASE };
128
+ import { listProfiles, loadProfile } from "./profile.js";
129
+ export default {
130
+ launch,
131
+ launchPersistentContext,
132
+ launchAgent,
133
+ executablePath,
134
+ download,
135
+ runAgentTask,
136
+ Profile,
137
+ listProfiles,
138
+ loadProfile,
139
+ RELEASE,
140
+ };
124
141
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,EAAE;AACF,wCAAwC;AACxC,oFAAoF;AACpF,0CAA0C;AAC1C,iEAAiE;AACjE,EAAE;AACF,4FAA4F;AAC5F,gGAAgG;AAChG,gGAAgG;AAChG,sBAAsB;AAEtB,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAOjC,OAAO,EAAE,YAAY,EAAwB,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAA2B,MAAM,kBAAkB,CAAC;AACrG,OAAO,EAAE,UAAU,EAAY,MAAM,YAAY,CAAC;AACl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WAAW,EAAE,MAAM,cAAc,CAAC;AACzD,eAAe;IACb,MAAM;IACN,uBAAuB;IACvB,WAAW;IACX,cAAc;IACd,QAAQ;IACR,YAAY;IACZ,OAAO;IACP,YAAY;IACZ,WAAW;IACX,OAAO;CACR,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { type FingerprintOptions } from "./fingerprint.js";
2
+ import type { Browser, BrowserContext } from "playwright-core";
3
+ /** Directory saved profiles live in (override with `CLEARCOTE_PROFILE_DIR`). */
4
+ export declare const PROFILE_DIR: string;
5
+ /** A persisted set of launch options (a saved persona). */
6
+ export type ProfileOptions = FingerprintOptions & Record<string, unknown>;
7
+ /** A named bundle of {@link launch} options (a saved persona). */
8
+ export declare class Profile {
9
+ name: string;
10
+ options: ProfileOptions;
11
+ constructor(name: string, options?: ProfileOptions);
12
+ /** Merge in more options; returns this for chaining. */
13
+ set(options: ProfileOptions): this;
14
+ /** `~/.clearcote/profiles/<name>.json` (or the explicit path the name resolves to). */
15
+ get path(): string;
16
+ /** Persist as JSON (defaults to {@link path}). Returns the file path. The dir is created 0700
17
+ * and the file written 0600 (it may hold secrets). */
18
+ save(path?: string): string;
19
+ /** Load a saved profile by name (under PROFILE_DIR) or by explicit path. */
20
+ static load(nameOrPath: string): Profile;
21
+ /** Launch this persona; explicit `overrides` win over the saved options. */
22
+ launch(overrides?: ProfileOptions): Promise<Browser>;
23
+ /** Launch this persona with a persistent profile directory. */
24
+ launchPersistentContext(userDataDir: string, overrides?: ProfileOptions): Promise<BrowserContext>;
25
+ }
26
+ /** Names of the saved profiles under {@link PROFILE_DIR}. */
27
+ export declare function listProfiles(): string[];
28
+ /** Convenience wrapper for {@link Profile.load}. */
29
+ export declare function loadProfile(nameOrPath: string): Profile;
30
+ /** Resolve the saved (camelCase-normalized) options for a `profile` option (a name, path, or Profile). */
31
+ export declare function resolveProfileOptions(profile: string | Profile): ProfileOptions;
32
+ //# sourceMappingURL=profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,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// A `Profile` bundles a set of launch options — the fingerprint persona (seed, GPU, brand, …)
4
+ // AND its `canvasBridge` config — under a name you can persist and re-launch as one coherent
5
+ // identity:
6
+ //
7
+ // import { Profile, launch } from "clearcote";
8
+ //
9
+ // await new Profile("acct-1", {
10
+ // fingerprint: "acct-1",
11
+ // gpuVendor: "Google Inc. (Intel)",
12
+ // gpuRenderer: "ANGLE (Intel, Intel(R) UHD Graphics ... D3D11)",
13
+ // canvasBridge: { url: "ws://127.0.0.1:9099", auth: "user:secret" },
14
+ // }).save();
15
+ //
16
+ // const browser = await Profile.load("acct-1").launch({ headless: false }); // or launch({ profile: "acct-1" })
17
+ //
18
+ // Profiles are plain JSON at `~/.clearcote/profiles/<name>.json` (override the dir with
19
+ // CLEARCOTE_PROFILE_DIR). The persona's claimed GPU, the bridge endpoint, and the bridge's
20
+ // GPU-keyed cache stay coherent because they travel together in one file. Fingerprint option
21
+ // keys are normalized on load, so a profile written by the Python SDK (snake_case) loads
22
+ // correctly here (camelCase) and vice versa.
23
+ //
24
+ // SECURITY: a profile is a plaintext file that may hold credentials (e.g. `canvasBridge.auth`)
25
+ // — it is written 0600 but is NOT encrypted; do not commit or share it. Treat profile *names*
26
+ // and profile *files* as trusted input (a loaded profile can set any launch option).
27
+ import { mkdirSync, readFileSync, writeFileSync, existsSync, readdirSync, chmodSync } from "node:fs";
28
+ import { homedir } from "node:os";
29
+ import { join, dirname, sep } from "node:path";
30
+ import { FINGERPRINT_KEYS } from "./fingerprint.js";
31
+ /** Directory saved profiles live in (override with `CLEARCOTE_PROFILE_DIR`). */
32
+ export const PROFILE_DIR = process.env.CLEARCOTE_PROFILE_DIR ?? join(homedir(), ".clearcote", "profiles");
33
+ const FINGERPRINT_KEY_SET = new Set(FINGERPRINT_KEYS);
34
+ const SAFE_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
35
+ function toCamel(key) {
36
+ return key.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
37
+ }
38
+ /** Map snake_case fingerprint keys (e.g. a Python-written profile) to this SDK's camelCase. */
39
+ function normalizeKeys(options) {
40
+ const out = {};
41
+ for (const [k, v] of Object.entries(options)) {
42
+ const camel = toCamel(k);
43
+ out[FINGERPRINT_KEY_SET.has(camel) ? camel : k] = v;
44
+ }
45
+ return out;
46
+ }
47
+ function profilePath(nameOrPath) {
48
+ // a path (has a separator, or ends in .json) is used verbatim; a bare name must be a safe slug
49
+ // (no separators, no "..") so an untrusted name cannot traverse out of PROFILE_DIR.
50
+ if (nameOrPath.includes(sep) || nameOrPath.includes("/") || nameOrPath.endsWith(".json")) {
51
+ return nameOrPath;
52
+ }
53
+ if (!SAFE_NAME.test(nameOrPath)) {
54
+ throw new Error(`invalid profile name '${nameOrPath}' — use [A-Za-z0-9._-] (or pass an explicit path)`);
55
+ }
56
+ return join(PROFILE_DIR, `${nameOrPath}.json`);
57
+ }
58
+ /** A named bundle of {@link launch} options (a saved persona). */
59
+ export class Profile {
60
+ name;
61
+ options;
62
+ constructor(name, options = {}) {
63
+ this.name = name;
64
+ this.options = { ...options };
65
+ }
66
+ /** Merge in more options; returns this for chaining. */
67
+ set(options) {
68
+ Object.assign(this.options, options);
69
+ return this;
70
+ }
71
+ /** `~/.clearcote/profiles/<name>.json` (or the explicit path the name resolves to). */
72
+ get path() {
73
+ return profilePath(this.name);
74
+ }
75
+ /** Persist as JSON (defaults to {@link path}). Returns the file path. The dir is created 0700
76
+ * and the file written 0600 (it may hold secrets). */
77
+ save(path) {
78
+ const dest = path ?? this.path;
79
+ mkdirSync(dirname(dest), { recursive: true });
80
+ writeFileSync(dest, `${JSON.stringify({ name: this.name, options: this.options }, null, 2)}\n`, { mode: 0o600 });
81
+ try {
82
+ chmodSync(dirname(dest), 0o700);
83
+ chmodSync(dest, 0o600);
84
+ }
85
+ catch {
86
+ /* best-effort on platforms without POSIX modes */
87
+ }
88
+ return dest;
89
+ }
90
+ /** Load a saved profile by name (under PROFILE_DIR) or by explicit path. */
91
+ static load(nameOrPath) {
92
+ const data = JSON.parse(readFileSync(profilePath(nameOrPath), "utf8"));
93
+ const base = nameOrPath.split(/[\\/]/).pop() ?? nameOrPath;
94
+ const name = data.name ?? (base.endsWith(".json") ? base.slice(0, -5) : base);
95
+ return new Profile(name, normalizeKeys(data.options ?? {}));
96
+ }
97
+ /** Launch this persona; explicit `overrides` win over the saved options. */
98
+ async launch(overrides = {}) {
99
+ const { launch } = await import("./index.js");
100
+ return launch({ ...this.options, ...overrides });
101
+ }
102
+ /** Launch this persona with a persistent profile directory. */
103
+ async launchPersistentContext(userDataDir, overrides = {}) {
104
+ const { launchPersistentContext } = await import("./index.js");
105
+ return launchPersistentContext(userDataDir, { ...this.options, ...overrides });
106
+ }
107
+ }
108
+ /** Names of the saved profiles under {@link PROFILE_DIR}. */
109
+ export function listProfiles() {
110
+ if (!existsSync(PROFILE_DIR))
111
+ return [];
112
+ return readdirSync(PROFILE_DIR)
113
+ .filter((f) => f.endsWith(".json"))
114
+ .map((f) => f.slice(0, -5))
115
+ .sort();
116
+ }
117
+ /** Convenience wrapper for {@link Profile.load}. */
118
+ export function loadProfile(nameOrPath) {
119
+ return Profile.load(nameOrPath);
120
+ }
121
+ /** Resolve the saved (camelCase-normalized) options for a `profile` option (a name, path, or Profile). */
122
+ export function resolveProfileOptions(profile) {
123
+ return profile instanceof Profile ? normalizeKeys({ ...profile.options }) : { ...Profile.load(profile).options };
124
+ }
125
+ //# sourceMappingURL=profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.js","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,EAAE;AACF,8FAA8F;AAC9F,6FAA6F;AAC7F,YAAY;AACZ,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,kCAAkC;AAClC,6BAA6B;AAC7B,wCAAwC;AACxC,qEAAqE;AACrE,yEAAyE;AACzE,eAAe;AACf,EAAE;AACF,kHAAkH;AAClH,EAAE;AACF,wFAAwF;AACxF,2FAA2F;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M,EAAE,uBAAuB,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;QAC/D,OAAO,uBAAuB,CAAC,WAAW,EAAE,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,SAAS,EAA8B,CAAC,CAAC;IAC7G,CAAC;CACF;AAED,6DAA6D;AAC7D,MAAM,UAAU,YAAY;IAC1B,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,CAAC;IACxC,OAAO,WAAW,CAAC,WAAW,CAAC;SAC5B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;SAClC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SAC1B,IAAI,EAAE,CAAC;AACZ,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,WAAW,CAAC,UAAkB;IAC5C,OAAO,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAClC,CAAC;AAED,0GAA0G;AAC1G,MAAM,UAAU,qBAAqB,CAAC,OAAyB;IAC7D,OAAO,OAAO,YAAY,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;AACnH,CAAC"}
package/dist/release.js CHANGED
@@ -4,13 +4,13 @@
4
4
  // this package, the hash check guarantees you run exactly the published, signed binary.
5
5
  // Published checksums + GPG signatures live on the release page.
6
6
  export const RELEASE = {
7
- tag: "v0.1.0-pre.11",
7
+ tag: "v0.1.0-pre.12",
8
8
  version: "149.0.7827.114",
9
9
  asset: "clearcote-149.0.7827.114-windows-x64.zip",
10
- url: "https://github.com/clearcotelabs/clearcote-browser/releases/download/v0.1.0-pre.11/clearcote-149.0.7827.114-windows-x64.zip",
11
- sha256: "b144b2ae3ef8fe07eb3453f1b15fc73edc753b3b0eb351753977cb17b5667cc7",
10
+ url: "https://github.com/clearcotelabs/clearcote-browser/releases/download/v0.1.0-pre.12/clearcote-149.0.7827.114-windows-x64.zip",
11
+ sha256: "1c1d7e58f50463c09b3c1ad96ec79cc7777ef6482f00e2f3bc8dc6d03df47ced",
12
12
  exeSha256: "5743595256c89c6874804bf3315acce592fc7f1883760c8d380c010151a73b23",
13
- size: 242626707,
13
+ size: 242636042,
14
14
  os: "win32",
15
15
  };
16
16
  /** GitHub repo (owner/name) the releases come from — used by the opt-in auto-update resolver. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clearcote",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Playwright drop-in for the Clearcote anti-fingerprint Chromium build. launch() returns a standard Playwright Browser backed by the verified Clearcote binary, which is auto-downloaded and SHA-256 checked.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",