@socketsecurity/lib 6.0.7 → 6.0.9

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 (323) hide show
  1. package/CHANGELOG.md +42 -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 +82 -0
  18. package/dist/ai/route.js +171 -0
  19. package/dist/ai/spawn.d.mts +42 -2
  20. package/dist/ai/spawn.js +146 -33
  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 +25 -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 +23322 -18018
  34. package/dist/bin/resolve.js +2 -2
  35. package/dist/cache/ttl/store.js +2 -2
  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 +5 -1
  41. package/dist/compression/gzip.js +5 -1
  42. package/dist/config/layers.d.ts +53 -0
  43. package/dist/config/layers.js +83 -0
  44. package/dist/constants/packages.d.ts +3 -0
  45. package/dist/constants/packages.js +2 -1
  46. package/dist/constants/socket.d.ts +2 -6
  47. package/dist/constants/socket.js +12 -14
  48. package/dist/cover/code.js +2 -2
  49. package/dist/crypto/hash.d.ts +4 -1
  50. package/dist/crypto/hash.js +4 -1
  51. package/dist/dlx/arborist.js +13 -3
  52. package/dist/dlx/binary-cache.js +1 -1
  53. package/dist/dlx/binary-resolution.js +1 -1
  54. package/dist/dlx/detect.d.ts +8 -0
  55. package/dist/dlx/firewall.d.ts +8 -0
  56. package/dist/dlx/lockfile.js +5 -2
  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 +2 -2
  71. package/dist/env/proxy.js +1 -1
  72. package/dist/env/rewire.d.ts +6 -3
  73. package/dist/env/rewire.js +7 -8
  74. package/dist/env/socket.d.ts +7 -0
  75. package/dist/env/socket.js +10 -0
  76. package/dist/env/xdg.d.ts +17 -0
  77. package/dist/env/xdg.js +21 -1
  78. package/dist/errors/predicates.js +1 -1
  79. package/dist/errors/stack.js +1 -2
  80. package/dist/external/@npmcli/package-json.js +3455 -4881
  81. package/dist/external/@npmcli/promise-spawn.js +3 -1
  82. package/dist/external/@yarnpkg/extensions.js +1 -1
  83. package/dist/external/external-pack.js +1 -1
  84. package/dist/external/npm-pack.js +29164 -31799
  85. package/dist/external/pico-pack.js +4 -2
  86. package/dist/external/tar-fs.js +63 -16
  87. package/dist/external/which.js +3 -1
  88. package/dist/external-tools/bazel/asset-names.d.ts +1 -1
  89. package/dist/external-tools/bazel/asset-names.js +5 -2
  90. package/dist/external-tools/bazel/from-download.d.ts +1 -1
  91. package/dist/external-tools/bazel/from-download.js +5 -2
  92. package/dist/external-tools/bazel/resolve-bazel-version.js +4 -0
  93. package/dist/external-tools/bazel/resolve.d.ts +3 -3
  94. package/dist/external-tools/bazel/resolve.js +16 -8
  95. package/dist/external-tools/cdxgen/asset-names.d.ts +1 -1
  96. package/dist/external-tools/cdxgen/asset-names.js +5 -2
  97. package/dist/external-tools/cdxgen/from-download.d.ts +1 -1
  98. package/dist/external-tools/cdxgen/from-download.js +7 -4
  99. package/dist/external-tools/cdxgen/resolve.d.ts +3 -3
  100. package/dist/external-tools/cdxgen/resolve.js +16 -8
  101. package/dist/external-tools/from-download.d.ts +2 -2
  102. package/dist/external-tools/from-download.js +11 -5
  103. package/dist/external-tools/from-pip-venv.d.ts +1 -1
  104. package/dist/external-tools/from-pip-venv.js +12 -5
  105. package/dist/external-tools/janus/asset-names.d.ts +1 -1
  106. package/dist/external-tools/janus/asset-names.js +5 -2
  107. package/dist/external-tools/janus/from-download.d.ts +1 -1
  108. package/dist/external-tools/janus/from-download.js +5 -2
  109. package/dist/external-tools/janus/resolve.d.ts +3 -3
  110. package/dist/external-tools/janus/resolve.js +16 -8
  111. package/dist/external-tools/jre/asset-names.d.ts +1 -1
  112. package/dist/external-tools/jre/asset-names.js +5 -2
  113. package/dist/external-tools/jre/detect-platform-arch.js +1 -1
  114. package/dist/external-tools/jre/from-download.d.ts +1 -1
  115. package/dist/external-tools/jre/from-download.js +7 -4
  116. package/dist/external-tools/jre/from-java-home.js +2 -2
  117. package/dist/external-tools/jre/from-vfs.js +2 -2
  118. package/dist/external-tools/jre/resolve.d.ts +3 -3
  119. package/dist/external-tools/jre/resolve.js +16 -8
  120. package/dist/external-tools/manifest.d.ts +18 -0
  121. package/dist/external-tools/manifest.js +2 -2
  122. package/dist/external-tools/opengrep/asset-names.d.ts +1 -1
  123. package/dist/external-tools/opengrep/asset-names.js +5 -2
  124. package/dist/external-tools/opengrep/from-download.d.ts +1 -1
  125. package/dist/external-tools/opengrep/from-download.js +5 -2
  126. package/dist/external-tools/opengrep/resolve.d.ts +3 -3
  127. package/dist/external-tools/opengrep/resolve.js +16 -8
  128. package/dist/external-tools/python/asset-names.d.ts +1 -1
  129. package/dist/external-tools/python/asset-names.js +11 -4
  130. package/dist/external-tools/python/dlx.d.ts +3 -3
  131. package/dist/external-tools/python/dlx.js +20 -9
  132. package/dist/external-tools/python/from-download.d.ts +1 -1
  133. package/dist/external-tools/python/from-download.js +12 -5
  134. package/dist/external-tools/python/pin.js +6 -3
  135. package/dist/external-tools/python/pip-install.js +6 -3
  136. package/dist/external-tools/python/resolve.d.ts +3 -3
  137. package/dist/external-tools/python/resolve.js +19 -11
  138. package/dist/external-tools/python/uv-install.d.ts +89 -0
  139. package/dist/external-tools/python/uv-install.js +165 -0
  140. package/dist/external-tools/sbt/asset-names.d.ts +1 -1
  141. package/dist/external-tools/sbt/asset-names.js +5 -2
  142. package/dist/external-tools/sbt/from-download.d.ts +1 -1
  143. package/dist/external-tools/sbt/from-download.js +5 -2
  144. package/dist/external-tools/sbt/resolve.d.ts +3 -3
  145. package/dist/external-tools/sbt/resolve.js +16 -8
  146. package/dist/external-tools/skillspector/from-dlx.d.ts +1 -1
  147. package/dist/external-tools/skillspector/from-dlx.js +10 -3
  148. package/dist/external-tools/skillspector/from-uv.d.ts +30 -0
  149. package/dist/external-tools/skillspector/from-uv.js +56 -0
  150. package/dist/external-tools/skillspector/resolve.d.ts +20 -5
  151. package/dist/external-tools/skillspector/resolve.js +27 -6
  152. package/dist/external-tools/skillspector/types.d.ts +3 -1
  153. package/dist/external-tools/synp/asset-names.d.ts +1 -1
  154. package/dist/external-tools/synp/asset-names.js +6 -2
  155. package/dist/external-tools/synp/from-download.d.ts +1 -1
  156. package/dist/external-tools/synp/from-download.js +5 -2
  157. package/dist/external-tools/synp/resolve.d.ts +3 -3
  158. package/dist/external-tools/synp/resolve.js +16 -8
  159. package/dist/external-tools/trivy/asset-names.d.ts +1 -1
  160. package/dist/external-tools/trivy/asset-names.js +5 -2
  161. package/dist/external-tools/trivy/from-download.d.ts +1 -1
  162. package/dist/external-tools/trivy/from-download.js +7 -4
  163. package/dist/external-tools/trivy/resolve.d.ts +3 -3
  164. package/dist/external-tools/trivy/resolve.js +16 -8
  165. package/dist/external-tools/trufflehog/asset-names.d.ts +1 -1
  166. package/dist/external-tools/trufflehog/asset-names.js +5 -2
  167. package/dist/external-tools/trufflehog/from-download.d.ts +1 -1
  168. package/dist/external-tools/trufflehog/from-download.js +7 -4
  169. package/dist/external-tools/trufflehog/resolve.d.ts +3 -3
  170. package/dist/external-tools/trufflehog/resolve.js +16 -8
  171. package/dist/external-tools/uv/asset-names.d.ts +36 -0
  172. package/dist/external-tools/uv/asset-names.js +73 -0
  173. package/dist/external-tools/uv/from-download.d.ts +17 -0
  174. package/dist/external-tools/uv/from-download.js +50 -0
  175. package/dist/external-tools/uv/from-path.d.ts +5 -0
  176. package/dist/external-tools/uv/from-path.js +22 -0
  177. package/dist/external-tools/uv/from-vfs.d.ts +7 -0
  178. package/dist/external-tools/uv/from-vfs.js +26 -0
  179. package/dist/external-tools/uv/resolve.d.ts +25 -0
  180. package/dist/external-tools/uv/resolve.js +61 -0
  181. package/dist/external-tools/uv/types.d.ts +24 -0
  182. package/dist/external-tools/uv/types.js +2 -0
  183. package/dist/fleet/repo-config.d.ts +53 -0
  184. package/dist/fleet/repo-config.js +79 -0
  185. package/dist/fs/allowed-dirs-cache.d.ts +27 -1
  186. package/dist/fs/allowed-dirs-cache.js +39 -6
  187. package/dist/fs/copy.d.ts +88 -0
  188. package/dist/fs/copy.js +89 -0
  189. package/dist/fs/find.js +1 -1
  190. package/dist/fs/read-json-cache.d.ts +7 -0
  191. package/dist/fs/resolve-module.js +6 -2
  192. package/dist/fs/safe.js +1 -1
  193. package/dist/git/_internal.js +3 -3
  194. package/dist/git/repo.js +2 -4
  195. package/dist/git/staged.js +8 -0
  196. package/dist/git/tracked.d.ts +84 -0
  197. package/dist/git/tracked.js +163 -0
  198. package/dist/git/unstaged.js +8 -0
  199. package/dist/github/refs-graphql.js +4 -0
  200. package/dist/github/refs-rest.js +4 -0
  201. package/dist/globs/_internal.js +1 -1
  202. package/dist/globs/match.js +9 -1
  203. package/dist/globs/matcher.js +5 -1
  204. package/dist/http-request/browser.js +7 -3
  205. package/dist/http-request/checksum-file.js +1 -1
  206. package/dist/http-request/{browser-fetch.d.ts → fetch/browser.d.ts} +2 -2
  207. package/dist/http-request/{browser-fetch.js → fetch/browser.js} +4 -4
  208. package/dist/http-request/headers.js +1 -1
  209. package/dist/http-request/request-attempt.js +2 -2
  210. package/dist/http-request/user-agent.js +1 -1
  211. package/dist/integrity.d.ts +124 -71
  212. package/dist/integrity.js +168 -78
  213. package/dist/json/edit.js +38 -30
  214. package/dist/json/format.js +1 -1
  215. package/dist/logger/colors.d.ts +1 -2
  216. package/dist/logger/colors.js +2 -2
  217. package/dist/logger/symbols-builder.js +7 -8
  218. package/dist/logger/symbols.js +8 -8
  219. package/dist/native-messaging/install.d.ts +1 -1
  220. package/dist/native-messaging/install.js +7 -4
  221. package/dist/native-messaging/rate-limit.d.ts +7 -0
  222. package/dist/native-messaging/rate-limit.js +4 -0
  223. package/dist/node/async-hooks.js +1 -1
  224. package/dist/node/child-process.js +1 -1
  225. package/dist/node/crypto.js +1 -1
  226. package/dist/node/events.js +1 -1
  227. package/dist/node/fs-promises.js +1 -1
  228. package/dist/node/fs.d.ts +22 -6
  229. package/dist/node/fs.js +16 -3
  230. package/dist/node/http.js +1 -1
  231. package/dist/node/https.js +1 -1
  232. package/dist/node/module.d.ts +73 -2
  233. package/dist/node/module.js +97 -12
  234. package/dist/node/os.d.ts +10 -2
  235. package/dist/node/os.js +11 -4
  236. package/dist/node/path.d.ts +11 -2
  237. package/dist/node/path.js +17 -4
  238. package/dist/node/timers-promises.js +1 -1
  239. package/dist/node/url.js +1 -1
  240. package/dist/node/util.js +1 -1
  241. package/dist/objects/getters.js +1 -1
  242. package/dist/objects/mutate.js +2 -2
  243. package/dist/packages/edit-class.d.ts +2 -3
  244. package/dist/packages/edit-class.js +41 -35
  245. package/dist/packages/exports.js +4 -4
  246. package/dist/packages/fetch.js +1 -1
  247. package/dist/packages/isolation.js +2 -2
  248. package/dist/packages/licenses.js +2 -2
  249. package/dist/packages/manifest.d.ts +29 -0
  250. package/dist/packages/manifest.js +40 -4
  251. package/dist/packages/normalize.js +2 -2
  252. package/dist/packages/provenance.js +3 -3
  253. package/dist/packages/specs.js +1 -1
  254. package/dist/packages/tarball.js +4 -2
  255. package/dist/packages/types.d.ts +1 -2
  256. package/dist/paths/_internal.d.ts +1 -7
  257. package/dist/paths/_internal.js +9 -15
  258. package/dist/paths/conversion.js +1 -1
  259. package/dist/paths/dirnames.d.ts +1 -0
  260. package/dist/paths/dirnames.js +2 -0
  261. package/dist/paths/normalize.js +1 -1
  262. package/dist/paths/predicates.js +2 -1
  263. package/dist/paths/resolve.js +14 -19
  264. package/dist/paths/rewire.d.ts +5 -0
  265. package/dist/paths/socket.d.ts +137 -123
  266. package/dist/paths/socket.js +172 -131
  267. package/dist/perf/metrics.js +1 -1
  268. package/dist/perf/report.js +1 -1
  269. package/dist/primordials/process.d.ts +88 -0
  270. package/dist/primordials/process.js +132 -0
  271. package/dist/primordials/uncurry.d.ts +1 -2
  272. package/dist/process/spawn/child.js +8 -2
  273. package/dist/process/spawn/errors.js +1 -1
  274. package/dist/releases/github-archives.js +1 -1
  275. package/dist/releases/github-listing.d.ts +1 -2
  276. package/dist/schema/types.d.ts +3 -4
  277. package/dist/schema/validate.js +1 -1
  278. package/dist/secrets/broker.d.ts +35 -0
  279. package/dist/secrets/broker.js +72 -0
  280. package/dist/secrets/find.d.ts +8 -6
  281. package/dist/secrets/find.js +25 -5
  282. package/dist/secrets/keychain.d.ts +1 -1
  283. package/dist/secrets/linux.js +32 -44
  284. package/dist/secrets/macos.d.ts +1 -2
  285. package/dist/secrets/macos.js +20 -29
  286. package/dist/secrets/rc.d.ts +2 -2
  287. package/dist/secrets/rc.js +21 -13
  288. package/dist/secrets/socket-api-token.js +8 -0
  289. package/dist/secrets/windows.js +27 -33
  290. package/dist/shell/parse.d.ts +32 -0
  291. package/dist/shell/parse.js +60 -0
  292. package/dist/smol/detect.js +1 -1
  293. package/dist/smol/http.js +1 -1
  294. package/dist/smol/https.js +1 -1
  295. package/dist/smol/manifest.js +1 -1
  296. package/dist/smol/path.js +1 -1
  297. package/dist/smol/primordial.js +1 -1
  298. package/dist/smol/purl.js +1 -1
  299. package/dist/smol/versions.js +1 -1
  300. package/dist/smol/vfs.js +1 -1
  301. package/dist/sorts/_internal.d.ts +1 -2
  302. package/dist/sorts/_internal.js +2 -6
  303. package/dist/sorts/semver.js +2 -2
  304. package/dist/spinner/create-spinner-class.js +2 -2
  305. package/dist/spinner/spinner-internals.d.ts +1 -1
  306. package/dist/spinner/spinner-internals.js +9 -5
  307. package/dist/spinner/spinner.d.ts +4 -0
  308. package/dist/spinner/spinner.js +1 -1
  309. package/dist/stdio/progress.js +6 -2
  310. package/dist/stdio/prompts.d.ts +2 -10
  311. package/dist/stdio/prompts.js +11 -24
  312. package/dist/strings/format.js +1 -1
  313. package/dist/strings/search.js +1 -1
  314. package/dist/temporal/instant.js +2 -2
  315. package/dist/themes/context.d.ts +5 -3
  316. package/dist/themes/context.js +5 -6
  317. package/dist/url/assert-safe.d.ts +29 -0
  318. package/dist/url/assert-safe.js +54 -0
  319. package/dist/url/predicates.d.ts +31 -1
  320. package/dist/url/predicates.js +42 -1
  321. package/dist/url/types.d.ts +4 -0
  322. package/llms.txt +750 -0
  323. package/package.json +253 -125
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_constants_platform = require('../constants/platform.js');
5
4
  const require_primordials_string = require('../primordials/string.js');
5
+ const require_constants_platform = require('../constants/platform.js');
6
6
  const require_paths__internal = require('./_internal.js');
7
7
  const require_paths_normalize = require('./normalize.js');
8
8
 
@@ -7,5 +7,6 @@ export declare const DOT_GITHUB = ".github";
7
7
  export declare const DOT_SOCKET_DIR = ".socket";
8
8
  export declare const CACHE_DIR = "cache";
9
9
  export declare const CACHE_TTL_DIR = "ttl";
10
+ export declare const RUN_DIR = "run";
10
11
  export declare const NODE_MODULES_GLOB_RECURSIVE = "**/node_modules";
11
12
  export declare const SLASH_NODE_MODULES_SLASH = "/node_modules/";
@@ -12,6 +12,7 @@ const DOT_GITHUB = ".github";
12
12
  const DOT_SOCKET_DIR = ".socket";
13
13
  const CACHE_DIR = "cache";
14
14
  const CACHE_TTL_DIR = "ttl";
15
+ const RUN_DIR = "run";
15
16
  const NODE_MODULES_GLOB_RECURSIVE = "**/node_modules";
16
17
  const SLASH_NODE_MODULES_SLASH = "/node_modules/";
17
18
 
@@ -23,4 +24,5 @@ exports.DOT_GIT_DIR = DOT_GIT_DIR;
23
24
  exports.DOT_SOCKET_DIR = DOT_SOCKET_DIR;
24
25
  exports.NODE_MODULES = NODE_MODULES;
25
26
  exports.NODE_MODULES_GLOB_RECURSIVE = NODE_MODULES_GLOB_RECURSIVE;
27
+ exports.RUN_DIR = RUN_DIR;
26
28
  exports.SLASH_NODE_MODULES_SLASH = SLASH_NODE_MODULES_SLASH;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_constants_platform = require('../constants/platform.js');
5
4
  const require_primordials_string = require('../primordials/string.js');
5
+ const require_constants_platform = require('../constants/platform.js');
6
6
  const require_strings_search = require('../strings/search.js');
7
7
  const require_paths__internal = require('./_internal.js');
8
8
  const require_paths_conversion = require('./conversion.js');
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_constants_platform = require('../constants/platform.js');
5
4
  const require_primordials_string = require('../primordials/string.js');
5
+ const require_constants_platform = require('../constants/platform.js');
6
+ const require_constants_encoding = require('../constants/encoding.js');
6
7
  const require_paths__internal = require('./_internal.js');
7
8
  const require_primordials_regexp = require('../primordials/regexp.js');
8
9
 
@@ -1,11 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_constants_platform = require('../constants/platform.js');
5
- const require_primordials_string = require('../primordials/string.js');
6
- const require_paths__internal = require('./_internal.js');
7
- const require_paths_predicates = require('./predicates.js');
8
- const require_paths_normalize = require('./normalize.js');
9
4
 
10
5
  //#region src/paths/resolve.ts
11
6
  /**
@@ -44,7 +39,7 @@ function relative(from, to) {
44
39
  const actualTo = resolve(to);
45
40
  if (actualFrom === actualTo) return "";
46
41
  /* c8 ignore start - Windows-only case-insensitive comparison. */
47
- if (require_constants_platform.WIN32) {
42
+ if (WIN32) {
48
43
  if (actualFrom.toLowerCase() === actualTo.toLowerCase()) return "";
49
44
  }
50
45
  /* c8 ignore stop */
@@ -57,32 +52,32 @@ function relative(from, to) {
57
52
  let lastCommonSep = -1;
58
53
  let i = 0;
59
54
  for (; i < length; i += 1) {
60
- let fromCode = require_primordials_string.StringPrototypeCharCodeAt(actualFrom, fromStart + i);
61
- let toCode = require_primordials_string.StringPrototypeCharCodeAt(actualTo, toStart + i);
55
+ let fromCode = StringPrototypeCharCodeAt(actualFrom, fromStart + i);
56
+ let toCode = StringPrototypeCharCodeAt(actualTo, toStart + i);
62
57
  /* c8 ignore start - Windows-only case folding. */
63
- if (require_constants_platform.WIN32) {
64
- if (fromCode >= 65 && fromCode <= 90) fromCode += 32;
65
- if (toCode >= 65 && toCode <= 90) toCode += 32;
58
+ if (WIN32) {
59
+ if (fromCode >= CHAR_UPPERCASE_A && fromCode <= CHAR_UPPERCASE_Z) fromCode += 32;
60
+ if (toCode >= CHAR_UPPERCASE_A && toCode <= CHAR_UPPERCASE_Z) toCode += 32;
66
61
  }
67
62
  /* c8 ignore stop */
68
63
  if (fromCode !== toCode) break;
69
- if (require_paths_predicates.isPathSeparator(require_primordials_string.StringPrototypeCharCodeAt(actualFrom, fromStart + i))) lastCommonSep = i;
64
+ if (isPathSeparator(StringPrototypeCharCodeAt(actualFrom, fromStart + i))) lastCommonSep = i;
70
65
  }
71
66
  /* c8 ignore start */
72
67
  if (i === length) {
73
68
  if (toLen > length) {
74
- if (require_paths_predicates.isPathSeparator(require_primordials_string.StringPrototypeCharCodeAt(actualTo, toStart + i))) return actualTo.slice(toStart + i + 1);
69
+ if (isPathSeparator(StringPrototypeCharCodeAt(actualTo, toStart + i))) return actualTo.slice(toStart + i + 1);
75
70
  if (i === 0) return actualTo.slice(toStart + i);
76
71
  } else if (fromLen > length) {
77
- if (require_paths_predicates.isPathSeparator(require_primordials_string.StringPrototypeCharCodeAt(actualFrom, fromStart + i))) lastCommonSep = i;
72
+ if (isPathSeparator(StringPrototypeCharCodeAt(actualFrom, fromStart + i))) lastCommonSep = i;
78
73
  else if (i === 0) lastCommonSep = 0;
79
74
  }
80
75
  }
81
76
  /* c8 ignore stop */
82
77
  let out = "";
83
78
  for (i = fromStart + lastCommonSep + 1; i <= fromEnd; i += 1) {
84
- const code = require_primordials_string.StringPrototypeCharCodeAt(actualFrom, i);
85
- if (i === fromEnd || require_paths_predicates.isPathSeparator(code)) out += out.length === 0 ? ".." : "/..";
79
+ const code = StringPrototypeCharCodeAt(actualFrom, i);
80
+ if (i === fromEnd || isPathSeparator(code)) out += out.length === 0 ? ".." : "/..";
86
81
  }
87
82
  return out + actualTo.slice(toStart + lastCommonSep);
88
83
  }
@@ -108,7 +103,7 @@ function relative(from, to) {
108
103
  function relativeResolve(from, to) {
109
104
  const rel = relative(from, to);
110
105
  if (rel === "") return "";
111
- return require_paths_normalize.normalizePath(rel);
106
+ return normalizePath(rel);
112
107
  }
113
108
  /**
114
109
  * Resolve an absolute path from path segments.
@@ -137,11 +132,11 @@ function resolve(...segments) {
137
132
  /* c8 ignore start */
138
133
  if (typeof segment !== "string" || segment.length === 0) continue;
139
134
  resolvedPath = segment + (resolvedPath.length === 0 ? "" : `/${resolvedPath}`);
140
- resolvedAbsolute = require_paths_predicates.isAbsolute(segment);
135
+ resolvedAbsolute = isAbsolute(segment);
141
136
  }
142
137
  if (!resolvedAbsolute) resolvedPath = /* @__PURE__ */ require("node:process").cwd() + (resolvedPath.length === 0 ? "" : `/${resolvedPath}`);
143
138
  /* c8 ignore stop */
144
- return require_paths_normalize.normalizePath(resolvedPath);
139
+ return normalizePath(resolvedPath);
145
140
  }
146
141
 
147
142
  //#endregion
@@ -7,6 +7,11 @@
7
7
  * - Automatic cache invalidation for path-dependent modules
8
8
  * - Thread-safe for concurrent test execution
9
9
  */
10
+ export interface PathRewireState {
11
+ testOverrides: Map<string, string | undefined>;
12
+ valueCache: Map<string, string>;
13
+ cacheInvalidationCallbacks: Array<() => void>;
14
+ }
10
15
  /**
11
16
  * Clear a specific path override.
12
17
  */
@@ -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
@@ -22,6 +23,26 @@ export declare function getOsHomeDir(): string;
22
23
  * setPath('tmpdir', ...) from paths/rewire.
23
24
  */
24
25
  export declare function getOsTmpDir(): string;
26
+ /**
27
+ * Resolve the runtime socket path for a local daemon named `name`. Distinct
28
+ * from getSocketAppRuntimeDir (the persistent ~/.socket/_state/<app>/run/
29
+ * home): the SOCKET endpoint itself belongs in the ephemeral, owner-only XDG
30
+ * runtime dir — correctly permissioned and auto-cleaned on logout — while the
31
+ * downloaded daemon binary + durable token cache live under ~/.socket. The
32
+ * daemon and every client MUST compute the identical path (1 path, 1
33
+ * reference), so this is the single resolver both sides call.
34
+ *
35
+ * Resolution:
36
+ *
37
+ * - Windows: `\\.\pipe\<name>-sock` (named pipe; Unix sockets are unavailable
38
+ * pre-Win10 1803, same framing/semantics). Returned raw — a pipe path is not
39
+ * a filesystem path and must not be slash-normalized.
40
+ * - `$XDG_RUNTIME_DIR/<name>.sock` when XDG_RUNTIME_DIR is set (systemd
41
+ * `/run/user/<uid>/`).
42
+ * - Else `$TMPDIR/<name>-<uid>.sock` (the `<uid>` suffix avoids collisions when
43
+ * TMPDIR is shared across users on a multi-tenant box).
44
+ */
45
+ export declare function getRuntimeSocketPath(name: string): string;
25
46
  /**
26
47
  * Get a Socket app cache directory (~/.socket/_<appName>/cache).
27
48
  */
@@ -37,67 +58,56 @@ export declare function getSocketAppCacheDir(appName: string): string;
37
58
  */
38
59
  export declare function getSocketAppCacheTtlDir(appName: string): string;
39
60
  /**
40
- * Get a Socket app directory (~/.socket/_<appName>).
61
+ * Get a Socket app directory (~/.socket/_<appName>). The `_` prefix is applied
62
+ * here; pass the bare app name (e.g. 'socket', 'registry').
41
63
  */
42
64
  /**
43
- * 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').
44
67
  */
45
68
  export declare function getSocketAppDir(appName: string): string;
46
69
  /**
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
70
+ * Get the Socket cacache directory (~/.socket/_cacache). Override precedence:
71
+ * setPath('socket-cacache-dir', …) SOCKET_CACACHE_DIR env →
72
+ * $SOCKET_HOME/_cacache $HOME/.socket/_cacache.
56
73
  */
57
74
  /**
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
75
+ * Get an app's runtime directory (~/.socket/_state/<app>/run/) the home for a
76
+ * daemon's Unix socket + `concurrency.lock` + `<socket>.pid`. Version-less so
77
+ * the socket path is stable across binary upgrades.
67
78
  */
68
- export declare function getSocketCacacheDir(): string;
79
+ export declare function getSocketAppRuntimeDir(appName: string): string;
69
80
  /**
70
- * Get the Socket CLI directory (~/.socket/_socket).
81
+ * Get the Socket user directory (~/.socket). Override precedence:
82
+ * setPath('socket-user-dir', …) → SOCKET_HOME env → $HOME/.socket →
83
+ * /tmp/.socket (Unix) or %TEMP%.socket (Windows).
71
84
  */
72
85
  /**
73
- * Get the Socket CLI directory (~/.socket/_socket).
86
+ * Get an app's persistent state directory (~/.socket/_state/<app>/). The
87
+ * `<app>` is a real app (proteus, acorn) nesting its version-less state inside
88
+ * the `_state` infra dir.
74
89
  */
75
- export declare function getSocketCliDir(): string;
90
+ export declare function getSocketAppStateDir(appName: string): string;
76
91
  /**
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)
92
+ * Get an app's runtime directory (~/.socket/_state/<app>/run/) the home for a
93
+ * daemon's Unix socket + `concurrency.lock` + `<socket>.pid`. Version-less so
94
+ * the socket path is stable across binary upgrades.
88
95
  */
89
96
  /**
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)
97
+ * Get the Socket cacache directory (~/.socket/_cacache). Override precedence:
98
+ * setPath('socket-cacache-dir', …) SOCKET_CACACHE_DIR env
99
+ * $SOCKET_HOME/_cacache $HOME/.socket/_cacache.
100
+ */
101
+ export declare function getSocketCacacheDir(): string;
102
+ /**
103
+ * Get the Socket DLX directory (~/.socket/_dlx) — the name+version binary store
104
+ * (node, jre, python, sfw, …). Override precedence: setPath('socket-dlx-dir',
105
+ * …) SOCKET_DLX_DIR env $SOCKET_HOME/_dlx $HOME/.socket/_dlx.
106
+ */
107
+ /**
108
+ * Get the Socket DLX directory (~/.socket/_dlx) — the name+version binary store
109
+ * (node, jre, python, sfw, …). Override precedence: setPath('socket-dlx-dir',
110
+ * …) → SOCKET_DLX_DIR env → $SOCKET_HOME/_dlx → $HOME/.socket/_dlx.
101
111
  */
102
112
  export declare function getSocketDlxDir(): string;
103
113
  /**
@@ -110,91 +120,95 @@ export declare function getSocketDlxDir(): string;
110
120
  */
111
121
  export declare function getSocketHomePath(): string;
112
122
  /**
113
- * Get the Socket Registry directory (~/.socket/_registry).
114
- */
115
- /**
116
- * Get the Socket Registry directory (~/.socket/_registry).
117
- */
118
- export declare function getSocketRegistryDir(): string;
119
- /**
120
- * Get the Socket Registry GitHub cache directory
121
- * (~/.socket/_registry/cache/ttl/github).
122
- */
123
- /**
124
- * Get the Socket Registry GitHub cache directory
125
- * (~/.socket/_registry/cache/ttl/github).
126
- */
127
- export declare function getSocketRegistryGithubCacheDir(): string;
128
- /**
129
- * Get the Socket Wheelhouse directory (~/.socket/_wheelhouse). Shared
130
- * cross-fleet location for binaries that every fleet member can reach without
131
- * each one re-downloading and re-extracting per-repo. Tool installers (janus,
132
- * sfw, etc.) drop their resolved executables under
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)
123
+ * Get the Wheelhouse rack directory (~/.socket/_wheelhouse/rack) — the tool
124
+ * STORE. Every `_wheelhouse`-managed CLI tool keeps its real binaries here,
125
+ * racked by name + version as `<rack>/<tool>/<version>/…` (the wheelhouse
126
+ * analog of Homebrew's `Cellar/`). The handles on PATH live in
127
+ * `<wheelhouse>/bin` (getSocketWheelhouseBinDir) and point into the rack.
128
+ * Inherits the `_wheelhouse` override chain (SOCKET_HOME /
129
+ * setPath('socket-wheelhouse-dir')).
130
+ */
131
+ export declare function getSocketRackDir(): string;
132
+ /**
133
+ * Get a racked tool's version directory (~/.socket/_wheelhouse/rack/<tool>/
134
+ * <version>) the per-tool, per-version home under the rack. The
135
+ * 1-path-1-reference owner of a tool install destination: installers resolve
136
+ * their extract/copy target through this, and the `<wheelhouse>/bin/<tool>`
137
+ * shim points at a binary inside it.
138
+ */
139
+ export declare function getSocketRackToolDir(options: {
140
+ tool: string;
141
+ version: string;
142
+ }): string;
143
+ /**
144
+ * Get the Wheelhouse repo-clones directory (~/.socket/_wheelhouse/repo-clones).
145
+ * Sits beside the per-tool dirs (sfw, codedb, janus, bin) under `_wheelhouse`.
146
+ * The home for reference clones of EXTERNAL repos an agent reviews, each as
147
+ * `<org>-<repo>` lowercased + dash-cased (e.g. `justrach-codedb`).
148
+ *
149
+ * Smallest-practical clone form (smallest disk + fastest initial fetch without
150
+ * the treeless tax): git clone --depth=1 --single-branch --filter=blob:none
151
+ * <url> <dest> `--depth=1` truncates history, `--single-branch` skips other
152
+ * refs, and `--filter=blob:none` (a BLOBLESS partial clone) fetches file blobs
153
+ * lazily on first access — so the initial download is tree-metadata only.
154
+ * (Treeless `--filter=tree:0` is smaller still but refetches trees on every
155
+ * walk, which is slow + breaks offline, so it is NOT the default.)
156
+ *
157
+ * Deliberately OUTSIDE `~/projects/` so the fleet's sibling-walk tooling (e.g.
158
+ * cascade `--all`) never mistakes a reference clone for a fleet member
159
+ * checkout. Disposable: a reference cache, not a working tree. Inherits the
160
+ * `_wheelhouse` override chain (SOCKET_HOME /
161
+ * setPath('socket-wheelhouse-dir')).
162
+ */
163
+ export declare function getSocketRepoClonesDir(): string;
164
+ /**
165
+ * Get the Socket state directory (~/.socket/_state) — version-LESS persistent
166
+ * app state (the home for daemon sockets, locks, OAuth refresh, durable caches
167
+ * that survive version bumps; mirrors pnpm `state-dir` / XDG_STATE_HOME).
168
+ * Override precedence: setPath('socket-state-dir', …) → SOCKET_STATE_DIR env →
169
+ * $SOCKET_HOME/_state → $HOME/.socket/_state.
170
+ */
171
+ export declare function getSocketStateDir(): string;
172
+ /**
173
+ * Get the Socket user directory (~/.socket). Override precedence:
174
+ * setPath('socket-user-dir', …) → SOCKET_HOME env → $HOME/.socket →
175
+ * /tmp/.socket (Unix) or %TEMP%.socket (Windows).
154
176
  */
155
177
  export declare function getSocketUserDir(): string;
156
178
  /**
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)
179
+ * Get the Wheelhouse bin directory (~/.socket/_wheelhouse/bin) the single
180
+ * directory placed on PATH. Holds only flat handles (thin exec shims or
181
+ * symlinks), one per tool, each pointing at a real binary racked under
182
+ * `<wheelhouse>/rack/<tool>/<version>/…` (getSocketRackToolDir). The shim IS
183
+ * the bin, the npm `prefix/bin` / Homebrew `bin/` model: PATH lookup does not
184
+ * recurse, so this dir stays flat (never a `bin/<tool>/` subdir). Inherits the
185
+ * `_wheelhouse` override chain (SOCKET_HOME /
186
+ * setPath('socket-wheelhouse-dir')).
163
187
  */
188
+ export declare function getSocketWheelhouseBinDir(): string;
164
189
  /**
165
190
  * Get the Socket Wheelhouse directory (~/.socket/_wheelhouse). Shared
166
191
  * cross-fleet location for binaries that every fleet member can reach without
167
192
  * each one re-downloading and re-extracting per-repo. Tool installers (janus,
168
- * sfw, etc.) drop their resolved executables under
169
- * `<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
193
+ * sfw, etc.) rack their resolved executables under
194
+ * `<wheelhouse>/rack/<tool>/<version>/…` (getSocketRackToolDir) and expose a
195
+ * handle in `<wheelhouse>/bin` (getSocketWheelhouseBinDir); consumers add that
196
+ * one `bin/` to PATH. Override precedence: setPath('socket-wheelhouse-dir', …)
197
+ * $SOCKET_HOME/_wheelhouse → $HOME/.socket/_wheelhouse.
178
198
  */
179
199
  export declare function getSocketWheelhouseDir(): string;
180
200
  /**
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:
201
+ * Get the user's home directory. Uses environment variables directly to support
202
+ * test mocking. Falls back to temporary directory if home is not available.
186
203
  *
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)
204
+ * Priority order: 1. HOME (Unix) 2. USERPROFILE (Windows) 3.
205
+ * getNodeOs().homedir() 4. Fallback: getNodeOs().tmpdir() (restricted envs).
191
206
  */
192
207
  /**
193
208
  * Get the user's home directory. Uses environment variables directly to support
194
209
  * test mocking. Falls back to temporary directory if home is not available.
195
210
  *
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)
211
+ * Priority order: 1. HOME (Unix) 2. USERPROFILE (Windows) 3.
212
+ * getNodeOs().homedir() 4. Fallback: getNodeOs().tmpdir() (restricted envs).
199
213
  */
200
214
  export declare function getUserHomeDir(): string;