@swmansion/argent 0.33.1-next.14 → 0.33.1-next.16
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 +260 -68
- package/dist/client.js +246 -54
- package/dist/installer.mjs +20 -10
- package/dist/mcp-server.mjs +250 -58
- package/dist/tool-server.cjs +689 -507
- package/package.json +1 -1
package/dist/cli-cmds.mjs
CHANGED
|
@@ -8794,9 +8794,9 @@ var require_picocolors = __commonJS({
|
|
|
8794
8794
|
var argv = p.argv || [];
|
|
8795
8795
|
var env = p.env || {};
|
|
8796
8796
|
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);
|
|
8797
|
-
var formatter = (
|
|
8798
|
-
let string4 = "" + input2, index = string4.indexOf(close,
|
|
8799
|
-
return ~index ?
|
|
8797
|
+
var formatter = (open3, close, replace = open3) => (input2) => {
|
|
8798
|
+
let string4 = "" + input2, index = string4.indexOf(close, open3.length);
|
|
8799
|
+
return ~index ? open3 + replaceClose(string4, close, replace, index) + close : open3 + string4 + close;
|
|
8800
8800
|
};
|
|
8801
8801
|
var replaceClose = (string4, close, replace, index) => {
|
|
8802
8802
|
let result = "", cursor3 = 0;
|
|
@@ -14904,7 +14904,7 @@ function handleIntersectionResults(result, left, right) {
|
|
|
14904
14904
|
const unrecKeys = /* @__PURE__ */ new Map();
|
|
14905
14905
|
let unrecIssue;
|
|
14906
14906
|
const keyIssues = /* @__PURE__ */ new Map();
|
|
14907
|
-
const
|
|
14907
|
+
const collect2 = (iss, side) => {
|
|
14908
14908
|
let keys;
|
|
14909
14909
|
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
14910
14910
|
unrecIssue ?? (unrecIssue = iss);
|
|
@@ -14925,11 +14925,11 @@ function handleIntersectionResults(result, left, right) {
|
|
|
14925
14925
|
return true;
|
|
14926
14926
|
};
|
|
14927
14927
|
for (const iss of left.issues) {
|
|
14928
|
-
if (!
|
|
14928
|
+
if (!collect2(iss, "l"))
|
|
14929
14929
|
result.issues.push(iss);
|
|
14930
14930
|
}
|
|
14931
14931
|
for (const iss of right.issues) {
|
|
14932
|
-
if (!
|
|
14932
|
+
if (!collect2(iss, "r"))
|
|
14933
14933
|
result.issues.push(iss);
|
|
14934
14934
|
}
|
|
14935
14935
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
@@ -30775,7 +30775,7 @@ function parseLinkTarget(input2) {
|
|
|
30775
30775
|
|
|
30776
30776
|
// ../argent-tools-client/src/file-inputs.ts
|
|
30777
30777
|
import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
|
|
30778
|
-
import { createReadStream, rmSync as rmSync2 } from "node:fs";
|
|
30778
|
+
import { createReadStream as createReadStream2, rmSync as rmSync2 } from "node:fs";
|
|
30779
30779
|
import {
|
|
30780
30780
|
chmod as chmod3,
|
|
30781
30781
|
lstat,
|
|
@@ -30791,50 +30791,234 @@ import { constants, tmpdir } from "node:os";
|
|
|
30791
30791
|
import * as path10 from "node:path";
|
|
30792
30792
|
|
|
30793
30793
|
// ../archive/src/index.ts
|
|
30794
|
-
import {
|
|
30795
|
-
import {
|
|
30796
|
-
import {
|
|
30797
|
-
import {
|
|
30798
|
-
|
|
30794
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
30795
|
+
import { once } from "node:events";
|
|
30796
|
+
import { createReadStream, createWriteStream } from "node:fs";
|
|
30797
|
+
import { open as open2, rm, readdir as readdir3 } from "node:fs/promises";
|
|
30798
|
+
import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve6, sep as sep2 } from "node:path";
|
|
30799
|
+
import { Writable } from "node:stream";
|
|
30800
|
+
import { pipeline } from "node:stream/promises";
|
|
30801
|
+
import zlib from "node:zlib";
|
|
30799
30802
|
var ArchiveError = class extends Error {
|
|
30800
30803
|
};
|
|
30801
|
-
function
|
|
30802
|
-
|
|
30804
|
+
var ARCHIVE_FORMATS = typeof zlib.createZstdCompress === "function" ? ["zstd", "gzip"] : ["gzip"];
|
|
30805
|
+
var ARCHIVE_CONTENT_TYPES = {
|
|
30806
|
+
zstd: "application/zstd",
|
|
30807
|
+
gzip: "application/gzip"
|
|
30808
|
+
};
|
|
30809
|
+
function pickArchiveFormat(peerFormats) {
|
|
30810
|
+
return ARCHIVE_FORMATS.find((f) => peerFormats?.includes(f)) ?? "gzip";
|
|
30811
|
+
}
|
|
30812
|
+
var CHUNK_BYTES = 1 << 20;
|
|
30813
|
+
function createCompressor(format) {
|
|
30814
|
+
return format === "zstd" ? zlib.createZstdCompress({
|
|
30815
|
+
chunkSize: CHUNK_BYTES,
|
|
30816
|
+
// Lets the decoder detect corruption.
|
|
30817
|
+
params: { [zlib.constants.ZSTD_c_checksumFlag]: 1 }
|
|
30818
|
+
}) : zlib.createGzip({ chunkSize: CHUNK_BYTES });
|
|
30819
|
+
}
|
|
30820
|
+
function createTarArgs(sourcePath) {
|
|
30821
|
+
const name = basename4(sourcePath);
|
|
30822
|
+
return ["-cf", "-", "-C", dirname5(sourcePath), /^[-@]/.test(name) ? `./${name}` : name];
|
|
30823
|
+
}
|
|
30824
|
+
var MAX_LISTING_BYTES = 32 << 20;
|
|
30825
|
+
var MAX_LISTING_LINES = 1 << 18;
|
|
30826
|
+
var MAX_STDERR_BYTES = 16 << 10;
|
|
30827
|
+
var MAX_UNREAD_BYTES = 16 << 20;
|
|
30828
|
+
function collect(stream, maxBytes, { maxLines = Infinity, onOverflow } = {}) {
|
|
30829
|
+
const chunks = [];
|
|
30830
|
+
let bytes = 0;
|
|
30831
|
+
let lines = 0;
|
|
30832
|
+
let overflowed = false;
|
|
30833
|
+
stream?.on("data", (chunk) => {
|
|
30834
|
+
if (overflowed) return;
|
|
30835
|
+
chunks.push(chunk.subarray(0, maxBytes - bytes));
|
|
30836
|
+
bytes += chunk.length;
|
|
30837
|
+
for (let i2 = chunk.indexOf(10); i2 !== -1 && lines <= maxLines; i2 = chunk.indexOf(10, i2 + 1)) {
|
|
30838
|
+
lines++;
|
|
30839
|
+
}
|
|
30840
|
+
if (bytes > maxBytes || lines > maxLines) {
|
|
30841
|
+
overflowed = true;
|
|
30842
|
+
onOverflow?.();
|
|
30843
|
+
}
|
|
30844
|
+
});
|
|
30845
|
+
return {
|
|
30846
|
+
overflowed: () => overflowed,
|
|
30847
|
+
text: () => Buffer.concat(chunks).toString("utf8") + (overflowed ? "\u2026" : "")
|
|
30848
|
+
};
|
|
30803
30849
|
}
|
|
30804
|
-
async function
|
|
30850
|
+
async function createArchiveFile(sourcePath, archivePath, format, signal) {
|
|
30851
|
+
const out = createWriteStream(archivePath);
|
|
30852
|
+
await once(out, "ready");
|
|
30805
30853
|
try {
|
|
30806
|
-
await
|
|
30854
|
+
await archiveInto(out, sourcePath, format, signal);
|
|
30807
30855
|
} catch (err) {
|
|
30808
|
-
|
|
30856
|
+
out.destroy();
|
|
30857
|
+
await rm(archivePath, { force: true }).catch(() => {
|
|
30809
30858
|
});
|
|
30859
|
+
signal?.throwIfAborted();
|
|
30810
30860
|
throw err;
|
|
30811
30861
|
}
|
|
30812
30862
|
}
|
|
30863
|
+
async function archiveInto(out, sourcePath, format, signal) {
|
|
30864
|
+
const child = spawn2("tar", createTarArgs(sourcePath), {
|
|
30865
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
30866
|
+
signal
|
|
30867
|
+
});
|
|
30868
|
+
const exited = new Promise((res, rej) => {
|
|
30869
|
+
child.on("error", rej);
|
|
30870
|
+
child.on("close", res);
|
|
30871
|
+
});
|
|
30872
|
+
const stderr = collect(child.stderr, MAX_STDERR_BYTES);
|
|
30873
|
+
const [written, closed] = await Promise.allSettled([
|
|
30874
|
+
pipeline(child.stdout, createCompressor(format), out),
|
|
30875
|
+
exited
|
|
30876
|
+
]);
|
|
30877
|
+
if (closed.status === "rejected") throw closed.reason;
|
|
30878
|
+
if (written.status === "rejected") throw written.reason;
|
|
30879
|
+
if (closed.value !== 0) {
|
|
30880
|
+
throw new Error(`tar exited with code ${closed.value}: ${stderr.text().trim()}`);
|
|
30881
|
+
}
|
|
30882
|
+
}
|
|
30883
|
+
async function sniffFormat(archivePath) {
|
|
30884
|
+
const fh = await open2(archivePath, "r");
|
|
30885
|
+
try {
|
|
30886
|
+
const { buffer, bytesRead } = await fh.read(Buffer.alloc(4), 0, 4, 0);
|
|
30887
|
+
const magic = buffer.subarray(0, bytesRead).toString("hex");
|
|
30888
|
+
if (magic.startsWith("1f8b")) return "gzip";
|
|
30889
|
+
if (magic === "28b52ffd" && ARCHIVE_FORMATS.includes("zstd")) return "zstd";
|
|
30890
|
+
throw new ArchiveError("unrecognized compression");
|
|
30891
|
+
} finally {
|
|
30892
|
+
await fh.close();
|
|
30893
|
+
}
|
|
30894
|
+
}
|
|
30895
|
+
var ZSTD_FRAME_MAGIC = 4247762216;
|
|
30896
|
+
async function assertSingleCompleteZstdFrame(archivePath) {
|
|
30897
|
+
const fh = await open2(archivePath, "r");
|
|
30898
|
+
try {
|
|
30899
|
+
const { size } = await fh.stat();
|
|
30900
|
+
const window2 = Buffer.alloc(4096);
|
|
30901
|
+
let windowStart = 0;
|
|
30902
|
+
let windowEnd = 0;
|
|
30903
|
+
let pos = 0;
|
|
30904
|
+
const read = async (n3) => {
|
|
30905
|
+
if (pos < windowStart || pos + n3 > windowEnd) {
|
|
30906
|
+
const { bytesRead } = await fh.read(window2, 0, window2.length, pos);
|
|
30907
|
+
windowStart = pos;
|
|
30908
|
+
windowEnd = pos + bytesRead;
|
|
30909
|
+
if (bytesRead < n3) throw new ArchiveError("truncated zstd frame");
|
|
30910
|
+
}
|
|
30911
|
+
return window2.subarray(pos - windowStart, pos - windowStart + n3);
|
|
30912
|
+
};
|
|
30913
|
+
for (let frame = 0; pos < size; frame++) {
|
|
30914
|
+
const header = await read(5);
|
|
30915
|
+
if (header.readUInt32LE(0) !== ZSTD_FRAME_MAGIC) throw new ArchiveError("bad zstd frame");
|
|
30916
|
+
const descriptor = header[4];
|
|
30917
|
+
const singleSegment = descriptor >> 5 & 1;
|
|
30918
|
+
pos += 5 + (singleSegment ? 0 : 1) + // window descriptor
|
|
30919
|
+
[0, 1, 2, 4][descriptor & 3] + // dictionary id
|
|
30920
|
+
[singleSegment, 2, 4, 8][descriptor >> 6];
|
|
30921
|
+
let hasData = false;
|
|
30922
|
+
for (let last = 0; !last; ) {
|
|
30923
|
+
const block2 = (await read(3)).readUIntLE(0, 3);
|
|
30924
|
+
last = block2 & 1;
|
|
30925
|
+
const type = block2 >> 1 & 3;
|
|
30926
|
+
const blockSize = block2 >> 3;
|
|
30927
|
+
if (blockSize > 0) hasData = true;
|
|
30928
|
+
pos += 3 + (type === 1 ? 1 : blockSize);
|
|
30929
|
+
}
|
|
30930
|
+
if (descriptor >> 2 & 1) pos += 4;
|
|
30931
|
+
if (hasData && frame > 0) throw new ArchiveError("multi-frame zstd");
|
|
30932
|
+
}
|
|
30933
|
+
if (pos !== size) throw new ArchiveError("truncated zstd frame");
|
|
30934
|
+
} finally {
|
|
30935
|
+
await fh.close();
|
|
30936
|
+
}
|
|
30937
|
+
}
|
|
30938
|
+
var TAR_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
30939
|
+
function tarEnv(env) {
|
|
30940
|
+
const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
|
|
30941
|
+
return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
|
|
30942
|
+
}
|
|
30943
|
+
async function runTar(archive, args) {
|
|
30944
|
+
const child = spawn2("tar", [...args, "-f", "-"], {
|
|
30945
|
+
env: tarEnv(process.env)
|
|
30946
|
+
});
|
|
30947
|
+
const exited = new Promise((res, rej) => {
|
|
30948
|
+
child.on("error", rej);
|
|
30949
|
+
child.on("close", res);
|
|
30950
|
+
});
|
|
30951
|
+
const stdout2 = collect(child.stdout, MAX_LISTING_BYTES, {
|
|
30952
|
+
maxLines: MAX_LISTING_LINES,
|
|
30953
|
+
onOverflow: () => child.kill()
|
|
30954
|
+
});
|
|
30955
|
+
const stderr = collect(child.stderr, MAX_STDERR_BYTES);
|
|
30956
|
+
child.stdin?.on("error", () => {
|
|
30957
|
+
});
|
|
30958
|
+
const unreadLimit = new Error("unread limit");
|
|
30959
|
+
let unread = 0;
|
|
30960
|
+
const fed = pipeline(
|
|
30961
|
+
createReadStream(archive.path, { highWaterMark: CHUNK_BYTES }),
|
|
30962
|
+
archive.format === "zstd" ? zlib.createZstdDecompress({ chunkSize: CHUNK_BYTES }) : zlib.createGunzip({ chunkSize: CHUNK_BYTES }),
|
|
30963
|
+
new Writable({
|
|
30964
|
+
write(chunk, _encoding, done) {
|
|
30965
|
+
if (child.stdin?.writable) return void child.stdin.write(chunk, () => done());
|
|
30966
|
+
unread += chunk.length;
|
|
30967
|
+
done(unread > MAX_UNREAD_BYTES ? unreadLimit : null);
|
|
30968
|
+
},
|
|
30969
|
+
final(done) {
|
|
30970
|
+
child.stdin?.end();
|
|
30971
|
+
done();
|
|
30972
|
+
},
|
|
30973
|
+
destroy(err, done) {
|
|
30974
|
+
if (err) child.stdin?.destroy();
|
|
30975
|
+
done(err);
|
|
30976
|
+
}
|
|
30977
|
+
})
|
|
30978
|
+
).then(
|
|
30979
|
+
() => null,
|
|
30980
|
+
(err) => err
|
|
30981
|
+
);
|
|
30982
|
+
const [code, feedError] = await Promise.all([exited, fed]);
|
|
30983
|
+
if (stdout2.overflowed()) {
|
|
30984
|
+
throw new Error(
|
|
30985
|
+
`tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
|
|
30986
|
+
);
|
|
30987
|
+
}
|
|
30988
|
+
if (feedError && feedError !== unreadLimit) throw feedError;
|
|
30989
|
+
if (code !== 0)
|
|
30990
|
+
throw new Error(`tar ${args.join(" ")} exited with code ${code}: ${stderr.text().trim()}`);
|
|
30991
|
+
return stdout2.text();
|
|
30992
|
+
}
|
|
30813
30993
|
function normalizeTarMemberPath(memberPath) {
|
|
30814
30994
|
return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
|
|
30815
30995
|
}
|
|
30996
|
+
function isContainedPath(path25, windows = process.platform === "win32") {
|
|
30997
|
+
const slashed = path25.replace(/\\/g, "/");
|
|
30998
|
+
const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
|
|
30999
|
+
return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
|
|
31000
|
+
}
|
|
30816
31001
|
function isSafeTarMember(memberPath, destDir) {
|
|
30817
31002
|
const normalized = normalizeTarMemberPath(memberPath);
|
|
30818
|
-
if (!normalized
|
|
30819
|
-
if (normalized.startsWith("/") || /^[A-Za-z]:[\\/]/.test(normalized)) return false;
|
|
30820
|
-
const relative3 = posix2.normalize(normalized);
|
|
30821
|
-
if (relative3 === ".." || relative3.startsWith("../") || relative3.split("/").includes("..")) {
|
|
30822
|
-
return false;
|
|
30823
|
-
}
|
|
31003
|
+
if (!isContainedPath(normalized)) return false;
|
|
30824
31004
|
const root = resolve6(destDir);
|
|
30825
|
-
|
|
30826
|
-
return resolved === root || resolved.startsWith(root + sep2);
|
|
31005
|
+
return resolve6(destDir, normalized).startsWith(root + sep2);
|
|
30827
31006
|
}
|
|
30828
|
-
async function
|
|
30829
|
-
|
|
30830
|
-
|
|
31007
|
+
async function readListing(archive, args) {
|
|
31008
|
+
try {
|
|
31009
|
+
return await runTar(archive, args);
|
|
31010
|
+
} catch (err) {
|
|
31011
|
+
throw new ArchiveError(
|
|
31012
|
+
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
31013
|
+
);
|
|
31014
|
+
}
|
|
30831
31015
|
}
|
|
30832
|
-
function
|
|
30833
|
-
|
|
30834
|
-
return
|
|
31016
|
+
async function listTarMembers(archive) {
|
|
31017
|
+
const stdout2 = await readListing(archive, ["-t"]);
|
|
31018
|
+
return stdout2.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
30835
31019
|
}
|
|
30836
|
-
async function assertSafeMemberTypes(
|
|
30837
|
-
const
|
|
31020
|
+
async function assertSafeMemberTypes(archive) {
|
|
31021
|
+
const stdout2 = await readListing(archive, ["-tv"]);
|
|
30838
31022
|
for (const line of stdout2.split("\n")) {
|
|
30839
31023
|
if (!line.trim()) continue;
|
|
30840
31024
|
const type = line[0];
|
|
@@ -30842,7 +31026,7 @@ async function assertSafeMemberTypes(tarPath) {
|
|
|
30842
31026
|
if (type === "l") {
|
|
30843
31027
|
const parts = line.split(" -> ");
|
|
30844
31028
|
const target = parts.length === 2 ? parts[1].trim() : "";
|
|
30845
|
-
if (parts.length !== 2 || !target ||
|
|
31029
|
+
if (parts.length !== 2 || !target || !isContainedPath(target)) {
|
|
30846
31030
|
throw new ArchiveError(
|
|
30847
31031
|
`Archive contains a symlink whose target could not be confirmed safe: "${line.trim()}".`
|
|
30848
31032
|
);
|
|
@@ -30854,15 +31038,8 @@ async function assertSafeMemberTypes(tarPath) {
|
|
|
30854
31038
|
);
|
|
30855
31039
|
}
|
|
30856
31040
|
}
|
|
30857
|
-
async function assertSafeArchive(
|
|
30858
|
-
|
|
30859
|
-
try {
|
|
30860
|
-
members2 = await listTarMembers(tarPath);
|
|
30861
|
-
} catch (err) {
|
|
30862
|
-
throw new ArchiveError(
|
|
30863
|
-
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
30864
|
-
);
|
|
30865
|
-
}
|
|
31041
|
+
async function assertSafeArchive(archive, destDir) {
|
|
31042
|
+
const members2 = await listTarMembers(archive);
|
|
30866
31043
|
if (members2.length === 0) {
|
|
30867
31044
|
throw new ArchiveError("Archive is empty.");
|
|
30868
31045
|
}
|
|
@@ -30871,7 +31048,7 @@ async function assertSafeArchive(tarPath, destDir) {
|
|
|
30871
31048
|
throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
|
|
30872
31049
|
}
|
|
30873
31050
|
}
|
|
30874
|
-
await assertSafeMemberTypes(
|
|
31051
|
+
await assertSafeMemberTypes(archive);
|
|
30875
31052
|
}
|
|
30876
31053
|
async function resolveMember(destDir, expectedName) {
|
|
30877
31054
|
const entries = await readdir3(destDir);
|
|
@@ -30886,9 +31063,18 @@ async function resolveMember(destDir, expectedName) {
|
|
|
30886
31063
|
}
|
|
30887
31064
|
return join9(destDir, real[0]);
|
|
30888
31065
|
}
|
|
30889
|
-
async function
|
|
30890
|
-
|
|
30891
|
-
|
|
31066
|
+
async function safeExtractArchive(archivePath, destDir, expectedName) {
|
|
31067
|
+
let archive;
|
|
31068
|
+
try {
|
|
31069
|
+
archive = { path: archivePath, format: await sniffFormat(archivePath) };
|
|
31070
|
+
if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
|
|
31071
|
+
} catch (err) {
|
|
31072
|
+
throw new ArchiveError(
|
|
31073
|
+
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
31074
|
+
);
|
|
31075
|
+
}
|
|
31076
|
+
await assertSafeArchive(archive, destDir);
|
|
31077
|
+
await runTar(archive, ["-x", "-C", destDir]);
|
|
30892
31078
|
return resolveMember(destDir, expectedName);
|
|
30893
31079
|
}
|
|
30894
31080
|
|
|
@@ -30969,7 +31155,7 @@ function untrackArchive(archive) {
|
|
|
30969
31155
|
function sha256File(filePath) {
|
|
30970
31156
|
return new Promise((resolve13, reject) => {
|
|
30971
31157
|
const hash2 = createHash2("sha256");
|
|
30972
|
-
|
|
31158
|
+
createReadStream2(filePath).on("data", (chunk) => hash2.update(chunk)).on("end", () => resolve13(hash2.digest("hex"))).on("error", reject);
|
|
30973
31159
|
});
|
|
30974
31160
|
}
|
|
30975
31161
|
function toolServerError(text2) {
|
|
@@ -30995,15 +31181,15 @@ function uploadFailure(url2, res, text2, bytes) {
|
|
|
30995
31181
|
errorKind: "validation"
|
|
30996
31182
|
});
|
|
30997
31183
|
}
|
|
30998
|
-
async function uploadTar(tarPath, endpoint, signal) {
|
|
31184
|
+
async function uploadTar(tarPath, format, endpoint, signal) {
|
|
30999
31185
|
const { size } = await stat3(tarPath);
|
|
31000
31186
|
const init2 = {
|
|
31001
31187
|
method: "POST",
|
|
31002
31188
|
headers: {
|
|
31003
|
-
"content-type":
|
|
31189
|
+
"content-type": ARCHIVE_CONTENT_TYPES[format],
|
|
31004
31190
|
...endpoint.token ? { Authorization: `Bearer ${endpoint.token}` } : {}
|
|
31005
31191
|
},
|
|
31006
|
-
body:
|
|
31192
|
+
body: createReadStream2(tarPath),
|
|
31007
31193
|
duplex: "half",
|
|
31008
31194
|
signal
|
|
31009
31195
|
};
|
|
@@ -31020,12 +31206,13 @@ async function uploadTar(tarPath, endpoint, signal) {
|
|
|
31020
31206
|
return json2.uploadId;
|
|
31021
31207
|
}
|
|
31022
31208
|
async function uploadFile(sourcePath, endpoint, signal) {
|
|
31209
|
+
const format = pickArchiveFormat(endpoint.formats);
|
|
31023
31210
|
const tarPath = path10.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
|
|
31024
31211
|
trackArchive(tarPath);
|
|
31025
31212
|
try {
|
|
31026
|
-
await
|
|
31213
|
+
await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
|
|
31027
31214
|
const contentHash = await sha256File(tarPath);
|
|
31028
|
-
return { uploadId: await uploadTar(tarPath, endpoint, signal), contentHash };
|
|
31215
|
+
return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
|
|
31029
31216
|
} finally {
|
|
31030
31217
|
untrackArchive(tarPath);
|
|
31031
31218
|
await rm2(tarPath, { force: true }).catch(() => {
|
|
@@ -31880,7 +32067,7 @@ function createToolsClient(options = {}) {
|
|
|
31880
32067
|
const { url: url2, token } = await route();
|
|
31881
32068
|
return { url: url2, token };
|
|
31882
32069
|
}
|
|
31883
|
-
async function
|
|
32070
|
+
async function fetchToolList(opts) {
|
|
31884
32071
|
opts?.signal?.throwIfAborted();
|
|
31885
32072
|
const { url: url2, token } = await baseUrl();
|
|
31886
32073
|
const res = await doFetch(
|
|
@@ -31889,8 +32076,10 @@ function createToolsClient(options = {}) {
|
|
|
31889
32076
|
{ longRunning: false, carriesUpload: false }
|
|
31890
32077
|
);
|
|
31891
32078
|
if (!res.ok) throw new Error(`GET /tools failed: ${res.status} ${res.statusText}`);
|
|
31892
|
-
|
|
31893
|
-
|
|
32079
|
+
return await res.json();
|
|
32080
|
+
}
|
|
32081
|
+
async function fetchTools(opts) {
|
|
32082
|
+
return (await fetchToolList(opts)).tools;
|
|
31894
32083
|
}
|
|
31895
32084
|
async function fetchTool(name, opts) {
|
|
31896
32085
|
return findTool(await fetchTools(opts), name);
|
|
@@ -31899,7 +32088,7 @@ function createToolsClient(options = {}) {
|
|
|
31899
32088
|
opts?.signal?.throwIfAborted();
|
|
31900
32089
|
const { url: url2, token, remote } = await route();
|
|
31901
32090
|
let finalArgs = canonicalToolArgs(name, args);
|
|
31902
|
-
const tools2 = await
|
|
32091
|
+
const { tools: tools2, uploadFormats } = await fetchToolList({ signal: opts?.signal });
|
|
31903
32092
|
const meta3 = findTool(tools2, name);
|
|
31904
32093
|
const olderServer = meta3 !== null && !tools2.some((t2) => t2.name === canonicalToolId(meta3.name));
|
|
31905
32094
|
if (meta3) {
|
|
@@ -31916,7 +32105,7 @@ function createToolsClient(options = {}) {
|
|
|
31916
32105
|
if (remote) assertRequiredPresent(meta3, finalArgs);
|
|
31917
32106
|
finalArgs = await prepareFileInputs(meta3.fileInputs, finalArgs ?? {}, {
|
|
31918
32107
|
includeContent: remote,
|
|
31919
|
-
uploadEndpoint: remote ? { url: url2, token } : void 0,
|
|
32108
|
+
uploadEndpoint: remote ? { url: url2, token, formats: uploadFormats } : void 0,
|
|
31920
32109
|
log: diagnose,
|
|
31921
32110
|
baselineDirs,
|
|
31922
32111
|
collectMembers: collectFlowMembers,
|
|
@@ -32213,7 +32402,7 @@ async function downloadAndExtractArchive(handle, data, dir) {
|
|
|
32213
32402
|
const tarball = join13(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
|
|
32214
32403
|
try {
|
|
32215
32404
|
await writeFile4(tarball, data);
|
|
32216
|
-
return await
|
|
32405
|
+
return await safeExtractArchive(tarball, dir, handle.filename);
|
|
32217
32406
|
} catch {
|
|
32218
32407
|
return null;
|
|
32219
32408
|
} finally {
|
|
@@ -32292,7 +32481,10 @@ async function materializeArtifacts(result, ctx) {
|
|
|
32292
32481
|
}
|
|
32293
32482
|
try {
|
|
32294
32483
|
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
32295
|
-
headers:
|
|
32484
|
+
headers: value.archive ? {
|
|
32485
|
+
...authHeaders3,
|
|
32486
|
+
Accept: ARCHIVE_FORMATS.map((f) => ARCHIVE_CONTENT_TYPES[f]).join(", ")
|
|
32487
|
+
} : authHeaders3,
|
|
32296
32488
|
signal: ctx.signal
|
|
32297
32489
|
});
|
|
32298
32490
|
if (!res.ok) return null;
|
|
@@ -34442,7 +34634,7 @@ function getNodeHttpConfigurationDefaults(requiredHeaders, signalResourcePath) {
|
|
|
34442
34634
|
}
|
|
34443
34635
|
|
|
34444
34636
|
// ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/http-transport-utils.js
|
|
34445
|
-
import * as
|
|
34637
|
+
import * as zlib2 from "zlib";
|
|
34446
34638
|
import { Readable } from "stream";
|
|
34447
34639
|
|
|
34448
34640
|
// ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/is-export-retryable.js
|
|
@@ -34563,7 +34755,7 @@ function compressAndSend(req, compression, data, onError) {
|
|
|
34563
34755
|
let dataStream = readableFromUint8Array(data);
|
|
34564
34756
|
if (compression === "gzip") {
|
|
34565
34757
|
req.setHeader("Content-Encoding", "gzip");
|
|
34566
|
-
dataStream = dataStream.on("error", onError).pipe(
|
|
34758
|
+
dataStream = dataStream.on("error", onError).pipe(zlib2.createGzip()).on("error", onError);
|
|
34567
34759
|
}
|
|
34568
34760
|
dataStream.pipe(req).on("error", onError);
|
|
34569
34761
|
}
|
|
@@ -35877,7 +36069,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
35877
36069
|
var SESSION_ID2 = randomUUID5();
|
|
35878
36070
|
function readCliVersion() {
|
|
35879
36071
|
if (true) {
|
|
35880
|
-
return "0.33.1-next.
|
|
36072
|
+
return "0.33.1-next.16";
|
|
35881
36073
|
}
|
|
35882
36074
|
return "0.0.0";
|
|
35883
36075
|
}
|
|
@@ -36132,7 +36324,7 @@ function tryReadId(filePath) {
|
|
|
36132
36324
|
}
|
|
36133
36325
|
|
|
36134
36326
|
// ../telemetry/src/fingerprint.ts
|
|
36135
|
-
import { execFileSync as execFileSync2, spawn as
|
|
36327
|
+
import { execFileSync as execFileSync2, spawn as spawn3 } from "node:child_process";
|
|
36136
36328
|
|
|
36137
36329
|
// ../native-devtools-ios/src/index.ts
|
|
36138
36330
|
import * as path16 from "node:path";
|
|
@@ -36210,7 +36402,7 @@ function resolveHostFingerprintAsync() {
|
|
|
36210
36402
|
const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
|
|
36211
36403
|
watchdog.unref?.();
|
|
36212
36404
|
try {
|
|
36213
|
-
child =
|
|
36405
|
+
child = spawn3(binary, ["fingerprint"], { stdio: ["ignore", "pipe", "ignore"] });
|
|
36214
36406
|
} catch {
|
|
36215
36407
|
finish(null);
|
|
36216
36408
|
return;
|
|
@@ -38370,7 +38562,7 @@ Listing tools contacts the argent tool-server, starting one if none is running.
|
|
|
38370
38562
|
import * as fs13 from "node:fs";
|
|
38371
38563
|
import * as path19 from "node:path";
|
|
38372
38564
|
import { constants as constants2, homedir as homedir5, networkInterfaces } from "node:os";
|
|
38373
|
-
import { spawn as
|
|
38565
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
38374
38566
|
var STATE_DIR2 = path19.join(homedir5(), ".argent");
|
|
38375
38567
|
var LOG_FILE2 = path19.join(STATE_DIR2, "tool-server.log");
|
|
38376
38568
|
async function describeForeignServers(ownBundlePath) {
|
|
@@ -38444,7 +38636,7 @@ function logsCmd(follow) {
|
|
|
38444
38636
|
process.stdout.write(fs13.readFileSync(LOG_FILE2, "utf8"));
|
|
38445
38637
|
return;
|
|
38446
38638
|
}
|
|
38447
|
-
const child =
|
|
38639
|
+
const child = spawn4("tail", ["-f", LOG_FILE2], { stdio: "inherit" });
|
|
38448
38640
|
child.on(
|
|
38449
38641
|
"exit",
|
|
38450
38642
|
(code, signal) => process.exit(code ?? (signal ? 128 + (signalNumber(signal) ?? 0) : 0))
|
|
@@ -38668,7 +38860,7 @@ async function runForeground(paths, port, host, idleTimeoutMinutes, token) {
|
|
|
38668
38860
|
idleTimeoutMinutes,
|
|
38669
38861
|
token
|
|
38670
38862
|
});
|
|
38671
|
-
const child =
|
|
38863
|
+
const child = spawn4("node", [paths.bundlePath, "start"], {
|
|
38672
38864
|
stdio: "inherit",
|
|
38673
38865
|
env
|
|
38674
38866
|
});
|