2026-04-20 09:52:48 +08:00
|
|
|
import type {
|
|
|
|
|
CreatePublishJobResponse,
|
|
|
|
|
DesktopAccountInfo,
|
2026-05-25 19:23:49 +08:00
|
|
|
DesktopClientReleaseCheckResponse,
|
|
|
|
|
DesktopClientUpdateProgressEvent,
|
|
|
|
|
DesktopClientUpdateResult,
|
2026-05-08 11:43:25 +08:00
|
|
|
DesktopClientRotateResponse,
|
2026-04-20 09:52:48 +08:00
|
|
|
DesktopPublishTaskListResponse,
|
|
|
|
|
DesktopRuntimeSessionSyncRequest,
|
|
|
|
|
ListDesktopPublishTasksParams,
|
2026-05-01 20:39:09 +08:00
|
|
|
} from '@geo/shared-types'
|
|
|
|
|
import type { DesktopObservedRequest } from '../shared/network-debug'
|
|
|
|
|
import type { DesktopRuntimeSnapshot } from './types'
|
2026-04-19 14:18:20 +08:00
|
|
|
|
2026-05-01 20:39:09 +08:00
|
|
|
export {}
|
2026-04-19 14:18:20 +08:00
|
|
|
|
|
|
|
|
declare global {
|
2026-04-30 22:00:01 +08:00
|
|
|
interface DesktopAppSettings {
|
2026-05-01 20:39:09 +08:00
|
|
|
openAtLogin: boolean
|
|
|
|
|
keepRunningInBackground: boolean
|
2026-04-30 22:00:01 +08:00
|
|
|
}
|
|
|
|
|
|
2026-05-14 21:49:27 +08:00
|
|
|
interface DesktopLoginCredentials {
|
|
|
|
|
identifier: string
|
|
|
|
|
password: string
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-20 15:44:26 +08:00
|
|
|
interface WorkbenchNavigationState {
|
|
|
|
|
canGoBack: boolean
|
|
|
|
|
canGoForward: boolean
|
|
|
|
|
loading: boolean
|
|
|
|
|
url: string
|
|
|
|
|
title: string
|
|
|
|
|
host: string
|
|
|
|
|
secure: boolean
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-19 14:18:20 +08:00
|
|
|
interface Window {
|
|
|
|
|
desktopBridge: {
|
|
|
|
|
app: {
|
2026-05-01 20:39:09 +08:00
|
|
|
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>
|
2026-04-27 20:06:37 +08:00
|
|
|
deviceInfo(): Promise<{
|
2026-05-01 20:39:09 +08:00
|
|
|
device_name: string
|
|
|
|
|
os: string
|
|
|
|
|
cpu_arch: string
|
|
|
|
|
}>
|
2026-04-27 20:06:37 +08:00
|
|
|
clientId(scope: {
|
2026-05-01 20:39:09 +08:00
|
|
|
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>
|
2026-04-19 14:18:20 +08:00
|
|
|
openPublishAccountConsole(account: {
|
2026-05-01 20:39:09 +08:00
|
|
|
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>
|
2026-05-25 19:23:49 +08:00
|
|
|
saveLoginCredentials(credentials: DesktopLoginCredentials): Promise<DesktopLoginCredentials>
|
2026-05-14 21:49:27 +08:00
|
|
|
clearLoginCredentials(): Promise<null>
|
2026-05-01 20:39:09 +08:00
|
|
|
setAppSetting(key: keyof DesktopAppSettings, value: boolean): Promise<DesktopAppSettings>
|
|
|
|
|
syncRuntimeSession(session: DesktopRuntimeSessionSyncRequest | null): Promise<null>
|
2026-05-08 11:43:25 +08:00
|
|
|
rotateRuntimeClientToken(): Promise<DesktopClientRotateResponse>
|
2026-05-01 20:39:09 +08:00
|
|
|
releaseRuntimeSession(revoke?: boolean): Promise<null>
|
|
|
|
|
setWindowMode(
|
|
|
|
|
mode: 'login' | 'main',
|
|
|
|
|
request?: {
|
|
|
|
|
source?: 'auth-state' | 'login' | 'logout'
|
|
|
|
|
animate?: boolean
|
|
|
|
|
},
|
|
|
|
|
): Promise<null>
|
2026-04-20 17:16:15 +08:00
|
|
|
onRuntimeInvalidated(
|
2026-05-06 21:34:13 +08:00
|
|
|
listener: (event: {
|
|
|
|
|
reason: 'account-health' | 'publish-task-lease'
|
|
|
|
|
at: number
|
|
|
|
|
accountId?: string
|
|
|
|
|
taskId?: string
|
|
|
|
|
}) => void,
|
2026-05-01 20:39:09 +08:00
|
|
|
): () => void
|
|
|
|
|
onNetworkObserved(listener: (event: DesktopObservedRequest) => void): () => void
|
2026-05-25 19:23:49 +08:00
|
|
|
onClientUpdateProgress(
|
|
|
|
|
listener: (event: DesktopClientUpdateProgressEvent) => void,
|
|
|
|
|
): () => void
|
2026-05-01 20:39:09 +08:00
|
|
|
}
|
2026-05-20 15:44:26 +08:00
|
|
|
workbenchNavigation: {
|
|
|
|
|
getState(): Promise<WorkbenchNavigationState>
|
|
|
|
|
goBack(): Promise<null>
|
|
|
|
|
goForward(): Promise<null>
|
|
|
|
|
reload(): Promise<null>
|
|
|
|
|
onStateChanged(listener: (state: WorkbenchNavigationState) => void): () => void
|
|
|
|
|
}
|
2026-05-01 20:39:09 +08:00
|
|
|
}
|
2026-04-19 14:18:20 +08:00
|
|
|
}
|
|
|
|
|
}
|