safari-mcp 2.7.15 → 2.7.16

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/safari.js +2 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "safari-mcp",
3
- "version": "2.7.15",
3
+ "version": "2.7.16",
4
4
  "mcpName": "io.github.achiya-automation/safari-mcp",
5
5
  "description": "Safari browser automation for AI agents — native macOS, zero Chrome overhead. 80 tools via AppleScript + JavaScript.",
6
6
  "type": "module",
package/safari.js CHANGED
@@ -1551,7 +1551,7 @@ export async function pressKey({ key, modifiers = [] }) {
1551
1551
  const shiftKey = hasShift;
1552
1552
  const altKey = modifiers.some((m) => m.toLowerCase() === "alt");
1553
1553
 
1554
- await runJS(
1554
+ const result = await runJS(
1555
1555
  `(function(){
1556
1556
  var el = document.activeElement || document.body;
1557
1557
  var opts = {key:'${safeKey}',code:'Key${safeKey.length === 1 ? safeKey.toUpperCase() : safeKey}',bubbles:true,cancelable:true,shiftKey:${shiftKey},altKey:${altKey}};
@@ -1593,13 +1593,7 @@ export async function pressKey({ key, modifiers = [] }) {
1593
1593
  // (~50ms), send real keystroke, then immediately restore the previous
1594
1594
  // frontmost app. The visual flash is imperceptible (<100ms total).
1595
1595
  if (result === '__ENTER_NOT_HANDLED__') {
1596
- const savedApp = await saveFrontmostApp();
1597
- await osascript(`tell application "Safari" to activate`);
1598
- await new Promise(r => setTimeout(r, 80));
1599
- await osascript(`tell application "System Events" to keystroke return`);
1600
- await new Promise(r => setTimeout(r, 50));
1601
- await restoreFocusIfStolen(savedApp);
1602
- return `Pressed: enter (native fallback — brief activate+restore)`;
1596
+ return `Pressed: enter (JS keydown dispatched but not handled — the app likely requires isTrusted:true. Editor content is ready; the user needs to press Enter in Safari to submit.)`;
1603
1597
  }
1604
1598
 
1605
1599
  return `Pressed: ${modifiers.length ? modifiers.join("+") + "+" : ""}${key}`;