@socketsecurity/lib 6.0.5 → 6.0.6

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 (210) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/ai/discover.js +3 -2
  3. package/dist/ai/spawn.js +8 -5
  4. package/dist/ai/worktree.js +11 -6
  5. package/dist/ansi/strip.js +2 -2
  6. package/dist/archives/_internal.js +4 -4
  7. package/dist/archives/zip.js +1 -1
  8. package/dist/arrays/_internal.js +2 -2
  9. package/dist/arrays/chunk.js +1 -1
  10. package/dist/arrays/join.js +2 -2
  11. package/dist/arrays/unique.js +1 -1
  12. package/dist/bin/acorn-bindgen.cjs +769 -0
  13. package/dist/bin/acorn.wasm +0 -0
  14. package/dist/bin/check-primordials.js +3 -2
  15. package/dist/bin/check.js +3 -2
  16. package/dist/bin/exec.js +1 -1
  17. package/dist/bin/prim.cjs +39064 -0
  18. package/dist/bin/resolve.js +1 -1
  19. package/dist/colors/socket-palette.js +2 -2
  20. package/dist/compression/_internal.js +3 -2
  21. package/dist/compression/brotli.js +5 -12
  22. package/dist/compression/gzip.js +5 -13
  23. package/dist/constants/agents.js +4 -4
  24. package/dist/constants/packages.js +6 -6
  25. package/dist/constants/socket.js +1 -1
  26. package/dist/crypto/hash.js +2 -2
  27. package/dist/debug/_internal.js +2 -2
  28. package/dist/debug/caller-info.js +1 -1
  29. package/dist/debug/namespace.js +5 -5
  30. package/dist/debug/output.js +3 -3
  31. package/dist/dlx/binary-download.js +3 -2
  32. package/dist/eco/npm/npm/flags.js +5 -5
  33. package/dist/eco/npm/pnpm/flags.js +3 -3
  34. package/dist/env/boolean.js +1 -1
  35. package/dist/env/ci.js +1 -1
  36. package/dist/env/debug.js +1 -1
  37. package/dist/env/github.js +8 -8
  38. package/dist/env/home.js +1 -1
  39. package/dist/env/locale.js +3 -3
  40. package/dist/env/node-auth-token.js +1 -1
  41. package/dist/env/node-env.js +1 -1
  42. package/dist/env/npm.js +5 -5
  43. package/dist/env/number.js +1 -1
  44. package/dist/env/package-manager.js +3 -3
  45. package/dist/env/path.js +1 -1
  46. package/dist/env/pre-commit.js +1 -1
  47. package/dist/env/rewire.js +2 -2
  48. package/dist/env/shell.js +1 -1
  49. package/dist/env/socket-cli.js +13 -13
  50. package/dist/env/socket.js +33 -32
  51. package/dist/env/string.js +1 -1
  52. package/dist/env/temp-dir.js +3 -3
  53. package/dist/env/term.js +1 -1
  54. package/dist/env/test.js +3 -3
  55. package/dist/env/windows.js +4 -4
  56. package/dist/env/xdg.js +3 -3
  57. package/dist/events/exit/_internal.js +5 -5
  58. package/dist/events/exit/handler.js +1 -1
  59. package/dist/events/exit/intercept.js +2 -2
  60. package/dist/events/exit/lifecycle.js +3 -3
  61. package/dist/events/exit/signals.js +1 -1
  62. package/dist/external/@sinclair/typebox/value.js +5 -1
  63. package/dist/external/@sinclair/typebox.js +5 -1
  64. package/dist/external/@socketregistry/packageurl-js.js +27 -0
  65. package/dist/external-tools/bazel/resolve.js +2 -1
  66. package/dist/external-tools/cdxgen/resolve.js +2 -1
  67. package/dist/external-tools/from-pip-venv.d.ts +73 -0
  68. package/dist/external-tools/from-pip-venv.js +98 -0
  69. package/dist/external-tools/janus/asset-names.js +1 -1
  70. package/dist/external-tools/janus/from-download.js +3 -5
  71. package/dist/external-tools/janus/resolve.js +2 -1
  72. package/dist/external-tools/jre/from-download.js +2 -1
  73. package/dist/external-tools/jre/resolve.js +2 -1
  74. package/dist/external-tools/manifest.js +7 -5
  75. package/dist/external-tools/opengrep/resolve.js +2 -1
  76. package/dist/external-tools/sbt/resolve.js +2 -1
  77. package/dist/external-tools/skillspector/from-dlx.d.ts +24 -0
  78. package/dist/external-tools/skillspector/from-dlx.js +41 -0
  79. package/dist/external-tools/skillspector/from-path.d.ts +8 -0
  80. package/dist/external-tools/skillspector/from-path.js +32 -0
  81. package/dist/external-tools/skillspector/from-vfs.d.ts +8 -0
  82. package/dist/external-tools/skillspector/from-vfs.js +27 -0
  83. package/dist/external-tools/skillspector/resolve.d.ts +34 -0
  84. package/dist/external-tools/skillspector/resolve.js +53 -0
  85. package/dist/external-tools/skillspector/types.d.ts +24 -0
  86. package/dist/external-tools/skillspector/types.js +2 -0
  87. package/dist/external-tools/synp/resolve.js +2 -1
  88. package/dist/external-tools/trivy/resolve.js +2 -1
  89. package/dist/external-tools/trufflehog/resolve.js +2 -1
  90. package/dist/external-tools/uv/resolve.js +2 -1
  91. package/dist/fs/access.js +4 -4
  92. package/dist/fs/encoding.js +2 -2
  93. package/dist/fs/find-up.js +2 -2
  94. package/dist/fs/inspect.js +6 -6
  95. package/dist/fs/read-dir.js +3 -3
  96. package/dist/fs/read-file.js +6 -6
  97. package/dist/fs/read-json.js +2 -2
  98. package/dist/fs/safe.js +2 -2
  99. package/dist/fs/unique.js +1 -1
  100. package/dist/fs/validate.js +1 -1
  101. package/dist/fs/write-json.js +1 -1
  102. package/dist/git/_internal.js +2 -1
  103. package/dist/globs/_internal.js +4 -4
  104. package/dist/globs/match.js +4 -3
  105. package/dist/globs/matcher.js +2 -2
  106. package/dist/globs/stream.js +1 -1
  107. package/dist/http-request/browser.js +17 -11
  108. package/dist/http-request/download.js +1 -1
  109. package/dist/http-request/headers.d.ts +32 -3
  110. package/dist/http-request/headers.js +42 -13
  111. package/dist/http-request/request-attempt.js +1 -0
  112. package/dist/http-request/request-types.d.ts +5 -0
  113. package/dist/http-request/request.js +32 -15
  114. package/dist/http-request/response-reader.d.ts +12 -1
  115. package/dist/http-request/response-reader.js +22 -2
  116. package/dist/http-request/user-agent.js +1 -1
  117. package/dist/json/edit.js +1 -1
  118. package/dist/json/parse.js +4 -4
  119. package/dist/logger/colors.js +2 -2
  120. package/dist/logger/console.js +1 -1
  121. package/dist/logger/symbols.js +1 -1
  122. package/dist/node/async-hooks.js +2 -2
  123. package/dist/node/child-process.js +2 -2
  124. package/dist/node/crypto.js +2 -2
  125. package/dist/node/events.js +2 -2
  126. package/dist/node/fs-promises.js +2 -2
  127. package/dist/node/fs.js +2 -2
  128. package/dist/node/http.js +2 -2
  129. package/dist/node/https.js +2 -2
  130. package/dist/node/module.js +3 -3
  131. package/dist/node/os.js +2 -2
  132. package/dist/node/path.js +2 -2
  133. package/dist/node/timers-promises.js +2 -2
  134. package/dist/node/url.js +2 -2
  135. package/dist/node/util.js +2 -2
  136. package/dist/objects/getters.js +2 -2
  137. package/dist/objects/inspect.js +3 -3
  138. package/dist/objects/mutate.js +1 -1
  139. package/dist/objects/predicates.js +4 -4
  140. package/dist/objects/sort.js +4 -4
  141. package/dist/packages/edit-class.js +1 -1
  142. package/dist/packages/edit.js +2 -2
  143. package/dist/packages/exports.js +6 -6
  144. package/dist/packages/licenses.js +8 -8
  145. package/dist/packages/manifest.js +3 -3
  146. package/dist/packages/normalize.js +4 -4
  147. package/dist/packages/operations.js +11 -11
  148. package/dist/packages/provenance.d.ts +6 -0
  149. package/dist/packages/provenance.js +12 -3
  150. package/dist/packages/specs.js +5 -5
  151. package/dist/packages/validation.js +3 -3
  152. package/dist/paths/_internal.js +3 -3
  153. package/dist/paths/conversion.js +4 -4
  154. package/dist/paths/normalize.js +3 -1
  155. package/dist/paths/packages.js +3 -3
  156. package/dist/paths/predicates.js +7 -7
  157. package/dist/paths/resolve.js +3 -3
  158. package/dist/process/spawn/_internal.js +3 -3
  159. package/dist/process/spawn/errors.js +2 -2
  160. package/dist/process/spawn/stdio.js +1 -1
  161. package/dist/promises/_internal.js +1 -1
  162. package/dist/promises/iterate.js +5 -5
  163. package/dist/promises/options.js +3 -3
  164. package/dist/promises/retry.js +1 -1
  165. package/dist/secrets/_internal.js +3 -2
  166. package/dist/secrets/keychain.js +5 -4
  167. package/dist/secrets/linux.js +6 -4
  168. package/dist/secrets/macos.js +5 -3
  169. package/dist/secrets/rc.js +9 -6
  170. package/dist/secrets/windows.js +7 -4
  171. package/dist/shell/parse.d.ts +108 -1
  172. package/dist/shell/parse.js +168 -2
  173. package/dist/smol/detect.js +1 -1
  174. package/dist/smol/http.js +1 -1
  175. package/dist/smol/https.js +1 -1
  176. package/dist/smol/manifest.js +1 -1
  177. package/dist/smol/path.js +1 -1
  178. package/dist/smol/primordial.js +1 -1
  179. package/dist/smol/purl.js +1 -1
  180. package/dist/smol/versions.js +1 -1
  181. package/dist/smol/vfs.js +1 -1
  182. package/dist/sorts/_internal.js +4 -4
  183. package/dist/sorts/natural.js +3 -3
  184. package/dist/sorts/semver.js +1 -1
  185. package/dist/sorts/strings.js +1 -1
  186. package/dist/spinner/default.js +1 -1
  187. package/dist/spinner/spinner.js +1 -1
  188. package/dist/ssri/convert.js +2 -2
  189. package/dist/ssri/parse.js +1 -1
  190. package/dist/ssri/validate.js +2 -2
  191. package/dist/stdio/prompts.js +1 -1
  192. package/dist/streams/parallel.js +2 -2
  193. package/dist/streams/transform.js +1 -1
  194. package/dist/strings/format.js +4 -4
  195. package/dist/strings/predicates.js +2 -2
  196. package/dist/strings/search.js +1 -1
  197. package/dist/strings/transform.js +3 -3
  198. package/dist/strings/width.js +2 -2
  199. package/dist/temporal/instant.js +4 -2
  200. package/dist/temporal/slots.js +3 -2
  201. package/dist/themes/context.js +2 -2
  202. package/dist/url/parse.js +2 -2
  203. package/dist/url/predicates.js +1 -1
  204. package/dist/url/search-params.js +6 -6
  205. package/dist/words/article.js +1 -1
  206. package/dist/words/capitalize.js +1 -1
  207. package/dist/words/pluralize.d.ts +24 -2
  208. package/dist/words/pluralize.js +37 -2
  209. package/dist/words/types.d.ts +25 -2
  210. package/package.json +44 -4
@@ -14,7 +14,7 @@ const require_events_exit__internal = require('./_internal.js');
14
14
  */
15
15
  /* c8 ignore start - processEmit + processReallyExit interceptors
16
16
  only fire on real process exit/emit; can't be triggered in-test. */
17
- /* @__NO_SIDE_EFFECTS__ */
17
+ /*@__NO_SIDE_EFFECTS__*/
18
18
  function processEmit(eventName, exitCode, ...args) {
19
19
  if (eventName === "exit") {
20
20
  let actualExitCode = exitCode;
@@ -38,7 +38,7 @@ function processEmit(eventName, exitCode, ...args) {
38
38
  ...args
39
39
  ]);
40
40
  }
41
- /* @__NO_SIDE_EFFECTS__ */
41
+ /*@__NO_SIDE_EFFECTS__*/
42
42
  function processReallyExit(code) {
43
43
  const exitCode = code || 0;
44
44
  if (require_events_exit__internal.globalProcess) require_events_exit__internal.globalProcess.exitCode = exitCode;
@@ -12,7 +12,7 @@ const require_events_exit_intercept = require('./intercept.js');
12
12
  * cycle.
13
13
  */
14
14
  let _sigListeners;
15
- /* @__NO_SIDE_EFFECTS__ */
15
+ /*@__NO_SIDE_EFFECTS__*/
16
16
  function getSignalListeners() {
17
17
  if (_sigListeners === void 0) {
18
18
  _sigListeners = { __proto__: null };
@@ -41,7 +41,7 @@ function getSignalListeners() {
41
41
  * // Signal handlers are now active
42
42
  * ```
43
43
  */
44
- /* @__NO_SIDE_EFFECTS__ */
44
+ /*@__NO_SIDE_EFFECTS__*/
45
45
  function load() {
46
46
  /* c8 ignore next - !globalProcess never fires in Node tests. */
47
47
  if (require_events_exit__internal.isLoaded() || !require_events_exit__internal.globalProcess) return;
@@ -73,7 +73,7 @@ function load() {
73
73
  * // Signal handlers are now removed
74
74
  * ```
75
75
  */
76
- /* @__NO_SIDE_EFFECTS__ */
76
+ /*@__NO_SIDE_EFFECTS__*/
77
77
  function unload() {
78
78
  /* c8 ignore start */
79
79
  if (!require_events_exit__internal.isLoaded() || !require_events_exit__internal.globalProcess) return;
@@ -19,7 +19,7 @@ const require_events_exit__internal = require('./_internal.js');
19
19
  * console.log(sigs) // ['SIGABRT', 'SIGALRM', 'SIGHUP', ...]
20
20
  * ```
21
21
  */
22
- /* @__NO_SIDE_EFFECTS__ */
22
+ /*@__NO_SIDE_EFFECTS__*/
23
23
  function signals() {
24
24
  return /* @__PURE__ */ require_events_exit__internal.getSignals();
25
25
  }
@@ -4071,7 +4071,11 @@ var require_extends_check = /* @__PURE__ */ __commonJSMin(((exports) => {
4071
4071
  return Visit(left, right) === ExtendsResult.False ? ExtendsResult.False : index_10.TypeGuard.IsOptional(left) && !index_10.TypeGuard.IsOptional(right) ? ExtendsResult.False : ExtendsResult.True;
4072
4072
  }
4073
4073
  function FromObjectRight(left, right) {
4074
- return index_10.TypeGuard.IsUnknown(left) ? ExtendsResult.False : index_10.TypeGuard.IsAny(left) ? ExtendsResult.Union : index_10.TypeGuard.IsNever(left) || index_10.TypeGuard.IsLiteralString(left) && IsObjectStringLike(right) || index_10.TypeGuard.IsLiteralNumber(left) && IsObjectNumberLike(right) || index_10.TypeGuard.IsLiteralBoolean(left) && IsObjectBooleanLike(right) || index_10.TypeGuard.IsSymbol(left) && IsObjectSymbolLike(right) || index_10.TypeGuard.IsBigInt(left) && IsObjectBigIntLike(right) || index_10.TypeGuard.IsString(left) && IsObjectStringLike(right) || index_10.TypeGuard.IsSymbol(left) && IsObjectSymbolLike(right) || index_10.TypeGuard.IsNumber(left) && IsObjectNumberLike(right) || index_10.TypeGuard.IsInteger(left) && IsObjectNumberLike(right) || index_10.TypeGuard.IsBoolean(left) && IsObjectBooleanLike(right) || index_10.TypeGuard.IsUint8Array(left) && IsObjectUint8ArrayLike(right) || index_10.TypeGuard.IsDate(left) && IsObjectDateLike(right) || index_10.TypeGuard.IsConstructor(left) && IsObjectConstructorLike(right) || index_10.TypeGuard.IsFunction(left) && IsObjectFunctionLike(right) ? ExtendsResult.True : index_10.TypeGuard.IsRecord(left) && index_10.TypeGuard.IsString(RecordKey(left)) ? right[index_8.Hint] === "Record" ? ExtendsResult.True : ExtendsResult.False : index_10.TypeGuard.IsRecord(left) && index_10.TypeGuard.IsNumber(RecordKey(left)) ? IsObjectPropertyCount(right, 0) ? ExtendsResult.True : ExtendsResult.False : ExtendsResult.False;
4074
+ return index_10.TypeGuard.IsUnknown(left) ? ExtendsResult.False : index_10.TypeGuard.IsAny(left) ? ExtendsResult.Union : index_10.TypeGuard.IsNever(left) || index_10.TypeGuard.IsLiteralString(left) && IsObjectStringLike(right) || index_10.TypeGuard.IsLiteralNumber(left) && IsObjectNumberLike(right) || index_10.TypeGuard.IsLiteralBoolean(left) && IsObjectBooleanLike(right) || index_10.TypeGuard.IsSymbol(left) && IsObjectSymbolLike(right) || index_10.TypeGuard.IsBigInt(left) && IsObjectBigIntLike(right) || index_10.TypeGuard.IsString(left) && IsObjectStringLike(right) || index_10.TypeGuard.IsSymbol(left) && IsObjectSymbolLike(right) || index_10.TypeGuard.IsNumber(left) && IsObjectNumberLike(right) || index_10.TypeGuard.IsInteger(left) && IsObjectNumberLike(right) || index_10.TypeGuard.IsBoolean(left) && IsObjectBooleanLike(right) || index_10.TypeGuard.IsUint8Array(left) && IsObjectUint8ArrayLike(right) || index_10.TypeGuard.IsDate(left) && IsObjectDateLike(right) || index_10.TypeGuard.IsConstructor(left) && IsObjectConstructorLike(right) || index_10.TypeGuard.IsFunction(left) && IsObjectFunctionLike(right) ? ExtendsResult.True : index_10.TypeGuard.IsRecord(left) && index_10.TypeGuard.IsString(RecordKey(left)) ? (() => {
4075
+ return right[index_8.Hint] === "Record" ? ExtendsResult.True : ExtendsResult.False;
4076
+ })() : index_10.TypeGuard.IsRecord(left) && index_10.TypeGuard.IsNumber(RecordKey(left)) ? (() => {
4077
+ return IsObjectPropertyCount(right, 0) ? ExtendsResult.True : ExtendsResult.False;
4078
+ })() : ExtendsResult.False;
4075
4079
  }
4076
4080
  function FromObject(left, right) {
4077
4081
  return IsStructuralRight(right) ? StructuralRight(left, right) : index_10.TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : !index_10.TypeGuard.IsObject(right) ? ExtendsResult.False : (() => {
@@ -4284,7 +4284,11 @@ var require_extends_check = /* @__PURE__ */ __commonJSMin(((exports) => {
4284
4284
  return Visit(left, right) === ExtendsResult.False ? ExtendsResult.False : index_10.TypeGuard.IsOptional(left) && !index_10.TypeGuard.IsOptional(right) ? ExtendsResult.False : ExtendsResult.True;
4285
4285
  }
4286
4286
  function FromObjectRight(left, right) {
4287
- return index_10.TypeGuard.IsUnknown(left) ? ExtendsResult.False : index_10.TypeGuard.IsAny(left) ? ExtendsResult.Union : index_10.TypeGuard.IsNever(left) || index_10.TypeGuard.IsLiteralString(left) && IsObjectStringLike(right) || index_10.TypeGuard.IsLiteralNumber(left) && IsObjectNumberLike(right) || index_10.TypeGuard.IsLiteralBoolean(left) && IsObjectBooleanLike(right) || index_10.TypeGuard.IsSymbol(left) && IsObjectSymbolLike(right) || index_10.TypeGuard.IsBigInt(left) && IsObjectBigIntLike(right) || index_10.TypeGuard.IsString(left) && IsObjectStringLike(right) || index_10.TypeGuard.IsSymbol(left) && IsObjectSymbolLike(right) || index_10.TypeGuard.IsNumber(left) && IsObjectNumberLike(right) || index_10.TypeGuard.IsInteger(left) && IsObjectNumberLike(right) || index_10.TypeGuard.IsBoolean(left) && IsObjectBooleanLike(right) || index_10.TypeGuard.IsUint8Array(left) && IsObjectUint8ArrayLike(right) || index_10.TypeGuard.IsDate(left) && IsObjectDateLike(right) || index_10.TypeGuard.IsConstructor(left) && IsObjectConstructorLike(right) || index_10.TypeGuard.IsFunction(left) && IsObjectFunctionLike(right) ? ExtendsResult.True : index_10.TypeGuard.IsRecord(left) && index_10.TypeGuard.IsString(RecordKey(left)) ? right[index_8.Hint] === "Record" ? ExtendsResult.True : ExtendsResult.False : index_10.TypeGuard.IsRecord(left) && index_10.TypeGuard.IsNumber(RecordKey(left)) ? IsObjectPropertyCount(right, 0) ? ExtendsResult.True : ExtendsResult.False : ExtendsResult.False;
4287
+ return index_10.TypeGuard.IsUnknown(left) ? ExtendsResult.False : index_10.TypeGuard.IsAny(left) ? ExtendsResult.Union : index_10.TypeGuard.IsNever(left) || index_10.TypeGuard.IsLiteralString(left) && IsObjectStringLike(right) || index_10.TypeGuard.IsLiteralNumber(left) && IsObjectNumberLike(right) || index_10.TypeGuard.IsLiteralBoolean(left) && IsObjectBooleanLike(right) || index_10.TypeGuard.IsSymbol(left) && IsObjectSymbolLike(right) || index_10.TypeGuard.IsBigInt(left) && IsObjectBigIntLike(right) || index_10.TypeGuard.IsString(left) && IsObjectStringLike(right) || index_10.TypeGuard.IsSymbol(left) && IsObjectSymbolLike(right) || index_10.TypeGuard.IsNumber(left) && IsObjectNumberLike(right) || index_10.TypeGuard.IsInteger(left) && IsObjectNumberLike(right) || index_10.TypeGuard.IsBoolean(left) && IsObjectBooleanLike(right) || index_10.TypeGuard.IsUint8Array(left) && IsObjectUint8ArrayLike(right) || index_10.TypeGuard.IsDate(left) && IsObjectDateLike(right) || index_10.TypeGuard.IsConstructor(left) && IsObjectConstructorLike(right) || index_10.TypeGuard.IsFunction(left) && IsObjectFunctionLike(right) ? ExtendsResult.True : index_10.TypeGuard.IsRecord(left) && index_10.TypeGuard.IsString(RecordKey(left)) ? (() => {
4288
+ return right[index_8.Hint] === "Record" ? ExtendsResult.True : ExtendsResult.False;
4289
+ })() : index_10.TypeGuard.IsRecord(left) && index_10.TypeGuard.IsNumber(RecordKey(left)) ? (() => {
4290
+ return IsObjectPropertyCount(right, 0) ? ExtendsResult.True : ExtendsResult.False;
4291
+ })() : ExtendsResult.False;
4288
4292
  }
4289
4293
  function FromObject(left, right) {
4290
4294
  return IsStructuralRight(right) ? StructuralRight(left, right) : index_10.TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : !index_10.TypeGuard.IsObject(right) ? ExtendsResult.False : (() => {
@@ -6113,6 +6113,33 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6113
6113
  return `vers:${this.scheme}/${ArrayPrototypeJoin(parts, "|")}`;
6114
6114
  }
6115
6115
  };
6116
+ 0 && (module.exports = {
6117
+ Err,
6118
+ Ok,
6119
+ PURL_Type,
6120
+ PackageURL,
6121
+ PurlBuilder,
6122
+ PurlComponent,
6123
+ PurlError,
6124
+ PurlInjectionError,
6125
+ PurlQualifierNames,
6126
+ PurlType,
6127
+ ResultUtils,
6128
+ UrlConverter,
6129
+ Vers,
6130
+ compare,
6131
+ containsInjectionCharacters,
6132
+ createMatcher,
6133
+ equals,
6134
+ err,
6135
+ findInjectionCharCode,
6136
+ formatInjectionChar,
6137
+ matches,
6138
+ ok,
6139
+ parseNpmSpecifier,
6140
+ stringify,
6141
+ stringifySpec
6142
+ });
6116
6143
  }));
6117
6144
  /*!
6118
6145
  Copyright (c) the purl authors
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_primordials_map_set = require('../../primordials/map-set.js');
4
5
  const require_external_tools_bazel_from_download = require('./from-download.js');
5
6
  const require_external_tools_bazel_from_path = require('./from-path.js');
6
7
 
@@ -21,7 +22,7 @@ const require_external_tools_bazel_from_path = require('./from-path.js');
21
22
  * `downloadIfMissing` produces two distinct cache entries so the second
22
23
  * call can fall through to the download tier.
23
24
  */
24
- const resolutionCache = /* @__PURE__ */ new Map();
25
+ const resolutionCache = new require_primordials_map_set.MapCtor();
25
26
  function cacheKey(opts) {
26
27
  if (!opts?.downloadIfMissing) return "local-only";
27
28
  const { integrity, platformArch, version } = opts.downloadIfMissing;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_primordials_map_set = require('../../primordials/map-set.js');
4
5
  const require_external_tools_cdxgen_from_download = require('./from-download.js');
5
6
  const require_external_tools_cdxgen_from_path = require('./from-path.js');
6
7
  const require_external_tools_cdxgen_from_vfs = require('./from-vfs.js');
@@ -20,7 +21,7 @@ const require_external_tools_cdxgen_from_vfs = require('./from-vfs.js');
20
21
  * `undefined` if all of the enabled sources miss. Memoized per
21
22
  * option-shape.
22
23
  */
23
- const resolutionCache = /* @__PURE__ */ new Map();
24
+ const resolutionCache = new require_primordials_map_set.MapCtor();
24
25
  function cacheKey(opts) {
25
26
  if (!opts?.downloadIfMissing) return "local-only";
26
27
  const { cacheDir, integrity, platformArch, variant, version } = opts.downloadIfMissing;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @file Generic "venv-install tier" for external-tools resolvers. Parallel to
3
+ * `from-download.ts` — that one handles single-binary tools downloaded as
4
+ * GitHub release assets; this one handles Python packages installed into a
5
+ * single-purpose venv. Per-tool resolvers (skillspector, future Python CLIs)
6
+ * compose their fourth tier on top of these helpers. Two helpers:
7
+ *
8
+ * - `createPipVenv` — `python -m venv <cacheDir>` + `pip install <spec>`.
9
+ * Idempotent: hits the existing venv when its entry-point already exists.
10
+ * Stops at "venv created, entry-point present."
11
+ * - `findPython` — locates `python3` (or `python` on Windows) on PATH. Returns
12
+ * the absolute path or `undefined` when no Python is available. What this
13
+ * does NOT do:
14
+ * - Decide where the venv lives. The caller picks the cache dir (typically
15
+ * under `getSocketDlxDir()`); we just create the venv there.
16
+ * - Verify package integrity beyond pip's own wheel-hash mechanism. Pinning is
17
+ * the caller's responsibility: pass exact-version `<pkg>==<ver>` or git-SHA
18
+ * `git+...@<sha>`.
19
+ * - Re-resolve when the cache is stale. The cache key is derived by the caller
20
+ * from the install spec; a re-pin produces a new dir.
21
+ */
22
+ export interface CreatePipVenvOptions {
23
+ /**
24
+ * Absolute path to the venv directory. Created if missing; reused if the
25
+ * entry-point already exists inside it.
26
+ */
27
+ readonly cacheDir: string;
28
+ /**
29
+ * Name of the entry-point executable. Matches the package's
30
+ * `[project.scripts]` key (or the package name when it's the same).
31
+ */
32
+ readonly entryPoint: string;
33
+ /**
34
+ * Pip-install argument — either `<pkg>==<version>` (PyPI exact pin) or
35
+ * `git+<https-url>@<sha>` (git-SHA pin). Anything else is rejected.
36
+ */
37
+ readonly installSpec: string;
38
+ /**
39
+ * Optional override for the Python interpreter. Defaults to
40
+ * {@link findPython}.
41
+ */
42
+ readonly python?: string | undefined;
43
+ }
44
+ export interface CreatePipVenvResult {
45
+ /**
46
+ * Absolute path to the entry-point binary inside the venv. Always set when
47
+ * `created` or the cache was already populated.
48
+ */
49
+ readonly entryPointPath: string;
50
+ /**
51
+ * `true` when this call created the venv (and ran pip install); `false` when
52
+ * the existing cache was reused.
53
+ */
54
+ readonly created: boolean;
55
+ }
56
+ /**
57
+ * Create (or reuse) a venv at `cacheDir` and pip-install `installSpec` into it.
58
+ * Returns the entry-point path + a `created` flag. Throws when:
59
+ *
60
+ * - No Python interpreter is on PATH (and none was passed via `python`).
61
+ * - `python -m venv` fails.
62
+ * - `pip install` fails.
63
+ * - The install succeeded but the entry-point was not created (caller passed a
64
+ * wrong `entryPoint` name, or the package has no console script).
65
+ */
66
+ export declare function createPipVenv(opts: CreatePipVenvOptions): Promise<CreatePipVenvResult>;
67
+ /**
68
+ * Locate a Python interpreter. Prefer `python3` on macOS/Linux, fall back to
69
+ * `python` (the Windows convention). Returns `undefined` when neither is on
70
+ * PATH.
71
+ */
72
+ export declare function findPython(): Promise<string | undefined>;
73
+ export declare function pipVenvEntryPointPath(venvDir: string, entryPoint: string): string;
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ /* Socket Lib - Built with rolldown */
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_runtime = require('../_virtual/_rolldown/runtime.js');
5
+ const require_bin_which = require('../bin/which.js');
6
+ const require_process_spawn_child = require('../process/spawn/child.js');
7
+ const require_fs_safe = require('../fs/safe.js');
8
+ let node_fs = require("node:fs");
9
+ let node_path = require("node:path");
10
+ node_path = require_runtime.__toESM(node_path);
11
+ let node_process = require("node:process");
12
+ node_process = require_runtime.__toESM(node_process);
13
+
14
+ //#region src/external-tools/from-pip-venv.ts
15
+ /**
16
+ * @file Generic "venv-install tier" for external-tools resolvers. Parallel to
17
+ * `from-download.ts` — that one handles single-binary tools downloaded as
18
+ * GitHub release assets; this one handles Python packages installed into a
19
+ * single-purpose venv. Per-tool resolvers (skillspector, future Python CLIs)
20
+ * compose their fourth tier on top of these helpers. Two helpers:
21
+ *
22
+ * - `createPipVenv` — `python -m venv <cacheDir>` + `pip install <spec>`.
23
+ * Idempotent: hits the existing venv when its entry-point already exists.
24
+ * Stops at "venv created, entry-point present."
25
+ * - `findPython` — locates `python3` (or `python` on Windows) on PATH. Returns
26
+ * the absolute path or `undefined` when no Python is available. What this
27
+ * does NOT do:
28
+ * - Decide where the venv lives. The caller picks the cache dir (typically
29
+ * under `getSocketDlxDir()`); we just create the venv there.
30
+ * - Verify package integrity beyond pip's own wheel-hash mechanism. Pinning is
31
+ * the caller's responsibility: pass exact-version `<pkg>==<ver>` or git-SHA
32
+ * `git+...@<sha>`.
33
+ * - Re-resolve when the cache is stale. The cache key is derived by the caller
34
+ * from the install spec; a re-pin produces a new dir.
35
+ */
36
+ /**
37
+ * Create (or reuse) a venv at `cacheDir` and pip-install `installSpec` into it.
38
+ * Returns the entry-point path + a `created` flag. Throws when:
39
+ *
40
+ * - No Python interpreter is on PATH (and none was passed via `python`).
41
+ * - `python -m venv` fails.
42
+ * - `pip install` fails.
43
+ * - The install succeeded but the entry-point was not created (caller passed a
44
+ * wrong `entryPoint` name, or the package has no console script).
45
+ */
46
+ async function createPipVenv(opts) {
47
+ const { cacheDir, entryPoint, installSpec } = opts;
48
+ const entryBin = pipVenvEntryPointPath(cacheDir, entryPoint);
49
+ if ((0, node_fs.existsSync)(entryBin)) return {
50
+ entryPointPath: entryBin,
51
+ created: false
52
+ };
53
+ const python = opts.python ?? await findPython();
54
+ if (!python) throw new Error("createPipVenv: no Python interpreter on PATH (looked for python3, python)");
55
+ await require_fs_safe.safeMkdir(node_path.default.dirname(cacheDir), { recursive: true });
56
+ await require_process_spawn_child.spawn(python, [
57
+ "-m",
58
+ "venv",
59
+ "--clear",
60
+ cacheDir
61
+ ], { stdio: "pipe" });
62
+ const venvPython = pipVenvEntryPointPath(cacheDir, "python");
63
+ if (!(0, node_fs.existsSync)(venvPython)) throw new Error(`createPipVenv: venv created at ${cacheDir} but ${venvPython} is missing`);
64
+ await require_process_spawn_child.spawn(venvPython, [
65
+ "-m",
66
+ "pip",
67
+ "install",
68
+ "--no-input",
69
+ "--disable-pip-version-check",
70
+ installSpec
71
+ ], { stdio: "pipe" });
72
+ if (!(0, node_fs.existsSync)(entryBin)) throw new Error(`createPipVenv: pip install ${installSpec} succeeded but entry-point ${entryPoint} was not created at ${entryBin}`);
73
+ return {
74
+ entryPointPath: entryBin,
75
+ created: true
76
+ };
77
+ }
78
+ /**
79
+ * Locate a Python interpreter. Prefer `python3` on macOS/Linux, fall back to
80
+ * `python` (the Windows convention). Returns `undefined` when neither is on
81
+ * PATH.
82
+ */
83
+ async function findPython() {
84
+ const candidates = node_process.default.platform === "win32" ? ["python", "python3"] : ["python3", "python"];
85
+ for (let i = 0, { length } = candidates; i < length; i += 1) {
86
+ const found = await require_bin_which.which(candidates[i], { nothrow: true });
87
+ if (typeof found === "string") return found;
88
+ }
89
+ }
90
+ function pipVenvEntryPointPath(venvDir, entryPoint) {
91
+ if (node_process.default.platform === "win32") return node_path.default.join(venvDir, "Scripts", `${entryPoint}.exe`);
92
+ return node_path.default.join(venvDir, "bin", entryPoint);
93
+ }
94
+
95
+ //#endregion
96
+ exports.createPipVenv = createPipVenv;
97
+ exports.findPython = findPython;
98
+ exports.pipVenvEntryPointPath = pipVenvEntryPointPath;
@@ -26,7 +26,7 @@ const JANUS_ASSET_MAP = require_primordials_object.ObjectFreeze({
26
26
  * supported set. Use this from `from-download.ts` to throw a helpful error
27
27
  * rather than letting the URL builder silently return undefined.
28
28
  */
29
- const JANUS_SUPPORTED_PLATFORM_ARCHES = require_primordials_object.ObjectFreeze(Object.keys(JANUS_ASSET_MAP));
29
+ const JANUS_SUPPORTED_PLATFORM_ARCHES = require_primordials_object.ObjectFreeze(require_primordials_object.ObjectKeys(JANUS_ASSET_MAP));
30
30
  function getJanusAssetEntry(platformArch) {
31
31
  return JANUS_ASSET_MAP[platformArch];
32
32
  }
@@ -2,6 +2,7 @@
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_runtime = require('../../_virtual/_rolldown/runtime.js');
5
+ const require_primordials_error = require('../../primordials/error.js');
5
6
  const require_paths_socket = require('../../paths/socket.js');
6
7
  const require_external_tools_from_download = require('../from-download.js');
7
8
  const require_external_tools_janus_asset_names = require('./asset-names.js');
@@ -20,15 +21,12 @@ node_path = require_runtime.__toESM(node_path);
20
21
  */
21
22
  async function janusFromDownload(opts) {
22
23
  const { cacheDir, downloader, integrity, platformArch, version } = opts;
23
- if (!require_external_tools_janus_asset_names.JANUS_SUPPORTED_PLATFORM_ARCHES.includes(platformArch)) {
24
- const supported = require_external_tools_janus_asset_names.JANUS_SUPPORTED_PLATFORM_ARCHES.map((p) => `\`${p}\``).join(", ");
25
- throw new Error(`janusFromDownload: platformArch must be one of [${supported}], got \`${platformArch}\`. Upstream janus only publishes the macOS arm64 build (see https://github.com/divmain/janus/releases); request \`darwin-arm64\` or use a different tool for other platforms.`);
26
- }
24
+ if (!require_external_tools_janus_asset_names.JANUS_SUPPORTED_PLATFORM_ARCHES.includes(platformArch)) throw new require_primordials_error.ErrorCtor(`janusFromDownload: platformArch must be one of [${require_external_tools_janus_asset_names.JANUS_SUPPORTED_PLATFORM_ARCHES.map((p) => `\`${p}\``).join(", ")}], got \`${platformArch}\`. Upstream janus only publishes the macOS arm64 build (see https://github.com/divmain/janus/releases); request \`darwin-arm64\` or use a different tool for other platforms.`);
27
25
  const url = require_external_tools_janus_asset_names.getJanusDownloadUrl({
28
26
  version,
29
27
  platformArch
30
28
  });
31
- if (!url) throw new Error(`janusFromDownload: no upstream asset for janus@${version} on \`${platformArch}\`. The platform is in the supported set but the version may be missing; check https://github.com/divmain/janus/releases/tag/v${version}.`);
29
+ if (!url) throw new require_primordials_error.ErrorCtor(`janusFromDownload: no upstream asset for janus@${version} on \`${platformArch}\`. The platform is in the supported set but the version may be missing; check https://github.com/divmain/janus/releases/tag/v${version}.`);
32
30
  const extractedDir = cacheDir ?? node_path.default.join(require_paths_socket.getSocketWheelhouseDir(), "janus", version, platformArch);
33
31
  const archive = await require_external_tools_from_download.downloadAndExtractTool({
34
32
  url,
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_primordials_map_set = require('../../primordials/map-set.js');
4
5
  const require_external_tools_janus_from_download = require('./from-download.js');
5
6
  const require_external_tools_janus_from_path = require('./from-path.js');
6
7
  const require_external_tools_janus_from_vfs = require('./from-vfs.js');
@@ -18,7 +19,7 @@ const require_external_tools_janus_from_vfs = require('./from-vfs.js');
18
19
  * platform-arch isn't shipped by upstream janus (currently darwin-arm64
19
20
  * only). Memoized per option-shape.
20
21
  */
21
- const resolutionCache = /* @__PURE__ */ new Map();
22
+ const resolutionCache = new require_primordials_map_set.MapCtor();
22
23
  function cacheKey(opts) {
23
24
  if (!opts?.downloadIfMissing) return "local-only";
24
25
  const { cacheDir, integrity, platformArch, version } = opts.downloadIfMissing;
@@ -2,6 +2,7 @@
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_runtime = require('../../_virtual/_rolldown/runtime.js');
5
+ const require_primordials_string = require('../../primordials/string.js');
5
6
  const require_paths_socket = require('../../paths/socket.js');
6
7
  const require_external_tools_from_download = require('../from-download.js');
7
8
  const require_external_tools_jre_asset_names = require('./asset-names.js');
@@ -53,7 +54,7 @@ async function jreFromDownload(opts) {
53
54
  const extractedDir = cacheDir ?? node_path.default.join(require_paths_socket.getSocketDlxDir(), "jre", String(version), platformArch);
54
55
  const archive = await require_external_tools_from_download.downloadAndExtractTool({
55
56
  url,
56
- name: `adoptium-jre-${version}-${platformArch}${platformArch.startsWith("win-") ? ".zip" : ".tar.gz"}`,
57
+ name: `adoptium-jre-${version}-${platformArch}${require_primordials_string.StringPrototypeStartsWith(platformArch, "win-") ? ".zip" : ".tar.gz"}`,
57
58
  integrity,
58
59
  extractedDir,
59
60
  extractOptions: { strip: 1 },
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_primordials_map_set = require('../../primordials/map-set.js');
4
5
  const require_external_tools_jre_from_download = require('./from-download.js');
5
6
  const require_external_tools_jre_from_java_home = require('./from-java-home.js');
6
7
  const require_external_tools_jre_from_path = require('./from-path.js');
@@ -26,7 +27,7 @@ const require_external_tools_jre_from_vfs = require('./from-vfs.js');
26
27
  * `resetJreResolution()` clears the cache so tests can exercise the
27
28
  * resolver fresh.
28
29
  */
29
- const resolutionCache = /* @__PURE__ */ new Map();
30
+ const resolutionCache = new require_primordials_map_set.MapCtor();
30
31
  function cacheKey(opts) {
31
32
  if (!opts?.downloadIfMissing) return "local-only";
32
33
  const { cacheDir, integrity, platformArch, version } = opts.downloadIfMissing;
@@ -2,8 +2,10 @@
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_primordials_error = require('../primordials/error.js');
5
+ const require_primordials_string = require('../primordials/string.js');
5
6
  const require_integrity = require('../integrity.js');
6
7
  const require_primordials_array = require('../primordials/array.js');
8
+ const require_primordials_object = require('../primordials/object.js');
7
9
  const require_fs_read_json = require('../fs/read-json.js');
8
10
 
9
11
  //#region src/external-tools/manifest.ts
@@ -59,7 +61,7 @@ function parseChecksum(raw, toolName, platformKey) {
59
61
  function parseChecksums(raw, toolName) {
60
62
  if (!isObject(raw)) throw new require_primordials_error.ErrorCtor(`external-tools.json: tool '${toolName}' is missing a 'checksums' object`);
61
63
  const out = {};
62
- for (const platformKey of Object.keys(raw)) out[platformKey] = parseChecksum(raw[platformKey], toolName, platformKey);
64
+ for (const platformKey of require_primordials_object.ObjectKeys(raw)) out[platformKey] = parseChecksum(raw[platformKey], toolName, platformKey);
63
65
  return out;
64
66
  }
65
67
  function parseToolEntry(raw, toolName) {
@@ -106,15 +108,15 @@ async function readExternalToolsManifest(filepath) {
106
108
  const raw = await /* @__PURE__ */ require_fs_read_json.readJson(filepath);
107
109
  if (!isObject(raw)) throw new require_primordials_error.ErrorCtor(`external-tools.json: expected top-level object, got: ${typeof raw}`);
108
110
  const tools = {};
109
- for (const toolName of Object.keys(raw)) {
110
- if (toolName.startsWith("$")) continue;
111
+ for (const toolName of require_primordials_object.ObjectKeys(raw)) {
112
+ if (require_primordials_string.StringPrototypeStartsWith(toolName, "$")) continue;
111
113
  tools[toolName] = parseToolEntry(raw[toolName], toolName);
112
114
  }
113
115
  return { tools };
114
116
  }
115
117
  function tryParseFlavored(raw, toolName) {
116
118
  const flavors = {};
117
- for (const key of Object.keys(raw)) {
119
+ for (const key of require_primordials_object.ObjectKeys(raw)) {
118
120
  const value = raw[key];
119
121
  if (!isObject(value)) continue;
120
122
  const rf = value;
@@ -126,7 +128,7 @@ function tryParseFlavored(raw, toolName) {
126
128
  checksums: parseChecksums(rf.checksums, `${toolName}.${key}`)
127
129
  };
128
130
  }
129
- if (Object.keys(flavors).length === 0) return;
131
+ if (require_primordials_object.ObjectKeys(flavors).length === 0) return;
130
132
  return {
131
133
  description: String(raw["description"] ?? ""),
132
134
  version: String(raw["version"] ?? ""),
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_primordials_map_set = require('../../primordials/map-set.js');
4
5
  const require_external_tools_opengrep_from_download = require('./from-download.js');
5
6
  const require_external_tools_opengrep_from_path = require('./from-path.js');
6
7
  const require_external_tools_opengrep_from_vfs = require('./from-vfs.js');
@@ -16,7 +17,7 @@ const require_external_tools_opengrep_from_vfs = require('./from-vfs.js');
16
17
  * passed) Returns `undefined` if all of the enabled sources miss. Memoized
17
18
  * per option-shape.
18
19
  */
19
- const resolutionCache = /* @__PURE__ */ new Map();
20
+ const resolutionCache = new require_primordials_map_set.MapCtor();
20
21
  function cacheKey(opts) {
21
22
  if (!opts?.downloadIfMissing) return "local-only";
22
23
  const { cacheDir, integrity, platformArch, version } = opts.downloadIfMissing;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_primordials_map_set = require('../../primordials/map-set.js');
4
5
  const require_external_tools_sbt_from_download = require('./from-download.js');
5
6
  const require_external_tools_sbt_from_path = require('./from-path.js');
6
7
  const require_external_tools_sbt_from_vfs = require('./from-vfs.js');
@@ -18,7 +19,7 @@ const require_external_tools_sbt_from_vfs = require('./from-vfs.js');
18
19
  * download-sourced SBT is the `sbt` script, which finds its own JRE.
19
20
  * Memoized per option-shape.
20
21
  */
21
- const resolutionCache = /* @__PURE__ */ new Map();
22
+ const resolutionCache = new require_primordials_map_set.MapCtor();
22
23
  function cacheKey(opts) {
23
24
  if (!opts?.downloadIfMissing) return "local-only";
24
25
  const { cacheDir, integrity, version } = opts.downloadIfMissing;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @file `skillspectorFromDlx()` — DLX-venv tier of SkillSpector resolution.
3
+ * Creates a single-purpose venv under `~/.socket/_dlx/skillspector/<sha>/`
4
+ * and pip-installs the pinned git SHA. Returns `undefined` when:
5
+ *
6
+ * - No Python interpreter is on PATH (host lacks Python 3.12+).
7
+ * - The venv-create or pip-install command fails. Idempotent: hits the cached
8
+ * venv when its `skillspector` entry-point already exists.
9
+ */
10
+ import type { ResolvedSkillSpector } from './types';
11
+ export interface SkillSpectorFromDlxOptions {
12
+ /**
13
+ * Pinned upstream SHA. Combined with the canonical NVIDIA/skillspector repo
14
+ * URL to form the pip-install spec
15
+ * `git+https://github.com/NVIDIA/skillspector.git@<sha>`.
16
+ */
17
+ readonly sha: string;
18
+ /**
19
+ * Cache directory override. Defaults to `getSocketDlxDir() +
20
+ * 'skillspector/<sha>'`. Tests pass a tmpdir.
21
+ */
22
+ readonly cacheDir?: string | undefined;
23
+ }
24
+ export declare function skillspectorFromDlx(opts: SkillSpectorFromDlxOptions): Promise<ResolvedSkillSpector | undefined>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /* Socket Lib - Built with rolldown */
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_runtime = require('../../_virtual/_rolldown/runtime.js');
5
+ const require_paths_socket = require('../../paths/socket.js');
6
+ const require_external_tools_from_pip_venv = require('../from-pip-venv.js');
7
+ let node_path = require("node:path");
8
+ node_path = require_runtime.__toESM(node_path);
9
+
10
+ //#region src/external-tools/skillspector/from-dlx.ts
11
+ /**
12
+ * @file `skillspectorFromDlx()` — DLX-venv tier of SkillSpector resolution.
13
+ * Creates a single-purpose venv under `~/.socket/_dlx/skillspector/<sha>/`
14
+ * and pip-installs the pinned git SHA. Returns `undefined` when:
15
+ *
16
+ * - No Python interpreter is on PATH (host lacks Python 3.12+).
17
+ * - The venv-create or pip-install command fails. Idempotent: hits the cached
18
+ * venv when its `skillspector` entry-point already exists.
19
+ */
20
+ const UPSTREAM_REPO = "https://github.com/NVIDIA/skillspector.git";
21
+ async function skillspectorFromDlx(opts) {
22
+ const { sha } = opts;
23
+ if (!sha) return;
24
+ const cacheDir = opts.cacheDir ?? node_path.default.join(require_paths_socket.getSocketDlxDir(), "skillspector", sha);
25
+ const installSpec = `git+${UPSTREAM_REPO}@${sha}`;
26
+ try {
27
+ return {
28
+ path: (await require_external_tools_from_pip_venv.createPipVenv({
29
+ cacheDir,
30
+ entryPoint: "skillspector",
31
+ installSpec
32
+ })).entryPointPath,
33
+ source: "dlx"
34
+ };
35
+ } catch {
36
+ return;
37
+ }
38
+ }
39
+
40
+ //#endregion
41
+ exports.skillspectorFromDlx = skillspectorFromDlx;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @file `skillspectorFromPath()` — `which skillspector` lookup. Reports
3
+ * `source: 'pipx'` when the resolved path lives under a `pipx/venvs/`
4
+ * directory (the dev's `pipx install skillspector` path); reports `source:
5
+ * 'path'` otherwise (a one-off binary on PATH).
6
+ */
7
+ import type { ResolvedSkillSpector } from './types';
8
+ export declare function skillspectorFromPath(): Promise<ResolvedSkillSpector | undefined>;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /* Socket Lib - Built with rolldown */
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_runtime = require('../../_virtual/_rolldown/runtime.js');
5
+ const require_bin_which = require('../../bin/which.js');
6
+ let node_path = require("node:path");
7
+ node_path = require_runtime.__toESM(node_path);
8
+
9
+ //#region src/external-tools/skillspector/from-path.ts
10
+ /**
11
+ * @file `skillspectorFromPath()` — `which skillspector` lookup. Reports
12
+ * `source: 'pipx'` when the resolved path lives under a `pipx/venvs/`
13
+ * directory (the dev's `pipx install skillspector` path); reports `source:
14
+ * 'path'` otherwise (a one-off binary on PATH).
15
+ */
16
+ const PIPX_PATH_SEGMENT_RE = /pipx[/\\]venvs[/\\]/;
17
+ async function skillspectorFromPath() {
18
+ const resolved = await require_bin_which.which("skillspector", { nothrow: true });
19
+ if (typeof resolved !== "string") return;
20
+ const normalized = node_path.default.normalize(resolved);
21
+ if (PIPX_PATH_SEGMENT_RE.test(normalized)) return {
22
+ path: normalized,
23
+ source: "pipx"
24
+ };
25
+ return {
26
+ path: normalized,
27
+ source: "path"
28
+ };
29
+ }
30
+
31
+ //#endregion
32
+ exports.skillspectorFromPath = skillspectorFromPath;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @file `skillspectorFromVfs()` — extracts SkillSpector from the smol Node VFS
3
+ * if it's bundled. Returns `undefined` when the binary doesn't carry
4
+ * skillspector.
5
+ */
6
+ import type { ResolvedSkillSpector } from './types';
7
+ export declare const SKILLSPECTOR_VFS_KEY = "skillspector";
8
+ export declare function skillspectorFromVfs(): Promise<ResolvedSkillSpector | undefined>;