poi-plugin-mcp 0.2.23 → 0.2.24
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.
- package/lib/poi-auto-interaction-recorder.js +23 -4
- package/lib/poi-webview-runtime.js +1238 -1181
- package/package.json +1 -1
|
@@ -13,6 +13,13 @@ function createPoiAutoInteractionRecorder(options = {}) {
|
|
|
13
13
|
const remote = loadElectronRemote()
|
|
14
14
|
return remote.webContents.fromId(webContentsId)
|
|
15
15
|
})
|
|
16
|
+
// Remote-proxy memoization (0909 leak fix): every getWebContents() across
|
|
17
|
+
// @electron/remote registers fresh objects in poi's main-process
|
|
18
|
+
// ObjectsRegistry; at ~1 call/sec the per-context Map hits V8's size cap
|
|
19
|
+
// (RangeError: Map maximum size exceeded) and ALL game writes die until
|
|
20
|
+
// poi restarts. Resolve by integer id (no registration) and cache the
|
|
21
|
+
// proxy — Electron ids are monotonic, never reused after destroy.
|
|
22
|
+
const webContentsProxyCache = new Map()
|
|
16
23
|
let captureScreenshot = options.captureScreenshot || null
|
|
17
24
|
const createSessionRecorder = options.createSessionRecorder
|
|
18
25
|
const eventTarget = options.eventTarget === undefined
|
|
@@ -63,12 +70,24 @@ function createPoiAutoInteractionRecorder(options = {}) {
|
|
|
63
70
|
function currentWebContents() {
|
|
64
71
|
const layout = getStore('layout.webview')
|
|
65
72
|
if (!layout || !layout.ref) return null
|
|
66
|
-
if (typeof layout.ref.getWebContents === 'function') {
|
|
67
|
-
return layout.ref.getWebContents()
|
|
68
|
-
}
|
|
69
73
|
if (typeof layout.ref.getWebContentsId === 'function') {
|
|
70
74
|
const id = layout.ref.getWebContentsId()
|
|
71
|
-
if (Number.isInteger(id) && id > 0)
|
|
75
|
+
if (Number.isInteger(id) && id > 0) {
|
|
76
|
+
const hit = webContentsProxyCache.get(id)
|
|
77
|
+
if (hit) return hit
|
|
78
|
+
const resolved = resolveWebContents(id)
|
|
79
|
+
if (resolved) {
|
|
80
|
+
webContentsProxyCache.set(id, resolved)
|
|
81
|
+
return resolved
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (typeof layout.ref.getWebContents === 'function') {
|
|
86
|
+
const webContents = layout.ref.getWebContents()
|
|
87
|
+
if (webContents) {
|
|
88
|
+
webContentsProxyCache.set('ref', webContents)
|
|
89
|
+
return webContents
|
|
90
|
+
}
|
|
72
91
|
}
|
|
73
92
|
return null
|
|
74
93
|
}
|