@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/mcp-server.mjs
CHANGED
|
@@ -17450,7 +17450,7 @@ function handleIntersectionResults(result, left, right) {
|
|
|
17450
17450
|
const unrecKeys = /* @__PURE__ */ new Map();
|
|
17451
17451
|
let unrecIssue;
|
|
17452
17452
|
const keyIssues = /* @__PURE__ */ new Map();
|
|
17453
|
-
const
|
|
17453
|
+
const collect2 = (iss, side) => {
|
|
17454
17454
|
let keys;
|
|
17455
17455
|
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
17456
17456
|
unrecIssue ?? (unrecIssue = iss);
|
|
@@ -17471,11 +17471,11 @@ function handleIntersectionResults(result, left, right) {
|
|
|
17471
17471
|
return true;
|
|
17472
17472
|
};
|
|
17473
17473
|
for (const iss of left.issues) {
|
|
17474
|
-
if (!
|
|
17474
|
+
if (!collect2(iss, "l"))
|
|
17475
17475
|
result.issues.push(iss);
|
|
17476
17476
|
}
|
|
17477
17477
|
for (const iss of right.issues) {
|
|
17478
|
-
if (!
|
|
17478
|
+
if (!collect2(iss, "r"))
|
|
17479
17479
|
result.issues.push(iss);
|
|
17480
17480
|
}
|
|
17481
17481
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
@@ -24574,7 +24574,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
24574
24574
|
"error",
|
|
24575
24575
|
(err) => reject(
|
|
24576
24576
|
new Error(
|
|
24577
|
-
err.code === "ENOENT" && nodeBin === "node" ? "Could not start the argent tool-server: `node` was not found on PATH. Install Node.js
|
|
24577
|
+
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}`
|
|
24578
24578
|
)
|
|
24579
24579
|
)
|
|
24580
24580
|
);
|
|
@@ -26275,7 +26275,7 @@ async function getResolvedToolsUrl() {
|
|
|
26275
26275
|
|
|
26276
26276
|
// ../argent-tools-client/src/file-inputs.ts
|
|
26277
26277
|
import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
|
|
26278
|
-
import { createReadStream, rmSync as rmSync2 } from "node:fs";
|
|
26278
|
+
import { createReadStream as createReadStream2, rmSync as rmSync2 } from "node:fs";
|
|
26279
26279
|
import {
|
|
26280
26280
|
chmod as chmod3,
|
|
26281
26281
|
lstat,
|
|
@@ -26291,50 +26291,234 @@ import { constants, tmpdir } from "node:os";
|
|
|
26291
26291
|
import * as path10 from "node:path";
|
|
26292
26292
|
|
|
26293
26293
|
// ../archive/src/index.ts
|
|
26294
|
-
import {
|
|
26295
|
-
import {
|
|
26296
|
-
import {
|
|
26297
|
-
import {
|
|
26298
|
-
|
|
26294
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
26295
|
+
import { once } from "node:events";
|
|
26296
|
+
import { createReadStream, createWriteStream } from "node:fs";
|
|
26297
|
+
import { open as open2, rm, readdir as readdir3 } from "node:fs/promises";
|
|
26298
|
+
import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve6, sep as sep2 } from "node:path";
|
|
26299
|
+
import { Writable } from "node:stream";
|
|
26300
|
+
import { pipeline } from "node:stream/promises";
|
|
26301
|
+
import zlib from "node:zlib";
|
|
26299
26302
|
var ArchiveError = class extends Error {
|
|
26300
26303
|
};
|
|
26301
|
-
function
|
|
26302
|
-
|
|
26304
|
+
var ARCHIVE_FORMATS = typeof zlib.createZstdCompress === "function" ? ["zstd", "gzip"] : ["gzip"];
|
|
26305
|
+
var ARCHIVE_CONTENT_TYPES = {
|
|
26306
|
+
zstd: "application/zstd",
|
|
26307
|
+
gzip: "application/gzip"
|
|
26308
|
+
};
|
|
26309
|
+
function pickArchiveFormat(peerFormats) {
|
|
26310
|
+
return ARCHIVE_FORMATS.find((f) => peerFormats?.includes(f)) ?? "gzip";
|
|
26311
|
+
}
|
|
26312
|
+
var CHUNK_BYTES = 1 << 20;
|
|
26313
|
+
function createCompressor(format) {
|
|
26314
|
+
return format === "zstd" ? zlib.createZstdCompress({
|
|
26315
|
+
chunkSize: CHUNK_BYTES,
|
|
26316
|
+
// Lets the decoder detect corruption.
|
|
26317
|
+
params: { [zlib.constants.ZSTD_c_checksumFlag]: 1 }
|
|
26318
|
+
}) : zlib.createGzip({ chunkSize: CHUNK_BYTES });
|
|
26319
|
+
}
|
|
26320
|
+
function createTarArgs(sourcePath) {
|
|
26321
|
+
const name = basename4(sourcePath);
|
|
26322
|
+
return ["-cf", "-", "-C", dirname5(sourcePath), /^[-@]/.test(name) ? `./${name}` : name];
|
|
26323
|
+
}
|
|
26324
|
+
var MAX_LISTING_BYTES = 32 << 20;
|
|
26325
|
+
var MAX_LISTING_LINES = 1 << 18;
|
|
26326
|
+
var MAX_STDERR_BYTES = 16 << 10;
|
|
26327
|
+
var MAX_UNREAD_BYTES = 16 << 20;
|
|
26328
|
+
function collect(stream, maxBytes, { maxLines = Infinity, onOverflow } = {}) {
|
|
26329
|
+
const chunks = [];
|
|
26330
|
+
let bytes = 0;
|
|
26331
|
+
let lines = 0;
|
|
26332
|
+
let overflowed = false;
|
|
26333
|
+
stream?.on("data", (chunk) => {
|
|
26334
|
+
if (overflowed) return;
|
|
26335
|
+
chunks.push(chunk.subarray(0, maxBytes - bytes));
|
|
26336
|
+
bytes += chunk.length;
|
|
26337
|
+
for (let i = chunk.indexOf(10); i !== -1 && lines <= maxLines; i = chunk.indexOf(10, i + 1)) {
|
|
26338
|
+
lines++;
|
|
26339
|
+
}
|
|
26340
|
+
if (bytes > maxBytes || lines > maxLines) {
|
|
26341
|
+
overflowed = true;
|
|
26342
|
+
onOverflow?.();
|
|
26343
|
+
}
|
|
26344
|
+
});
|
|
26345
|
+
return {
|
|
26346
|
+
overflowed: () => overflowed,
|
|
26347
|
+
text: () => Buffer.concat(chunks).toString("utf8") + (overflowed ? "\u2026" : "")
|
|
26348
|
+
};
|
|
26303
26349
|
}
|
|
26304
|
-
async function
|
|
26350
|
+
async function createArchiveFile(sourcePath, archivePath, format, signal) {
|
|
26351
|
+
const out = createWriteStream(archivePath);
|
|
26352
|
+
await once(out, "ready");
|
|
26305
26353
|
try {
|
|
26306
|
-
await
|
|
26354
|
+
await archiveInto(out, sourcePath, format, signal);
|
|
26307
26355
|
} catch (err) {
|
|
26308
|
-
|
|
26356
|
+
out.destroy();
|
|
26357
|
+
await rm(archivePath, { force: true }).catch(() => {
|
|
26309
26358
|
});
|
|
26359
|
+
signal?.throwIfAborted();
|
|
26310
26360
|
throw err;
|
|
26311
26361
|
}
|
|
26312
26362
|
}
|
|
26363
|
+
async function archiveInto(out, sourcePath, format, signal) {
|
|
26364
|
+
const child = spawn2("tar", createTarArgs(sourcePath), {
|
|
26365
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
26366
|
+
signal
|
|
26367
|
+
});
|
|
26368
|
+
const exited = new Promise((res, rej) => {
|
|
26369
|
+
child.on("error", rej);
|
|
26370
|
+
child.on("close", res);
|
|
26371
|
+
});
|
|
26372
|
+
const stderr = collect(child.stderr, MAX_STDERR_BYTES);
|
|
26373
|
+
const [written, closed] = await Promise.allSettled([
|
|
26374
|
+
pipeline(child.stdout, createCompressor(format), out),
|
|
26375
|
+
exited
|
|
26376
|
+
]);
|
|
26377
|
+
if (closed.status === "rejected") throw closed.reason;
|
|
26378
|
+
if (written.status === "rejected") throw written.reason;
|
|
26379
|
+
if (closed.value !== 0) {
|
|
26380
|
+
throw new Error(`tar exited with code ${closed.value}: ${stderr.text().trim()}`);
|
|
26381
|
+
}
|
|
26382
|
+
}
|
|
26383
|
+
async function sniffFormat(archivePath) {
|
|
26384
|
+
const fh = await open2(archivePath, "r");
|
|
26385
|
+
try {
|
|
26386
|
+
const { buffer, bytesRead } = await fh.read(Buffer.alloc(4), 0, 4, 0);
|
|
26387
|
+
const magic = buffer.subarray(0, bytesRead).toString("hex");
|
|
26388
|
+
if (magic.startsWith("1f8b")) return "gzip";
|
|
26389
|
+
if (magic === "28b52ffd" && ARCHIVE_FORMATS.includes("zstd")) return "zstd";
|
|
26390
|
+
throw new ArchiveError("unrecognized compression");
|
|
26391
|
+
} finally {
|
|
26392
|
+
await fh.close();
|
|
26393
|
+
}
|
|
26394
|
+
}
|
|
26395
|
+
var ZSTD_FRAME_MAGIC = 4247762216;
|
|
26396
|
+
async function assertSingleCompleteZstdFrame(archivePath) {
|
|
26397
|
+
const fh = await open2(archivePath, "r");
|
|
26398
|
+
try {
|
|
26399
|
+
const { size } = await fh.stat();
|
|
26400
|
+
const window = Buffer.alloc(4096);
|
|
26401
|
+
let windowStart = 0;
|
|
26402
|
+
let windowEnd = 0;
|
|
26403
|
+
let pos = 0;
|
|
26404
|
+
const read = async (n) => {
|
|
26405
|
+
if (pos < windowStart || pos + n > windowEnd) {
|
|
26406
|
+
const { bytesRead } = await fh.read(window, 0, window.length, pos);
|
|
26407
|
+
windowStart = pos;
|
|
26408
|
+
windowEnd = pos + bytesRead;
|
|
26409
|
+
if (bytesRead < n) throw new ArchiveError("truncated zstd frame");
|
|
26410
|
+
}
|
|
26411
|
+
return window.subarray(pos - windowStart, pos - windowStart + n);
|
|
26412
|
+
};
|
|
26413
|
+
for (let frame = 0; pos < size; frame++) {
|
|
26414
|
+
const header = await read(5);
|
|
26415
|
+
if (header.readUInt32LE(0) !== ZSTD_FRAME_MAGIC) throw new ArchiveError("bad zstd frame");
|
|
26416
|
+
const descriptor = header[4];
|
|
26417
|
+
const singleSegment = descriptor >> 5 & 1;
|
|
26418
|
+
pos += 5 + (singleSegment ? 0 : 1) + // window descriptor
|
|
26419
|
+
[0, 1, 2, 4][descriptor & 3] + // dictionary id
|
|
26420
|
+
[singleSegment, 2, 4, 8][descriptor >> 6];
|
|
26421
|
+
let hasData = false;
|
|
26422
|
+
for (let last = 0; !last; ) {
|
|
26423
|
+
const block = (await read(3)).readUIntLE(0, 3);
|
|
26424
|
+
last = block & 1;
|
|
26425
|
+
const type = block >> 1 & 3;
|
|
26426
|
+
const blockSize = block >> 3;
|
|
26427
|
+
if (blockSize > 0) hasData = true;
|
|
26428
|
+
pos += 3 + (type === 1 ? 1 : blockSize);
|
|
26429
|
+
}
|
|
26430
|
+
if (descriptor >> 2 & 1) pos += 4;
|
|
26431
|
+
if (hasData && frame > 0) throw new ArchiveError("multi-frame zstd");
|
|
26432
|
+
}
|
|
26433
|
+
if (pos !== size) throw new ArchiveError("truncated zstd frame");
|
|
26434
|
+
} finally {
|
|
26435
|
+
await fh.close();
|
|
26436
|
+
}
|
|
26437
|
+
}
|
|
26438
|
+
var TAR_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
26439
|
+
function tarEnv(env) {
|
|
26440
|
+
const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
|
|
26441
|
+
return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
|
|
26442
|
+
}
|
|
26443
|
+
async function runTar(archive, args) {
|
|
26444
|
+
const child = spawn2("tar", [...args, "-f", "-"], {
|
|
26445
|
+
env: tarEnv(process.env)
|
|
26446
|
+
});
|
|
26447
|
+
const exited = new Promise((res, rej) => {
|
|
26448
|
+
child.on("error", rej);
|
|
26449
|
+
child.on("close", res);
|
|
26450
|
+
});
|
|
26451
|
+
const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
|
|
26452
|
+
maxLines: MAX_LISTING_LINES,
|
|
26453
|
+
onOverflow: () => child.kill()
|
|
26454
|
+
});
|
|
26455
|
+
const stderr = collect(child.stderr, MAX_STDERR_BYTES);
|
|
26456
|
+
child.stdin?.on("error", () => {
|
|
26457
|
+
});
|
|
26458
|
+
const unreadLimit = new Error("unread limit");
|
|
26459
|
+
let unread = 0;
|
|
26460
|
+
const fed = pipeline(
|
|
26461
|
+
createReadStream(archive.path, { highWaterMark: CHUNK_BYTES }),
|
|
26462
|
+
archive.format === "zstd" ? zlib.createZstdDecompress({ chunkSize: CHUNK_BYTES }) : zlib.createGunzip({ chunkSize: CHUNK_BYTES }),
|
|
26463
|
+
new Writable({
|
|
26464
|
+
write(chunk, _encoding, done) {
|
|
26465
|
+
if (child.stdin?.writable) return void child.stdin.write(chunk, () => done());
|
|
26466
|
+
unread += chunk.length;
|
|
26467
|
+
done(unread > MAX_UNREAD_BYTES ? unreadLimit : null);
|
|
26468
|
+
},
|
|
26469
|
+
final(done) {
|
|
26470
|
+
child.stdin?.end();
|
|
26471
|
+
done();
|
|
26472
|
+
},
|
|
26473
|
+
destroy(err, done) {
|
|
26474
|
+
if (err) child.stdin?.destroy();
|
|
26475
|
+
done(err);
|
|
26476
|
+
}
|
|
26477
|
+
})
|
|
26478
|
+
).then(
|
|
26479
|
+
() => null,
|
|
26480
|
+
(err) => err
|
|
26481
|
+
);
|
|
26482
|
+
const [code, feedError] = await Promise.all([exited, fed]);
|
|
26483
|
+
if (stdout.overflowed()) {
|
|
26484
|
+
throw new Error(
|
|
26485
|
+
`tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
|
|
26486
|
+
);
|
|
26487
|
+
}
|
|
26488
|
+
if (feedError && feedError !== unreadLimit) throw feedError;
|
|
26489
|
+
if (code !== 0)
|
|
26490
|
+
throw new Error(`tar ${args.join(" ")} exited with code ${code}: ${stderr.text().trim()}`);
|
|
26491
|
+
return stdout.text();
|
|
26492
|
+
}
|
|
26313
26493
|
function normalizeTarMemberPath(memberPath) {
|
|
26314
26494
|
return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
|
|
26315
26495
|
}
|
|
26496
|
+
function isContainedPath(path17, windows = process.platform === "win32") {
|
|
26497
|
+
const slashed = path17.replace(/\\/g, "/");
|
|
26498
|
+
const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
|
|
26499
|
+
return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
|
|
26500
|
+
}
|
|
26316
26501
|
function isSafeTarMember(memberPath, destDir) {
|
|
26317
26502
|
const normalized = normalizeTarMemberPath(memberPath);
|
|
26318
|
-
if (!normalized
|
|
26319
|
-
if (normalized.startsWith("/") || /^[A-Za-z]:[\\/]/.test(normalized)) return false;
|
|
26320
|
-
const relative2 = posix2.normalize(normalized);
|
|
26321
|
-
if (relative2 === ".." || relative2.startsWith("../") || relative2.split("/").includes("..")) {
|
|
26322
|
-
return false;
|
|
26323
|
-
}
|
|
26503
|
+
if (!isContainedPath(normalized)) return false;
|
|
26324
26504
|
const root = resolve6(destDir);
|
|
26325
|
-
|
|
26326
|
-
return resolved === root || resolved.startsWith(root + sep2);
|
|
26505
|
+
return resolve6(destDir, normalized).startsWith(root + sep2);
|
|
26327
26506
|
}
|
|
26328
|
-
async function
|
|
26329
|
-
|
|
26330
|
-
|
|
26507
|
+
async function readListing(archive, args) {
|
|
26508
|
+
try {
|
|
26509
|
+
return await runTar(archive, args);
|
|
26510
|
+
} catch (err) {
|
|
26511
|
+
throw new ArchiveError(
|
|
26512
|
+
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
26513
|
+
);
|
|
26514
|
+
}
|
|
26331
26515
|
}
|
|
26332
|
-
function
|
|
26333
|
-
|
|
26334
|
-
return
|
|
26516
|
+
async function listTarMembers(archive) {
|
|
26517
|
+
const stdout = await readListing(archive, ["-t"]);
|
|
26518
|
+
return stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
26335
26519
|
}
|
|
26336
|
-
async function assertSafeMemberTypes(
|
|
26337
|
-
const
|
|
26520
|
+
async function assertSafeMemberTypes(archive) {
|
|
26521
|
+
const stdout = await readListing(archive, ["-tv"]);
|
|
26338
26522
|
for (const line of stdout.split("\n")) {
|
|
26339
26523
|
if (!line.trim()) continue;
|
|
26340
26524
|
const type = line[0];
|
|
@@ -26342,7 +26526,7 @@ async function assertSafeMemberTypes(tarPath) {
|
|
|
26342
26526
|
if (type === "l") {
|
|
26343
26527
|
const parts = line.split(" -> ");
|
|
26344
26528
|
const target = parts.length === 2 ? parts[1].trim() : "";
|
|
26345
|
-
if (parts.length !== 2 || !target ||
|
|
26529
|
+
if (parts.length !== 2 || !target || !isContainedPath(target)) {
|
|
26346
26530
|
throw new ArchiveError(
|
|
26347
26531
|
`Archive contains a symlink whose target could not be confirmed safe: "${line.trim()}".`
|
|
26348
26532
|
);
|
|
@@ -26354,15 +26538,8 @@ async function assertSafeMemberTypes(tarPath) {
|
|
|
26354
26538
|
);
|
|
26355
26539
|
}
|
|
26356
26540
|
}
|
|
26357
|
-
async function assertSafeArchive(
|
|
26358
|
-
|
|
26359
|
-
try {
|
|
26360
|
-
members2 = await listTarMembers(tarPath);
|
|
26361
|
-
} catch (err) {
|
|
26362
|
-
throw new ArchiveError(
|
|
26363
|
-
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
26364
|
-
);
|
|
26365
|
-
}
|
|
26541
|
+
async function assertSafeArchive(archive, destDir) {
|
|
26542
|
+
const members2 = await listTarMembers(archive);
|
|
26366
26543
|
if (members2.length === 0) {
|
|
26367
26544
|
throw new ArchiveError("Archive is empty.");
|
|
26368
26545
|
}
|
|
@@ -26371,7 +26548,7 @@ async function assertSafeArchive(tarPath, destDir) {
|
|
|
26371
26548
|
throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
|
|
26372
26549
|
}
|
|
26373
26550
|
}
|
|
26374
|
-
await assertSafeMemberTypes(
|
|
26551
|
+
await assertSafeMemberTypes(archive);
|
|
26375
26552
|
}
|
|
26376
26553
|
async function resolveMember(destDir, expectedName) {
|
|
26377
26554
|
const entries = await readdir3(destDir);
|
|
@@ -26386,9 +26563,18 @@ async function resolveMember(destDir, expectedName) {
|
|
|
26386
26563
|
}
|
|
26387
26564
|
return join9(destDir, real[0]);
|
|
26388
26565
|
}
|
|
26389
|
-
async function
|
|
26390
|
-
|
|
26391
|
-
|
|
26566
|
+
async function safeExtractArchive(archivePath, destDir, expectedName) {
|
|
26567
|
+
let archive;
|
|
26568
|
+
try {
|
|
26569
|
+
archive = { path: archivePath, format: await sniffFormat(archivePath) };
|
|
26570
|
+
if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
|
|
26571
|
+
} catch (err) {
|
|
26572
|
+
throw new ArchiveError(
|
|
26573
|
+
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
26574
|
+
);
|
|
26575
|
+
}
|
|
26576
|
+
await assertSafeArchive(archive, destDir);
|
|
26577
|
+
await runTar(archive, ["-x", "-C", destDir]);
|
|
26392
26578
|
return resolveMember(destDir, expectedName);
|
|
26393
26579
|
}
|
|
26394
26580
|
|
|
@@ -26469,7 +26655,7 @@ function untrackArchive(archive) {
|
|
|
26469
26655
|
function sha256File(filePath) {
|
|
26470
26656
|
return new Promise((resolve10, reject) => {
|
|
26471
26657
|
const hash = createHash2("sha256");
|
|
26472
|
-
|
|
26658
|
+
createReadStream2(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve10(hash.digest("hex"))).on("error", reject);
|
|
26473
26659
|
});
|
|
26474
26660
|
}
|
|
26475
26661
|
function toolServerError(text) {
|
|
@@ -26495,15 +26681,15 @@ function uploadFailure(url, res, text, bytes) {
|
|
|
26495
26681
|
errorKind: "validation"
|
|
26496
26682
|
});
|
|
26497
26683
|
}
|
|
26498
|
-
async function uploadTar(tarPath, endpoint, signal) {
|
|
26684
|
+
async function uploadTar(tarPath, format, endpoint, signal) {
|
|
26499
26685
|
const { size } = await stat3(tarPath);
|
|
26500
26686
|
const init = {
|
|
26501
26687
|
method: "POST",
|
|
26502
26688
|
headers: {
|
|
26503
|
-
"content-type":
|
|
26689
|
+
"content-type": ARCHIVE_CONTENT_TYPES[format],
|
|
26504
26690
|
...endpoint.token ? { Authorization: `Bearer ${endpoint.token}` } : {}
|
|
26505
26691
|
},
|
|
26506
|
-
body:
|
|
26692
|
+
body: createReadStream2(tarPath),
|
|
26507
26693
|
duplex: "half",
|
|
26508
26694
|
signal
|
|
26509
26695
|
};
|
|
@@ -26520,12 +26706,13 @@ async function uploadTar(tarPath, endpoint, signal) {
|
|
|
26520
26706
|
return json.uploadId;
|
|
26521
26707
|
}
|
|
26522
26708
|
async function uploadFile(sourcePath, endpoint, signal) {
|
|
26709
|
+
const format = pickArchiveFormat(endpoint.formats);
|
|
26523
26710
|
const tarPath = path10.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
|
|
26524
26711
|
trackArchive(tarPath);
|
|
26525
26712
|
try {
|
|
26526
|
-
await
|
|
26713
|
+
await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
|
|
26527
26714
|
const contentHash = await sha256File(tarPath);
|
|
26528
|
-
return { uploadId: await uploadTar(tarPath, endpoint, signal), contentHash };
|
|
26715
|
+
return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
|
|
26529
26716
|
} finally {
|
|
26530
26717
|
untrackArchive(tarPath);
|
|
26531
26718
|
await rm2(tarPath, { force: true }).catch(() => {
|
|
@@ -27380,7 +27567,7 @@ function createToolsClient(options = {}) {
|
|
|
27380
27567
|
const { url, token } = await route();
|
|
27381
27568
|
return { url, token };
|
|
27382
27569
|
}
|
|
27383
|
-
async function
|
|
27570
|
+
async function fetchToolList(opts) {
|
|
27384
27571
|
opts?.signal?.throwIfAborted();
|
|
27385
27572
|
const { url, token } = await baseUrl();
|
|
27386
27573
|
const res = await doFetch(
|
|
@@ -27389,8 +27576,10 @@ function createToolsClient(options = {}) {
|
|
|
27389
27576
|
{ longRunning: false, carriesUpload: false }
|
|
27390
27577
|
);
|
|
27391
27578
|
if (!res.ok) throw new Error(`GET /tools failed: ${res.status} ${res.statusText}`);
|
|
27392
|
-
|
|
27393
|
-
|
|
27579
|
+
return await res.json();
|
|
27580
|
+
}
|
|
27581
|
+
async function fetchTools(opts) {
|
|
27582
|
+
return (await fetchToolList(opts)).tools;
|
|
27394
27583
|
}
|
|
27395
27584
|
async function fetchTool(name, opts) {
|
|
27396
27585
|
return findTool(await fetchTools(opts), name);
|
|
@@ -27399,7 +27588,7 @@ function createToolsClient(options = {}) {
|
|
|
27399
27588
|
opts?.signal?.throwIfAborted();
|
|
27400
27589
|
const { url, token, remote } = await route();
|
|
27401
27590
|
let finalArgs = canonicalToolArgs(name, args);
|
|
27402
|
-
const tools = await
|
|
27591
|
+
const { tools, uploadFormats } = await fetchToolList({ signal: opts?.signal });
|
|
27403
27592
|
const meta2 = findTool(tools, name);
|
|
27404
27593
|
const olderServer = meta2 !== null && !tools.some((t) => t.name === canonicalToolId(meta2.name));
|
|
27405
27594
|
if (meta2) {
|
|
@@ -27416,7 +27605,7 @@ function createToolsClient(options = {}) {
|
|
|
27416
27605
|
if (remote) assertRequiredPresent(meta2, finalArgs);
|
|
27417
27606
|
finalArgs = await prepareFileInputs(meta2.fileInputs, finalArgs ?? {}, {
|
|
27418
27607
|
includeContent: remote,
|
|
27419
|
-
uploadEndpoint: remote ? { url, token } : void 0,
|
|
27608
|
+
uploadEndpoint: remote ? { url, token, formats: uploadFormats } : void 0,
|
|
27420
27609
|
log: diagnose,
|
|
27421
27610
|
baselineDirs,
|
|
27422
27611
|
collectMembers: collectFlowMembers,
|
|
@@ -27713,7 +27902,7 @@ async function downloadAndExtractArchive(handle, data, dir) {
|
|
|
27713
27902
|
const tarball = join13(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
|
|
27714
27903
|
try {
|
|
27715
27904
|
await writeFile4(tarball, data);
|
|
27716
|
-
return await
|
|
27905
|
+
return await safeExtractArchive(tarball, dir, handle.filename);
|
|
27717
27906
|
} catch {
|
|
27718
27907
|
return null;
|
|
27719
27908
|
} finally {
|
|
@@ -27792,7 +27981,10 @@ async function materializeArtifacts(result, ctx) {
|
|
|
27792
27981
|
}
|
|
27793
27982
|
try {
|
|
27794
27983
|
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
27795
|
-
headers:
|
|
27984
|
+
headers: value.archive ? {
|
|
27985
|
+
...authHeaders3,
|
|
27986
|
+
Accept: ARCHIVE_FORMATS.map((f) => ARCHIVE_CONTENT_TYPES[f]).join(", ")
|
|
27987
|
+
} : authHeaders3,
|
|
27796
27988
|
signal: ctx.signal
|
|
27797
27989
|
});
|
|
27798
27990
|
if (!res.ok) return null;
|
|
@@ -28541,7 +28733,7 @@ import * as fs8 from "node:fs";
|
|
|
28541
28733
|
import * as path14 from "node:path";
|
|
28542
28734
|
|
|
28543
28735
|
// ../telemetry/src/fingerprint.ts
|
|
28544
|
-
import { execFileSync as execFileSync2, spawn as
|
|
28736
|
+
import { execFileSync as execFileSync2, spawn as spawn3 } from "node:child_process";
|
|
28545
28737
|
|
|
28546
28738
|
// ../native-devtools-ios/src/index.ts
|
|
28547
28739
|
import * as path15 from "node:path";
|