@socketsecurity/lib 6.0.7 → 6.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +1 -1
  3. package/dist/ai/agent-context.d.mts +103 -0
  4. package/dist/ai/agent-context.js +157 -0
  5. package/dist/ai/backends.d.mts +83 -0
  6. package/dist/ai/backends.js +173 -0
  7. package/dist/ai/credentials.d.mts +49 -0
  8. package/dist/ai/credentials.js +82 -0
  9. package/dist/ai/discover.d.mts +4 -0
  10. package/dist/ai/discover.js +1 -1
  11. package/dist/ai/exec.d.mts +52 -0
  12. package/dist/ai/exec.js +92 -0
  13. package/dist/ai/http.d.mts +132 -0
  14. package/dist/ai/http.js +130 -0
  15. package/dist/ai/profiles.d.mts +41 -6
  16. package/dist/ai/profiles.js +52 -10
  17. package/dist/ai/route.d.mts +69 -0
  18. package/dist/ai/route.js +156 -0
  19. package/dist/ai/spawn.d.mts +10 -2
  20. package/dist/ai/spawn.js +55 -31
  21. package/dist/ai/subagent-status.d.mts +48 -0
  22. package/dist/ai/subagent-status.js +57 -0
  23. package/dist/ai/tier.d.mts +60 -0
  24. package/dist/ai/tier.js +53 -0
  25. package/dist/ai/types.d.mts +15 -2
  26. package/dist/ai/worktree.js +4 -0
  27. package/dist/archives/tar.js +1 -1
  28. package/dist/archives/zip.js +2 -2
  29. package/dist/argv/parse.d.ts +19 -2
  30. package/dist/argv/parse.js +1 -1
  31. package/dist/arrays/join.js +4 -0
  32. package/dist/bin/find.js +4 -4
  33. package/dist/bin/prim.cjs +3915 -3781
  34. package/dist/bin/resolve.js +1 -1
  35. package/dist/cache/ttl/store.js +1 -1
  36. package/dist/cli/check-primordials.d.ts +8 -3
  37. package/dist/cli/check-primordials.js +4 -4
  38. package/dist/compression/_internal.js +1 -1
  39. package/dist/compression/brotli.d.ts +1 -2
  40. package/dist/compression/brotli.js +6 -2
  41. package/dist/compression/gzip.js +6 -2
  42. package/dist/constants/packages.d.ts +3 -0
  43. package/dist/constants/packages.js +2 -1
  44. package/dist/constants/socket.d.ts +2 -6
  45. package/dist/constants/socket.js +12 -14
  46. package/dist/cover/code.js +2 -2
  47. package/dist/crypto/hash.d.ts +4 -1
  48. package/dist/crypto/hash.js +4 -1
  49. package/dist/debug/caller-info.js +1 -1
  50. package/dist/dlx/arborist.js +13 -3
  51. package/dist/dlx/binary-cache.js +1 -1
  52. package/dist/dlx/binary-resolution.js +1 -1
  53. package/dist/dlx/detect.d.ts +8 -0
  54. package/dist/dlx/firewall.d.ts +8 -0
  55. package/dist/dlx/firewall.js +1 -1
  56. package/dist/dlx/lockfile.js +4 -1
  57. package/dist/dlx/manifest.js +1 -1
  58. package/dist/dlx/package.js +4 -0
  59. package/dist/eco/cargo/parse-lockfile.d.ts +1 -2
  60. package/dist/eco/cargo/parse-lockfile.js +3 -3
  61. package/dist/eco/manifest/detect-format.js +1 -1
  62. package/dist/eco/npm/npm/parse-lockfile.d.ts +3 -4
  63. package/dist/eco/npm/npm/parse-lockfile.js +2 -2
  64. package/dist/eco/npm/parse-package-json.d.ts +11 -0
  65. package/dist/eco/npm/parse-package-json.js +1 -1
  66. package/dist/eco/npm/pnpm/parse-lockfile.d.ts +5 -3
  67. package/dist/eco/npm/pnpm/parse-lockfile.js +3 -3
  68. package/dist/eco/npm/yarnpkg/yarn/exec.js +1 -1
  69. package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.d.ts +1 -2
  70. package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.js +1 -1
  71. package/dist/env/proxy.js +1 -1
  72. package/dist/env/rewire.d.ts +1 -0
  73. package/dist/env/rewire.js +1 -1
  74. package/dist/env/socket.d.ts +7 -0
  75. package/dist/env/socket.js +10 -0
  76. package/dist/errors/predicates.js +1 -1
  77. package/dist/external/@npmcli/promise-spawn.js +3 -1
  78. package/dist/external/pico-pack.js +4 -2
  79. package/dist/external/which.js +3 -1
  80. package/dist/external-tools/bazel/asset-names.d.ts +1 -1
  81. package/dist/external-tools/bazel/asset-names.js +5 -2
  82. package/dist/external-tools/bazel/from-download.d.ts +1 -1
  83. package/dist/external-tools/bazel/from-download.js +5 -2
  84. package/dist/external-tools/bazel/resolve-bazel-version.js +4 -0
  85. package/dist/external-tools/bazel/resolve.d.ts +3 -3
  86. package/dist/external-tools/bazel/resolve.js +16 -8
  87. package/dist/external-tools/cdxgen/asset-names.d.ts +1 -1
  88. package/dist/external-tools/cdxgen/asset-names.js +5 -2
  89. package/dist/external-tools/cdxgen/from-download.d.ts +1 -1
  90. package/dist/external-tools/cdxgen/from-download.js +7 -4
  91. package/dist/external-tools/cdxgen/resolve.d.ts +3 -3
  92. package/dist/external-tools/cdxgen/resolve.js +16 -8
  93. package/dist/external-tools/from-download.d.ts +2 -2
  94. package/dist/external-tools/from-download.js +11 -5
  95. package/dist/external-tools/from-pip-venv.d.ts +1 -1
  96. package/dist/external-tools/from-pip-venv.js +12 -5
  97. package/dist/external-tools/janus/asset-names.d.ts +1 -1
  98. package/dist/external-tools/janus/asset-names.js +5 -2
  99. package/dist/external-tools/janus/from-download.d.ts +1 -1
  100. package/dist/external-tools/janus/from-download.js +5 -2
  101. package/dist/external-tools/janus/resolve.d.ts +3 -3
  102. package/dist/external-tools/janus/resolve.js +16 -8
  103. package/dist/external-tools/jre/asset-names.d.ts +1 -1
  104. package/dist/external-tools/jre/asset-names.js +5 -2
  105. package/dist/external-tools/jre/from-download.d.ts +1 -1
  106. package/dist/external-tools/jre/from-download.js +7 -4
  107. package/dist/external-tools/jre/from-java-home.js +2 -2
  108. package/dist/external-tools/jre/from-vfs.js +2 -2
  109. package/dist/external-tools/jre/resolve.d.ts +3 -3
  110. package/dist/external-tools/jre/resolve.js +16 -8
  111. package/dist/external-tools/manifest.d.ts +18 -0
  112. package/dist/external-tools/manifest.js +1 -1
  113. package/dist/external-tools/opengrep/asset-names.d.ts +1 -1
  114. package/dist/external-tools/opengrep/asset-names.js +5 -2
  115. package/dist/external-tools/opengrep/from-download.d.ts +1 -1
  116. package/dist/external-tools/opengrep/from-download.js +5 -2
  117. package/dist/external-tools/opengrep/resolve.d.ts +3 -3
  118. package/dist/external-tools/opengrep/resolve.js +16 -8
  119. package/dist/external-tools/python/asset-names.d.ts +1 -1
  120. package/dist/external-tools/python/asset-names.js +10 -3
  121. package/dist/external-tools/python/dlx.d.ts +3 -3
  122. package/dist/external-tools/python/dlx.js +20 -9
  123. package/dist/external-tools/python/from-download.d.ts +1 -1
  124. package/dist/external-tools/python/from-download.js +12 -5
  125. package/dist/external-tools/python/pin.js +6 -3
  126. package/dist/external-tools/python/pip-install.js +6 -3
  127. package/dist/external-tools/python/resolve.d.ts +3 -3
  128. package/dist/external-tools/python/resolve.js +19 -11
  129. package/dist/external-tools/sbt/asset-names.d.ts +1 -1
  130. package/dist/external-tools/sbt/asset-names.js +5 -2
  131. package/dist/external-tools/sbt/from-download.d.ts +1 -1
  132. package/dist/external-tools/sbt/from-download.js +5 -2
  133. package/dist/external-tools/sbt/resolve.d.ts +3 -3
  134. package/dist/external-tools/sbt/resolve.js +16 -8
  135. package/dist/external-tools/skillspector/from-dlx.d.ts +1 -1
  136. package/dist/external-tools/skillspector/from-dlx.js +10 -3
  137. package/dist/external-tools/skillspector/resolve.d.ts +2 -2
  138. package/dist/external-tools/skillspector/resolve.js +14 -6
  139. package/dist/external-tools/synp/asset-names.d.ts +1 -1
  140. package/dist/external-tools/synp/asset-names.js +6 -2
  141. package/dist/external-tools/synp/from-download.d.ts +1 -1
  142. package/dist/external-tools/synp/from-download.js +5 -2
  143. package/dist/external-tools/synp/resolve.d.ts +3 -3
  144. package/dist/external-tools/synp/resolve.js +16 -8
  145. package/dist/external-tools/trivy/asset-names.d.ts +1 -1
  146. package/dist/external-tools/trivy/asset-names.js +5 -2
  147. package/dist/external-tools/trivy/from-download.d.ts +1 -1
  148. package/dist/external-tools/trivy/from-download.js +7 -4
  149. package/dist/external-tools/trivy/resolve.d.ts +3 -3
  150. package/dist/external-tools/trivy/resolve.js +16 -8
  151. package/dist/external-tools/trufflehog/asset-names.d.ts +1 -1
  152. package/dist/external-tools/trufflehog/asset-names.js +5 -2
  153. package/dist/external-tools/trufflehog/from-download.d.ts +1 -1
  154. package/dist/external-tools/trufflehog/from-download.js +7 -4
  155. package/dist/external-tools/trufflehog/resolve.d.ts +3 -3
  156. package/dist/external-tools/trufflehog/resolve.js +16 -8
  157. package/dist/fs/allowed-dirs-cache.d.ts +27 -1
  158. package/dist/fs/allowed-dirs-cache.js +38 -3
  159. package/dist/fs/find.js +1 -1
  160. package/dist/fs/read-json-cache.d.ts +7 -0
  161. package/dist/fs/resolve-module.js +6 -2
  162. package/dist/fs/safe.js +1 -1
  163. package/dist/git/_internal.js +2 -2
  164. package/dist/git/repo.js +2 -4
  165. package/dist/git/staged.js +8 -0
  166. package/dist/git/tracked.d.ts +84 -0
  167. package/dist/git/tracked.js +163 -0
  168. package/dist/git/unstaged.js +8 -0
  169. package/dist/github/refs-graphql.js +4 -0
  170. package/dist/github/refs-rest.js +4 -0
  171. package/dist/github/refs.js +15 -10
  172. package/dist/globs/_internal.js +1 -1
  173. package/dist/globs/match.js +9 -1
  174. package/dist/globs/matcher.js +5 -1
  175. package/dist/http-request/browser.js +6 -2
  176. package/dist/http-request/{browser-fetch.d.ts → fetch/browser.d.ts} +2 -2
  177. package/dist/http-request/{browser-fetch.js → fetch/browser.js} +4 -4
  178. package/dist/http-request/headers.js +1 -1
  179. package/dist/http-request/request-attempt.js +2 -2
  180. package/dist/http-request/user-agent.js +1 -1
  181. package/dist/integrity.d.ts +10 -4
  182. package/dist/integrity.js +10 -4
  183. package/dist/json/edit.js +38 -30
  184. package/dist/json/format.js +1 -1
  185. package/dist/native-messaging/install.d.ts +1 -1
  186. package/dist/native-messaging/install.js +7 -4
  187. package/dist/native-messaging/rate-limit.d.ts +7 -0
  188. package/dist/native-messaging/rate-limit.js +4 -0
  189. package/dist/node/async-hooks.js +1 -1
  190. package/dist/node/child-process.js +1 -1
  191. package/dist/node/crypto.js +1 -1
  192. package/dist/node/events.js +1 -1
  193. package/dist/node/fs-promises.js +1 -1
  194. package/dist/node/fs.d.ts +22 -6
  195. package/dist/node/fs.js +16 -3
  196. package/dist/node/http.js +1 -1
  197. package/dist/node/https.js +1 -1
  198. package/dist/node/module.js +1 -1
  199. package/dist/node/os.d.ts +10 -2
  200. package/dist/node/os.js +11 -4
  201. package/dist/node/path.d.ts +11 -2
  202. package/dist/node/path.js +17 -4
  203. package/dist/node/timers-promises.js +1 -1
  204. package/dist/node/url.js +1 -1
  205. package/dist/node/util.js +1 -1
  206. package/dist/objects/getters.js +1 -1
  207. package/dist/objects/mutate.js +2 -2
  208. package/dist/objects/predicates.js +1 -1
  209. package/dist/packages/edit-class.d.ts +2 -3
  210. package/dist/packages/edit-class.js +41 -35
  211. package/dist/packages/exports.js +4 -4
  212. package/dist/packages/fetch.js +1 -1
  213. package/dist/packages/isolation.js +1 -1
  214. package/dist/packages/licenses.js +2 -2
  215. package/dist/packages/manifest.js +4 -4
  216. package/dist/packages/normalize.js +1 -1
  217. package/dist/packages/provenance.js +2 -2
  218. package/dist/packages/specs.js +1 -1
  219. package/dist/packages/tarball.js +4 -2
  220. package/dist/packages/types.d.ts +1 -2
  221. package/dist/paths/dirnames.d.ts +1 -0
  222. package/dist/paths/dirnames.js +2 -0
  223. package/dist/paths/resolve.js +14 -19
  224. package/dist/paths/rewire.d.ts +5 -0
  225. package/dist/paths/socket.d.ts +74 -111
  226. package/dist/paths/socket.js +99 -132
  227. package/dist/primordials/process.d.ts +88 -0
  228. package/dist/primordials/process.js +132 -0
  229. package/dist/primordials/uncurry.d.ts +1 -2
  230. package/dist/process/spawn/child.js +8 -2
  231. package/dist/process/spawn/errors.js +1 -1
  232. package/dist/regexps/spec.js +1 -1
  233. package/dist/releases/github-archives.js +1 -1
  234. package/dist/releases/github-listing.d.ts +1 -2
  235. package/dist/schema/types.d.ts +3 -4
  236. package/dist/schema/validate.js +1 -1
  237. package/dist/secrets/find.d.ts +2 -2
  238. package/dist/secrets/find.js +10 -4
  239. package/dist/secrets/keychain.d.ts +1 -1
  240. package/dist/secrets/linux.js +32 -44
  241. package/dist/secrets/macos.d.ts +1 -2
  242. package/dist/secrets/macos.js +20 -29
  243. package/dist/secrets/rc.d.ts +2 -2
  244. package/dist/secrets/rc.js +21 -13
  245. package/dist/secrets/socket-api-token.js +8 -0
  246. package/dist/secrets/windows.js +27 -33
  247. package/dist/shell/parse.d.ts +32 -0
  248. package/dist/shell/parse.js +60 -0
  249. package/dist/spinner/create-spinner-class.js +2 -2
  250. package/dist/spinner/spinner-internals.d.ts +1 -1
  251. package/dist/spinner/spinner-internals.js +9 -5
  252. package/dist/spinner/spinner.d.ts +4 -0
  253. package/dist/spinner/spinner.js +1 -1
  254. package/dist/stdio/progress.js +5 -1
  255. package/dist/stdio/prompts.d.ts +2 -2
  256. package/dist/stdio/prompts.js +1 -1
  257. package/dist/temporal/instant.js +2 -2
  258. package/dist/url/assert-safe.d.ts +29 -0
  259. package/dist/url/assert-safe.js +54 -0
  260. package/dist/url/predicates.d.ts +31 -1
  261. package/dist/url/predicates.js +42 -1
  262. package/dist/url/types.d.ts +4 -0
  263. package/package.json +177 -115
@@ -1,12 +1,13 @@
1
1
  /**
2
- * @file Path utilities for Socket ecosystem directories. Provides
3
- * platform-aware path resolution for Socket tools' shared directory
4
- * structure. Directory Structure: ~/.socket/ ├── _cacache/ #
5
- * Content-addressable cache for npm packages ├── _dlx/ # DLX installations
6
- * (content-addressed by hash) ├── <hash>/ # npm package installs
7
- * (dlx-package) └── <hash>/ # binary downloads (dlx-binary) ├── _socket/ #
8
- * Socket CLI app directory ├── _registry/ # Socket Registry app directory └──
9
- * _sfw/ # Socket Firewall app directory.
2
+ * @file Path utilities for Socket ecosystem directories. Platform-aware
3
+ * resolution for the shared ~/.socket/ layout. The `_`-prefixed entries are
4
+ * Socket-managed DIRS (not apps): `_cacache` content-addressable cache;
5
+ * `_dlx/<hash>/` name+version binary store (node, jre, python, sfw, …);
6
+ * `_state/<app>/` version-LESS persistent app state (daemon socket + lock +
7
+ * OAuth refresh; mirrors pnpm `state-dir` / XDG_STATE_HOME), with
8
+ * `_state/<app>/run/` for a daemon's socket/lock/pid; `_wheelhouse`
9
+ * cross-fleet shared bin. Generic per-app dirs (`getSocketAppDir('<name>')`)
10
+ * nest under the same `_`-prefix.
10
11
  */
11
12
  /**
12
13
  * Get the OS home directory. Can be overridden in tests using
@@ -37,67 +38,56 @@ export declare function getSocketAppCacheDir(appName: string): string;
37
38
  */
38
39
  export declare function getSocketAppCacheTtlDir(appName: string): string;
39
40
  /**
40
- * Get a Socket app directory (~/.socket/_<appName>).
41
+ * Get a Socket app directory (~/.socket/_<appName>). The `_` prefix is applied
42
+ * here; pass the bare app name (e.g. 'socket', 'registry').
41
43
  */
42
44
  /**
43
- * Get a Socket app directory (~/.socket/_<appName>).
45
+ * Get a Socket app directory (~/.socket/_<appName>). The `_` prefix is applied
46
+ * here; pass the bare app name (e.g. 'socket', 'registry').
44
47
  */
45
48
  export declare function getSocketAppDir(appName: string): string;
46
49
  /**
47
- * Get the Socket cacache directory (~/.socket/_cacache). Can be overridden with
48
- * SOCKET_CACACHE_DIR environment variable or via setPath() for testing. Result
49
- * is cached via getPathValue for performance.
50
- *
51
- * Priority order:
52
- *
53
- * 1. Test override via setPath('socket-cacache-dir', ...)
54
- * 2. SOCKET_CACACHE_DIR - Full override of cacache directory
55
- * 3. Default: $SOCKET_HOME/_cacache or $HOME/.socket/_cacache
50
+ * Get the Socket cacache directory (~/.socket/_cacache). Override precedence:
51
+ * setPath('socket-cacache-dir', …) SOCKET_CACACHE_DIR env →
52
+ * $SOCKET_HOME/_cacache $HOME/.socket/_cacache.
56
53
  */
57
54
  /**
58
- * Get the Socket cacache directory (~/.socket/_cacache). Can be overridden with
59
- * SOCKET_CACACHE_DIR environment variable or via setPath() for testing. Result
60
- * is cached via getPathValue for performance.
61
- *
62
- * Priority order:
63
- *
64
- * 1. Test override via setPath('socket-cacache-dir', ...)
65
- * 2. SOCKET_CACACHE_DIR - Full override of cacache directory
66
- * 3. Default: $SOCKET_HOME/_cacache or $HOME/.socket/_cacache
55
+ * Get an app's runtime directory (~/.socket/_state/<app>/run/) the home for a
56
+ * daemon's Unix socket + `concurrency.lock` + `<socket>.pid`. Version-less so
57
+ * the socket path is stable across binary upgrades.
67
58
  */
68
- export declare function getSocketCacacheDir(): string;
59
+ export declare function getSocketAppRuntimeDir(appName: string): string;
69
60
  /**
70
- * Get the Socket CLI directory (~/.socket/_socket).
61
+ * Get the Socket user directory (~/.socket). Override precedence:
62
+ * setPath('socket-user-dir', …) → SOCKET_HOME env → $HOME/.socket →
63
+ * /tmp/.socket (Unix) or %TEMP%.socket (Windows).
71
64
  */
72
65
  /**
73
- * Get the Socket CLI directory (~/.socket/_socket).
66
+ * Get an app's persistent state directory (~/.socket/_state/<app>/). The
67
+ * `<app>` is a real app (proteus, acorn) nesting its version-less state inside
68
+ * the `_state` infra dir.
74
69
  */
75
- export declare function getSocketCliDir(): string;
70
+ export declare function getSocketAppStateDir(appName: string): string;
76
71
  /**
77
- * Get the Socket DLX directory (~/.socket/_dlx). Can be overridden with
78
- * SOCKET_DLX_DIR environment variable or via setPath() for testing. Result is
79
- * cached via getPathValue for performance.
80
- *
81
- * Priority order:
82
- *
83
- * 1. Test override via setPath('socket-dlx-dir', ...)
84
- * 2. SOCKET_DLX_DIR - Full override of DLX cache directory
85
- * 3. SOCKET_HOME/_dlx - Base directory override (inherits from getSocketUserDir)
86
- * 4. Default: $HOME/.socket/_dlx
87
- * 5. Fallback: /tmp/.socket/_dlx (Unix) or %TEMP%.socket_dlx (Windows)
72
+ * Get an app's runtime directory (~/.socket/_state/<app>/run/) the home for a
73
+ * daemon's Unix socket + `concurrency.lock` + `<socket>.pid`. Version-less so
74
+ * the socket path is stable across binary upgrades.
88
75
  */
89
76
  /**
90
- * Get the Socket DLX directory (~/.socket/_dlx). Can be overridden with
91
- * SOCKET_DLX_DIR environment variable or via setPath() for testing. Result is
92
- * cached via getPathValue for performance.
93
- *
94
- * Priority order:
95
- *
96
- * 1. Test override via setPath('socket-dlx-dir', ...)
97
- * 2. SOCKET_DLX_DIR - Full override of DLX cache directory
98
- * 3. SOCKET_HOME/_dlx - Base directory override (inherits from getSocketUserDir)
99
- * 4. Default: $HOME/.socket/_dlx
100
- * 5. Fallback: /tmp/.socket/_dlx (Unix) or %TEMP%.socket_dlx (Windows)
77
+ * Get the Socket cacache directory (~/.socket/_cacache). Override precedence:
78
+ * setPath('socket-cacache-dir', …) SOCKET_CACACHE_DIR env
79
+ * $SOCKET_HOME/_cacache $HOME/.socket/_cacache.
80
+ */
81
+ export declare function getSocketCacacheDir(): string;
82
+ /**
83
+ * Get the Socket DLX directory (~/.socket/_dlx) — the name+version binary store
84
+ * (node, jre, python, sfw, …). Override precedence: setPath('socket-dlx-dir',
85
+ * …) SOCKET_DLX_DIR env $SOCKET_HOME/_dlx $HOME/.socket/_dlx.
86
+ */
87
+ /**
88
+ * Get the Socket DLX directory (~/.socket/_dlx) — the name+version binary store
89
+ * (node, jre, python, sfw, …). Override precedence: setPath('socket-dlx-dir',
90
+ * …) → SOCKET_DLX_DIR env → $SOCKET_HOME/_dlx → $HOME/.socket/_dlx.
101
91
  */
102
92
  export declare function getSocketDlxDir(): string;
103
93
  /**
@@ -110,56 +100,40 @@ export declare function getSocketDlxDir(): string;
110
100
  */
111
101
  export declare function getSocketHomePath(): string;
112
102
  /**
113
- * Get the Socket Registry directory (~/.socket/_registry).
103
+ * Get the Socket state directory (~/.socket/_state) — version-LESS persistent
104
+ * app state (the home for daemon sockets, locks, OAuth refresh, durable caches
105
+ * that survive version bumps; mirrors pnpm `state-dir` / XDG_STATE_HOME).
106
+ * Override precedence: setPath('socket-state-dir', …) → SOCKET_STATE_DIR env →
107
+ * $SOCKET_HOME/_state → $HOME/.socket/_state.
114
108
  */
115
109
  /**
116
- * Get the Socket Registry directory (~/.socket/_registry).
110
+ * Get the Socket state directory (~/.socket/_state) — version-LESS persistent
111
+ * app state (the home for daemon sockets, locks, OAuth refresh, durable caches
112
+ * that survive version bumps; mirrors pnpm `state-dir` / XDG_STATE_HOME).
113
+ * Override precedence: setPath('socket-state-dir', …) → SOCKET_STATE_DIR env →
114
+ * $SOCKET_HOME/_state → $HOME/.socket/_state.
117
115
  */
118
- export declare function getSocketRegistryDir(): string;
116
+ export declare function getSocketStateDir(): string;
119
117
  /**
120
- * Get the Socket Registry GitHub cache directory
121
- * (~/.socket/_registry/cache/ttl/github).
118
+ * Get an app's persistent state directory (~/.socket/_state/<app>/). The
119
+ * `<app>` is a real app (proteus, acorn) nesting its version-less state inside
120
+ * the `_state` infra dir.
122
121
  */
123
122
  /**
124
- * Get the Socket Registry GitHub cache directory
125
- * (~/.socket/_registry/cache/ttl/github).
123
+ * Get the Socket user directory (~/.socket). Override precedence:
124
+ * setPath('socket-user-dir', …) → SOCKET_HOME env → $HOME/.socket →
125
+ * /tmp/.socket (Unix) or %TEMP%.socket (Windows).
126
126
  */
127
- export declare function getSocketRegistryGithubCacheDir(): string;
127
+ export declare function getSocketUserDir(): string;
128
128
  /**
129
129
  * Get the Socket Wheelhouse directory (~/.socket/_wheelhouse). Shared
130
130
  * cross-fleet location for binaries that every fleet member can reach without
131
131
  * each one re-downloading and re-extracting per-repo. Tool installers (janus,
132
132
  * sfw, etc.) drop their resolved executables under
133
133
  * `<wheelhouse>/<tool>/<version>/<platform-arch>/`; consumers add the
134
- * appropriate `bin/` to PATH or invoke the binary by absolute path.
135
- *
136
- * Priority order:
137
- *
138
- * 1. Test override via setPath('socket-wheelhouse-dir', ...)
139
- * 2. SOCKET_HOME/_wheelhouse - Base directory override (inherits from
140
- * getSocketUserDir)
141
- * 3. Default: $HOME/.socket/_wheelhouse
142
- */
143
- /**
144
- * Get the Socket user directory (~/.socket). Can be overridden with SOCKET_HOME
145
- * environment variable or via setPath() for testing. Result is cached via
146
- * getPathValue for performance.
147
- *
148
- * Priority order:
149
- *
150
- * 1. Test override via setPath('socket-user-dir', ...)
151
- * 2. SOCKET_HOME - Base directory override
152
- * 3. Default: $HOME/.socket
153
- * 4. Fallback: /tmp/.socket (Unix) or %TEMP%.socket (Windows)
154
- */
155
- export declare function getSocketUserDir(): string;
156
- /**
157
- * Get the user's home directory. Uses environment variables directly to support
158
- * test mocking. Falls back to temporary directory if home is not available.
159
- *
160
- * Priority order: 1. HOME environment variable (Unix) 2. USERPROFILE
161
- * environment variable (Windows) 3. getNodeOs().homedir() 4. Fallback:
162
- * getNodeOs().tmpdir() (rarely used, for restricted environments)
134
+ * appropriate `bin/` to PATH or invoke the binary by absolute path. Override
135
+ * precedence: setPath('socket-wheelhouse-dir', …) → $SOCKET_HOME/_wheelhouse →
136
+ * $HOME/.socket/_wheelhouse.
163
137
  */
164
138
  /**
165
139
  * Get the Socket Wheelhouse directory (~/.socket/_wheelhouse). Shared
@@ -167,34 +141,23 @@ export declare function getSocketUserDir(): string;
167
141
  * each one re-downloading and re-extracting per-repo. Tool installers (janus,
168
142
  * sfw, etc.) drop their resolved executables under
169
143
  * `<wheelhouse>/<tool>/<version>/<platform-arch>/`; consumers add the
170
- * appropriate `bin/` to PATH or invoke the binary by absolute path.
171
- *
172
- * Priority order:
173
- *
174
- * 1. Test override via setPath('socket-wheelhouse-dir', ...)
175
- * 2. SOCKET_HOME/_wheelhouse - Base directory override (inherits from
176
- * getSocketUserDir)
177
- * 3. Default: $HOME/.socket/_wheelhouse
144
+ * appropriate `bin/` to PATH or invoke the binary by absolute path. Override
145
+ * precedence: setPath('socket-wheelhouse-dir', …) → $SOCKET_HOME/_wheelhouse →
146
+ * $HOME/.socket/_wheelhouse.
178
147
  */
179
148
  export declare function getSocketWheelhouseDir(): string;
180
149
  /**
181
- * Get the Socket user directory (~/.socket). Can be overridden with SOCKET_HOME
182
- * environment variable or via setPath() for testing. Result is cached via
183
- * getPathValue for performance.
184
- *
185
- * Priority order:
150
+ * Get the user's home directory. Uses environment variables directly to support
151
+ * test mocking. Falls back to temporary directory if home is not available.
186
152
  *
187
- * 1. Test override via setPath('socket-user-dir', ...)
188
- * 2. SOCKET_HOME - Base directory override
189
- * 3. Default: $HOME/.socket
190
- * 4. Fallback: /tmp/.socket (Unix) or %TEMP%.socket (Windows)
153
+ * Priority order: 1. HOME (Unix) 2. USERPROFILE (Windows) 3.
154
+ * getNodeOs().homedir() 4. Fallback: getNodeOs().tmpdir() (restricted envs).
191
155
  */
192
156
  /**
193
157
  * Get the user's home directory. Uses environment variables directly to support
194
158
  * test mocking. Falls back to temporary directory if home is not available.
195
159
  *
196
- * Priority order: 1. HOME environment variable (Unix) 2. USERPROFILE
197
- * environment variable (Windows) 3. getNodeOs().homedir() 4. Fallback:
198
- * getNodeOs().tmpdir() (rarely used, for restricted environments)
160
+ * Priority order: 1. HOME (Unix) 2. USERPROFILE (Windows) 3.
161
+ * getNodeOs().homedir() 4. Fallback: getNodeOs().tmpdir() (restricted envs).
199
162
  */
200
163
  export declare function getUserHomeDir(): string;
@@ -2,33 +2,34 @@
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_node_os = require('../node/os.js');
5
+ const require_env_home = require('../env/home.js');
5
6
  const require_paths_normalize = require('./normalize.js');
6
7
  const require_node_path = require('../node/path.js');
7
8
  const require_env_socket = require('../env/socket.js');
8
- const require_constants_github = require('../constants/github.js');
9
9
  const require_constants_socket = require('../constants/socket.js');
10
- const require_env_home = require('../env/home.js');
11
10
  const require_env_windows = require('../env/windows.js');
12
11
  const require_paths_dirnames = require('./dirnames.js');
13
12
  const require_paths_rewire = require('./rewire.js');
14
13
 
15
14
  //#region src/paths/socket.ts
16
15
  /**
17
- * @file Path utilities for Socket ecosystem directories. Provides
18
- * platform-aware path resolution for Socket tools' shared directory
19
- * structure. Directory Structure: ~/.socket/ ├── _cacache/ #
20
- * Content-addressable cache for npm packages ├── _dlx/ # DLX installations
21
- * (content-addressed by hash) ├── <hash>/ # npm package installs
22
- * (dlx-package) └── <hash>/ # binary downloads (dlx-binary) ├── _socket/ #
23
- * Socket CLI app directory ├── _registry/ # Socket Registry app directory └──
24
- * _sfw/ # Socket Firewall app directory.
16
+ * @file Path utilities for Socket ecosystem directories. Platform-aware
17
+ * resolution for the shared ~/.socket/ layout. The `_`-prefixed entries are
18
+ * Socket-managed DIRS (not apps): `_cacache` content-addressable cache;
19
+ * `_dlx/<hash>/` name+version binary store (node, jre, python, sfw, …);
20
+ * `_state/<app>/` version-LESS persistent app state (daemon socket + lock +
21
+ * OAuth refresh; mirrors pnpm `state-dir` / XDG_STATE_HOME), with
22
+ * `_state/<app>/run/` for a daemon's socket/lock/pid; `_wheelhouse`
23
+ * cross-fleet shared bin. Generic per-app dirs (`getSocketAppDir('<name>')`)
24
+ * nest under the same `_`-prefix.
25
25
  */
26
26
  /**
27
27
  * Get the OS home directory. Can be overridden in tests using
28
28
  * setPath('homedir', ...) from paths/rewire.
29
29
  */
30
30
  function getOsHomeDir() {
31
- return require_paths_rewire.getPathValue("homedir", () => require_node_os.getNodeOs().homedir());
31
+ const os = require_node_os.getNodeOs();
32
+ return require_paths_rewire.getPathValue("homedir", () => os.homedir());
32
33
  }
33
34
  /**
34
35
  * Get the OS temporary directory. Can be overridden in tests using
@@ -39,7 +40,8 @@ function getOsHomeDir() {
39
40
  * setPath('tmpdir', ...) from paths/rewire.
40
41
  */
41
42
  function getOsTmpDir() {
42
- return require_paths_rewire.getPathValue("tmpdir", () => require_node_os.getNodeOs().tmpdir());
43
+ const os = require_node_os.getNodeOs();
44
+ return require_paths_rewire.getPathValue("tmpdir", () => os.tmpdir());
43
45
  }
44
46
  /**
45
47
  * Get a Socket app cache directory (~/.socket/_<appName>/cache).
@@ -60,81 +62,72 @@ function getSocketAppCacheTtlDir(appName) {
60
62
  return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketAppCacheDir(appName), "ttl"));
61
63
  }
62
64
  /**
63
- * Get a Socket app directory (~/.socket/_<appName>).
65
+ * Get a Socket app directory (~/.socket/_<appName>). The `_` prefix is applied
66
+ * here; pass the bare app name (e.g. 'socket', 'registry').
64
67
  */
65
68
  /**
66
- * Get a Socket app directory (~/.socket/_<appName>).
69
+ * Get a Socket app directory (~/.socket/_<appName>). The `_` prefix is applied
70
+ * here; pass the bare app name (e.g. 'socket', 'registry').
67
71
  */
68
72
  function getSocketAppDir(appName) {
69
73
  return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketUserDir(), `${"_"}${appName}`));
70
74
  }
71
75
  /**
72
- * Get the Socket cacache directory (~/.socket/_cacache). Can be overridden with
73
- * SOCKET_CACACHE_DIR environment variable or via setPath() for testing. Result
74
- * is cached via getPathValue for performance.
75
- *
76
- * Priority order:
77
- *
78
- * 1. Test override via setPath('socket-cacache-dir', ...)
79
- * 2. SOCKET_CACACHE_DIR - Full override of cacache directory
80
- * 3. Default: $SOCKET_HOME/_cacache or $HOME/.socket/_cacache
76
+ * Get the Socket cacache directory (~/.socket/_cacache). Override precedence:
77
+ * setPath('socket-cacache-dir', …) SOCKET_CACACHE_DIR env →
78
+ * $SOCKET_HOME/_cacache $HOME/.socket/_cacache.
81
79
  */
82
80
  /**
83
- * Get the Socket cacache directory (~/.socket/_cacache). Can be overridden with
84
- * SOCKET_CACACHE_DIR environment variable or via setPath() for testing. Result
85
- * is cached via getPathValue for performance.
86
- *
87
- * Priority order:
88
- *
89
- * 1. Test override via setPath('socket-cacache-dir', ...)
90
- * 2. SOCKET_CACACHE_DIR - Full override of cacache directory
91
- * 3. Default: $SOCKET_HOME/_cacache or $HOME/.socket/_cacache
81
+ * Get an app's runtime directory (~/.socket/_state/<app>/run/) the home for a
82
+ * daemon's Unix socket + `concurrency.lock` + `<socket>.pid`. Version-less so
83
+ * the socket path is stable across binary upgrades.
92
84
  */
93
- function getSocketCacacheDir() {
94
- return require_paths_rewire.getPathValue("socket-cacache-dir", () => {
95
- if (require_env_socket.getSocketCacacheDirEnv()) return require_paths_normalize.normalizePath(require_env_socket.getSocketCacacheDirEnv());
96
- return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketUserDir(), `${"_"}cacache`));
97
- });
85
+ function getSocketAppRuntimeDir(appName) {
86
+ return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketAppStateDir(appName), "run"));
98
87
  }
99
88
  /**
100
- * Get the Socket CLI directory (~/.socket/_socket).
89
+ * Get the Socket user directory (~/.socket). Override precedence:
90
+ * setPath('socket-user-dir', …) → SOCKET_HOME env → $HOME/.socket →
91
+ * /tmp/.socket (Unix) or %TEMP%.socket (Windows).
101
92
  */
102
93
  /**
103
- * Get the Socket CLI directory (~/.socket/_socket).
94
+ * Get an app's persistent state directory (~/.socket/_state/<app>/). The
95
+ * `<app>` is a real app (proteus, acorn) nesting its version-less state inside
96
+ * the `_state` infra dir.
104
97
  */
105
- function getSocketCliDir() {
106
- return getSocketAppDir(require_constants_socket.SOCKET_CLI_APP_NAME);
98
+ function getSocketAppStateDir(appName) {
99
+ return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketStateDir(), appName));
107
100
  }
108
101
  /**
109
- * Get the Socket DLX directory (~/.socket/_dlx). Can be overridden with
110
- * SOCKET_DLX_DIR environment variable or via setPath() for testing. Result is
111
- * cached via getPathValue for performance.
112
- *
113
- * Priority order:
114
- *
115
- * 1. Test override via setPath('socket-dlx-dir', ...)
116
- * 2. SOCKET_DLX_DIR - Full override of DLX cache directory
117
- * 3. SOCKET_HOME/_dlx - Base directory override (inherits from getSocketUserDir)
118
- * 4. Default: $HOME/.socket/_dlx
119
- * 5. Fallback: /tmp/.socket/_dlx (Unix) or %TEMP%.socket_dlx (Windows)
102
+ * Get an app's runtime directory (~/.socket/_state/<app>/run/) the home for a
103
+ * daemon's Unix socket + `concurrency.lock` + `<socket>.pid`. Version-less so
104
+ * the socket path is stable across binary upgrades.
120
105
  */
121
106
  /**
122
- * Get the Socket DLX directory (~/.socket/_dlx). Can be overridden with
123
- * SOCKET_DLX_DIR environment variable or via setPath() for testing. Result is
124
- * cached via getPathValue for performance.
125
- *
126
- * Priority order:
127
- *
128
- * 1. Test override via setPath('socket-dlx-dir', ...)
129
- * 2. SOCKET_DLX_DIR - Full override of DLX cache directory
130
- * 3. SOCKET_HOME/_dlx - Base directory override (inherits from getSocketUserDir)
131
- * 4. Default: $HOME/.socket/_dlx
132
- * 5. Fallback: /tmp/.socket/_dlx (Unix) or %TEMP%.socket_dlx (Windows)
107
+ * Get the Socket cacache directory (~/.socket/_cacache). Override precedence:
108
+ * setPath('socket-cacache-dir', …) SOCKET_CACACHE_DIR env
109
+ * $SOCKET_HOME/_cacache $HOME/.socket/_cacache.
110
+ */
111
+ function getSocketCacacheDir() {
112
+ return require_paths_rewire.getPathValue("socket-cacache-dir", () => {
113
+ if (require_env_socket.getSocketCacacheDirEnv()) return require_paths_normalize.normalizePath(require_env_socket.getSocketCacacheDirEnv());
114
+ return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketUserDir(), require_constants_socket.SOCKET_DIR.cacache));
115
+ });
116
+ }
117
+ /**
118
+ * Get the Socket DLX directory (~/.socket/_dlx) — the name+version binary store
119
+ * (node, jre, python, sfw, …). Override precedence: setPath('socket-dlx-dir',
120
+ * …) → SOCKET_DLX_DIR env → $SOCKET_HOME/_dlx → $HOME/.socket/_dlx.
121
+ */
122
+ /**
123
+ * Get the Socket DLX directory (~/.socket/_dlx) — the name+version binary store
124
+ * (node, jre, python, sfw, …). Override precedence: setPath('socket-dlx-dir',
125
+ * …) → SOCKET_DLX_DIR env → $SOCKET_HOME/_dlx → $HOME/.socket/_dlx.
133
126
  */
134
127
  function getSocketDlxDir() {
135
128
  return require_paths_rewire.getPathValue("socket-dlx-dir", () => {
136
129
  if (require_env_socket.getSocketDlxDirEnv()) return require_paths_normalize.normalizePath(require_env_socket.getSocketDlxDirEnv());
137
- return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketUserDir(), `${"_"}${"dlx"}`));
130
+ return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketUserDir(), require_constants_socket.SOCKET_DIR.dlx));
138
131
  });
139
132
  }
140
133
  /**
@@ -149,51 +142,34 @@ function getSocketHomePath() {
149
142
  return getSocketUserDir();
150
143
  }
151
144
  /**
152
- * Get the Socket Registry directory (~/.socket/_registry).
145
+ * Get the Socket state directory (~/.socket/_state) — version-LESS persistent
146
+ * app state (the home for daemon sockets, locks, OAuth refresh, durable caches
147
+ * that survive version bumps; mirrors pnpm `state-dir` / XDG_STATE_HOME).
148
+ * Override precedence: setPath('socket-state-dir', …) → SOCKET_STATE_DIR env →
149
+ * $SOCKET_HOME/_state → $HOME/.socket/_state.
153
150
  */
154
151
  /**
155
- * Get the Socket Registry directory (~/.socket/_registry).
156
- */
157
- function getSocketRegistryDir() {
158
- return getSocketAppDir(require_constants_socket.SOCKET_REGISTRY_APP_NAME);
159
- }
160
- /**
161
- * Get the Socket Registry GitHub cache directory
162
- * (~/.socket/_registry/cache/ttl/github).
152
+ * Get the Socket state directory (~/.socket/_state) — version-LESS persistent
153
+ * app state (the home for daemon sockets, locks, OAuth refresh, durable caches
154
+ * that survive version bumps; mirrors pnpm `state-dir` / XDG_STATE_HOME).
155
+ * Override precedence: setPath('socket-state-dir', …) → SOCKET_STATE_DIR env →
156
+ * $SOCKET_HOME/_state → $HOME/.socket/_state.
163
157
  */
164
- /**
165
- * Get the Socket Registry GitHub cache directory
166
- * (~/.socket/_registry/cache/ttl/github).
167
- */
168
- function getSocketRegistryGithubCacheDir() {
169
- return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketAppCacheTtlDir(require_constants_socket.SOCKET_REGISTRY_APP_NAME), require_constants_github.CACHE_GITHUB_DIR));
158
+ function getSocketStateDir() {
159
+ return require_paths_rewire.getPathValue("socket-state-dir", () => {
160
+ if (require_env_socket.getSocketStateDirEnv()) return require_paths_normalize.normalizePath(require_env_socket.getSocketStateDirEnv());
161
+ return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketUserDir(), require_constants_socket.SOCKET_DIR.state));
162
+ });
170
163
  }
171
164
  /**
172
- * Get the Socket Wheelhouse directory (~/.socket/_wheelhouse). Shared
173
- * cross-fleet location for binaries that every fleet member can reach without
174
- * each one re-downloading and re-extracting per-repo. Tool installers (janus,
175
- * sfw, etc.) drop their resolved executables under
176
- * `<wheelhouse>/<tool>/<version>/<platform-arch>/`; consumers add the
177
- * appropriate `bin/` to PATH or invoke the binary by absolute path.
178
- *
179
- * Priority order:
180
- *
181
- * 1. Test override via setPath('socket-wheelhouse-dir', ...)
182
- * 2. SOCKET_HOME/_wheelhouse - Base directory override (inherits from
183
- * getSocketUserDir)
184
- * 3. Default: $HOME/.socket/_wheelhouse
165
+ * Get an app's persistent state directory (~/.socket/_state/<app>/). The
166
+ * `<app>` is a real app (proteus, acorn) nesting its version-less state inside
167
+ * the `_state` infra dir.
185
168
  */
186
169
  /**
187
- * Get the Socket user directory (~/.socket). Can be overridden with SOCKET_HOME
188
- * environment variable or via setPath() for testing. Result is cached via
189
- * getPathValue for performance.
190
- *
191
- * Priority order:
192
- *
193
- * 1. Test override via setPath('socket-user-dir', ...)
194
- * 2. SOCKET_HOME - Base directory override
195
- * 3. Default: $HOME/.socket
196
- * 4. Fallback: /tmp/.socket (Unix) or %TEMP%.socket (Windows)
170
+ * Get the Socket user directory (~/.socket). Override precedence:
171
+ * setPath('socket-user-dir', …) SOCKET_HOME env $HOME/.socket
172
+ * /tmp/.socket (Unix) or %TEMP%.socket (Windows).
197
173
  */
198
174
  function getSocketUserDir() {
199
175
  return require_paths_rewire.getPathValue("socket-user-dir", () => {
@@ -203,12 +179,14 @@ function getSocketUserDir() {
203
179
  });
204
180
  }
205
181
  /**
206
- * Get the user's home directory. Uses environment variables directly to support
207
- * test mocking. Falls back to temporary directory if home is not available.
208
- *
209
- * Priority order: 1. HOME environment variable (Unix) 2. USERPROFILE
210
- * environment variable (Windows) 3. getNodeOs().homedir() 4. Fallback:
211
- * getNodeOs().tmpdir() (rarely used, for restricted environments)
182
+ * Get the Socket Wheelhouse directory (~/.socket/_wheelhouse). Shared
183
+ * cross-fleet location for binaries that every fleet member can reach without
184
+ * each one re-downloading and re-extracting per-repo. Tool installers (janus,
185
+ * sfw, etc.) drop their resolved executables under
186
+ * `<wheelhouse>/<tool>/<version>/<platform-arch>/`; consumers add the
187
+ * appropriate `bin/` to PATH or invoke the binary by absolute path. Override
188
+ * precedence: setPath('socket-wheelhouse-dir', …) → $SOCKET_HOME/_wheelhouse →
189
+ * $HOME/.socket/_wheelhouse.
212
190
  */
213
191
  /**
214
192
  * Get the Socket Wheelhouse directory (~/.socket/_wheelhouse). Shared
@@ -216,39 +194,28 @@ function getSocketUserDir() {
216
194
  * each one re-downloading and re-extracting per-repo. Tool installers (janus,
217
195
  * sfw, etc.) drop their resolved executables under
218
196
  * `<wheelhouse>/<tool>/<version>/<platform-arch>/`; consumers add the
219
- * appropriate `bin/` to PATH or invoke the binary by absolute path.
220
- *
221
- * Priority order:
222
- *
223
- * 1. Test override via setPath('socket-wheelhouse-dir', ...)
224
- * 2. SOCKET_HOME/_wheelhouse - Base directory override (inherits from
225
- * getSocketUserDir)
226
- * 3. Default: $HOME/.socket/_wheelhouse
197
+ * appropriate `bin/` to PATH or invoke the binary by absolute path. Override
198
+ * precedence: setPath('socket-wheelhouse-dir', …) → $SOCKET_HOME/_wheelhouse →
199
+ * $HOME/.socket/_wheelhouse.
227
200
  */
228
201
  function getSocketWheelhouseDir() {
229
202
  return require_paths_rewire.getPathValue("socket-wheelhouse-dir", () => {
230
- return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketUserDir(), `${"_"}${require_constants_socket.SOCKET_WHEELHOUSE_APP_NAME}`));
203
+ return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketUserDir(), require_constants_socket.SOCKET_DIR.wheelhouse));
231
204
  });
232
205
  }
233
206
  /**
234
- * Get the Socket user directory (~/.socket). Can be overridden with SOCKET_HOME
235
- * environment variable or via setPath() for testing. Result is cached via
236
- * getPathValue for performance.
237
- *
238
- * Priority order:
207
+ * Get the user's home directory. Uses environment variables directly to support
208
+ * test mocking. Falls back to temporary directory if home is not available.
239
209
  *
240
- * 1. Test override via setPath('socket-user-dir', ...)
241
- * 2. SOCKET_HOME - Base directory override
242
- * 3. Default: $HOME/.socket
243
- * 4. Fallback: /tmp/.socket (Unix) or %TEMP%.socket (Windows)
210
+ * Priority order: 1. HOME (Unix) 2. USERPROFILE (Windows) 3.
211
+ * getNodeOs().homedir() 4. Fallback: getNodeOs().tmpdir() (restricted envs).
244
212
  */
245
213
  /**
246
214
  * Get the user's home directory. Uses environment variables directly to support
247
215
  * test mocking. Falls back to temporary directory if home is not available.
248
216
  *
249
- * Priority order: 1. HOME environment variable (Unix) 2. USERPROFILE
250
- * environment variable (Windows) 3. getNodeOs().homedir() 4. Fallback:
251
- * getNodeOs().tmpdir() (rarely used, for restricted environments)
217
+ * Priority order: 1. HOME (Unix) 2. USERPROFILE (Windows) 3.
218
+ * getNodeOs().homedir() 4. Fallback: getNodeOs().tmpdir() (restricted envs).
252
219
  */
253
220
  function getUserHomeDir() {
254
221
  const home = require_env_home.getHome();
@@ -270,12 +237,12 @@ exports.getOsTmpDir = getOsTmpDir;
270
237
  exports.getSocketAppCacheDir = getSocketAppCacheDir;
271
238
  exports.getSocketAppCacheTtlDir = getSocketAppCacheTtlDir;
272
239
  exports.getSocketAppDir = getSocketAppDir;
240
+ exports.getSocketAppRuntimeDir = getSocketAppRuntimeDir;
241
+ exports.getSocketAppStateDir = getSocketAppStateDir;
273
242
  exports.getSocketCacacheDir = getSocketCacacheDir;
274
- exports.getSocketCliDir = getSocketCliDir;
275
243
  exports.getSocketDlxDir = getSocketDlxDir;
276
244
  exports.getSocketHomePath = getSocketHomePath;
277
- exports.getSocketRegistryDir = getSocketRegistryDir;
278
- exports.getSocketRegistryGithubCacheDir = getSocketRegistryGithubCacheDir;
245
+ exports.getSocketStateDir = getSocketStateDir;
279
246
  exports.getSocketUserDir = getSocketUserDir;
280
247
  exports.getSocketWheelhouseDir = getSocketWheelhouseDir;
281
248
  exports.getUserHomeDir = getUserHomeDir;