@swmansion/argent 0.35.1-next.63 → 0.35.1-next.65
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 +111 -65
- package/dist/cli.js +21 -2
- package/dist/cli.js.map +1 -1
- package/dist/client.js +83 -34
- package/dist/installer.mjs +19 -18
- package/dist/mcp-server.mjs +147 -97
- package/dist/tool-server.cjs +66 -31
- package/package.json +2 -2
package/dist/client.js
CHANGED
|
@@ -8330,12 +8330,13 @@ var UnknownConfigKeyError = class extends Error {
|
|
|
8330
8330
|
|
|
8331
8331
|
// ../argent-tools-client/src/launcher.ts
|
|
8332
8332
|
import * as net from "node:net";
|
|
8333
|
+
import * as os2 from "node:os";
|
|
8333
8334
|
import * as fs6 from "node:fs";
|
|
8334
8335
|
import * as path7 from "node:path";
|
|
8335
8336
|
import * as readline from "node:readline";
|
|
8336
8337
|
import { spawn, execFileSync } from "node:child_process";
|
|
8337
8338
|
import { createHash, randomBytes } from "node:crypto";
|
|
8338
|
-
import {
|
|
8339
|
+
import { readFile, readdir, unlink } from "node:fs/promises";
|
|
8339
8340
|
var STATE_DIR = argentHomeDir();
|
|
8340
8341
|
var STATE_FILE = path7.join(STATE_DIR, "tool-server.json");
|
|
8341
8342
|
var LOG_FILE = path7.join(STATE_DIR, "tool-server.log");
|
|
@@ -8564,20 +8565,66 @@ async function readToolsServerState(bundlePath) {
|
|
|
8564
8565
|
const legacy = await readStateFile(STATE_FILE);
|
|
8565
8566
|
return legacy && legacy.bundlePath === bundlePath ? legacy : null;
|
|
8566
8567
|
}
|
|
8568
|
+
function primaryGid() {
|
|
8569
|
+
try {
|
|
8570
|
+
return os2.userInfo().gid;
|
|
8571
|
+
} catch {
|
|
8572
|
+
return process.getgid?.();
|
|
8573
|
+
}
|
|
8574
|
+
}
|
|
8575
|
+
var UnsafeArgentHomeError = class extends Error {
|
|
8576
|
+
name = "UnsafeArgentHomeError";
|
|
8577
|
+
};
|
|
8578
|
+
function statHome() {
|
|
8579
|
+
try {
|
|
8580
|
+
fs6.mkdirSync(path7.dirname(STATE_DIR), { recursive: true });
|
|
8581
|
+
fs6.mkdirSync(STATE_DIR, { mode: 448 });
|
|
8582
|
+
} catch {
|
|
8583
|
+
}
|
|
8584
|
+
try {
|
|
8585
|
+
return fs6.statSync(STATE_DIR);
|
|
8586
|
+
} catch {
|
|
8587
|
+
return null;
|
|
8588
|
+
}
|
|
8589
|
+
}
|
|
8590
|
+
function isWritable(dir) {
|
|
8591
|
+
try {
|
|
8592
|
+
fs6.accessSync(dir, fs6.constants.W_OK);
|
|
8593
|
+
return true;
|
|
8594
|
+
} catch {
|
|
8595
|
+
return false;
|
|
8596
|
+
}
|
|
8597
|
+
}
|
|
8598
|
+
function assertPrivateArgentHome() {
|
|
8599
|
+
const uid = process.getuid?.();
|
|
8600
|
+
if (uid === void 0) return;
|
|
8601
|
+
const stat6 = statHome();
|
|
8602
|
+
if (!stat6) return;
|
|
8603
|
+
if (stat6.uid !== uid && !(stat6.uid === 0 && isWritable(STATE_DIR))) {
|
|
8604
|
+
throw new UnsafeArgentHomeError(
|
|
8605
|
+
`The Argent home ${STATE_DIR} belongs to another user. Change its owner or set ARGENT_HOME_DIR to a directory you own.`
|
|
8606
|
+
);
|
|
8607
|
+
}
|
|
8608
|
+
const ownPrivateGroup = process.platform === "linux" && stat6.gid === primaryGid();
|
|
8609
|
+
const groupCanWrite = (stat6.mode & 16) !== 0 && !ownPrivateGroup;
|
|
8610
|
+
if ((stat6.mode & 2) !== 0 || groupCanWrite) {
|
|
8611
|
+
throw new UnsafeArgentHomeError(
|
|
8612
|
+
`The Argent home ${STATE_DIR} is writable by other users. If only you have used it, run \`chmod go-w '${STATE_DIR}'\`. Otherwise set ARGENT_HOME_DIR to a new private directory.`
|
|
8613
|
+
);
|
|
8614
|
+
}
|
|
8615
|
+
}
|
|
8567
8616
|
async function writeToolsServerState(state) {
|
|
8617
|
+
writeToolsServerStateSync(state);
|
|
8618
|
+
}
|
|
8619
|
+
function writeToolsServerStateSync(state) {
|
|
8568
8620
|
const target = stateFileForBundle(state.bundlePath);
|
|
8569
|
-
|
|
8570
|
-
const tmp = `${target}.${
|
|
8621
|
+
fs6.mkdirSync(STATE_DIR, { recursive: true });
|
|
8622
|
+
const tmp = `${target}.${randomBytes(8).toString("hex")}.tmp`;
|
|
8571
8623
|
try {
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
mode: 384
|
|
8575
|
-
});
|
|
8576
|
-
await chmod(tmp, 384);
|
|
8577
|
-
await rename(tmp, target);
|
|
8624
|
+
fs6.writeFileSync(tmp, JSON.stringify(state, null, 2) + "\n", { flag: "wx", mode: 384 });
|
|
8625
|
+
fs6.renameSync(tmp, target);
|
|
8578
8626
|
} catch (err) {
|
|
8579
|
-
|
|
8580
|
-
});
|
|
8627
|
+
fs6.rmSync(tmp, { force: true });
|
|
8581
8628
|
throw err;
|
|
8582
8629
|
}
|
|
8583
8630
|
}
|
|
@@ -8787,6 +8834,7 @@ async function reusableHandle(state, wantBundlePath, wantVersion) {
|
|
|
8787
8834
|
return { url: formatUrl(healthCheckHost(host), state.port), token: state.token ?? "" };
|
|
8788
8835
|
}
|
|
8789
8836
|
async function ensureToolsServer(paths) {
|
|
8837
|
+
assertPrivateArgentHome();
|
|
8790
8838
|
const fast = await reusableHandle(
|
|
8791
8839
|
await readState(paths.bundlePath),
|
|
8792
8840
|
paths.bundlePath,
|
|
@@ -9635,7 +9683,7 @@ function describeParamIssues(error, params) {
|
|
|
9635
9683
|
|
|
9636
9684
|
// ../argent-tools-client/src/link-config.ts
|
|
9637
9685
|
import * as path10 from "node:path";
|
|
9638
|
-
import { mkdir
|
|
9686
|
+
import { mkdir, writeFile, readFile as readFile2, unlink as unlink2, chmod } from "node:fs/promises";
|
|
9639
9687
|
var LINK_DIR = argentHomeDir();
|
|
9640
9688
|
var LINK_FILE = path10.join(LINK_DIR, "link.json");
|
|
9641
9689
|
async function readLinkConfig() {
|
|
@@ -9677,19 +9725,19 @@ async function getResolvedToolsUrl() {
|
|
|
9677
9725
|
|
|
9678
9726
|
// ../argent-tools-client/src/file-inputs.ts
|
|
9679
9727
|
import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
|
|
9680
|
-
import { createReadStream as createReadStream2, rmSync as
|
|
9728
|
+
import { createReadStream as createReadStream2, rmSync as rmSync3 } from "node:fs";
|
|
9681
9729
|
import {
|
|
9682
|
-
chmod as
|
|
9730
|
+
chmod as chmod2,
|
|
9683
9731
|
lstat,
|
|
9684
|
-
mkdir as
|
|
9732
|
+
mkdir as mkdir2,
|
|
9685
9733
|
readFile as readFile3,
|
|
9686
9734
|
realpath as realpath2,
|
|
9687
|
-
rename
|
|
9735
|
+
rename,
|
|
9688
9736
|
rm as rm2,
|
|
9689
9737
|
stat as stat3,
|
|
9690
|
-
writeFile as
|
|
9738
|
+
writeFile as writeFile2
|
|
9691
9739
|
} from "node:fs/promises";
|
|
9692
|
-
import { constants, tmpdir } from "node:os";
|
|
9740
|
+
import { constants as constants2, tmpdir } from "node:os";
|
|
9693
9741
|
import * as path11 from "node:path";
|
|
9694
9742
|
|
|
9695
9743
|
// ../archive/src/index.ts
|
|
@@ -10053,7 +10101,7 @@ var ARCHIVE_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
|
10053
10101
|
function removePendingArchives() {
|
|
10054
10102
|
for (const archive of pendingArchives) {
|
|
10055
10103
|
try {
|
|
10056
|
-
|
|
10104
|
+
rmSync3(archive, { force: true });
|
|
10057
10105
|
} catch {
|
|
10058
10106
|
}
|
|
10059
10107
|
}
|
|
@@ -10067,7 +10115,7 @@ function removeArchivesOnSignal(signal) {
|
|
|
10067
10115
|
try {
|
|
10068
10116
|
process.kill(process.pid, signal);
|
|
10069
10117
|
} catch {
|
|
10070
|
-
process.exit(128 +
|
|
10118
|
+
process.exit(128 + constants2.signals[signal]);
|
|
10071
10119
|
}
|
|
10072
10120
|
}
|
|
10073
10121
|
function trackArchive(archive) {
|
|
@@ -10242,9 +10290,9 @@ function isClientFileDirective2(value) {
|
|
|
10242
10290
|
async function replaceFile(target, bytes, mode) {
|
|
10243
10291
|
const temp = path11.join(path11.dirname(target), `.baseline-${randomUUID4()}.tmp`);
|
|
10244
10292
|
try {
|
|
10245
|
-
await
|
|
10246
|
-
if (mode !== void 0) await
|
|
10247
|
-
await
|
|
10293
|
+
await writeFile2(temp, bytes, { flag: "wx" });
|
|
10294
|
+
if (mode !== void 0) await chmod2(temp, mode & 511);
|
|
10295
|
+
await rename(temp, target);
|
|
10248
10296
|
} catch (err) {
|
|
10249
10297
|
await rm2(temp, { force: true });
|
|
10250
10298
|
throw err;
|
|
@@ -10258,7 +10306,7 @@ async function writeBaselineFile(file, bytes, allowedDirs) {
|
|
|
10258
10306
|
return `${file}: the baseline is larger than the 32 MiB cap on a file this client writes`;
|
|
10259
10307
|
}
|
|
10260
10308
|
const dir = path11.dirname(file);
|
|
10261
|
-
await
|
|
10309
|
+
await mkdir2(dir, { recursive: true });
|
|
10262
10310
|
const link = await lstat(file).catch(() => null);
|
|
10263
10311
|
const real = link === null ? null : await realpath2(file).catch(() => null);
|
|
10264
10312
|
if (link !== null && real === null) return `${file} is a symbolic link to a missing file`;
|
|
@@ -10297,8 +10345,8 @@ async function applyClientFileDirectives(result, opts = {}) {
|
|
|
10297
10345
|
if (isClientFileDirective2(value)) {
|
|
10298
10346
|
if (!isAllowedClientFilePath(value.path)) return null;
|
|
10299
10347
|
try {
|
|
10300
|
-
await
|
|
10301
|
-
await
|
|
10348
|
+
await mkdir2(path11.dirname(value.path), { recursive: true });
|
|
10349
|
+
await writeFile2(value.path, value.content, "utf8");
|
|
10302
10350
|
written.push(value.path);
|
|
10303
10351
|
return value.path;
|
|
10304
10352
|
} catch {
|
|
@@ -11096,6 +11144,7 @@ function createToolsClient(options = {}) {
|
|
|
11096
11144
|
`));
|
|
11097
11145
|
async function route() {
|
|
11098
11146
|
if (options.baseUrl) return options.baseUrl();
|
|
11147
|
+
assertPrivateArgentHome();
|
|
11099
11148
|
const resolved = await getResolvedToolsUrl();
|
|
11100
11149
|
if (resolved.url) {
|
|
11101
11150
|
return { url: resolved.url, token: resolved.token ?? "", remote: true };
|
|
@@ -11324,13 +11373,13 @@ function createToolsClient(options = {}) {
|
|
|
11324
11373
|
// ../argent-tools-client/src/artifacts.ts
|
|
11325
11374
|
import {
|
|
11326
11375
|
copyFile,
|
|
11327
|
-
mkdir as
|
|
11376
|
+
mkdir as mkdir3,
|
|
11328
11377
|
mkdtemp,
|
|
11329
11378
|
readFile as readFile6,
|
|
11330
11379
|
realpath as realpath4,
|
|
11331
11380
|
rm as rm3,
|
|
11332
11381
|
stat as stat5,
|
|
11333
|
-
writeFile as
|
|
11382
|
+
writeFile as writeFile3
|
|
11334
11383
|
} from "node:fs/promises";
|
|
11335
11384
|
import { constants as fsConstants } from "node:fs";
|
|
11336
11385
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
@@ -11481,8 +11530,8 @@ async function downloadAndExtractArchive(handle, data, dir, signal) {
|
|
|
11481
11530
|
const tarball = join14(attemptDir, "download.tar");
|
|
11482
11531
|
const extractDir = join14(attemptDir, "files");
|
|
11483
11532
|
try {
|
|
11484
|
-
await
|
|
11485
|
-
await
|
|
11533
|
+
await writeFile3(tarball, data, { signal });
|
|
11534
|
+
await mkdir3(extractDir);
|
|
11486
11535
|
const member = await safeExtractArchive(tarball, extractDir, handle.filename, signal);
|
|
11487
11536
|
await rm3(tarball);
|
|
11488
11537
|
signal?.throwIfAborted();
|
|
@@ -11501,7 +11550,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
11501
11550
|
let dirReady = false;
|
|
11502
11551
|
async function ensureDir() {
|
|
11503
11552
|
if (!dirReady) {
|
|
11504
|
-
await
|
|
11553
|
+
await mkdir3(dir, { recursive: true });
|
|
11505
11554
|
dirReady = true;
|
|
11506
11555
|
}
|
|
11507
11556
|
}
|
|
@@ -11512,7 +11561,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
11512
11561
|
if (saveTarget) {
|
|
11513
11562
|
const filename = basename7(saveTarget.path);
|
|
11514
11563
|
try {
|
|
11515
|
-
await
|
|
11564
|
+
await mkdir3(saveTarget.dir, { recursive: true });
|
|
11516
11565
|
if (!await confineToRealBase(saveTarget.dir, saveTarget.base, saveTarget.rel)) {
|
|
11517
11566
|
return null;
|
|
11518
11567
|
}
|
|
@@ -11545,7 +11594,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
11545
11594
|
const finalPath = await writeDurableUnique(
|
|
11546
11595
|
saveTarget.dir,
|
|
11547
11596
|
filename,
|
|
11548
|
-
(p) =>
|
|
11597
|
+
(p) => writeFile3(p, data, { flag: "wx" })
|
|
11549
11598
|
);
|
|
11550
11599
|
if (!finalPath) return null;
|
|
11551
11600
|
if (value.mimeType.startsWith("image/")) {
|
|
@@ -11580,7 +11629,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
11580
11629
|
}
|
|
11581
11630
|
if (value.size > 0 && data.length !== value.size) return null;
|
|
11582
11631
|
const downloadedPath = join14(dir, sanitizeSegment(value.filename));
|
|
11583
|
-
await
|
|
11632
|
+
await writeFile3(downloadedPath, data);
|
|
11584
11633
|
if (value.mimeType.startsWith("image/")) {
|
|
11585
11634
|
images.push({ localPath: downloadedPath, data, mimeType: value.mimeType });
|
|
11586
11635
|
}
|
package/dist/installer.mjs
CHANGED
|
@@ -2431,10 +2431,10 @@ var require_truncate = __commonJS({
|
|
|
2431
2431
|
"../../node_modules/semver/functions/truncate.js"(exports, module) {
|
|
2432
2432
|
"use strict";
|
|
2433
2433
|
var parse6 = require_parse();
|
|
2434
|
-
var
|
|
2434
|
+
var constants4 = require_constants();
|
|
2435
2435
|
var SemVer = require_semver();
|
|
2436
2436
|
var truncate = (version, truncation, options) => {
|
|
2437
|
-
if (!
|
|
2437
|
+
if (!constants4.RELEASE_TYPES.includes(truncation)) {
|
|
2438
2438
|
return null;
|
|
2439
2439
|
}
|
|
2440
2440
|
const clonedVersion = cloneInputVersion(version, options);
|
|
@@ -3483,7 +3483,7 @@ var require_semver2 = __commonJS({
|
|
|
3483
3483
|
"../../node_modules/semver/index.js"(exports, module) {
|
|
3484
3484
|
"use strict";
|
|
3485
3485
|
var internalRe = require_re();
|
|
3486
|
-
var
|
|
3486
|
+
var constants4 = require_constants();
|
|
3487
3487
|
var SemVer = require_semver();
|
|
3488
3488
|
var identifiers = require_identifiers();
|
|
3489
3489
|
var parse6 = require_parse();
|
|
@@ -3567,8 +3567,8 @@ var require_semver2 = __commonJS({
|
|
|
3567
3567
|
re: internalRe.re,
|
|
3568
3568
|
src: internalRe.src,
|
|
3569
3569
|
tokens: internalRe.t,
|
|
3570
|
-
SEMVER_SPEC_VERSION:
|
|
3571
|
-
RELEASE_TYPES:
|
|
3570
|
+
SEMVER_SPEC_VERSION: constants4.SEMVER_SPEC_VERSION,
|
|
3571
|
+
RELEASE_TYPES: constants4.RELEASE_TYPES,
|
|
3572
3572
|
compareIdentifiers: identifiers.compareIdentifiers,
|
|
3573
3573
|
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
3574
3574
|
};
|
|
@@ -17119,7 +17119,7 @@ function isCi(env = process.env) {
|
|
|
17119
17119
|
var SESSION_ID = randomUUID4();
|
|
17120
17120
|
function readCliVersion() {
|
|
17121
17121
|
if (true) {
|
|
17122
|
-
return "0.35.1-next.
|
|
17122
|
+
return "0.35.1-next.65";
|
|
17123
17123
|
}
|
|
17124
17124
|
return "0.0.0";
|
|
17125
17125
|
}
|
|
@@ -24558,7 +24558,7 @@ function printBanner() {
|
|
|
24558
24558
|
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
24559
24559
|
var import_semver5 = __toESM(require_semver2(), 1);
|
|
24560
24560
|
import * as fs25 from "node:fs";
|
|
24561
|
-
import * as
|
|
24561
|
+
import * as os6 from "node:os";
|
|
24562
24562
|
import * as path32 from "node:path";
|
|
24563
24563
|
|
|
24564
24564
|
// ../argent-installer/src/install-targets.ts
|
|
@@ -24631,12 +24631,13 @@ async function resolveInstallableUpdateTarget(pm, current, cwd, candidate) {
|
|
|
24631
24631
|
|
|
24632
24632
|
// ../argent-tools-client/src/launcher.ts
|
|
24633
24633
|
import * as net from "node:net";
|
|
24634
|
+
import * as os5 from "node:os";
|
|
24634
24635
|
import * as fs24 from "node:fs";
|
|
24635
24636
|
import * as path27 from "node:path";
|
|
24636
24637
|
import * as readline from "node:readline";
|
|
24637
24638
|
import { spawn as spawn4, execFileSync as execFileSync9 } from "node:child_process";
|
|
24638
24639
|
import { createHash as createHash3, randomBytes } from "node:crypto";
|
|
24639
|
-
import {
|
|
24640
|
+
import { readFile, readdir as readdir2, unlink } from "node:fs/promises";
|
|
24640
24641
|
var STATE_DIR = argentHomeDir();
|
|
24641
24642
|
var STATE_FILE = path27.join(STATE_DIR, "tool-server.json");
|
|
24642
24643
|
var LOG_FILE = path27.join(STATE_DIR, "tool-server.log");
|
|
@@ -24822,25 +24823,25 @@ import * as path31 from "node:path";
|
|
|
24822
24823
|
|
|
24823
24824
|
// ../argent-tools-client/src/link-config.ts
|
|
24824
24825
|
import * as path28 from "node:path";
|
|
24825
|
-
import { mkdir
|
|
24826
|
+
import { mkdir, writeFile, readFile as readFile2, unlink as unlink2, chmod } from "node:fs/promises";
|
|
24826
24827
|
var LINK_DIR = argentHomeDir();
|
|
24827
24828
|
var LINK_FILE = path28.join(LINK_DIR, "link.json");
|
|
24828
24829
|
|
|
24829
24830
|
// ../argent-tools-client/src/file-inputs.ts
|
|
24830
24831
|
import { createHash as createHash4, randomUUID as randomUUID6 } from "node:crypto";
|
|
24831
|
-
import { createReadStream as createReadStream2, rmSync as
|
|
24832
|
+
import { createReadStream as createReadStream2, rmSync as rmSync7 } from "node:fs";
|
|
24832
24833
|
import {
|
|
24833
|
-
chmod as
|
|
24834
|
+
chmod as chmod2,
|
|
24834
24835
|
lstat,
|
|
24835
|
-
mkdir as
|
|
24836
|
+
mkdir as mkdir2,
|
|
24836
24837
|
readFile as readFile3,
|
|
24837
24838
|
realpath as realpath2,
|
|
24838
|
-
rename
|
|
24839
|
+
rename,
|
|
24839
24840
|
rm as rm2,
|
|
24840
24841
|
stat as stat3,
|
|
24841
|
-
writeFile as
|
|
24842
|
+
writeFile as writeFile2
|
|
24842
24843
|
} from "node:fs/promises";
|
|
24843
|
-
import { constants as
|
|
24844
|
+
import { constants as constants3, tmpdir } from "node:os";
|
|
24844
24845
|
import * as path29 from "node:path";
|
|
24845
24846
|
|
|
24846
24847
|
// ../archive/src/index.ts
|
|
@@ -24882,13 +24883,13 @@ var RECORDING_FILE_INPUT = {
|
|
|
24882
24883
|
// ../argent-tools-client/src/artifacts.ts
|
|
24883
24884
|
import {
|
|
24884
24885
|
copyFile,
|
|
24885
|
-
mkdir as
|
|
24886
|
+
mkdir as mkdir3,
|
|
24886
24887
|
mkdtemp,
|
|
24887
24888
|
readFile as readFile6,
|
|
24888
24889
|
realpath as realpath4,
|
|
24889
24890
|
rm as rm3,
|
|
24890
24891
|
stat as stat5,
|
|
24891
|
-
writeFile as
|
|
24892
|
+
writeFile as writeFile3
|
|
24892
24893
|
} from "node:fs/promises";
|
|
24893
24894
|
import { constants as fsConstants } from "node:fs";
|
|
24894
24895
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
@@ -25409,7 +25410,7 @@ async function update(args) {
|
|
|
25409
25410
|
version: getGloballyInstalledVersion() ?? requestedVersion
|
|
25410
25411
|
});
|
|
25411
25412
|
await refreshConfiguration({
|
|
25412
|
-
projectRoot:
|
|
25413
|
+
projectRoot: os6.homedir(),
|
|
25413
25414
|
installMode: "global",
|
|
25414
25415
|
nonInteractive: true,
|
|
25415
25416
|
globalOnly: true
|