@socketsecurity/lib 6.0.8 → 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 (119) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/ai/route.d.mts +21 -8
  3. package/dist/ai/route.js +21 -6
  4. package/dist/ai/spawn.d.mts +32 -0
  5. package/dist/ai/spawn.js +91 -2
  6. package/dist/ai/types.d.mts +10 -0
  7. package/dist/bin/prim.cjs +18797 -13627
  8. package/dist/bin/resolve.js +1 -1
  9. package/dist/cache/ttl/store.js +1 -1
  10. package/dist/compression/brotli.js +1 -1
  11. package/dist/compression/gzip.js +1 -1
  12. package/dist/config/layers.d.ts +53 -0
  13. package/dist/config/layers.js +83 -0
  14. package/dist/constants/socket.js +1 -1
  15. package/dist/debug/caller-info.js +1 -1
  16. package/dist/dlx/binary-cache.js +1 -1
  17. package/dist/dlx/binary-resolution.js +1 -1
  18. package/dist/dlx/firewall.js +1 -1
  19. package/dist/dlx/lockfile.js +1 -1
  20. package/dist/eco/npm/npm/parse-lockfile.js +1 -1
  21. package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.js +1 -1
  22. package/dist/env/rewire.d.ts +5 -3
  23. package/dist/env/rewire.js +6 -7
  24. package/dist/env/xdg.d.ts +17 -0
  25. package/dist/env/xdg.js +21 -1
  26. package/dist/errors/stack.js +1 -2
  27. package/dist/external/@npmcli/package-json.js +3455 -4881
  28. package/dist/external/@yarnpkg/extensions.js +1 -1
  29. package/dist/external/external-pack.js +1 -1
  30. package/dist/external/npm-pack.js +29164 -31799
  31. package/dist/external/tar-fs.js +63 -16
  32. package/dist/external-tools/jre/detect-platform-arch.js +1 -1
  33. package/dist/external-tools/manifest.js +1 -1
  34. package/dist/external-tools/python/asset-names.js +1 -1
  35. package/dist/external-tools/python/uv-install.d.ts +89 -0
  36. package/dist/external-tools/python/uv-install.js +165 -0
  37. package/dist/external-tools/skillspector/from-uv.d.ts +30 -0
  38. package/dist/external-tools/skillspector/from-uv.js +56 -0
  39. package/dist/external-tools/skillspector/resolve.d.ts +18 -3
  40. package/dist/external-tools/skillspector/resolve.js +21 -8
  41. package/dist/external-tools/skillspector/types.d.ts +3 -1
  42. package/dist/external-tools/uv/asset-names.d.ts +36 -0
  43. package/dist/external-tools/uv/asset-names.js +73 -0
  44. package/dist/external-tools/uv/from-download.d.ts +17 -0
  45. package/dist/external-tools/uv/from-download.js +50 -0
  46. package/dist/external-tools/uv/from-path.d.ts +5 -0
  47. package/dist/external-tools/uv/from-path.js +22 -0
  48. package/dist/external-tools/uv/from-vfs.d.ts +7 -0
  49. package/dist/external-tools/uv/from-vfs.js +26 -0
  50. package/dist/external-tools/uv/resolve.d.ts +25 -0
  51. package/dist/external-tools/uv/resolve.js +61 -0
  52. package/dist/external-tools/uv/types.d.ts +24 -0
  53. package/dist/external-tools/uv/types.js +2 -0
  54. package/dist/fleet/repo-config.d.ts +53 -0
  55. package/dist/fleet/repo-config.js +79 -0
  56. package/dist/fs/allowed-dirs-cache.js +3 -5
  57. package/dist/fs/copy.d.ts +88 -0
  58. package/dist/fs/copy.js +89 -0
  59. package/dist/fs/safe.js +1 -1
  60. package/dist/git/_internal.js +2 -2
  61. package/dist/github/refs.js +10 -15
  62. package/dist/globs/_internal.js +1 -1
  63. package/dist/http-request/browser.js +1 -1
  64. package/dist/http-request/checksum-file.js +1 -1
  65. package/dist/http-request/headers.js +1 -1
  66. package/dist/integrity.d.ts +125 -78
  67. package/dist/integrity.js +168 -84
  68. package/dist/logger/colors.d.ts +1 -2
  69. package/dist/logger/colors.js +2 -2
  70. package/dist/logger/symbols-builder.js +7 -8
  71. package/dist/logger/symbols.js +8 -8
  72. package/dist/node/module.d.ts +73 -2
  73. package/dist/node/module.js +97 -12
  74. package/dist/objects/predicates.js +1 -1
  75. package/dist/packages/exports.js +2 -2
  76. package/dist/packages/isolation.js +1 -1
  77. package/dist/packages/manifest.d.ts +29 -0
  78. package/dist/packages/manifest.js +38 -2
  79. package/dist/packages/normalize.js +1 -1
  80. package/dist/packages/provenance.js +2 -2
  81. package/dist/packages/specs.js +1 -1
  82. package/dist/paths/_internal.d.ts +1 -7
  83. package/dist/paths/_internal.js +9 -15
  84. package/dist/paths/conversion.js +1 -1
  85. package/dist/paths/normalize.js +1 -1
  86. package/dist/paths/predicates.js +2 -1
  87. package/dist/paths/socket.d.ts +74 -23
  88. package/dist/paths/socket.js +97 -23
  89. package/dist/perf/metrics.js +1 -1
  90. package/dist/perf/report.js +1 -1
  91. package/dist/regexps/spec.js +1 -1
  92. package/dist/schema/validate.js +1 -1
  93. package/dist/secrets/broker.d.ts +35 -0
  94. package/dist/secrets/broker.js +72 -0
  95. package/dist/secrets/find.d.ts +6 -4
  96. package/dist/secrets/find.js +15 -1
  97. package/dist/secrets/rc.js +1 -1
  98. package/dist/smol/detect.js +1 -1
  99. package/dist/smol/http.js +1 -1
  100. package/dist/smol/https.js +1 -1
  101. package/dist/smol/manifest.js +1 -1
  102. package/dist/smol/path.js +1 -1
  103. package/dist/smol/primordial.js +1 -1
  104. package/dist/smol/purl.js +1 -1
  105. package/dist/smol/versions.js +1 -1
  106. package/dist/smol/vfs.js +1 -1
  107. package/dist/sorts/_internal.d.ts +1 -2
  108. package/dist/sorts/_internal.js +2 -6
  109. package/dist/sorts/semver.js +2 -2
  110. package/dist/spinner/create-spinner-class.js +1 -1
  111. package/dist/stdio/progress.js +1 -1
  112. package/dist/stdio/prompts.d.ts +0 -8
  113. package/dist/stdio/prompts.js +10 -23
  114. package/dist/strings/format.js +1 -1
  115. package/dist/strings/search.js +1 -1
  116. package/dist/themes/context.d.ts +5 -3
  117. package/dist/themes/context.js +5 -6
  118. package/llms.txt +750 -0
  119. package/package.json +79 -13
@@ -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_arrays_predicates = require('../arrays/predicates.js');
5
4
  const require_primordials_object = require('../primordials/object.js');
5
+ const require_arrays_predicates = require('../arrays/predicates.js');
6
6
 
7
7
  //#region src/objects/predicates.ts
8
8
  /**
@@ -2,11 +2,11 @@
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_arrays_predicates = require('../arrays/predicates.js');
6
5
  const require_primordials_object = require('../primordials/object.js');
6
+ const require_primordials_string = require('../primordials/string.js');
7
+ const require_arrays_predicates = require('../arrays/predicates.js');
7
8
  const require_objects_predicates = require('../objects/predicates.js');
8
9
  const require_primordials_map_set = require('../primordials/map-set.js');
9
- const require_primordials_string = require('../primordials/string.js');
10
10
  const require_primordials_array = require('../primordials/array.js');
11
11
  const require_constants_sentinels = require('../constants/sentinels.js');
12
12
 
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_runtime = require('../_virtual/_rolldown/runtime.js');
5
5
  const require_primordials_error = require('../primordials/error.js');
6
- const require_constants_platform = require('../constants/platform.js');
7
6
  const require_primordials_object = require('../primordials/object.js');
8
7
  const require_primordials_string = require('../primordials/string.js');
8
+ const require_constants_platform = require('../constants/platform.js');
9
9
  const require_paths_conversion = require('../paths/conversion.js');
10
10
  const require_paths_predicates = require('../paths/predicates.js');
11
11
  const require_node_fs = require('../node/fs.js');
@@ -32,3 +32,32 @@ export declare function fetchPackageManifest(pkgNameOrId: string, options?: Paco
32
32
  * ```
33
33
  */
34
34
  export declare function fetchPackagePackument(pkgNameOrId: string, options?: PacoteOptions): Promise<unknown>;
35
+ /**
36
+ * Dev/build-only top-level package.json fields not needed at runtime. The
37
+ * conservative default for {@link trimPublishManifest}; extend per-package via
38
+ * its `drop` option.
39
+ */
40
+ export declare const DEFAULT_TRIM_FIELDS: readonly string[];
41
+ export interface TrimPublishManifestOptions {
42
+ /**
43
+ * Top-level fields to omit (defaults to {@link DEFAULT_TRIM_FIELDS}).
44
+ */
45
+ readonly drop?: readonly string[] | undefined;
46
+ /**
47
+ * Fields to KEEP even when listed in `drop` (e.g. a runtime postinstall).
48
+ */
49
+ readonly keep?: readonly string[] | undefined;
50
+ }
51
+ /**
52
+ * Return a shallow copy of `manifest` that omits dev/build-only top-level
53
+ * fields so a published tarball + its npm metadata stay lean (npm caps total
54
+ * per-package metadata at 100 MB). The original object is left intact; persist
55
+ * the result only for the publish, never over the repo's own package.json.
56
+ *
57
+ * @example
58
+ * ;```typescript
59
+ * const lean = trimPublishManifest(pkg) // omits devDependencies + scripts
60
+ * const kept = trimPublishManifest(pkg, { keep: ['scripts'] })
61
+ * ```
62
+ */
63
+ export declare function trimPublishManifest(manifest: PackageJson, options?: TrimPublishManifestOptions | undefined): PackageJson;
@@ -2,8 +2,8 @@
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_arrays_predicates = require('../arrays/predicates.js');
6
5
  const require_primordials_object = require('../primordials/object.js');
6
+ const require_arrays_predicates = require('../arrays/predicates.js');
7
7
  const require_objects_predicates = require('../objects/predicates.js');
8
8
  const require_process_abort = require('../process/abort.js');
9
9
  const require_constants_socket = require('../constants/socket.js');
@@ -132,8 +132,44 @@ async function fetchPackagePackument(pkgNameOrId, options) {
132
132
  });
133
133
  } catch {}
134
134
  }
135
+ /**
136
+ * Dev/build-only top-level package.json fields not needed at runtime. The
137
+ * conservative default for {@link trimPublishManifest}; extend per-package via
138
+ * its `drop` option.
139
+ */
140
+ const DEFAULT_TRIM_FIELDS = ["devDependencies", "scripts"];
141
+ /**
142
+ * Return a shallow copy of `manifest` that omits dev/build-only top-level
143
+ * fields so a published tarball + its npm metadata stay lean (npm caps total
144
+ * per-package metadata at 100 MB). The original object is left intact; persist
145
+ * the result only for the publish, never over the repo's own package.json.
146
+ *
147
+ * @example
148
+ * ;```typescript
149
+ * const lean = trimPublishManifest(pkg) // omits devDependencies + scripts
150
+ * const kept = trimPublishManifest(pkg, { keep: ['scripts'] })
151
+ * ```
152
+ */
153
+ function trimPublishManifest(manifest, options) {
154
+ const opts = {
155
+ __proto__: null,
156
+ ...options
157
+ };
158
+ const drop = new Set(opts.drop ?? DEFAULT_TRIM_FIELDS);
159
+ const keep = new Set(opts.keep ?? []);
160
+ const source = manifest;
161
+ const keys = require_primordials_object.ObjectKeys(source);
162
+ const out = {};
163
+ for (let i = 0, { length } = keys; i < length; i += 1) {
164
+ const key = keys[i];
165
+ if (!drop.has(key) || keep.has(key)) out[key] = source[key];
166
+ }
167
+ return out;
168
+ }
135
169
 
136
170
  //#endregion
171
+ exports.DEFAULT_TRIM_FIELDS = DEFAULT_TRIM_FIELDS;
137
172
  exports.createPackageJson = createPackageJson;
138
173
  exports.fetchPackageManifest = fetchPackageManifest;
139
- exports.fetchPackagePackument = fetchPackagePackument;
174
+ exports.fetchPackagePackument = fetchPackagePackument;
175
+ exports.trimPublishManifest = trimPublishManifest;
@@ -6,8 +6,8 @@ const require_primordials_object = require('../primordials/object.js');
6
6
  const require_primordials_string = require('../primordials/string.js');
7
7
  const require_primordials_regexp = require('../primordials/regexp.js');
8
8
  const require_primordials_array = require('../primordials/array.js');
9
- const require_objects_mutate = require('../objects/mutate.js');
10
9
  const require_constants_socket = require('../constants/socket.js');
10
+ const require_objects_mutate = require('../objects/mutate.js');
11
11
  const require_regexps_escape = require('../regexps/escape.js');
12
12
  const require_packages_metadata_extensions = require('./metadata-extensions.js');
13
13
  let src_external_normalize_package_data = require("../external/normalize-package-data");
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_runtime = require('../_virtual/_rolldown/runtime.js');
5
5
  const require_primordials_buffer = require('../primordials/buffer.js');
6
- const require_abort_signal = require('../abort/signal.js');
7
6
  const require_primordials_object = require('../primordials/object.js');
8
- const require_objects_predicates = require('../objects/predicates.js');
9
7
  const require_primordials_string = require('../primordials/string.js');
8
+ const require_abort_signal = require('../abort/signal.js');
9
+ const require_objects_predicates = require('../objects/predicates.js');
10
10
  const require_primordials_array = require('../primordials/array.js');
11
11
  const require_primordials_json = require('../primordials/json.js');
12
12
  const require_constants_agents = require('../constants/agents.js');
@@ -2,8 +2,8 @@
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_objects_predicates = require('../objects/predicates.js');
6
5
  const require_primordials_string = require('../primordials/string.js');
6
+ const require_objects_predicates = require('../objects/predicates.js');
7
7
  const require_strings_predicates = require('../strings/predicates.js');
8
8
  const require_constants_socket = require('../constants/socket.js');
9
9
  const require_smol_purl = require('../smol/purl.js');
@@ -9,13 +9,7 @@
9
9
  * - `pathLikeToString` — `string | Buffer | URL` → `string`
10
10
  */
11
11
  import type nodeUrl from 'node:url';
12
- export declare const CHAR_BACKWARD_SLASH = 92;
13
- export declare const CHAR_COLON = 58;
14
- export declare const CHAR_FORWARD_SLASH = 47;
15
- export declare const CHAR_LOWERCASE_A = 97;
16
- export declare const CHAR_LOWERCASE_Z = 122;
17
- export declare const CHAR_UPPERCASE_A = 65;
18
- export declare const CHAR_UPPERCASE_Z = 90;
12
+ export { CHAR_BACKWARD_SLASH, CHAR_COLON, CHAR_FORWARD_SLASH, CHAR_LOWERCASE_A, CHAR_LOWERCASE_Z, CHAR_UPPERCASE_A, CHAR_UPPERCASE_Z, } from '../constants/encoding';
19
13
  export declare const msysDriveRegExp: RegExp;
20
14
  export declare const nodeModulesPathRegExp: RegExp;
21
15
  export declare const slashRegExp: RegExp;
@@ -2,17 +2,11 @@
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_primordials_buffer = require('../primordials/buffer.js');
5
- const require_constants_platform = require('../constants/platform.js');
6
5
  const require_primordials_string = require('../primordials/string.js');
6
+ const require_constants_platform = require('../constants/platform.js');
7
+ const require_constants_encoding = require('../constants/encoding.js');
7
8
 
8
9
  //#region src/paths/_internal.ts
9
- const CHAR_BACKWARD_SLASH = 92;
10
- const CHAR_COLON = 58;
11
- const CHAR_FORWARD_SLASH = 47;
12
- const CHAR_LOWERCASE_A = 97;
13
- const CHAR_LOWERCASE_Z = 122;
14
- const CHAR_UPPERCASE_A = 65;
15
- const CHAR_UPPERCASE_Z = 90;
16
10
  const msysDriveRegExp = /^\/([a-zA-Z])($|\/)/;
17
11
  const nodeModulesPathRegExp = /(?:[/\\]|^)node_modules(?:$|[/\\])/;
18
12
  const slashRegExp = /[/\\]/;
@@ -72,13 +66,13 @@ function pathLikeToString(pathLike) {
72
66
  }
73
67
 
74
68
  //#endregion
75
- exports.CHAR_BACKWARD_SLASH = CHAR_BACKWARD_SLASH;
76
- exports.CHAR_COLON = CHAR_COLON;
77
- exports.CHAR_FORWARD_SLASH = CHAR_FORWARD_SLASH;
78
- exports.CHAR_LOWERCASE_A = CHAR_LOWERCASE_A;
79
- exports.CHAR_LOWERCASE_Z = CHAR_LOWERCASE_Z;
80
- exports.CHAR_UPPERCASE_A = CHAR_UPPERCASE_A;
81
- exports.CHAR_UPPERCASE_Z = CHAR_UPPERCASE_Z;
69
+ exports.CHAR_BACKWARD_SLASH = require_constants_encoding.CHAR_BACKWARD_SLASH;
70
+ exports.CHAR_COLON = require_constants_encoding.CHAR_COLON;
71
+ exports.CHAR_FORWARD_SLASH = require_constants_encoding.CHAR_FORWARD_SLASH;
72
+ exports.CHAR_LOWERCASE_A = require_constants_encoding.CHAR_LOWERCASE_A;
73
+ exports.CHAR_LOWERCASE_Z = require_constants_encoding.CHAR_LOWERCASE_Z;
74
+ exports.CHAR_UPPERCASE_A = require_constants_encoding.CHAR_UPPERCASE_A;
75
+ exports.CHAR_UPPERCASE_Z = require_constants_encoding.CHAR_UPPERCASE_Z;
82
76
  exports.getUrl = getUrl;
83
77
  exports.msysDriveRegExp = msysDriveRegExp;
84
78
  exports.nodeModulesPathRegExp = nodeModulesPathRegExp;
@@ -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
 
@@ -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
 
@@ -23,6 +23,26 @@ export declare function getOsHomeDir(): string;
23
23
  * setPath('tmpdir', ...) from paths/rewire.
24
24
  */
25
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;
26
46
  /**
27
47
  * Get a Socket app cache directory (~/.socket/_<appName>/cache).
28
48
  */
@@ -100,12 +120,47 @@ export declare function getSocketDlxDir(): string;
100
120
  */
101
121
  export declare function getSocketHomePath(): string;
102
122
  /**
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.
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')).
108
162
  */
163
+ export declare function getSocketRepoClonesDir(): string;
109
164
  /**
110
165
  * Get the Socket state directory (~/.socket/_state) — version-LESS persistent
111
166
  * app state (the home for daemon sockets, locks, OAuth refresh, durable caches
@@ -114,11 +169,6 @@ export declare function getSocketHomePath(): string;
114
169
  * $SOCKET_HOME/_state → $HOME/.socket/_state.
115
170
  */
116
171
  export declare function getSocketStateDir(): string;
117
- /**
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.
121
- */
122
172
  /**
123
173
  * Get the Socket user directory (~/.socket). Override precedence:
124
174
  * setPath('socket-user-dir', …) → SOCKET_HOME env → $HOME/.socket →
@@ -126,24 +176,25 @@ export declare function getSocketStateDir(): string;
126
176
  */
127
177
  export declare function getSocketUserDir(): string;
128
178
  /**
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. Override
135
- * precedence: setPath('socket-wheelhouse-dir', …) $SOCKET_HOME/_wheelhouse →
136
- * $HOME/.socket/_wheelhouse.
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')).
137
187
  */
188
+ export declare function getSocketWheelhouseBinDir(): string;
138
189
  /**
139
190
  * Get the Socket Wheelhouse directory (~/.socket/_wheelhouse). Shared
140
191
  * cross-fleet location for binaries that every fleet member can reach without
141
192
  * each one re-downloading and re-extracting per-repo. Tool installers (janus,
142
- * sfw, etc.) drop their resolved executables under
143
- * `<wheelhouse>/<tool>/<version>/<platform-arch>/`; consumers add the
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.
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.
147
198
  */
148
199
  export declare function getSocketWheelhouseDir(): string;
149
200
  /**
@@ -2,7 +2,9 @@
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_constants_platform = require('../constants/platform.js');
5
6
  const require_env_home = require('../env/home.js');
7
+ const require_env_xdg = require('../env/xdg.js');
6
8
  const require_paths_normalize = require('./normalize.js');
7
9
  const require_node_path = require('../node/path.js');
8
10
  const require_env_socket = require('../env/socket.js');
@@ -44,6 +46,33 @@ function getOsTmpDir() {
44
46
  return require_paths_rewire.getPathValue("tmpdir", () => os.tmpdir());
45
47
  }
46
48
  /**
49
+ * Resolve the runtime socket path for a local daemon named `name`. Distinct
50
+ * from getSocketAppRuntimeDir (the persistent ~/.socket/_state/<app>/run/
51
+ * home): the SOCKET endpoint itself belongs in the ephemeral, owner-only XDG
52
+ * runtime dir — correctly permissioned and auto-cleaned on logout — while the
53
+ * downloaded daemon binary + durable token cache live under ~/.socket. The
54
+ * daemon and every client MUST compute the identical path (1 path, 1
55
+ * reference), so this is the single resolver both sides call.
56
+ *
57
+ * Resolution:
58
+ *
59
+ * - Windows: `\\.\pipe\<name>-sock` (named pipe; Unix sockets are unavailable
60
+ * pre-Win10 1803, same framing/semantics). Returned raw — a pipe path is not
61
+ * a filesystem path and must not be slash-normalized.
62
+ * - `$XDG_RUNTIME_DIR/<name>.sock` when XDG_RUNTIME_DIR is set (systemd
63
+ * `/run/user/<uid>/`).
64
+ * - Else `$TMPDIR/<name>-<uid>.sock` (the `<uid>` suffix avoids collisions when
65
+ * TMPDIR is shared across users on a multi-tenant box).
66
+ */
67
+ function getRuntimeSocketPath(name) {
68
+ if (require_constants_platform.WIN32) return `\\\\.\\pipe\\${name}-sock`;
69
+ const path = require_node_path.getNodePath();
70
+ const xdgRuntimeDir = require_env_xdg.getXdgRuntimeDir();
71
+ if (xdgRuntimeDir) return require_paths_normalize.normalizePath(path.join(xdgRuntimeDir, `${name}.sock`));
72
+ const { uid } = require_node_os.getNodeOs().userInfo();
73
+ return require_paths_normalize.normalizePath(path.join(getOsTmpDir(), `${name}-${uid}.sock`));
74
+ }
75
+ /**
47
76
  * Get a Socket app cache directory (~/.socket/_<appName>/cache).
48
77
  */
49
78
  /**
@@ -142,12 +171,54 @@ function getSocketHomePath() {
142
171
  return getSocketUserDir();
143
172
  }
144
173
  /**
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.
174
+ * Get the Wheelhouse rack directory (~/.socket/_wheelhouse/rack) — the tool
175
+ * STORE. Every `_wheelhouse`-managed CLI tool keeps its real binaries here,
176
+ * racked by name + version as `<rack>/<tool>/<version>/…` (the wheelhouse
177
+ * analog of Homebrew's `Cellar/`). The handles on PATH live in
178
+ * `<wheelhouse>/bin` (getSocketWheelhouseBinDir) and point into the rack.
179
+ * Inherits the `_wheelhouse` override chain (SOCKET_HOME /
180
+ * setPath('socket-wheelhouse-dir')).
181
+ */
182
+ function getSocketRackDir() {
183
+ return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketWheelhouseDir(), "rack"));
184
+ }
185
+ /**
186
+ * Get a racked tool's version directory (~/.socket/_wheelhouse/rack/<tool>/
187
+ * <version>) — the per-tool, per-version home under the rack. The
188
+ * 1-path-1-reference owner of a tool install destination: installers resolve
189
+ * their extract/copy target through this, and the `<wheelhouse>/bin/<tool>`
190
+ * shim points at a binary inside it.
191
+ */
192
+ function getSocketRackToolDir(options) {
193
+ const opts = {
194
+ __proto__: null,
195
+ ...options
196
+ };
197
+ return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketRackDir(), opts.tool, opts.version));
198
+ }
199
+ /**
200
+ * Get the Wheelhouse repo-clones directory (~/.socket/_wheelhouse/repo-clones).
201
+ * Sits beside the per-tool dirs (sfw, codedb, janus, bin) under `_wheelhouse`.
202
+ * The home for reference clones of EXTERNAL repos an agent reviews, each as
203
+ * `<org>-<repo>` lowercased + dash-cased (e.g. `justrach-codedb`).
204
+ *
205
+ * Smallest-practical clone form (smallest disk + fastest initial fetch without
206
+ * the treeless tax): git clone --depth=1 --single-branch --filter=blob:none
207
+ * <url> <dest> `--depth=1` truncates history, `--single-branch` skips other
208
+ * refs, and `--filter=blob:none` (a BLOBLESS partial clone) fetches file blobs
209
+ * lazily on first access — so the initial download is tree-metadata only.
210
+ * (Treeless `--filter=tree:0` is smaller still but refetches trees on every
211
+ * walk, which is slow + breaks offline, so it is NOT the default.)
212
+ *
213
+ * Deliberately OUTSIDE `~/projects/` so the fleet's sibling-walk tooling (e.g.
214
+ * cascade `--all`) never mistakes a reference clone for a fleet member
215
+ * checkout. Disposable: a reference cache, not a working tree. Inherits the
216
+ * `_wheelhouse` override chain (SOCKET_HOME /
217
+ * setPath('socket-wheelhouse-dir')).
150
218
  */
219
+ function getSocketRepoClonesDir() {
220
+ return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketWheelhouseDir(), "repo-clones"));
221
+ }
151
222
  /**
152
223
  * Get the Socket state directory (~/.socket/_state) — version-LESS persistent
153
224
  * app state (the home for daemon sockets, locks, OAuth refresh, durable caches
@@ -162,11 +233,6 @@ function getSocketStateDir() {
162
233
  });
163
234
  }
164
235
  /**
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.
168
- */
169
- /**
170
236
  * Get the Socket user directory (~/.socket). Override precedence:
171
237
  * setPath('socket-user-dir', …) → SOCKET_HOME env → $HOME/.socket →
172
238
  * /tmp/.socket (Unix) or %TEMP%.socket (Windows).
@@ -179,24 +245,27 @@ function getSocketUserDir() {
179
245
  });
180
246
  }
181
247
  /**
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.
248
+ * Get the Wheelhouse bin directory (~/.socket/_wheelhouse/bin) — the single
249
+ * directory placed on PATH. Holds only flat handles (thin exec shims or
250
+ * symlinks), one per tool, each pointing at a real binary racked under
251
+ * `<wheelhouse>/rack/<tool>/<version>/…` (getSocketRackToolDir). The shim IS
252
+ * the bin, the npm `prefix/bin` / Homebrew `bin/` model: PATH lookup does not
253
+ * recurse, so this dir stays flat (never a `bin/<tool>/` subdir). Inherits the
254
+ * `_wheelhouse` override chain (SOCKET_HOME /
255
+ * setPath('socket-wheelhouse-dir')).
190
256
  */
257
+ function getSocketWheelhouseBinDir() {
258
+ return require_paths_normalize.normalizePath(require_node_path.getNodePath().join(getSocketWheelhouseDir(), "bin"));
259
+ }
191
260
  /**
192
261
  * Get the Socket Wheelhouse directory (~/.socket/_wheelhouse). Shared
193
262
  * cross-fleet location for binaries that every fleet member can reach without
194
263
  * each one re-downloading and re-extracting per-repo. Tool installers (janus,
195
- * sfw, etc.) drop their resolved executables under
196
- * `<wheelhouse>/<tool>/<version>/<platform-arch>/`; consumers add the
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.
264
+ * sfw, etc.) rack their resolved executables under
265
+ * `<wheelhouse>/rack/<tool>/<version>/…` (getSocketRackToolDir) and expose a
266
+ * handle in `<wheelhouse>/bin` (getSocketWheelhouseBinDir); consumers add that
267
+ * one `bin/` to PATH. Override precedence: setPath('socket-wheelhouse-dir', …)
268
+ * $SOCKET_HOME/_wheelhouse → $HOME/.socket/_wheelhouse.
200
269
  */
201
270
  function getSocketWheelhouseDir() {
202
271
  return require_paths_rewire.getPathValue("socket-wheelhouse-dir", () => {
@@ -234,6 +303,7 @@ function getUserHomeDir() {
234
303
  //#endregion
235
304
  exports.getOsHomeDir = getOsHomeDir;
236
305
  exports.getOsTmpDir = getOsTmpDir;
306
+ exports.getRuntimeSocketPath = getRuntimeSocketPath;
237
307
  exports.getSocketAppCacheDir = getSocketAppCacheDir;
238
308
  exports.getSocketAppCacheTtlDir = getSocketAppCacheTtlDir;
239
309
  exports.getSocketAppDir = getSocketAppDir;
@@ -242,7 +312,11 @@ exports.getSocketAppStateDir = getSocketAppStateDir;
242
312
  exports.getSocketCacacheDir = getSocketCacacheDir;
243
313
  exports.getSocketDlxDir = getSocketDlxDir;
244
314
  exports.getSocketHomePath = getSocketHomePath;
315
+ exports.getSocketRackDir = getSocketRackDir;
316
+ exports.getSocketRackToolDir = getSocketRackToolDir;
317
+ exports.getSocketRepoClonesDir = getSocketRepoClonesDir;
245
318
  exports.getSocketStateDir = getSocketStateDir;
246
319
  exports.getSocketUserDir = getSocketUserDir;
320
+ exports.getSocketWheelhouseBinDir = getSocketWheelhouseBinDir;
247
321
  exports.getSocketWheelhouseDir = getSocketWheelhouseDir;
248
322
  exports.getUserHomeDir = getUserHomeDir;
@@ -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_primordials_math = require('../primordials/math.js');
5
4
  const require_primordials_object = require('../primordials/object.js');
5
+ const require_primordials_math = require('../primordials/math.js');
6
6
  const require_debug_output = require('../debug/output.js');
7
7
  const require_perf__internal = require('./_internal.js');
8
8
 
@@ -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_primordials_math = require('../primordials/math.js');
5
4
  const require_primordials_object = require('../primordials/object.js');
5
+ const require_primordials_math = require('../primordials/math.js');
6
6
  const require_debug_output = require('../debug/output.js');
7
7
  const require_perf__internal = require('./_internal.js');
8
8
  const require_perf_enabled = require('./enabled.js');
@@ -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_primordials_map_set = require('../primordials/map-set.js');
5
4
  const require_primordials_string = require('../primordials/string.js');
5
+ const require_primordials_map_set = require('../primordials/map-set.js');
6
6
  const require_regexps_hex = require('./hex.js');
7
7
 
8
8
  //#region src/regexps/spec.ts
@@ -2,8 +2,8 @@
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_number = require('../primordials/number.js');
6
5
  const require_primordials_object = require('../primordials/object.js');
6
+ const require_primordials_number = require('../primordials/number.js');
7
7
  const require_primordials_array = require('../primordials/array.js');
8
8
 
9
9
  //#region src/schema/validate.ts