@swmansion/argent 0.34.1-next.29 → 0.34.1-next.30
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 +520 -351
- package/dist/client.js +82 -67
- package/dist/installer.mjs +830 -680
- package/dist/mcp-server.mjs +250 -207
- package/dist/tool-server.cjs +1577 -1560
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -7308,14 +7308,14 @@ var require_parser = __commonJS({
|
|
|
7308
7308
|
case "scalar":
|
|
7309
7309
|
case "single-quoted-scalar":
|
|
7310
7310
|
case "double-quoted-scalar": {
|
|
7311
|
-
const
|
|
7311
|
+
const fs9 = this.flowScalar(this.type);
|
|
7312
7312
|
if (atNextItem || it.value) {
|
|
7313
|
-
map.items.push({ start, key:
|
|
7313
|
+
map.items.push({ start, key: fs9, sep: [] });
|
|
7314
7314
|
this.onKeyLine = true;
|
|
7315
7315
|
} else if (it.sep) {
|
|
7316
|
-
this.stack.push(
|
|
7316
|
+
this.stack.push(fs9);
|
|
7317
7317
|
} else {
|
|
7318
|
-
Object.assign(it, { key:
|
|
7318
|
+
Object.assign(it, { key: fs9, sep: [] });
|
|
7319
7319
|
this.onKeyLine = true;
|
|
7320
7320
|
}
|
|
7321
7321
|
return;
|
|
@@ -7443,13 +7443,13 @@ var require_parser = __commonJS({
|
|
|
7443
7443
|
case "scalar":
|
|
7444
7444
|
case "single-quoted-scalar":
|
|
7445
7445
|
case "double-quoted-scalar": {
|
|
7446
|
-
const
|
|
7446
|
+
const fs9 = this.flowScalar(this.type);
|
|
7447
7447
|
if (!it || it.value)
|
|
7448
|
-
fc.items.push({ start: [], key:
|
|
7448
|
+
fc.items.push({ start: [], key: fs9, sep: [] });
|
|
7449
7449
|
else if (it.sep)
|
|
7450
|
-
this.stack.push(
|
|
7450
|
+
this.stack.push(fs9);
|
|
7451
7451
|
else
|
|
7452
|
-
Object.assign(it, { key:
|
|
7452
|
+
Object.assign(it, { key: fs9, sep: [] });
|
|
7453
7453
|
return;
|
|
7454
7454
|
}
|
|
7455
7455
|
case "flow-map-end":
|
|
@@ -7880,6 +7880,7 @@ function isFeatureEnabled(name, options = {}, registry = FLAG_REGISTRY) {
|
|
|
7880
7880
|
}
|
|
7881
7881
|
|
|
7882
7882
|
// ../configuration-core/src/paths.ts
|
|
7883
|
+
import * as fs2 from "node:fs";
|
|
7883
7884
|
import * as os from "node:os";
|
|
7884
7885
|
import * as path2 from "node:path";
|
|
7885
7886
|
function nonEmpty(value) {
|
|
@@ -7891,6 +7892,16 @@ function resolveHomeDir(options = {}) {
|
|
|
7891
7892
|
if (options.homeDir) return options.homeDir;
|
|
7892
7893
|
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
7893
7894
|
}
|
|
7895
|
+
function isHomeDir(dir, options = {}) {
|
|
7896
|
+
return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
|
|
7897
|
+
}
|
|
7898
|
+
function canonicalPath(p) {
|
|
7899
|
+
try {
|
|
7900
|
+
return fs2.realpathSync.native(p);
|
|
7901
|
+
} catch {
|
|
7902
|
+
return path2.resolve(p);
|
|
7903
|
+
}
|
|
7904
|
+
}
|
|
7894
7905
|
function argentHomeDir() {
|
|
7895
7906
|
return path2.join(resolveHomeDir(), ".argent");
|
|
7896
7907
|
}
|
|
@@ -7907,11 +7918,11 @@ function configFilePath(scope = "global", options = {}) {
|
|
|
7907
7918
|
|
|
7908
7919
|
// ../configuration-core/src/config.ts
|
|
7909
7920
|
import * as crypto from "node:crypto";
|
|
7910
|
-
import * as
|
|
7921
|
+
import * as fs3 from "node:fs";
|
|
7911
7922
|
import * as path3 from "node:path";
|
|
7912
7923
|
function readConfigObject(scope = "global", options = {}) {
|
|
7913
7924
|
try {
|
|
7914
|
-
const raw =
|
|
7925
|
+
const raw = fs3.readFileSync(configFilePath(scope, options), "utf8");
|
|
7915
7926
|
const json = JSON.parse(raw);
|
|
7916
7927
|
if (json && typeof json === "object" && !Array.isArray(json)) {
|
|
7917
7928
|
return json;
|
|
@@ -7948,7 +7959,7 @@ function getAtPath(obj, dottedKey) {
|
|
|
7948
7959
|
|
|
7949
7960
|
// ../configuration-core/src/secrets.ts
|
|
7950
7961
|
var import_dotenv = __toESM(require_dist(), 1);
|
|
7951
|
-
import * as
|
|
7962
|
+
import * as fs4 from "node:fs";
|
|
7952
7963
|
import * as path4 from "node:path";
|
|
7953
7964
|
var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
|
|
7954
7965
|
var SECRETS_FILE_NAME = "secrets.env";
|
|
@@ -7978,10 +7989,10 @@ function fileSource(filePath, exposure) {
|
|
|
7978
7989
|
names: [],
|
|
7979
7990
|
values: /* @__PURE__ */ new Map()
|
|
7980
7991
|
};
|
|
7981
|
-
if (!
|
|
7992
|
+
if (!fs4.statSync(filePath, { throwIfNoEntry: false })) return absent;
|
|
7982
7993
|
let content;
|
|
7983
7994
|
try {
|
|
7984
|
-
content =
|
|
7995
|
+
content = fs4.readFileSync(filePath, "utf8");
|
|
7985
7996
|
} catch {
|
|
7986
7997
|
return absent;
|
|
7987
7998
|
}
|
|
@@ -8007,7 +8018,9 @@ function fileSource(filePath, exposure) {
|
|
|
8007
8018
|
}
|
|
8008
8019
|
function secretSources(options = {}) {
|
|
8009
8020
|
const sources = [envSource(options.env ?? process.env)];
|
|
8010
|
-
const
|
|
8021
|
+
const home = resolveHomeDir(options);
|
|
8022
|
+
const found = findProjectRoot(options.cwd ?? process.cwd());
|
|
8023
|
+
const projectRoot = found && isHomeDir(found, options) ? home : found;
|
|
8011
8024
|
const filePaths = [];
|
|
8012
8025
|
if (projectRoot) {
|
|
8013
8026
|
filePaths.push({
|
|
@@ -8019,7 +8032,7 @@ function secretSources(options = {}) {
|
|
|
8019
8032
|
}
|
|
8020
8033
|
}
|
|
8021
8034
|
filePaths.push({
|
|
8022
|
-
path: path4.join(
|
|
8035
|
+
path: path4.join(home, ".argent", SECRETS_FILE_NAME),
|
|
8023
8036
|
exposure: "dedicated"
|
|
8024
8037
|
});
|
|
8025
8038
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -8263,7 +8276,7 @@ var UnknownConfigKeyError = class extends Error {
|
|
|
8263
8276
|
|
|
8264
8277
|
// ../argent-tools-client/src/launcher.ts
|
|
8265
8278
|
import * as net from "node:net";
|
|
8266
|
-
import * as
|
|
8279
|
+
import * as fs5 from "node:fs";
|
|
8267
8280
|
import * as path6 from "node:path";
|
|
8268
8281
|
import * as readline from "node:readline";
|
|
8269
8282
|
import { homedir as homedir3 } from "node:os";
|
|
@@ -8277,6 +8290,7 @@ var LOCK_FILE = path6.join(STATE_DIR, "tool-server.lock");
|
|
|
8277
8290
|
var AUTH_TOKEN_BYTES = 32;
|
|
8278
8291
|
var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
|
|
8279
8292
|
var AUTOSPAWN_IDLE_TIMEOUT_MINUTES = 30;
|
|
8293
|
+
var AUTOSPAWN_HOST = "127.0.0.1";
|
|
8280
8294
|
function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
|
|
8281
8295
|
const env = {
|
|
8282
8296
|
...baseEnv,
|
|
@@ -8288,7 +8302,7 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
|
|
|
8288
8302
|
if (options.idleTimeoutMinutes !== void 0) {
|
|
8289
8303
|
env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
|
|
8290
8304
|
}
|
|
8291
|
-
|
|
8305
|
+
env[AUTH_TOKEN_ENV] = options.token ?? "";
|
|
8292
8306
|
if (paths.installKind) env.ARGENT_INSTALL_KIND = paths.installKind;
|
|
8293
8307
|
if (paths.installProjectRoot) env.ARGENT_PROJECT_ROOT = paths.installProjectRoot;
|
|
8294
8308
|
return env;
|
|
@@ -8297,7 +8311,7 @@ function generateToken() {
|
|
|
8297
8311
|
return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
|
|
8298
8312
|
}
|
|
8299
8313
|
function findFreePort() {
|
|
8300
|
-
return new Promise((
|
|
8314
|
+
return new Promise((resolve10, reject) => {
|
|
8301
8315
|
const srv = net.createServer();
|
|
8302
8316
|
srv.listen(0, "127.0.0.1", () => {
|
|
8303
8317
|
const addr = srv.address();
|
|
@@ -8308,7 +8322,7 @@ function findFreePort() {
|
|
|
8308
8322
|
const port = addr.port;
|
|
8309
8323
|
srv.close((err) => {
|
|
8310
8324
|
if (err) reject(err);
|
|
8311
|
-
else
|
|
8325
|
+
else resolve10(port);
|
|
8312
8326
|
});
|
|
8313
8327
|
});
|
|
8314
8328
|
srv.on("error", reject);
|
|
@@ -8350,7 +8364,7 @@ function isVersionNewer(a, b) {
|
|
|
8350
8364
|
function readBundlePackageVersion(bundlePath) {
|
|
8351
8365
|
try {
|
|
8352
8366
|
const pkg = JSON.parse(
|
|
8353
|
-
|
|
8367
|
+
fs5.readFileSync(path6.join(path6.dirname(bundlePath), "..", "package.json"), "utf8")
|
|
8354
8368
|
);
|
|
8355
8369
|
return typeof pkg.version === "string" ? pkg.version : void 0;
|
|
8356
8370
|
} catch {
|
|
@@ -8407,16 +8421,16 @@ function killSpawnedChild(child, pid) {
|
|
|
8407
8421
|
}
|
|
8408
8422
|
function resolveToolsServerNode() {
|
|
8409
8423
|
const { bun, deno, electron } = process.versions;
|
|
8410
|
-
return !(bun || deno || electron) &&
|
|
8424
|
+
return !(bun || deno || electron) && fs5.existsSync(process.execPath) ? process.execPath : "node";
|
|
8411
8425
|
}
|
|
8412
8426
|
function spawnToolsServer(paths, port, options = {}) {
|
|
8413
|
-
return new Promise((
|
|
8427
|
+
return new Promise((resolve10, reject) => {
|
|
8414
8428
|
let logFd;
|
|
8415
8429
|
try {
|
|
8416
|
-
|
|
8417
|
-
logFd =
|
|
8430
|
+
fs5.mkdirSync(STATE_DIR, { recursive: true });
|
|
8431
|
+
logFd = fs5.openSync(LOG_FILE, "a");
|
|
8418
8432
|
} catch {
|
|
8419
|
-
logFd =
|
|
8433
|
+
logFd = fs5.openSync("/dev/null", "w");
|
|
8420
8434
|
}
|
|
8421
8435
|
const nodeBin = resolveToolsServerNode();
|
|
8422
8436
|
const child = spawn(nodeBin, [paths.bundlePath, "start"], {
|
|
@@ -8424,7 +8438,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
8424
8438
|
stdio: ["ignore", "pipe", logFd],
|
|
8425
8439
|
env: buildToolsServerEnv(paths, port, process.env, options)
|
|
8426
8440
|
});
|
|
8427
|
-
|
|
8441
|
+
fs5.closeSync(logFd);
|
|
8428
8442
|
child.unref();
|
|
8429
8443
|
const pid = child.pid;
|
|
8430
8444
|
if (!pid) {
|
|
@@ -8456,7 +8470,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
8456
8470
|
rl.close();
|
|
8457
8471
|
child.stdout?.resume();
|
|
8458
8472
|
child.stdout?.unref?.();
|
|
8459
|
-
settle(() =>
|
|
8473
|
+
settle(() => resolve10({ port: actualPort, pid }));
|
|
8460
8474
|
}
|
|
8461
8475
|
});
|
|
8462
8476
|
child.on("error", (err) => {
|
|
@@ -8551,7 +8565,7 @@ async function sweepDeadStateFiles() {
|
|
|
8551
8565
|
});
|
|
8552
8566
|
continue;
|
|
8553
8567
|
}
|
|
8554
|
-
if (
|
|
8568
|
+
if (fs5.existsSync(fresh.bundlePath)) continue;
|
|
8555
8569
|
if (!couldBeOurToolServer(fresh.pid, fresh.bundlePath)) continue;
|
|
8556
8570
|
await unlink(file).catch(() => {
|
|
8557
8571
|
});
|
|
@@ -8598,7 +8612,7 @@ async function killToolServer(bundlePath) {
|
|
|
8598
8612
|
await clearToolsServerState(bundlePath ?? state.bundlePath);
|
|
8599
8613
|
return alive;
|
|
8600
8614
|
}
|
|
8601
|
-
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) =>
|
|
8615
|
+
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs5.existsSync(p)) ?? "ps";
|
|
8602
8616
|
var PS_WIDTH_FLAGS = ["-ww"];
|
|
8603
8617
|
var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
8604
8618
|
function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
|
|
@@ -8645,13 +8659,13 @@ var LOCK_STALE_MS = 45e3;
|
|
|
8645
8659
|
var LOCK_POLL_MS = 100;
|
|
8646
8660
|
function spawnLockIsStale() {
|
|
8647
8661
|
try {
|
|
8648
|
-
const { pid, ts } = JSON.parse(
|
|
8662
|
+
const { pid, ts } = JSON.parse(fs5.readFileSync(LOCK_FILE, "utf8"));
|
|
8649
8663
|
if (typeof pid === "number" && pid > 0 && !isProcessAlive(pid)) return true;
|
|
8650
8664
|
if (typeof ts === "number" && Date.now() - ts > LOCK_STALE_MS) return true;
|
|
8651
8665
|
return false;
|
|
8652
8666
|
} catch {
|
|
8653
8667
|
try {
|
|
8654
|
-
return Date.now() -
|
|
8668
|
+
return Date.now() - fs5.statSync(LOCK_FILE).mtimeMs > LOCK_STALE_MS;
|
|
8655
8669
|
} catch {
|
|
8656
8670
|
return true;
|
|
8657
8671
|
}
|
|
@@ -8659,7 +8673,7 @@ function spawnLockIsStale() {
|
|
|
8659
8673
|
}
|
|
8660
8674
|
async function acquireSpawnLock() {
|
|
8661
8675
|
try {
|
|
8662
|
-
|
|
8676
|
+
fs5.mkdirSync(STATE_DIR, { recursive: true });
|
|
8663
8677
|
} catch {
|
|
8664
8678
|
return null;
|
|
8665
8679
|
}
|
|
@@ -8667,11 +8681,11 @@ async function acquireSpawnLock() {
|
|
|
8667
8681
|
const deadline = Date.now() + LOCK_WAIT_TIMEOUT_MS;
|
|
8668
8682
|
for (; ; ) {
|
|
8669
8683
|
try {
|
|
8670
|
-
const fd =
|
|
8684
|
+
const fd = fs5.openSync(LOCK_FILE, "wx");
|
|
8671
8685
|
try {
|
|
8672
|
-
|
|
8686
|
+
fs5.writeSync(fd, JSON.stringify({ pid: process.pid, nonce, ts: Date.now() }));
|
|
8673
8687
|
} finally {
|
|
8674
|
-
|
|
8688
|
+
fs5.closeSync(fd);
|
|
8675
8689
|
}
|
|
8676
8690
|
let released = false;
|
|
8677
8691
|
return {
|
|
@@ -8679,8 +8693,8 @@ async function acquireSpawnLock() {
|
|
|
8679
8693
|
if (released) return;
|
|
8680
8694
|
released = true;
|
|
8681
8695
|
try {
|
|
8682
|
-
const cur = JSON.parse(
|
|
8683
|
-
if (cur.pid === process.pid && cur.nonce === nonce)
|
|
8696
|
+
const cur = JSON.parse(fs5.readFileSync(LOCK_FILE, "utf8"));
|
|
8697
|
+
if (cur.pid === process.pid && cur.nonce === nonce) fs5.unlinkSync(LOCK_FILE);
|
|
8684
8698
|
} catch {
|
|
8685
8699
|
}
|
|
8686
8700
|
}
|
|
@@ -8689,10 +8703,10 @@ async function acquireSpawnLock() {
|
|
|
8689
8703
|
if (err.code !== "EEXIST") return null;
|
|
8690
8704
|
if (spawnLockIsStale()) {
|
|
8691
8705
|
try {
|
|
8692
|
-
|
|
8706
|
+
fs5.unlinkSync(LOCK_FILE);
|
|
8693
8707
|
} catch {
|
|
8694
8708
|
}
|
|
8695
|
-
if (!
|
|
8709
|
+
if (!fs5.existsSync(LOCK_FILE)) continue;
|
|
8696
8710
|
}
|
|
8697
8711
|
if (Date.now() >= deadline) return null;
|
|
8698
8712
|
await new Promise((r) => setTimeout(r, LOCK_POLL_MS));
|
|
@@ -8732,7 +8746,7 @@ async function ensureToolsServer(paths) {
|
|
|
8732
8746
|
}
|
|
8733
8747
|
await clearToolsServerState(paths.bundlePath);
|
|
8734
8748
|
await sweepDeadStateFiles();
|
|
8735
|
-
if (!
|
|
8749
|
+
if (!fs5.existsSync(paths.bundlePath)) {
|
|
8736
8750
|
throw new Error(
|
|
8737
8751
|
`The argent install serving this session is gone from disk (${paths.bundlePath}) \u2014 it was likely updated or removed. Restart the editor's MCP connection to reconnect.`
|
|
8738
8752
|
);
|
|
@@ -8742,6 +8756,7 @@ async function ensureToolsServer(paths) {
|
|
|
8742
8756
|
const port = await findFreePort();
|
|
8743
8757
|
const { port: actualPort, pid } = await spawnToolsServer(paths, port, {
|
|
8744
8758
|
token,
|
|
8759
|
+
host: AUTOSPAWN_HOST,
|
|
8745
8760
|
idleTimeoutMinutes: AUTOSPAWN_IDLE_TIMEOUT_MINUTES
|
|
8746
8761
|
});
|
|
8747
8762
|
await writeState({
|
|
@@ -8750,11 +8765,11 @@ async function ensureToolsServer(paths) {
|
|
|
8750
8765
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8751
8766
|
bundlePath: paths.bundlePath,
|
|
8752
8767
|
version: diskVersion,
|
|
8753
|
-
host:
|
|
8768
|
+
host: AUTOSPAWN_HOST,
|
|
8754
8769
|
token,
|
|
8755
8770
|
managed: "autospawn"
|
|
8756
8771
|
});
|
|
8757
|
-
return { url: formatUrl(
|
|
8772
|
+
return { url: formatUrl(AUTOSPAWN_HOST, actualPort), token };
|
|
8758
8773
|
} finally {
|
|
8759
8774
|
lock?.release();
|
|
8760
8775
|
}
|
|
@@ -8826,11 +8841,11 @@ function isClientFileArgument({ spec, path: path14 }) {
|
|
|
8826
8841
|
}
|
|
8827
8842
|
|
|
8828
8843
|
// ../registry/src/flow-file-refs.ts
|
|
8829
|
-
import * as
|
|
8844
|
+
import * as fs7 from "node:fs/promises";
|
|
8830
8845
|
import * as path8 from "node:path";
|
|
8831
8846
|
|
|
8832
8847
|
// ../registry/src/e2e-dirs.ts
|
|
8833
|
-
import * as
|
|
8848
|
+
import * as fs6 from "node:fs/promises";
|
|
8834
8849
|
import * as path7 from "node:path";
|
|
8835
8850
|
var E2E_DIR = path7.join(".argent", "e2e");
|
|
8836
8851
|
var LEGACY_E2E_DIRS = Object.freeze([path7.join(".argent", "flows")]);
|
|
@@ -8845,7 +8860,7 @@ function e2eFileCandidates(projectRoot, name) {
|
|
|
8845
8860
|
return e2eDirsFor(projectRoot).map((dir) => path7.join(dir, `${name}.yaml`));
|
|
8846
8861
|
}
|
|
8847
8862
|
async function exists(file) {
|
|
8848
|
-
return
|
|
8863
|
+
return fs6.stat(file).then(
|
|
8849
8864
|
() => true,
|
|
8850
8865
|
() => false
|
|
8851
8866
|
);
|
|
@@ -8936,10 +8951,10 @@ function canonicalToolArgs(tool, args) {
|
|
|
8936
8951
|
// ../registry/src/flow-file-refs.ts
|
|
8937
8952
|
async function canonicalFlowPath(p) {
|
|
8938
8953
|
try {
|
|
8939
|
-
return await
|
|
8954
|
+
return await fs7.realpath(p);
|
|
8940
8955
|
} catch {
|
|
8941
8956
|
try {
|
|
8942
|
-
return path8.join(await
|
|
8957
|
+
return path8.join(await fs7.realpath(path8.dirname(p)), path8.basename(p));
|
|
8943
8958
|
} catch {
|
|
8944
8959
|
return p;
|
|
8945
8960
|
}
|
|
@@ -8985,15 +9000,15 @@ function collectFlowRequests(doc) {
|
|
|
8985
9000
|
if (isRecord(doc)) visit(doc.steps, 0);
|
|
8986
9001
|
return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
|
|
8987
9002
|
}
|
|
8988
|
-
function baselineKeyFor(
|
|
8989
|
-
const stem = path8.basename(
|
|
9003
|
+
function baselineKeyFor(canonicalPath2, flowName) {
|
|
9004
|
+
const stem = path8.basename(canonicalPath2, ".yaml");
|
|
8990
9005
|
return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
|
|
8991
9006
|
}
|
|
8992
9007
|
function flowMemberKey(anchorDir, target) {
|
|
8993
9008
|
return `${anchorDir}\0${target}`;
|
|
8994
9009
|
}
|
|
8995
9010
|
async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
|
|
8996
|
-
const entries = await
|
|
9011
|
+
const entries = await fs7.readdir(dir).catch(() => null);
|
|
8997
9012
|
if (entries === null || entries.includes(base)) return { state: "listed" };
|
|
8998
9013
|
const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
|
|
8999
9014
|
if (actual === void 0) return { state: "absent" };
|
|
@@ -9601,7 +9616,7 @@ import { spawn as spawn2 } from "node:child_process";
|
|
|
9601
9616
|
import { once } from "node:events";
|
|
9602
9617
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
9603
9618
|
import { open, rm, readdir as readdir3 } from "node:fs/promises";
|
|
9604
|
-
import { basename as basename4, dirname as dirname5, join as join9, resolve as
|
|
9619
|
+
import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve7, sep as sep2 } from "node:path";
|
|
9605
9620
|
import { Writable } from "node:stream";
|
|
9606
9621
|
import { pipeline } from "node:stream/promises";
|
|
9607
9622
|
import zlib from "node:zlib";
|
|
@@ -9756,7 +9771,7 @@ async function runTar(archive, args, signal) {
|
|
|
9756
9771
|
child.on("error", (err) => {
|
|
9757
9772
|
childError = err;
|
|
9758
9773
|
});
|
|
9759
|
-
const closed = new Promise((
|
|
9774
|
+
const closed = new Promise((resolve10) => child.once("close", resolve10));
|
|
9760
9775
|
const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
|
|
9761
9776
|
maxLines: MAX_LISTING_LINES,
|
|
9762
9777
|
onOverflow: () => child.kill()
|
|
@@ -9813,8 +9828,8 @@ function isContainedPath(path14, windows = process.platform === "win32") {
|
|
|
9813
9828
|
function isSafeTarMember(memberPath, destDir) {
|
|
9814
9829
|
const normalized = normalizeTarMemberPath(memberPath);
|
|
9815
9830
|
if (!isContainedPath(normalized)) return false;
|
|
9816
|
-
const root =
|
|
9817
|
-
return
|
|
9831
|
+
const root = resolve7(destDir);
|
|
9832
|
+
return resolve7(destDir, normalized).startsWith(root + sep2);
|
|
9818
9833
|
}
|
|
9819
9834
|
async function readListing(archive, args, signal) {
|
|
9820
9835
|
try {
|
|
@@ -9970,10 +9985,10 @@ function untrackArchive(archive) {
|
|
|
9970
9985
|
for (const s of ARCHIVE_SIGNALS) process.removeListener(s, removeArchivesOnSignal);
|
|
9971
9986
|
process.removeListener("exit", removePendingArchives);
|
|
9972
9987
|
}
|
|
9973
|
-
function sha256File(filePath) {
|
|
9974
|
-
return new Promise((
|
|
9988
|
+
function sha256File(filePath, signal) {
|
|
9989
|
+
return new Promise((resolve10, reject) => {
|
|
9975
9990
|
const hash = createHash2("sha256");
|
|
9976
|
-
createReadStream2(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () =>
|
|
9991
|
+
createReadStream2(filePath, { signal }).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve10(hash.digest("hex"))).on("error", reject);
|
|
9977
9992
|
});
|
|
9978
9993
|
}
|
|
9979
9994
|
function toolServerError(text) {
|
|
@@ -10036,7 +10051,7 @@ async function uploadFile(sourcePath, endpoint, signal) {
|
|
|
10036
10051
|
trackArchive(tarPath);
|
|
10037
10052
|
try {
|
|
10038
10053
|
await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
|
|
10039
|
-
const contentHash = await sha256File(tarPath);
|
|
10054
|
+
const contentHash = await sha256File(tarPath, signal);
|
|
10040
10055
|
return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
|
|
10041
10056
|
} finally {
|
|
10042
10057
|
untrackArchive(tarPath);
|
|
@@ -11091,7 +11106,7 @@ import {
|
|
|
11091
11106
|
} from "node:fs/promises";
|
|
11092
11107
|
import { constants as fsConstants } from "node:fs";
|
|
11093
11108
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
11094
|
-
import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as
|
|
11109
|
+
import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as resolve9, sep as sep4 } from "node:path";
|
|
11095
11110
|
import { createHash as createHash3 } from "node:crypto";
|
|
11096
11111
|
var ARTIFACT_MARKER2 = "__argentArtifact";
|
|
11097
11112
|
function isArtifactHandle(value) {
|
|
@@ -11140,7 +11155,7 @@ function configuredRecordingsDir() {
|
|
|
11140
11155
|
if (trimmed === "") return null;
|
|
11141
11156
|
const home = dirname9(argentHomeDir());
|
|
11142
11157
|
const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep4}`) ? join13(home, trimmed.slice(2)) : trimmed;
|
|
11143
|
-
return
|
|
11158
|
+
return resolve9(durableBaseDir(), expanded);
|
|
11144
11159
|
}
|
|
11145
11160
|
var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
|
|
11146
11161
|
async function readCapped(res, cap) {
|
|
@@ -11370,12 +11385,12 @@ function getDeviceIdFromArgs(args) {
|
|
|
11370
11385
|
}
|
|
11371
11386
|
|
|
11372
11387
|
// src/bundled-paths.ts
|
|
11373
|
-
import * as
|
|
11388
|
+
import * as fs8 from "node:fs";
|
|
11374
11389
|
import * as path13 from "node:path";
|
|
11375
11390
|
function readPackageVersion() {
|
|
11376
11391
|
try {
|
|
11377
11392
|
const pkg = JSON.parse(
|
|
11378
|
-
|
|
11393
|
+
fs8.readFileSync(path13.join(import.meta.dirname, "..", "package.json"), "utf8")
|
|
11379
11394
|
);
|
|
11380
11395
|
return pkg.version;
|
|
11381
11396
|
} catch {
|
|
@@ -11386,9 +11401,9 @@ var PACKAGE_NAME = "@swmansion/argent";
|
|
|
11386
11401
|
function findDeclaringRoot(startDir) {
|
|
11387
11402
|
let dir = startDir;
|
|
11388
11403
|
for (; ; ) {
|
|
11389
|
-
if (
|
|
11404
|
+
if (fs8.existsSync(path13.join(dir, ".argent", "install.json"))) return dir;
|
|
11390
11405
|
try {
|
|
11391
|
-
const manifest = JSON.parse(
|
|
11406
|
+
const manifest = JSON.parse(fs8.readFileSync(path13.join(dir, "package.json"), "utf8"));
|
|
11392
11407
|
if (manifest.devDependencies?.[PACKAGE_NAME] || manifest.dependencies?.[PACKAGE_NAME] || manifest.optionalDependencies?.[PACKAGE_NAME]) {
|
|
11393
11408
|
return dir;
|
|
11394
11409
|
}
|
|
@@ -11404,7 +11419,7 @@ function findStablePackageDir(startDir, packageRoot) {
|
|
|
11404
11419
|
for (; ; ) {
|
|
11405
11420
|
const candidate = path13.join(dir, "node_modules", PACKAGE_NAME);
|
|
11406
11421
|
try {
|
|
11407
|
-
if (
|
|
11422
|
+
if (fs8.realpathSync(candidate) === packageRoot) return candidate;
|
|
11408
11423
|
} catch {
|
|
11409
11424
|
}
|
|
11410
11425
|
const parent = path13.dirname(dir);
|
|
@@ -11417,7 +11432,7 @@ function classifyInstall() {
|
|
|
11417
11432
|
let dir;
|
|
11418
11433
|
let cwd;
|
|
11419
11434
|
try {
|
|
11420
|
-
packageRoot =
|
|
11435
|
+
packageRoot = fs8.realpathSync(path13.join(import.meta.dirname, ".."));
|
|
11421
11436
|
cwd = process.cwd();
|
|
11422
11437
|
dir = cwd;
|
|
11423
11438
|
} catch {
|
|
@@ -11425,7 +11440,7 @@ function classifyInstall() {
|
|
|
11425
11440
|
}
|
|
11426
11441
|
for (; ; ) {
|
|
11427
11442
|
try {
|
|
11428
|
-
const nmReal =
|
|
11443
|
+
const nmReal = fs8.realpathSync(path13.join(dir, "node_modules"));
|
|
11429
11444
|
if (packageRoot === nmReal || packageRoot.startsWith(nmReal + path13.sep)) {
|
|
11430
11445
|
return {
|
|
11431
11446
|
kind: "local",
|