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
+40
View File
@@ -20,6 +20,7 @@ declare global {
interface DesktopAppSettings {
openAtLogin: boolean
keepRunningInBackground: boolean
autoCleanStorageWeekly: boolean
}
interface DesktopLoginCredentials {
@@ -27,6 +28,43 @@ declare global {
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
@@ -90,6 +128,8 @@ declare global {
saveLoginCredentials(credentials: DesktopLoginCredentials): Promise<DesktopLoginCredentials>
clearLoginCredentials(): Promise<null>
setAppSetting(key: keyof DesktopAppSettings, value: boolean): Promise<DesktopAppSettings>
storageSnapshot(): Promise<DesktopStorageSnapshot>
cleanStorage(): Promise<DesktopStorageCleanupResult>
syncRuntimeSession(session: DesktopRuntimeSessionSyncRequest | null): Promise<null>
rotateRuntimeClientToken(): Promise<DesktopClientRotateResponse>
releaseRuntimeSession(revoke?: boolean): Promise<null>