poi-plugin-mcp 0.2.21 → 0.2.22

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/lib/poi-input.js +20 -12
  2. package/package.json +3 -3
package/lib/poi-input.js CHANGED
@@ -32,12 +32,14 @@ function createPoiInputProvider(options = {}) {
32
32
  return async function performPoiInput(operation) {
33
33
  validateOperationObject(operation)
34
34
  const layout = readLayout(getStore, resolveWebContents)
35
- // The game's PIXI interaction manager drops synthetic pointer events while
36
- // its document lacks focus (verified live 2026-08-17: clicks reached the
37
- // canvas yet produced no game/API effect until a real OS-level click gave
38
- // the WebView focus). Focus the hosting window first: webContents.focus()
39
- // alone cannot give the document OS focus while the window is backgrounded.
40
- focusGameWindow(layout.webContents)
35
+ // Live 2026-08-24: synthetic clicks reach the game and take effect in a
36
+ // visible, non-focused window; they only stall when the window is
37
+ // minimized/occluded and Chromium throttles the renderer (PIXI ticker
38
+ // frozen). So: un-throttle the webContents, restore a minimized window,
39
+ // and keep the document focused at the webContents level — never steal
40
+ // the user's OS foreground (the Windows foreground lock silently ignored
41
+ // the old win.focus() anyway).
42
+ prepareGameWindowForInput(layout.webContents)
41
43
 
42
44
  switch (operation.operation) {
43
45
  case 'move':
@@ -84,17 +86,23 @@ function validateOperationObject(operation) {
84
86
  }
85
87
  }
86
88
 
87
- function focusGameWindow(webContents) {
89
+ function prepareGameWindowForInput(webContents) {
90
+ try {
91
+ if (typeof webContents.setBackgroundThrottling === 'function') {
92
+ webContents.setBackgroundThrottling(false)
93
+ }
94
+ } catch (_throttleError) {
95
+ // Throttling control is best-effort; input below is still delivered.
96
+ }
88
97
  try {
89
98
  const { BrowserWindow } = require('electron')
90
99
  const win = BrowserWindow.fromWebContents(
91
100
  webContents.hostWebContents || webContents,
92
101
  )
93
- if (win && !win.isFocused()) {
94
- // show-no-activate keeps the user's foreground window; focus() then
95
- // grants the document the OS focus the game's input layer requires.
96
- if (win.isMinimized()) win.restore()
97
- win.focus()
102
+ if (win && win.isMinimized()) {
103
+ // Restoring resumes the throttled renderer; it does not need the
104
+ // OS foreground for synthetic input to work (verified 2026-08-24).
105
+ win.restore()
98
106
  }
99
107
  } catch (_windowError) {
100
108
  // Fall through to webContents-level focus below.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
- {
1
+ {
2
2
  "name": "poi-plugin-mcp",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "description": "Poi data, WebView capture, and opt-in authenticated input bridge for local KanColle tools.",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -22,7 +22,7 @@
22
22
  "test": "node --test test/*.test.js"
23
23
  },
24
24
  "poiPlugin": {
25
- "title": "MCP 数据桥",
25
+ "title": "MCP 数据桥",
26
26
  "id": "mcp_data_bridge",
27
27
  "description": "Expose Poi state, in-memory game WebView captures, and opt-in authenticated input on a local bridge.",
28
28
  "icon": "fa/database",