Files
CodePilot/electron/preload.ts
T
7418andClaude Opus 4.6 857e9fc413 refactor: Electron install wizard, connection status, and platform detection
- Rewrite install-check-prerequisites with multi-path Claude CLI detection
  (native, bun, homebrew, npm) and structured result reporting
- Improve InstallWizard with step-by-step progress and better error handling
- Enhance ConnectionStatus with detailed status display and invalidation
- Add /api/claude-status/invalidate route for cache-busting
- Expand platform.ts with richer detection utilities
- Add onInitMeta handler in stream-session-manager
- Update electron.d.ts types for new IPC channels

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 17:27:35 +08:00

32 lines
1.2 KiB
TypeScript

// eslint-disable-next-line @typescript-eslint/no-require-imports
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('electronAPI', {
versions: {
electron: process.versions.electron,
node: process.versions.node,
chrome: process.versions.chrome,
},
shell: {
openPath: (folderPath: string) => ipcRenderer.invoke('shell:open-path', folderPath),
},
dialog: {
openFolder: (options?: { defaultPath?: string; title?: string }) =>
ipcRenderer.invoke('dialog:open-folder', options),
},
install: {
checkPrerequisites: () => ipcRenderer.invoke('install:check-prerequisites'),
start: () => ipcRenderer.invoke('install:start'),
cancel: () => ipcRenderer.invoke('install:cancel'),
getLogs: () => ipcRenderer.invoke('install:get-logs'),
onProgress: (callback: (data: unknown) => void) => {
const listener = (_event: unknown, data: unknown) => callback(data);
ipcRenderer.on('install:progress', listener);
return () => { ipcRenderer.removeListener('install:progress', listener); };
},
},
bridge: {
isActive: () => ipcRenderer.invoke('bridge:is-active'),
},
});