|
| 1 | +export interface UpdateInfo { |
| 2 | + version: string |
| 3 | + releaseDate?: string |
| 4 | +} |
| 5 | + |
| 6 | +export interface UpdateProgress { |
| 7 | + percent: number |
| 8 | + bytesPerSecond: number |
| 9 | + transferred: number |
| 10 | + total: number |
| 11 | +} |
| 12 | + |
| 13 | +export interface DesktopUser { |
| 14 | + id: string |
| 15 | + email: string |
| 16 | + name: string | null |
| 17 | + imageUrl: string | null |
| 18 | + username: string | null |
| 19 | +} |
| 20 | + |
1 | 21 | export interface DesktopApi { |
| 22 | + // Platform info |
| 23 | + platform: NodeJS.Platform |
| 24 | + arch: string |
2 | 25 | getVersion: () => Promise<string> |
3 | | - checkUpdate: () => Promise<{ version: string; downloadUrl: string } | null> |
4 | | - getPlatform: () => Promise<NodeJS.Platform> |
5 | | - getUser: () => Promise<{ |
6 | | - id: string |
7 | | - email: string |
8 | | - name: string | null |
9 | | - imageUrl: string | null |
10 | | - username: string | null |
11 | | - } | null> |
| 26 | + |
| 27 | + // Auto-update |
| 28 | + checkForUpdates: () => Promise<UpdateInfo | null> |
| 29 | + downloadUpdate: () => Promise<boolean> |
| 30 | + installUpdate: () => void |
| 31 | + onUpdateChecking: (callback: () => void) => () => void |
| 32 | + onUpdateAvailable: (callback: (info: UpdateInfo) => void) => () => void |
| 33 | + onUpdateNotAvailable: (callback: () => void) => () => void |
| 34 | + onUpdateProgress: (callback: (progress: UpdateProgress) => void) => () => void |
| 35 | + onUpdateDownloaded: (callback: (info: UpdateInfo) => void) => () => void |
| 36 | + onUpdateError: (callback: (error: string) => void) => () => void |
| 37 | + onUpdateManualCheck: (callback: () => void) => () => void |
| 38 | + |
| 39 | + // Window controls |
| 40 | + windowMinimize: () => Promise<void> |
| 41 | + windowMaximize: () => Promise<void> |
| 42 | + windowClose: () => Promise<void> |
| 43 | + windowIsMaximized: () => Promise<boolean> |
| 44 | + windowToggleFullscreen: () => Promise<void> |
| 45 | + windowIsFullscreen: () => Promise<boolean> |
| 46 | + setTrafficLightVisibility: (visible: boolean) => Promise<void> |
| 47 | + onFullscreenChange: (callback: (isFullscreen: boolean) => void) => () => void |
| 48 | + onFocusChange: (callback: (isFocused: boolean) => void) => () => void |
| 49 | + |
| 50 | + // Zoom |
| 51 | + zoomIn: () => Promise<void> |
| 52 | + zoomOut: () => Promise<void> |
| 53 | + zoomReset: () => Promise<void> |
| 54 | + getZoom: () => Promise<number> |
| 55 | + |
| 56 | + // DevTools |
| 57 | + toggleDevTools: () => Promise<void> |
| 58 | + |
| 59 | + // Analytics |
| 60 | + setAnalyticsOptOut: (optedOut: boolean) => Promise<void> |
| 61 | + |
| 62 | + // Native features |
| 63 | + setBadge: (count: number | null) => Promise<void> |
| 64 | + showNotification: (options: { title: string; body: string }) => Promise<void> |
| 65 | + openExternal: (url: string) => Promise<void> |
| 66 | + getApiBaseUrl: () => Promise<string> |
| 67 | + |
| 68 | + // Clipboard |
| 69 | + clipboardWrite: (text: string) => Promise<void> |
| 70 | + clipboardRead: () => Promise<string> |
| 71 | + |
| 72 | + // Auth |
| 73 | + getUser: () => Promise<DesktopUser | null> |
12 | 74 | isAuthenticated: () => Promise<boolean> |
13 | 75 | logout: () => Promise<void> |
14 | 76 | startAuthFlow: () => Promise<void> |
| 77 | + submitAuthCode: (code: string) => Promise<void> |
| 78 | + updateUser: (updates: { name?: string }) => Promise<DesktopUser | null> |
15 | 79 | onAuthSuccess: (callback: (user: any) => void) => () => void |
16 | 80 | onAuthError: (callback: (error: string) => void) => () => void |
| 81 | + |
| 82 | + // Shortcuts |
| 83 | + onShortcutNewAgent: (callback: () => void) => () => void |
17 | 84 | } |
18 | 85 |
|
19 | 86 | declare global { |
20 | 87 | interface Window { |
21 | | - desktopApi?: DesktopApi |
| 88 | + desktopApi: DesktopApi |
22 | 89 | } |
23 | 90 | } |
0 commit comments