bidi-browser-mcp 0.1.10 → 0.2.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 +64 -9
- package/dist/bin.js +3 -2
- package/dist/config.js +4 -0
- package/dist/connection/bidi-client.d.ts +13 -1
- package/dist/connection/bidi-client.js +59 -8
- package/dist/connection/browser-discovery.d.ts +20 -0
- package/dist/connection/browser-discovery.js +76 -12
- package/dist/connection/chromium-mapper.d.ts +9 -0
- package/dist/connection/chromium-mapper.js +24 -0
- package/dist/connection/event-pipeline.d.ts +15 -2
- package/dist/connection/event-pipeline.js +45 -3
- package/dist/connection/protocol-probe.d.ts +43 -0
- package/dist/connection/protocol-probe.js +112 -0
- package/dist/index.js +6 -0
- package/dist/session/session-manager.d.ts +26 -1
- package/dist/session/session-manager.js +262 -6
- package/dist/snapshot/cache.d.ts +4 -0
- package/dist/snapshot/cache.js +8 -0
- package/dist/snapshot/dom-snapshot.js +10 -1
- package/dist/snapshot/element-script.d.ts +23 -0
- package/dist/snapshot/element-script.js +70 -0
- package/dist/snapshot/token-optimizer.js +26 -8
- package/dist/snapshot/uid-verify.d.ts +43 -0
- package/dist/snapshot/uid-verify.js +154 -0
- package/dist/tools/browser.js +21 -6
- package/dist/tools/context.js +4 -6
- package/dist/tools/interact.d.ts +1 -0
- package/dist/tools/interact.js +593 -0
- package/dist/tools/network.d.ts +1 -0
- package/dist/tools/network.js +166 -0
- package/dist/tools/page.js +53 -2
- package/dist/tools/ping.js +5 -1
- package/dist/tools/script.d.ts +1 -0
- package/dist/tools/script.js +166 -0
- package/dist/types.d.ts +50 -1
- package/dist/utils/bidi-value.d.ts +10 -0
- package/dist/utils/bidi-value.js +56 -0
- package/dist/utils/errors.d.ts +3 -1
- package/dist/utils/errors.js +13 -7
- package/dist/utils/redact.d.ts +16 -0
- package/dist/utils/redact.js +47 -0
- package/package.json +1 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Home-directory prefixes worth hiding in tool output: the OS username is
|
|
3
|
+
* embedded in the path, and every tool answer is sent to the agent provider.
|
|
4
|
+
*/
|
|
5
|
+
const HOME_PREFIXES = [/^[A-Za-z]:\\Users\\[^\\/]+/, /^\/(?:home|Users)\/[^/]+/];
|
|
6
|
+
/**
|
|
7
|
+
* Replace the user-specific prefix of a profile path with `~` while keeping
|
|
8
|
+
* everything above it: `C:\Users\me\AppData\…\Zen\Profiles\xxx` becomes
|
|
9
|
+
* `~\AppData\…\Zen\Profiles\xxx`, which still identifies the profile file
|
|
10
|
+
* but carries no username. Paths without a home prefix are returned as they
|
|
11
|
+
* are (portable installs use their own drive or a flat config).
|
|
12
|
+
*/
|
|
13
|
+
export function redactProfilePath(path) {
|
|
14
|
+
for (const pattern of HOME_PREFIXES) {
|
|
15
|
+
if (pattern.test(path)) {
|
|
16
|
+
return path.replace(pattern, '~');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return path;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Redact every path a status payload can carry: the resolved `profile` of the
|
|
23
|
+
* live session and the `moz:profile` capability the browser reports. Raw paths
|
|
24
|
+
* stay available to internal callers (profile reads in the container and
|
|
25
|
+
* spaces tools) — this copy is for tool output.
|
|
26
|
+
*/
|
|
27
|
+
export function redactStatusProfile(status) {
|
|
28
|
+
const profile = status.profile === undefined
|
|
29
|
+
? undefined
|
|
30
|
+
: redactProfilePath(status.profile);
|
|
31
|
+
const browser = status.browser === undefined
|
|
32
|
+
? status.browser
|
|
33
|
+
: (() => {
|
|
34
|
+
const normalized = { ...status.browser };
|
|
35
|
+
const mozProfile = normalized['moz:profile'];
|
|
36
|
+
if (typeof mozProfile === 'string') {
|
|
37
|
+
normalized['moz:profile'] = redactProfilePath(mozProfile);
|
|
38
|
+
}
|
|
39
|
+
return normalized;
|
|
40
|
+
})();
|
|
41
|
+
return {
|
|
42
|
+
...status,
|
|
43
|
+
...(profile === undefined ? {} : { profile }),
|
|
44
|
+
...(browser === undefined ? {} : { browser }),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=redact.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bidi-browser-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "WebDriver BiDi browser MCP server — control your real Firefox (native BiDi) or Chromium browser (in-process mapper) over the W3C standard protocol",
|
|
5
5
|
"mcpName": "io.github.tushar49/bidi-browser-mcp",
|
|
6
6
|
"type": "module",
|