chrome-ai-bridge 1.0.15 → 1.0.17

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.
@@ -267,21 +267,27 @@ export const askGeminiWeb = defineTool({
267
267
  }
268
268
  response.appendResponseLine('✅ ログイン確認完了');
269
269
  response.appendResponseLine('質問を送信中...');
270
- // Input text using Puppeteer's type() for proper Angular state updates
271
- // Gemini uses Angular and requires real keyboard events to update internal state
270
+ // Input text using innerText + event dispatch for proper Angular state updates
271
+ // This is more reliable than keyboard.type() which can cause sync issues with Angular
272
272
  const textboxSelector = '[role="textbox"]';
273
273
  const textbox = await page.$(textboxSelector);
274
274
  if (!textbox) {
275
275
  response.appendResponseLine('❌ 入力欄が見つかりません');
276
276
  return;
277
277
  }
278
- // Click to focus and clear existing content
279
- await textbox.click({ clickCount: 3 }); // Triple-click to select all
280
- await page.keyboard.press('Backspace'); // Clear selection
281
- // Type the question using real keyboard events (essential for Angular)
282
- await page.keyboard.type(sanitizedQuestion, { delay: 5 });
278
+ // Click to focus
279
+ await textbox.click();
280
+ // Use innerText + input event dispatch for proper Angular state updates
281
+ // This approach is more reliable than keyboard.type() which can cause sync issues
282
+ await textbox.evaluate((el, text) => {
283
+ // Clear and set content
284
+ el.innerText = text;
285
+ // Dispatch input event to notify Angular of the change
286
+ el.dispatchEvent(new Event('input', { bubbles: true }));
287
+ el.dispatchEvent(new Event('change', { bubbles: true }));
288
+ }, sanitizedQuestion);
283
289
  // Wait for Angular to process the input and show send button
284
- await new Promise(resolve => setTimeout(resolve, 500));
290
+ await new Promise(resolve => setTimeout(resolve, 300));
285
291
  // 質問送信前に model-response 要素数を記録(ChatGPTと同じカウント方式)
286
292
  const initialModelResponseCount = await page.evaluate(() => {
287
293
  return document.querySelectorAll('model-response').length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chrome-ai-bridge",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "MCP server bridging Chrome browser and AI assistants (ChatGPT, Gemini). Browser automation + AI consultation.",
5
5
  "type": "module",
6
6
  "bin": "./scripts/cli.mjs",