Files
geo/apps/desktop-client/src/renderer/env.d.ts
T

91 lines
3.0 KiB
TypeScript
Raw Normal View History

import type {
CreatePublishJobResponse,
DesktopAccountInfo,
DesktopClientRotateResponse,
DesktopPublishTaskListResponse,
DesktopRuntimeSessionSyncRequest,
ListDesktopPublishTasksParams,
} from '@geo/shared-types'
import type { DesktopObservedRequest } from '../shared/network-debug'
import type { DesktopRuntimeSnapshot } from './types'
export {}
declare global {
interface DesktopAppSettings {
openAtLogin: boolean
keepRunningInBackground: boolean
}
2026-05-14 21:49:27 +08:00
interface DesktopLoginCredentials {
identifier: string
password: string
}
interface Window {
desktopBridge: {
app: {
ping(): Promise<string>
deviceInfo(): Promise<{
device_name: string
os: string
cpu_arch: string
}>
clientId(scope: {
tenant_id: number
workspace_id: number
user_id: number
}): Promise<string>
runtimeSnapshot(): Promise<DesktopRuntimeSnapshot>
runtimeAccountSnapshot(
accountId: string,
): Promise<DesktopRuntimeSnapshot['accounts'][number] | null>
bindPublishAccount(platformId: string): Promise<DesktopAccountInfo>
refreshRuntimeAccounts(): Promise<null>
probeRuntimeAccount(
accountId: string,
): Promise<DesktopRuntimeSnapshot['accounts'][number] | null>
openPublishAccountConsole(account: {
id: string
platform: string
platformUid: string
displayName: string
}): Promise<null>
unbindPublishAccount(accountId: string, syncVersion: number): Promise<null>
listPublishTasks(
params?: ListDesktopPublishTasksParams,
): Promise<DesktopPublishTaskListResponse>
retryPublishTask(taskId: string): Promise<CreatePublishJobResponse>
openExternalUrl(url: string): Promise<null>
openSettingsWindow(): Promise<null>
getAppSettings(): Promise<DesktopAppSettings>
2026-05-14 21:49:27 +08:00
getLoginCredentials(): Promise<DesktopLoginCredentials | null>
saveLoginCredentials(
credentials: DesktopLoginCredentials,
): Promise<DesktopLoginCredentials>
clearLoginCredentials(): Promise<null>
setAppSetting(key: keyof DesktopAppSettings, value: boolean): Promise<DesktopAppSettings>
syncRuntimeSession(session: DesktopRuntimeSessionSyncRequest | null): Promise<null>
rotateRuntimeClientToken(): Promise<DesktopClientRotateResponse>
releaseRuntimeSession(revoke?: boolean): Promise<null>
setWindowMode(
mode: 'login' | 'main',
request?: {
source?: 'auth-state' | 'login' | 'logout'
animate?: boolean
},
): Promise<null>
onRuntimeInvalidated(
listener: (event: {
reason: 'account-health' | 'publish-task-lease'
at: number
accountId?: string
taskId?: string
}) => void,
): () => void
onNetworkObserved(listener: (event: DesktopObservedRequest) => void): () => void
}
}
}
}