Skip to content

desktop/owned-instance/persistent-profile

A persistent user-data profile for an owned desktop instance: a directory the caller keeps (and signs in to once, by hand), which the harness launches against instead of a fresh temporary one. Used to drive Obsidian Sync and Obsidian Publish, whose account and connection live in the profile’s localStorage and IndexedDB.

Two things differ from a temporary profile, and both live here as pure functions:

  • obsidian.json is merged, never overwritten. The profile’s registry already lists the vault the owner connected to Sync, under the id Sync keys its connection to, so the vault is reused under that id, every other vault is kept, and only the auto-open markers and updateDisabled change (the latter only for the run, see persistent-profile-updates.ts). - One instance per profile. Two Electron processes on one user-data directory corrupt each other’s localStorage, and Electron’s own single-instance lock would hand the second launch to the first and exit. So the harness takes a lock file in the profile and refuses a second run while the holder is alive.
Class Description
PersistentProfileInUseError Thrown when a second run asks for a persistent profile another live process holds.
Interface Description
PersistentProfileInUseErrorConstructorParams Parameters for PersistentProfileInUseError.
PersistentProfileLock The contents of a persistent profile’s lock file.