@hy-sde-org/dsh-browser 0.2.2-rc.1 → 0.2.2-rc.5
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 +6 -6
- package/dist/assets/background.js.txt +80 -4
- package/dist/assets/manifest.json.txt +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/patchright.d.ts +57 -0
- package/dist/patchright.d.ts.map +1 -0
- package/dist/patchright.js +89 -0
- package/dist/patchright.js.map +1 -0
- package/dist/profile-seed.d.ts +24 -0
- package/dist/profile-seed.d.ts.map +1 -0
- package/dist/profile-seed.js +68 -0
- package/dist/profile-seed.js.map +1 -0
- package/dist/relay/bridge.d.ts.map +1 -1
- package/dist/relay/bridge.js +278 -40
- package/dist/relay/bridge.js.map +1 -1
- package/dist/relay/protocol.d.ts +8 -1
- package/dist/relay/protocol.d.ts.map +1 -1
- package/dist/service.d.ts +8 -5
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +60 -29
- package/dist/service.js.map +1 -1
- package/dist/types.d.ts +4 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -3
- package/dist/cloak.d.ts +0 -52
- package/dist/cloak.d.ts.map +0 -1
- package/dist/cloak.js +0 -83
- package/dist/cloak.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hy-sde-org/dsh-browser",
|
|
3
|
-
"version": "0.2.2-rc.
|
|
3
|
+
"version": "0.2.2-rc.5",
|
|
4
4
|
"description": "Agentic browser plumbing for DeepSeek Harness: the host ctx.browser service (stealth launch, CDP-attach, and a relay + companion Chrome extension driving the user's own tabs) backing the browser tool in @hy-sde-org/dsh-tool-browser — no harness changes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -66,13 +66,14 @@
|
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"@deepseek-ai/cordis": "~4.1.0",
|
|
69
|
-
"
|
|
69
|
+
"patchright": ">=1.49.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@deepseek-ai/cordis": "~4.1.0",
|
|
73
73
|
"@types/node": "^24.0.0",
|
|
74
74
|
"@types/ws": "^8.5.0",
|
|
75
75
|
"playwright-core": "^1.61.1",
|
|
76
|
+
"patchright": "^1.64.3",
|
|
76
77
|
"typescript": "^5.9.3",
|
|
77
78
|
"vitest": "^3.2.7",
|
|
78
79
|
"ws": "^8.21.0"
|
|
@@ -87,7 +88,7 @@
|
|
|
87
88
|
"chrome"
|
|
88
89
|
],
|
|
89
90
|
"peerDependenciesMeta": {
|
|
90
|
-
"
|
|
91
|
+
"patchright": {
|
|
91
92
|
"optional": true
|
|
92
93
|
}
|
|
93
94
|
},
|
package/dist/cloak.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CloakBrowser backend (`app.patch`): launch the CloakBrowser Chromium — a
|
|
3
|
-
* fork carrying 71 source-level C++ fingerprint patches (canvas, WebGL,
|
|
4
|
-
* audio, fonts, GPU, screen, WebRTC, network timing, automation signals) —
|
|
5
|
-
* through the `cloakbrowser` npm package, a drop-in Playwright replacement:
|
|
6
|
-
* its `launch()` returns a plain Playwright-compatible `Browser` over its
|
|
7
|
-
* patched Chromium binary.
|
|
8
|
-
*
|
|
9
|
-
* `cloakbrowser` is an OPTIONAL peer: it is dynamically imported here with a
|
|
10
|
-
* computed specifier (same technique as @hy-sde-org/dsh-tool-library-search's
|
|
11
|
-
* optional transformers embedder) so the package keeps zero hard dependency on
|
|
12
|
-
* it. The first launch auto-downloads the patched Chromium (~200 MB, cached
|
|
13
|
-
* under `~/.cloakbrowser/`); every launch randomizes per-session fingerprints
|
|
14
|
-
* at the C++ layer, so the dsh-browser UA override and JS init scripts are
|
|
15
|
-
* deliberately NOT applied on this backend (they would fight the
|
|
16
|
-
* randomization).
|
|
17
|
-
* @module @hy-sde-org/dsh-browser/cloak
|
|
18
|
-
*/
|
|
19
|
-
/** Raised when the CloakBrowser backend is requested but not usable. */
|
|
20
|
-
export declare class CloakUnavailableError extends Error {
|
|
21
|
-
constructor(message: string);
|
|
22
|
-
}
|
|
23
|
-
/** Launch options passed through to `cloakbrowser.launch()` (README surface). */
|
|
24
|
-
export interface CloakLaunchOptions {
|
|
25
|
-
/** Headless mode (default: the service's `headless` config, usually true). */
|
|
26
|
-
headless?: boolean;
|
|
27
|
-
/** Proxy URL passed to the browser (e.g. a residential proxy). */
|
|
28
|
-
proxy?: string;
|
|
29
|
-
/** Match timezone + locale to the proxy IP (needs `proxy`). */
|
|
30
|
-
geoip?: boolean;
|
|
31
|
-
/** Human-like mouse, keyboard, scroll behaviour. */
|
|
32
|
-
humanize?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Launch a CloakBrowser Chromium.
|
|
36
|
-
* @param options - launch options (headless/proxy/geoip/humanize passthrough).
|
|
37
|
-
* @returns the Playwright-compatible `Browser` (cast by the caller).
|
|
38
|
-
* @throws {CloakUnavailableError} when `cloakbrowser` is not installed or has
|
|
39
|
-
* no `launch` export (too old / wrong package).
|
|
40
|
-
*/
|
|
41
|
-
export declare function launchCloakBrowser(options: CloakLaunchOptions): Promise<unknown>;
|
|
42
|
-
/**
|
|
43
|
-
* OS pid of a launched CloakBrowser Chromium, when the peer exposes its
|
|
44
|
-
* process. CloakBrowser's `launch()` returns a plain Playwright-compatible
|
|
45
|
-
* `Browser` with no launchServer handle, so a crashed host's patch browser is
|
|
46
|
-
* only reapable if the peer surfaces the pid (duck-typed — a peer without the
|
|
47
|
-
* accessor records nothing, same as before this existed).
|
|
48
|
-
* @param browser - the value returned by {@link launchCloakBrowser}.
|
|
49
|
-
* @returns the browser's OS pid, or undefined when not exposed.
|
|
50
|
-
*/
|
|
51
|
-
export declare function cloakBrowserPid(browser: unknown): number | undefined;
|
|
52
|
-
//# sourceMappingURL=cloak.d.ts.map
|
package/dist/cloak.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cloak.d.ts","sourceRoot":"","sources":["../src/cloak.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,wEAAwE;AACxE,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI5B;AAED,iFAAiF;AACjF,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,+DAA+D;IAC/D,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,oDAAoD;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAyBtF;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAKpE"}
|
package/dist/cloak.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CloakBrowser backend (`app.patch`): launch the CloakBrowser Chromium — a
|
|
3
|
-
* fork carrying 71 source-level C++ fingerprint patches (canvas, WebGL,
|
|
4
|
-
* audio, fonts, GPU, screen, WebRTC, network timing, automation signals) —
|
|
5
|
-
* through the `cloakbrowser` npm package, a drop-in Playwright replacement:
|
|
6
|
-
* its `launch()` returns a plain Playwright-compatible `Browser` over its
|
|
7
|
-
* patched Chromium binary.
|
|
8
|
-
*
|
|
9
|
-
* `cloakbrowser` is an OPTIONAL peer: it is dynamically imported here with a
|
|
10
|
-
* computed specifier (same technique as @hy-sde-org/dsh-tool-library-search's
|
|
11
|
-
* optional transformers embedder) so the package keeps zero hard dependency on
|
|
12
|
-
* it. The first launch auto-downloads the patched Chromium (~200 MB, cached
|
|
13
|
-
* under `~/.cloakbrowser/`); every launch randomizes per-session fingerprints
|
|
14
|
-
* at the C++ layer, so the dsh-browser UA override and JS init scripts are
|
|
15
|
-
* deliberately NOT applied on this backend (they would fight the
|
|
16
|
-
* randomization).
|
|
17
|
-
* @module @hy-sde-org/dsh-browser/cloak
|
|
18
|
-
*/
|
|
19
|
-
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
20
|
-
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
21
|
-
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
22
|
-
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
return path;
|
|
26
|
-
};
|
|
27
|
-
/** Raised when the CloakBrowser backend is requested but not usable. */
|
|
28
|
-
export class CloakUnavailableError extends Error {
|
|
29
|
-
constructor(message) {
|
|
30
|
-
super(message);
|
|
31
|
-
this.name = 'CloakUnavailableError';
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Launch a CloakBrowser Chromium.
|
|
36
|
-
* @param options - launch options (headless/proxy/geoip/humanize passthrough).
|
|
37
|
-
* @returns the Playwright-compatible `Browser` (cast by the caller).
|
|
38
|
-
* @throws {CloakUnavailableError} when `cloakbrowser` is not installed or has
|
|
39
|
-
* no `launch` export (too old / wrong package).
|
|
40
|
-
*/
|
|
41
|
-
export async function launchCloakBrowser(options) {
|
|
42
|
-
// Computed specifier: keeps the OPTIONAL peer out of static type resolution
|
|
43
|
-
// (it is not installed in base deployments) while still allowing a runtime
|
|
44
|
-
// `npm i cloakbrowser` to be picked up lazily. Typed as `string` so tsc
|
|
45
|
-
// never tries to resolve it.
|
|
46
|
-
const moduleName = 'cloakbrowser';
|
|
47
|
-
let mod;
|
|
48
|
-
try {
|
|
49
|
-
mod = await import(__rewriteRelativeImportExtension(moduleName));
|
|
50
|
-
}
|
|
51
|
-
catch {
|
|
52
|
-
throw new CloakUnavailableError('browser app.patch: install the optional peer `cloakbrowser` (npm i cloakbrowser) to use this backend '
|
|
53
|
-
+ '— its first launch auto-downloads the patched Chromium (~200MB, cached under ~/.cloakbrowser/).');
|
|
54
|
-
}
|
|
55
|
-
if (typeof mod.launch !== 'function') {
|
|
56
|
-
throw new CloakUnavailableError('browser app.patch: the installed `cloakbrowser` has no `launch` export — install a current version (>=0.5).');
|
|
57
|
-
}
|
|
58
|
-
const launchOptions = { headless: options.headless ?? true };
|
|
59
|
-
if (options.proxy !== undefined)
|
|
60
|
-
launchOptions.proxy = options.proxy;
|
|
61
|
-
if (options.geoip === true)
|
|
62
|
-
launchOptions.geoip = true;
|
|
63
|
-
if (options.humanize === true)
|
|
64
|
-
launchOptions.humanize = true;
|
|
65
|
-
return mod.launch(launchOptions);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* OS pid of a launched CloakBrowser Chromium, when the peer exposes its
|
|
69
|
-
* process. CloakBrowser's `launch()` returns a plain Playwright-compatible
|
|
70
|
-
* `Browser` with no launchServer handle, so a crashed host's patch browser is
|
|
71
|
-
* only reapable if the peer surfaces the pid (duck-typed — a peer without the
|
|
72
|
-
* accessor records nothing, same as before this existed).
|
|
73
|
-
* @param browser - the value returned by {@link launchCloakBrowser}.
|
|
74
|
-
* @returns the browser's OS pid, or undefined when not exposed.
|
|
75
|
-
*/
|
|
76
|
-
export function cloakBrowserPid(browser) {
|
|
77
|
-
const processFn = browser.process;
|
|
78
|
-
if (typeof processFn !== 'function')
|
|
79
|
-
return undefined;
|
|
80
|
-
const pid = processFn.call(browser)?.pid;
|
|
81
|
-
return typeof pid === 'number' && Number.isInteger(pid) ? pid : undefined;
|
|
82
|
-
}
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