@swmansion/argent 0.33.1-next.13 → 0.33.1-next.15
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/dist/cli-cmds.mjs +261 -69
- package/dist/client.js +247 -55
- package/dist/installer.mjs +20 -10
- package/dist/mcp-server.mjs +251 -59
- package/dist/tool-server.cjs +704 -535
- package/package.json +2 -2
- package/skills/argent-create-e2e/references/e2e-yaml.md +1 -1
package/dist/client.js
CHANGED
|
@@ -8432,7 +8432,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
8432
8432
|
"error",
|
|
8433
8433
|
(err) => reject(
|
|
8434
8434
|
new Error(
|
|
8435
|
-
err.code === "ENOENT" && nodeBin === "node" ? "Could not start the argent tool-server: `node` was not found on PATH. Install Node.js
|
|
8435
|
+
err.code === "ENOENT" && nodeBin === "node" ? "Could not start the argent tool-server: `node` was not found on PATH. Install Node.js 22.18+ or add it to PATH." : `Could not start the argent tool-server: ${err.message}`
|
|
8436
8436
|
)
|
|
8437
8437
|
)
|
|
8438
8438
|
);
|
|
@@ -9521,7 +9521,7 @@ async function getResolvedToolsUrl() {
|
|
|
9521
9521
|
|
|
9522
9522
|
// ../argent-tools-client/src/file-inputs.ts
|
|
9523
9523
|
import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
|
|
9524
|
-
import { createReadStream, rmSync as rmSync2 } from "node:fs";
|
|
9524
|
+
import { createReadStream as createReadStream2, rmSync as rmSync2 } from "node:fs";
|
|
9525
9525
|
import {
|
|
9526
9526
|
chmod as chmod3,
|
|
9527
9527
|
lstat,
|
|
@@ -9537,50 +9537,234 @@ import { constants, tmpdir } from "node:os";
|
|
|
9537
9537
|
import * as path10 from "node:path";
|
|
9538
9538
|
|
|
9539
9539
|
// ../archive/src/index.ts
|
|
9540
|
-
import {
|
|
9541
|
-
import {
|
|
9542
|
-
import {
|
|
9543
|
-
import {
|
|
9544
|
-
|
|
9540
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
9541
|
+
import { once } from "node:events";
|
|
9542
|
+
import { createReadStream, createWriteStream } from "node:fs";
|
|
9543
|
+
import { open, rm, readdir as readdir3 } from "node:fs/promises";
|
|
9544
|
+
import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve6, sep as sep2 } from "node:path";
|
|
9545
|
+
import { Writable } from "node:stream";
|
|
9546
|
+
import { pipeline } from "node:stream/promises";
|
|
9547
|
+
import zlib from "node:zlib";
|
|
9545
9548
|
var ArchiveError = class extends Error {
|
|
9546
9549
|
};
|
|
9547
|
-
function
|
|
9548
|
-
|
|
9550
|
+
var ARCHIVE_FORMATS = typeof zlib.createZstdCompress === "function" ? ["zstd", "gzip"] : ["gzip"];
|
|
9551
|
+
var ARCHIVE_CONTENT_TYPES = {
|
|
9552
|
+
zstd: "application/zstd",
|
|
9553
|
+
gzip: "application/gzip"
|
|
9554
|
+
};
|
|
9555
|
+
function pickArchiveFormat(peerFormats) {
|
|
9556
|
+
return ARCHIVE_FORMATS.find((f) => peerFormats?.includes(f)) ?? "gzip";
|
|
9557
|
+
}
|
|
9558
|
+
var CHUNK_BYTES = 1 << 20;
|
|
9559
|
+
function createCompressor(format) {
|
|
9560
|
+
return format === "zstd" ? zlib.createZstdCompress({
|
|
9561
|
+
chunkSize: CHUNK_BYTES,
|
|
9562
|
+
// Lets the decoder detect corruption.
|
|
9563
|
+
params: { [zlib.constants.ZSTD_c_checksumFlag]: 1 }
|
|
9564
|
+
}) : zlib.createGzip({ chunkSize: CHUNK_BYTES });
|
|
9565
|
+
}
|
|
9566
|
+
function createTarArgs(sourcePath) {
|
|
9567
|
+
const name = basename4(sourcePath);
|
|
9568
|
+
return ["-cf", "-", "-C", dirname5(sourcePath), /^[-@]/.test(name) ? `./${name}` : name];
|
|
9569
|
+
}
|
|
9570
|
+
var MAX_LISTING_BYTES = 32 << 20;
|
|
9571
|
+
var MAX_LISTING_LINES = 1 << 18;
|
|
9572
|
+
var MAX_STDERR_BYTES = 16 << 10;
|
|
9573
|
+
var MAX_UNREAD_BYTES = 16 << 20;
|
|
9574
|
+
function collect(stream, maxBytes, { maxLines = Infinity, onOverflow } = {}) {
|
|
9575
|
+
const chunks = [];
|
|
9576
|
+
let bytes = 0;
|
|
9577
|
+
let lines = 0;
|
|
9578
|
+
let overflowed = false;
|
|
9579
|
+
stream?.on("data", (chunk) => {
|
|
9580
|
+
if (overflowed) return;
|
|
9581
|
+
chunks.push(chunk.subarray(0, maxBytes - bytes));
|
|
9582
|
+
bytes += chunk.length;
|
|
9583
|
+
for (let i = chunk.indexOf(10); i !== -1 && lines <= maxLines; i = chunk.indexOf(10, i + 1)) {
|
|
9584
|
+
lines++;
|
|
9585
|
+
}
|
|
9586
|
+
if (bytes > maxBytes || lines > maxLines) {
|
|
9587
|
+
overflowed = true;
|
|
9588
|
+
onOverflow?.();
|
|
9589
|
+
}
|
|
9590
|
+
});
|
|
9591
|
+
return {
|
|
9592
|
+
overflowed: () => overflowed,
|
|
9593
|
+
text: () => Buffer.concat(chunks).toString("utf8") + (overflowed ? "\u2026" : "")
|
|
9594
|
+
};
|
|
9549
9595
|
}
|
|
9550
|
-
async function
|
|
9596
|
+
async function createArchiveFile(sourcePath, archivePath, format, signal) {
|
|
9597
|
+
const out = createWriteStream(archivePath);
|
|
9598
|
+
await once(out, "ready");
|
|
9551
9599
|
try {
|
|
9552
|
-
await
|
|
9600
|
+
await archiveInto(out, sourcePath, format, signal);
|
|
9553
9601
|
} catch (err) {
|
|
9554
|
-
|
|
9602
|
+
out.destroy();
|
|
9603
|
+
await rm(archivePath, { force: true }).catch(() => {
|
|
9555
9604
|
});
|
|
9605
|
+
signal?.throwIfAborted();
|
|
9556
9606
|
throw err;
|
|
9557
9607
|
}
|
|
9558
9608
|
}
|
|
9609
|
+
async function archiveInto(out, sourcePath, format, signal) {
|
|
9610
|
+
const child = spawn2("tar", createTarArgs(sourcePath), {
|
|
9611
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
9612
|
+
signal
|
|
9613
|
+
});
|
|
9614
|
+
const exited = new Promise((res, rej) => {
|
|
9615
|
+
child.on("error", rej);
|
|
9616
|
+
child.on("close", res);
|
|
9617
|
+
});
|
|
9618
|
+
const stderr = collect(child.stderr, MAX_STDERR_BYTES);
|
|
9619
|
+
const [written, closed] = await Promise.allSettled([
|
|
9620
|
+
pipeline(child.stdout, createCompressor(format), out),
|
|
9621
|
+
exited
|
|
9622
|
+
]);
|
|
9623
|
+
if (closed.status === "rejected") throw closed.reason;
|
|
9624
|
+
if (written.status === "rejected") throw written.reason;
|
|
9625
|
+
if (closed.value !== 0) {
|
|
9626
|
+
throw new Error(`tar exited with code ${closed.value}: ${stderr.text().trim()}`);
|
|
9627
|
+
}
|
|
9628
|
+
}
|
|
9629
|
+
async function sniffFormat(archivePath) {
|
|
9630
|
+
const fh = await open(archivePath, "r");
|
|
9631
|
+
try {
|
|
9632
|
+
const { buffer, bytesRead } = await fh.read(Buffer.alloc(4), 0, 4, 0);
|
|
9633
|
+
const magic = buffer.subarray(0, bytesRead).toString("hex");
|
|
9634
|
+
if (magic.startsWith("1f8b")) return "gzip";
|
|
9635
|
+
if (magic === "28b52ffd" && ARCHIVE_FORMATS.includes("zstd")) return "zstd";
|
|
9636
|
+
throw new ArchiveError("unrecognized compression");
|
|
9637
|
+
} finally {
|
|
9638
|
+
await fh.close();
|
|
9639
|
+
}
|
|
9640
|
+
}
|
|
9641
|
+
var ZSTD_FRAME_MAGIC = 4247762216;
|
|
9642
|
+
async function assertSingleCompleteZstdFrame(archivePath) {
|
|
9643
|
+
const fh = await open(archivePath, "r");
|
|
9644
|
+
try {
|
|
9645
|
+
const { size } = await fh.stat();
|
|
9646
|
+
const window = Buffer.alloc(4096);
|
|
9647
|
+
let windowStart = 0;
|
|
9648
|
+
let windowEnd = 0;
|
|
9649
|
+
let pos = 0;
|
|
9650
|
+
const read = async (n) => {
|
|
9651
|
+
if (pos < windowStart || pos + n > windowEnd) {
|
|
9652
|
+
const { bytesRead } = await fh.read(window, 0, window.length, pos);
|
|
9653
|
+
windowStart = pos;
|
|
9654
|
+
windowEnd = pos + bytesRead;
|
|
9655
|
+
if (bytesRead < n) throw new ArchiveError("truncated zstd frame");
|
|
9656
|
+
}
|
|
9657
|
+
return window.subarray(pos - windowStart, pos - windowStart + n);
|
|
9658
|
+
};
|
|
9659
|
+
for (let frame = 0; pos < size; frame++) {
|
|
9660
|
+
const header = await read(5);
|
|
9661
|
+
if (header.readUInt32LE(0) !== ZSTD_FRAME_MAGIC) throw new ArchiveError("bad zstd frame");
|
|
9662
|
+
const descriptor = header[4];
|
|
9663
|
+
const singleSegment = descriptor >> 5 & 1;
|
|
9664
|
+
pos += 5 + (singleSegment ? 0 : 1) + // window descriptor
|
|
9665
|
+
[0, 1, 2, 4][descriptor & 3] + // dictionary id
|
|
9666
|
+
[singleSegment, 2, 4, 8][descriptor >> 6];
|
|
9667
|
+
let hasData = false;
|
|
9668
|
+
for (let last = 0; !last; ) {
|
|
9669
|
+
const block = (await read(3)).readUIntLE(0, 3);
|
|
9670
|
+
last = block & 1;
|
|
9671
|
+
const type = block >> 1 & 3;
|
|
9672
|
+
const blockSize = block >> 3;
|
|
9673
|
+
if (blockSize > 0) hasData = true;
|
|
9674
|
+
pos += 3 + (type === 1 ? 1 : blockSize);
|
|
9675
|
+
}
|
|
9676
|
+
if (descriptor >> 2 & 1) pos += 4;
|
|
9677
|
+
if (hasData && frame > 0) throw new ArchiveError("multi-frame zstd");
|
|
9678
|
+
}
|
|
9679
|
+
if (pos !== size) throw new ArchiveError("truncated zstd frame");
|
|
9680
|
+
} finally {
|
|
9681
|
+
await fh.close();
|
|
9682
|
+
}
|
|
9683
|
+
}
|
|
9684
|
+
var TAR_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
9685
|
+
function tarEnv(env) {
|
|
9686
|
+
const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
|
|
9687
|
+
return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
|
|
9688
|
+
}
|
|
9689
|
+
async function runTar(archive, args) {
|
|
9690
|
+
const child = spawn2("tar", [...args, "-f", "-"], {
|
|
9691
|
+
env: tarEnv(process.env)
|
|
9692
|
+
});
|
|
9693
|
+
const exited = new Promise((res, rej) => {
|
|
9694
|
+
child.on("error", rej);
|
|
9695
|
+
child.on("close", res);
|
|
9696
|
+
});
|
|
9697
|
+
const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
|
|
9698
|
+
maxLines: MAX_LISTING_LINES,
|
|
9699
|
+
onOverflow: () => child.kill()
|
|
9700
|
+
});
|
|
9701
|
+
const stderr = collect(child.stderr, MAX_STDERR_BYTES);
|
|
9702
|
+
child.stdin?.on("error", () => {
|
|
9703
|
+
});
|
|
9704
|
+
const unreadLimit = new Error("unread limit");
|
|
9705
|
+
let unread = 0;
|
|
9706
|
+
const fed = pipeline(
|
|
9707
|
+
createReadStream(archive.path, { highWaterMark: CHUNK_BYTES }),
|
|
9708
|
+
archive.format === "zstd" ? zlib.createZstdDecompress({ chunkSize: CHUNK_BYTES }) : zlib.createGunzip({ chunkSize: CHUNK_BYTES }),
|
|
9709
|
+
new Writable({
|
|
9710
|
+
write(chunk, _encoding, done) {
|
|
9711
|
+
if (child.stdin?.writable) return void child.stdin.write(chunk, () => done());
|
|
9712
|
+
unread += chunk.length;
|
|
9713
|
+
done(unread > MAX_UNREAD_BYTES ? unreadLimit : null);
|
|
9714
|
+
},
|
|
9715
|
+
final(done) {
|
|
9716
|
+
child.stdin?.end();
|
|
9717
|
+
done();
|
|
9718
|
+
},
|
|
9719
|
+
destroy(err, done) {
|
|
9720
|
+
if (err) child.stdin?.destroy();
|
|
9721
|
+
done(err);
|
|
9722
|
+
}
|
|
9723
|
+
})
|
|
9724
|
+
).then(
|
|
9725
|
+
() => null,
|
|
9726
|
+
(err) => err
|
|
9727
|
+
);
|
|
9728
|
+
const [code, feedError] = await Promise.all([exited, fed]);
|
|
9729
|
+
if (stdout.overflowed()) {
|
|
9730
|
+
throw new Error(
|
|
9731
|
+
`tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
|
|
9732
|
+
);
|
|
9733
|
+
}
|
|
9734
|
+
if (feedError && feedError !== unreadLimit) throw feedError;
|
|
9735
|
+
if (code !== 0)
|
|
9736
|
+
throw new Error(`tar ${args.join(" ")} exited with code ${code}: ${stderr.text().trim()}`);
|
|
9737
|
+
return stdout.text();
|
|
9738
|
+
}
|
|
9559
9739
|
function normalizeTarMemberPath(memberPath) {
|
|
9560
9740
|
return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
|
|
9561
9741
|
}
|
|
9742
|
+
function isContainedPath(path14, windows = process.platform === "win32") {
|
|
9743
|
+
const slashed = path14.replace(/\\/g, "/");
|
|
9744
|
+
const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
|
|
9745
|
+
return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
|
|
9746
|
+
}
|
|
9562
9747
|
function isSafeTarMember(memberPath, destDir) {
|
|
9563
9748
|
const normalized = normalizeTarMemberPath(memberPath);
|
|
9564
|
-
if (!normalized
|
|
9565
|
-
if (normalized.startsWith("/") || /^[A-Za-z]:[\\/]/.test(normalized)) return false;
|
|
9566
|
-
const relative2 = posix2.normalize(normalized);
|
|
9567
|
-
if (relative2 === ".." || relative2.startsWith("../") || relative2.split("/").includes("..")) {
|
|
9568
|
-
return false;
|
|
9569
|
-
}
|
|
9749
|
+
if (!isContainedPath(normalized)) return false;
|
|
9570
9750
|
const root = resolve6(destDir);
|
|
9571
|
-
|
|
9572
|
-
return resolved === root || resolved.startsWith(root + sep2);
|
|
9751
|
+
return resolve6(destDir, normalized).startsWith(root + sep2);
|
|
9573
9752
|
}
|
|
9574
|
-
async function
|
|
9575
|
-
|
|
9576
|
-
|
|
9753
|
+
async function readListing(archive, args) {
|
|
9754
|
+
try {
|
|
9755
|
+
return await runTar(archive, args);
|
|
9756
|
+
} catch (err) {
|
|
9757
|
+
throw new ArchiveError(
|
|
9758
|
+
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
9759
|
+
);
|
|
9760
|
+
}
|
|
9577
9761
|
}
|
|
9578
|
-
function
|
|
9579
|
-
|
|
9580
|
-
return
|
|
9762
|
+
async function listTarMembers(archive) {
|
|
9763
|
+
const stdout = await readListing(archive, ["-t"]);
|
|
9764
|
+
return stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
9581
9765
|
}
|
|
9582
|
-
async function assertSafeMemberTypes(
|
|
9583
|
-
const
|
|
9766
|
+
async function assertSafeMemberTypes(archive) {
|
|
9767
|
+
const stdout = await readListing(archive, ["-tv"]);
|
|
9584
9768
|
for (const line of stdout.split("\n")) {
|
|
9585
9769
|
if (!line.trim()) continue;
|
|
9586
9770
|
const type = line[0];
|
|
@@ -9588,7 +9772,7 @@ async function assertSafeMemberTypes(tarPath) {
|
|
|
9588
9772
|
if (type === "l") {
|
|
9589
9773
|
const parts = line.split(" -> ");
|
|
9590
9774
|
const target = parts.length === 2 ? parts[1].trim() : "";
|
|
9591
|
-
if (parts.length !== 2 || !target ||
|
|
9775
|
+
if (parts.length !== 2 || !target || !isContainedPath(target)) {
|
|
9592
9776
|
throw new ArchiveError(
|
|
9593
9777
|
`Archive contains a symlink whose target could not be confirmed safe: "${line.trim()}".`
|
|
9594
9778
|
);
|
|
@@ -9600,15 +9784,8 @@ async function assertSafeMemberTypes(tarPath) {
|
|
|
9600
9784
|
);
|
|
9601
9785
|
}
|
|
9602
9786
|
}
|
|
9603
|
-
async function assertSafeArchive(
|
|
9604
|
-
|
|
9605
|
-
try {
|
|
9606
|
-
members = await listTarMembers(tarPath);
|
|
9607
|
-
} catch (err) {
|
|
9608
|
-
throw new ArchiveError(
|
|
9609
|
-
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
9610
|
-
);
|
|
9611
|
-
}
|
|
9787
|
+
async function assertSafeArchive(archive, destDir) {
|
|
9788
|
+
const members = await listTarMembers(archive);
|
|
9612
9789
|
if (members.length === 0) {
|
|
9613
9790
|
throw new ArchiveError("Archive is empty.");
|
|
9614
9791
|
}
|
|
@@ -9617,7 +9794,7 @@ async function assertSafeArchive(tarPath, destDir) {
|
|
|
9617
9794
|
throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
|
|
9618
9795
|
}
|
|
9619
9796
|
}
|
|
9620
|
-
await assertSafeMemberTypes(
|
|
9797
|
+
await assertSafeMemberTypes(archive);
|
|
9621
9798
|
}
|
|
9622
9799
|
async function resolveMember(destDir, expectedName) {
|
|
9623
9800
|
const entries = await readdir3(destDir);
|
|
@@ -9632,9 +9809,18 @@ async function resolveMember(destDir, expectedName) {
|
|
|
9632
9809
|
}
|
|
9633
9810
|
return join9(destDir, real[0]);
|
|
9634
9811
|
}
|
|
9635
|
-
async function
|
|
9636
|
-
|
|
9637
|
-
|
|
9812
|
+
async function safeExtractArchive(archivePath, destDir, expectedName) {
|
|
9813
|
+
let archive;
|
|
9814
|
+
try {
|
|
9815
|
+
archive = { path: archivePath, format: await sniffFormat(archivePath) };
|
|
9816
|
+
if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
|
|
9817
|
+
} catch (err) {
|
|
9818
|
+
throw new ArchiveError(
|
|
9819
|
+
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
9820
|
+
);
|
|
9821
|
+
}
|
|
9822
|
+
await assertSafeArchive(archive, destDir);
|
|
9823
|
+
await runTar(archive, ["-x", "-C", destDir]);
|
|
9638
9824
|
return resolveMember(destDir, expectedName);
|
|
9639
9825
|
}
|
|
9640
9826
|
|
|
@@ -9715,7 +9901,7 @@ function untrackArchive(archive) {
|
|
|
9715
9901
|
function sha256File(filePath) {
|
|
9716
9902
|
return new Promise((resolve9, reject) => {
|
|
9717
9903
|
const hash = createHash2("sha256");
|
|
9718
|
-
|
|
9904
|
+
createReadStream2(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve9(hash.digest("hex"))).on("error", reject);
|
|
9719
9905
|
});
|
|
9720
9906
|
}
|
|
9721
9907
|
function toolServerError(text) {
|
|
@@ -9741,15 +9927,15 @@ function uploadFailure(url, res, text, bytes) {
|
|
|
9741
9927
|
errorKind: "validation"
|
|
9742
9928
|
});
|
|
9743
9929
|
}
|
|
9744
|
-
async function uploadTar(tarPath, endpoint, signal) {
|
|
9930
|
+
async function uploadTar(tarPath, format, endpoint, signal) {
|
|
9745
9931
|
const { size } = await stat3(tarPath);
|
|
9746
9932
|
const init = {
|
|
9747
9933
|
method: "POST",
|
|
9748
9934
|
headers: {
|
|
9749
|
-
"content-type":
|
|
9935
|
+
"content-type": ARCHIVE_CONTENT_TYPES[format],
|
|
9750
9936
|
...endpoint.token ? { Authorization: `Bearer ${endpoint.token}` } : {}
|
|
9751
9937
|
},
|
|
9752
|
-
body:
|
|
9938
|
+
body: createReadStream2(tarPath),
|
|
9753
9939
|
duplex: "half",
|
|
9754
9940
|
signal
|
|
9755
9941
|
};
|
|
@@ -9766,12 +9952,13 @@ async function uploadTar(tarPath, endpoint, signal) {
|
|
|
9766
9952
|
return json.uploadId;
|
|
9767
9953
|
}
|
|
9768
9954
|
async function uploadFile(sourcePath, endpoint, signal) {
|
|
9955
|
+
const format = pickArchiveFormat(endpoint.formats);
|
|
9769
9956
|
const tarPath = path10.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
|
|
9770
9957
|
trackArchive(tarPath);
|
|
9771
9958
|
try {
|
|
9772
|
-
await
|
|
9959
|
+
await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
|
|
9773
9960
|
const contentHash = await sha256File(tarPath);
|
|
9774
|
-
return { uploadId: await uploadTar(tarPath, endpoint, signal), contentHash };
|
|
9961
|
+
return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
|
|
9775
9962
|
} finally {
|
|
9776
9963
|
untrackArchive(tarPath);
|
|
9777
9964
|
await rm2(tarPath, { force: true }).catch(() => {
|
|
@@ -10626,7 +10813,7 @@ function createToolsClient(options = {}) {
|
|
|
10626
10813
|
const { url, token } = await route();
|
|
10627
10814
|
return { url, token };
|
|
10628
10815
|
}
|
|
10629
|
-
async function
|
|
10816
|
+
async function fetchToolList(opts) {
|
|
10630
10817
|
opts?.signal?.throwIfAborted();
|
|
10631
10818
|
const { url, token } = await baseUrl();
|
|
10632
10819
|
const res = await doFetch(
|
|
@@ -10635,8 +10822,10 @@ function createToolsClient(options = {}) {
|
|
|
10635
10822
|
{ longRunning: false, carriesUpload: false }
|
|
10636
10823
|
);
|
|
10637
10824
|
if (!res.ok) throw new Error(`GET /tools failed: ${res.status} ${res.statusText}`);
|
|
10638
|
-
|
|
10639
|
-
|
|
10825
|
+
return await res.json();
|
|
10826
|
+
}
|
|
10827
|
+
async function fetchTools(opts) {
|
|
10828
|
+
return (await fetchToolList(opts)).tools;
|
|
10640
10829
|
}
|
|
10641
10830
|
async function fetchTool(name, opts) {
|
|
10642
10831
|
return findTool(await fetchTools(opts), name);
|
|
@@ -10645,7 +10834,7 @@ function createToolsClient(options = {}) {
|
|
|
10645
10834
|
opts?.signal?.throwIfAborted();
|
|
10646
10835
|
const { url, token, remote } = await route();
|
|
10647
10836
|
let finalArgs = canonicalToolArgs(name, args);
|
|
10648
|
-
const tools = await
|
|
10837
|
+
const { tools, uploadFormats } = await fetchToolList({ signal: opts?.signal });
|
|
10649
10838
|
const meta = findTool(tools, name);
|
|
10650
10839
|
const olderServer = meta !== null && !tools.some((t) => t.name === canonicalToolId(meta.name));
|
|
10651
10840
|
if (meta) {
|
|
@@ -10662,7 +10851,7 @@ function createToolsClient(options = {}) {
|
|
|
10662
10851
|
if (remote) assertRequiredPresent(meta, finalArgs);
|
|
10663
10852
|
finalArgs = await prepareFileInputs(meta.fileInputs, finalArgs ?? {}, {
|
|
10664
10853
|
includeContent: remote,
|
|
10665
|
-
uploadEndpoint: remote ? { url, token } : void 0,
|
|
10854
|
+
uploadEndpoint: remote ? { url, token, formats: uploadFormats } : void 0,
|
|
10666
10855
|
log: diagnose,
|
|
10667
10856
|
baselineDirs,
|
|
10668
10857
|
collectMembers: collectFlowMembers,
|
|
@@ -10959,7 +11148,7 @@ async function downloadAndExtractArchive(handle, data, dir) {
|
|
|
10959
11148
|
const tarball = join13(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
|
|
10960
11149
|
try {
|
|
10961
11150
|
await writeFile4(tarball, data);
|
|
10962
|
-
return await
|
|
11151
|
+
return await safeExtractArchive(tarball, dir, handle.filename);
|
|
10963
11152
|
} catch {
|
|
10964
11153
|
return null;
|
|
10965
11154
|
} finally {
|
|
@@ -11038,7 +11227,10 @@ async function materializeArtifacts(result, ctx) {
|
|
|
11038
11227
|
}
|
|
11039
11228
|
try {
|
|
11040
11229
|
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
11041
|
-
headers:
|
|
11230
|
+
headers: value.archive ? {
|
|
11231
|
+
...authHeaders3,
|
|
11232
|
+
Accept: ARCHIVE_FORMATS.map((f) => ARCHIVE_CONTENT_TYPES[f]).join(", ")
|
|
11233
|
+
} : authHeaders3,
|
|
11042
11234
|
signal: ctx.signal
|
|
11043
11235
|
});
|
|
11044
11236
|
if (!res.ok) return null;
|
package/dist/installer.mjs
CHANGED
|
@@ -106,9 +106,9 @@ var require_picocolors = __commonJS({
|
|
|
106
106
|
var argv = p.argv || [];
|
|
107
107
|
var env = p.env || {};
|
|
108
108
|
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
109
|
-
var formatter = (
|
|
110
|
-
let string = "" + input, index = string.indexOf(close,
|
|
111
|
-
return ~index ?
|
|
109
|
+
var formatter = (open2, close, replace = open2) => (input) => {
|
|
110
|
+
let string = "" + input, index = string.indexOf(close, open2.length);
|
|
111
|
+
return ~index ? open2 + replaceClose(string, close, replace, index) + close : open2 + string + close;
|
|
112
112
|
};
|
|
113
113
|
var replaceClose = (string, close, replace, index) => {
|
|
114
114
|
let result = "", cursor3 = 0;
|
|
@@ -16986,7 +16986,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
16986
16986
|
var SESSION_ID = randomUUID4();
|
|
16987
16987
|
function readCliVersion() {
|
|
16988
16988
|
if (true) {
|
|
16989
|
-
return "0.33.1-next.
|
|
16989
|
+
return "0.33.1-next.15";
|
|
16990
16990
|
}
|
|
16991
16991
|
return "0.0.0";
|
|
16992
16992
|
}
|
|
@@ -24165,7 +24165,7 @@ var LINK_FILE = path24.join(LINK_DIR, "link.json");
|
|
|
24165
24165
|
|
|
24166
24166
|
// ../argent-tools-client/src/file-inputs.ts
|
|
24167
24167
|
import { createHash as createHash4, randomUUID as randomUUID6 } from "node:crypto";
|
|
24168
|
-
import { createReadStream, rmSync as rmSync7 } from "node:fs";
|
|
24168
|
+
import { createReadStream as createReadStream2, rmSync as rmSync7 } from "node:fs";
|
|
24169
24169
|
import {
|
|
24170
24170
|
chmod as chmod3,
|
|
24171
24171
|
lstat,
|
|
@@ -24181,11 +24181,21 @@ import { constants, tmpdir } from "node:os";
|
|
|
24181
24181
|
import * as path25 from "node:path";
|
|
24182
24182
|
|
|
24183
24183
|
// ../archive/src/index.ts
|
|
24184
|
-
import {
|
|
24185
|
-
import {
|
|
24186
|
-
import {
|
|
24187
|
-
import {
|
|
24188
|
-
|
|
24184
|
+
import { spawn as spawn5 } from "node:child_process";
|
|
24185
|
+
import { once } from "node:events";
|
|
24186
|
+
import { createReadStream, createWriteStream } from "node:fs";
|
|
24187
|
+
import { open, rm, readdir as readdir3 } from "node:fs/promises";
|
|
24188
|
+
import { basename as basename4, dirname as dirname13, join as join24, resolve as resolve13, sep as sep4 } from "node:path";
|
|
24189
|
+
import { Writable } from "node:stream";
|
|
24190
|
+
import { pipeline } from "node:stream/promises";
|
|
24191
|
+
import zlib2 from "node:zlib";
|
|
24192
|
+
var ARCHIVE_FORMATS = typeof zlib2.createZstdCompress === "function" ? ["zstd", "gzip"] : ["gzip"];
|
|
24193
|
+
var CHUNK_BYTES = 1 << 20;
|
|
24194
|
+
var MAX_LISTING_BYTES = 32 << 20;
|
|
24195
|
+
var MAX_LISTING_LINES = 1 << 18;
|
|
24196
|
+
var MAX_STDERR_BYTES = 16 << 10;
|
|
24197
|
+
var MAX_UNREAD_BYTES = 16 << 20;
|
|
24198
|
+
var TAR_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
24189
24199
|
|
|
24190
24200
|
// ../argent-tools-client/src/file-inputs.ts
|
|
24191
24201
|
var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
|