neuron-inspector 0.2.2 → 0.3.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/dist/compound-tools.d.ts +19 -0
- package/dist/compound-tools.js +523 -0
- package/dist/compound-tools.js.map +1 -0
- package/dist/server.js +24 -1
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compound tools — high-level operations that chain multiple extension
|
|
3
|
+
* primitives in one MCP call. The AI spends inference on judgment,
|
|
4
|
+
* not puppetry.
|
|
5
|
+
*
|
|
6
|
+
* These run server-side in the bridge. The extension doesn't need to
|
|
7
|
+
* know about them — they just issue sequences of existing TOOL_CALL
|
|
8
|
+
* messages via the same PendingCalls correlation.
|
|
9
|
+
*/
|
|
10
|
+
import type { WebSocket } from "ws";
|
|
11
|
+
import type { PendingCalls } from "./correlation.js";
|
|
12
|
+
import type { ToolDef } from "./tools.js";
|
|
13
|
+
interface BridgeContext {
|
|
14
|
+
ws: WebSocket;
|
|
15
|
+
pending: PendingCalls;
|
|
16
|
+
}
|
|
17
|
+
export declare const COMPOUND_TOOLS: ToolDef[];
|
|
18
|
+
export declare function handleCompoundTool(name: string, args: Record<string, unknown>, ctx: BridgeContext): Promise<unknown>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compound tools — high-level operations that chain multiple extension
|
|
3
|
+
* primitives in one MCP call. The AI spends inference on judgment,
|
|
4
|
+
* not puppetry.
|
|
5
|
+
*
|
|
6
|
+
* These run server-side in the bridge. The extension doesn't need to
|
|
7
|
+
* know about them — they just issue sequences of existing TOOL_CALL
|
|
8
|
+
* messages via the same PendingCalls correlation.
|
|
9
|
+
*/
|
|
10
|
+
// ── Helpers ─────────────────────────────────────────────────
|
|
11
|
+
async function call(ctx, primitive, args, timeoutMs = 15000) {
|
|
12
|
+
return ctx.pending.call(ctx.ws, primitive, args, timeoutMs);
|
|
13
|
+
}
|
|
14
|
+
function sleep(ms) {
|
|
15
|
+
return new Promise((r) => setTimeout(r, ms));
|
|
16
|
+
}
|
|
17
|
+
// ── Tool definitions ────────────────────────────────────────
|
|
18
|
+
export const COMPOUND_TOOLS = [
|
|
19
|
+
{
|
|
20
|
+
name: "neuron_research_page",
|
|
21
|
+
description: "Deep-read a single URL in one call. Navigates to the page, waits for load, scrolls " +
|
|
22
|
+
"to trigger lazy content, extracts structured data, captures console errors, and takes " +
|
|
23
|
+
"a screenshot. Returns everything the AI needs to understand the page without multiple " +
|
|
24
|
+
"round-trips. Use instead of separate navigate → scroll → extract → screenshot chains.",
|
|
25
|
+
inputSchema: {
|
|
26
|
+
type: "object",
|
|
27
|
+
properties: {
|
|
28
|
+
url: { type: "string", description: "URL to research" },
|
|
29
|
+
tabId: { type: "number", description: "Use an existing tab (optional — opens a new tab if omitted)" },
|
|
30
|
+
scrolls: { type: "number", description: "Number of scroll-downs to trigger lazy content (default: 3)" },
|
|
31
|
+
screenshot: { type: "boolean", description: "Capture a screenshot (default: true)" },
|
|
32
|
+
extractSelector: { type: "string", description: "CSS selector to extract from (optional — auto-extracts if omitted)" },
|
|
33
|
+
},
|
|
34
|
+
required: ["url"],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "neuron_research_profiles",
|
|
39
|
+
description: "Research multiple URLs in parallel. Opens each URL in a separate tab, scrolls to load " +
|
|
40
|
+
"lazy content, extracts structured data from each, and returns all results in one response. " +
|
|
41
|
+
"Up to 8 URLs per call. 5-10x faster than researching one at a time. Use for batch " +
|
|
42
|
+
"profile research, multi-page data collection, or comparing pages side by side.",
|
|
43
|
+
inputSchema: {
|
|
44
|
+
type: "object",
|
|
45
|
+
properties: {
|
|
46
|
+
urls: {
|
|
47
|
+
type: "array",
|
|
48
|
+
items: { type: "string" },
|
|
49
|
+
description: "URLs to research (max 8)",
|
|
50
|
+
},
|
|
51
|
+
scrolls: { type: "number", description: "Scroll-downs per page to load lazy content (default: 2)" },
|
|
52
|
+
delayMs: { type: "number", description: "Delay between opening tabs to avoid rate limits (default: 1500ms)" },
|
|
53
|
+
closeTabs: { type: "boolean", description: "Close the tabs after extracting (default: true)" },
|
|
54
|
+
},
|
|
55
|
+
required: ["urls"],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "neuron_search_and_collect",
|
|
60
|
+
description: "Run a search on any site and collect results across multiple pages. Navigates to the URL, " +
|
|
61
|
+
"types the query into the search box, extracts results, optionally paginates (clicks 'next' / " +
|
|
62
|
+
"scrolls for infinite scroll), and returns all collected items. One call replaces the typical " +
|
|
63
|
+
"navigate → find search box → type → extract → scroll → extract → click next → extract chain.",
|
|
64
|
+
inputSchema: {
|
|
65
|
+
type: "object",
|
|
66
|
+
properties: {
|
|
67
|
+
url: { type: "string", description: "Starting URL (e.g. 'https://linkedin.com/search/results/people/')" },
|
|
68
|
+
query: { type: "string", description: "Search query to type" },
|
|
69
|
+
searchSelector: {
|
|
70
|
+
type: "string",
|
|
71
|
+
description: "CSS selector for the search input (optional — auto-detects input[type=search], input[name=q], etc.)",
|
|
72
|
+
},
|
|
73
|
+
pages: { type: "number", description: "Max pages to collect from (default: 1)" },
|
|
74
|
+
nextSelector: {
|
|
75
|
+
type: "string",
|
|
76
|
+
description: "CSS selector for the next/pagination button (optional — tries common patterns)",
|
|
77
|
+
},
|
|
78
|
+
scrollForMore: { type: "boolean", description: "Use infinite scroll instead of pagination (default: false)" },
|
|
79
|
+
extractSelector: { type: "string", description: "CSS selector for result items (optional — auto-extracts)" },
|
|
80
|
+
delayMs: { type: "number", description: "Delay between pages in ms (default: 2000)" },
|
|
81
|
+
},
|
|
82
|
+
required: ["url"],
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "neuron_fill_and_submit",
|
|
87
|
+
description: "Fill a form and optionally submit it in one call. Takes a map of field selectors to values, " +
|
|
88
|
+
"fills each one, optionally screenshots the filled form for review, and clicks the submit button " +
|
|
89
|
+
"if specified. Returns the before/after page state diff so you can verify what changed. " +
|
|
90
|
+
"Replaces the typical find → type → find → type → screenshot → click chain.",
|
|
91
|
+
inputSchema: {
|
|
92
|
+
type: "object",
|
|
93
|
+
properties: {
|
|
94
|
+
tabId: { type: "number", description: "Chrome tab ID" },
|
|
95
|
+
fields: {
|
|
96
|
+
type: "array",
|
|
97
|
+
items: {
|
|
98
|
+
type: "object",
|
|
99
|
+
properties: {
|
|
100
|
+
selectors: { type: "array", items: { type: "string" }, description: "CSS selectors to try for this field" },
|
|
101
|
+
texts: { type: "array", items: { type: "string" }, description: "Visible text labels to match" },
|
|
102
|
+
value: { type: "string", description: "Value to type into the field" },
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
description: "Fields to fill — each has selectors/texts to find the input and a value to type",
|
|
106
|
+
},
|
|
107
|
+
submitSelector: {
|
|
108
|
+
type: "string",
|
|
109
|
+
description: "CSS selector for the submit button (optional — omit to fill without submitting)",
|
|
110
|
+
},
|
|
111
|
+
submitText: {
|
|
112
|
+
type: "string",
|
|
113
|
+
description: "Visible text on the submit button (alternative to submitSelector)",
|
|
114
|
+
},
|
|
115
|
+
screenshot: { type: "boolean", description: "Screenshot the form after filling, before submit (default: true)" },
|
|
116
|
+
delayMs: { type: "number", description: "Delay between field fills in ms (default: 200)" },
|
|
117
|
+
},
|
|
118
|
+
required: ["tabId", "fields"],
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "neuron_audit_page",
|
|
123
|
+
description: "Run all quality audits on a page in one call — accessibility (WCAG), security scan, " +
|
|
124
|
+
"performance snapshot, SEO audit, and console errors. Returns a combined report. " +
|
|
125
|
+
"Replaces 5 separate tool calls (a11y_audit + security_scan + perf_snapshot + seo_audit + get_errors).",
|
|
126
|
+
inputSchema: {
|
|
127
|
+
type: "object",
|
|
128
|
+
properties: {
|
|
129
|
+
tabId: { type: "number", description: "Chrome tab ID to audit" },
|
|
130
|
+
audits: {
|
|
131
|
+
type: "array",
|
|
132
|
+
items: { type: "string" },
|
|
133
|
+
description: "Which audits to run (default: all). Options: a11y, security, performance, seo, errors",
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
required: ["tabId"],
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "neuron_monitor_action",
|
|
141
|
+
description: "Snapshot page state, perform an action (click/type/navigate), then diff to see what changed. " +
|
|
142
|
+
"One call replaces the snapshot_state → click → wait → snapshot_state → diff_states chain. " +
|
|
143
|
+
"Use to verify that a button click, form submit, or navigation actually did what was expected.",
|
|
144
|
+
inputSchema: {
|
|
145
|
+
type: "object",
|
|
146
|
+
properties: {
|
|
147
|
+
tabId: { type: "number", description: "Chrome tab ID" },
|
|
148
|
+
action: {
|
|
149
|
+
type: "object",
|
|
150
|
+
properties: {
|
|
151
|
+
type: { type: "string", description: "Action type: click, type, navigate" },
|
|
152
|
+
selectors: { type: "array", items: { type: "string" }, description: "CSS selectors (for click/type)" },
|
|
153
|
+
texts: { type: "array", items: { type: "string" }, description: "Visible text (for click)" },
|
|
154
|
+
value: { type: "string", description: "Value to type (for type action)" },
|
|
155
|
+
url: { type: "string", description: "URL to navigate to (for navigate action)" },
|
|
156
|
+
},
|
|
157
|
+
description: "The action to perform between snapshots",
|
|
158
|
+
},
|
|
159
|
+
waitMs: { type: "number", description: "Wait time after action before diffing (default: 1500)" },
|
|
160
|
+
screenshot: { type: "boolean", description: "Screenshot after action (default: true)" },
|
|
161
|
+
},
|
|
162
|
+
required: ["tabId", "action"],
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
];
|
|
166
|
+
// ── Handlers ────────────────────────────────────────────────
|
|
167
|
+
export async function handleCompoundTool(name, args, ctx) {
|
|
168
|
+
switch (name) {
|
|
169
|
+
case "neuron_research_page":
|
|
170
|
+
return researchPage(args, ctx);
|
|
171
|
+
case "neuron_research_profiles":
|
|
172
|
+
return researchProfiles(args, ctx);
|
|
173
|
+
case "neuron_search_and_collect":
|
|
174
|
+
return searchAndCollect(args, ctx);
|
|
175
|
+
case "neuron_fill_and_submit":
|
|
176
|
+
return fillAndSubmit(args, ctx);
|
|
177
|
+
case "neuron_audit_page":
|
|
178
|
+
return auditPage(args, ctx);
|
|
179
|
+
case "neuron_monitor_action":
|
|
180
|
+
return monitorAction(args, ctx);
|
|
181
|
+
default:
|
|
182
|
+
throw new Error(`Unknown compound tool: ${name}`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// ── Implementations ─────────────────────────────────────────
|
|
186
|
+
async function researchPage(args, ctx) {
|
|
187
|
+
const url = args.url;
|
|
188
|
+
const scrollCount = args.scrolls ?? 3;
|
|
189
|
+
const wantScreenshot = args.screenshot ?? true;
|
|
190
|
+
const extractSel = args.extractSelector;
|
|
191
|
+
// Open tab or reuse
|
|
192
|
+
let tabId = args.tabId;
|
|
193
|
+
if (!tabId) {
|
|
194
|
+
const tab = (await call(ctx, "openTab", { url }));
|
|
195
|
+
tabId = tab?.tabId;
|
|
196
|
+
await sleep(2000); // initial page load
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
await call(ctx, "navigateTo", { tabId, url });
|
|
200
|
+
await sleep(2000);
|
|
201
|
+
}
|
|
202
|
+
if (!tabId)
|
|
203
|
+
throw new Error("Failed to open tab");
|
|
204
|
+
// Scroll to trigger lazy content
|
|
205
|
+
for (let i = 0; i < scrollCount; i++) {
|
|
206
|
+
await call(ctx, "scrollPage", { tabId, deltaY: 800, smooth: true });
|
|
207
|
+
await sleep(600);
|
|
208
|
+
}
|
|
209
|
+
// Extract structured data
|
|
210
|
+
const extractArgs = { tabId };
|
|
211
|
+
if (extractSel)
|
|
212
|
+
extractArgs.selector = extractSel;
|
|
213
|
+
const data = await call(ctx, "extractData", extractArgs);
|
|
214
|
+
// Get errors
|
|
215
|
+
const errors = await call(ctx, "getRecentErrors", { tabId, limit: 10 });
|
|
216
|
+
// Screenshot
|
|
217
|
+
let screenshot = null;
|
|
218
|
+
if (wantScreenshot) {
|
|
219
|
+
try {
|
|
220
|
+
screenshot = await call(ctx, "captureScreenshot", { tabId });
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
// non-fatal — tab might not be in foreground
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
url,
|
|
228
|
+
tabId,
|
|
229
|
+
data,
|
|
230
|
+
errors,
|
|
231
|
+
screenshot,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
async function researchProfiles(args, ctx) {
|
|
235
|
+
const urls = args.urls.slice(0, 8);
|
|
236
|
+
const scrollCount = args.scrolls ?? 2;
|
|
237
|
+
const delayMs = args.delayMs ?? 1500;
|
|
238
|
+
const closeTabs = args.closeTabs ?? true;
|
|
239
|
+
const results = [];
|
|
240
|
+
const openTabs = [];
|
|
241
|
+
// Open all tabs with delay between each
|
|
242
|
+
for (const url of urls) {
|
|
243
|
+
try {
|
|
244
|
+
const tab = (await call(ctx, "openTab", { url }));
|
|
245
|
+
const tabId = tab?.tabId ?? null;
|
|
246
|
+
results.push({ url, tabId, data: null, error: null });
|
|
247
|
+
if (tabId)
|
|
248
|
+
openTabs.push(tabId);
|
|
249
|
+
}
|
|
250
|
+
catch (err) {
|
|
251
|
+
results.push({ url, tabId: null, data: null, error: err.message });
|
|
252
|
+
}
|
|
253
|
+
if (delayMs > 0)
|
|
254
|
+
await sleep(delayMs);
|
|
255
|
+
}
|
|
256
|
+
// Wait for all pages to load
|
|
257
|
+
await sleep(2500);
|
|
258
|
+
// Extract from each tab
|
|
259
|
+
for (const result of results) {
|
|
260
|
+
if (!result.tabId)
|
|
261
|
+
continue;
|
|
262
|
+
try {
|
|
263
|
+
// Scroll to load lazy content
|
|
264
|
+
for (let i = 0; i < scrollCount; i++) {
|
|
265
|
+
await call(ctx, "scrollPage", { tabId: result.tabId, deltaY: 600, smooth: true });
|
|
266
|
+
await sleep(400);
|
|
267
|
+
}
|
|
268
|
+
result.data = await call(ctx, "extractData", { tabId: result.tabId });
|
|
269
|
+
}
|
|
270
|
+
catch (err) {
|
|
271
|
+
result.error = err.message;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
// Close tabs
|
|
275
|
+
if (closeTabs) {
|
|
276
|
+
for (const tabId of openTabs) {
|
|
277
|
+
try {
|
|
278
|
+
await call(ctx, "evaluateJS", { tabId, expression: "window.close()" });
|
|
279
|
+
}
|
|
280
|
+
catch {
|
|
281
|
+
// non-fatal
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return {
|
|
286
|
+
count: results.length,
|
|
287
|
+
successful: results.filter((r) => r.data && !r.error).length,
|
|
288
|
+
failed: results.filter((r) => r.error).length,
|
|
289
|
+
results,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
async function searchAndCollect(args, ctx) {
|
|
293
|
+
const url = args.url;
|
|
294
|
+
const query = args.query;
|
|
295
|
+
const searchSel = args.searchSelector;
|
|
296
|
+
const maxPages = args.pages ?? 1;
|
|
297
|
+
const nextSel = args.nextSelector;
|
|
298
|
+
const scrollMore = args.scrollForMore ?? false;
|
|
299
|
+
const extractSel = args.extractSelector;
|
|
300
|
+
const delayMs = args.delayMs ?? 2000;
|
|
301
|
+
// Navigate
|
|
302
|
+
const tab = (await call(ctx, "openTab", { url }));
|
|
303
|
+
const tabId = tab?.tabId;
|
|
304
|
+
if (!tabId)
|
|
305
|
+
throw new Error("Failed to open tab");
|
|
306
|
+
await sleep(2500);
|
|
307
|
+
// Type query if provided
|
|
308
|
+
if (query) {
|
|
309
|
+
const searchSelectors = searchSel
|
|
310
|
+
? [searchSel]
|
|
311
|
+
: ["input[type='search']", "input[name='q']", "input[name='keywords']",
|
|
312
|
+
"input[name='query']", "input[placeholder*='earch']", "input[aria-label*='earch']"];
|
|
313
|
+
await call(ctx, "typeText", { tabId, selectors: searchSelectors, value: query });
|
|
314
|
+
await sleep(500);
|
|
315
|
+
// Press enter
|
|
316
|
+
await call(ctx, "evaluateJS", {
|
|
317
|
+
tabId,
|
|
318
|
+
expression: `document.querySelector("${searchSelectors.join('","')}").dispatchEvent(new KeyboardEvent('keydown',{key:'Enter',code:'Enter',keyCode:13,bubbles:true}))`,
|
|
319
|
+
});
|
|
320
|
+
await sleep(delayMs);
|
|
321
|
+
}
|
|
322
|
+
// Collect results across pages
|
|
323
|
+
const allItems = [];
|
|
324
|
+
for (let page = 0; page < maxPages; page++) {
|
|
325
|
+
// Scroll to load content
|
|
326
|
+
for (let i = 0; i < 3; i++) {
|
|
327
|
+
await call(ctx, "scrollPage", { tabId, deltaY: 600, smooth: true });
|
|
328
|
+
await sleep(400);
|
|
329
|
+
}
|
|
330
|
+
// Extract
|
|
331
|
+
const extractArgs = { tabId };
|
|
332
|
+
if (extractSel)
|
|
333
|
+
extractArgs.selector = extractSel;
|
|
334
|
+
const pageData = (await call(ctx, "extractData", extractArgs));
|
|
335
|
+
const items = pageData?.items ?? (Array.isArray(pageData) ? pageData : [pageData]);
|
|
336
|
+
allItems.push(...items);
|
|
337
|
+
// Paginate
|
|
338
|
+
if (page < maxPages - 1) {
|
|
339
|
+
if (scrollMore) {
|
|
340
|
+
// Infinite scroll — keep scrolling
|
|
341
|
+
for (let i = 0; i < 5; i++) {
|
|
342
|
+
await call(ctx, "scrollPage", { tabId, deltaY: 1000, smooth: true });
|
|
343
|
+
await sleep(800);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
// Click next button
|
|
348
|
+
const nextSelectors = nextSel
|
|
349
|
+
? [nextSel]
|
|
350
|
+
: ["button[aria-label='Next']", "a[aria-label='Next']", ".pagination-next",
|
|
351
|
+
"button:has(> svg[aria-label='Next'])", "[data-test='pagination-next']"];
|
|
352
|
+
try {
|
|
353
|
+
await call(ctx, "clickElement", { tabId, selectors: nextSelectors });
|
|
354
|
+
await sleep(delayMs);
|
|
355
|
+
}
|
|
356
|
+
catch {
|
|
357
|
+
break; // no more pages
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return {
|
|
363
|
+
tabId,
|
|
364
|
+
query,
|
|
365
|
+
pages_collected: Math.min(maxPages, allItems.length > 0 ? maxPages : 1),
|
|
366
|
+
total_items: allItems.length,
|
|
367
|
+
items: allItems,
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
async function fillAndSubmit(args, ctx) {
|
|
371
|
+
const tabId = args.tabId;
|
|
372
|
+
const fields = args.fields;
|
|
373
|
+
const submitSel = args.submitSelector;
|
|
374
|
+
const submitText = args.submitText;
|
|
375
|
+
const wantScreenshot = args.screenshot ?? true;
|
|
376
|
+
const delayMs = args.delayMs ?? 200;
|
|
377
|
+
// Snapshot before
|
|
378
|
+
await call(ctx, "snapshotState", { tabId, label: "pre-fill" });
|
|
379
|
+
// Fill each field
|
|
380
|
+
const fieldResults = [];
|
|
381
|
+
for (const field of fields) {
|
|
382
|
+
try {
|
|
383
|
+
await call(ctx, "typeText", {
|
|
384
|
+
tabId,
|
|
385
|
+
selectors: field.selectors,
|
|
386
|
+
texts: field.texts,
|
|
387
|
+
value: field.value,
|
|
388
|
+
});
|
|
389
|
+
fieldResults.push({ selectors: field.selectors, status: "filled" });
|
|
390
|
+
}
|
|
391
|
+
catch (err) {
|
|
392
|
+
fieldResults.push({ selectors: field.selectors, status: `error: ${err.message}` });
|
|
393
|
+
}
|
|
394
|
+
if (delayMs > 0)
|
|
395
|
+
await sleep(delayMs);
|
|
396
|
+
}
|
|
397
|
+
// Screenshot
|
|
398
|
+
let screenshot = null;
|
|
399
|
+
if (wantScreenshot) {
|
|
400
|
+
try {
|
|
401
|
+
screenshot = await call(ctx, "captureScreenshot", { tabId });
|
|
402
|
+
}
|
|
403
|
+
catch { /* non-fatal */ }
|
|
404
|
+
}
|
|
405
|
+
// Submit if requested
|
|
406
|
+
let submitted = false;
|
|
407
|
+
if (submitSel || submitText) {
|
|
408
|
+
try {
|
|
409
|
+
await call(ctx, "clickElement", {
|
|
410
|
+
tabId,
|
|
411
|
+
selectors: submitSel ? [submitSel] : undefined,
|
|
412
|
+
texts: submitText ? [submitText] : undefined,
|
|
413
|
+
});
|
|
414
|
+
submitted = true;
|
|
415
|
+
await sleep(1500);
|
|
416
|
+
}
|
|
417
|
+
catch (err) {
|
|
418
|
+
return {
|
|
419
|
+
fields: fieldResults,
|
|
420
|
+
screenshot,
|
|
421
|
+
submitted: false,
|
|
422
|
+
submit_error: err.message,
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
// Snapshot after
|
|
427
|
+
await call(ctx, "snapshotState", { tabId, label: "post-fill" });
|
|
428
|
+
const diff = await call(ctx, "diffStates", { before: "pre-fill", after: "post-fill" });
|
|
429
|
+
return {
|
|
430
|
+
fields: fieldResults,
|
|
431
|
+
screenshot,
|
|
432
|
+
submitted,
|
|
433
|
+
diff,
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
async function auditPage(args, ctx) {
|
|
437
|
+
const tabId = args.tabId;
|
|
438
|
+
const requestedAudits = args.audits ?? ["a11y", "security", "performance", "seo", "errors"];
|
|
439
|
+
const results = {};
|
|
440
|
+
// Run audits in parallel where possible (they're read-only, no conflicts)
|
|
441
|
+
const promises = [];
|
|
442
|
+
if (requestedAudits.includes("a11y")) {
|
|
443
|
+
promises.push(["a11y", call(ctx, "a11yAudit", { tabId })]);
|
|
444
|
+
}
|
|
445
|
+
if (requestedAudits.includes("security")) {
|
|
446
|
+
promises.push(["security", call(ctx, "securityScan", { tabId })]);
|
|
447
|
+
}
|
|
448
|
+
if (requestedAudits.includes("performance")) {
|
|
449
|
+
promises.push(["performance", call(ctx, "perfSnapshot", { tabId })]);
|
|
450
|
+
}
|
|
451
|
+
if (requestedAudits.includes("seo")) {
|
|
452
|
+
promises.push(["seo", call(ctx, "seoAudit", { tabId })]);
|
|
453
|
+
}
|
|
454
|
+
if (requestedAudits.includes("errors")) {
|
|
455
|
+
promises.push(["errors", call(ctx, "getRecentErrors", { tabId, limit: 20 })]);
|
|
456
|
+
}
|
|
457
|
+
// Await all in parallel
|
|
458
|
+
const settled = await Promise.allSettled(promises.map(([, p]) => p));
|
|
459
|
+
for (let i = 0; i < promises.length; i++) {
|
|
460
|
+
const [key] = promises[i];
|
|
461
|
+
const result = settled[i];
|
|
462
|
+
results[key] = result.status === "fulfilled" ? result.value : { error: result.reason.message };
|
|
463
|
+
}
|
|
464
|
+
return {
|
|
465
|
+
tabId,
|
|
466
|
+
audits_run: requestedAudits,
|
|
467
|
+
results,
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
async function monitorAction(args, ctx) {
|
|
471
|
+
const tabId = args.tabId;
|
|
472
|
+
const action = args.action;
|
|
473
|
+
const waitMs = args.waitMs ?? 1500;
|
|
474
|
+
const wantScreenshot = args.screenshot ?? true;
|
|
475
|
+
// Snapshot before
|
|
476
|
+
await call(ctx, "snapshotState", { tabId, label: "before-action" });
|
|
477
|
+
// Perform action
|
|
478
|
+
let actionResult = null;
|
|
479
|
+
switch (action.type) {
|
|
480
|
+
case "click":
|
|
481
|
+
actionResult = await call(ctx, "clickElement", {
|
|
482
|
+
tabId,
|
|
483
|
+
selectors: action.selectors,
|
|
484
|
+
texts: action.texts,
|
|
485
|
+
});
|
|
486
|
+
break;
|
|
487
|
+
case "type":
|
|
488
|
+
actionResult = await call(ctx, "typeText", {
|
|
489
|
+
tabId,
|
|
490
|
+
selectors: action.selectors,
|
|
491
|
+
value: action.value,
|
|
492
|
+
});
|
|
493
|
+
break;
|
|
494
|
+
case "navigate":
|
|
495
|
+
actionResult = await call(ctx, "navigateTo", { tabId, url: action.url });
|
|
496
|
+
break;
|
|
497
|
+
default:
|
|
498
|
+
throw new Error(`Unknown action type: ${action.type}`);
|
|
499
|
+
}
|
|
500
|
+
// Wait for effects
|
|
501
|
+
await sleep(waitMs);
|
|
502
|
+
// Screenshot
|
|
503
|
+
let screenshot = null;
|
|
504
|
+
if (wantScreenshot) {
|
|
505
|
+
try {
|
|
506
|
+
screenshot = await call(ctx, "captureScreenshot", { tabId });
|
|
507
|
+
}
|
|
508
|
+
catch { /* non-fatal */ }
|
|
509
|
+
}
|
|
510
|
+
// Snapshot after and diff
|
|
511
|
+
await call(ctx, "snapshotState", { tabId, label: "after-action" });
|
|
512
|
+
const diff = await call(ctx, "diffStates", { before: "before-action", after: "after-action" });
|
|
513
|
+
// Check for errors
|
|
514
|
+
const errors = await call(ctx, "getRecentErrors", { tabId, limit: 5 });
|
|
515
|
+
return {
|
|
516
|
+
action: action.type,
|
|
517
|
+
actionResult,
|
|
518
|
+
screenshot,
|
|
519
|
+
diff,
|
|
520
|
+
errors,
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
//# sourceMappingURL=compound-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compound-tools.js","sourceRoot":"","sources":["../src/compound-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH,+DAA+D;AAE/D,KAAK,UAAU,IAAI,CACjB,GAAkB,EAClB,SAAiB,EACjB,IAA6B,EAC7B,SAAS,GAAG,KAAK;IAEjB,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,+DAA+D;AAE/D,MAAM,CAAC,MAAM,cAAc,GAAc;IACvC;QACE,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EACT,qFAAqF;YACrF,wFAAwF;YACxF,wFAAwF;YACxF,uFAAuF;QACzF,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;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E,EAAE,KAAK,EAAE,CAAC,CAAC;QAC/D,CAAC;QAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC;IAC7B,CAAC;IAED,0BAA0B;IAC1B,MAAM,IAAI,CAAC,GAAG,EAAE,eAAe,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;IACnE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;IAE/F,mBAAmB;IACnB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,iBAAiB,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAEvE,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,IAAI;QACnB,YAAY;QACZ,UAAU;QACV,IAAI;QACJ,MAAM;KACP,CAAC;AACJ,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -5,6 +5,7 @@ import { z } from "zod";
|
|
|
5
5
|
import { PendingCalls } from "./correlation.js";
|
|
6
6
|
import { TOOLS, toolToPrimitive } from "./tools.js";
|
|
7
7
|
import { RECIPE_TOOLS, handleRecipeTool } from "./recipe-tools.js";
|
|
8
|
+
import { COMPOUND_TOOLS, handleCompoundTool } from "./compound-tools.js";
|
|
8
9
|
function propToZod(p) {
|
|
9
10
|
let zt;
|
|
10
11
|
if (Array.isArray(p?.enum) && p.enum.length > 0) {
|
|
@@ -121,11 +122,33 @@ for (const tool of RECIPE_TOOLS) {
|
|
|
121
122
|
}
|
|
122
123
|
});
|
|
123
124
|
}
|
|
125
|
+
// Compound tools (bridge-side orchestration, forward to extension)
|
|
126
|
+
for (const tool of COMPOUND_TOOLS) {
|
|
127
|
+
mcp.tool(tool.name, tool.description, shapeFromSchema(tool.inputSchema), async (args) => {
|
|
128
|
+
if (!extensionWs || extensionWs.readyState !== WebSocket.OPEN) {
|
|
129
|
+
return {
|
|
130
|
+
content: [{ type: "text", text: "Extension not connected. Open Chrome with the Neuron extension and enable developer mode." }],
|
|
131
|
+
isError: true,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
const result = await handleCompoundTool(tool.name, args, { ws: extensionWs, pending });
|
|
136
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
137
|
+
}
|
|
138
|
+
catch (err) {
|
|
139
|
+
return {
|
|
140
|
+
content: [{ type: "text", text: `Error: ${err.message}` }],
|
|
141
|
+
isError: true,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
124
146
|
// ── Start ────────────────────────────────────────────────────
|
|
125
147
|
async function main() {
|
|
126
148
|
const transport = new StdioServerTransport();
|
|
127
149
|
await mcp.connect(transport);
|
|
128
|
-
|
|
150
|
+
const total = TOOLS.length + COMPOUND_TOOLS.length + RECIPE_TOOLS.length;
|
|
151
|
+
console.error(`[bridge] MCP server ready on stdio (${total} tools: ${TOOLS.length} browser + ${COMPOUND_TOOLS.length} compound + ${RECIPE_TOOLS.length} recipe)`);
|
|
129
152
|
}
|
|
130
153
|
main().catch((err) => {
|
|
131
154
|
console.error("[bridge] Fatal:", err);
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAChD,OAAO,EAAE,CAAC,EAAmB,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO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OAAO,EAAE,CAC7B,CAAC;YACF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAChF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAW,GAAa,CAAC,OAAO,EAAE,EAAE,CAAC;gBACrE,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,gEAAgE;AAEhE,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;IACzE,OAAO,CAAC,KAAK,CAAC,uCAAuC,KAAK,WAAW,KAAK,CAAC,MAAM,cAAc,cAAc,CAAC,MAAM,eAAe,YAAY,CAAC,MAAM,UAAU,CAAC,CAAC;AACpK,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neuron-inspector",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "64 tools for AI agents. Turn Chrome into an MCP server — inspect DOM, automate clicks, audit security, mock APIs, extract data, record demos, self-improving recipes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/server.js",
|