/** * @file Path utilities for Socket ecosystem directories. Platform-aware * resolution for the shared ~/.socket/ layout. The `_`-prefixed entries are * Socket-managed DIRS rather than apps: `_cacache` content-addressable cache; * `_dlx//` name+version binary store (node, jre, python, sfw, …); * `_state//` version-LESS persistent app state (daemon socket + lock + * OAuth refresh; mirrors pnpm `state-dir` / XDG_STATE_HOME), with * `_state//run/` for a daemon's socket/lock/pid; `_wheelhouse` shared * bin across Socket tools. Generic per-app dirs (`getSocketAppDir('')`) * nest under the same `_`-prefix. */ /** * Get the OS home directory. Can be overridden in tests using * setPath('homedir', ...) from paths/rewire. */ export declare function getOsHomeDir(): string; /** * Get the OS temporary directory. Can be overridden in tests using * setPath('tmpdir', ...) from paths/rewire. */ /** * Get the OS temporary directory. Can be overridden in tests using * setPath('tmpdir', ...) from paths/rewire. */ export declare function getOsTmpDir(): string; /** * Resolve the runtime socket path for a local daemon named `name`. Distinct * from getSocketAppRuntimeDir (the persistent ~/.socket/_state//run/ * home): the SOCKET endpoint itself belongs in the ephemeral, owner-only XDG * runtime dir — correctly permissioned and auto-cleaned on logout — while the * downloaded daemon binary + durable token cache live under ~/.socket. The * daemon and every client MUST compute the identical path (1 path, 1 * reference), so this is the single resolver both sides call. * * Resolution: * * - Windows: `\\.\pipe\-sock` (named pipe; Unix sockets are unavailable * pre-Win10 1803, same framing/semantics). Returned raw — a pipe path is not * a filesystem path and must not be slash-normalized. * - `$XDG_RUNTIME_DIR/.sock` when XDG_RUNTIME_DIR is set (systemd * `/run/user//`). * - Else `$TMPDIR/-.sock` (the `` suffix avoids collisions when * TMPDIR is shared across users on a multi-tenant box). */ export declare function getRuntimeSocketPath(name: string): string; /** * Get a Socket app cache directory (~/.socket/_/cache). */ /** * Get a Socket app cache directory (~/.socket/_/cache). */ export declare function getSocketAppCacheDir(appName: string): string; /** * Get a Socket app TTL cache directory (~/.socket/_/cache/ttl). */ /** * Get a Socket app TTL cache directory (~/.socket/_/cache/ttl). */ export declare function getSocketAppCacheTtlDir(appName: string): string; /** * Get a Socket app directory (~/.socket/_). The `_` prefix is applied * here; pass the bare app name (e.g. 'socket', 'registry'). */ /** * Get a Socket app directory (~/.socket/_). The `_` prefix is applied * here; pass the bare app name (e.g. 'socket', 'registry'). */ export declare function getSocketAppDir(appName: string): string; /** * Get the Socket cacache directory (~/.socket/_cacache). Override precedence: * setPath('socket-cacache-dir', …) → SOCKET_CACACHE_DIR env → * $SOCKET_HOME/_cacache → $HOME/.socket/_cacache. */ /** * Get an app's runtime directory (~/.socket/_state//run/) — the home for a * daemon's Unix socket + `concurrency.lock` + `.pid`. Version-less so * the socket path is stable across binary upgrades. */ export declare function getSocketAppRuntimeDir(appName: string): string; /** * Get the Socket user directory (~/.socket). Override precedence: * setPath('socket-user-dir', …) → SOCKET_HOME env → $HOME/.socket → * /tmp/.socket (Unix) or %TEMP%.socket (Windows). */ /** * Get an app's persistent state directory (~/.socket/_state//). The * `` is a real app such as sockeye or acorn, nesting its version-less * state inside the `_state` infra dir. */ export declare function getSocketAppStateDir(appName: string): string; /** * Get an app's runtime directory (~/.socket/_state//run/) — the home for a * daemon's Unix socket + `concurrency.lock` + `.pid`. Version-less so * the socket path is stable across binary upgrades. */ /** * Get the Socket cacache directory (~/.socket/_cacache). Override precedence: * setPath('socket-cacache-dir', …) → SOCKET_CACACHE_DIR env → * $SOCKET_HOME/_cacache → $HOME/.socket/_cacache. */ export declare function getSocketCacacheDir(): string; /** * Get the Socket DLX directory (~/.socket/_dlx) — the name+version binary store * (node, jre, python, sfw, …). Override precedence: setPath('socket-dlx-dir', * …) → SOCKET_DLX_DIR env → $SOCKET_HOME/_dlx → $HOME/.socket/_dlx. */ /** * Get the Socket DLX directory (~/.socket/_dlx) — the name+version binary store * (node, jre, python, sfw, …). Override precedence: setPath('socket-dlx-dir', * …) → SOCKET_DLX_DIR env → $SOCKET_HOME/_dlx → $HOME/.socket/_dlx. */ export declare function getSocketDlxDir(): string; /** * Get the Socket home directory (~/.socket). Alias for getSocketUserDir() for * consistency across Socket projects. */ /** * Get the Socket home directory (~/.socket). Alias for getSocketUserDir() for * consistency across Socket projects. */ export declare function getSocketHomePath(): string; /** * Get the Wheelhouse rack directory (~/.socket/_wheelhouse/rack) — the tool * STORE. Every `_wheelhouse`-managed CLI tool keeps its real binaries here, * racked by name + version as `///…` (the wheelhouse * analog of Homebrew's `Cellar/`). The handles on PATH live in * `/bin` (getSocketWheelhouseBinDir) and point into the rack. * Inherits the `_wheelhouse` override chain (SOCKET_HOME / * setPath('socket-wheelhouse-dir')). */ export declare function getSocketRackDir(): string; /** * Get a racked tool's version directory (~/.socket/_wheelhouse/rack// * ) — the per-tool, per-version home under the rack. The * 1-path-1-reference owner of a tool install destination: installers resolve * their extract/copy target through this, and the `/bin/` * shim points at a binary inside it. */ export declare function getSocketRackToolDir(options: { tool: string; version: string; }): string; /** * Get the Wheelhouse repo-clones directory (~/.socket/_wheelhouse/repo-clones). * Sits beside the per-tool dirs sfw, codedb, janus, and bin under * `_wheelhouse`. * The home for reference clones of EXTERNAL repos an agent reviews, each as * `-` lowercased + dash-cased (e.g. `justrach-codedb`). * * Smallest-practical clone form (smallest disk + fastest initial fetch without * the treeless tax): `git clone` --depth=1 --single-branch --filter=blob:none * `--depth=1` truncates history, `--single-branch` skips other * refs, and `--filter=blob:none` (a BLOBLESS partial clone) fetches file blobs * lazily on first access — so the initial download is tree-metadata only. * (Treeless `--filter=tree:0` is smaller still but refetches trees on every * walk, which is slow + breaks offline, so it is NOT the default.) * * Deliberately OUTSIDE `~/projects/` so Socket's sibling-walk tooling (e.g. * cascade `--all`) never mistakes a reference clone for a Socket repo * checkout. Disposable: a reference cache, not a working tree. Inherits the * `_wheelhouse` override chain (SOCKET_HOME / * setPath('socket-wheelhouse-dir')). */ export declare function getSocketRepoClonesDir(): string; /** * Get the Socket state directory (~/.socket/_state) — version-LESS persistent * app state (the home for daemon sockets, locks, OAuth refresh, durable caches * that survive version bumps; mirrors pnpm `state-dir` / XDG_STATE_HOME). * Override precedence: setPath('socket-state-dir', …) → SOCKET_STATE_DIR env → * $SOCKET_HOME/_state → $HOME/.socket/_state. */ export declare function getSocketStateDbPath(appName: string): string; export declare function getSocketStateDir(): string; /** * Get the Socket user directory (~/.socket). Override precedence: * setPath('socket-user-dir', …) → SOCKET_HOME env → $HOME/.socket → * /tmp/.socket (Unix) or %TEMP%.socket (Windows). */ export declare function getSocketUserDir(): string; /** * Get the Wheelhouse bin directory (~/.socket/_wheelhouse/bin) — the single * directory placed on PATH. Holds only flat handles (thin exec shims or * symlinks), one per tool, each pointing at a real binary racked under * `/rack///…` (getSocketRackToolDir). The shim IS * the bin, the npm `prefix/bin` / Homebrew `bin/` model: PATH lookup does not * recurse, so this dir stays flat (never a `bin//` subdir). Inherits the * `_wheelhouse` override chain (SOCKET_HOME / * setPath('socket-wheelhouse-dir')). */ export declare function getSocketWheelhouseBinDir(): string; /** * Get the Socket Wheelhouse directory (~/.socket/_wheelhouse). Shared location, * common across Socket repos, for binaries that every Socket repo can reach * without each one re-downloading and re-extracting per-repo. Tool installers * (janus, sfw, etc.) rack their resolved executables under * `/rack///…` (getSocketRackToolDir) and expose a * handle in `/bin` (getSocketWheelhouseBinDir); consumers add that * one `bin/` to PATH. Override precedence: setPath('socket-wheelhouse-dir', …) * → $SOCKET_HOME/_wheelhouse → $HOME/.socket/_wheelhouse. */ export declare function getSocketWheelhouseDir(): string; /** * Get the user's home directory. Uses environment variables directly to support * test mocking. Falls back to temporary directory if home is not available. * * Priority order: 1. HOME (Unix) 2. USERPROFILE (Windows) 3. * getNodeOs().homedir() 4. Fallback: getNodeOs().tmpdir() for restricted envs. */ /** * Get the user's home directory. Uses environment variables directly to support * test mocking. Falls back to temporary directory if home is not available. * * Priority order: 1. HOME (Unix) 2. USERPROFILE (Windows) 3. * getNodeOs().homedir() 4. Fallback: getNodeOs().tmpdir() for restricted envs. */ export declare function getUserHomeDir(): string;