Releases: SocketDev/socket-lib
v6.0.9
Added
external-tools/uv— uv resolver. Resolves Astral'suvPython package manager across three tiers (embedded VFS, then system PATH, then a downloaded GitHub release), matching the shape of the otherexternal-tools/*tool resolvers. ExportsresolveUv,ResolvedUv,UvSource, plus the per-platform asset map and download helpers.external-tools/python/uv-install— reproducible uv-project install helpers.uvSyncProjectinstalls a uv project at its exact pinned versions and refuses to proceed when those have drifted, so every machine gets the same result.uvExportMaterializeinstalls the same pinned versions into a content-addressed directory with no virtualenv, so the result is relocatable and embeddable in a single-file build. Concurrent callers serialize so two installs can't collide. The Python analog of the npm dlx install model.external-tools/skillspector— pinned-project resolution tier.skillspectorFromUvinstalls SkillSpector from a fully pinned uv project (every version fixed) and returns its entry point, resolved ahead of the existing git-SHA fallback when a project directory anduvbinary are supplied. Adds a'uv'source to the resolution result.config/layers— generic layered-config reader.readConfigLayers(name, { dirs })reads a named config file from an ordered list of layer directories (lowest precedence first) and returns the layers that exist; absent or unparseable layers are skipped.mergeConfigArrayconcatenates one array-valued key across all layers, for lists that higher layers extend rather than replace. It carries no project-convention knowledge: the caller supplies the directories and the merge policy.paths—_wheelhousetool-layout dirs and the agent-clone dir.getSocketRackDirandgetSocketRackToolDirlocate the racked tool store,getSocketWheelhouseBinDirthe PATH-handle directory that points into it, andgetSocketRepoClonesDirthe directory where agents clone external repos for reference (kept out of the projects tree so sibling-walking tooling never treats a clone as a fleet member).ai— offline/gated-model detection and fall-over.spawnTierWithFallbackwalks a tier's cross-engine equivalence chain and runs the first engine that is both installed and authenticated, so a request still completes when the preferred model is down, gated, or unkeyed.isModelUnavailablerecognizes a down-or-gated model from the engine's actual output rather than a brittle literal-string match. Theai/routeresolver andai/subagent-statusreader are exposed as their own entry points.fs/copy— recursive copy with three destination modes.copy(from, to, { mode })copies a file or directory tree.CopyModechooses how an existing destination is treated:'overlay'(the default: overwrite collisions, keep destination-only files),'pave'(the destination becomes an exact mirror of the source via an atomic sibling-temp-then-rename swap, so no stale files survive and a partial tree is never observed), or'fill'(no-clobber: add only what is missing, never overwrite). Also acceptsfilter,dereference, and an abortsignal.node/requireFrom— relativerequirebound to the caller's directory.requireFrom(fromUrl, specifier)resolves a relative specifier (./x,../y) from the caller's own directory, passed asimport.meta.url, so relative loads bind to the right base when modules run unbundled (for example AOT-compiled from source, where each module sits at its own nested path). Builtins and bare packages resolve as before.secrets— proteus broker credential tier. The credential resolver gains a broker layer in the documented order (explicit, then env, then broker, then keychain): it connects to the broker's runtime socket, requests the value, and self-gates. No socket means no broker, so it returnsundefinedand falls through to the keychain. Async only (absent fromresolveSync) and skipped underallowEnvOnly. ExistingresolveProviderCredentialcall sites are unchanged.paths—getRuntimeSocketPathandgetXdgRuntimeDirfor daemon sockets. One resolver a daemon and its clients both call to locate a runtime socket: the XDG runtime dir when present, a$TMPDIR/<name>-<uid>fallback, or a named pipe on Windows.llms.txt— discovery index for AI agents.pnpm run docsnow also emits a publish-safellms.txtat the package root that links each export subpath to its shipped.d.mtsdeclaration, giving an agent one file to read after installing. It ships in the published tarball.packages/manifest—trimPublishManifest. Returns a shallow copy of apackage.jsonthat omits dev/build-only top-level fields (devDependencies,scriptsby default) so a published tarball and its npm metadata stay lean.dropoverrides the field set;keepretains a field even when dropped (e.g. a runtimepostinstall). The original object is left intact.
Changed
integrity— oneHashcurrency (breaking). Hashes are modeled as a single concept, aHashcarrying algorithm, hex, and sri, rather than an integrity-vs-checksum type duality, so the algorithm is explicit on every value. AddsparseHash(encoding- and length-aware),computeHash(sha512 default),verifyHash(bytes, expected)(verifies against the expected hash's declared algorithm),equalHashes(encoding-agnostic, and never equal across algorithms),makeHash, andHashMismatchError. Breaking:verifyHashnow takes(bytes, expected), not(expected, computed), andDlxHashMismatchErroris a deprecated alias ofHashMismatchError. Back-compat shims remain:checksumToIntegrity,integrityToChecksum,normalizeHash,computeHashes,isChecksum,isIntegrity,parseIntegrity.fleet/repo-configis now a thin wrapper overconfig/layers.resolveRepoConfig(the fleet default layered under a per-repo override) andmergeRepoConfigArraystay atfleet/repo-config; the generic, convention-free primitives moved to the newconfig/layersentry.resolveRepoConfigcallers see no behavior change.
v5.7.0
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.
5.7.0 - 2026-02-12
Added
-
env: Added
isInEnv()helper function to check if an environment variable key exists, regardless of its value- Returns
trueeven for empty strings,"false","0", etc. - Follows same override resolution order as
getEnvValue()(isolated overrides → shared overrides → process.env) - Useful for detecting presence of environment variables independent of their value
- Returns
-
dlx: Added new exported helper functions
downloadBinaryFile()- Downloads a binary file from a URL to the dlx cache directoryensurePackageInstalled()- Ensures an npm package is installed and cached via ArboristgetBinaryCacheMetadataPath()- Gets the file path to dlx binary cache metadata (.dlx-metadata.json)isBinaryCacheValid()- Checks if a cached dlx binary is still valid based on TTL and timestampmakePackageBinsExecutable()- Makes npm package binaries executable on Unix systemsparsePackageSpec()- Parses npm package spec strings (e.g.,pkg@1.0.0) into name and versionresolveBinaryPath()- Resolves the absolute path to a binary within an installed packagewriteBinaryCacheMetadata()- Writes dlx binary cache metadata with integrity, size, and source info
-
releases: Added
createAssetMatcher()utility function for GitHub release asset pattern matching- Creates matcher functions that test strings against glob patterns, prefix/suffix, or RegExp
- Used for dynamic asset discovery in GitHub releases (e.g., matching platform-specific binaries)
Changed
- env: Updated
getCI()to useisInEnv()for more accurate CI detection- Now returns
truewhenever theCIkey exists in the environment, not just when truthy - Matches standard CI detection behavior where the presence of the key (not its value) indicates a CI environment
- Now returns
Fixed
-
github: Fixed JSON parsing crash vulnerability by adding try-catch around
JSON.parse()in GitHub API responses- Prevents crashes on malformed, incomplete, or binary responses
- Error messages now include the response URL for better debugging
-
dlx/binary: Fixed clock skew vulnerabilities in cache validation
- Cache entries with future timestamps (clock skew) are now treated as expired
- Metadata writes now use atomic write-then-rename pattern to prevent corruption
- Added TOCTOU race protection by re-checking binary existence after metadata read
-
dlx/cache cleanup: Fixed handling of future timestamps during cache cleanup
- Entries with future timestamps (due to clock skew) are now properly treated as expired
-
dlx/package: Fixed scoped package parsing bug where
@scope/packagewas incorrectly parsed- Changed condition from
startsWith('@')toatIndex === 0for more precise detection - Fixes installation failures for scoped packages like
@socketregistry/lib
- Changed condition from
-
cache-with-ttl: Added clock skew detection to TTL cache
- Far-future
expiresAtvalues (>2x TTL) are now treated as expired - Protects against cache poisoning from clock skew
- Far-future
-
packages/specs: Fixed unconditional
.gittruncation in Git URL parsing- Now only removes
.gitsuffix when URL actually ends with.git - Prevents incorrect truncation of URLs containing
.gitin the middle
- Now only removes
-
releases/github: Fixed TOCTOU race condition in binary download verification
- Re-checks binary existence after reading version file
- Ensures binary is re-downloaded if missing despite version file presence
-
provenance: Fixed incorrect package name in provenance workflow
- Changed from
@socketregistry/libto@socketsecurity/lib
- Changed from
5.6.0 - 2026-02-08
Added
- http-request: Added automatic default headers for JSON and text requests
httpJson()now automatically setsAccept: application/jsonheaderhttpJson()automatically setsContent-Type: application/jsonwhen body is presenthttpText()now automatically setsAccept: text/plainheaderhttpText()automatically setsContent-Type: text/plainwhen body is present- User-provided headers always override defaults
- Simplifies API usage - no need to manually set common headers
Changed
- http-request: Renamed HTTP helper functions to support all HTTP methods (BREAKING CHANGE)
httpGetJson()→httpJson()- Now supports GET, POST, PUT, DELETE, PATCH, etc.httpGetText()→httpText()- Now supports all HTTP methods viamethodoption- Functions now accept
methodparameter in options (defaults to 'GET') - More flexible API that matches modern fetch-style conventions
- Migration: Replace
httpGetJson()calls withhttpJson()andhttpGetText()withhttpText()
Fixed
- http-request: Fixed Content-Type header incorrectly sent with empty string body
- Empty string body (
"") no longer triggers Content-Type header - Changed condition from
if (body !== undefined)toif (body)for semantic correctness - Empty string represents "no content" and should not declare a Content-Type
- Affects
httpJson()andhttpText()functions - Fixes potential API compatibility issues with servers expecting no Content-Type for empty bodies
- Added comprehensive test coverage for empty string edge case
- Empty string body (
5.5.3 - 2026-01-20
Fixed
- deps: Added patch for execa@2.1.0 to fix signal-exit v4 compatibility. The package was using default import syntax with signal-exit v4, which now exports onExit as a named export.
5.5.2 - 2026-01-20
Changed
- dlx/package: Use
getSocketCacacheDir()instead ofgetPacoteCachePath()for Arborist cache configuration- Ensures consistent use of Socket's shared cacache directory (
~/.socket/_cacache) - Removes dependency on pacote cache path extraction which could fail
- Simplifies cache configuration by using reliable Socket path utility
- Ensures consistent use of Socket's shared cacache directory (
5.5.1 - 2026-01-12
Fixed
- Fixed dotenvx compatibility with pre-commit hooks
- Fixed empty releases being returned when finding latest release
5.5.0 - 2026-01-12
Added
- dlx/detect: Executable type detection utilities for DLX cache and local file paths
detectDlxExecutableType(): Detects Node.js packages vs native binaries in DLX cache by checking for node_modules/ directorydetectExecutableType(): Generic entry point that routes to appropriate detection strategydetectLocalExecutableType(): Detects executables on local filesystem by checking package.json bin field or file extensionisJsFilePath(): Validates if a file path has .js, .mjs, or .cjs extensionisNativeBinary(): Simplified helper that returns true for native binary executablesisNodePackage(): Simplified helper that returns true for Node.js packages
Fixed
- releases/github: Sort releases by published_at to reliably find latest release instead of relying on creation order
5.4.1 - 2026-01-10
Fixed
- build: Removed debug module stub to bundle real debug package. The stub was missing
enable()anddisable()methods, causing errors when downstream projects re-bundled the lib.
5.4.0 - 2026-01-07
Added
-
releases/github: Extended release functions to accept glob patterns for asset discovery
getReleaseAssetUrl()now accepts glob patterns:'yoga-sync-*.mjs','models-*.tar.gz'downloadReleaseAsset()now accepts glob patterns for automatic asset discoverygetLatestRelease()now accepts asset patterns to find releases with matching assets- Supports wildcards, brace expansion, RegExp patterns, and prefix/suffix objects
- Uses picomatch for robust glob pattern matching
-
releases/socket-btm: Extended
downloadSocketBtmRelease()to accept glob patternsassetparameter now accepts wildcards:'yoga-sync-*.mjs','models-*.tar.gz'- Automatically discovers and downloads latest matching asset
- Eliminates need for hardcoded asset names in build scripts
5.3.0 - 2026-01-07
Added
-
releases/socket-btm: Exported helper functions for external use
detectLibc(): Detect musl vs glibc on Linux systemsgetBinaryAssetName(): Get GitHub asset name for platform/archgetBinaryName(): Get binary filename with platform-appropriate extensiongetPlatformArch(): Get platform-arch identifier for directory structure
-
releases/github: Exported
getAuthHeaders()for GitHub API authentication- Returns headers with
Accept,X-GitHub-Api-Version, and optionalAuthorization - Checks
GH_TOKENandGITHUB_TOKENenvironment variables
- Returns headers with
5.2.1 - 2026-01-06
Fixed
- releases: Fixed "Text file busy" errors when executing downloaded binaries
- Changed
downloadGitHubRelease()to use synchronouschmodSync()instead of asyncchmod() - Ensures file system operations complete before binary execution
- Prevents race conditions in CI/CD environments where async operations may not fully flush to disk
- Changed
5.2.0 - 2026-01-06
Added
- releases: Added GitHub release download uti...