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