@swmansion/argent 0.16.2-next.8 → 0.17.0
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.1.0.apk +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/tcp/ax-service +0 -0
- package/dist/cli-cmds.mjs +1710 -1594
- package/dist/installer.mjs +67 -63
- package/dist/mcp-server.mjs +306 -188
- package/dist/tool-server.cjs +206 -52
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.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 +1 -1
- package/skills/argent-screen-recording/SKILL.md +10 -4
package/dist/mcp-server.mjs
CHANGED
|
@@ -2235,8 +2235,8 @@ var require_resolve = __commonJS({
|
|
|
2235
2235
|
}
|
|
2236
2236
|
return count;
|
|
2237
2237
|
}
|
|
2238
|
-
function getFullPath(resolver, id = "",
|
|
2239
|
-
if (
|
|
2238
|
+
function getFullPath(resolver, id = "", normalize2) {
|
|
2239
|
+
if (normalize2 !== false)
|
|
2240
2240
|
id = normalizeId(id);
|
|
2241
2241
|
const p = resolver.parse(id);
|
|
2242
2242
|
return _getFullPath(resolver, p);
|
|
@@ -3632,7 +3632,7 @@ var require_fast_uri = __commonJS({
|
|
|
3632
3632
|
"use strict";
|
|
3633
3633
|
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
3634
3634
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
3635
|
-
function
|
|
3635
|
+
function normalize2(uri, options) {
|
|
3636
3636
|
if (typeof uri === "string") {
|
|
3637
3637
|
uri = /** @type {T} */
|
|
3638
3638
|
normalizeString(uri, options);
|
|
@@ -3899,7 +3899,7 @@ var require_fast_uri = __commonJS({
|
|
|
3899
3899
|
}
|
|
3900
3900
|
var fastUri = {
|
|
3901
3901
|
SCHEMES,
|
|
3902
|
-
normalize,
|
|
3902
|
+
normalize: normalize2,
|
|
3903
3903
|
resolve: resolve5,
|
|
3904
3904
|
resolveComponent,
|
|
3905
3905
|
equal,
|
|
@@ -6891,7 +6891,7 @@ var require_dist = __commonJS({
|
|
|
6891
6891
|
|
|
6892
6892
|
// ../argent-mcp/src/mcp-server.ts
|
|
6893
6893
|
import { appendFile, mkdir as mkdir5 } from "node:fs/promises";
|
|
6894
|
-
import { dirname as
|
|
6894
|
+
import { dirname as dirname6 } from "node:path";
|
|
6895
6895
|
import { homedir as homedir5 } from "node:os";
|
|
6896
6896
|
|
|
6897
6897
|
// ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
@@ -16203,10 +16203,183 @@ async function applyClientFileDirectives(result) {
|
|
|
16203
16203
|
}
|
|
16204
16204
|
|
|
16205
16205
|
// ../argent-tools-client/src/artifacts.ts
|
|
16206
|
-
import { mkdir as mkdir4, readFile as readFile4, rm as rm3, stat as stat2, writeFile as writeFile4 } from "node:fs/promises";
|
|
16206
|
+
import { copyFile, mkdir as mkdir4, readFile as readFile4, realpath, rm as rm3, stat as stat2, writeFile as writeFile4 } from "node:fs/promises";
|
|
16207
|
+
import { constants as fsConstants } from "node:fs";
|
|
16207
16208
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
16208
|
-
import { basename as basename3, join as
|
|
16209
|
+
import { basename as basename3, dirname as dirname5, extname, isAbsolute as isAbsolute3, join as join8, normalize, sep as sep2 } from "node:path";
|
|
16209
16210
|
import { createHash as createHash3 } from "node:crypto";
|
|
16211
|
+
|
|
16212
|
+
// ../configuration-core/src/flags.ts
|
|
16213
|
+
import * as fs2 from "node:fs";
|
|
16214
|
+
import * as path4 from "node:path";
|
|
16215
|
+
import { homedir as homedir3 } from "node:os";
|
|
16216
|
+
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
16217
|
+
function findProjectRoot(startDir) {
|
|
16218
|
+
let current = path4.resolve(startDir);
|
|
16219
|
+
while (true) {
|
|
16220
|
+
for (const marker of PROJECT_MARKERS) {
|
|
16221
|
+
if (fs2.existsSync(path4.join(current, marker))) return current;
|
|
16222
|
+
}
|
|
16223
|
+
const parent = path4.dirname(current);
|
|
16224
|
+
if (parent === current) return null;
|
|
16225
|
+
current = parent;
|
|
16226
|
+
}
|
|
16227
|
+
}
|
|
16228
|
+
function resolveProjectRoot(startDir) {
|
|
16229
|
+
return findProjectRoot(startDir) ?? path4.resolve(startDir);
|
|
16230
|
+
}
|
|
16231
|
+
function getFlagsPath(scope, options = {}) {
|
|
16232
|
+
const home = options.homeDir ?? homedir3();
|
|
16233
|
+
if (scope === "global") {
|
|
16234
|
+
return path4.join(home, ".argent", "flags.json");
|
|
16235
|
+
}
|
|
16236
|
+
const cwd = options.cwd ?? process.cwd();
|
|
16237
|
+
return path4.join(resolveProjectRoot(cwd), ".argent", "flags.json");
|
|
16238
|
+
}
|
|
16239
|
+
function readFlagsFile(filePath) {
|
|
16240
|
+
let raw;
|
|
16241
|
+
try {
|
|
16242
|
+
raw = fs2.readFileSync(filePath, "utf8");
|
|
16243
|
+
} catch {
|
|
16244
|
+
return {};
|
|
16245
|
+
}
|
|
16246
|
+
let parsed;
|
|
16247
|
+
try {
|
|
16248
|
+
parsed = JSON.parse(raw);
|
|
16249
|
+
} catch {
|
|
16250
|
+
return {};
|
|
16251
|
+
}
|
|
16252
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
|
|
16253
|
+
const flags = parsed.flags;
|
|
16254
|
+
if (!flags || typeof flags !== "object" || Array.isArray(flags)) return {};
|
|
16255
|
+
const out = {};
|
|
16256
|
+
for (const [k, v] of Object.entries(flags)) {
|
|
16257
|
+
if (typeof v === "boolean") out[k] = v;
|
|
16258
|
+
}
|
|
16259
|
+
return out;
|
|
16260
|
+
}
|
|
16261
|
+
function readFlags(scope, options = {}) {
|
|
16262
|
+
return readFlagsFile(getFlagsPath(scope, options));
|
|
16263
|
+
}
|
|
16264
|
+
function isFlagEnabled(name, options = {}) {
|
|
16265
|
+
const projectFlags = readFlags("project", options);
|
|
16266
|
+
if (Object.hasOwn(projectFlags, name)) return projectFlags[name];
|
|
16267
|
+
const globalFlags = readFlags("global", options);
|
|
16268
|
+
if (Object.hasOwn(globalFlags, name)) return globalFlags[name];
|
|
16269
|
+
return options.default ?? false;
|
|
16270
|
+
}
|
|
16271
|
+
|
|
16272
|
+
// ../configuration-core/src/paths.ts
|
|
16273
|
+
import * as os from "node:os";
|
|
16274
|
+
import * as path5 from "node:path";
|
|
16275
|
+
function nonEmpty(value) {
|
|
16276
|
+
if (value == void 0) return null;
|
|
16277
|
+
const trimmed = value.trim();
|
|
16278
|
+
return trimmed === "" ? null : value;
|
|
16279
|
+
}
|
|
16280
|
+
function argentHomeDir() {
|
|
16281
|
+
const home = process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
16282
|
+
return path5.join(home, ".argent");
|
|
16283
|
+
}
|
|
16284
|
+
function configDir(scope = "global", options = {}) {
|
|
16285
|
+
if (scope === "global") {
|
|
16286
|
+
return options.homeDir ? path5.join(options.homeDir, ".argent") : argentHomeDir();
|
|
16287
|
+
}
|
|
16288
|
+
const cwd = options.cwd ?? process.cwd();
|
|
16289
|
+
return path5.join(resolveProjectRoot(cwd), ".argent");
|
|
16290
|
+
}
|
|
16291
|
+
function configFilePath(scope = "global", options = {}) {
|
|
16292
|
+
return path5.join(configDir(scope, options), "config.json");
|
|
16293
|
+
}
|
|
16294
|
+
|
|
16295
|
+
// ../configuration-core/src/config.ts
|
|
16296
|
+
import * as crypto from "node:crypto";
|
|
16297
|
+
import * as fs3 from "node:fs";
|
|
16298
|
+
import * as path6 from "node:path";
|
|
16299
|
+
function readConfigObject(scope = "global", options = {}) {
|
|
16300
|
+
try {
|
|
16301
|
+
const raw = fs3.readFileSync(configFilePath(scope, options), "utf8");
|
|
16302
|
+
const json = JSON.parse(raw);
|
|
16303
|
+
if (json && typeof json === "object" && !Array.isArray(json)) {
|
|
16304
|
+
return json;
|
|
16305
|
+
}
|
|
16306
|
+
} catch {
|
|
16307
|
+
}
|
|
16308
|
+
return {};
|
|
16309
|
+
}
|
|
16310
|
+
var LOCK_STALE_MS2 = 1e4;
|
|
16311
|
+
var LOCK_MAX_WAIT_MS = 2e3;
|
|
16312
|
+
var LOCK_RETRY_MS = 25;
|
|
16313
|
+
function sleepSync(ms) {
|
|
16314
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
16315
|
+
}
|
|
16316
|
+
function acquireConfigLock(finalPath) {
|
|
16317
|
+
const lockPath = finalPath + ".lock";
|
|
16318
|
+
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
16319
|
+
for (; ; ) {
|
|
16320
|
+
try {
|
|
16321
|
+
const fd = fs3.openSync(lockPath, "wx", 384);
|
|
16322
|
+
try {
|
|
16323
|
+
fs3.writeSync(fd, `${process.pid}
|
|
16324
|
+
`);
|
|
16325
|
+
} catch {
|
|
16326
|
+
}
|
|
16327
|
+
return { fd, lockPath };
|
|
16328
|
+
} catch (err) {
|
|
16329
|
+
if (err.code !== "EEXIST") return null;
|
|
16330
|
+
try {
|
|
16331
|
+
if (Date.now() - fs3.statSync(lockPath).mtimeMs > LOCK_STALE_MS2) {
|
|
16332
|
+
fs3.unlinkSync(lockPath);
|
|
16333
|
+
continue;
|
|
16334
|
+
}
|
|
16335
|
+
} catch {
|
|
16336
|
+
}
|
|
16337
|
+
if (Date.now() >= deadline) return null;
|
|
16338
|
+
sleepSync(LOCK_RETRY_MS);
|
|
16339
|
+
}
|
|
16340
|
+
}
|
|
16341
|
+
}
|
|
16342
|
+
function releaseConfigLock(lock) {
|
|
16343
|
+
try {
|
|
16344
|
+
fs3.closeSync(lock.fd);
|
|
16345
|
+
} catch {
|
|
16346
|
+
}
|
|
16347
|
+
try {
|
|
16348
|
+
fs3.unlinkSync(lock.lockPath);
|
|
16349
|
+
} catch {
|
|
16350
|
+
}
|
|
16351
|
+
}
|
|
16352
|
+
function updateConfig(mutate, scope = "global", options = {}) {
|
|
16353
|
+
const dir = configDir(scope, options);
|
|
16354
|
+
fs3.mkdirSync(dir, { recursive: true });
|
|
16355
|
+
const finalPath = configFilePath(scope, options);
|
|
16356
|
+
const lock = acquireConfigLock(finalPath);
|
|
16357
|
+
try {
|
|
16358
|
+
const next = readConfigObject(scope, options);
|
|
16359
|
+
mutate(next);
|
|
16360
|
+
const tmpPath = path6.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
16361
|
+
const fd = fs3.openSync(tmpPath, "wx", 384);
|
|
16362
|
+
try {
|
|
16363
|
+
fs3.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
16364
|
+
fs3.fsyncSync(fd);
|
|
16365
|
+
} finally {
|
|
16366
|
+
fs3.closeSync(fd);
|
|
16367
|
+
}
|
|
16368
|
+
try {
|
|
16369
|
+
fs3.renameSync(tmpPath, finalPath);
|
|
16370
|
+
} catch (err) {
|
|
16371
|
+
try {
|
|
16372
|
+
fs3.unlinkSync(tmpPath);
|
|
16373
|
+
} catch {
|
|
16374
|
+
}
|
|
16375
|
+
throw err;
|
|
16376
|
+
}
|
|
16377
|
+
} finally {
|
|
16378
|
+
if (lock) releaseConfigLock(lock);
|
|
16379
|
+
}
|
|
16380
|
+
}
|
|
16381
|
+
|
|
16382
|
+
// ../argent-tools-client/src/artifacts.ts
|
|
16210
16383
|
var ARTIFACT_MARKER = "__argentArtifact";
|
|
16211
16384
|
function isArtifactHandle(value) {
|
|
16212
16385
|
return !!value && typeof value === "object" && value[ARTIFACT_MARKER] === true && typeof value.id === "string" && typeof value.filename === "string";
|
|
@@ -16229,12 +16402,79 @@ function projectSlug() {
|
|
|
16229
16402
|
return `${name}-${hash}`;
|
|
16230
16403
|
}
|
|
16231
16404
|
function artifactsRoot() {
|
|
16232
|
-
return process.env.ARGENT_ARTIFACTS_DIR ??
|
|
16405
|
+
return process.env.ARGENT_ARTIFACTS_DIR ?? join8(tmpdir2(), "argent-artifacts");
|
|
16233
16406
|
}
|
|
16234
16407
|
function artifactDir(deviceId) {
|
|
16235
16408
|
const parts = [artifactsRoot(), projectSlug(), sessionId()];
|
|
16236
16409
|
if (deviceId) parts.push(sanitizeSegment(deviceId));
|
|
16237
|
-
return
|
|
16410
|
+
return join8(...parts);
|
|
16411
|
+
}
|
|
16412
|
+
function durableBaseDir() {
|
|
16413
|
+
const projectRoot = findProjectRoot(process.cwd());
|
|
16414
|
+
return projectRoot ?? dirname5(argentHomeDir());
|
|
16415
|
+
}
|
|
16416
|
+
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize(".argent/recordings")]);
|
|
16417
|
+
var MAX_DURABLE_BYTES = 2 * 1024 * 1024 * 1024;
|
|
16418
|
+
async function readCapped(res, cap) {
|
|
16419
|
+
const headers = res.headers;
|
|
16420
|
+
const declared = Number(headers?.get?.("content-length"));
|
|
16421
|
+
if (Number.isFinite(declared) && declared > cap) return null;
|
|
16422
|
+
const body = res.body;
|
|
16423
|
+
if (!body?.getReader) {
|
|
16424
|
+
const buf = Buffer.from(await res.arrayBuffer());
|
|
16425
|
+
return buf.length > cap ? null : buf;
|
|
16426
|
+
}
|
|
16427
|
+
const reader = body.getReader();
|
|
16428
|
+
const chunks = [];
|
|
16429
|
+
let total = 0;
|
|
16430
|
+
for (; ; ) {
|
|
16431
|
+
const { done, value } = await reader.read();
|
|
16432
|
+
if (done) break;
|
|
16433
|
+
total += value.byteLength;
|
|
16434
|
+
if (total > cap) {
|
|
16435
|
+
await reader.cancel().catch(() => {
|
|
16436
|
+
});
|
|
16437
|
+
return null;
|
|
16438
|
+
}
|
|
16439
|
+
chunks.push(Buffer.from(value));
|
|
16440
|
+
}
|
|
16441
|
+
return Buffer.concat(chunks);
|
|
16442
|
+
}
|
|
16443
|
+
async function writeDurableUnique(dir, filename, write) {
|
|
16444
|
+
const ext = extname(filename);
|
|
16445
|
+
const stem = filename.slice(0, filename.length - ext.length);
|
|
16446
|
+
for (let i = 1; i <= 1e3; i++) {
|
|
16447
|
+
const candidate = i === 1 ? filename : `${stem} (${i})${ext}`;
|
|
16448
|
+
const path11 = join8(dir, candidate);
|
|
16449
|
+
try {
|
|
16450
|
+
await write(path11);
|
|
16451
|
+
return path11;
|
|
16452
|
+
} catch (err) {
|
|
16453
|
+
if (err?.code === "EEXIST") continue;
|
|
16454
|
+
throw err;
|
|
16455
|
+
}
|
|
16456
|
+
}
|
|
16457
|
+
return null;
|
|
16458
|
+
}
|
|
16459
|
+
function durableSaveTarget(handle) {
|
|
16460
|
+
if (typeof handle.saveDir !== "string" || !handle.saveDir || handle.archive) return null;
|
|
16461
|
+
const rel = normalize(handle.saveDir);
|
|
16462
|
+
if (isAbsolute3(rel) || rel === ".." || rel.startsWith(`..${sep2}`) || rel.split(sep2).includes("..")) {
|
|
16463
|
+
return null;
|
|
16464
|
+
}
|
|
16465
|
+
if (!ALLOWED_SAVE_DIRS.has(rel)) return null;
|
|
16466
|
+
const base = durableBaseDir();
|
|
16467
|
+
const dir = join8(base, rel);
|
|
16468
|
+
return { dir, path: join8(dir, sanitizeSegment(handle.filename)), base, rel };
|
|
16469
|
+
}
|
|
16470
|
+
async function confineToRealBase(dir, base, rel) {
|
|
16471
|
+
try {
|
|
16472
|
+
const realDir = await realpath(dir);
|
|
16473
|
+
const realBase = await realpath(base);
|
|
16474
|
+
return realDir === join8(realBase, rel);
|
|
16475
|
+
} catch {
|
|
16476
|
+
return false;
|
|
16477
|
+
}
|
|
16238
16478
|
}
|
|
16239
16479
|
async function resolveLocalFile(handle) {
|
|
16240
16480
|
if (!handle.hostPath) return null;
|
|
@@ -16254,7 +16494,7 @@ async function resolveLocalFile(handle) {
|
|
|
16254
16494
|
}
|
|
16255
16495
|
}
|
|
16256
16496
|
async function downloadAndExtractArchive(handle, data, dir) {
|
|
16257
|
-
const tarball2 =
|
|
16497
|
+
const tarball2 = join8(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
|
|
16258
16498
|
try {
|
|
16259
16499
|
await writeFile4(tarball2, data);
|
|
16260
16500
|
return await safeExtractTarGz(tarball2, dir, handle.filename);
|
|
@@ -16280,6 +16520,53 @@ async function materializeArtifacts(result, ctx) {
|
|
|
16280
16520
|
async function walk(value) {
|
|
16281
16521
|
if (isArtifactHandle(value)) {
|
|
16282
16522
|
const localPath = await resolveLocalFile(value);
|
|
16523
|
+
const saveTarget = durableSaveTarget(value);
|
|
16524
|
+
if (saveTarget) {
|
|
16525
|
+
const filename = basename3(saveTarget.path);
|
|
16526
|
+
try {
|
|
16527
|
+
await mkdir4(saveTarget.dir, { recursive: true });
|
|
16528
|
+
if (!await confineToRealBase(saveTarget.dir, saveTarget.base, saveTarget.rel)) {
|
|
16529
|
+
return null;
|
|
16530
|
+
}
|
|
16531
|
+
if (localPath) {
|
|
16532
|
+
const finalPath2 = await writeDurableUnique(
|
|
16533
|
+
saveTarget.dir,
|
|
16534
|
+
filename,
|
|
16535
|
+
(p) => copyFile(localPath, p, fsConstants.COPYFILE_EXCL)
|
|
16536
|
+
);
|
|
16537
|
+
if (!finalPath2) return null;
|
|
16538
|
+
if (value.mimeType.startsWith("image/")) {
|
|
16539
|
+
images.push({
|
|
16540
|
+
localPath: finalPath2,
|
|
16541
|
+
data: await readFile4(finalPath2),
|
|
16542
|
+
mimeType: value.mimeType
|
|
16543
|
+
});
|
|
16544
|
+
}
|
|
16545
|
+
return finalPath2;
|
|
16546
|
+
}
|
|
16547
|
+
if (!Number.isInteger(value.size) || value.size <= 0 || value.size > MAX_DURABLE_BYTES) {
|
|
16548
|
+
return null;
|
|
16549
|
+
}
|
|
16550
|
+
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
16551
|
+
headers: authHeaders2
|
|
16552
|
+
});
|
|
16553
|
+
if (!res.ok) return null;
|
|
16554
|
+
const data = await readCapped(res, value.size);
|
|
16555
|
+
if (!data || data.length !== value.size) return null;
|
|
16556
|
+
const finalPath = await writeDurableUnique(
|
|
16557
|
+
saveTarget.dir,
|
|
16558
|
+
filename,
|
|
16559
|
+
(p) => writeFile4(p, data, { flag: "wx" })
|
|
16560
|
+
);
|
|
16561
|
+
if (!finalPath) return null;
|
|
16562
|
+
if (value.mimeType.startsWith("image/")) {
|
|
16563
|
+
images.push({ localPath: finalPath, data, mimeType: value.mimeType });
|
|
16564
|
+
}
|
|
16565
|
+
return finalPath;
|
|
16566
|
+
} catch {
|
|
16567
|
+
return null;
|
|
16568
|
+
}
|
|
16569
|
+
}
|
|
16283
16570
|
if (localPath) {
|
|
16284
16571
|
if (value.mimeType.startsWith("image/")) {
|
|
16285
16572
|
images.push({ localPath, data: await readFile4(localPath), mimeType: value.mimeType });
|
|
@@ -16297,7 +16584,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
16297
16584
|
return await downloadAndExtractArchive(value, data, dir);
|
|
16298
16585
|
}
|
|
16299
16586
|
if (value.size > 0 && data.length !== value.size) return null;
|
|
16300
|
-
const downloadedPath =
|
|
16587
|
+
const downloadedPath = join8(dir, sanitizeSegment(value.filename));
|
|
16301
16588
|
await writeFile4(downloadedPath, data);
|
|
16302
16589
|
if (value.mimeType.startsWith("image/")) {
|
|
16303
16590
|
images.push({ localPath: downloadedPath, data, mimeType: value.mimeType });
|
|
@@ -17546,8 +17833,8 @@ var PostHogSentryIntegration = class {
|
|
|
17546
17833
|
|
|
17547
17834
|
// ../registry/src/artifacts.ts
|
|
17548
17835
|
import { stat as stat3 } from "node:fs/promises";
|
|
17549
|
-
import { randomUUID as
|
|
17550
|
-
import { basename as basename4, extname } from "node:path";
|
|
17836
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
17837
|
+
import { basename as basename4, extname as extname2 } from "node:path";
|
|
17551
17838
|
|
|
17552
17839
|
// ../registry/src/failure-codes.ts
|
|
17553
17840
|
var FAILURE_CODES = {
|
|
@@ -17741,6 +18028,7 @@ var FAILURE_CODES = {
|
|
|
17741
18028
|
SCREEN_RECORDING_NO_ACTIVE_SESSION: "SCREEN_RECORDING_NO_ACTIVE_SESSION",
|
|
17742
18029
|
SCREEN_RECORDING_STOP_IN_PROGRESS: "SCREEN_RECORDING_STOP_IN_PROGRESS",
|
|
17743
18030
|
SCREEN_RECORDING_START_EXITED: "SCREEN_RECORDING_START_EXITED",
|
|
18031
|
+
SCREEN_RECORDING_START_TIMEOUT: "SCREEN_RECORDING_START_TIMEOUT",
|
|
17744
18032
|
SCREEN_RECORDING_PROCESS_ERROR: "SCREEN_RECORDING_PROCESS_ERROR",
|
|
17745
18033
|
SCREEN_RECORDING_OUTPUT_MISSING: "SCREEN_RECORDING_OUTPUT_MISSING",
|
|
17746
18034
|
SCREEN_RECORDING_SERVER_SHUTTING_DOWN: "SCREEN_RECORDING_SERVER_SHUTTING_DOWN",
|
|
@@ -17850,7 +18138,7 @@ var FAILURE_SIGNAL_NAME_SET = new Set(FAILURE_SIGNAL_NAMES);
|
|
|
17850
18138
|
var FAILURE_SPAWN_CODE_SET = new Set(FAILURE_SPAWN_CODES);
|
|
17851
18139
|
|
|
17852
18140
|
// ../registry/src/registry.ts
|
|
17853
|
-
import { randomUUID as
|
|
18141
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
17854
18142
|
|
|
17855
18143
|
// ../telemetry/src/events.ts
|
|
17856
18144
|
var PLATFORMS = [
|
|
@@ -18127,10 +18415,10 @@ var ALLOWED = {
|
|
|
18127
18415
|
};
|
|
18128
18416
|
|
|
18129
18417
|
// ../telemetry/src/base-props.ts
|
|
18130
|
-
import { randomUUID as
|
|
18418
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
18131
18419
|
|
|
18132
18420
|
// ../telemetry/src/cloud-agent-detect.ts
|
|
18133
|
-
import { existsSync as
|
|
18421
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
18134
18422
|
|
|
18135
18423
|
// ../../node_modules/ci-info/vendors.json
|
|
18136
18424
|
var vendors_default = [
|
|
@@ -18501,7 +18789,7 @@ var vendors_default = [
|
|
|
18501
18789
|
var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
18502
18790
|
|
|
18503
18791
|
// ../telemetry/src/base-props.ts
|
|
18504
|
-
var SESSION_ID2 =
|
|
18792
|
+
var SESSION_ID2 = randomUUID5();
|
|
18505
18793
|
|
|
18506
18794
|
// ../telemetry/src/identity.ts
|
|
18507
18795
|
import * as crypto2 from "node:crypto";
|
|
@@ -18511,176 +18799,6 @@ import * as path8 from "node:path";
|
|
|
18511
18799
|
// ../telemetry/src/paths.ts
|
|
18512
18800
|
import * as path7 from "node:path";
|
|
18513
18801
|
|
|
18514
|
-
// ../configuration-core/src/flags.ts
|
|
18515
|
-
import * as fs2 from "node:fs";
|
|
18516
|
-
import * as path4 from "node:path";
|
|
18517
|
-
import { homedir as homedir3 } from "node:os";
|
|
18518
|
-
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
18519
|
-
function findProjectRoot(startDir) {
|
|
18520
|
-
let current = path4.resolve(startDir);
|
|
18521
|
-
while (true) {
|
|
18522
|
-
for (const marker of PROJECT_MARKERS) {
|
|
18523
|
-
if (fs2.existsSync(path4.join(current, marker))) return current;
|
|
18524
|
-
}
|
|
18525
|
-
const parent = path4.dirname(current);
|
|
18526
|
-
if (parent === current) return null;
|
|
18527
|
-
current = parent;
|
|
18528
|
-
}
|
|
18529
|
-
}
|
|
18530
|
-
function resolveProjectRoot(startDir) {
|
|
18531
|
-
return findProjectRoot(startDir) ?? path4.resolve(startDir);
|
|
18532
|
-
}
|
|
18533
|
-
function getFlagsPath(scope, options = {}) {
|
|
18534
|
-
const home = options.homeDir ?? homedir3();
|
|
18535
|
-
if (scope === "global") {
|
|
18536
|
-
return path4.join(home, ".argent", "flags.json");
|
|
18537
|
-
}
|
|
18538
|
-
const cwd = options.cwd ?? process.cwd();
|
|
18539
|
-
return path4.join(resolveProjectRoot(cwd), ".argent", "flags.json");
|
|
18540
|
-
}
|
|
18541
|
-
function readFlagsFile(filePath) {
|
|
18542
|
-
let raw;
|
|
18543
|
-
try {
|
|
18544
|
-
raw = fs2.readFileSync(filePath, "utf8");
|
|
18545
|
-
} catch {
|
|
18546
|
-
return {};
|
|
18547
|
-
}
|
|
18548
|
-
let parsed;
|
|
18549
|
-
try {
|
|
18550
|
-
parsed = JSON.parse(raw);
|
|
18551
|
-
} catch {
|
|
18552
|
-
return {};
|
|
18553
|
-
}
|
|
18554
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
|
|
18555
|
-
const flags = parsed.flags;
|
|
18556
|
-
if (!flags || typeof flags !== "object" || Array.isArray(flags)) return {};
|
|
18557
|
-
const out = {};
|
|
18558
|
-
for (const [k, v] of Object.entries(flags)) {
|
|
18559
|
-
if (typeof v === "boolean") out[k] = v;
|
|
18560
|
-
}
|
|
18561
|
-
return out;
|
|
18562
|
-
}
|
|
18563
|
-
function readFlags(scope, options = {}) {
|
|
18564
|
-
return readFlagsFile(getFlagsPath(scope, options));
|
|
18565
|
-
}
|
|
18566
|
-
function isFlagEnabled(name, options = {}) {
|
|
18567
|
-
const projectFlags = readFlags("project", options);
|
|
18568
|
-
if (Object.hasOwn(projectFlags, name)) return projectFlags[name];
|
|
18569
|
-
const globalFlags = readFlags("global", options);
|
|
18570
|
-
if (Object.hasOwn(globalFlags, name)) return globalFlags[name];
|
|
18571
|
-
return options.default ?? false;
|
|
18572
|
-
}
|
|
18573
|
-
|
|
18574
|
-
// ../configuration-core/src/paths.ts
|
|
18575
|
-
import * as os from "node:os";
|
|
18576
|
-
import * as path5 from "node:path";
|
|
18577
|
-
function nonEmpty(value) {
|
|
18578
|
-
if (value == void 0) return null;
|
|
18579
|
-
const trimmed = value.trim();
|
|
18580
|
-
return trimmed === "" ? null : value;
|
|
18581
|
-
}
|
|
18582
|
-
function argentHomeDir() {
|
|
18583
|
-
const home = process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
18584
|
-
return path5.join(home, ".argent");
|
|
18585
|
-
}
|
|
18586
|
-
function configDir(scope = "global", options = {}) {
|
|
18587
|
-
if (scope === "global") {
|
|
18588
|
-
return options.homeDir ? path5.join(options.homeDir, ".argent") : argentHomeDir();
|
|
18589
|
-
}
|
|
18590
|
-
const cwd = options.cwd ?? process.cwd();
|
|
18591
|
-
return path5.join(resolveProjectRoot(cwd), ".argent");
|
|
18592
|
-
}
|
|
18593
|
-
function configFilePath(scope = "global", options = {}) {
|
|
18594
|
-
return path5.join(configDir(scope, options), "config.json");
|
|
18595
|
-
}
|
|
18596
|
-
|
|
18597
|
-
// ../configuration-core/src/config.ts
|
|
18598
|
-
import * as crypto from "node:crypto";
|
|
18599
|
-
import * as fs3 from "node:fs";
|
|
18600
|
-
import * as path6 from "node:path";
|
|
18601
|
-
function readConfigObject(scope = "global", options = {}) {
|
|
18602
|
-
try {
|
|
18603
|
-
const raw = fs3.readFileSync(configFilePath(scope, options), "utf8");
|
|
18604
|
-
const json = JSON.parse(raw);
|
|
18605
|
-
if (json && typeof json === "object" && !Array.isArray(json)) {
|
|
18606
|
-
return json;
|
|
18607
|
-
}
|
|
18608
|
-
} catch {
|
|
18609
|
-
}
|
|
18610
|
-
return {};
|
|
18611
|
-
}
|
|
18612
|
-
var LOCK_STALE_MS2 = 1e4;
|
|
18613
|
-
var LOCK_MAX_WAIT_MS = 2e3;
|
|
18614
|
-
var LOCK_RETRY_MS = 25;
|
|
18615
|
-
function sleepSync(ms) {
|
|
18616
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
18617
|
-
}
|
|
18618
|
-
function acquireConfigLock(finalPath) {
|
|
18619
|
-
const lockPath = finalPath + ".lock";
|
|
18620
|
-
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
18621
|
-
for (; ; ) {
|
|
18622
|
-
try {
|
|
18623
|
-
const fd = fs3.openSync(lockPath, "wx", 384);
|
|
18624
|
-
try {
|
|
18625
|
-
fs3.writeSync(fd, `${process.pid}
|
|
18626
|
-
`);
|
|
18627
|
-
} catch {
|
|
18628
|
-
}
|
|
18629
|
-
return { fd, lockPath };
|
|
18630
|
-
} catch (err) {
|
|
18631
|
-
if (err.code !== "EEXIST") return null;
|
|
18632
|
-
try {
|
|
18633
|
-
if (Date.now() - fs3.statSync(lockPath).mtimeMs > LOCK_STALE_MS2) {
|
|
18634
|
-
fs3.unlinkSync(lockPath);
|
|
18635
|
-
continue;
|
|
18636
|
-
}
|
|
18637
|
-
} catch {
|
|
18638
|
-
}
|
|
18639
|
-
if (Date.now() >= deadline) return null;
|
|
18640
|
-
sleepSync(LOCK_RETRY_MS);
|
|
18641
|
-
}
|
|
18642
|
-
}
|
|
18643
|
-
}
|
|
18644
|
-
function releaseConfigLock(lock) {
|
|
18645
|
-
try {
|
|
18646
|
-
fs3.closeSync(lock.fd);
|
|
18647
|
-
} catch {
|
|
18648
|
-
}
|
|
18649
|
-
try {
|
|
18650
|
-
fs3.unlinkSync(lock.lockPath);
|
|
18651
|
-
} catch {
|
|
18652
|
-
}
|
|
18653
|
-
}
|
|
18654
|
-
function updateConfig(mutate, scope = "global", options = {}) {
|
|
18655
|
-
const dir = configDir(scope, options);
|
|
18656
|
-
fs3.mkdirSync(dir, { recursive: true });
|
|
18657
|
-
const finalPath = configFilePath(scope, options);
|
|
18658
|
-
const lock = acquireConfigLock(finalPath);
|
|
18659
|
-
try {
|
|
18660
|
-
const next = readConfigObject(scope, options);
|
|
18661
|
-
mutate(next);
|
|
18662
|
-
const tmpPath = path6.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
18663
|
-
const fd = fs3.openSync(tmpPath, "wx", 384);
|
|
18664
|
-
try {
|
|
18665
|
-
fs3.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
18666
|
-
fs3.fsyncSync(fd);
|
|
18667
|
-
} finally {
|
|
18668
|
-
fs3.closeSync(fd);
|
|
18669
|
-
}
|
|
18670
|
-
try {
|
|
18671
|
-
fs3.renameSync(tmpPath, finalPath);
|
|
18672
|
-
} catch (err) {
|
|
18673
|
-
try {
|
|
18674
|
-
fs3.unlinkSync(tmpPath);
|
|
18675
|
-
} catch {
|
|
18676
|
-
}
|
|
18677
|
-
throw err;
|
|
18678
|
-
}
|
|
18679
|
-
} finally {
|
|
18680
|
-
if (lock) releaseConfigLock(lock);
|
|
18681
|
-
}
|
|
18682
|
-
}
|
|
18683
|
-
|
|
18684
18802
|
// ../telemetry/src/fingerprint.ts
|
|
18685
18803
|
import { execFileSync as execFileSync2, spawn as spawn2 } from "node:child_process";
|
|
18686
18804
|
|
|
@@ -19173,7 +19291,7 @@ async function startMcpServer(options) {
|
|
|
19173
19291
|
async function spyLog(entry) {
|
|
19174
19292
|
try {
|
|
19175
19293
|
if (!logDirReady) {
|
|
19176
|
-
await mkdir5(
|
|
19294
|
+
await mkdir5(dirname6(LOG_FILE2), { recursive: true });
|
|
19177
19295
|
logDirReady = true;
|
|
19178
19296
|
}
|
|
19179
19297
|
await appendFile(LOG_FILE2, JSON.stringify(entry) + "\n");
|