@swmansion/argent 0.33.1-next.2 → 0.33.1-next.20
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/bin/argent-android-devtools-0.4.0.apk +0 -0
- package/bin/darwin/argent-macos-helper +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/network-inspector/network-inspector.jar +0 -0
- package/bin/tcp/ax-service +0 -0
- package/dist/cli-cmds.mjs +267 -70
- package/dist/client.js +253 -56
- package/dist/flow-script-runner.mjs +148 -5
- package/dist/installer.mjs +52 -26
- package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Snapshot.swift +110 -4
- package/dist/mcp-server.mjs +257 -60
- package/dist/tool-args.generated.d.ts +3 -1
- package/dist/tool-server.cjs +1366 -697
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
- package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
- package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
- package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +2 -3
- package/skills/argent-create-e2e/references/e2e-yaml.md +11 -1
- package/skills/argent-create-e2e/references/reliability-and-recovery.md +1 -1
- package/skills/argent-device-interact/SKILL.md +1 -1
- package/skills/argent-device-interact/references/harmonyos.md +1 -1
- package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
- package/skills/argent-test-ui-flow/SKILL.md +6 -8
- package/assets/trace-processor/SHA256SUMS +0 -4
- package/assets/trace-processor/engine.mjs +0 -42423
|
Binary file
|
|
Binary file
|
package/bin/darwin/ax-service
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/tcp/ax-service
CHANGED
|
Binary file
|
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;
|
|
@@ -9093,7 +9093,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
9093
9093
|
"error",
|
|
9094
9094
|
(err) => reject(
|
|
9095
9095
|
new Error(
|
|
9096
|
-
err.code === "ENOENT" && nodeBin === "node" ? "Could not start the argent tool-server: `node` was not found on PATH. Install Node.js
|
|
9096
|
+
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}`
|
|
9097
9097
|
)
|
|
9098
9098
|
)
|
|
9099
9099
|
);
|
|
@@ -10204,7 +10204,10 @@ import { basename, extname } from "node:path";
|
|
|
10204
10204
|
var FLOW_NAME_CHARSET = "[A-Za-z0-9_-]+";
|
|
10205
10205
|
var FLOW_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}$`);
|
|
10206
10206
|
var FLOW_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.yaml$`);
|
|
10207
|
-
var
|
|
10207
|
+
var SCRIPT_FILE_EXTENSIONS = [".mjs", ".mts", ".js", ".ts"];
|
|
10208
|
+
var SCRIPT_FILE_NAME_PATTERN = new RegExp(
|
|
10209
|
+
`^${FLOW_NAME_CHARSET}(?:${SCRIPT_FILE_EXTENSIONS.map((ext) => `\\${ext}`).join("|")})$`
|
|
10210
|
+
);
|
|
10208
10211
|
function interpolateFileInputPath(template, args) {
|
|
10209
10212
|
let missing = false;
|
|
10210
10213
|
const out = template.replace(/\$\{([A-Za-z0-9_]+)\}/g, (_m, name) => {
|
|
@@ -10727,6 +10730,8 @@ var FAILURE_CODES = {
|
|
|
10727
10730
|
FLOW_DEVICE_RESOLUTION: "FLOW_DEVICE_RESOLUTION",
|
|
10728
10731
|
// The target does not satisfy the test's `requires:` block; a directory run skips it.
|
|
10729
10732
|
FLOW_REQUIREMENTS_UNMET: "FLOW_REQUIREMENTS_UNMET",
|
|
10733
|
+
// The tool-server's Node.js cannot run a TypeScript `script:` step the test holds.
|
|
10734
|
+
FLOW_SCRIPT_TYPESCRIPT_UNSUPPORTED: "FLOW_SCRIPT_TYPESCRIPT_UNSUPPORTED",
|
|
10730
10735
|
PROFILER_QUERY_MODE_INVALID: "PROFILER_QUERY_MODE_INVALID",
|
|
10731
10736
|
PROFILER_QUERY_REQUIRED_PARAM_MISSING: "PROFILER_QUERY_REQUIRED_PARAM_MISSING",
|
|
10732
10737
|
PROFILER_DATA_NOT_LOADED: "PROFILER_DATA_NOT_LOADED",
|
|
@@ -14899,7 +14904,7 @@ function handleIntersectionResults(result, left, right) {
|
|
|
14899
14904
|
const unrecKeys = /* @__PURE__ */ new Map();
|
|
14900
14905
|
let unrecIssue;
|
|
14901
14906
|
const keyIssues = /* @__PURE__ */ new Map();
|
|
14902
|
-
const
|
|
14907
|
+
const collect2 = (iss, side) => {
|
|
14903
14908
|
let keys;
|
|
14904
14909
|
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
14905
14910
|
unrecIssue ?? (unrecIssue = iss);
|
|
@@ -14920,11 +14925,11 @@ function handleIntersectionResults(result, left, right) {
|
|
|
14920
14925
|
return true;
|
|
14921
14926
|
};
|
|
14922
14927
|
for (const iss of left.issues) {
|
|
14923
|
-
if (!
|
|
14928
|
+
if (!collect2(iss, "l"))
|
|
14924
14929
|
result.issues.push(iss);
|
|
14925
14930
|
}
|
|
14926
14931
|
for (const iss of right.issues) {
|
|
14927
|
-
if (!
|
|
14932
|
+
if (!collect2(iss, "r"))
|
|
14928
14933
|
result.issues.push(iss);
|
|
14929
14934
|
}
|
|
14930
14935
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
@@ -30770,7 +30775,7 @@ function parseLinkTarget(input2) {
|
|
|
30770
30775
|
|
|
30771
30776
|
// ../argent-tools-client/src/file-inputs.ts
|
|
30772
30777
|
import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
|
|
30773
|
-
import { createReadStream, rmSync as rmSync2 } from "node:fs";
|
|
30778
|
+
import { createReadStream as createReadStream2, rmSync as rmSync2 } from "node:fs";
|
|
30774
30779
|
import {
|
|
30775
30780
|
chmod as chmod3,
|
|
30776
30781
|
lstat,
|
|
@@ -30786,50 +30791,234 @@ import { constants, tmpdir } from "node:os";
|
|
|
30786
30791
|
import * as path10 from "node:path";
|
|
30787
30792
|
|
|
30788
30793
|
// ../archive/src/index.ts
|
|
30789
|
-
import {
|
|
30790
|
-
import {
|
|
30791
|
-
import {
|
|
30792
|
-
import {
|
|
30793
|
-
|
|
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";
|
|
30794
30802
|
var ArchiveError = class extends Error {
|
|
30795
30803
|
};
|
|
30796
|
-
function
|
|
30797
|
-
|
|
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
|
+
};
|
|
30798
30849
|
}
|
|
30799
|
-
async function
|
|
30850
|
+
async function createArchiveFile(sourcePath, archivePath, format, signal) {
|
|
30851
|
+
const out = createWriteStream(archivePath);
|
|
30852
|
+
await once(out, "ready");
|
|
30800
30853
|
try {
|
|
30801
|
-
await
|
|
30854
|
+
await archiveInto(out, sourcePath, format, signal);
|
|
30802
30855
|
} catch (err) {
|
|
30803
|
-
|
|
30856
|
+
out.destroy();
|
|
30857
|
+
await rm(archivePath, { force: true }).catch(() => {
|
|
30804
30858
|
});
|
|
30859
|
+
signal?.throwIfAborted();
|
|
30805
30860
|
throw err;
|
|
30806
30861
|
}
|
|
30807
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
|
+
}
|
|
30808
30993
|
function normalizeTarMemberPath(memberPath) {
|
|
30809
30994
|
return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
|
|
30810
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
|
+
}
|
|
30811
31001
|
function isSafeTarMember(memberPath, destDir) {
|
|
30812
31002
|
const normalized = normalizeTarMemberPath(memberPath);
|
|
30813
|
-
if (!normalized
|
|
30814
|
-
if (normalized.startsWith("/") || /^[A-Za-z]:[\\/]/.test(normalized)) return false;
|
|
30815
|
-
const relative3 = posix2.normalize(normalized);
|
|
30816
|
-
if (relative3 === ".." || relative3.startsWith("../") || relative3.split("/").includes("..")) {
|
|
30817
|
-
return false;
|
|
30818
|
-
}
|
|
31003
|
+
if (!isContainedPath(normalized)) return false;
|
|
30819
31004
|
const root = resolve6(destDir);
|
|
30820
|
-
|
|
30821
|
-
return resolved === root || resolved.startsWith(root + sep2);
|
|
31005
|
+
return resolve6(destDir, normalized).startsWith(root + sep2);
|
|
30822
31006
|
}
|
|
30823
|
-
async function
|
|
30824
|
-
|
|
30825
|
-
|
|
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
|
+
}
|
|
30826
31015
|
}
|
|
30827
|
-
function
|
|
30828
|
-
|
|
30829
|
-
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);
|
|
30830
31019
|
}
|
|
30831
|
-
async function assertSafeMemberTypes(
|
|
30832
|
-
const
|
|
31020
|
+
async function assertSafeMemberTypes(archive) {
|
|
31021
|
+
const stdout2 = await readListing(archive, ["-tv"]);
|
|
30833
31022
|
for (const line of stdout2.split("\n")) {
|
|
30834
31023
|
if (!line.trim()) continue;
|
|
30835
31024
|
const type = line[0];
|
|
@@ -30837,7 +31026,7 @@ async function assertSafeMemberTypes(tarPath) {
|
|
|
30837
31026
|
if (type === "l") {
|
|
30838
31027
|
const parts = line.split(" -> ");
|
|
30839
31028
|
const target = parts.length === 2 ? parts[1].trim() : "";
|
|
30840
|
-
if (parts.length !== 2 || !target ||
|
|
31029
|
+
if (parts.length !== 2 || !target || !isContainedPath(target)) {
|
|
30841
31030
|
throw new ArchiveError(
|
|
30842
31031
|
`Archive contains a symlink whose target could not be confirmed safe: "${line.trim()}".`
|
|
30843
31032
|
);
|
|
@@ -30849,15 +31038,8 @@ async function assertSafeMemberTypes(tarPath) {
|
|
|
30849
31038
|
);
|
|
30850
31039
|
}
|
|
30851
31040
|
}
|
|
30852
|
-
async function assertSafeArchive(
|
|
30853
|
-
|
|
30854
|
-
try {
|
|
30855
|
-
members2 = await listTarMembers(tarPath);
|
|
30856
|
-
} catch (err) {
|
|
30857
|
-
throw new ArchiveError(
|
|
30858
|
-
`Could not read archive: ${err instanceof Error ? err.message : String(err)}`
|
|
30859
|
-
);
|
|
30860
|
-
}
|
|
31041
|
+
async function assertSafeArchive(archive, destDir) {
|
|
31042
|
+
const members2 = await listTarMembers(archive);
|
|
30861
31043
|
if (members2.length === 0) {
|
|
30862
31044
|
throw new ArchiveError("Archive is empty.");
|
|
30863
31045
|
}
|
|
@@ -30866,7 +31048,7 @@ async function assertSafeArchive(tarPath, destDir) {
|
|
|
30866
31048
|
throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
|
|
30867
31049
|
}
|
|
30868
31050
|
}
|
|
30869
|
-
await assertSafeMemberTypes(
|
|
31051
|
+
await assertSafeMemberTypes(archive);
|
|
30870
31052
|
}
|
|
30871
31053
|
async function resolveMember(destDir, expectedName) {
|
|
30872
31054
|
const entries = await readdir3(destDir);
|
|
@@ -30881,9 +31063,18 @@ async function resolveMember(destDir, expectedName) {
|
|
|
30881
31063
|
}
|
|
30882
31064
|
return join9(destDir, real[0]);
|
|
30883
31065
|
}
|
|
30884
|
-
async function
|
|
30885
|
-
|
|
30886
|
-
|
|
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]);
|
|
30887
31078
|
return resolveMember(destDir, expectedName);
|
|
30888
31079
|
}
|
|
30889
31080
|
|
|
@@ -30964,7 +31155,7 @@ function untrackArchive(archive) {
|
|
|
30964
31155
|
function sha256File(filePath) {
|
|
30965
31156
|
return new Promise((resolve13, reject) => {
|
|
30966
31157
|
const hash2 = createHash2("sha256");
|
|
30967
|
-
|
|
31158
|
+
createReadStream2(filePath).on("data", (chunk) => hash2.update(chunk)).on("end", () => resolve13(hash2.digest("hex"))).on("error", reject);
|
|
30968
31159
|
});
|
|
30969
31160
|
}
|
|
30970
31161
|
function toolServerError(text2) {
|
|
@@ -30990,15 +31181,15 @@ function uploadFailure(url2, res, text2, bytes) {
|
|
|
30990
31181
|
errorKind: "validation"
|
|
30991
31182
|
});
|
|
30992
31183
|
}
|
|
30993
|
-
async function uploadTar(tarPath, endpoint, signal) {
|
|
31184
|
+
async function uploadTar(tarPath, format, endpoint, signal) {
|
|
30994
31185
|
const { size } = await stat3(tarPath);
|
|
30995
31186
|
const init2 = {
|
|
30996
31187
|
method: "POST",
|
|
30997
31188
|
headers: {
|
|
30998
|
-
"content-type":
|
|
31189
|
+
"content-type": ARCHIVE_CONTENT_TYPES[format],
|
|
30999
31190
|
...endpoint.token ? { Authorization: `Bearer ${endpoint.token}` } : {}
|
|
31000
31191
|
},
|
|
31001
|
-
body:
|
|
31192
|
+
body: createReadStream2(tarPath),
|
|
31002
31193
|
duplex: "half",
|
|
31003
31194
|
signal
|
|
31004
31195
|
};
|
|
@@ -31015,12 +31206,13 @@ async function uploadTar(tarPath, endpoint, signal) {
|
|
|
31015
31206
|
return json2.uploadId;
|
|
31016
31207
|
}
|
|
31017
31208
|
async function uploadFile(sourcePath, endpoint, signal) {
|
|
31209
|
+
const format = pickArchiveFormat(endpoint.formats);
|
|
31018
31210
|
const tarPath = path10.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
|
|
31019
31211
|
trackArchive(tarPath);
|
|
31020
31212
|
try {
|
|
31021
|
-
await
|
|
31213
|
+
await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
|
|
31022
31214
|
const contentHash = await sha256File(tarPath);
|
|
31023
|
-
return { uploadId: await uploadTar(tarPath, endpoint, signal), contentHash };
|
|
31215
|
+
return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
|
|
31024
31216
|
} finally {
|
|
31025
31217
|
untrackArchive(tarPath);
|
|
31026
31218
|
await rm2(tarPath, { force: true }).catch(() => {
|
|
@@ -31875,7 +32067,7 @@ function createToolsClient(options = {}) {
|
|
|
31875
32067
|
const { url: url2, token } = await route();
|
|
31876
32068
|
return { url: url2, token };
|
|
31877
32069
|
}
|
|
31878
|
-
async function
|
|
32070
|
+
async function fetchToolList(opts) {
|
|
31879
32071
|
opts?.signal?.throwIfAborted();
|
|
31880
32072
|
const { url: url2, token } = await baseUrl();
|
|
31881
32073
|
const res = await doFetch(
|
|
@@ -31884,8 +32076,10 @@ function createToolsClient(options = {}) {
|
|
|
31884
32076
|
{ longRunning: false, carriesUpload: false }
|
|
31885
32077
|
);
|
|
31886
32078
|
if (!res.ok) throw new Error(`GET /tools failed: ${res.status} ${res.statusText}`);
|
|
31887
|
-
|
|
31888
|
-
|
|
32079
|
+
return await res.json();
|
|
32080
|
+
}
|
|
32081
|
+
async function fetchTools(opts) {
|
|
32082
|
+
return (await fetchToolList(opts)).tools;
|
|
31889
32083
|
}
|
|
31890
32084
|
async function fetchTool(name, opts) {
|
|
31891
32085
|
return findTool(await fetchTools(opts), name);
|
|
@@ -31894,7 +32088,7 @@ function createToolsClient(options = {}) {
|
|
|
31894
32088
|
opts?.signal?.throwIfAborted();
|
|
31895
32089
|
const { url: url2, token, remote } = await route();
|
|
31896
32090
|
let finalArgs = canonicalToolArgs(name, args);
|
|
31897
|
-
const tools2 = await
|
|
32091
|
+
const { tools: tools2, uploadFormats } = await fetchToolList({ signal: opts?.signal });
|
|
31898
32092
|
const meta3 = findTool(tools2, name);
|
|
31899
32093
|
const olderServer = meta3 !== null && !tools2.some((t2) => t2.name === canonicalToolId(meta3.name));
|
|
31900
32094
|
if (meta3) {
|
|
@@ -31911,7 +32105,7 @@ function createToolsClient(options = {}) {
|
|
|
31911
32105
|
if (remote) assertRequiredPresent(meta3, finalArgs);
|
|
31912
32106
|
finalArgs = await prepareFileInputs(meta3.fileInputs, finalArgs ?? {}, {
|
|
31913
32107
|
includeContent: remote,
|
|
31914
|
-
uploadEndpoint: remote ? { url: url2, token } : void 0,
|
|
32108
|
+
uploadEndpoint: remote ? { url: url2, token, formats: uploadFormats } : void 0,
|
|
31915
32109
|
log: diagnose,
|
|
31916
32110
|
baselineDirs,
|
|
31917
32111
|
collectMembers: collectFlowMembers,
|
|
@@ -32208,7 +32402,7 @@ async function downloadAndExtractArchive(handle, data, dir) {
|
|
|
32208
32402
|
const tarball = join13(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
|
|
32209
32403
|
try {
|
|
32210
32404
|
await writeFile4(tarball, data);
|
|
32211
|
-
return await
|
|
32405
|
+
return await safeExtractArchive(tarball, dir, handle.filename);
|
|
32212
32406
|
} catch {
|
|
32213
32407
|
return null;
|
|
32214
32408
|
} finally {
|
|
@@ -32287,7 +32481,10 @@ async function materializeArtifacts(result, ctx) {
|
|
|
32287
32481
|
}
|
|
32288
32482
|
try {
|
|
32289
32483
|
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
32290
|
-
headers:
|
|
32484
|
+
headers: value.archive ? {
|
|
32485
|
+
...authHeaders3,
|
|
32486
|
+
Accept: ARCHIVE_FORMATS.map((f) => ARCHIVE_CONTENT_TYPES[f]).join(", ")
|
|
32487
|
+
} : authHeaders3,
|
|
32291
32488
|
signal: ctx.signal
|
|
32292
32489
|
});
|
|
32293
32490
|
if (!res.ok) return null;
|
|
@@ -34437,7 +34634,7 @@ function getNodeHttpConfigurationDefaults(requiredHeaders, signalResourcePath) {
|
|
|
34437
34634
|
}
|
|
34438
34635
|
|
|
34439
34636
|
// ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/http-transport-utils.js
|
|
34440
|
-
import * as
|
|
34637
|
+
import * as zlib2 from "zlib";
|
|
34441
34638
|
import { Readable } from "stream";
|
|
34442
34639
|
|
|
34443
34640
|
// ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/is-export-retryable.js
|
|
@@ -34558,7 +34755,7 @@ function compressAndSend(req, compression, data, onError) {
|
|
|
34558
34755
|
let dataStream = readableFromUint8Array(data);
|
|
34559
34756
|
if (compression === "gzip") {
|
|
34560
34757
|
req.setHeader("Content-Encoding", "gzip");
|
|
34561
|
-
dataStream = dataStream.on("error", onError).pipe(
|
|
34758
|
+
dataStream = dataStream.on("error", onError).pipe(zlib2.createGzip()).on("error", onError);
|
|
34562
34759
|
}
|
|
34563
34760
|
dataStream.pipe(req).on("error", onError);
|
|
34564
34761
|
}
|
|
@@ -35872,7 +36069,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
35872
36069
|
var SESSION_ID2 = randomUUID5();
|
|
35873
36070
|
function readCliVersion() {
|
|
35874
36071
|
if (true) {
|
|
35875
|
-
return "0.33.1-next.
|
|
36072
|
+
return "0.33.1-next.20";
|
|
35876
36073
|
}
|
|
35877
36074
|
return "0.0.0";
|
|
35878
36075
|
}
|
|
@@ -36127,7 +36324,7 @@ function tryReadId(filePath) {
|
|
|
36127
36324
|
}
|
|
36128
36325
|
|
|
36129
36326
|
// ../telemetry/src/fingerprint.ts
|
|
36130
|
-
import { execFileSync as execFileSync2, spawn as
|
|
36327
|
+
import { execFileSync as execFileSync2, spawn as spawn3 } from "node:child_process";
|
|
36131
36328
|
|
|
36132
36329
|
// ../native-devtools-ios/src/index.ts
|
|
36133
36330
|
import * as path16 from "node:path";
|
|
@@ -36205,7 +36402,7 @@ function resolveHostFingerprintAsync() {
|
|
|
36205
36402
|
const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
|
|
36206
36403
|
watchdog.unref?.();
|
|
36207
36404
|
try {
|
|
36208
|
-
child =
|
|
36405
|
+
child = spawn3(binary, ["fingerprint"], { stdio: ["ignore", "pipe", "ignore"] });
|
|
36209
36406
|
} catch {
|
|
36210
36407
|
finish(null);
|
|
36211
36408
|
return;
|
|
@@ -38365,7 +38562,7 @@ Listing tools contacts the argent tool-server, starting one if none is running.
|
|
|
38365
38562
|
import * as fs13 from "node:fs";
|
|
38366
38563
|
import * as path19 from "node:path";
|
|
38367
38564
|
import { constants as constants2, homedir as homedir5, networkInterfaces } from "node:os";
|
|
38368
|
-
import { spawn as
|
|
38565
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
38369
38566
|
var STATE_DIR2 = path19.join(homedir5(), ".argent");
|
|
38370
38567
|
var LOG_FILE2 = path19.join(STATE_DIR2, "tool-server.log");
|
|
38371
38568
|
async function describeForeignServers(ownBundlePath) {
|
|
@@ -38439,7 +38636,7 @@ function logsCmd(follow) {
|
|
|
38439
38636
|
process.stdout.write(fs13.readFileSync(LOG_FILE2, "utf8"));
|
|
38440
38637
|
return;
|
|
38441
38638
|
}
|
|
38442
|
-
const child =
|
|
38639
|
+
const child = spawn4("tail", ["-f", LOG_FILE2], { stdio: "inherit" });
|
|
38443
38640
|
child.on(
|
|
38444
38641
|
"exit",
|
|
38445
38642
|
(code, signal) => process.exit(code ?? (signal ? 128 + (signalNumber(signal) ?? 0) : 0))
|
|
@@ -38663,7 +38860,7 @@ async function runForeground(paths, port, host, idleTimeoutMinutes, token) {
|
|
|
38663
38860
|
idleTimeoutMinutes,
|
|
38664
38861
|
token
|
|
38665
38862
|
});
|
|
38666
|
-
const child =
|
|
38863
|
+
const child = spawn4("node", [paths.bundlePath, "start"], {
|
|
38667
38864
|
stdio: "inherit",
|
|
38668
38865
|
env
|
|
38669
38866
|
});
|