@amalgm/browser 0.1.0 → 0.1.2-main.34176149752
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/PURPOSE.md +28 -0
- package/README.md +27 -0
- package/dist/src/drivers/electron/native/adblock/index.js +6 -1
- package/dist/src/drivers/electron/native/adblock/index.js.map +1 -1
- package/dist/src/electron-preload.cjs +113 -0
- package/dist/src/electron.cjs +13553 -0
- package/dist/src/electron.d.cts +14 -0
- package/dist/src/runtime-selector.js +7 -13
- package/dist/src/runtime-selector.js.map +1 -1
- package/package.json +109 -20
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { ElectronBrowserDriver } from './drivers/electron/driver.js';
|
|
2
|
+
export { ElectronCookieAdapter, ELECTRON_COOKIE_ADAPTER_ID } from './drivers/electron/cookie-adapter.js';
|
|
3
|
+
export { writeHostAdvertisement, removeHostAdvertisement, isLoopbackCdpUrl, type WriteHostAdvertisementOptions, } from './drivers/electron/advertisement.js';
|
|
4
|
+
export { BROWSER_SESSION_PARTITION, BROWSER_SURFACE_PROTOCOL, BROWSER_SURFACE_PROTOCOLS, markerUrl, surfaceStamp, type ElectronSurfaceIdentity, type ElectronSurfaceState, type ElectronVisibleHost, } from './drivers/electron/contracts.js';
|
|
5
|
+
export { isolatedBrowserSession, type ElectronSessionModule } from './drivers/electron/session.js';
|
|
6
|
+
export { browserNavigationPolicy, normalizeBrowserLocation, permissionOrigin, safeDownloadName, } from './drivers/electron/policy.js';
|
|
7
|
+
export { createBrowserShell, type BrowserShell, type BrowserShellOptions } from './drivers/electron/native/shell.js';
|
|
8
|
+
export { createBrowserSurfaceController, type BrowserSurfaceController, type NativeBrowserSurface, } from './drivers/electron/native/surface-controller.js';
|
|
9
|
+
export { getBrowserSession } from './drivers/electron/native/session.js';
|
|
10
|
+
export { NativeAdBlocker, adBlockHostname, isNativeAdBlockDisabled } from './drivers/electron/native/adblock/index.js';
|
|
11
|
+
export { isAdBlockCacheFresh } from './drivers/electron/native/adblock/cache.js';
|
|
12
|
+
export * from './drivers/electron/native/contracts.js';
|
|
13
|
+
export * from './drivers/electron/native/policy.js';
|
|
14
|
+
export { setValueScript, insertTextScript, keyScript, codeFor } from './interaction/typing.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import {
|
|
3
|
+
import { runtimeBindingFromEnvironment, runtimeStateDir } from '@amalgm/core/identity';
|
|
4
4
|
import { isLoopbackCdpUrl } from './drivers/electron/advertisement.js';
|
|
5
5
|
import { BROWSER_SURFACE_PROTOCOLS } from './drivers/electron/contracts.js';
|
|
6
6
|
export const ELECTRON_SURFACE_PROTOCOLS = BROWSER_SURFACE_PROTOCOLS;
|
|
@@ -16,18 +16,12 @@ export function pidIsRunning(pid) {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
export function bridgeFileCandidates(env = process.env) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// folded by the runtime label law, so junk can never name a directory.
|
|
26
|
-
if (root && label)
|
|
27
|
-
directories.push(runtimeStateDir(root, coerceRuntimeLabel(label)));
|
|
28
|
-
if (root)
|
|
29
|
-
directories.push(root);
|
|
30
|
-
return [...new Set(directories)].map((directory) => path.join(directory, 'electron-browser-bridge.json'));
|
|
19
|
+
const binding = runtimeBindingFromEnvironment(env);
|
|
20
|
+
// The host supplies its reserved machine namespace. A shared user root is
|
|
21
|
+
// never a discovery fallback, and an unknown binding never selects main.
|
|
22
|
+
const directory = env.AMALGM_RUNTIME_STATE_DIR || (env.AMALGM_DIR && env.AMALGM_DEVICE_ID
|
|
23
|
+
? runtimeStateDir(env.AMALGM_DIR, env.AMALGM_DEVICE_ID, binding.runtimeLabel) : null);
|
|
24
|
+
return directory ? [path.join(directory, 'electron-browser-bridge.json')] : [];
|
|
31
25
|
}
|
|
32
26
|
export function readHostAdvertisement(files = bridgeFileCandidates()) {
|
|
33
27
|
for (const file of files) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-selector.js","sourceRoot":"","sources":["../../src/runtime-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"runtime-selector.js","sourceRoot":"","sources":["../../src/runtime-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,6BAA6B,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,MAAM,CAAC,MAAM,0BAA0B,GAAG,yBAAyB,CAAC;AAEpE,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACrD,IAAI,CAAC;QAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;IAC1C,OAAO,KAAK,EAAE,CAAC;QAAC,OAAQ,KAA+B,CAAC,IAAI,KAAK,OAAO,CAAC;IAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,MAAyB,OAAO,CAAC,GAAG;IACvE,MAAM,OAAO,GAAG,6BAA6B,CAAC,GAAG,CAAC,CAAC;IACnD,0EAA0E;IAC1E,yEAAyE;IACzE,MAAM,SAAS,GAAG,GAAG,CAAC,wBAAwB,IAAI,CAAC,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,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AE,CAAC;QAClC,OAAO,IAAI,IAAK,0BAAgD,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;YACtF,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,UAAU,CAAC;IACjB,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,26 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amalgm/browser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2-main.34176149752",
|
|
4
4
|
"description": "Safe persistent browser automation across headless Chromium and visible Electron surfaces.",
|
|
5
|
-
"repository": {
|
|
6
|
-
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/amalgm-inc/amalgm-browser.git"
|
|
8
|
+
},
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/amalgm-inc/amalgm-browser/issues"
|
|
11
|
+
},
|
|
7
12
|
"homepage": "https://github.com/amalgm-inc/amalgm-browser#readme",
|
|
8
13
|
"license": "UNLICENSED",
|
|
9
14
|
"type": "module",
|
|
10
15
|
"private": false,
|
|
11
|
-
"publishConfig": {
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
12
19
|
"main": "./dist/src/index.js",
|
|
13
20
|
"types": "./dist/src/index.d.ts",
|
|
14
21
|
"exports": {
|
|
15
|
-
".": {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"./
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"./
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/src/index.d.ts",
|
|
24
|
+
"import": "./dist/src/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./headless": {
|
|
27
|
+
"types": "./dist/src/headless.d.ts",
|
|
28
|
+
"import": "./dist/src/headless.js"
|
|
29
|
+
},
|
|
30
|
+
"./electron": {
|
|
31
|
+
"import": {
|
|
32
|
+
"types": "./dist/src/electron.d.ts",
|
|
33
|
+
"default": "./dist/src/electron.js"
|
|
34
|
+
},
|
|
35
|
+
"require": {
|
|
36
|
+
"types": "./dist/src/electron.d.cts",
|
|
37
|
+
"default": "./dist/src/electron.cjs"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"./cookies": {
|
|
41
|
+
"types": "./dist/src/cookies.d.ts",
|
|
42
|
+
"import": "./dist/src/cookies.js"
|
|
43
|
+
},
|
|
44
|
+
"./recording": {
|
|
45
|
+
"types": "./dist/src/recording.d.ts",
|
|
46
|
+
"import": "./dist/src/recording.js"
|
|
47
|
+
},
|
|
48
|
+
"./toolbox": {
|
|
49
|
+
"types": "./dist/src/toolbox.d.ts",
|
|
50
|
+
"import": "./dist/src/toolbox.js"
|
|
51
|
+
},
|
|
52
|
+
"./mcp": {
|
|
53
|
+
"types": "./dist/src/mcp.d.ts",
|
|
54
|
+
"import": "./dist/src/mcp.js"
|
|
55
|
+
},
|
|
56
|
+
"./http": {
|
|
57
|
+
"types": "./dist/src/http.d.ts",
|
|
58
|
+
"import": "./dist/src/http.js"
|
|
59
|
+
},
|
|
60
|
+
"./testing": {
|
|
61
|
+
"types": "./dist/src/testing.d.ts",
|
|
62
|
+
"import": "./dist/src/testing.js"
|
|
63
|
+
}
|
|
24
64
|
},
|
|
25
65
|
"bin": {
|
|
26
66
|
"amalgm-browser": "./dist/bin/amalgm-browser.js",
|
|
@@ -39,7 +79,8 @@
|
|
|
39
79
|
"SECURITY.md"
|
|
40
80
|
],
|
|
41
81
|
"scripts": {
|
|
42
|
-
"build": "
|
|
82
|
+
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json && npm run build:electron-cjs && tsx scripts/finalize-build.ts",
|
|
83
|
+
"build:electron-cjs": "esbuild src/electron.ts --bundle --platform=node --format=cjs --target=node20 --define:import.meta.dirname=__dirname --define:__AMALGM_BROWSER_ADBLOCK_PRELOAD__=\\\"electron-preload.cjs\\\" --outfile=dist/src/electron.cjs --external:electron && esbuild src/drivers/electron/native/adblock/preload.ts --bundle --platform=node --format=cjs --target=node20 --outfile=dist/src/electron-preload.cjs --external:electron",
|
|
43
84
|
"check": "tsx scripts/check-tree.ts && tsc -p tsconfig.json && tsc -p tsconfig.test.json",
|
|
44
85
|
"test": "tsx --test --test-concurrency=1 --test-timeout=30000 test/*.test.ts",
|
|
45
86
|
"test:real": "cross-env AMALGM_BROWSER_REAL=1 tsx --test --test-timeout=60000 test/real-headless.test.ts",
|
|
@@ -47,11 +88,19 @@
|
|
|
47
88
|
"test:electron": "tsx scripts/run-electron-test.ts",
|
|
48
89
|
"verify": "npm run check && npm run build && npm test && npm run verify:pack",
|
|
49
90
|
"verify:pack": "tsx scripts/verify-package.ts",
|
|
50
|
-
"prepack": "npm run build"
|
|
91
|
+
"prepack": "npm run build",
|
|
92
|
+
"release:admit": "node scripts/release/package.mjs admit",
|
|
93
|
+
"release:prepare": "node scripts/release/package.mjs prepare",
|
|
94
|
+
"release:examine": "node scripts/release/package.mjs examine",
|
|
95
|
+
"release:publish": "node scripts/release/package.mjs publish",
|
|
96
|
+
"release:compose": "node scripts/release/compose.mjs",
|
|
97
|
+
"test:release": "node --test scripts/release/*.test.mjs"
|
|
98
|
+
},
|
|
99
|
+
"engines": {
|
|
100
|
+
"node": ">=24"
|
|
51
101
|
},
|
|
52
|
-
"engines": { "node": ">=20" },
|
|
53
102
|
"dependencies": {
|
|
54
|
-
"@amalgm/core": "
|
|
103
|
+
"@amalgm/core": "0.4.8-main.34168902443",
|
|
55
104
|
"@ghostery/adblocker": "^2.18.1",
|
|
56
105
|
"agent-browser": "0.26.0",
|
|
57
106
|
"better-sqlite3": "^12.10.1",
|
|
@@ -63,16 +112,56 @@
|
|
|
63
112
|
"electron": ">=33"
|
|
64
113
|
},
|
|
65
114
|
"peerDependenciesMeta": {
|
|
66
|
-
"electron": {
|
|
115
|
+
"electron": {
|
|
116
|
+
"optional": true
|
|
117
|
+
}
|
|
67
118
|
},
|
|
68
119
|
"devDependencies": {
|
|
120
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
69
121
|
"@types/ffmpeg-static": "^3.0.3",
|
|
70
122
|
"@types/node": "^20.19.43",
|
|
71
|
-
"@types/better-sqlite3": "^7.6.13",
|
|
72
123
|
"@types/ws": "^8.18.1",
|
|
73
124
|
"cross-env": "^7.0.3",
|
|
74
|
-
"electron": "41.7
|
|
125
|
+
"electron": "41.10.7",
|
|
126
|
+
"esbuild": "0.28.2",
|
|
75
127
|
"tsx": "^4.23.1",
|
|
76
128
|
"typescript": "^5.9.3"
|
|
129
|
+
},
|
|
130
|
+
"amalgmRelease": {
|
|
131
|
+
"schema": 1,
|
|
132
|
+
"workflow": "ci.yml",
|
|
133
|
+
"jobs": [
|
|
134
|
+
"verify",
|
|
135
|
+
"real-headless",
|
|
136
|
+
"real-electron"
|
|
137
|
+
],
|
|
138
|
+
"verify": "verify",
|
|
139
|
+
"cli": [
|
|
140
|
+
"amalgm-browser"
|
|
141
|
+
],
|
|
142
|
+
"peerExports": [
|
|
143
|
+
"./electron"
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
"allowScripts": {
|
|
147
|
+
"agent-browser@0.26.0": true,
|
|
148
|
+
"better-sqlite3@12.11.1": true,
|
|
149
|
+
"ffmpeg-static@5.3.0": true,
|
|
150
|
+
"fsevents@2.3.3": false,
|
|
151
|
+
"esbuild@0.28.2": true,
|
|
152
|
+
"electron@41.10.7": true
|
|
153
|
+
},
|
|
154
|
+
"amalgmComposition": {
|
|
155
|
+
"schema": 1,
|
|
156
|
+
"manifests": [
|
|
157
|
+
"package.json"
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
"gitHead": "655b65cc66dea3695a2fff241cd785542a355a2f",
|
|
161
|
+
"amalgmSource": {
|
|
162
|
+
"repository": "amalgm-inc/amalgm-browser",
|
|
163
|
+
"branch": "main",
|
|
164
|
+
"commit": "655b65cc66dea3695a2fff241cd785542a355a2f",
|
|
165
|
+
"occurrence": "34176149752"
|
|
77
166
|
}
|
|
78
167
|
}
|