n8n-nodes-smart-browser-automation 1.1.6 → 1.1.9
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.
|
@@ -202,6 +202,19 @@ class SmartBrowserAutomation {
|
|
|
202
202
|
if (enabledTools.length > 0) {
|
|
203
203
|
tools = tools.filter(tool => enabledTools.includes(tool.name));
|
|
204
204
|
}
|
|
205
|
+
// Sort tools to prioritize core actions
|
|
206
|
+
const priorityTools = ['browser_navigate', 'browser_click', 'browser_type', 'browser_press_key', 'browser_scroll_to', 'browser_get_text'];
|
|
207
|
+
tools.sort((a, b) => {
|
|
208
|
+
const indexA = priorityTools.indexOf(a.name);
|
|
209
|
+
const indexB = priorityTools.indexOf(b.name);
|
|
210
|
+
if (indexA !== -1 && indexB !== -1)
|
|
211
|
+
return indexA - indexB;
|
|
212
|
+
if (indexA !== -1)
|
|
213
|
+
return -1;
|
|
214
|
+
if (indexB !== -1)
|
|
215
|
+
return 1;
|
|
216
|
+
return a.name.localeCompare(b.name);
|
|
217
|
+
});
|
|
205
218
|
// Add a custom tool for the AI to connect to a specific CDP URL
|
|
206
219
|
const connectTool = {
|
|
207
220
|
name: 'browser_connect_cdp',
|
|
@@ -287,11 +300,7 @@ class SmartBrowserAutomation {
|
|
|
287
300
|
// AI Agent mode: Just initialize or close
|
|
288
301
|
const operation = this.getNodeParameter('operation', i);
|
|
289
302
|
if (operation === 'initialize') {
|
|
290
|
-
|
|
291
|
-
const cdpUrl = options.cdpUrl || credentials.cdpEndpoint;
|
|
292
|
-
if (verbose) {
|
|
293
|
-
console.log(`Initializing AI session with CDP: ${cdpUrl}`);
|
|
294
|
-
}
|
|
303
|
+
const cdpUrl = credentials.cdpEndpoint;
|
|
295
304
|
const tools = await sessionManager.initialize(credentials.mcpEndpoint, true, cdpUrl);
|
|
296
305
|
let connectionStatus = 'Skipped (No CDP URL provided)';
|
|
297
306
|
let connectionResult = null;
|
|
@@ -316,7 +325,6 @@ class SmartBrowserAutomation {
|
|
|
316
325
|
browserConnection: connectionStatus,
|
|
317
326
|
browserResponse: connectionResult,
|
|
318
327
|
totalToolsAvailable: tools.length,
|
|
319
|
-
// We omit the full tools list here to keep the n8n UI clean
|
|
320
328
|
},
|
|
321
329
|
pairedItem: i,
|
|
322
330
|
});
|