fix: 修复桌面集成失效 + 清理死代码

- main.ts: window.__metonaBridge → window.metonaDesktop(与 preload.ts 对齐)
- 删除 DesktopBridge 接口和 __metonaBridge 类型(从未使用)
- 删除 extractDocument(定义了但无调用)
- 删除 logIPC(导出了但零引用)
- 删除 getMessagesContainer(导出了但无调用)
- SAFE_DATA_TYPES 去掉多余的 export
- vite.config.ts 移除未使用的 server 配置
This commit is contained in:
thzxx
2026-04-07 01:28:07 +08:00
parent e1e67dd285
commit 58ef272061
7 changed files with 2 additions and 34 deletions
-20
View File
@@ -234,25 +234,6 @@ export interface SaveFileOptions {
filters?: Array<{ name: string; extensions: string[] }>;
}
// ── 桌面 Bridge 接口 ──
export interface DesktopBridge {
isDesktop: boolean;
getInfo: () => Promise<{ platform: string; version: string; arch?: string; electronVersion?: string; userDataPath?: string }>;
openFile: (filters?: Array<{ name: string; extensions: string[] }>) => Promise<string[] | null>;
saveFile: (options?: SaveFileOptions) => Promise<string | null>;
readFile: (filePath: string) => Promise<{ success: boolean; content?: string; name?: string; error?: string }>;
writeFile: (filePath: string, content: string) => Promise<{ success: boolean; error?: string }>;
notify: (title: string, body: string) => void;
minimize: () => void;
maximize: () => void;
close: () => void;
openExternal: (url: string) => void;
onMenuAction: (callback: (action: string) => void) => void;
onTrayAction: (callback: (action: string) => void) => void;
off: (channel: string) => void;
}
// ── State Keys ──
export type StateKey =
@@ -333,7 +314,6 @@ export type AgentState = 'idle' | 'sending' | 'accumulating' | 'executing' | 'co
declare global {
interface Window {
metonaDesktop?: MetonaDesktopAPI;
__metonaBridge?: DesktopBridge;
}
}