@socketsecurity/lib 6.0.5 → 6.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/ai/discover.js +3 -2
- package/dist/ai/spawn.js +8 -5
- package/dist/ai/worktree.js +11 -6
- package/dist/ansi/strip.js +2 -2
- package/dist/archives/_internal.js +4 -4
- package/dist/archives/zip.js +1 -1
- package/dist/arrays/_internal.js +2 -2
- package/dist/arrays/chunk.js +1 -1
- package/dist/arrays/join.js +2 -2
- package/dist/arrays/unique.js +1 -1
- package/dist/bin/acorn-bindgen.cjs +769 -0
- package/dist/bin/acorn.wasm +0 -0
- package/dist/bin/check-primordials.js +3 -2
- package/dist/bin/check.js +3 -2
- package/dist/bin/exec.js +1 -1
- package/dist/bin/prim.cjs +39064 -0
- package/dist/bin/resolve.js +1 -1
- package/dist/colors/socket-palette.js +2 -2
- package/dist/compression/_internal.js +3 -2
- package/dist/compression/brotli.js +5 -12
- package/dist/compression/gzip.js +5 -13
- package/dist/constants/agents.js +4 -4
- package/dist/constants/packages.js +6 -6
- package/dist/constants/socket.js +1 -1
- package/dist/crypto/hash.js +2 -2
- package/dist/debug/_internal.js +2 -2
- package/dist/debug/caller-info.js +1 -1
- package/dist/debug/namespace.js +5 -5
- package/dist/debug/output.js +3 -3
- package/dist/dlx/binary-download.js +3 -2
- package/dist/eco/npm/npm/flags.js +5 -5
- package/dist/eco/npm/pnpm/flags.js +3 -3
- package/dist/env/boolean.js +1 -1
- package/dist/env/ci.js +1 -1
- package/dist/env/debug.js +1 -1
- package/dist/env/github.js +8 -8
- package/dist/env/home.js +1 -1
- package/dist/env/locale.js +3 -3
- package/dist/env/node-auth-token.js +1 -1
- package/dist/env/node-env.js +1 -1
- package/dist/env/npm.js +5 -5
- package/dist/env/number.js +1 -1
- package/dist/env/package-manager.js +3 -3
- package/dist/env/path.js +1 -1
- package/dist/env/pre-commit.js +1 -1
- package/dist/env/rewire.js +2 -2
- package/dist/env/shell.js +1 -1
- package/dist/env/socket-cli.js +13 -13
- package/dist/env/socket.js +33 -32
- package/dist/env/string.js +1 -1
- package/dist/env/temp-dir.js +3 -3
- package/dist/env/term.js +1 -1
- package/dist/env/test.js +3 -3
- package/dist/env/windows.js +4 -4
- package/dist/env/xdg.js +3 -3
- package/dist/events/exit/_internal.js +5 -5
- package/dist/events/exit/handler.js +1 -1
- package/dist/events/exit/intercept.js +2 -2
- package/dist/events/exit/lifecycle.js +3 -3
- package/dist/events/exit/signals.js +1 -1
- package/dist/external/@sinclair/typebox/value.js +5 -1
- package/dist/external/@sinclair/typebox.js +5 -1
- package/dist/external/@socketregistry/packageurl-js.js +27 -0
- package/dist/external-tools/bazel/resolve.js +2 -1
- package/dist/external-tools/cdxgen/resolve.js +2 -1
- package/dist/external-tools/from-pip-venv.d.ts +73 -0
- package/dist/external-tools/from-pip-venv.js +98 -0
- package/dist/external-tools/janus/asset-names.js +1 -1
- package/dist/external-tools/janus/from-download.js +3 -5
- package/dist/external-tools/janus/resolve.js +2 -1
- package/dist/external-tools/jre/from-download.js +2 -1
- package/dist/external-tools/jre/resolve.js +2 -1
- package/dist/external-tools/manifest.js +7 -5
- package/dist/external-tools/opengrep/resolve.js +2 -1
- package/dist/external-tools/sbt/resolve.js +2 -1
- package/dist/external-tools/skillspector/from-dlx.d.ts +24 -0
- package/dist/external-tools/skillspector/from-dlx.js +41 -0
- package/dist/external-tools/skillspector/from-path.d.ts +8 -0
- package/dist/external-tools/skillspector/from-path.js +32 -0
- package/dist/external-tools/skillspector/from-vfs.d.ts +8 -0
- package/dist/external-tools/skillspector/from-vfs.js +27 -0
- package/dist/external-tools/skillspector/resolve.d.ts +34 -0
- package/dist/external-tools/skillspector/resolve.js +53 -0
- package/dist/external-tools/skillspector/types.d.ts +24 -0
- package/dist/external-tools/skillspector/types.js +2 -0
- package/dist/external-tools/synp/resolve.js +2 -1
- package/dist/external-tools/trivy/resolve.js +2 -1
- package/dist/external-tools/trufflehog/resolve.js +2 -1
- package/dist/external-tools/uv/resolve.js +2 -1
- package/dist/fs/access.js +4 -4
- package/dist/fs/encoding.js +2 -2
- package/dist/fs/find-up.js +2 -2
- package/dist/fs/inspect.js +6 -6
- package/dist/fs/read-dir.js +3 -3
- package/dist/fs/read-file.js +6 -6
- package/dist/fs/read-json.js +2 -2
- package/dist/fs/safe.js +2 -2
- package/dist/fs/unique.js +1 -1
- package/dist/fs/validate.js +1 -1
- package/dist/fs/write-json.js +1 -1
- package/dist/git/_internal.js +2 -1
- package/dist/globs/_internal.js +4 -4
- package/dist/globs/match.js +4 -3
- package/dist/globs/matcher.js +2 -2
- package/dist/globs/stream.js +1 -1
- package/dist/http-request/browser.js +17 -11
- package/dist/http-request/download.js +1 -1
- package/dist/http-request/headers.d.ts +32 -3
- package/dist/http-request/headers.js +42 -13
- package/dist/http-request/request-attempt.js +1 -0
- package/dist/http-request/request-types.d.ts +5 -0
- package/dist/http-request/request.js +32 -15
- package/dist/http-request/response-reader.d.ts +12 -1
- package/dist/http-request/response-reader.js +22 -2
- package/dist/http-request/user-agent.js +1 -1
- package/dist/json/edit.js +1 -1
- package/dist/json/parse.js +4 -4
- package/dist/logger/colors.js +2 -2
- package/dist/logger/console.js +1 -1
- package/dist/logger/symbols.js +1 -1
- package/dist/node/async-hooks.js +2 -2
- package/dist/node/child-process.js +2 -2
- package/dist/node/crypto.js +2 -2
- package/dist/node/events.js +2 -2
- package/dist/node/fs-promises.js +2 -2
- package/dist/node/fs.js +2 -2
- package/dist/node/http.js +2 -2
- package/dist/node/https.js +2 -2
- package/dist/node/module.js +3 -3
- package/dist/node/os.js +2 -2
- package/dist/node/path.js +2 -2
- package/dist/node/timers-promises.js +2 -2
- package/dist/node/url.js +2 -2
- package/dist/node/util.js +2 -2
- package/dist/objects/getters.js +2 -2
- package/dist/objects/inspect.js +3 -3
- package/dist/objects/mutate.js +1 -1
- package/dist/objects/predicates.js +4 -4
- package/dist/objects/sort.js +4 -4
- package/dist/packages/edit-class.js +1 -1
- package/dist/packages/edit.js +2 -2
- package/dist/packages/exports.js +6 -6
- package/dist/packages/licenses.js +8 -8
- package/dist/packages/manifest.js +3 -3
- package/dist/packages/normalize.js +4 -4
- package/dist/packages/operations.js +11 -11
- package/dist/packages/provenance.d.ts +6 -0
- package/dist/packages/provenance.js +12 -3
- package/dist/packages/specs.js +5 -5
- package/dist/packages/validation.js +3 -3
- package/dist/paths/_internal.js +3 -3
- package/dist/paths/conversion.js +4 -4
- package/dist/paths/normalize.js +3 -1
- package/dist/paths/packages.js +3 -3
- package/dist/paths/predicates.js +7 -7
- package/dist/paths/resolve.js +3 -3
- package/dist/process/spawn/_internal.js +3 -3
- package/dist/process/spawn/errors.js +2 -2
- package/dist/process/spawn/stdio.js +1 -1
- package/dist/promises/_internal.js +1 -1
- package/dist/promises/iterate.js +5 -5
- package/dist/promises/options.js +3 -3
- package/dist/promises/retry.js +1 -1
- package/dist/secrets/_internal.js +3 -2
- package/dist/secrets/keychain.js +5 -4
- package/dist/secrets/linux.js +6 -4
- package/dist/secrets/macos.js +5 -3
- package/dist/secrets/rc.js +9 -6
- package/dist/secrets/windows.js +7 -4
- package/dist/shell/parse.d.ts +108 -1
- package/dist/shell/parse.js +168 -2
- package/dist/smol/detect.js +1 -1
- package/dist/smol/http.js +1 -1
- package/dist/smol/https.js +1 -1
- package/dist/smol/manifest.js +1 -1
- package/dist/smol/path.js +1 -1
- package/dist/smol/primordial.js +1 -1
- package/dist/smol/purl.js +1 -1
- package/dist/smol/versions.js +1 -1
- package/dist/smol/vfs.js +1 -1
- package/dist/sorts/_internal.js +4 -4
- package/dist/sorts/natural.js +3 -3
- package/dist/sorts/semver.js +1 -1
- package/dist/sorts/strings.js +1 -1
- package/dist/spinner/default.js +1 -1
- package/dist/spinner/spinner.js +1 -1
- package/dist/ssri/convert.js +2 -2
- package/dist/ssri/parse.js +1 -1
- package/dist/ssri/validate.js +2 -2
- package/dist/stdio/prompts.js +1 -1
- package/dist/streams/parallel.js +2 -2
- package/dist/streams/transform.js +1 -1
- package/dist/strings/format.js +4 -4
- package/dist/strings/predicates.js +2 -2
- package/dist/strings/search.js +1 -1
- package/dist/strings/transform.js +3 -3
- package/dist/strings/width.js +2 -2
- package/dist/temporal/instant.js +4 -2
- package/dist/temporal/slots.js +3 -2
- package/dist/themes/context.js +2 -2
- package/dist/url/parse.js +2 -2
- package/dist/url/predicates.js +1 -1
- package/dist/url/search-params.js +6 -6
- package/dist/words/article.js +1 -1
- package/dist/words/capitalize.js +1 -1
- package/dist/words/pluralize.d.ts +24 -2
- package/dist/words/pluralize.js +37 -2
- package/dist/words/types.d.ts +25 -2
- package/package.json +44 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [6.0.6](https://github.com/SocketDev/socket-lib/releases/tag/v6.0.6) - 2026-06-01
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`http-request` now negotiates and decompresses `gzip` / `br` response bodies.** Buffered requests advertise `Accept-Encoding: gzip, br` and transparently decompress responses by `Content-Encoding`. Node's HTTP client does neither, so a compressed Socket API response previously reached callers as raw deflated bytes. Streamed requests (`stream: true`, e.g. `httpDownload`) intentionally skip the `Accept-Encoding` header so piped-to-disk payloads stay raw and checksum cleanly. Callers can override (e.g. `'identity'`).
|
|
13
|
+
- **`http-request/headers` — `basicAuthHeader(token)`.** Builds the Socket API Basic-auth shape (token-as-username, empty password) so call sites stop hand-rolling `Basic ${base64(token + ':')}`.
|
|
14
|
+
- **`http-request` retry instrumentation.** Adds `Retry-Attempt`, `Retry-Max`, and `Retry-After` request headers on retried attempts so server-side logs can correlate a retry chain.
|
|
15
|
+
- **`prim` CLI bin.** `prim` is now published as a `bin` entry (`dist/bin/prim.cjs`); installs from `@socketsecurity/lib` make `npx prim` work. Also new in this release: `prim --diff` for unified line-diffs in dry-run mode, multi-hop cycle detection in `validateRewrites`, and a two-phase apply with cross-batch validation.
|
|
16
|
+
- **`sanitizeHeaders` shape-based redaction.** `isSensitiveHeaderName` regex (`auth | cookie | credential | key | password | secret | token`) covers custom token headers (`x-amz-security-token`, `api-key`, …) without an explicit allowlist. Same reasoning as "a denylist is itself a leak."
|
|
17
|
+
- **`packages/provenance` — staged-publish detection.** `getTrustStatus` now reads `_npmUser.approver` and surfaces `stagedPublish: true` when a registry version was promoted out of staging via the 2FA-gated approve step (pnpm/pnpm#12056). Adds a new top tier to the trust ladder: `stagedPublish` ranks above `trustedPublisher` and `provenance`. The `TRUST_LEVELS` tuple (`'none' | 'provenance' | 'trustedPublisher' | 'stagedPublish'`), `getTrustLevel`, `getTrustLevelName`, `compareTrust`, and `didTrustDecrease` all extend to level 3.
|
|
18
|
+
- **`words/pluralize` — `Intl.PluralRules` dictionary mode.** New `options.forms` accepts a `{ singular?, plural, zero?, two?, few?, many? }` dictionary keyed by CLDR plural category for locale-aware pluralization of irregulars and non-English counts. `singular` and `plural` map to CLDR's `one` and `other`; the remaining four are optional and fall back to `plural`. New `options.locale` (BCP 47, default `'en-US'`) and `options.type` (`'cardinal' | 'ordinal'`, default `'cardinal'`) configure the underlying `Intl.PluralRules`. Defaults are unchanged — `pluralize('file', { count: n })` still uses the simple `+s` rule with zero `Intl` cost. Cache reuses one `Intl.PluralRules` instance per `<locale>:<type>` pair.
|
|
19
|
+
- **`external-tools/from-pip-venv` — generic Python-package install helper.** Two functions: `createPipVenv({ cacheDir, entryPoint, installSpec })` creates a venv (`python -m venv --clear`) + runs `pip install <spec>` inside it, returning the entry-point binary path. Idempotent: hits the existing venv when its entry-point already exists. `findPython()` locates `python3` (or `python` on Windows) on PATH. Parallel to `from-download.ts` — that one handles single-binary tools from GitHub releases; this handles Python packages from PyPI or git.
|
|
20
|
+
- **`external-tools/skillspector` — resolver for [NVIDIA SkillSpector](https://github.com/NVIDIA/skillspector).** Third-party-skill security scanner; sibling to AgentShield in fleet security tooling. 4-tier resolution (VFS → PATH → DLX-venv → fail) matching the canonical shape used by `external-tools/uv/`. PATH tier distinguishes pipx-installed binaries (`source: 'pipx'`) from plain PATH binaries (`source: 'path'`). DLX-venv tier composes `from-pip-venv` against the pinned upstream git SHA — upstream has no PyPI release or GH tags as of 2026-06-01.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- **`walkUp` emits `D:/` not `D:` at a Windows drive root.** `normalizePath('D:\\')` collapses the trailing separator to `D:` — correct in general (where `D:` means current dir on the `D:` drive), wrong for the filesystem root `walkUp` must yield. A new `normalizeWalkDir` helper preserves the root slash on bare drive letters and defers to `normalizePath` everywhere else.
|
|
25
|
+
|
|
8
26
|
## [6.0.5](https://github.com/SocketDev/socket-lib/releases/tag/v6.0.5) - 2026-05-28
|
|
9
27
|
|
|
10
28
|
### Fixed
|
package/dist/ai/discover.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
|
+
const require_primordials_date = require('../primordials/date.js');
|
|
5
6
|
const require_primordials_json = require('../primordials/json.js');
|
|
6
7
|
const require_bin_which = require('../bin/which.js');
|
|
7
8
|
const require_errors_message = require('../errors/message.js');
|
|
@@ -93,7 +94,7 @@ function readDiskCache(cachePath) {
|
|
|
93
94
|
if (!(0, node_fs.existsSync)(cachePath)) return;
|
|
94
95
|
try {
|
|
95
96
|
const parsed = require_primordials_json.JSONParse((0, node_fs.readFileSync)(cachePath, "utf8"));
|
|
96
|
-
if (typeof parsed !== "object" || parsed === null || typeof parsed.writtenAt !== "number" ||
|
|
97
|
+
if (typeof parsed !== "object" || parsed === null || typeof parsed.writtenAt !== "number" || require_primordials_date.DateNow() - parsed.writtenAt > CACHE_TTL_MS) return;
|
|
97
98
|
return parsed.agents;
|
|
98
99
|
} catch {
|
|
99
100
|
return;
|
|
@@ -111,7 +112,7 @@ async function writeDiskCache(cachePath, agents) {
|
|
|
111
112
|
await (0, node_fs_promises.mkdir)(node_path.default.dirname(cachePath), { recursive: true });
|
|
112
113
|
(0, node_fs.writeFileSync)(cachePath, require_primordials_json.JSONStringify({
|
|
113
114
|
agents,
|
|
114
|
-
writtenAt:
|
|
115
|
+
writtenAt: require_primordials_date.DateNow()
|
|
115
116
|
}, void 0, 2) + "\n");
|
|
116
117
|
} catch (e) {
|
|
117
118
|
logger.error(`discoverAiAgents: cache write failed (${require_errors_message.errorMessage(e)})`);
|
package/dist/ai/spawn.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_primordials_error = require('../primordials/error.js');
|
|
5
|
+
const require_primordials_date = require('../primordials/date.js');
|
|
4
6
|
const require_primordials_object = require('../primordials/object.js');
|
|
5
7
|
const require_errors_message = require('../errors/message.js');
|
|
6
8
|
const require_ai_discover = require('./discover.js');
|
|
7
9
|
const require_process_spawn_errors = require('../process/spawn/errors.js');
|
|
8
10
|
const require_process_spawn_child = require('../process/spawn/child.js');
|
|
11
|
+
const require_primordials_promise = require('../primordials/promise.js');
|
|
9
12
|
|
|
10
13
|
//#region src/ai/spawn.mts
|
|
11
14
|
/**
|
|
@@ -98,7 +101,7 @@ function isOverloaded(stdout, stderr) {
|
|
|
98
101
|
async function pickAgent(requested, cwd) {
|
|
99
102
|
const discovered = await require_ai_discover.discoverAiAgents({ repoRoot: cwd });
|
|
100
103
|
if (requested) {
|
|
101
|
-
if (!(requested in discovered)) throw new
|
|
104
|
+
if (!(requested in discovered)) throw new require_primordials_error.ErrorCtor(`spawnAiAgent: requested agent "${requested}" is not on PATH. Install the CLI or pass a different agent. Discovered: ${require_primordials_object.ObjectKeys(discovered).join(", ") || "(none)"}`);
|
|
102
105
|
return requested;
|
|
103
106
|
}
|
|
104
107
|
if ("claude" in discovered) return "claude";
|
|
@@ -107,7 +110,7 @@ async function pickAgent(requested, cwd) {
|
|
|
107
110
|
"opencode",
|
|
108
111
|
"gemini"
|
|
109
112
|
]) if (candidate in discovered) return candidate;
|
|
110
|
-
throw new
|
|
113
|
+
throw new require_primordials_error.ErrorCtor("spawnAiAgent: no AI agent CLI on PATH. Install one of: claude, codex, opencode, gemini.");
|
|
111
114
|
}
|
|
112
115
|
/**
|
|
113
116
|
* Spawn an AI agent CLI subprocess with the locked-down flag set.
|
|
@@ -137,7 +140,7 @@ async function spawnAiAgent(opts) {
|
|
|
137
140
|
let stderr = "";
|
|
138
141
|
let exitCode = 0;
|
|
139
142
|
let attempts = 0;
|
|
140
|
-
const start =
|
|
143
|
+
const start = require_primordials_date.DateNow();
|
|
141
144
|
while (attempts < MAX_ATTEMPTS) {
|
|
142
145
|
attempts += 1;
|
|
143
146
|
stdout = "";
|
|
@@ -166,11 +169,11 @@ async function spawnAiAgent(opts) {
|
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
171
|
if (!isOverloaded(stdout, stderr) || attempts >= MAX_ATTEMPTS) break;
|
|
169
|
-
await new
|
|
172
|
+
await new require_primordials_promise.PromiseCtor((resolve) => setTimeout(resolve, backoffFor(attempts)));
|
|
170
173
|
}
|
|
171
174
|
return {
|
|
172
175
|
attempts,
|
|
173
|
-
durationMs:
|
|
176
|
+
durationMs: require_primordials_date.DateNow() - start,
|
|
174
177
|
exitCode,
|
|
175
178
|
stderr,
|
|
176
179
|
stdout
|
package/dist/ai/worktree.js
CHANGED
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
|
+
const require_primordials_error = require('../primordials/error.js');
|
|
6
|
+
const require_primordials_math = require('../primordials/math.js');
|
|
7
|
+
const require_primordials_array = require('../primordials/array.js');
|
|
8
|
+
const require_primordials_date = require('../primordials/date.js');
|
|
5
9
|
const require_errors_message = require('../errors/message.js');
|
|
6
10
|
const require_process_spawn_errors = require('../process/spawn/errors.js');
|
|
7
11
|
const require_process_spawn_child = require('../process/spawn/child.js');
|
|
12
|
+
const require_primordials_promise = require('../primordials/promise.js');
|
|
8
13
|
let node_fs = require("node:fs");
|
|
9
14
|
let node_path = require("node:path");
|
|
10
15
|
node_path = require_runtime.__toESM(node_path, 1);
|
|
@@ -51,7 +56,7 @@ async function runOne(item, index, worktreeBranch, worktreePath, baseRepo, branc
|
|
|
51
56
|
const add = tryGit(baseRepo, "worktree", "add", "-b", worktreeBranch, worktreePath, branch);
|
|
52
57
|
if (!add.ok) return {
|
|
53
58
|
cleanup: "kept",
|
|
54
|
-
error:
|
|
59
|
+
error: new require_primordials_error.ErrorCtor(`git worktree add failed: ${add.output}`),
|
|
55
60
|
merged: false,
|
|
56
61
|
status: "rejected",
|
|
57
62
|
worktreePath
|
|
@@ -73,7 +78,7 @@ async function runOne(item, index, worktreeBranch, worktreePath, baseRepo, branc
|
|
|
73
78
|
if (error === void 0 && hasCommitted) {
|
|
74
79
|
const merge = tryGit(baseRepo, "merge", "--ff-only", worktreeBranch);
|
|
75
80
|
if (merge.ok) merged = true;
|
|
76
|
-
else error =
|
|
81
|
+
else error = new require_primordials_error.ErrorCtor(`git merge --ff-only failed: ${merge.output}`);
|
|
77
82
|
}
|
|
78
83
|
let didCleanup = "kept";
|
|
79
84
|
if (error === void 0 && (cleanup === "always" || cleanup === "on-empty" && !hasCommitted && !hasUncommitted)) {
|
|
@@ -130,9 +135,9 @@ async function runOne(item, index, worktreeBranch, worktreePath, baseRepo, branc
|
|
|
130
135
|
async function spawnAiAgentsInWorktrees(items, fn, options) {
|
|
131
136
|
const cleanup = options.cleanup ?? "always";
|
|
132
137
|
const namePrefix = options.namePrefix ?? "agent-task";
|
|
133
|
-
const concurrency =
|
|
138
|
+
const concurrency = require_primordials_math.MathMax(1, Math.min(options.concurrency ?? DEFAULT_CONCURRENCY, MAX_CONCURRENCY));
|
|
134
139
|
const baseRepo = options.baseRepo;
|
|
135
|
-
if (!(0, node_fs.existsSync)(node_path.default.join(baseRepo, ".git"))) throw new
|
|
140
|
+
if (!(0, node_fs.existsSync)(node_path.default.join(baseRepo, ".git"))) throw new require_primordials_error.ErrorCtor(`spawnAiAgentsInWorktrees: baseRepo is not a git checkout: ${baseRepo}`);
|
|
136
141
|
const branch = options.branch ?? currentBranch(baseRepo);
|
|
137
142
|
const worktreeRoot = options.worktreeRoot ?? node_path.default.join(process.platform === "win32" ? process.env["TEMP"] ?? "." : "/tmp", `${namePrefix}-${Date.now()}`);
|
|
138
143
|
const settled = [];
|
|
@@ -143,10 +148,10 @@ async function spawnAiAgentsInWorktrees(items, fn, options) {
|
|
|
143
148
|
cursor += 1;
|
|
144
149
|
if (idx >= items.length) return;
|
|
145
150
|
const item = items[idx];
|
|
146
|
-
settled[idx] = await runOne(item, idx, `${namePrefix}-${idx}-${
|
|
151
|
+
settled[idx] = await runOne(item, idx, `${namePrefix}-${idx}-${require_primordials_date.DateNow()}`, node_path.default.join(worktreeRoot, `${namePrefix}-${idx}`), baseRepo, branch, cleanup, fn);
|
|
147
152
|
}
|
|
148
153
|
}
|
|
149
|
-
await
|
|
154
|
+
await require_primordials_promise.PromiseAll(require_primordials_array.ArrayFrom({ length: concurrency }, () => worker()));
|
|
150
155
|
return settled;
|
|
151
156
|
}
|
|
152
157
|
function tryGit(cwd, ...args) {
|
package/dist/ansi/strip.js
CHANGED
|
@@ -26,7 +26,7 @@ const ANSI_REGEX = /\x1b\[[0-9;]*m/g;
|
|
|
26
26
|
* ansiRegex({ onlyFirst: true }) // matches only the first code
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
30
30
|
function ansiRegex(options) {
|
|
31
31
|
const { onlyFirst } = options ?? {};
|
|
32
32
|
return new require_primordials_regexp.RegExpCtor(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`, onlyFirst ? void 0 : "g");
|
|
@@ -40,7 +40,7 @@ function ansiRegex(options) {
|
|
|
40
40
|
* stripAnsi('\u001b[1mBold\u001b[0m') // 'Bold'
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
44
44
|
function stripAnsi(text) {
|
|
45
45
|
return require_primordials_string.StringPrototypeReplace(text, ANSI_REGEX, "");
|
|
46
46
|
}
|
|
@@ -38,14 +38,14 @@ function assertArchiveExists(archivePath) {
|
|
|
38
38
|
throw err;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
42
42
|
function getAdmZip() {
|
|
43
|
-
if (_AdmZip === void 0) _AdmZip =
|
|
43
|
+
if (_AdmZip === void 0) _AdmZip = /*@__PURE__*/ require("../external/adm-zip.js");
|
|
44
44
|
return _AdmZip;
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
47
47
|
function getTarFs() {
|
|
48
|
-
if (_tarFs === void 0) _tarFs =
|
|
48
|
+
if (_tarFs === void 0) _tarFs = /*@__PURE__*/ require("../external/tar-fs.js");
|
|
49
49
|
return _tarFs;
|
|
50
50
|
}
|
|
51
51
|
/**
|
package/dist/archives/zip.js
CHANGED
|
@@ -6,9 +6,9 @@ const require_paths_normalize = require('../paths/normalize.js');
|
|
|
6
6
|
const require_primordials_array = require('../primordials/array.js');
|
|
7
7
|
const require_primordials_map_set = require('../primordials/map-set.js');
|
|
8
8
|
const require_node_path = require('../node/path.js');
|
|
9
|
+
const require_primordials_promise = require('../primordials/promise.js');
|
|
9
10
|
const require_archives__internal = require('./_internal.js');
|
|
10
11
|
const require_fs_safe = require('../fs/safe.js');
|
|
11
|
-
const require_primordials_promise = require('../primordials/promise.js');
|
|
12
12
|
|
|
13
13
|
//#region src/archives/zip.ts
|
|
14
14
|
/**
|
package/dist/arrays/_internal.js
CHANGED
|
@@ -28,7 +28,7 @@ let _disjunctionFormatter;
|
|
|
28
28
|
* @returns Cached Intl.ListFormat instance configured for conjunction
|
|
29
29
|
* formatting.
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
32
32
|
function getConjunctionFormatter() {
|
|
33
33
|
if (_conjunctionFormatter === void 0)
|
|
34
34
|
/* c8 ignore start */
|
|
@@ -56,7 +56,7 @@ function getConjunctionFormatter() {
|
|
|
56
56
|
* @returns Cached Intl.ListFormat instance configured for disjunction
|
|
57
57
|
* formatting.
|
|
58
58
|
*/
|
|
59
|
-
|
|
59
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
60
60
|
function getDisjunctionFormatter() {
|
|
61
61
|
if (_disjunctionFormatter === void 0)
|
|
62
62
|
/* c8 ignore start */
|
package/dist/arrays/chunk.js
CHANGED
|
@@ -40,7 +40,7 @@ const require_primordials_error = require('../primordials/error.js');
|
|
|
40
40
|
*
|
|
41
41
|
* @throws {Error} If chunk size is less than or equal to 0
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
44
44
|
function arrayChunk(arr, size) {
|
|
45
45
|
const chunkSize = size ?? 2;
|
|
46
46
|
if (chunkSize <= 0) throw new require_primordials_error.ErrorCtor("Chunk size must be greater than 0");
|
package/dist/arrays/join.js
CHANGED
|
@@ -43,7 +43,7 @@ const require_arrays__internal = require('./_internal.js');
|
|
|
43
43
|
*
|
|
44
44
|
* @returns Formatted string with proper "and" conjunction
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
47
47
|
function joinAnd(arr) {
|
|
48
48
|
return (/* @__PURE__ */ require_arrays__internal.getConjunctionFormatter()).format(arr);
|
|
49
49
|
}
|
|
@@ -82,7 +82,7 @@ function joinAnd(arr) {
|
|
|
82
82
|
*
|
|
83
83
|
* @returns Formatted string with proper "or" disjunction
|
|
84
84
|
*/
|
|
85
|
-
|
|
85
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
86
86
|
function joinOr(arr) {
|
|
87
87
|
return (/* @__PURE__ */ require_arrays__internal.getDisjunctionFormatter()).format(arr);
|
|
88
88
|
}
|
package/dist/arrays/unique.js
CHANGED
|
@@ -39,7 +39,7 @@ const require_primordials_map_set = require('../primordials/map-set.js');
|
|
|
39
39
|
*
|
|
40
40
|
* @returns New array with duplicate values removed
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
43
43
|
function arrayUnique(arr) {
|
|
44
44
|
return [...new require_primordials_map_set.SetCtor(arr)];
|
|
45
45
|
}
|