localVm.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. export type LocalVmMode = 'shared' | 'per-bot'
  2. export const LOCAL_VM_IMAGE_KEYS = ['standard', 'cursor'] as const
  3. export type LocalVmImageKey = typeof LOCAL_VM_IMAGE_KEYS[number]
  4. export const LOCAL_VM_IMAGES = [
  5. {key:'standard',name:'标准桌面',description:'XFCE 桌面环境'},
  6. {key:'cursor',name:'Cursor Universal',description:'Debian 开发桌面 · amd64'},
  7. ] as const
  8. export interface LocalVmImageOption {key:LocalVmImageKey;name:string;description:string;ready:boolean;imageId?:string}
  9. export type LocalVmAction = 'create' | 'start' | 'stop' | 'recreate' | 'remove'
  10. export interface LocalVmStatus {
  11. fixedCapacity?:boolean
  12. desktops?:Array<{id:string;name:string;online:boolean;ready:boolean;available?:boolean;imageKey?:LocalVmImageKey}>
  13. executionHost?: 'server' | 'runner'
  14. runnerName?: string
  15. setupRequired?: 'runner' | 'worker'
  16. configured: boolean
  17. runtime?: 'docker' | 'podman'
  18. daemonUp: boolean
  19. image: boolean
  20. imageId?: string
  21. images?: LocalVmImageOption[]
  22. mode: LocalVmMode
  23. maxInstances: number
  24. busy: boolean
  25. problem?: string
  26. job?: { id: string; state: 'running' | 'complete' | 'failed'; message: string; imageKey?: LocalVmImageKey }
  27. instances?: Array<{id:string;status:string;name?:string;orphaned?:boolean}>
  28. }
  29. export interface LocalVmInstance {
  30. desktopId?:string
  31. fixedCapacity?:boolean
  32. desktops?:Array<{id:string;name:string;online:boolean;ready:boolean;available?:boolean;imageKey?:LocalVmImageKey}>
  33. container: 'missing' | 'stopped' | 'running'
  34. ready: boolean
  35. inUse: boolean
  36. mode: LocalVmMode
  37. maxInstances: number
  38. image: boolean
  39. imageId?: string
  40. images?: LocalVmImageOption[]
  41. imageKey?: LocalVmImageKey
  42. problem?: string
  43. }