paths.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /** Filesystem ownership for the Electron-managed desktop installation. */
  2. import { join } from 'node:path'
  3. import { resolveDshHome } from '@deepseek-ai/dsh-home-paths'
  4. /** Stable desktop installation paths under the shared Harness home. */
  5. export interface DesktopPaths {
  6. readonly root: string
  7. readonly profile: string
  8. readonly lock: string
  9. readonly pnpm: {
  10. readonly root: string
  11. readonly store: string
  12. readonly cache: string
  13. readonly state: string
  14. readonly config: string
  15. readonly home: string
  16. }
  17. }
  18. /**
  19. * Resolve every Electron-owned path without changing the shared data roots.
  20. * @param dshHome - Harness home shared with npm-installed dsh.
  21. * @returns immutable desktop path set.
  22. */
  23. export function resolveDesktopPaths(dshHome: string = resolveDshHome()): DesktopPaths {
  24. const root = join(dshHome, 'desktop')
  25. const pnpm = join(root, 'pnpm')
  26. return {
  27. root,
  28. profile: join(dshHome, 'profiles', 'desktop'),
  29. lock: join(dshHome, 'profiles', 'desktop', 'lock'),
  30. pnpm: {
  31. root: pnpm,
  32. store: join(pnpm, 'store'),
  33. cache: join(pnpm, 'cache'),
  34. state: join(pnpm, 'state'),
  35. config: join(pnpm, 'config'),
  36. home: join(pnpm, 'home'),
  37. },
  38. }
  39. }