chrome-devtools-mcp-for-extension 0.22.2 → 0.22.3

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.
@@ -368,25 +368,41 @@ export const askGeminiWeb = defineTool({
368
368
  return main?.innerText.slice(-5000) || '';
369
369
  });
370
370
  response.appendResponseLine('✅ 回答完了');
371
- // Save session
372
- if (isNewChat) {
373
- const chatUrl = page.url();
374
- const chatIdMatch = chatUrl.match(/\/app\/([a-f0-9]+)/);
375
- const chatId = chatIdMatch ? chatIdMatch[1] : 'unknown-' + Date.now();
371
+ // Always save/update session (not just for new chats)
372
+ const chatUrl = page.url();
373
+ const chatIdMatch = chatUrl.match(/\/app\/([a-f0-9]+)/);
374
+ const currentChatId = chatIdMatch ? chatIdMatch[1] : null;
375
+ if (currentChatId) {
376
+ // Check if URL changed (Gemini redirected to new chat)
377
+ const urlChanged = sessionChatId && currentChatId !== sessionChatId;
378
+ if (urlChanged) {
379
+ response.appendResponseLine(`⚠️ チャットIDが変更されました: ${sessionChatId} → ${currentChatId}`);
380
+ isNewChat = true;
381
+ }
382
+ // Load existing session to get conversation count
383
+ const sessions = await loadChatSessions();
384
+ const projectSessions = sessions[project] || [];
385
+ const existingSession = projectSessions.find(s => s.chatId === currentChatId);
386
+ const newCount = (existingSession?.conversationCount || 0) + 1;
376
387
  await saveChatSession(project, {
377
- chatId,
388
+ chatId: currentChatId,
378
389
  url: chatUrl,
379
390
  lastUsed: new Date().toISOString(),
380
- createdAt: new Date().toISOString(),
391
+ createdAt: existingSession?.createdAt || new Date().toISOString(),
381
392
  title: `[Project: ${project}]`,
382
- conversationCount: 1,
393
+ conversationCount: newCount,
383
394
  });
384
- sessionChatId = chatId;
395
+ sessionChatId = currentChatId;
385
396
  }
386
- // Save log
397
+ // Save log with conversation number
398
+ const finalSessions = await loadChatSessions();
399
+ const finalProjectSessions = finalSessions[project] || [];
400
+ const finalSession = finalProjectSessions.find(s => s.chatId === sessionChatId);
401
+ const conversationNumber = finalSession?.conversationCount || 1;
387
402
  const logPath = await saveConversationLog(project, sanitizedQuestion, responseText, {
388
403
  chatUrl: page.url(),
389
404
  chatId: sessionChatId,
405
+ conversationNumber,
390
406
  });
391
407
  response.appendResponseLine(`📝 会話ログ保存: ${logPath}`);
392
408
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chrome-devtools-mcp-for-extension",
3
- "version": "0.22.2",
3
+ "version": "0.22.3",
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": "./scripts/cli.mjs",