chrome-devtools-mcp-for-extension 0.9.34 → 0.9.36

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.
@@ -219,7 +219,7 @@ async function enableDeepResearchMode(page, response) {
219
219
  try {
220
220
  response.appendResponseLine('DeepResearchモードを有効化中...');
221
221
  // Step 1: Click "+" button (ファイルの追加など)
222
- const plusClicked = await page.evaluate(() => {
222
+ const plusButtonSelector = await page.evaluate(() => {
223
223
  const buttons = Array.from(document.querySelectorAll('button'));
224
224
  const plusButton = buttons.find((btn) => {
225
225
  const aria = btn.getAttribute('aria-label') || '';
@@ -227,32 +227,45 @@ async function enableDeepResearchMode(page, response) {
227
227
  });
228
228
  if (!plusButton)
229
229
  return { success: false, error: '+ボタン(ファイルの追加など)が見つかりません' };
230
- plusButton.click();
231
- return { success: true };
230
+ // Return selector info instead of clicking
231
+ const ariaLabel = plusButton.getAttribute('aria-label');
232
+ return { success: true, ariaLabel };
232
233
  });
233
- if (!plusClicked.success) {
234
- return { success: false, error: plusClicked.error };
234
+ if (!plusButtonSelector.success) {
235
+ return { success: false, error: plusButtonSelector.error };
235
236
  }
237
+ // Use Puppeteer's click for reliable interaction
238
+ await page.click(`button[aria-label="${plusButtonSelector.ariaLabel}"]`);
236
239
  response.appendResponseLine('✅ +ボタン(ファイルの追加など)をクリック');
237
- // Wait for menu to appear (deep combinator for shadow DOM)
238
- await page.waitForSelector(':scope >>> [role="menuitemradio"]', { visible: true, timeout: 5000 });
240
+ // Wait for menu to appear
241
+ await page.waitForSelector('[role="menuitemradio"]', { visible: true, timeout: 5000 });
239
242
  await new Promise((resolve) => setTimeout(resolve, 500));
240
- // Step 2: Click "Deep Research" menuitemradio (deep combinator for shadow DOM)
241
- const menuItems = await page.$$eval(':scope >>> [role="menuitemradio"]', (els) => els.map((el) => ({
242
- text: el.innerText.trim(),
243
- index: els.indexOf(el),
244
- })));
245
- const deepResearchIndex = menuItems.findIndex((item) => item.text.includes('Deep Research') || item.text.includes('リサーチ'));
246
- if (deepResearchIndex === -1) {
247
- return {
248
- success: false,
249
- error: `DeepResearch menuitemradio が見つかりません (found: ${menuItems.length} items: ${menuItems.map((m) => m.text).join(', ')})`,
250
- };
243
+ // Step 2: Find and click "Deep Research" menuitemradio
244
+ const deepResearchResult = await page.evaluate(() => {
245
+ const menuItems = Array.from(document.querySelectorAll('[role="menuitemradio"]'));
246
+ const deepResearchItem = menuItems.find((item) => item.textContent?.includes('Deep Research') || item.textContent?.includes('リサーチ'));
247
+ if (!deepResearchItem) {
248
+ return {
249
+ success: false,
250
+ error: `DeepResearch menuitemradio が見つかりません (found: ${menuItems.length} items: ${menuItems.map(m => m.textContent?.trim()).join(', ')})`,
251
+ };
252
+ }
253
+ // Check if already checked
254
+ const isChecked = deepResearchItem.getAttribute('aria-checked') === 'true';
255
+ if (!isChecked) {
256
+ deepResearchItem.click();
257
+ }
258
+ return { success: true, alreadyEnabled: isChecked };
259
+ });
260
+ if (!deepResearchResult.success) {
261
+ return { success: false, error: deepResearchResult.error };
262
+ }
263
+ if (deepResearchResult.alreadyEnabled) {
264
+ response.appendResponseLine('✅ DeepResearch は既に有効です');
265
+ }
266
+ else {
267
+ response.appendResponseLine('✅ DeepResearch menuitemradio をクリック');
251
268
  }
252
- // Click the found menuitemradio
253
- const menuItemElements = await page.$$(':scope >>> [role="menuitemradio"]');
254
- await menuItemElements[deepResearchIndex].click();
255
- response.appendResponseLine('✅ DeepResearch menuitemradio をクリック');
256
269
  await new Promise((resolve) => setTimeout(resolve, 1000));
257
270
  // Step 3: Verify mode was actually enabled (composer-pill detection)
258
271
  const verification = await detectDeepResearchMode(page);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chrome-devtools-mcp-for-extension",
3
- "version": "0.9.34",
3
+ "version": "0.9.36",
4
4
  "description": "MCP server for Chrome extension development with Web Store automation. Fork of chrome-devtools-mcp with extension-specific tools.",
5
5
  "type": "module",
6
6
  "bin": "./build/src/index.js",