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

121 lines
4.1 KiB
TypeScript
Raw Normal View History

import type {
CreatePublishJobResponse,
DesktopAccountInfo,
2026-05-25 19:23:49 +08:00
DesktopClientReleaseCheckResponse,
DesktopClientUpdateProgressEvent,
DesktopClientUpdateResult,
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 WorkbenchNavigationState {
canGoBack: boolean
canGoForward: boolean
loading: boolean
url: string
title: string
host: string
secure: boolean
}
interface Window {
desktopBridge: {
app: {
ping(): Promise<string>
2026-05-25 19:23:49 +08:00
versionInfo(): Promise<{
version: string
channel: string
}>
checkClientRelease(): Promise<DesktopClientReleaseCheckResponse>
clientReleaseDownloadURL(): Promise<{ download_url: string }>
quitApp(): Promise<null>
startClientUpdate(): Promise<DesktopClientUpdateResult>
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>
cancelPublishTask(taskId: string): Promise<DesktopTaskInfo>
openExternalUrl(url: string): Promise<null>
openSettingsWindow(): Promise<null>
getAppSettings(): Promise<DesktopAppSettings>
2026-05-14 21:49:27 +08:00
getLoginCredentials(): Promise<DesktopLoginCredentials | null>
2026-05-25 19:23:49 +08:00
saveLoginCredentials(credentials: DesktopLoginCredentials): Promise<DesktopLoginCredentials>
2026-05-14 21:49:27 +08:00
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' | 'publish-task-progress'
at: number
accountId?: string
taskId?: string
}) => void,
): () => void
onNetworkObserved(listener: (event: DesktopObservedRequest) => void): () => void
2026-05-25 19:23:49 +08:00
onClientUpdateProgress(
listener: (event: DesktopClientUpdateProgressEvent) => void,
): () => void
}
workbenchNavigation: {
getState(): Promise<WorkbenchNavigationState>
goBack(): Promise<null>
goForward(): Promise<null>
reload(): Promise<null>
onStateChanged(listener: (state: WorkbenchNavigationState) => void): () => void
}
}
}
}