cicy-desktop 2.1.57 → 2.1.58
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/package.json
CHANGED
|
@@ -32,11 +32,9 @@ const relay = (type, payload) =>
|
|
|
32
32
|
// install cicy-code on the user's machine, so we mirror the same bridge
|
|
33
33
|
// here. Same channel as homepage-preload's "rpc" → the existing tool
|
|
34
34
|
// registry dispatches without any further wiring.
|
|
35
|
-
|
|
36
|
-
ipcRenderer.invoke("rpc", tool, args || {}),
|
|
37
|
-
);
|
|
35
|
+
const electronRPC = (tool, args) => ipcRenderer.invoke("rpc", tool, args || {});
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
const cicyApi = {
|
|
40
38
|
platform: process.platform,
|
|
41
39
|
arch: process.arch,
|
|
42
40
|
localTeams: {
|
|
@@ -48,6 +46,19 @@ contextBridge.exposeInMainWorld("cicy", {
|
|
|
48
46
|
},
|
|
49
47
|
// (sidecar install/checkLatest removed — cicy-code is installed via
|
|
50
48
|
// `npx cicy-code` by the sidecar, no in-app downloader.)
|
|
51
|
-
}
|
|
49
|
+
};
|
|
52
50
|
|
|
53
|
-
|
|
51
|
+
// contextBridge.exposeInMainWorld ONLY works with contextIsolation:true. createWindow
|
|
52
|
+
// runs TRUSTED urls with contextIsolation:false (+ nodeIntegration:true), where
|
|
53
|
+
// exposeInMainWorld throws — there the preload already shares the page's main-world
|
|
54
|
+
// `window`, so attach the bridge to it directly. Untrusted urls are isolated and
|
|
55
|
+
// must go through contextBridge. (process.contextIsolated tells us which world we're in.)
|
|
56
|
+
if (process.contextIsolated) {
|
|
57
|
+
contextBridge.exposeInMainWorld("electronRPC", electronRPC);
|
|
58
|
+
contextBridge.exposeInMainWorld("cicy", cicyApi);
|
|
59
|
+
} else {
|
|
60
|
+
window.electronRPC = electronRPC;
|
|
61
|
+
window.cicy = Object.assign(window.cicy || {}, cicyApi);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
console.log(`[webview-preload] electronRPC + cicy.localTeams ready (isolated=${process.contextIsolated})`);
|
|
@@ -293,6 +293,12 @@ function createWindow(options = {}, accountIdx = 0, forceNew = false) {
|
|
|
293
293
|
offscreen: false, // 确保不是离屏渲染
|
|
294
294
|
nodeIntegration: isTrustedUrl(url),
|
|
295
295
|
contextIsolation: !isTrustedUrl(url),
|
|
296
|
+
// electronRPC + window.cicy for EVERY window open_window creates — without
|
|
297
|
+
// this, untrusted (contextIsolation:true) pages had no electronRPC and the
|
|
298
|
+
// agent-desktop/agent-electron skills' `desktop_event rpc_call` failed with
|
|
299
|
+
// 'electronRPC not available'. webview-preload self-adapts to the isolation
|
|
300
|
+
// mode (contextBridge when isolated, direct window assign when not).
|
|
301
|
+
preload: path.join(__dirname, "../backends/webview-preload.js"),
|
|
296
302
|
partition: `persist:sandbox-${accountIdx}`,
|
|
297
303
|
// 启用剪贴板权限
|
|
298
304
|
enableClipboard: true,
|