description: "Shared resolution of the DeepSeek Harness home and user-data paths for packages that need one consistent root, tilde expansion, and stable watch paths."
English | 中文
@deepseek-ai/dsh-home-paths lets package authors resolve one DeepSeek Harness data root and derive child paths from it. An explicit path wins over $DSH_HOME, which wins over ~/.dsh; blank environment values are ignored. Its public helpers can render the root without revealing an absolute machine path, expand only bare or current-user tilde forms, and canonicalize watch targets whose final components do not yet exist. Use it as a direct library dependency, not through cordis.yml.
Use these helpers wherever a package must agree with the rest of the harness about where user data lives: resolve the home once, then derive every child path from it.
import { resolveDshHome, dshHomePath } from '@deepseek-ai/dsh-home-paths'
const home = resolveDshHome() // configured path, else $DSH_HOME, else ~/.dsh
const settings = dshHomePath('settings') // join one child onto the resolved home
An explicit configured path has the highest precedence, then $DSH_HOME, then the default ~/.dsh. An empty or whitespace-only $DSH_HOME is treated as unset, so a blank override never resolves the home to the current working directory.
For user-facing paths, render the root symbolically rather than as a machine path: the default home displays as ~/.dsh and any configured home displays as $DSH_HOME. The display form never leaks an absolute machine path.
expandHomePath expands a leading ~, ~/, or ~\ against the operating-system home and leaves everything else untouched — non-tilde paths and named-user forms such as ~alice/... pass through unchanged.
canonicalizeWatchPath gives a native filesystem watcher one canonical spelling of its target: the deepest existing ancestor is resolved through realpath and any missing suffix is restored, so a file or directory can be watched before it is created. This prevents Windows from treating a regular-file ancestor as ordinary absence, and prevents 8.3 short-name aliases from mixing with the long paths the native watcher backend emits.
Read these pages when you need the launcher or the consumers that depend on a single home root.
DSH_HOME reaches model shell calls.These limits define when the helpers are not the right tool. They are current package constraints, not a task backlog.
~, ~/..., and ~\... use the current operating-system home; named-user forms such as ~alice/..., environment variables, and shell expressions remain unchanged.canonicalizeWatchPath performs realpath probes and propagates errors other than absence; callers still own directory creation, permissions, and trust policy for the resulting path.