feat: add desktop storage cleanup controls

This commit is contained in:
2026-06-18 23:50:56 +08:00
parent 889a575188
commit d8195bc935
7 changed files with 976 additions and 1 deletions
+42
View File
@@ -42,6 +42,7 @@ interface WindowModeRequest {
interface DesktopAppSettings {
openAtLogin: boolean
keepRunningInBackground: boolean
autoCleanStorageWeekly: boolean
}
interface DesktopLoginCredentials {
@@ -49,6 +50,43 @@ interface DesktopLoginCredentials {
password: string
}
interface DesktopStorageEntry {
id: string
label: string
kind: 'app-cache' | 'bound-account' | 'unbound-session'
partition: string | null
accountId: string | null
sizeBytes: number
cleanableBytes: number
lastModifiedAt: number | null
cleanable: boolean
active: boolean
}
interface DesktopStorageSnapshot {
generatedAt: number
totalBytes: number
cleanableBytes: number
appCacheBytes: number
boundAccountBytes: number
boundAccountCleanableBytes: number
unboundSessionBytes: number
unboundSessionCount: number
boundAccountCount: number
entries: DesktopStorageEntry[]
autoCleanStorageWeekly: boolean
lastCleanupAt: number | null
nextCleanupAt: number | null
}
interface DesktopStorageCleanupResult {
cleanedAt: number
cleanedBytes: number
removedEntries: number
before: DesktopStorageSnapshot
after: DesktopStorageSnapshot
}
interface WorkbenchNavigationState {
canGoBack: boolean
canGoForward: boolean
@@ -195,6 +233,10 @@ const desktopBridge = {
ipcRenderer.invoke('desktop:clear-login-credentials') as Promise<null>,
setAppSetting: (key: keyof DesktopAppSettings, value: boolean) =>
ipcRenderer.invoke('desktop:set-app-setting', key, value) as Promise<DesktopAppSettings>,
storageSnapshot: () =>
ipcRenderer.invoke('desktop:storage-snapshot') as Promise<DesktopStorageSnapshot>,
cleanStorage: () =>
ipcRenderer.invoke('desktop:clean-storage') as Promise<DesktopStorageCleanupResult>,
syncRuntimeSession: (session: DesktopRuntimeSessionSyncRequest | null) =>
ipcRenderer.invoke('desktop:runtime-session-sync', session) as Promise<null>,
rotateRuntimeClientToken: () =>