@amaster.ai/pi-browser-use 0.1.2-beta.8 → 0.1.2-beta.80

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.
@@ -0,0 +1,86 @@
1
+ import { accessSync, constants, existsSync, renameSync, statSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { DEFAULT_PROFILE_DIR } from './config.js';
4
+ // Files Chrome must be able to read and write; if any is inaccessible (e.g.
5
+ // owned by root after the profile was created via sudo), Chrome shows a
6
+ // "can't read your preferences" dialog and silently drops preference changes.
7
+ const REQUIRED_PROFILE_FILES = ['Local State', join('Default', 'Preferences')];
8
+ function isReadableWritable(path) {
9
+ try {
10
+ accessSync(path, constants.R_OK | constants.W_OK);
11
+ return true;
12
+ }
13
+ catch {
14
+ return false;
15
+ }
16
+ }
17
+ function isUsableDirectory(path) {
18
+ try {
19
+ if (!statSync(path).isDirectory())
20
+ return false;
21
+ accessSync(path, constants.R_OK | constants.W_OK | constants.X_OK);
22
+ return true;
23
+ }
24
+ catch {
25
+ return false;
26
+ }
27
+ }
28
+ function findInaccessiblePath(userDataDir) {
29
+ if (!isUsableDirectory(userDataDir))
30
+ return userDataDir;
31
+ const defaultDir = join(userDataDir, 'Default');
32
+ if (existsSync(defaultDir) && !isUsableDirectory(defaultDir))
33
+ return defaultDir;
34
+ for (const file of REQUIRED_PROFILE_FILES) {
35
+ const path = join(userDataDir, file);
36
+ if (existsSync(path) && !isReadableWritable(path))
37
+ return path;
38
+ }
39
+ return undefined;
40
+ }
41
+ function inaccessibleProfileError(userDataDir, inaccessiblePath, moveFailed = false) {
42
+ return new Error(`Chrome profile at ${JSON.stringify(userDataDir)} is not readable/writable by the current user ` +
43
+ `(${JSON.stringify(inaccessiblePath)})${moveFailed ? ' and could not be moved aside' : ''}. ` +
44
+ 'Restore ownership and read/write permissions for that profile, then retry.');
45
+ }
46
+ /**
47
+ * Verify Chrome can read and write its profile before launch.
48
+ *
49
+ * When the profile is unusable (typically files owned by another user after a
50
+ * sudo-run browser), the managed default profile is moved aside so Chrome
51
+ * starts fresh — nothing is deleted. For a custom userDataDir we refuse to
52
+ * touch the directory and throw with a remediation hint instead.
53
+ */
54
+ function ensureProfileAccessible(userDataDir, allowRelocate) {
55
+ if (!existsSync(userDataDir))
56
+ return;
57
+ const inaccessiblePath = findInaccessiblePath(userDataDir);
58
+ if (!inaccessiblePath)
59
+ return;
60
+ if (!allowRelocate) {
61
+ throw inaccessibleProfileError(userDataDir, inaccessiblePath);
62
+ }
63
+ const movedTo = `${userDataDir}.inaccessible-${Date.now()}`;
64
+ try {
65
+ renameSync(userDataDir, movedTo);
66
+ }
67
+ catch {
68
+ if (!existsSync(userDataDir))
69
+ return;
70
+ throw inaccessibleProfileError(userDataDir, inaccessiblePath, true);
71
+ }
72
+ console.error(`[pi-browser-use] Chrome profile at ${JSON.stringify(userDataDir)} was not readable/writable ` +
73
+ `by the current user; moved it to ${JSON.stringify(movedTo)} and will create a fresh profile.`);
74
+ }
75
+ export function prepareBrowserProfile(config, managedProfileDir = DEFAULT_PROFILE_DIR) {
76
+ const userDataDir = config.userDataDir;
77
+ if (config.sessionMode !== 'persistent' ||
78
+ !userDataDir ||
79
+ config.browserUrl ||
80
+ config.wsEndpoint ||
81
+ config.autoConnect) {
82
+ return;
83
+ }
84
+ ensureProfileAccessible(userDataDir, userDataDir === managedProfileDir);
85
+ }
86
+ //# sourceMappingURL=profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.js","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAyB,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEzE,4EAA4E;AAC5E,wEAAwE;AACxE,8EAA8E;AAC9E,MAAM,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CAAC,WAAW;QACZ,MAAM,CAAC,UAAU;QACjB,MAAM,CAAC,UAAU;QACjB,MAAM,CAAC,WAAW,EAClB,CAAC;QACD,OAAO;IACT,CAAC;IACD,uBAAuB,CAAC,WAAW,EAAE,WAAW,KAAK,iBAAiB,CAAC,CAAC;AAC1E,CAAC"}
@@ -2,7 +2,7 @@
2
2
  // These steer the LLM toward correct usage (e.g. "call take_snapshot first").
3
3
  const DESCRIPTION_HINTS = {
4
4
  fill_form: ' Fills multiple standard HTML form fields at once. Same limitations as fill — does not work on canvas/custom widgets.',
5
- fill: ' Fills standard HTML form fields (<input>, <textarea>, <select>) by uid. Does NOT work on custom/canvas-based widgets (e.g., Google Sheets cells, Notion blocks). If fill times out or fails, click the element first then use press_key with individual characters instead.',
5
+ fill: ' Fills standard HTML form fields (<input>, <textarea>, <select>) by uid. Does NOT work on custom/canvas-based widgets (e.g., Google Sheets cells, Notion blocks). If fill times out or fails, click the element first then use type_text to enter the text.',
6
6
  click_at: ' Clicks at exact pixel coordinates (x, y). Use when you have specific coordinates for visual elements.',
7
7
  click: ' Use the element uid from the accessibility tree snapshot (e.g., uid="87_4"). UIDs are invalidated after this action — call take_snapshot before using another uid.',
8
8
  hover: ' Use the element uid from the accessibility tree snapshot to hover over elements.',
@@ -1 +1 @@
1
- {"version":3,"file":"tool-augment.js","sourceRoot":"","sources":["../src/tool-augment.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,8EAA8E;AAC9E,MAAM,iBAAiB,GAA2B;IAChD,SAAS,EACP,uHAAuH;IACzH,IAAI,EAAE,8QAA8Q;IACpR,QAAQ,EACN,wGAAwG;IAC1G,KAAK,EACH,qKAAqK;IACvK,KAAK,EAAE,mFAAmF;IAC1F,aAAa,EACX,mMAAmM;IACrM,aAAa,EAAE,+EAA+E;IAC9F,QAAQ,EACN,6FAA6F;IAC/F,SAAS,EACP,kQAAkQ;CACrQ,CAAC;AAEF,2EAA2E;AAC3E,MAAM,UAAU,sBAAsB,CAAC,Q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,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC;SAC1C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAK,CAAC;SACnB,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Deferred tool groups: every upstream tool stays registered, but only the
3
+ * core set is active at session start. The `browser_tools` tool or the
4
+ * `/browser-tools` command activates a group on demand.
5
+ *
6
+ * Group membership follows the upstream chrome-devtools-mcp tool categories,
7
+ * read from the installed package at runtime so groups track the upstream
8
+ * version instead of a hand-maintained table. Names are unprefixed upstream
9
+ * tool names; the `browser_` prefix is applied where tools are registered.
10
+ */
11
+ export declare const CORE_TOOLS: readonly string[];
12
+ /** One-line summary per known upstream category, used in group listings. */
13
+ export declare const GROUP_SUMMARIES: Readonly<Record<string, string>>;
14
+ export type CategoryMap = Readonly<Record<string, string>>;
15
+ /** name → upstream category, read from the installed chrome-devtools-mcp. */
16
+ export declare function loadCategoryMap(): Promise<CategoryMap>;
17
+ /** Group registered upstream tools by category, excluding the core set. */
18
+ export declare function buildGroups(registered: readonly string[], categories: CategoryMap): Map<string, string[]>;
19
+ //# sourceMappingURL=tool-groups.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-groups.d.ts","sourceRoot":"","sources":["../src/tool-groups.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,eAAO,MAAM,UAAU,EAAE,SAAS,MAAM,EAoBvC,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAY5D,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAI3D,6EAA6E;AAC7E,wBAAsB,eAAe,IAAI,OAAO,CAAC,WAAW,CAAC,CAyB5D;AAED,2EAA2E;AAC3E,wBAAgB,WAAW,CACzB,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,UAAU,EAAE,WAAW,GACtB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAWvB"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Deferred tool groups: every upstream tool stays registered, but only the
3
+ * core set is active at session start. The `browser_tools` tool or the
4
+ * `/browser-tools` command activates a group on demand.
5
+ *
6
+ * Group membership follows the upstream chrome-devtools-mcp tool categories,
7
+ * read from the installed package at runtime so groups track the upstream
8
+ * version instead of a hand-maintained table. Names are unprefixed upstream
9
+ * tool names; the `browser_` prefix is applied where tools are registered.
10
+ */
11
+ import { createRequire } from 'node:module';
12
+ import { dirname, join } from 'node:path';
13
+ import { pathToFileURL } from 'node:url';
14
+ export const CORE_TOOLS = [
15
+ // Pages and navigation
16
+ 'list_pages',
17
+ 'new_page',
18
+ 'navigate_page',
19
+ 'select_page',
20
+ 'close_page',
21
+ 'wait_for',
22
+ // Perception
23
+ 'take_snapshot',
24
+ 'take_screenshot',
25
+ // Input
26
+ 'click',
27
+ 'fill',
28
+ 'fill_form',
29
+ 'press_key',
30
+ 'handle_dialog',
31
+ // Escape hatch and console
32
+ 'evaluate_script',
33
+ 'list_console_messages',
34
+ ];
35
+ /** One-line summary per known upstream category, used in group listings. */
36
+ export const GROUP_SUMMARIES = {
37
+ input: 'Additional input automation tools',
38
+ navigation: 'Additional page and tab management',
39
+ debugging: 'Audits, console message details, and screencast',
40
+ network: 'Network request inspection',
41
+ emulation: 'Device, locale, and viewport emulation',
42
+ memory: 'Heap snapshots and memory analysis',
43
+ performance: 'Performance traces and insights',
44
+ extensions: 'Browser extension management',
45
+ experimentalThirdParty: 'Third-party DevTools integration',
46
+ experimentalWebmcp: 'WebMCP integration',
47
+ other: 'Tools without an upstream category',
48
+ };
49
+ const require = createRequire(import.meta.url);
50
+ /** name → upstream category, read from the installed chrome-devtools-mcp. */
51
+ export async function loadCategoryMap() {
52
+ try {
53
+ const packageJsonPath = require.resolve('chrome-devtools-mcp/package.json');
54
+ const toolsUrl = pathToFileURL(join(dirname(packageJsonPath), 'build', 'src', 'tools', 'tools.js'));
55
+ const mod = (await import(toolsUrl.href));
56
+ const map = {};
57
+ for (const tool of mod.createTools({ slim: false })) {
58
+ map[tool.name] = tool.annotations?.category ?? 'other';
59
+ }
60
+ return map;
61
+ }
62
+ catch (error) {
63
+ // Upstream layout changed — grouping degrades to a single 'other' group.
64
+ console.error(`[pi-browser-use] failed to load upstream tool categories; grouping degraded: ${error instanceof Error ? error.message : String(error)}`);
65
+ return {};
66
+ }
67
+ }
68
+ /** Group registered upstream tools by category, excluding the core set. */
69
+ export function buildGroups(registered, categories) {
70
+ const core = new Set(CORE_TOOLS);
71
+ const groups = new Map();
72
+ for (const name of registered) {
73
+ if (core.has(name))
74
+ continue;
75
+ const category = categories[name] ?? 'other';
76
+ const list = groups.get(category) ?? [];
77
+ list.push(name);
78
+ groups.set(category, list);
79
+ }
80
+ return groups;
81
+ }
82
+ //# sourceMappingURL=tool-groups.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-groups.js","sourceRoot":"","sources":["../src/tool-groups.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,UAAU,GAAsB;IAC3C,uBAAuB;IACvB,YAAY;IACZ,UAAU;IACV,eAAe;IACf,aAAa;IACb,YAAY;IACZ,UAAU;IACV,aAAa;IACb,eAAe;IACf,iBAAiB;IACjB,QAAQ;IACR,OAAO;IACP,MAAM;IACN,WAAW;IACX,WAAW;IACX,eAAe;IACf,2BAA2B;IAC3B,iBAAiB;IACjB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KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CACvD,EAAE,CACH,CAAC;QACF,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,WAAW,CACzB,UAA6B,EAC7B,UAAuB;IAEvB,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC3C,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,SAAS;QAC7B,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC;QAC7C,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChB,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/pi-browser-use",
3
- "version": "0.1.2-beta.8",
3
+ "version": "0.1.2-beta.80",
4
4
  "description": "Pi extension for browser automation via chrome-devtools-mcp with browser_ prefixed tools",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -13,6 +13,9 @@
13
13
  ],
14
14
  "license": "Apache-2.0",
15
15
  "type": "module",
16
+ "engines": {
17
+ "node": "^20.19.0 || ^22.12.0 || >=23"
18
+ },
16
19
  "sideEffects": false,
17
20
  "main": "./dist/index.js",
18
21
  "types": "./dist/index.d.ts",
@@ -30,9 +33,11 @@
30
33
  },
31
34
  "files": [
32
35
  "dist",
36
+ "preview.png",
33
37
  "README.md"
34
38
  ],
35
39
  "pi": {
40
+ "image": "https://raw.githubusercontent.com/TGYD-helige/pi/master/packages/pi-browser-use/preview.png",
36
41
  "extensions": [
37
42
  "./dist/index.js"
38
43
  ]
@@ -47,18 +52,19 @@
47
52
  },
48
53
  "dependencies": {
49
54
  "@modelcontextprotocol/sdk": "^1.29.0",
50
- "@amaster.ai/pi-shared": "0.1.2-beta.8"
55
+ "chrome-devtools-mcp": "^1.6.0",
56
+ "@amaster.ai/pi-shared": "0.1.2-beta.80"
51
57
  },
52
58
  "peerDependencies": {
53
- "@earendil-works/pi-ai": ">=0.74.0",
54
- "@earendil-works/pi-coding-agent": ">=0.74.0",
59
+ "@earendil-works/pi-ai": ">=0.80.10",
60
+ "@earendil-works/pi-coding-agent": ">=0.80.10",
55
61
  "typebox": "*"
56
62
  },
57
63
  "devDependencies": {
58
- "@earendil-works/pi-ai": "0.74.0",
59
- "@earendil-works/pi-coding-agent": "0.74.0",
64
+ "@earendil-works/pi-ai": "0.85.1",
65
+ "@earendil-works/pi-coding-agent": "0.85.1",
60
66
  "tsup": "^8.4.0",
61
- "typebox": "*",
67
+ "typebox": "1.3.7",
62
68
  "vitest": "^4.0.0"
63
69
  },
64
70
  "scripts": {
package/preview.png ADDED
Binary file