@swmansion/argent 0.18.1-next.8 → 0.19.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/README.md +1 -1
- package/bin/argent-android-devtools-0.1.0.apk +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/simulator-server +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/linux/simulator-server +0 -0
- package/bin/linux-arm64/simulator-server +0 -0
- package/bin/tcp/ax-service +0 -0
- package/bin/win32/simulator-server.exe +0 -0
- package/dist/cli-cmds.mjs +2087 -876
- package/dist/cli.js +11 -7
- package/dist/cli.js.map +1 -1
- package/dist/installer-help.d.ts +13 -2
- package/dist/installer-help.js +41 -2
- package/dist/installer-help.js.map +1 -1
- package/dist/installer.mjs +838 -464
- package/dist/mcp-server.mjs +1114 -775
- package/dist/tool-server.cjs +2421 -1672
- 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 +4 -1
- package/skills/argent-create-flow/SKILL.md +32 -23
- package/skills/argent-device-interact/SKILL.md +13 -3
- package/skills/argent-test-ui-flow/SKILL.md +1 -1
package/dist/installer.mjs
CHANGED
|
@@ -167,6 +167,325 @@ var require_picocolors = __commonJS({
|
|
|
167
167
|
}
|
|
168
168
|
});
|
|
169
169
|
|
|
170
|
+
// ../../node_modules/dotenv/lib/main.js
|
|
171
|
+
var require_main = __commonJS({
|
|
172
|
+
"../../node_modules/dotenv/lib/main.js"(exports, module) {
|
|
173
|
+
var fs17 = __require("fs");
|
|
174
|
+
var path21 = __require("path");
|
|
175
|
+
var os3 = __require("os");
|
|
176
|
+
var crypto3 = __require("crypto");
|
|
177
|
+
var TIPS = [
|
|
178
|
+
"\u25C8 encrypted .env [www.dotenvx.com]",
|
|
179
|
+
"\u25C8 secrets for agents [www.dotenvx.com]",
|
|
180
|
+
"\u2301 auth for agents [www.vestauth.com]",
|
|
181
|
+
"\u2318 custom filepath { path: '/custom/path/.env' }",
|
|
182
|
+
"\u2318 enable debugging { debug: true }",
|
|
183
|
+
"\u2318 override existing { override: true }",
|
|
184
|
+
"\u2318 suppress logs { quiet: true }",
|
|
185
|
+
"\u2318 multiple files { path: ['.env.local', '.env'] }"
|
|
186
|
+
];
|
|
187
|
+
function _getRandomTip() {
|
|
188
|
+
return TIPS[Math.floor(Math.random() * TIPS.length)];
|
|
189
|
+
}
|
|
190
|
+
function parseBoolean(value) {
|
|
191
|
+
if (typeof value === "string") {
|
|
192
|
+
return !["false", "0", "no", "off", ""].includes(value.toLowerCase());
|
|
193
|
+
}
|
|
194
|
+
return Boolean(value);
|
|
195
|
+
}
|
|
196
|
+
function supportsAnsi() {
|
|
197
|
+
return process.stdout.isTTY;
|
|
198
|
+
}
|
|
199
|
+
function dim(text2) {
|
|
200
|
+
return supportsAnsi() ? `\x1B[2m${text2}\x1B[0m` : text2;
|
|
201
|
+
}
|
|
202
|
+
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
203
|
+
function parse4(src) {
|
|
204
|
+
const obj = {};
|
|
205
|
+
let lines = src.toString();
|
|
206
|
+
lines = lines.replace(/\r\n?/mg, "\n");
|
|
207
|
+
let match;
|
|
208
|
+
while ((match = LINE.exec(lines)) != null) {
|
|
209
|
+
const key = match[1];
|
|
210
|
+
let value = match[2] || "";
|
|
211
|
+
value = value.trim();
|
|
212
|
+
const maybeQuote = value[0];
|
|
213
|
+
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
|
|
214
|
+
if (maybeQuote === '"') {
|
|
215
|
+
value = value.replace(/\\n/g, "\n");
|
|
216
|
+
value = value.replace(/\\r/g, "\r");
|
|
217
|
+
}
|
|
218
|
+
obj[key] = value;
|
|
219
|
+
}
|
|
220
|
+
return obj;
|
|
221
|
+
}
|
|
222
|
+
function _parseVault(options) {
|
|
223
|
+
options = options || {};
|
|
224
|
+
const vaultPath = _vaultPath(options);
|
|
225
|
+
options.path = vaultPath;
|
|
226
|
+
const result = DotenvModule.configDotenv(options);
|
|
227
|
+
if (!result.parsed) {
|
|
228
|
+
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
229
|
+
err.code = "MISSING_DATA";
|
|
230
|
+
throw err;
|
|
231
|
+
}
|
|
232
|
+
const keys = _dotenvKey(options).split(",");
|
|
233
|
+
const length = keys.length;
|
|
234
|
+
let decrypted;
|
|
235
|
+
for (let i2 = 0; i2 < length; i2++) {
|
|
236
|
+
try {
|
|
237
|
+
const key = keys[i2].trim();
|
|
238
|
+
const attrs = _instructions(result, key);
|
|
239
|
+
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
240
|
+
break;
|
|
241
|
+
} catch (error) {
|
|
242
|
+
if (i2 + 1 >= length) {
|
|
243
|
+
throw error;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return DotenvModule.parse(decrypted);
|
|
248
|
+
}
|
|
249
|
+
function _warn(message) {
|
|
250
|
+
console.error(`\u26A0 ${message}`);
|
|
251
|
+
}
|
|
252
|
+
function _debug(message) {
|
|
253
|
+
console.log(`\u2506 ${message}`);
|
|
254
|
+
}
|
|
255
|
+
function _log(message) {
|
|
256
|
+
console.log(`\u25C7 ${message}`);
|
|
257
|
+
}
|
|
258
|
+
function _dotenvKey(options) {
|
|
259
|
+
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
260
|
+
return options.DOTENV_KEY;
|
|
261
|
+
}
|
|
262
|
+
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
|
|
263
|
+
return process.env.DOTENV_KEY;
|
|
264
|
+
}
|
|
265
|
+
return "";
|
|
266
|
+
}
|
|
267
|
+
function _instructions(result, dotenvKey) {
|
|
268
|
+
let uri;
|
|
269
|
+
try {
|
|
270
|
+
uri = new URL(dotenvKey);
|
|
271
|
+
} catch (error) {
|
|
272
|
+
if (error.code === "ERR_INVALID_URL") {
|
|
273
|
+
const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
|
|
274
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
275
|
+
throw err;
|
|
276
|
+
}
|
|
277
|
+
throw error;
|
|
278
|
+
}
|
|
279
|
+
const key = uri.password;
|
|
280
|
+
if (!key) {
|
|
281
|
+
const err = new Error("INVALID_DOTENV_KEY: Missing key part");
|
|
282
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
283
|
+
throw err;
|
|
284
|
+
}
|
|
285
|
+
const environment = uri.searchParams.get("environment");
|
|
286
|
+
if (!environment) {
|
|
287
|
+
const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
|
|
288
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
289
|
+
throw err;
|
|
290
|
+
}
|
|
291
|
+
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
|
|
292
|
+
const ciphertext = result.parsed[environmentKey];
|
|
293
|
+
if (!ciphertext) {
|
|
294
|
+
const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
|
|
295
|
+
err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
|
|
296
|
+
throw err;
|
|
297
|
+
}
|
|
298
|
+
return { ciphertext, key };
|
|
299
|
+
}
|
|
300
|
+
function _vaultPath(options) {
|
|
301
|
+
let possibleVaultPath = null;
|
|
302
|
+
if (options && options.path && options.path.length > 0) {
|
|
303
|
+
if (Array.isArray(options.path)) {
|
|
304
|
+
for (const filepath of options.path) {
|
|
305
|
+
if (fs17.existsSync(filepath)) {
|
|
306
|
+
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
} else {
|
|
310
|
+
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
311
|
+
}
|
|
312
|
+
} else {
|
|
313
|
+
possibleVaultPath = path21.resolve(process.cwd(), ".env.vault");
|
|
314
|
+
}
|
|
315
|
+
if (fs17.existsSync(possibleVaultPath)) {
|
|
316
|
+
return possibleVaultPath;
|
|
317
|
+
}
|
|
318
|
+
return null;
|
|
319
|
+
}
|
|
320
|
+
function _resolveHome(envPath) {
|
|
321
|
+
return envPath[0] === "~" ? path21.join(os3.homedir(), envPath.slice(1)) : envPath;
|
|
322
|
+
}
|
|
323
|
+
function _configVault(options) {
|
|
324
|
+
const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
325
|
+
const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options && options.quiet);
|
|
326
|
+
if (debug || !quiet) {
|
|
327
|
+
_log("loading env from encrypted .env.vault");
|
|
328
|
+
}
|
|
329
|
+
const parsed = DotenvModule._parseVault(options);
|
|
330
|
+
let processEnv = process.env;
|
|
331
|
+
if (options && options.processEnv != null) {
|
|
332
|
+
processEnv = options.processEnv;
|
|
333
|
+
}
|
|
334
|
+
DotenvModule.populate(processEnv, parsed, options);
|
|
335
|
+
return { parsed };
|
|
336
|
+
}
|
|
337
|
+
function configDotenv(options) {
|
|
338
|
+
const dotenvPath = path21.resolve(process.cwd(), ".env");
|
|
339
|
+
let encoding = "utf8";
|
|
340
|
+
let processEnv = process.env;
|
|
341
|
+
if (options && options.processEnv != null) {
|
|
342
|
+
processEnv = options.processEnv;
|
|
343
|
+
}
|
|
344
|
+
let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
345
|
+
let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options && options.quiet);
|
|
346
|
+
if (options && options.encoding) {
|
|
347
|
+
encoding = options.encoding;
|
|
348
|
+
} else {
|
|
349
|
+
if (debug) {
|
|
350
|
+
_debug("no encoding is specified (UTF-8 is used by default)");
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
let optionPaths = [dotenvPath];
|
|
354
|
+
if (options && options.path) {
|
|
355
|
+
if (!Array.isArray(options.path)) {
|
|
356
|
+
optionPaths = [_resolveHome(options.path)];
|
|
357
|
+
} else {
|
|
358
|
+
optionPaths = [];
|
|
359
|
+
for (const filepath of options.path) {
|
|
360
|
+
optionPaths.push(_resolveHome(filepath));
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
let lastError;
|
|
365
|
+
const parsedAll = {};
|
|
366
|
+
for (const path22 of optionPaths) {
|
|
367
|
+
try {
|
|
368
|
+
const parsed = DotenvModule.parse(fs17.readFileSync(path22, { encoding }));
|
|
369
|
+
DotenvModule.populate(parsedAll, parsed, options);
|
|
370
|
+
} catch (e) {
|
|
371
|
+
if (debug) {
|
|
372
|
+
_debug(`failed to load ${path22} ${e.message}`);
|
|
373
|
+
}
|
|
374
|
+
lastError = e;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
const populated = DotenvModule.populate(processEnv, parsedAll, options);
|
|
378
|
+
debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug);
|
|
379
|
+
quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
|
|
380
|
+
if (debug || !quiet) {
|
|
381
|
+
const keysCount = Object.keys(populated).length;
|
|
382
|
+
const shortPaths = [];
|
|
383
|
+
for (const filePath of optionPaths) {
|
|
384
|
+
try {
|
|
385
|
+
const relative5 = path21.relative(process.cwd(), filePath);
|
|
386
|
+
shortPaths.push(relative5);
|
|
387
|
+
} catch (e) {
|
|
388
|
+
if (debug) {
|
|
389
|
+
_debug(`failed to load ${filePath} ${e.message}`);
|
|
390
|
+
}
|
|
391
|
+
lastError = e;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
_log(`injected env (${keysCount}) from ${shortPaths.join(",")} ${dim(`// tip: ${_getRandomTip()}`)}`);
|
|
395
|
+
}
|
|
396
|
+
if (lastError) {
|
|
397
|
+
return { parsed: parsedAll, error: lastError };
|
|
398
|
+
} else {
|
|
399
|
+
return { parsed: parsedAll };
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
function config(options) {
|
|
403
|
+
if (_dotenvKey(options).length === 0) {
|
|
404
|
+
return DotenvModule.configDotenv(options);
|
|
405
|
+
}
|
|
406
|
+
const vaultPath = _vaultPath(options);
|
|
407
|
+
if (!vaultPath) {
|
|
408
|
+
_warn(`you set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}`);
|
|
409
|
+
return DotenvModule.configDotenv(options);
|
|
410
|
+
}
|
|
411
|
+
return DotenvModule._configVault(options);
|
|
412
|
+
}
|
|
413
|
+
function decrypt(encrypted, keyStr) {
|
|
414
|
+
const key = Buffer.from(keyStr.slice(-64), "hex");
|
|
415
|
+
let ciphertext = Buffer.from(encrypted, "base64");
|
|
416
|
+
const nonce = ciphertext.subarray(0, 12);
|
|
417
|
+
const authTag = ciphertext.subarray(-16);
|
|
418
|
+
ciphertext = ciphertext.subarray(12, -16);
|
|
419
|
+
try {
|
|
420
|
+
const aesgcm = crypto3.createDecipheriv("aes-256-gcm", key, nonce);
|
|
421
|
+
aesgcm.setAuthTag(authTag);
|
|
422
|
+
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
|
|
423
|
+
} catch (error) {
|
|
424
|
+
const isRange = error instanceof RangeError;
|
|
425
|
+
const invalidKeyLength = error.message === "Invalid key length";
|
|
426
|
+
const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
|
|
427
|
+
if (isRange || invalidKeyLength) {
|
|
428
|
+
const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
|
|
429
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
430
|
+
throw err;
|
|
431
|
+
} else if (decryptionFailed) {
|
|
432
|
+
const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
|
|
433
|
+
err.code = "DECRYPTION_FAILED";
|
|
434
|
+
throw err;
|
|
435
|
+
} else {
|
|
436
|
+
throw error;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
function populate(processEnv, parsed, options = {}) {
|
|
441
|
+
const debug = Boolean(options && options.debug);
|
|
442
|
+
const override = Boolean(options && options.override);
|
|
443
|
+
const populated = {};
|
|
444
|
+
if (typeof parsed !== "object") {
|
|
445
|
+
const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
446
|
+
err.code = "OBJECT_REQUIRED";
|
|
447
|
+
throw err;
|
|
448
|
+
}
|
|
449
|
+
for (const key of Object.keys(parsed)) {
|
|
450
|
+
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
451
|
+
if (override === true) {
|
|
452
|
+
processEnv[key] = parsed[key];
|
|
453
|
+
populated[key] = parsed[key];
|
|
454
|
+
}
|
|
455
|
+
if (debug) {
|
|
456
|
+
if (override === true) {
|
|
457
|
+
_debug(`"${key}" is already defined and WAS overwritten`);
|
|
458
|
+
} else {
|
|
459
|
+
_debug(`"${key}" is already defined and was NOT overwritten`);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
} else {
|
|
463
|
+
processEnv[key] = parsed[key];
|
|
464
|
+
populated[key] = parsed[key];
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return populated;
|
|
468
|
+
}
|
|
469
|
+
var DotenvModule = {
|
|
470
|
+
configDotenv,
|
|
471
|
+
_configVault,
|
|
472
|
+
_parseVault,
|
|
473
|
+
config,
|
|
474
|
+
decrypt,
|
|
475
|
+
parse: parse4,
|
|
476
|
+
populate
|
|
477
|
+
};
|
|
478
|
+
module.exports.configDotenv = DotenvModule.configDotenv;
|
|
479
|
+
module.exports._configVault = DotenvModule._configVault;
|
|
480
|
+
module.exports._parseVault = DotenvModule._parseVault;
|
|
481
|
+
module.exports.config = DotenvModule.config;
|
|
482
|
+
module.exports.decrypt = DotenvModule.decrypt;
|
|
483
|
+
module.exports.parse = DotenvModule.parse;
|
|
484
|
+
module.exports.populate = DotenvModule.populate;
|
|
485
|
+
module.exports = DotenvModule;
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
|
|
170
489
|
// ../../node_modules/semver/internal/constants.js
|
|
171
490
|
var require_constants = __commonJS({
|
|
172
491
|
"../../node_modules/semver/internal/constants.js"(exports, module) {
|
|
@@ -2238,17 +2557,17 @@ var require_visit = __commonJS({
|
|
|
2238
2557
|
visit2.BREAK = BREAK;
|
|
2239
2558
|
visit2.SKIP = SKIP;
|
|
2240
2559
|
visit2.REMOVE = REMOVE;
|
|
2241
|
-
function visit_(key, node, visitor,
|
|
2242
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
2560
|
+
function visit_(key, node, visitor, path21) {
|
|
2561
|
+
const ctrl = callVisitor(key, node, visitor, path21);
|
|
2243
2562
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
2244
|
-
replaceNode(key,
|
|
2245
|
-
return visit_(key, ctrl, visitor,
|
|
2563
|
+
replaceNode(key, path21, ctrl);
|
|
2564
|
+
return visit_(key, ctrl, visitor, path21);
|
|
2246
2565
|
}
|
|
2247
2566
|
if (typeof ctrl !== "symbol") {
|
|
2248
2567
|
if (identity.isCollection(node)) {
|
|
2249
|
-
|
|
2568
|
+
path21 = Object.freeze(path21.concat(node));
|
|
2250
2569
|
for (let i2 = 0; i2 < node.items.length; ++i2) {
|
|
2251
|
-
const ci = visit_(i2, node.items[i2], visitor,
|
|
2570
|
+
const ci = visit_(i2, node.items[i2], visitor, path21);
|
|
2252
2571
|
if (typeof ci === "number")
|
|
2253
2572
|
i2 = ci - 1;
|
|
2254
2573
|
else if (ci === BREAK)
|
|
@@ -2259,13 +2578,13 @@ var require_visit = __commonJS({
|
|
|
2259
2578
|
}
|
|
2260
2579
|
}
|
|
2261
2580
|
} else if (identity.isPair(node)) {
|
|
2262
|
-
|
|
2263
|
-
const ck = visit_("key", node.key, visitor,
|
|
2581
|
+
path21 = Object.freeze(path21.concat(node));
|
|
2582
|
+
const ck = visit_("key", node.key, visitor, path21);
|
|
2264
2583
|
if (ck === BREAK)
|
|
2265
2584
|
return BREAK;
|
|
2266
2585
|
else if (ck === REMOVE)
|
|
2267
2586
|
node.key = null;
|
|
2268
|
-
const cv = visit_("value", node.value, visitor,
|
|
2587
|
+
const cv = visit_("value", node.value, visitor, path21);
|
|
2269
2588
|
if (cv === BREAK)
|
|
2270
2589
|
return BREAK;
|
|
2271
2590
|
else if (cv === REMOVE)
|
|
@@ -2286,17 +2605,17 @@ var require_visit = __commonJS({
|
|
|
2286
2605
|
visitAsync.BREAK = BREAK;
|
|
2287
2606
|
visitAsync.SKIP = SKIP;
|
|
2288
2607
|
visitAsync.REMOVE = REMOVE;
|
|
2289
|
-
async function visitAsync_(key, node, visitor,
|
|
2290
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
2608
|
+
async function visitAsync_(key, node, visitor, path21) {
|
|
2609
|
+
const ctrl = await callVisitor(key, node, visitor, path21);
|
|
2291
2610
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
2292
|
-
replaceNode(key,
|
|
2293
|
-
return visitAsync_(key, ctrl, visitor,
|
|
2611
|
+
replaceNode(key, path21, ctrl);
|
|
2612
|
+
return visitAsync_(key, ctrl, visitor, path21);
|
|
2294
2613
|
}
|
|
2295
2614
|
if (typeof ctrl !== "symbol") {
|
|
2296
2615
|
if (identity.isCollection(node)) {
|
|
2297
|
-
|
|
2616
|
+
path21 = Object.freeze(path21.concat(node));
|
|
2298
2617
|
for (let i2 = 0; i2 < node.items.length; ++i2) {
|
|
2299
|
-
const ci = await visitAsync_(i2, node.items[i2], visitor,
|
|
2618
|
+
const ci = await visitAsync_(i2, node.items[i2], visitor, path21);
|
|
2300
2619
|
if (typeof ci === "number")
|
|
2301
2620
|
i2 = ci - 1;
|
|
2302
2621
|
else if (ci === BREAK)
|
|
@@ -2307,13 +2626,13 @@ var require_visit = __commonJS({
|
|
|
2307
2626
|
}
|
|
2308
2627
|
}
|
|
2309
2628
|
} else if (identity.isPair(node)) {
|
|
2310
|
-
|
|
2311
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
2629
|
+
path21 = Object.freeze(path21.concat(node));
|
|
2630
|
+
const ck = await visitAsync_("key", node.key, visitor, path21);
|
|
2312
2631
|
if (ck === BREAK)
|
|
2313
2632
|
return BREAK;
|
|
2314
2633
|
else if (ck === REMOVE)
|
|
2315
2634
|
node.key = null;
|
|
2316
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
2635
|
+
const cv = await visitAsync_("value", node.value, visitor, path21);
|
|
2317
2636
|
if (cv === BREAK)
|
|
2318
2637
|
return BREAK;
|
|
2319
2638
|
else if (cv === REMOVE)
|
|
@@ -2340,23 +2659,23 @@ var require_visit = __commonJS({
|
|
|
2340
2659
|
}
|
|
2341
2660
|
return visitor;
|
|
2342
2661
|
}
|
|
2343
|
-
function callVisitor(key, node, visitor,
|
|
2662
|
+
function callVisitor(key, node, visitor, path21) {
|
|
2344
2663
|
if (typeof visitor === "function")
|
|
2345
|
-
return visitor(key, node,
|
|
2664
|
+
return visitor(key, node, path21);
|
|
2346
2665
|
if (identity.isMap(node))
|
|
2347
|
-
return visitor.Map?.(key, node,
|
|
2666
|
+
return visitor.Map?.(key, node, path21);
|
|
2348
2667
|
if (identity.isSeq(node))
|
|
2349
|
-
return visitor.Seq?.(key, node,
|
|
2668
|
+
return visitor.Seq?.(key, node, path21);
|
|
2350
2669
|
if (identity.isPair(node))
|
|
2351
|
-
return visitor.Pair?.(key, node,
|
|
2670
|
+
return visitor.Pair?.(key, node, path21);
|
|
2352
2671
|
if (identity.isScalar(node))
|
|
2353
|
-
return visitor.Scalar?.(key, node,
|
|
2672
|
+
return visitor.Scalar?.(key, node, path21);
|
|
2354
2673
|
if (identity.isAlias(node))
|
|
2355
|
-
return visitor.Alias?.(key, node,
|
|
2674
|
+
return visitor.Alias?.(key, node, path21);
|
|
2356
2675
|
return void 0;
|
|
2357
2676
|
}
|
|
2358
|
-
function replaceNode(key,
|
|
2359
|
-
const parent =
|
|
2677
|
+
function replaceNode(key, path21, node) {
|
|
2678
|
+
const parent = path21[path21.length - 1];
|
|
2360
2679
|
if (identity.isCollection(parent)) {
|
|
2361
2680
|
parent.items[key] = node;
|
|
2362
2681
|
} else if (identity.isPair(parent)) {
|
|
@@ -2966,10 +3285,10 @@ var require_Collection = __commonJS({
|
|
|
2966
3285
|
var createNode = require_createNode();
|
|
2967
3286
|
var identity = require_identity();
|
|
2968
3287
|
var Node = require_Node();
|
|
2969
|
-
function collectionFromPath(schema,
|
|
3288
|
+
function collectionFromPath(schema, path21, value) {
|
|
2970
3289
|
let v = value;
|
|
2971
|
-
for (let i2 =
|
|
2972
|
-
const k =
|
|
3290
|
+
for (let i2 = path21.length - 1; i2 >= 0; --i2) {
|
|
3291
|
+
const k = path21[i2];
|
|
2973
3292
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
2974
3293
|
const a3 = [];
|
|
2975
3294
|
a3[k] = v;
|
|
@@ -2988,7 +3307,7 @@ var require_Collection = __commonJS({
|
|
|
2988
3307
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
2989
3308
|
});
|
|
2990
3309
|
}
|
|
2991
|
-
var isEmptyPath = (
|
|
3310
|
+
var isEmptyPath = (path21) => path21 == null || typeof path21 === "object" && !!path21[Symbol.iterator]().next().done;
|
|
2992
3311
|
var Collection = class extends Node.NodeBase {
|
|
2993
3312
|
constructor(type, schema) {
|
|
2994
3313
|
super(type);
|
|
@@ -3018,11 +3337,11 @@ var require_Collection = __commonJS({
|
|
|
3018
3337
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
3019
3338
|
* that already exists in the map.
|
|
3020
3339
|
*/
|
|
3021
|
-
addIn(
|
|
3022
|
-
if (isEmptyPath(
|
|
3340
|
+
addIn(path21, value) {
|
|
3341
|
+
if (isEmptyPath(path21))
|
|
3023
3342
|
this.add(value);
|
|
3024
3343
|
else {
|
|
3025
|
-
const [key, ...rest] =
|
|
3344
|
+
const [key, ...rest] = path21;
|
|
3026
3345
|
const node = this.get(key, true);
|
|
3027
3346
|
if (identity.isCollection(node))
|
|
3028
3347
|
node.addIn(rest, value);
|
|
@@ -3036,8 +3355,8 @@ var require_Collection = __commonJS({
|
|
|
3036
3355
|
* Removes a value from the collection.
|
|
3037
3356
|
* @returns `true` if the item was found and removed.
|
|
3038
3357
|
*/
|
|
3039
|
-
deleteIn(
|
|
3040
|
-
const [key, ...rest] =
|
|
3358
|
+
deleteIn(path21) {
|
|
3359
|
+
const [key, ...rest] = path21;
|
|
3041
3360
|
if (rest.length === 0)
|
|
3042
3361
|
return this.delete(key);
|
|
3043
3362
|
const node = this.get(key, true);
|
|
@@ -3051,8 +3370,8 @@ var require_Collection = __commonJS({
|
|
|
3051
3370
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3052
3371
|
* `true` (collections are always returned intact).
|
|
3053
3372
|
*/
|
|
3054
|
-
getIn(
|
|
3055
|
-
const [key, ...rest] =
|
|
3373
|
+
getIn(path21, keepScalar) {
|
|
3374
|
+
const [key, ...rest] = path21;
|
|
3056
3375
|
const node = this.get(key, true);
|
|
3057
3376
|
if (rest.length === 0)
|
|
3058
3377
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -3070,8 +3389,8 @@ var require_Collection = __commonJS({
|
|
|
3070
3389
|
/**
|
|
3071
3390
|
* Checks if the collection includes a value with the key `key`.
|
|
3072
3391
|
*/
|
|
3073
|
-
hasIn(
|
|
3074
|
-
const [key, ...rest] =
|
|
3392
|
+
hasIn(path21) {
|
|
3393
|
+
const [key, ...rest] = path21;
|
|
3075
3394
|
if (rest.length === 0)
|
|
3076
3395
|
return this.has(key);
|
|
3077
3396
|
const node = this.get(key, true);
|
|
@@ -3081,8 +3400,8 @@ var require_Collection = __commonJS({
|
|
|
3081
3400
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
3082
3401
|
* boolean to add/remove the item from the set.
|
|
3083
3402
|
*/
|
|
3084
|
-
setIn(
|
|
3085
|
-
const [key, ...rest] =
|
|
3403
|
+
setIn(path21, value) {
|
|
3404
|
+
const [key, ...rest] = path21;
|
|
3086
3405
|
if (rest.length === 0) {
|
|
3087
3406
|
this.set(key, value);
|
|
3088
3407
|
} else {
|
|
@@ -5597,9 +5916,9 @@ var require_Document = __commonJS({
|
|
|
5597
5916
|
this.contents.add(value);
|
|
5598
5917
|
}
|
|
5599
5918
|
/** Adds a value to the document. */
|
|
5600
|
-
addIn(
|
|
5919
|
+
addIn(path21, value) {
|
|
5601
5920
|
if (assertCollection(this.contents))
|
|
5602
|
-
this.contents.addIn(
|
|
5921
|
+
this.contents.addIn(path21, value);
|
|
5603
5922
|
}
|
|
5604
5923
|
/**
|
|
5605
5924
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -5674,14 +5993,14 @@ var require_Document = __commonJS({
|
|
|
5674
5993
|
* Removes a value from the document.
|
|
5675
5994
|
* @returns `true` if the item was found and removed.
|
|
5676
5995
|
*/
|
|
5677
|
-
deleteIn(
|
|
5678
|
-
if (Collection.isEmptyPath(
|
|
5996
|
+
deleteIn(path21) {
|
|
5997
|
+
if (Collection.isEmptyPath(path21)) {
|
|
5679
5998
|
if (this.contents == null)
|
|
5680
5999
|
return false;
|
|
5681
6000
|
this.contents = null;
|
|
5682
6001
|
return true;
|
|
5683
6002
|
}
|
|
5684
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
6003
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path21) : false;
|
|
5685
6004
|
}
|
|
5686
6005
|
/**
|
|
5687
6006
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -5696,10 +6015,10 @@ var require_Document = __commonJS({
|
|
|
5696
6015
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
5697
6016
|
* `true` (collections are always returned intact).
|
|
5698
6017
|
*/
|
|
5699
|
-
getIn(
|
|
5700
|
-
if (Collection.isEmptyPath(
|
|
6018
|
+
getIn(path21, keepScalar) {
|
|
6019
|
+
if (Collection.isEmptyPath(path21))
|
|
5701
6020
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
5702
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
6021
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path21, keepScalar) : void 0;
|
|
5703
6022
|
}
|
|
5704
6023
|
/**
|
|
5705
6024
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -5710,10 +6029,10 @@ var require_Document = __commonJS({
|
|
|
5710
6029
|
/**
|
|
5711
6030
|
* Checks if the document includes a value at `path`.
|
|
5712
6031
|
*/
|
|
5713
|
-
hasIn(
|
|
5714
|
-
if (Collection.isEmptyPath(
|
|
6032
|
+
hasIn(path21) {
|
|
6033
|
+
if (Collection.isEmptyPath(path21))
|
|
5715
6034
|
return this.contents !== void 0;
|
|
5716
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
6035
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path21) : false;
|
|
5717
6036
|
}
|
|
5718
6037
|
/**
|
|
5719
6038
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -5730,13 +6049,13 @@ var require_Document = __commonJS({
|
|
|
5730
6049
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
5731
6050
|
* boolean to add/remove the item from the set.
|
|
5732
6051
|
*/
|
|
5733
|
-
setIn(
|
|
5734
|
-
if (Collection.isEmptyPath(
|
|
6052
|
+
setIn(path21, value) {
|
|
6053
|
+
if (Collection.isEmptyPath(path21)) {
|
|
5735
6054
|
this.contents = value;
|
|
5736
6055
|
} else if (this.contents == null) {
|
|
5737
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
6056
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path21), value);
|
|
5738
6057
|
} else if (assertCollection(this.contents)) {
|
|
5739
|
-
this.contents.setIn(
|
|
6058
|
+
this.contents.setIn(path21, value);
|
|
5740
6059
|
}
|
|
5741
6060
|
}
|
|
5742
6061
|
/**
|
|
@@ -7696,9 +8015,9 @@ var require_cst_visit = __commonJS({
|
|
|
7696
8015
|
visit2.BREAK = BREAK;
|
|
7697
8016
|
visit2.SKIP = SKIP;
|
|
7698
8017
|
visit2.REMOVE = REMOVE;
|
|
7699
|
-
visit2.itemAtPath = (cst,
|
|
8018
|
+
visit2.itemAtPath = (cst, path21) => {
|
|
7700
8019
|
let item = cst;
|
|
7701
|
-
for (const [field, index] of
|
|
8020
|
+
for (const [field, index] of path21) {
|
|
7702
8021
|
const tok = item?.[field];
|
|
7703
8022
|
if (tok && "items" in tok) {
|
|
7704
8023
|
item = tok.items[index];
|
|
@@ -7707,23 +8026,23 @@ var require_cst_visit = __commonJS({
|
|
|
7707
8026
|
}
|
|
7708
8027
|
return item;
|
|
7709
8028
|
};
|
|
7710
|
-
visit2.parentCollection = (cst,
|
|
7711
|
-
const parent = visit2.itemAtPath(cst,
|
|
7712
|
-
const field =
|
|
8029
|
+
visit2.parentCollection = (cst, path21) => {
|
|
8030
|
+
const parent = visit2.itemAtPath(cst, path21.slice(0, -1));
|
|
8031
|
+
const field = path21[path21.length - 1][0];
|
|
7713
8032
|
const coll = parent?.[field];
|
|
7714
8033
|
if (coll && "items" in coll)
|
|
7715
8034
|
return coll;
|
|
7716
8035
|
throw new Error("Parent collection not found");
|
|
7717
8036
|
};
|
|
7718
|
-
function _visit(
|
|
7719
|
-
let ctrl = visitor(item,
|
|
8037
|
+
function _visit(path21, item, visitor) {
|
|
8038
|
+
let ctrl = visitor(item, path21);
|
|
7720
8039
|
if (typeof ctrl === "symbol")
|
|
7721
8040
|
return ctrl;
|
|
7722
8041
|
for (const field of ["key", "value"]) {
|
|
7723
8042
|
const token = item[field];
|
|
7724
8043
|
if (token && "items" in token) {
|
|
7725
8044
|
for (let i2 = 0; i2 < token.items.length; ++i2) {
|
|
7726
|
-
const ci = _visit(Object.freeze(
|
|
8045
|
+
const ci = _visit(Object.freeze(path21.concat([[field, i2]])), token.items[i2], visitor);
|
|
7727
8046
|
if (typeof ci === "number")
|
|
7728
8047
|
i2 = ci - 1;
|
|
7729
8048
|
else if (ci === BREAK)
|
|
@@ -7734,10 +8053,10 @@ var require_cst_visit = __commonJS({
|
|
|
7734
8053
|
}
|
|
7735
8054
|
}
|
|
7736
8055
|
if (typeof ctrl === "function" && field === "key")
|
|
7737
|
-
ctrl = ctrl(item,
|
|
8056
|
+
ctrl = ctrl(item, path21);
|
|
7738
8057
|
}
|
|
7739
8058
|
}
|
|
7740
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
8059
|
+
return typeof ctrl === "function" ? ctrl(item, path21) : ctrl;
|
|
7741
8060
|
}
|
|
7742
8061
|
exports.visit = visit2;
|
|
7743
8062
|
}
|
|
@@ -9039,14 +9358,14 @@ var require_parser = __commonJS({
|
|
|
9039
9358
|
case "scalar":
|
|
9040
9359
|
case "single-quoted-scalar":
|
|
9041
9360
|
case "double-quoted-scalar": {
|
|
9042
|
-
const
|
|
9361
|
+
const fs17 = this.flowScalar(this.type);
|
|
9043
9362
|
if (atNextItem || it.value) {
|
|
9044
|
-
map.items.push({ start, key:
|
|
9363
|
+
map.items.push({ start, key: fs17, sep: [] });
|
|
9045
9364
|
this.onKeyLine = true;
|
|
9046
9365
|
} else if (it.sep) {
|
|
9047
|
-
this.stack.push(
|
|
9366
|
+
this.stack.push(fs17);
|
|
9048
9367
|
} else {
|
|
9049
|
-
Object.assign(it, { key:
|
|
9368
|
+
Object.assign(it, { key: fs17, sep: [] });
|
|
9050
9369
|
this.onKeyLine = true;
|
|
9051
9370
|
}
|
|
9052
9371
|
return;
|
|
@@ -9174,13 +9493,13 @@ var require_parser = __commonJS({
|
|
|
9174
9493
|
case "scalar":
|
|
9175
9494
|
case "single-quoted-scalar":
|
|
9176
9495
|
case "double-quoted-scalar": {
|
|
9177
|
-
const
|
|
9496
|
+
const fs17 = this.flowScalar(this.type);
|
|
9178
9497
|
if (!it || it.value)
|
|
9179
|
-
fc.items.push({ start: [], key:
|
|
9498
|
+
fc.items.push({ start: [], key: fs17, sep: [] });
|
|
9180
9499
|
else if (it.sep)
|
|
9181
|
-
this.stack.push(
|
|
9500
|
+
this.stack.push(fs17);
|
|
9182
9501
|
else
|
|
9183
|
-
Object.assign(it, { key:
|
|
9502
|
+
Object.assign(it, { key: fs17, sep: [] });
|
|
9184
9503
|
return;
|
|
9185
9504
|
}
|
|
9186
9505
|
case "flow-map-end":
|
|
@@ -9593,13 +9912,13 @@ var require_min_release_age = __commonJS({
|
|
|
9593
9912
|
return Number.isFinite(days) && days > 0 ? days * config_parse_1.DAY_MS : 0;
|
|
9594
9913
|
}
|
|
9595
9914
|
function probe(p) {
|
|
9596
|
-
return new Promise((
|
|
9915
|
+
return new Promise((resolve13) => {
|
|
9597
9916
|
(0, node_child_process_1.exec)(p.command, { timeout: PROBE_TIMEOUT_MS2, windowsHide: true }, (err, stdout2) => {
|
|
9598
9917
|
if (err) {
|
|
9599
|
-
|
|
9918
|
+
resolve13(0);
|
|
9600
9919
|
return;
|
|
9601
9920
|
}
|
|
9602
|
-
|
|
9921
|
+
resolve13(p.parse(stdout2));
|
|
9603
9922
|
});
|
|
9604
9923
|
});
|
|
9605
9924
|
}
|
|
@@ -9632,12 +9951,12 @@ var require_registry = __commonJS({
|
|
|
9632
9951
|
var node_https_1 = __importDefault(__require("node:https"));
|
|
9633
9952
|
var REQUEST_TIMEOUT_MS = 1e4;
|
|
9634
9953
|
function fetchRegistryInfo2(url) {
|
|
9635
|
-
return new Promise((
|
|
9954
|
+
return new Promise((resolve13) => {
|
|
9636
9955
|
let resolved = false;
|
|
9637
9956
|
const safeResolve = (value) => {
|
|
9638
9957
|
if (!resolved) {
|
|
9639
9958
|
resolved = true;
|
|
9640
|
-
|
|
9959
|
+
resolve13(value);
|
|
9641
9960
|
}
|
|
9642
9961
|
};
|
|
9643
9962
|
const req = node_https_1.default.get(url, { timeout: REQUEST_TIMEOUT_MS }, (res) => {
|
|
@@ -11148,8 +11467,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname2(proce
|
|
|
11148
11467
|
return decodedFile;
|
|
11149
11468
|
};
|
|
11150
11469
|
}
|
|
11151
|
-
function normalizeWindowsPath(
|
|
11152
|
-
return
|
|
11470
|
+
function normalizeWindowsPath(path21) {
|
|
11471
|
+
return path21.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
11153
11472
|
}
|
|
11154
11473
|
|
|
11155
11474
|
// ../../node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
@@ -13701,15 +14020,15 @@ async function addSourceContext(frames) {
|
|
|
13701
14020
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
13702
14021
|
return frames;
|
|
13703
14022
|
}
|
|
13704
|
-
function getContextLinesFromFile(
|
|
13705
|
-
return new Promise((
|
|
13706
|
-
const stream = createReadStream(
|
|
14023
|
+
function getContextLinesFromFile(path21, ranges, output) {
|
|
14024
|
+
return new Promise((resolve13) => {
|
|
14025
|
+
const stream = createReadStream(path21);
|
|
13707
14026
|
const lineReaded = createInterface2({
|
|
13708
14027
|
input: stream
|
|
13709
14028
|
});
|
|
13710
14029
|
function destroyStreamAndResolve() {
|
|
13711
14030
|
stream.destroy();
|
|
13712
|
-
|
|
14031
|
+
resolve13();
|
|
13713
14032
|
}
|
|
13714
14033
|
let lineNumber = 0;
|
|
13715
14034
|
let currentRangeIndex = 0;
|
|
@@ -13718,7 +14037,7 @@ function getContextLinesFromFile(path20, ranges, output) {
|
|
|
13718
14037
|
let rangeStart = range[0];
|
|
13719
14038
|
let rangeEnd = range[1];
|
|
13720
14039
|
function onStreamError() {
|
|
13721
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
14040
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path21, 1);
|
|
13722
14041
|
lineReaded.close();
|
|
13723
14042
|
lineReaded.removeAllListeners();
|
|
13724
14043
|
destroyStreamAndResolve();
|
|
@@ -13779,8 +14098,8 @@ function clearLineContext(frame) {
|
|
|
13779
14098
|
delete frame.context_line;
|
|
13780
14099
|
delete frame.post_context;
|
|
13781
14100
|
}
|
|
13782
|
-
function shouldSkipContextLinesForFile(
|
|
13783
|
-
return
|
|
14101
|
+
function shouldSkipContextLinesForFile(path21) {
|
|
14102
|
+
return path21.startsWith("node:") || path21.endsWith(".min.js") || path21.endsWith(".min.cjs") || path21.endsWith(".min.mjs") || path21.startsWith("data:");
|
|
13784
14103
|
}
|
|
13785
14104
|
function shouldSkipContextLinesForFrame(frame) {
|
|
13786
14105
|
if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
|
|
@@ -15006,9 +15325,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
15006
15325
|
if (!waitUntil) return;
|
|
15007
15326
|
if (this.disabled || this.optedOut) return;
|
|
15008
15327
|
if (!this._waitUntilCycle) {
|
|
15009
|
-
let
|
|
15328
|
+
let resolve13;
|
|
15010
15329
|
const promise = new Promise((r2) => {
|
|
15011
|
-
|
|
15330
|
+
resolve13 = r2;
|
|
15012
15331
|
});
|
|
15013
15332
|
try {
|
|
15014
15333
|
waitUntil(promise);
|
|
@@ -15016,7 +15335,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
15016
15335
|
return;
|
|
15017
15336
|
}
|
|
15018
15337
|
this._waitUntilCycle = {
|
|
15019
|
-
resolve:
|
|
15338
|
+
resolve: resolve13,
|
|
15020
15339
|
startedAt: Date.now(),
|
|
15021
15340
|
timer: void 0
|
|
15022
15341
|
};
|
|
@@ -15040,12 +15359,12 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
15040
15359
|
return cycle?.resolve;
|
|
15041
15360
|
}
|
|
15042
15361
|
async resolveWaitUntilFlush() {
|
|
15043
|
-
const
|
|
15362
|
+
const resolve13 = this._consumeWaitUntilCycle();
|
|
15044
15363
|
try {
|
|
15045
15364
|
await super.flush();
|
|
15046
15365
|
} catch {
|
|
15047
15366
|
} finally {
|
|
15048
|
-
|
|
15367
|
+
resolve13?.();
|
|
15049
15368
|
}
|
|
15050
15369
|
}
|
|
15051
15370
|
getPersistedProperty(key) {
|
|
@@ -15166,15 +15485,15 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
15166
15485
|
async waitForLocalEvaluationReady(timeoutMs = THIRTY_SECONDS) {
|
|
15167
15486
|
if (this.isLocalEvaluationReady()) return true;
|
|
15168
15487
|
if (void 0 === this.featureFlagsPoller) return false;
|
|
15169
|
-
return new Promise((
|
|
15488
|
+
return new Promise((resolve13) => {
|
|
15170
15489
|
const timeout = setTimeout(() => {
|
|
15171
15490
|
cleanup();
|
|
15172
|
-
|
|
15491
|
+
resolve13(false);
|
|
15173
15492
|
}, timeoutMs);
|
|
15174
15493
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
|
|
15175
15494
|
clearTimeout(timeout);
|
|
15176
15495
|
cleanup();
|
|
15177
|
-
|
|
15496
|
+
resolve13(count > 0);
|
|
15178
15497
|
});
|
|
15179
15498
|
});
|
|
15180
15499
|
}
|
|
@@ -15629,14 +15948,14 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
15629
15948
|
this.context?.enter(data, options);
|
|
15630
15949
|
}
|
|
15631
15950
|
async _shutdown(shutdownTimeoutMs) {
|
|
15632
|
-
const
|
|
15951
|
+
const resolve13 = this._consumeWaitUntilCycle();
|
|
15633
15952
|
await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
|
|
15634
15953
|
this.errorTracking.shutdown();
|
|
15635
15954
|
try {
|
|
15636
15955
|
return await super._shutdown(shutdownTimeoutMs);
|
|
15637
15956
|
} finally {
|
|
15638
15957
|
this.distinctIdHasSentFlagCalls = {};
|
|
15639
|
-
|
|
15958
|
+
resolve13?.();
|
|
15640
15959
|
}
|
|
15641
15960
|
}
|
|
15642
15961
|
async _requestRemoteConfigPayload(flagKey) {
|
|
@@ -16017,6 +16336,11 @@ import { stat } from "node:fs/promises";
|
|
|
16017
16336
|
import { randomUUID } from "node:crypto";
|
|
16018
16337
|
import { basename, extname } from "node:path";
|
|
16019
16338
|
|
|
16339
|
+
// ../registry/src/file-inputs.ts
|
|
16340
|
+
var FLOW_NAME_CHARSET = "[A-Za-z0-9_-]+";
|
|
16341
|
+
var FLOW_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}$`);
|
|
16342
|
+
var FLOW_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.yaml$`);
|
|
16343
|
+
|
|
16020
16344
|
// ../registry/src/failure-codes.ts
|
|
16021
16345
|
var FAILURE_CODES = {
|
|
16022
16346
|
ARGENT_UNCLASSIFIED_FAILURE: "ARGENT_UNCLASSIFIED_FAILURE",
|
|
@@ -16034,6 +16358,7 @@ var FAILURE_CODES = {
|
|
|
16034
16358
|
CLI_RUN_FLAG_PARSE_FAILED: "CLI_RUN_FLAG_PARSE_FAILED",
|
|
16035
16359
|
CLI_RUN_ARGS_NOT_OBJECT: "CLI_RUN_ARGS_NOT_OBJECT",
|
|
16036
16360
|
CLI_RUN_ARGS_JSON_INVALID: "CLI_RUN_ARGS_JSON_INVALID",
|
|
16361
|
+
CLI_RUN_INPUT_VALIDATION_FAILED: "CLI_RUN_INPUT_VALIDATION_FAILED",
|
|
16037
16362
|
CLI_RUN_TOOL_CALL_FAILED: "CLI_RUN_TOOL_CALL_FAILED",
|
|
16038
16363
|
CLI_RUN_SAVE_IMAGE_FAILED: "CLI_RUN_SAVE_IMAGE_FAILED",
|
|
16039
16364
|
TOOL_CAPABILITY_UNSUPPORTED_OPERATION: "TOOL_CAPABILITY_UNSUPPORTED_OPERATION",
|
|
@@ -16622,9 +16947,9 @@ function isReplitAgent(env) {
|
|
|
16622
16947
|
}
|
|
16623
16948
|
var DEVIN_MARKER_PATH = "/opt/.devin";
|
|
16624
16949
|
var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
16625
|
-
function safeExists(fileExists,
|
|
16950
|
+
function safeExists(fileExists, path21) {
|
|
16626
16951
|
try {
|
|
16627
|
-
return fileExists(
|
|
16952
|
+
return fileExists(path21);
|
|
16628
16953
|
} catch {
|
|
16629
16954
|
return false;
|
|
16630
16955
|
}
|
|
@@ -17045,7 +17370,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
17045
17370
|
var SESSION_ID = randomUUID3();
|
|
17046
17371
|
function readCliVersion() {
|
|
17047
17372
|
if (true) {
|
|
17048
|
-
return "0.
|
|
17373
|
+
return "0.19.0";
|
|
17049
17374
|
}
|
|
17050
17375
|
return "0.0.0";
|
|
17051
17376
|
}
|
|
@@ -17079,11 +17404,11 @@ function getBaseProps(runtime) {
|
|
|
17079
17404
|
|
|
17080
17405
|
// ../telemetry/src/identity.ts
|
|
17081
17406
|
import * as crypto2 from "node:crypto";
|
|
17082
|
-
import * as
|
|
17083
|
-
import * as
|
|
17407
|
+
import * as fs4 from "node:fs";
|
|
17408
|
+
import * as path7 from "node:path";
|
|
17084
17409
|
|
|
17085
17410
|
// ../telemetry/src/paths.ts
|
|
17086
|
-
import * as
|
|
17411
|
+
import * as path6 from "node:path";
|
|
17087
17412
|
|
|
17088
17413
|
// ../configuration-core/src/flags.ts
|
|
17089
17414
|
import * as fs from "node:fs";
|
|
@@ -17218,15 +17543,20 @@ function updateConfig(mutate, scope = "global", options = {}) {
|
|
|
17218
17543
|
}
|
|
17219
17544
|
}
|
|
17220
17545
|
|
|
17221
|
-
// ../configuration-core/src/
|
|
17546
|
+
// ../configuration-core/src/secrets.ts
|
|
17547
|
+
var import_dotenv = __toESM(require_main(), 1);
|
|
17548
|
+
import * as fs3 from "node:fs";
|
|
17222
17549
|
import * as path4 from "node:path";
|
|
17223
17550
|
|
|
17551
|
+
// ../configuration-core/src/config-access.ts
|
|
17552
|
+
import * as path5 from "node:path";
|
|
17553
|
+
|
|
17224
17554
|
// ../telemetry/src/paths.ts
|
|
17225
17555
|
function identityFilePath() {
|
|
17226
|
-
return
|
|
17556
|
+
return path6.join(argentHomeDir(), "telemetry-id");
|
|
17227
17557
|
}
|
|
17228
17558
|
function debugLogPath() {
|
|
17229
|
-
return
|
|
17559
|
+
return path6.join(argentHomeDir(), "telemetry-debug.log");
|
|
17230
17560
|
}
|
|
17231
17561
|
|
|
17232
17562
|
// ../telemetry/src/identity.ts
|
|
@@ -17336,66 +17666,66 @@ function resolveFingerprintOnce(resolveFingerprint) {
|
|
|
17336
17666
|
function isCorruptIdFile(filePath) {
|
|
17337
17667
|
let isRegularFile;
|
|
17338
17668
|
try {
|
|
17339
|
-
isRegularFile =
|
|
17669
|
+
isRegularFile = fs4.lstatSync(filePath).isFile();
|
|
17340
17670
|
} catch {
|
|
17341
17671
|
return false;
|
|
17342
17672
|
}
|
|
17343
17673
|
return isRegularFile && tryReadId(filePath) === null;
|
|
17344
17674
|
}
|
|
17345
17675
|
function writeIdFileAtomic(finalPath, id) {
|
|
17346
|
-
|
|
17676
|
+
fs4.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17347
17677
|
let occupant;
|
|
17348
17678
|
try {
|
|
17349
|
-
occupant =
|
|
17679
|
+
occupant = fs4.lstatSync(finalPath);
|
|
17350
17680
|
} catch (err) {
|
|
17351
17681
|
if (err.code !== "ENOENT") throw err;
|
|
17352
17682
|
}
|
|
17353
17683
|
if (occupant && !occupant.isFile()) {
|
|
17354
17684
|
throw new Error("telemetry: refusing to replace a non-regular file at the identity path");
|
|
17355
17685
|
}
|
|
17356
|
-
const tmpPath =
|
|
17686
|
+
const tmpPath = path7.join(
|
|
17357
17687
|
argentHomeDir(),
|
|
17358
17688
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17359
17689
|
);
|
|
17360
|
-
const fd =
|
|
17690
|
+
const fd = fs4.openSync(tmpPath, "wx", 384);
|
|
17361
17691
|
try {
|
|
17362
17692
|
try {
|
|
17363
|
-
|
|
17364
|
-
|
|
17693
|
+
fs4.writeSync(fd, id);
|
|
17694
|
+
fs4.fsyncSync(fd);
|
|
17365
17695
|
} finally {
|
|
17366
|
-
|
|
17696
|
+
fs4.closeSync(fd);
|
|
17367
17697
|
}
|
|
17368
|
-
|
|
17698
|
+
fs4.renameSync(tmpPath, finalPath);
|
|
17369
17699
|
} finally {
|
|
17370
17700
|
try {
|
|
17371
|
-
|
|
17701
|
+
fs4.unlinkSync(tmpPath);
|
|
17372
17702
|
} catch {
|
|
17373
17703
|
}
|
|
17374
17704
|
}
|
|
17375
17705
|
}
|
|
17376
17706
|
function mintRandomId(finalPath) {
|
|
17377
|
-
|
|
17707
|
+
fs4.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17378
17708
|
let value = crypto2.randomUUID();
|
|
17379
17709
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
17380
|
-
const tmpPath =
|
|
17710
|
+
const tmpPath = path7.join(
|
|
17381
17711
|
argentHomeDir(),
|
|
17382
17712
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17383
17713
|
);
|
|
17384
17714
|
let fd;
|
|
17385
17715
|
try {
|
|
17386
|
-
fd =
|
|
17716
|
+
fd = fs4.openSync(tmpPath, "wx", 384);
|
|
17387
17717
|
} catch (err) {
|
|
17388
17718
|
if (err.code === "EEXIST") continue;
|
|
17389
17719
|
throw err;
|
|
17390
17720
|
}
|
|
17391
17721
|
try {
|
|
17392
17722
|
try {
|
|
17393
|
-
|
|
17394
|
-
|
|
17723
|
+
fs4.writeSync(fd, value);
|
|
17724
|
+
fs4.fsyncSync(fd);
|
|
17395
17725
|
} finally {
|
|
17396
|
-
|
|
17726
|
+
fs4.closeSync(fd);
|
|
17397
17727
|
}
|
|
17398
|
-
|
|
17728
|
+
fs4.linkSync(tmpPath, finalPath);
|
|
17399
17729
|
cached = { path: finalPath, id: value };
|
|
17400
17730
|
return value;
|
|
17401
17731
|
} catch (err) {
|
|
@@ -17414,7 +17744,7 @@ function mintRandomId(finalPath) {
|
|
|
17414
17744
|
throw err;
|
|
17415
17745
|
} finally {
|
|
17416
17746
|
try {
|
|
17417
|
-
|
|
17747
|
+
fs4.unlinkSync(tmpPath);
|
|
17418
17748
|
} catch {
|
|
17419
17749
|
}
|
|
17420
17750
|
}
|
|
@@ -17422,12 +17752,12 @@ function mintRandomId(finalPath) {
|
|
|
17422
17752
|
throw new Error("telemetry: failed to create identity after retries");
|
|
17423
17753
|
}
|
|
17424
17754
|
function claimCorruptOccupant(finalPath) {
|
|
17425
|
-
const claimed =
|
|
17755
|
+
const claimed = path7.join(
|
|
17426
17756
|
argentHomeDir(),
|
|
17427
17757
|
`.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
|
|
17428
17758
|
);
|
|
17429
17759
|
try {
|
|
17430
|
-
|
|
17760
|
+
fs4.renameSync(finalPath, claimed);
|
|
17431
17761
|
} catch {
|
|
17432
17762
|
return null;
|
|
17433
17763
|
}
|
|
@@ -17436,7 +17766,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17436
17766
|
grabbed = tryReadId(claimed);
|
|
17437
17767
|
} finally {
|
|
17438
17768
|
try {
|
|
17439
|
-
|
|
17769
|
+
fs4.unlinkSync(claimed);
|
|
17440
17770
|
} catch {
|
|
17441
17771
|
}
|
|
17442
17772
|
}
|
|
@@ -17445,7 +17775,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17445
17775
|
function deleteAnonId() {
|
|
17446
17776
|
cached = null;
|
|
17447
17777
|
try {
|
|
17448
|
-
|
|
17778
|
+
fs4.unlinkSync(identityFilePath());
|
|
17449
17779
|
} catch (err) {
|
|
17450
17780
|
if (err.code !== "ENOENT") throw err;
|
|
17451
17781
|
}
|
|
@@ -17453,9 +17783,9 @@ function deleteAnonId() {
|
|
|
17453
17783
|
function tryReadId(filePath) {
|
|
17454
17784
|
let raw;
|
|
17455
17785
|
try {
|
|
17456
|
-
const stats =
|
|
17786
|
+
const stats = fs4.lstatSync(filePath);
|
|
17457
17787
|
if (!stats.isFile()) return null;
|
|
17458
|
-
raw =
|
|
17788
|
+
raw = fs4.readFileSync(filePath, "utf8");
|
|
17459
17789
|
} catch (err) {
|
|
17460
17790
|
if (err.code === "ENOENT") return null;
|
|
17461
17791
|
return null;
|
|
@@ -17469,12 +17799,12 @@ function tryReadId(filePath) {
|
|
|
17469
17799
|
import { execFileSync, spawn } from "node:child_process";
|
|
17470
17800
|
|
|
17471
17801
|
// ../native-devtools-ios/src/index.ts
|
|
17472
|
-
import * as
|
|
17473
|
-
import * as
|
|
17474
|
-
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ??
|
|
17475
|
-
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ??
|
|
17476
|
-
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ??
|
|
17477
|
-
var DYLIB_TVOS_DIR =
|
|
17802
|
+
import * as path8 from "node:path";
|
|
17803
|
+
import * as fs5 from "node:fs";
|
|
17804
|
+
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path8.join(__dirname, "..", "dylibs");
|
|
17805
|
+
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path8.join(__dirname, "..", "bin");
|
|
17806
|
+
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path8.join(DYLIB_DIR, "tcp");
|
|
17807
|
+
var DYLIB_TVOS_DIR = path8.join(DYLIB_DIR, "tvos");
|
|
17478
17808
|
function hostPlatformKey() {
|
|
17479
17809
|
if (process.platform === "linux" && process.arch === "arm64") {
|
|
17480
17810
|
return "linux-arm64";
|
|
@@ -17485,14 +17815,14 @@ function simulatorServerBinaryName() {
|
|
|
17485
17815
|
return process.platform === "win32" ? "simulator-server.exe" : "simulator-server";
|
|
17486
17816
|
}
|
|
17487
17817
|
function platformBinDir() {
|
|
17488
|
-
return
|
|
17818
|
+
return path8.join(BIN_DIR, hostPlatformKey());
|
|
17489
17819
|
}
|
|
17490
17820
|
function simulatorServerBinaryPath() {
|
|
17491
17821
|
const binaryName = simulatorServerBinaryName();
|
|
17492
|
-
const p =
|
|
17493
|
-
if (!
|
|
17494
|
-
const flat =
|
|
17495
|
-
const migrationHint =
|
|
17822
|
+
const p = path8.join(platformBinDir(), binaryName);
|
|
17823
|
+
if (!fs5.existsSync(p)) {
|
|
17824
|
+
const flat = path8.join(BIN_DIR, binaryName);
|
|
17825
|
+
const migrationHint = fs5.existsSync(flat) ? ` Found a binary at the old flat path ${flat}; move it to ${p} or update ARGENT_SIMULATOR_SERVER_DIR to point at the parent of the platform subdirectory.` : "";
|
|
17496
17826
|
throw new Error(
|
|
17497
17827
|
`simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
|
|
17498
17828
|
);
|
|
@@ -17525,12 +17855,12 @@ function resolveHostFingerprint() {
|
|
|
17525
17855
|
}
|
|
17526
17856
|
}
|
|
17527
17857
|
function resolveHostFingerprintAsync() {
|
|
17528
|
-
return new Promise((
|
|
17858
|
+
return new Promise((resolve13) => {
|
|
17529
17859
|
let binary;
|
|
17530
17860
|
try {
|
|
17531
17861
|
binary = simulatorServerBinaryPath();
|
|
17532
17862
|
} catch {
|
|
17533
|
-
|
|
17863
|
+
resolve13(null);
|
|
17534
17864
|
return;
|
|
17535
17865
|
}
|
|
17536
17866
|
let settled = false;
|
|
@@ -17543,7 +17873,7 @@ function resolveHostFingerprintAsync() {
|
|
|
17543
17873
|
child?.kill("SIGKILL");
|
|
17544
17874
|
} catch {
|
|
17545
17875
|
}
|
|
17546
|
-
|
|
17876
|
+
resolve13(value);
|
|
17547
17877
|
};
|
|
17548
17878
|
const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
|
|
17549
17879
|
watchdog.unref?.();
|
|
@@ -17576,13 +17906,13 @@ function resolveHostFingerprintAsync() {
|
|
|
17576
17906
|
}
|
|
17577
17907
|
|
|
17578
17908
|
// ../telemetry/src/consent.ts
|
|
17579
|
-
import * as
|
|
17909
|
+
import * as fs6 from "node:fs";
|
|
17580
17910
|
var cache = { current: null };
|
|
17581
17911
|
var sessionOverride = null;
|
|
17582
17912
|
function readConfigOverride() {
|
|
17583
17913
|
let stats;
|
|
17584
17914
|
try {
|
|
17585
|
-
stats =
|
|
17915
|
+
stats = fs6.lstatSync(configFilePath());
|
|
17586
17916
|
} catch (err) {
|
|
17587
17917
|
if (err.code === "ENOENT") {
|
|
17588
17918
|
cache.current = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
@@ -17602,7 +17932,7 @@ function readConfigOverride() {
|
|
|
17602
17932
|
}
|
|
17603
17933
|
let parsedEnabled = null;
|
|
17604
17934
|
try {
|
|
17605
|
-
const raw =
|
|
17935
|
+
const raw = fs6.readFileSync(configFilePath(), "utf8");
|
|
17606
17936
|
const json = JSON.parse(raw);
|
|
17607
17937
|
if (json && typeof json === "object") {
|
|
17608
17938
|
const t2 = json.telemetry;
|
|
@@ -17666,7 +17996,7 @@ function setSessionConsentOverride(enabled) {
|
|
|
17666
17996
|
}
|
|
17667
17997
|
|
|
17668
17998
|
// ../telemetry/src/debug.ts
|
|
17669
|
-
import * as
|
|
17999
|
+
import * as fs7 from "node:fs";
|
|
17670
18000
|
function isDebugEnabled(env = process.env) {
|
|
17671
18001
|
const v = env.ARGENT_TELEMETRY_DEBUG;
|
|
17672
18002
|
if (!v) return false;
|
|
@@ -17693,8 +18023,8 @@ function emitDebugPayload(payload) {
|
|
|
17693
18023
|
} catch {
|
|
17694
18024
|
}
|
|
17695
18025
|
try {
|
|
17696
|
-
|
|
17697
|
-
|
|
18026
|
+
fs7.mkdirSync(argentHomeDir(), { recursive: true });
|
|
18027
|
+
fs7.appendFileSync(debugLogPath(), line + "\n");
|
|
17698
18028
|
} catch {
|
|
17699
18029
|
}
|
|
17700
18030
|
}
|
|
@@ -17841,7 +18171,7 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
|
17841
18171
|
try {
|
|
17842
18172
|
await Promise.race([
|
|
17843
18173
|
client2.shutdown(timeoutMs),
|
|
17844
|
-
new Promise((
|
|
18174
|
+
new Promise((resolve13) => setTimeout(resolve13, timeoutMs + 250).unref())
|
|
17845
18175
|
]);
|
|
17846
18176
|
} catch (err) {
|
|
17847
18177
|
emitDebugError("shutdown failed", err);
|
|
@@ -17852,8 +18182,8 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
|
17852
18182
|
}
|
|
17853
18183
|
|
|
17854
18184
|
// ../argent-installer/src/mcp-configs.ts
|
|
17855
|
-
import * as
|
|
17856
|
-
import * as
|
|
18185
|
+
import * as fs14 from "node:fs";
|
|
18186
|
+
import * as path15 from "node:path";
|
|
17857
18187
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
17858
18188
|
import { homedir as homedir4 } from "node:os";
|
|
17859
18189
|
|
|
@@ -17867,8 +18197,8 @@ var CURSOR_ALLOWLIST_PATTERN = "argent:*";
|
|
|
17867
18197
|
|
|
17868
18198
|
// ../argent-installer/src/utils.ts
|
|
17869
18199
|
var import_semver2 = __toESM(require_semver2(), 1);
|
|
17870
|
-
import * as
|
|
17871
|
-
import * as
|
|
18200
|
+
import * as fs13 from "node:fs";
|
|
18201
|
+
import * as path14 from "node:path";
|
|
17872
18202
|
import * as dns from "node:dns";
|
|
17873
18203
|
import * as os2 from "node:os";
|
|
17874
18204
|
import { execSync as execSync2 } from "node:child_process";
|
|
@@ -19493,12 +19823,12 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
19493
19823
|
}
|
|
19494
19824
|
return result;
|
|
19495
19825
|
}
|
|
19496
|
-
function findNodeAtLocation(root,
|
|
19826
|
+
function findNodeAtLocation(root, path21) {
|
|
19497
19827
|
if (!root) {
|
|
19498
19828
|
return void 0;
|
|
19499
19829
|
}
|
|
19500
19830
|
let node = root;
|
|
19501
|
-
for (let segment of
|
|
19831
|
+
for (let segment of path21) {
|
|
19502
19832
|
if (typeof segment === "string") {
|
|
19503
19833
|
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
19504
19834
|
return void 0;
|
|
@@ -19852,14 +20182,14 @@ function getNodeType(value) {
|
|
|
19852
20182
|
|
|
19853
20183
|
// ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
19854
20184
|
function setProperty(text2, originalPath, value, options) {
|
|
19855
|
-
const
|
|
20185
|
+
const path21 = originalPath.slice();
|
|
19856
20186
|
const errors = [];
|
|
19857
20187
|
const root = parseTree(text2, errors);
|
|
19858
20188
|
let parent = void 0;
|
|
19859
20189
|
let lastSegment = void 0;
|
|
19860
|
-
while (
|
|
19861
|
-
lastSegment =
|
|
19862
|
-
parent = findNodeAtLocation(root,
|
|
20190
|
+
while (path21.length > 0) {
|
|
20191
|
+
lastSegment = path21.pop();
|
|
20192
|
+
parent = findNodeAtLocation(root, path21);
|
|
19863
20193
|
if (parent === void 0 && value !== void 0) {
|
|
19864
20194
|
if (typeof lastSegment === "string") {
|
|
19865
20195
|
value = { [lastSegment]: value };
|
|
@@ -20045,8 +20375,8 @@ var ParseErrorCode;
|
|
|
20045
20375
|
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
20046
20376
|
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
20047
20377
|
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
20048
|
-
function modify(text2,
|
|
20049
|
-
return setProperty(text2,
|
|
20378
|
+
function modify(text2, path21, value, options) {
|
|
20379
|
+
return setProperty(text2, path21, value, options);
|
|
20050
20380
|
}
|
|
20051
20381
|
function applyEdits(text2, edits) {
|
|
20052
20382
|
let sortedEdits = edits.slice(0).sort((a3, b) => {
|
|
@@ -20070,21 +20400,21 @@ function applyEdits(text2, edits) {
|
|
|
20070
20400
|
}
|
|
20071
20401
|
|
|
20072
20402
|
// ../argent-installer/src/package-root.ts
|
|
20073
|
-
import * as
|
|
20074
|
-
import * as
|
|
20403
|
+
import * as fs8 from "node:fs";
|
|
20404
|
+
import * as path9 from "node:path";
|
|
20075
20405
|
function resolvePackageRoot(dirname15) {
|
|
20076
|
-
let current =
|
|
20406
|
+
let current = path9.resolve(dirname15);
|
|
20077
20407
|
while (true) {
|
|
20078
|
-
if (
|
|
20079
|
-
const parent =
|
|
20080
|
-
if (parent === current) return
|
|
20408
|
+
if (fs8.existsSync(path9.join(current, "package.json"))) return current;
|
|
20409
|
+
const parent = path9.dirname(current);
|
|
20410
|
+
if (parent === current) return path9.resolve(dirname15);
|
|
20081
20411
|
current = parent;
|
|
20082
20412
|
}
|
|
20083
20413
|
}
|
|
20084
20414
|
|
|
20085
20415
|
// ../argent-installer/src/package-manager.ts
|
|
20086
|
-
import * as
|
|
20087
|
-
import * as
|
|
20416
|
+
import * as fs9 from "node:fs";
|
|
20417
|
+
import * as path10 from "node:path";
|
|
20088
20418
|
function formatShellCommand(cmd) {
|
|
20089
20419
|
const parts = [cmd.bin, ...cmd.args.map((a3) => a3.includes(" ") ? `"${a3}"` : a3)];
|
|
20090
20420
|
return parts.join(" ");
|
|
@@ -20101,7 +20431,7 @@ function asKnownPm(name) {
|
|
|
20101
20431
|
}
|
|
20102
20432
|
function pmFromPackageManagerField(dir) {
|
|
20103
20433
|
try {
|
|
20104
|
-
const pkg = JSON.parse(
|
|
20434
|
+
const pkg = JSON.parse(fs9.readFileSync(path10.join(dir, "package.json"), "utf8"));
|
|
20105
20435
|
if (typeof pkg.packageManager === "string") {
|
|
20106
20436
|
return asKnownPm(pkg.packageManager.split("@")[0]);
|
|
20107
20437
|
}
|
|
@@ -20112,7 +20442,7 @@ function pmFromPackageManagerField(dir) {
|
|
|
20112
20442
|
}
|
|
20113
20443
|
function pmFromDevEngines(dir) {
|
|
20114
20444
|
try {
|
|
20115
|
-
const pkg = JSON.parse(
|
|
20445
|
+
const pkg = JSON.parse(fs9.readFileSync(path10.join(dir, "package.json"), "utf8"));
|
|
20116
20446
|
const devEnginesPm = pkg.devEngines?.packageManager;
|
|
20117
20447
|
const names = /* @__PURE__ */ new Set();
|
|
20118
20448
|
for (const entry of Array.isArray(devEnginesPm) ? devEnginesPm : [devEnginesPm]) {
|
|
@@ -20125,7 +20455,7 @@ function pmFromDevEngines(dir) {
|
|
|
20125
20455
|
}
|
|
20126
20456
|
}
|
|
20127
20457
|
function pmFromLockfile(dir) {
|
|
20128
|
-
const has = (file) =>
|
|
20458
|
+
const has = (file) => fs9.existsSync(path10.join(dir, file));
|
|
20129
20459
|
if (has("pnpm-lock.yaml")) return "pnpm";
|
|
20130
20460
|
if (has("yarn.lock")) return "yarn";
|
|
20131
20461
|
if (has("bun.lock") || has("bun.lockb")) return "bun";
|
|
@@ -20133,15 +20463,15 @@ function pmFromLockfile(dir) {
|
|
|
20133
20463
|
return null;
|
|
20134
20464
|
}
|
|
20135
20465
|
function pmFromWorkspaceMarker(dir) {
|
|
20136
|
-
return
|
|
20466
|
+
return fs9.existsSync(path10.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
|
|
20137
20467
|
}
|
|
20138
20468
|
function detectProjectPackageManager(projectRoot) {
|
|
20139
|
-
let dir =
|
|
20469
|
+
let dir = path10.resolve(projectRoot);
|
|
20140
20470
|
for (; ; ) {
|
|
20141
20471
|
const pm = pmFromPackageManagerField(dir) ?? pmFromLockfile(dir) ?? pmFromDevEngines(dir) ?? pmFromWorkspaceMarker(dir);
|
|
20142
20472
|
if (pm) return pm;
|
|
20143
|
-
if (
|
|
20144
|
-
const parent =
|
|
20473
|
+
if (fs9.existsSync(path10.join(dir, ".git"))) break;
|
|
20474
|
+
const parent = path10.dirname(dir);
|
|
20145
20475
|
if (parent === dir) break;
|
|
20146
20476
|
dir = parent;
|
|
20147
20477
|
}
|
|
@@ -20209,19 +20539,19 @@ function localUninstallCommand(pm, pkg) {
|
|
|
20209
20539
|
}
|
|
20210
20540
|
|
|
20211
20541
|
// ../argent-installer/src/preflight.ts
|
|
20212
|
-
import * as
|
|
20213
|
-
import * as
|
|
20542
|
+
import * as fs10 from "node:fs";
|
|
20543
|
+
import * as path11 from "node:path";
|
|
20214
20544
|
function hasProjectPackageJson(projectRoot) {
|
|
20215
|
-
return
|
|
20545
|
+
return fs10.existsSync(path11.join(projectRoot, "package.json"));
|
|
20216
20546
|
}
|
|
20217
20547
|
function isYarnPnp(projectRoot) {
|
|
20218
|
-
return
|
|
20548
|
+
return fs10.existsSync(path11.join(projectRoot, ".pnp.cjs")) || fs10.existsSync(path11.join(projectRoot, ".pnp.loader.mjs"));
|
|
20219
20549
|
}
|
|
20220
20550
|
|
|
20221
20551
|
// ../argent-installer/src/topology.ts
|
|
20222
20552
|
var import_semver = __toESM(require_semver2(), 1);
|
|
20223
|
-
import * as
|
|
20224
|
-
import * as
|
|
20553
|
+
import * as fs11 from "node:fs";
|
|
20554
|
+
import * as path12 from "node:path";
|
|
20225
20555
|
import { createRequire } from "node:module";
|
|
20226
20556
|
import { execSync } from "node:child_process";
|
|
20227
20557
|
var TEMP_RUNNER_MARKERS = [
|
|
@@ -20253,9 +20583,9 @@ function getGloballyInstalledPackageRoot() {
|
|
|
20253
20583
|
const binaryPath = getGlobalBinaryPath();
|
|
20254
20584
|
if (!binaryPath) return null;
|
|
20255
20585
|
try {
|
|
20256
|
-
const realPath =
|
|
20257
|
-
const root = resolvePackageRoot(
|
|
20258
|
-
const pkg = JSON.parse(
|
|
20586
|
+
const realPath = fs11.realpathSync(binaryPath);
|
|
20587
|
+
const root = resolvePackageRoot(path12.dirname(realPath));
|
|
20588
|
+
const pkg = JSON.parse(fs11.readFileSync(path12.join(root, "package.json"), "utf8"));
|
|
20259
20589
|
return pkg.name === PACKAGE_NAME ? root : null;
|
|
20260
20590
|
} catch {
|
|
20261
20591
|
return null;
|
|
@@ -20265,7 +20595,7 @@ function getGloballyInstalledVersion() {
|
|
|
20265
20595
|
const pkgRoot = getGloballyInstalledPackageRoot();
|
|
20266
20596
|
if (!pkgRoot) return null;
|
|
20267
20597
|
try {
|
|
20268
|
-
const pkg = JSON.parse(
|
|
20598
|
+
const pkg = JSON.parse(fs11.readFileSync(path12.join(pkgRoot, "package.json"), "utf8"));
|
|
20269
20599
|
return pkg.version ?? null;
|
|
20270
20600
|
} catch {
|
|
20271
20601
|
return null;
|
|
@@ -20274,7 +20604,7 @@ function getGloballyInstalledVersion() {
|
|
|
20274
20604
|
function readManifestDeclaration(projectRoot) {
|
|
20275
20605
|
try {
|
|
20276
20606
|
const pkg = JSON.parse(
|
|
20277
|
-
|
|
20607
|
+
fs11.readFileSync(path12.join(projectRoot, "package.json"), "utf8")
|
|
20278
20608
|
);
|
|
20279
20609
|
const spec = pkg.devDependencies?.[PACKAGE_NAME] ?? pkg.dependencies?.[PACKAGE_NAME] ?? pkg.optionalDependencies?.[PACKAGE_NAME];
|
|
20280
20610
|
return typeof spec === "string" ? spec : null;
|
|
@@ -20287,11 +20617,11 @@ function isDeclaredLocally(projectRoot) {
|
|
|
20287
20617
|
}
|
|
20288
20618
|
function resolveLocalArgentDir(projectRoot) {
|
|
20289
20619
|
try {
|
|
20290
|
-
const req = createRequire(
|
|
20291
|
-
return
|
|
20620
|
+
const req = createRequire(path12.join(projectRoot, "package.json"));
|
|
20621
|
+
return path12.dirname(req.resolve(`${PACKAGE_NAME}/package.json`));
|
|
20292
20622
|
} catch {
|
|
20293
|
-
const plain =
|
|
20294
|
-
return
|
|
20623
|
+
const plain = path12.join(projectRoot, "node_modules", PACKAGE_NAME);
|
|
20624
|
+
return fs11.existsSync(path12.join(plain, "package.json")) ? plain : null;
|
|
20295
20625
|
}
|
|
20296
20626
|
}
|
|
20297
20627
|
function probeLocalInstall(projectRoot) {
|
|
@@ -20299,7 +20629,7 @@ function probeLocalInstall(projectRoot) {
|
|
|
20299
20629
|
if (packageDir) {
|
|
20300
20630
|
let version2;
|
|
20301
20631
|
try {
|
|
20302
|
-
const pkg = JSON.parse(
|
|
20632
|
+
const pkg = JSON.parse(fs11.readFileSync(path12.join(packageDir, "package.json"), "utf8"));
|
|
20303
20633
|
version2 = pkg.version ?? null;
|
|
20304
20634
|
} catch {
|
|
20305
20635
|
version2 = null;
|
|
@@ -20322,8 +20652,8 @@ function getLocallyInstalledVersion(projectRoot) {
|
|
|
20322
20652
|
}
|
|
20323
20653
|
function readLocalPackageVersionUncached(projectRoot) {
|
|
20324
20654
|
try {
|
|
20325
|
-
const pkgPath =
|
|
20326
|
-
const pkg = JSON.parse(
|
|
20655
|
+
const pkgPath = path12.join(projectRoot, "node_modules", PACKAGE_NAME, "package.json");
|
|
20656
|
+
const pkg = JSON.parse(fs11.readFileSync(pkgPath, "utf8"));
|
|
20327
20657
|
return pkg.version ?? null;
|
|
20328
20658
|
} catch {
|
|
20329
20659
|
return null;
|
|
@@ -20334,7 +20664,7 @@ function getLocalArgentBinRelPath(projectRoot) {
|
|
|
20334
20664
|
if (!pkgDir) return null;
|
|
20335
20665
|
let binSub;
|
|
20336
20666
|
try {
|
|
20337
|
-
const pkg = JSON.parse(
|
|
20667
|
+
const pkg = JSON.parse(fs11.readFileSync(path12.join(pkgDir, "package.json"), "utf8"));
|
|
20338
20668
|
if (typeof pkg.bin === "string") binSub = pkg.bin;
|
|
20339
20669
|
else if (pkg.bin && typeof pkg.bin === "object")
|
|
20340
20670
|
binSub = pkg.bin[MCP_BINARY_NAME] ?? Object.values(pkg.bin)[0];
|
|
@@ -20344,28 +20674,28 @@ function getLocalArgentBinRelPath(projectRoot) {
|
|
|
20344
20674
|
if (!binSub) return null;
|
|
20345
20675
|
let root = projectRoot;
|
|
20346
20676
|
try {
|
|
20347
|
-
root =
|
|
20677
|
+
root = fs11.realpathSync(projectRoot);
|
|
20348
20678
|
} catch {
|
|
20349
20679
|
}
|
|
20350
|
-
const stableRel =
|
|
20351
|
-
if (
|
|
20352
|
-
return stableRel.split(
|
|
20680
|
+
const stableRel = path12.join("node_modules", PACKAGE_NAME, binSub);
|
|
20681
|
+
if (fs11.existsSync(path12.join(root, stableRel))) {
|
|
20682
|
+
return stableRel.split(path12.sep).join("/");
|
|
20353
20683
|
}
|
|
20354
|
-
const abs =
|
|
20355
|
-
if (!
|
|
20356
|
-
return
|
|
20684
|
+
const abs = path12.join(pkgDir, binSub);
|
|
20685
|
+
if (!fs11.existsSync(abs)) return null;
|
|
20686
|
+
return path12.relative(root, abs).split(path12.sep).join("/");
|
|
20357
20687
|
}
|
|
20358
20688
|
|
|
20359
20689
|
// ../argent-installer/src/install-record.ts
|
|
20360
|
-
import * as
|
|
20361
|
-
import * as
|
|
20690
|
+
import * as fs12 from "node:fs";
|
|
20691
|
+
import * as path13 from "node:path";
|
|
20362
20692
|
function getInstallRecordPath(projectRoot) {
|
|
20363
|
-
return
|
|
20693
|
+
return path13.join(projectRoot, ".argent", "install.json");
|
|
20364
20694
|
}
|
|
20365
20695
|
function readInstallRecord(projectRoot) {
|
|
20366
20696
|
try {
|
|
20367
20697
|
const parsed = JSON.parse(
|
|
20368
|
-
|
|
20698
|
+
fs12.readFileSync(getInstallRecordPath(projectRoot), "utf8")
|
|
20369
20699
|
);
|
|
20370
20700
|
if (parsed && (parsed.mode === "local" || parsed.mode === "global")) return parsed;
|
|
20371
20701
|
return null;
|
|
@@ -20375,17 +20705,17 @@ function readInstallRecord(projectRoot) {
|
|
|
20375
20705
|
}
|
|
20376
20706
|
function writeInstallRecord(projectRoot, record) {
|
|
20377
20707
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20378
|
-
|
|
20379
|
-
|
|
20708
|
+
fs12.mkdirSync(path13.dirname(recordPath), { recursive: true });
|
|
20709
|
+
fs12.writeFileSync(recordPath, JSON.stringify(record, null, 2) + "\n");
|
|
20380
20710
|
}
|
|
20381
20711
|
function removeInstallRecord(projectRoot) {
|
|
20382
20712
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20383
20713
|
try {
|
|
20384
|
-
if (!
|
|
20385
|
-
|
|
20386
|
-
const dir =
|
|
20714
|
+
if (!fs12.existsSync(recordPath)) return false;
|
|
20715
|
+
fs12.rmSync(recordPath, { force: true });
|
|
20716
|
+
const dir = path13.dirname(recordPath);
|
|
20387
20717
|
try {
|
|
20388
|
-
if (
|
|
20718
|
+
if (fs12.existsSync(dir) && fs12.readdirSync(dir).length === 0) fs12.rmdirSync(dir);
|
|
20389
20719
|
} catch {
|
|
20390
20720
|
}
|
|
20391
20721
|
return true;
|
|
@@ -20459,9 +20789,9 @@ async function promptInstallTargets(verb) {
|
|
|
20459
20789
|
// ../argent-installer/src/utils.ts
|
|
20460
20790
|
var PACKAGE_ROOT = resolvePackageRoot(import.meta.dirname);
|
|
20461
20791
|
function resolveBundledDir(dirName) {
|
|
20462
|
-
const packagedDir =
|
|
20463
|
-
if (
|
|
20464
|
-
return
|
|
20792
|
+
const packagedDir = path14.join(PACKAGE_ROOT, dirName);
|
|
20793
|
+
if (fs13.existsSync(packagedDir)) return packagedDir;
|
|
20794
|
+
return path14.resolve(PACKAGE_ROOT, "..", "skills", dirName);
|
|
20465
20795
|
}
|
|
20466
20796
|
var SKILLS_DIR = resolveBundledDir("skills");
|
|
20467
20797
|
var RULES_DIR = resolveBundledDir("rules");
|
|
@@ -20473,23 +20803,23 @@ function buildArgentSkillsSource(version2) {
|
|
|
20473
20803
|
}
|
|
20474
20804
|
function listBundledSkills(skillsDir = SKILLS_DIR) {
|
|
20475
20805
|
try {
|
|
20476
|
-
return
|
|
20806
|
+
return fs13.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => fs13.existsSync(path14.join(skillsDir, name, "SKILL.md"))).sort();
|
|
20477
20807
|
} catch {
|
|
20478
20808
|
return [];
|
|
20479
20809
|
}
|
|
20480
20810
|
}
|
|
20481
20811
|
function getProjectSkillLockPath(cwd = process.cwd()) {
|
|
20482
|
-
return
|
|
20812
|
+
return path14.join(cwd, "skills-lock.json");
|
|
20483
20813
|
}
|
|
20484
20814
|
function getGlobalSkillLockPath() {
|
|
20485
20815
|
const xdgStateHome = process.env.XDG_STATE_HOME;
|
|
20486
|
-
if (xdgStateHome) return
|
|
20487
|
-
return
|
|
20816
|
+
if (xdgStateHome) return path14.join(xdgStateHome, "skills", ".skill-lock.json");
|
|
20817
|
+
return path14.join(os2.homedir(), ".agents", ".skill-lock.json");
|
|
20488
20818
|
}
|
|
20489
20819
|
var ARGENT_SKILL_PREFIX = "argent-";
|
|
20490
20820
|
function listArgentSkillsInLock(lockPath) {
|
|
20491
20821
|
try {
|
|
20492
|
-
const raw =
|
|
20822
|
+
const raw = fs13.readFileSync(lockPath, "utf8");
|
|
20493
20823
|
const lock = JSON.parse(raw);
|
|
20494
20824
|
const tracked = lock.skills ?? {};
|
|
20495
20825
|
return Object.keys(tracked).filter((name) => name.startsWith(ARGENT_SKILL_PREFIX)).sort();
|
|
@@ -20513,16 +20843,16 @@ var PROJECT_ROOT_MARKERS = [
|
|
|
20513
20843
|
"skills-lock.json"
|
|
20514
20844
|
];
|
|
20515
20845
|
function resolveProjectRoot2(startDir) {
|
|
20516
|
-
const initialDir =
|
|
20846
|
+
const initialDir = path14.resolve(startDir);
|
|
20517
20847
|
let currentDir = initialDir;
|
|
20518
20848
|
while (true) {
|
|
20519
|
-
if (PROJECT_ROOT_MARKERS.some((marker) =>
|
|
20849
|
+
if (PROJECT_ROOT_MARKERS.some((marker) => fs13.existsSync(path14.join(currentDir, marker)))) {
|
|
20520
20850
|
return currentDir;
|
|
20521
20851
|
}
|
|
20522
|
-
if (
|
|
20852
|
+
if (fs13.existsSync(path14.join(currentDir, ".git"))) {
|
|
20523
20853
|
return currentDir;
|
|
20524
20854
|
}
|
|
20525
|
-
const parentDir =
|
|
20855
|
+
const parentDir = path14.dirname(currentDir);
|
|
20526
20856
|
if (parentDir === currentDir) {
|
|
20527
20857
|
return initialDir;
|
|
20528
20858
|
}
|
|
@@ -20530,20 +20860,20 @@ function resolveProjectRoot2(startDir) {
|
|
|
20530
20860
|
}
|
|
20531
20861
|
}
|
|
20532
20862
|
function readToml(filePath) {
|
|
20533
|
-
if (!
|
|
20863
|
+
if (!fs13.existsSync(filePath)) return {};
|
|
20534
20864
|
try {
|
|
20535
|
-
return parse(
|
|
20865
|
+
return parse(fs13.readFileSync(filePath, "utf8"));
|
|
20536
20866
|
} catch {
|
|
20537
20867
|
return {};
|
|
20538
20868
|
}
|
|
20539
20869
|
}
|
|
20540
20870
|
function writeToml(filePath, data) {
|
|
20541
|
-
|
|
20542
|
-
|
|
20871
|
+
fs13.mkdirSync(path14.dirname(filePath), { recursive: true });
|
|
20872
|
+
fs13.writeFileSync(filePath, stringify(data) + "\n");
|
|
20543
20873
|
}
|
|
20544
20874
|
function readYaml(filePath) {
|
|
20545
|
-
if (!
|
|
20546
|
-
const text2 =
|
|
20875
|
+
if (!fs13.existsSync(filePath)) return new import_yaml.Document({});
|
|
20876
|
+
const text2 = fs13.readFileSync(filePath, "utf8");
|
|
20547
20877
|
const doc = (0, import_yaml.parseDocument)(text2);
|
|
20548
20878
|
if (doc.errors.length > 0) {
|
|
20549
20879
|
const messages = doc.errors.map((e) => e.message).join("; ");
|
|
@@ -20552,20 +20882,20 @@ function readYaml(filePath) {
|
|
|
20552
20882
|
return doc;
|
|
20553
20883
|
}
|
|
20554
20884
|
function writeYaml(filePath, doc) {
|
|
20555
|
-
|
|
20556
|
-
|
|
20885
|
+
fs13.mkdirSync(path14.dirname(filePath), { recursive: true });
|
|
20886
|
+
fs13.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
|
|
20557
20887
|
}
|
|
20558
20888
|
function readJson(filePath) {
|
|
20559
|
-
if (!
|
|
20889
|
+
if (!fs13.existsSync(filePath)) return {};
|
|
20560
20890
|
try {
|
|
20561
|
-
return JSON.parse(
|
|
20891
|
+
return JSON.parse(fs13.readFileSync(filePath, "utf8"));
|
|
20562
20892
|
} catch {
|
|
20563
20893
|
return {};
|
|
20564
20894
|
}
|
|
20565
20895
|
}
|
|
20566
20896
|
function writeJson(filePath, data) {
|
|
20567
|
-
|
|
20568
|
-
|
|
20897
|
+
fs13.mkdirSync(path14.dirname(filePath), { recursive: true });
|
|
20898
|
+
fs13.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
|
|
20569
20899
|
}
|
|
20570
20900
|
var JSONC_FORMATTING = { tabSize: 2, insertSpaces: true };
|
|
20571
20901
|
function setJsoncIn(text2, jsonPath, value) {
|
|
@@ -20573,8 +20903,8 @@ function setJsoncIn(text2, jsonPath, value) {
|
|
|
20573
20903
|
return applyEdits(text2, edits);
|
|
20574
20904
|
}
|
|
20575
20905
|
function readJsoncFileRaw(filePath) {
|
|
20576
|
-
if (!
|
|
20577
|
-
let text2 =
|
|
20906
|
+
if (!fs13.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
|
|
20907
|
+
let text2 = fs13.readFileSync(filePath, "utf8");
|
|
20578
20908
|
const hadBom = text2.charCodeAt(0) === 65279;
|
|
20579
20909
|
if (hadBom) text2 = text2.slice(1);
|
|
20580
20910
|
const wasEmpty = text2.trim() === "";
|
|
@@ -20594,16 +20924,16 @@ function isEmptyPlainObject(value) {
|
|
|
20594
20924
|
}
|
|
20595
20925
|
function rmEmptyDir(dirPath) {
|
|
20596
20926
|
try {
|
|
20597
|
-
if (!
|
|
20598
|
-
if (!
|
|
20599
|
-
if (
|
|
20600
|
-
|
|
20927
|
+
if (!fs13.existsSync(dirPath)) return;
|
|
20928
|
+
if (!fs13.statSync(dirPath).isDirectory()) return;
|
|
20929
|
+
if (fs13.readdirSync(dirPath).length > 0) return;
|
|
20930
|
+
fs13.rmdirSync(dirPath);
|
|
20601
20931
|
} catch {
|
|
20602
20932
|
}
|
|
20603
20933
|
}
|
|
20604
20934
|
function readJsonc(filePath) {
|
|
20605
|
-
if (!
|
|
20606
|
-
let raw =
|
|
20935
|
+
if (!fs13.existsSync(filePath)) return {};
|
|
20936
|
+
let raw = fs13.readFileSync(filePath, "utf8");
|
|
20607
20937
|
if (raw.charCodeAt(0) === 65279) raw = raw.slice(1);
|
|
20608
20938
|
if (raw.trim() === "") return {};
|
|
20609
20939
|
const parsed = parse3(raw, [], { allowTrailingComma: true });
|
|
@@ -20622,25 +20952,67 @@ function editJsoncFile(filePath, jsonPath, value) {
|
|
|
20622
20952
|
}
|
|
20623
20953
|
const parsed = parse3(text2, [], { allowTrailingComma: true });
|
|
20624
20954
|
if (isEmptyPlainObject(parsed)) {
|
|
20625
|
-
|
|
20626
|
-
rmEmptyDir(
|
|
20955
|
+
fs13.rmSync(filePath, { force: true });
|
|
20956
|
+
rmEmptyDir(path14.dirname(filePath));
|
|
20627
20957
|
return;
|
|
20628
20958
|
}
|
|
20629
|
-
|
|
20959
|
+
fs13.mkdirSync(path14.dirname(filePath), { recursive: true });
|
|
20630
20960
|
const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
|
|
20631
|
-
|
|
20961
|
+
fs13.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
|
|
20962
|
+
}
|
|
20963
|
+
var MAX_SYMLINK_HOPS = 40;
|
|
20964
|
+
function realpathOrSelf(p) {
|
|
20965
|
+
try {
|
|
20966
|
+
return fs13.realpathSync(p);
|
|
20967
|
+
} catch {
|
|
20968
|
+
return p;
|
|
20969
|
+
}
|
|
20970
|
+
}
|
|
20971
|
+
function resolveLinkedDestination(dest) {
|
|
20972
|
+
let current = dest;
|
|
20973
|
+
for (let hop = 0; hop < MAX_SYMLINK_HOPS; hop++) {
|
|
20974
|
+
let entry;
|
|
20975
|
+
try {
|
|
20976
|
+
entry = fs13.lstatSync(current);
|
|
20977
|
+
} catch {
|
|
20978
|
+
return current === dest || dirExists(path14.dirname(current)) ? current : dest;
|
|
20979
|
+
}
|
|
20980
|
+
if (!entry.isSymbolicLink()) return current;
|
|
20981
|
+
try {
|
|
20982
|
+
current = path14.resolve(realpathOrSelf(path14.dirname(current)), fs13.readlinkSync(current));
|
|
20983
|
+
} catch {
|
|
20984
|
+
return dest;
|
|
20985
|
+
}
|
|
20986
|
+
}
|
|
20987
|
+
return dest;
|
|
20988
|
+
}
|
|
20989
|
+
function copyDir(src, dest) {
|
|
20990
|
+
if (!fs13.existsSync(src)) return null;
|
|
20991
|
+
const target = resolveLinkedDestination(dest);
|
|
20992
|
+
copyTree(src, target);
|
|
20993
|
+
return target;
|
|
20994
|
+
}
|
|
20995
|
+
function copyTree(src, dest) {
|
|
20996
|
+
const entries = fs13.readdirSync(src, { withFileTypes: true });
|
|
20997
|
+
fs13.mkdirSync(dest, { recursive: true });
|
|
20998
|
+
for (const entry of entries) {
|
|
20999
|
+
const from = path14.join(src, entry.name);
|
|
21000
|
+
const to = resolveLinkedDestination(path14.join(dest, entry.name));
|
|
21001
|
+
if (entry.isDirectory()) copyTree(from, to);
|
|
21002
|
+
else fs13.copyFileSync(from, to);
|
|
21003
|
+
}
|
|
20632
21004
|
}
|
|
20633
21005
|
function dirExists(p) {
|
|
20634
21006
|
try {
|
|
20635
|
-
return
|
|
21007
|
+
return fs13.statSync(p).isDirectory();
|
|
20636
21008
|
} catch {
|
|
20637
21009
|
return false;
|
|
20638
21010
|
}
|
|
20639
21011
|
}
|
|
20640
21012
|
function getInstalledVersion() {
|
|
20641
21013
|
try {
|
|
20642
|
-
const pkgPath =
|
|
20643
|
-
const pkg = JSON.parse(
|
|
21014
|
+
const pkgPath = path14.join(PACKAGE_ROOT, "package.json");
|
|
21015
|
+
const pkg = JSON.parse(fs13.readFileSync(pkgPath, "utf8"));
|
|
20644
21016
|
return pkg.version ?? null;
|
|
20645
21017
|
} catch {
|
|
20646
21018
|
return null;
|
|
@@ -20679,12 +21051,12 @@ async function isOnline(timeoutMs = PROBE_TIMEOUT_MS) {
|
|
|
20679
21051
|
} catch {
|
|
20680
21052
|
return false;
|
|
20681
21053
|
}
|
|
20682
|
-
return new Promise((
|
|
20683
|
-
const timer = setTimeout(() =>
|
|
21054
|
+
return new Promise((resolve13) => {
|
|
21055
|
+
const timer = setTimeout(() => resolve13(false), timeoutMs);
|
|
20684
21056
|
timer.unref();
|
|
20685
21057
|
dns.lookup(host, (err) => {
|
|
20686
21058
|
clearTimeout(timer);
|
|
20687
|
-
|
|
21059
|
+
resolve13(!err);
|
|
20688
21060
|
});
|
|
20689
21061
|
});
|
|
20690
21062
|
}
|
|
@@ -20701,7 +21073,7 @@ function escapeStringRegexp(string) {
|
|
|
20701
21073
|
}
|
|
20702
21074
|
|
|
20703
21075
|
// ../argent-installer/src/mcp-configs.ts
|
|
20704
|
-
var TOOL_SERVER_BUNDLE =
|
|
21076
|
+
var TOOL_SERVER_BUNDLE = path15.join(import.meta.dirname, "tool-server.cjs");
|
|
20705
21077
|
function getAvailableToolIds() {
|
|
20706
21078
|
const out = execFileSync2("node", [TOOL_SERVER_BUNDLE, "-t"], { encoding: "utf8" });
|
|
20707
21079
|
const tools = JSON.parse(out);
|
|
@@ -20740,10 +21112,10 @@ function hasCustomizingEnv(entry) {
|
|
|
20740
21112
|
}
|
|
20741
21113
|
function removeDirIfEmpty(dirPath) {
|
|
20742
21114
|
try {
|
|
20743
|
-
if (!
|
|
20744
|
-
if (!
|
|
20745
|
-
if (
|
|
20746
|
-
|
|
21115
|
+
if (!fs14.existsSync(dirPath)) return;
|
|
21116
|
+
if (!fs14.statSync(dirPath).isDirectory()) return;
|
|
21117
|
+
if (fs14.readdirSync(dirPath).length > 0) return;
|
|
21118
|
+
fs14.rmdirSync(dirPath);
|
|
20747
21119
|
} catch {
|
|
20748
21120
|
}
|
|
20749
21121
|
}
|
|
@@ -20780,7 +21152,7 @@ function isArgentManagedEntry(entry) {
|
|
|
20780
21152
|
return args.length === 1 && args[0] === "mcp";
|
|
20781
21153
|
case "node": {
|
|
20782
21154
|
if (args.length !== 2 || args[1] !== "mcp" || !args[0]) return false;
|
|
20783
|
-
if (
|
|
21155
|
+
if (path15.isAbsolute(args[0])) return false;
|
|
20784
21156
|
const normalized = args[0].split("\\").join("/");
|
|
20785
21157
|
return normalized.includes(`node_modules/${PACKAGE_NAME}/`);
|
|
20786
21158
|
}
|
|
@@ -20794,8 +21166,8 @@ function isArgentManagedEntry(entry) {
|
|
|
20794
21166
|
}
|
|
20795
21167
|
function writeTomlOrRemove(filePath, data) {
|
|
20796
21168
|
if (Object.keys(data).length === 0) {
|
|
20797
|
-
|
|
20798
|
-
removeDirIfEmpty(
|
|
21169
|
+
fs14.rmSync(filePath, { force: true });
|
|
21170
|
+
removeDirIfEmpty(path15.dirname(filePath));
|
|
20799
21171
|
return;
|
|
20800
21172
|
}
|
|
20801
21173
|
writeToml(filePath, data);
|
|
@@ -20804,12 +21176,12 @@ function dirHasEditorEvidence(dir, looksArgentOnly) {
|
|
|
20804
21176
|
return dirExists(dir) && !looksArgentOnly(dir);
|
|
20805
21177
|
}
|
|
20806
21178
|
function fileHasEditorEvidence(filePath, looksArgentOnly) {
|
|
20807
|
-
return
|
|
21179
|
+
return fs14.existsSync(filePath) && !looksArgentOnly(filePath);
|
|
20808
21180
|
}
|
|
20809
21181
|
function parseJsoncStrict(filePath) {
|
|
20810
21182
|
let raw;
|
|
20811
21183
|
try {
|
|
20812
|
-
raw =
|
|
21184
|
+
raw = fs14.readFileSync(filePath, "utf8");
|
|
20813
21185
|
} catch {
|
|
20814
21186
|
return null;
|
|
20815
21187
|
}
|
|
@@ -20822,14 +21194,14 @@ function parseJsoncStrict(filePath) {
|
|
|
20822
21194
|
}
|
|
20823
21195
|
function parseTomlStrict(filePath) {
|
|
20824
21196
|
try {
|
|
20825
|
-
return parse(
|
|
21197
|
+
return parse(fs14.readFileSync(filePath, "utf8"));
|
|
20826
21198
|
} catch {
|
|
20827
21199
|
return null;
|
|
20828
21200
|
}
|
|
20829
21201
|
}
|
|
20830
21202
|
function parseYamlStrict(filePath) {
|
|
20831
21203
|
try {
|
|
20832
|
-
const parsed = (0, import_yaml2.parse)(
|
|
21204
|
+
const parsed = (0, import_yaml2.parse)(fs14.readFileSync(filePath, "utf8"));
|
|
20833
21205
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
20834
21206
|
return parsed;
|
|
20835
21207
|
} catch {
|
|
@@ -20852,7 +21224,7 @@ function bundledManagedNames(kind) {
|
|
|
20852
21224
|
if (cached2) return cached2;
|
|
20853
21225
|
let names;
|
|
20854
21226
|
try {
|
|
20855
|
-
names = new Set(
|
|
21227
|
+
names = new Set(fs14.readdirSync(kind === "rules" ? RULES_DIR : AGENTS_DIR));
|
|
20856
21228
|
} catch {
|
|
20857
21229
|
names = /* @__PURE__ */ new Set();
|
|
20858
21230
|
}
|
|
@@ -20862,7 +21234,7 @@ function bundledManagedNames(kind) {
|
|
|
20862
21234
|
function managedDirLooksArgentOnly(dir, kind) {
|
|
20863
21235
|
let entries;
|
|
20864
21236
|
try {
|
|
20865
|
-
entries =
|
|
21237
|
+
entries = fs14.readdirSync(dir);
|
|
20866
21238
|
} catch {
|
|
20867
21239
|
return false;
|
|
20868
21240
|
}
|
|
@@ -20874,13 +21246,13 @@ function managedDirLooksArgentOnly(dir, kind) {
|
|
|
20874
21246
|
function cursorDirLooksArgentOnly(dir) {
|
|
20875
21247
|
let entries;
|
|
20876
21248
|
try {
|
|
20877
|
-
entries =
|
|
21249
|
+
entries = fs14.readdirSync(dir);
|
|
20878
21250
|
} catch {
|
|
20879
21251
|
return false;
|
|
20880
21252
|
}
|
|
20881
21253
|
if (entries.length === 0) return false;
|
|
20882
21254
|
return entries.every((entry) => {
|
|
20883
|
-
const full =
|
|
21255
|
+
const full = path15.join(dir, entry);
|
|
20884
21256
|
if (entry === "mcp.json") {
|
|
20885
21257
|
return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
20886
21258
|
}
|
|
@@ -20913,13 +21285,13 @@ function claudeSettingsLooksArgentOnly(filePath) {
|
|
|
20913
21285
|
function claudeDirLooksArgentOnly(dir) {
|
|
20914
21286
|
let entries;
|
|
20915
21287
|
try {
|
|
20916
|
-
entries =
|
|
21288
|
+
entries = fs14.readdirSync(dir);
|
|
20917
21289
|
} catch {
|
|
20918
21290
|
return false;
|
|
20919
21291
|
}
|
|
20920
21292
|
if (entries.length === 0) return false;
|
|
20921
21293
|
return entries.every((entry) => {
|
|
20922
|
-
const full =
|
|
21294
|
+
const full = path15.join(dir, entry);
|
|
20923
21295
|
if (entry === "settings.json") return claudeSettingsLooksArgentOnly(full);
|
|
20924
21296
|
if (entry === "rules" || entry === "agents" || entry === "skills") {
|
|
20925
21297
|
return managedDirLooksArgentOnly(full, entry);
|
|
@@ -20930,25 +21302,25 @@ function claudeDirLooksArgentOnly(dir) {
|
|
|
20930
21302
|
function vscodeDirLooksArgentOnly(dir) {
|
|
20931
21303
|
let entries;
|
|
20932
21304
|
try {
|
|
20933
|
-
entries =
|
|
21305
|
+
entries = fs14.readdirSync(dir);
|
|
20934
21306
|
} catch {
|
|
20935
21307
|
return false;
|
|
20936
21308
|
}
|
|
20937
21309
|
if (entries.length === 0) return false;
|
|
20938
21310
|
return entries.every(
|
|
20939
|
-
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(
|
|
21311
|
+
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(path15.join(dir, entry), "servers")
|
|
20940
21312
|
);
|
|
20941
21313
|
}
|
|
20942
21314
|
function windsurfDirLooksArgentOnly(dir) {
|
|
20943
21315
|
let entries;
|
|
20944
21316
|
try {
|
|
20945
|
-
entries =
|
|
21317
|
+
entries = fs14.readdirSync(dir);
|
|
20946
21318
|
} catch {
|
|
20947
21319
|
return false;
|
|
20948
21320
|
}
|
|
20949
21321
|
if (entries.length === 0) return false;
|
|
20950
21322
|
return entries.every(
|
|
20951
|
-
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(
|
|
21323
|
+
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(path15.join(dir, entry), "mcpServers")
|
|
20952
21324
|
);
|
|
20953
21325
|
}
|
|
20954
21326
|
function zedSettingsLooksArgentOnly(filePath) {
|
|
@@ -20979,25 +21351,25 @@ function zedSettingsLooksArgentOnly(filePath) {
|
|
|
20979
21351
|
function zedDirLooksArgentOnly(dir) {
|
|
20980
21352
|
let entries;
|
|
20981
21353
|
try {
|
|
20982
|
-
entries =
|
|
21354
|
+
entries = fs14.readdirSync(dir);
|
|
20983
21355
|
} catch {
|
|
20984
21356
|
return false;
|
|
20985
21357
|
}
|
|
20986
21358
|
if (entries.length === 0) return false;
|
|
20987
21359
|
return entries.every(
|
|
20988
|
-
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(
|
|
21360
|
+
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(path15.join(dir, entry))
|
|
20989
21361
|
);
|
|
20990
21362
|
}
|
|
20991
21363
|
function geminiDirLooksArgentOnly(dir) {
|
|
20992
21364
|
let entries;
|
|
20993
21365
|
try {
|
|
20994
|
-
entries =
|
|
21366
|
+
entries = fs14.readdirSync(dir);
|
|
20995
21367
|
} catch {
|
|
20996
21368
|
return false;
|
|
20997
21369
|
}
|
|
20998
21370
|
if (entries.length === 0) return false;
|
|
20999
21371
|
return entries.every((entry) => {
|
|
21000
|
-
const full =
|
|
21372
|
+
const full = path15.join(dir, entry);
|
|
21001
21373
|
if (entry === "settings.json") return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
21002
21374
|
if (entry === "rules" || entry === "agents") return managedDirLooksArgentOnly(full, entry);
|
|
21003
21375
|
return false;
|
|
@@ -21016,48 +21388,48 @@ function hermesConfigLooksArgentOnly(filePath) {
|
|
|
21016
21388
|
function hermesDirLooksArgentOnly(dir) {
|
|
21017
21389
|
let entries;
|
|
21018
21390
|
try {
|
|
21019
|
-
entries =
|
|
21391
|
+
entries = fs14.readdirSync(dir);
|
|
21020
21392
|
} catch {
|
|
21021
21393
|
return false;
|
|
21022
21394
|
}
|
|
21023
21395
|
if (entries.length === 0) return false;
|
|
21024
21396
|
return entries.every(
|
|
21025
|
-
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(
|
|
21397
|
+
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(path15.join(dir, entry))
|
|
21026
21398
|
);
|
|
21027
21399
|
}
|
|
21028
21400
|
function kiroDirLooksArgentOnly(dir) {
|
|
21029
21401
|
let entries;
|
|
21030
21402
|
try {
|
|
21031
|
-
entries =
|
|
21403
|
+
entries = fs14.readdirSync(dir);
|
|
21032
21404
|
} catch {
|
|
21033
21405
|
return false;
|
|
21034
21406
|
}
|
|
21035
21407
|
if (entries.length === 0) return false;
|
|
21036
21408
|
return entries.every((entry) => {
|
|
21037
21409
|
if (entry !== "settings") return false;
|
|
21038
|
-
const settingsDir =
|
|
21410
|
+
const settingsDir = path15.join(dir, entry);
|
|
21039
21411
|
let settingsEntries;
|
|
21040
21412
|
try {
|
|
21041
|
-
settingsEntries =
|
|
21413
|
+
settingsEntries = fs14.readdirSync(settingsDir);
|
|
21042
21414
|
} catch {
|
|
21043
21415
|
return false;
|
|
21044
21416
|
}
|
|
21045
21417
|
if (settingsEntries.length === 0) return false;
|
|
21046
21418
|
return settingsEntries.every(
|
|
21047
|
-
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(
|
|
21419
|
+
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(path15.join(settingsDir, name), "mcpServers")
|
|
21048
21420
|
);
|
|
21049
21421
|
});
|
|
21050
21422
|
}
|
|
21051
21423
|
function codexDirLooksArgentOnly(dir) {
|
|
21052
21424
|
let entries;
|
|
21053
21425
|
try {
|
|
21054
|
-
entries =
|
|
21426
|
+
entries = fs14.readdirSync(dir);
|
|
21055
21427
|
} catch {
|
|
21056
21428
|
return false;
|
|
21057
21429
|
}
|
|
21058
21430
|
if (entries.length === 0) return false;
|
|
21059
21431
|
return entries.every((entry) => {
|
|
21060
|
-
const full =
|
|
21432
|
+
const full = path15.join(dir, entry);
|
|
21061
21433
|
if (entry === "config.toml") {
|
|
21062
21434
|
const config = parseTomlStrict(full);
|
|
21063
21435
|
if (config === null) return false;
|
|
@@ -21084,13 +21456,13 @@ function codexDirLooksArgentOnly(dir) {
|
|
|
21084
21456
|
var cursorAdapter = {
|
|
21085
21457
|
name: "Cursor",
|
|
21086
21458
|
detect() {
|
|
21087
|
-
return dirHasEditorEvidence(
|
|
21459
|
+
return dirHasEditorEvidence(path15.join(homedir4(), ".cursor"), cursorDirLooksArgentOnly) || dirHasEditorEvidence(path15.join(process.cwd(), ".cursor"), cursorDirLooksArgentOnly);
|
|
21088
21460
|
},
|
|
21089
21461
|
projectPath(root) {
|
|
21090
|
-
return
|
|
21462
|
+
return path15.join(root, ".cursor", "mcp.json");
|
|
21091
21463
|
},
|
|
21092
21464
|
globalPath() {
|
|
21093
|
-
return
|
|
21465
|
+
return path15.join(homedir4(), ".cursor", "mcp.json");
|
|
21094
21466
|
},
|
|
21095
21467
|
// Cursor is a VS Code fork: .cursor/mcp.json is JSONC (line/block comments,
|
|
21096
21468
|
// trailing commas). Routing write/remove/hasArgentEntry through readJsonc /
|
|
@@ -21106,7 +21478,7 @@ var cursorAdapter = {
|
|
|
21106
21478
|
});
|
|
21107
21479
|
},
|
|
21108
21480
|
remove(configPath) {
|
|
21109
|
-
if (!
|
|
21481
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21110
21482
|
const config = readJsonc(configPath);
|
|
21111
21483
|
const servers = config.mcpServers;
|
|
21112
21484
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21114,7 +21486,7 @@ var cursorAdapter = {
|
|
|
21114
21486
|
return true;
|
|
21115
21487
|
},
|
|
21116
21488
|
getArgentEntry(configPath) {
|
|
21117
|
-
if (!
|
|
21489
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21118
21490
|
const config = readJsonc(configPath);
|
|
21119
21491
|
const servers = config.mcpServers;
|
|
21120
21492
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21131,7 +21503,7 @@ var cursorAdapter = {
|
|
|
21131
21503
|
// because `hasArgentEntry` now reads mcp.json with readJsonc, so `update`
|
|
21132
21504
|
// detects a commented config as configured and calls this.
|
|
21133
21505
|
addAllowlist() {
|
|
21134
|
-
const permPath =
|
|
21506
|
+
const permPath = path15.join(homedir4(), ".cursor", "permissions.json");
|
|
21135
21507
|
const config = readJsonc(permPath);
|
|
21136
21508
|
const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : [];
|
|
21137
21509
|
if (list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
@@ -21139,8 +21511,8 @@ var cursorAdapter = {
|
|
|
21139
21511
|
},
|
|
21140
21512
|
removeAllowlist(_root, scope) {
|
|
21141
21513
|
if (scope !== "global") return;
|
|
21142
|
-
const permPath =
|
|
21143
|
-
if (!
|
|
21514
|
+
const permPath = path15.join(homedir4(), ".cursor", "permissions.json");
|
|
21515
|
+
if (!fs14.existsSync(permPath)) return;
|
|
21144
21516
|
const config = readJsonc(permPath);
|
|
21145
21517
|
const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : void 0;
|
|
21146
21518
|
if (!list || !list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
@@ -21151,16 +21523,16 @@ var cursorAdapter = {
|
|
|
21151
21523
|
function claudeProjectKeysForRoot(projects, root) {
|
|
21152
21524
|
const canonical = (value) => {
|
|
21153
21525
|
try {
|
|
21154
|
-
return
|
|
21526
|
+
return fs14.realpathSync.native(value);
|
|
21155
21527
|
} catch {
|
|
21156
|
-
return
|
|
21528
|
+
return path15.resolve(value);
|
|
21157
21529
|
}
|
|
21158
21530
|
};
|
|
21159
21531
|
const target = canonical(root);
|
|
21160
21532
|
return Object.keys(projects).filter((key) => key === root || canonical(key) === target);
|
|
21161
21533
|
}
|
|
21162
21534
|
function claudeDisabledListFinding(settingsPath, label, projectConfined) {
|
|
21163
|
-
if (!
|
|
21535
|
+
if (!fs14.existsSync(settingsPath)) return null;
|
|
21164
21536
|
const disabled = readJson(settingsPath).disabledMcpjsonServers;
|
|
21165
21537
|
if (!Array.isArray(disabled) || !disabled.includes(MCP_SERVER_KEY)) return null;
|
|
21166
21538
|
return {
|
|
@@ -21189,13 +21561,13 @@ var claudeAdapter = {
|
|
|
21189
21561
|
name: "Claude Code",
|
|
21190
21562
|
detect() {
|
|
21191
21563
|
const mcpJsonArgentOnly = (p) => jsonLooksArgentServerOnly(p, "mcpServers");
|
|
21192
|
-
return fileHasEditorEvidence(
|
|
21564
|
+
return fileHasEditorEvidence(path15.join(process.cwd(), ".mcp.json"), mcpJsonArgentOnly) || fileHasEditorEvidence(path15.join(homedir4(), ".claude.json"), mcpJsonArgentOnly) || dirHasEditorEvidence(path15.join(process.cwd(), ".claude"), claudeDirLooksArgentOnly) || dirHasEditorEvidence(path15.join(homedir4(), ".claude"), claudeDirLooksArgentOnly);
|
|
21193
21565
|
},
|
|
21194
21566
|
projectPath(root) {
|
|
21195
|
-
return
|
|
21567
|
+
return path15.join(root, ".mcp.json");
|
|
21196
21568
|
},
|
|
21197
21569
|
globalPath() {
|
|
21198
|
-
return
|
|
21570
|
+
return path15.join(homedir4(), ".claude.json");
|
|
21199
21571
|
},
|
|
21200
21572
|
// JSONC is a superset of JSON, so routing through readJsonc / editJsoncFile is
|
|
21201
21573
|
// safe for this strict-JSON config and keeps every MCP-entry write on the one
|
|
@@ -21209,7 +21581,7 @@ var claudeAdapter = {
|
|
|
21209
21581
|
});
|
|
21210
21582
|
},
|
|
21211
21583
|
remove(configPath) {
|
|
21212
|
-
if (!
|
|
21584
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21213
21585
|
const config = readJsonc(configPath);
|
|
21214
21586
|
const servers = config.mcpServers;
|
|
21215
21587
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21223,7 +21595,7 @@ var claudeAdapter = {
|
|
|
21223
21595
|
return true;
|
|
21224
21596
|
},
|
|
21225
21597
|
getArgentEntry(configPath) {
|
|
21226
|
-
if (!
|
|
21598
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21227
21599
|
const config = readJsonc(configPath);
|
|
21228
21600
|
const servers = config.mcpServers;
|
|
21229
21601
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21239,7 +21611,7 @@ var claudeAdapter = {
|
|
|
21239
21611
|
// reports recorded .mcp.json rejections (see claudeDisabledListFinding).
|
|
21240
21612
|
findShadowingConfigs(root, writtenScope) {
|
|
21241
21613
|
const findings = [];
|
|
21242
|
-
const claudeJsonPath =
|
|
21614
|
+
const claudeJsonPath = path15.join(homedir4(), ".claude.json");
|
|
21243
21615
|
const projects = readJson(claudeJsonPath).projects;
|
|
21244
21616
|
if (isRecord(projects)) {
|
|
21245
21617
|
for (const key of claudeProjectKeysForRoot(projects, root)) {
|
|
@@ -21276,9 +21648,9 @@ var claudeAdapter = {
|
|
|
21276
21648
|
}
|
|
21277
21649
|
if (writtenScope === "local") {
|
|
21278
21650
|
const candidates = [
|
|
21279
|
-
[
|
|
21280
|
-
[
|
|
21281
|
-
[
|
|
21651
|
+
[path15.join(root, ".claude", "settings.json"), ".claude/settings.json", true],
|
|
21652
|
+
[path15.join(root, ".claude", "settings.local.json"), ".claude/settings.local.json", true],
|
|
21653
|
+
[path15.join(homedir4(), ".claude", "settings.json"), "~/.claude/settings.json", false]
|
|
21282
21654
|
];
|
|
21283
21655
|
for (const [settingsPath, label, projectConfined] of candidates) {
|
|
21284
21656
|
const finding = claudeDisabledListFinding(settingsPath, label, projectConfined);
|
|
@@ -21297,10 +21669,10 @@ var claudeAdapter = {
|
|
|
21297
21669
|
var vscodeAdapter = {
|
|
21298
21670
|
name: "VS Code",
|
|
21299
21671
|
detect() {
|
|
21300
|
-
return dirHasEditorEvidence(
|
|
21672
|
+
return dirHasEditorEvidence(path15.join(process.cwd(), ".vscode"), vscodeDirLooksArgentOnly) || dirExists(path15.join(homedir4(), ".vscode"));
|
|
21301
21673
|
},
|
|
21302
21674
|
projectPath(root) {
|
|
21303
|
-
return
|
|
21675
|
+
return path15.join(root, ".vscode", "mcp.json");
|
|
21304
21676
|
},
|
|
21305
21677
|
globalPath() {
|
|
21306
21678
|
return null;
|
|
@@ -21321,7 +21693,7 @@ var vscodeAdapter = {
|
|
|
21321
21693
|
});
|
|
21322
21694
|
},
|
|
21323
21695
|
remove(configPath) {
|
|
21324
|
-
if (!
|
|
21696
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21325
21697
|
const config = readJsonc(configPath);
|
|
21326
21698
|
const servers = config.servers;
|
|
21327
21699
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21329,7 +21701,7 @@ var vscodeAdapter = {
|
|
|
21329
21701
|
return true;
|
|
21330
21702
|
},
|
|
21331
21703
|
getArgentEntry(configPath) {
|
|
21332
|
-
if (!
|
|
21704
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21333
21705
|
const config = readJsonc(configPath);
|
|
21334
21706
|
const servers = config.servers;
|
|
21335
21707
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21345,7 +21717,7 @@ var vscodeAdapter = {
|
|
|
21345
21717
|
findShadowingConfigs(_root, _writtenScope) {
|
|
21346
21718
|
const findings = [];
|
|
21347
21719
|
for (const userDir of vscodeUserDirs()) {
|
|
21348
|
-
const configPath =
|
|
21720
|
+
const configPath = path15.join(userDir, "mcp.json");
|
|
21349
21721
|
const entry = this.getArgentEntry(configPath);
|
|
21350
21722
|
if (!entry) continue;
|
|
21351
21723
|
findings.push({
|
|
@@ -21362,16 +21734,16 @@ var vscodeAdapter = {
|
|
|
21362
21734
|
function vscodeUserDirs() {
|
|
21363
21735
|
const bases = [];
|
|
21364
21736
|
if (process.platform === "darwin") {
|
|
21365
|
-
bases.push(
|
|
21737
|
+
bases.push(path15.join(homedir4(), "Library", "Application Support"));
|
|
21366
21738
|
} else if (process.platform === "win32") {
|
|
21367
21739
|
if (process.env.APPDATA) bases.push(process.env.APPDATA);
|
|
21368
21740
|
} else {
|
|
21369
|
-
bases.push(
|
|
21741
|
+
bases.push(path15.join(homedir4(), ".config"));
|
|
21370
21742
|
}
|
|
21371
21743
|
const dirs = [];
|
|
21372
21744
|
for (const base of bases) {
|
|
21373
21745
|
for (const product of ["Code", "Code - Insiders"]) {
|
|
21374
|
-
const dir =
|
|
21746
|
+
const dir = path15.join(base, product, "User");
|
|
21375
21747
|
if (dirExists(dir)) dirs.push(dir);
|
|
21376
21748
|
}
|
|
21377
21749
|
}
|
|
@@ -21381,7 +21753,7 @@ var windsurfAdapter = {
|
|
|
21381
21753
|
name: "Windsurf",
|
|
21382
21754
|
detect() {
|
|
21383
21755
|
return dirHasEditorEvidence(
|
|
21384
|
-
|
|
21756
|
+
path15.join(homedir4(), ".codeium", "windsurf"),
|
|
21385
21757
|
windsurfDirLooksArgentOnly
|
|
21386
21758
|
);
|
|
21387
21759
|
},
|
|
@@ -21389,7 +21761,7 @@ var windsurfAdapter = {
|
|
|
21389
21761
|
return null;
|
|
21390
21762
|
},
|
|
21391
21763
|
globalPath() {
|
|
21392
|
-
return
|
|
21764
|
+
return path15.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
|
|
21393
21765
|
},
|
|
21394
21766
|
// JSONC-safe MCP-entry writes (see the Cursor adapter): editJsoncFile
|
|
21395
21767
|
// preserves comments and pre-existing foreign servers on this JSON config.
|
|
@@ -21401,7 +21773,7 @@ var windsurfAdapter = {
|
|
|
21401
21773
|
});
|
|
21402
21774
|
},
|
|
21403
21775
|
remove(configPath) {
|
|
21404
|
-
if (!
|
|
21776
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21405
21777
|
const config = readJsonc(configPath);
|
|
21406
21778
|
const servers = config.mcpServers;
|
|
21407
21779
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21409,7 +21781,7 @@ var windsurfAdapter = {
|
|
|
21409
21781
|
return true;
|
|
21410
21782
|
},
|
|
21411
21783
|
getArgentEntry(configPath) {
|
|
21412
|
-
if (!
|
|
21784
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21413
21785
|
const config = readJsonc(configPath);
|
|
21414
21786
|
const servers = config.mcpServers;
|
|
21415
21787
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21423,7 +21795,7 @@ var windsurfAdapter = {
|
|
|
21423
21795
|
// silently skipped the toggle; editJsoncFile targets just the argent entry's
|
|
21424
21796
|
// alwaysAllow key so comments and foreign servers survive.
|
|
21425
21797
|
addAllowlist() {
|
|
21426
|
-
const configPath =
|
|
21798
|
+
const configPath = path15.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
|
|
21427
21799
|
const config = readJsonc(configPath);
|
|
21428
21800
|
const servers = config.mcpServers;
|
|
21429
21801
|
if (!servers?.[MCP_SERVER_KEY]) return;
|
|
@@ -21431,8 +21803,8 @@ var windsurfAdapter = {
|
|
|
21431
21803
|
},
|
|
21432
21804
|
removeAllowlist(_root, scope) {
|
|
21433
21805
|
if (scope !== "global") return;
|
|
21434
|
-
const configPath =
|
|
21435
|
-
if (!
|
|
21806
|
+
const configPath = path15.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
|
|
21807
|
+
if (!fs14.existsSync(configPath)) return;
|
|
21436
21808
|
const config = readJsonc(configPath);
|
|
21437
21809
|
const servers = config.mcpServers;
|
|
21438
21810
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -21443,13 +21815,13 @@ var windsurfAdapter = {
|
|
|
21443
21815
|
var zedAdapter = {
|
|
21444
21816
|
name: "Zed",
|
|
21445
21817
|
detect() {
|
|
21446
|
-
return dirHasEditorEvidence(
|
|
21818
|
+
return dirHasEditorEvidence(path15.join(homedir4(), ".config", "zed"), zedDirLooksArgentOnly);
|
|
21447
21819
|
},
|
|
21448
21820
|
projectPath(root) {
|
|
21449
|
-
return
|
|
21821
|
+
return path15.join(root, ".zed", "settings.json");
|
|
21450
21822
|
},
|
|
21451
21823
|
globalPath() {
|
|
21452
|
-
return
|
|
21824
|
+
return path15.join(homedir4(), ".config", "zed", "settings.json");
|
|
21453
21825
|
},
|
|
21454
21826
|
// Zed's settings.json is JSONC (line + block comments, trailing commas).
|
|
21455
21827
|
// The previous JSON.parse → mutate → JSON.stringify path silently stripped
|
|
@@ -21465,7 +21837,7 @@ var zedAdapter = {
|
|
|
21465
21837
|
});
|
|
21466
21838
|
},
|
|
21467
21839
|
remove(configPath) {
|
|
21468
|
-
if (!
|
|
21840
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21469
21841
|
const config = readJsonc(configPath);
|
|
21470
21842
|
const servers = config.context_servers;
|
|
21471
21843
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21473,7 +21845,7 @@ var zedAdapter = {
|
|
|
21473
21845
|
return true;
|
|
21474
21846
|
},
|
|
21475
21847
|
getArgentEntry(configPath) {
|
|
21476
|
-
if (!
|
|
21848
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21477
21849
|
const config = readJsonc(configPath);
|
|
21478
21850
|
const servers = config.context_servers;
|
|
21479
21851
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21486,12 +21858,12 @@ var zedAdapter = {
|
|
|
21486
21858
|
// documented opt-in; built-in security rules still protect against
|
|
21487
21859
|
// destructive operations.
|
|
21488
21860
|
addAllowlist(root, scope) {
|
|
21489
|
-
const settingsPath = scope === "global" ?
|
|
21861
|
+
const settingsPath = scope === "global" ? path15.join(homedir4(), ".config", "zed", "settings.json") : path15.join(root, ".zed", "settings.json");
|
|
21490
21862
|
editJsoncFile(settingsPath, ["agent", "tool_permissions", "default"], "allow");
|
|
21491
21863
|
},
|
|
21492
21864
|
removeAllowlist(root, scope) {
|
|
21493
|
-
const settingsPath = scope === "global" ?
|
|
21494
|
-
if (!
|
|
21865
|
+
const settingsPath = scope === "global" ? path15.join(homedir4(), ".config", "zed", "settings.json") : path15.join(root, ".zed", "settings.json");
|
|
21866
|
+
if (!fs14.existsSync(settingsPath)) return;
|
|
21495
21867
|
const config = readJsonc(settingsPath);
|
|
21496
21868
|
const perms = config.agent?.tool_permissions;
|
|
21497
21869
|
if (!perms || perms.default !== "allow") return;
|
|
@@ -21501,13 +21873,13 @@ var zedAdapter = {
|
|
|
21501
21873
|
var geminiAdapter = {
|
|
21502
21874
|
name: "Gemini",
|
|
21503
21875
|
detect() {
|
|
21504
|
-
return dirHasEditorEvidence(
|
|
21876
|
+
return dirHasEditorEvidence(path15.join(homedir4(), ".gemini"), geminiDirLooksArgentOnly) || dirHasEditorEvidence(path15.join(process.cwd(), ".gemini"), geminiDirLooksArgentOnly);
|
|
21505
21877
|
},
|
|
21506
21878
|
projectPath(root) {
|
|
21507
|
-
return
|
|
21879
|
+
return path15.join(root, ".gemini", "settings.json");
|
|
21508
21880
|
},
|
|
21509
21881
|
globalPath() {
|
|
21510
|
-
return
|
|
21882
|
+
return path15.join(homedir4(), ".gemini", "settings.json");
|
|
21511
21883
|
},
|
|
21512
21884
|
// JSONC-safe MCP-entry writes (see the Cursor adapter): editJsoncFile
|
|
21513
21885
|
// preserves comments and pre-existing foreign servers on this JSON config.
|
|
@@ -21519,7 +21891,7 @@ var geminiAdapter = {
|
|
|
21519
21891
|
});
|
|
21520
21892
|
},
|
|
21521
21893
|
remove(configPath) {
|
|
21522
|
-
if (!
|
|
21894
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21523
21895
|
const config = readJsonc(configPath);
|
|
21524
21896
|
const servers = config.mcpServers;
|
|
21525
21897
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21527,7 +21899,7 @@ var geminiAdapter = {
|
|
|
21527
21899
|
return true;
|
|
21528
21900
|
},
|
|
21529
21901
|
getArgentEntry(configPath) {
|
|
21530
|
-
if (!
|
|
21902
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21531
21903
|
const config = readJsonc(configPath);
|
|
21532
21904
|
const servers = config.mcpServers;
|
|
21533
21905
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21552,7 +21924,7 @@ var geminiAdapter = {
|
|
|
21552
21924
|
},
|
|
21553
21925
|
removeAllowlist(root, scope) {
|
|
21554
21926
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21555
|
-
if (!configPath || !
|
|
21927
|
+
if (!configPath || !fs14.existsSync(configPath)) {
|
|
21556
21928
|
return;
|
|
21557
21929
|
}
|
|
21558
21930
|
const config = readJsonc(configPath);
|
|
@@ -21566,13 +21938,13 @@ var CODEX_FILENAME = ".codex";
|
|
|
21566
21938
|
var codexAdapter = {
|
|
21567
21939
|
name: "Codex",
|
|
21568
21940
|
detect() {
|
|
21569
|
-
return dirHasEditorEvidence(
|
|
21941
|
+
return dirHasEditorEvidence(path15.join(homedir4(), CODEX_FILENAME), codexDirLooksArgentOnly) || dirHasEditorEvidence(path15.join(process.cwd(), CODEX_FILENAME), codexDirLooksArgentOnly);
|
|
21570
21942
|
},
|
|
21571
21943
|
projectPath(root) {
|
|
21572
|
-
return
|
|
21944
|
+
return path15.join(root, CODEX_FILENAME, "config.toml");
|
|
21573
21945
|
},
|
|
21574
21946
|
globalPath() {
|
|
21575
|
-
return
|
|
21947
|
+
return path15.join(homedir4(), CODEX_FILENAME, "config.toml");
|
|
21576
21948
|
},
|
|
21577
21949
|
write(configPath, entry) {
|
|
21578
21950
|
const config = readToml(configPath);
|
|
@@ -21586,7 +21958,7 @@ var codexAdapter = {
|
|
|
21586
21958
|
writeToml(configPath, config);
|
|
21587
21959
|
},
|
|
21588
21960
|
remove(configPath) {
|
|
21589
|
-
if (!
|
|
21961
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21590
21962
|
const config = readToml(configPath);
|
|
21591
21963
|
const servers = config.mcp_servers;
|
|
21592
21964
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21596,7 +21968,7 @@ var codexAdapter = {
|
|
|
21596
21968
|
return true;
|
|
21597
21969
|
},
|
|
21598
21970
|
getArgentEntry(configPath) {
|
|
21599
|
-
if (!
|
|
21971
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21600
21972
|
const config = readToml(configPath);
|
|
21601
21973
|
const servers = config.mcp_servers;
|
|
21602
21974
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21644,13 +22016,13 @@ var codexAdapter = {
|
|
|
21644
22016
|
var hermesAdapter = {
|
|
21645
22017
|
name: "Hermes",
|
|
21646
22018
|
detect() {
|
|
21647
|
-
return dirHasEditorEvidence(
|
|
22019
|
+
return dirHasEditorEvidence(path15.join(homedir4(), ".hermes"), hermesDirLooksArgentOnly);
|
|
21648
22020
|
},
|
|
21649
22021
|
projectPath() {
|
|
21650
22022
|
return null;
|
|
21651
22023
|
},
|
|
21652
22024
|
globalPath() {
|
|
21653
|
-
return
|
|
22025
|
+
return path15.join(homedir4(), ".hermes", "config.yaml");
|
|
21654
22026
|
},
|
|
21655
22027
|
write(configPath, entry) {
|
|
21656
22028
|
const doc = readYaml(configPath);
|
|
@@ -21669,7 +22041,7 @@ var hermesAdapter = {
|
|
|
21669
22041
|
writeYaml(configPath, doc);
|
|
21670
22042
|
},
|
|
21671
22043
|
remove(configPath) {
|
|
21672
|
-
if (!
|
|
22044
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21673
22045
|
const doc = readYaml(configPath);
|
|
21674
22046
|
const servers = doc.get("mcp_servers");
|
|
21675
22047
|
if (!(0, import_yaml2.isMap)(servers)) return false;
|
|
@@ -21682,7 +22054,7 @@ var hermesAdapter = {
|
|
|
21682
22054
|
return true;
|
|
21683
22055
|
},
|
|
21684
22056
|
getArgentEntry(configPath) {
|
|
21685
|
-
if (!
|
|
22057
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21686
22058
|
const doc = readYaml(configPath);
|
|
21687
22059
|
const servers = doc.get("mcp_servers");
|
|
21688
22060
|
if (!(0, import_yaml2.isMap)(servers)) return null;
|
|
@@ -21709,10 +22081,10 @@ function hasOpenCodeBinary() {
|
|
|
21709
22081
|
}
|
|
21710
22082
|
function pickOpencodeConfig(dir, candidates) {
|
|
21711
22083
|
for (const name of candidates) {
|
|
21712
|
-
const candidate =
|
|
21713
|
-
if (
|
|
22084
|
+
const candidate = path15.join(dir, name);
|
|
22085
|
+
if (fs14.existsSync(candidate)) return candidate;
|
|
21714
22086
|
}
|
|
21715
|
-
return
|
|
22087
|
+
return path15.join(dir, "opencode.json");
|
|
21716
22088
|
}
|
|
21717
22089
|
var openCodeAdapter = {
|
|
21718
22090
|
name: "opencode",
|
|
@@ -21723,7 +22095,7 @@ var openCodeAdapter = {
|
|
|
21723
22095
|
return pickOpencodeConfig(root, OPENCODE_PROJECT_FILES);
|
|
21724
22096
|
},
|
|
21725
22097
|
globalPath() {
|
|
21726
|
-
return pickOpencodeConfig(
|
|
22098
|
+
return pickOpencodeConfig(path15.join(homedir4(), ".config", "opencode"), OPENCODE_GLOBAL_FILES);
|
|
21727
22099
|
},
|
|
21728
22100
|
write(configPath, entry) {
|
|
21729
22101
|
editJsoncFile(configPath, ["mcp", MCP_SERVER_KEY], {
|
|
@@ -21734,7 +22106,7 @@ var openCodeAdapter = {
|
|
|
21734
22106
|
});
|
|
21735
22107
|
},
|
|
21736
22108
|
remove(configPath) {
|
|
21737
|
-
if (!
|
|
22109
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21738
22110
|
const config = readJsonc(configPath);
|
|
21739
22111
|
const servers = config.mcp;
|
|
21740
22112
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21742,7 +22114,7 @@ var openCodeAdapter = {
|
|
|
21742
22114
|
return true;
|
|
21743
22115
|
},
|
|
21744
22116
|
getArgentEntry(configPath) {
|
|
21745
|
-
if (!
|
|
22117
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21746
22118
|
const config = readJsonc(configPath);
|
|
21747
22119
|
const servers = config.mcp;
|
|
21748
22120
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21757,7 +22129,7 @@ var openCodeAdapter = {
|
|
|
21757
22129
|
},
|
|
21758
22130
|
removeAllowlist(root, scope) {
|
|
21759
22131
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21760
|
-
if (!configPath || !
|
|
22132
|
+
if (!configPath || !fs14.existsSync(configPath)) return;
|
|
21761
22133
|
const config = readJsonc(configPath);
|
|
21762
22134
|
const tools = config.tools;
|
|
21763
22135
|
if (!tools || !(OPENCODE_ALLOWLIST_PATTERN in tools)) return;
|
|
@@ -21768,13 +22140,13 @@ var KIRO_AUTO_APPROVE_ALL = ["*"];
|
|
|
21768
22140
|
var kiroAdapter = {
|
|
21769
22141
|
name: "Kiro",
|
|
21770
22142
|
detect() {
|
|
21771
|
-
return dirHasEditorEvidence(
|
|
22143
|
+
return dirHasEditorEvidence(path15.join(homedir4(), ".kiro"), kiroDirLooksArgentOnly) || dirHasEditorEvidence(path15.join(process.cwd(), ".kiro"), kiroDirLooksArgentOnly);
|
|
21772
22144
|
},
|
|
21773
22145
|
projectPath(root) {
|
|
21774
|
-
return
|
|
22146
|
+
return path15.join(root, ".kiro", "settings", "mcp.json");
|
|
21775
22147
|
},
|
|
21776
22148
|
globalPath() {
|
|
21777
|
-
return
|
|
22149
|
+
return path15.join(homedir4(), ".kiro", "settings", "mcp.json");
|
|
21778
22150
|
},
|
|
21779
22151
|
// Kiro is a VS Code fork: .kiro/settings/mcp.json is JSONC. As with Cursor,
|
|
21780
22152
|
// route write/remove/hasArgentEntry through readJsonc / editJsoncFile so
|
|
@@ -21788,7 +22160,7 @@ var kiroAdapter = {
|
|
|
21788
22160
|
});
|
|
21789
22161
|
},
|
|
21790
22162
|
remove(configPath) {
|
|
21791
|
-
if (!
|
|
22163
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21792
22164
|
const config = readJsonc(configPath);
|
|
21793
22165
|
const servers = config.mcpServers;
|
|
21794
22166
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21796,7 +22168,7 @@ var kiroAdapter = {
|
|
|
21796
22168
|
return true;
|
|
21797
22169
|
},
|
|
21798
22170
|
getArgentEntry(configPath) {
|
|
21799
|
-
if (!
|
|
22171
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21800
22172
|
const config = readJsonc(configPath);
|
|
21801
22173
|
const servers = config.mcpServers;
|
|
21802
22174
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21823,7 +22195,7 @@ var kiroAdapter = {
|
|
|
21823
22195
|
},
|
|
21824
22196
|
removeAllowlist(root, scope) {
|
|
21825
22197
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21826
|
-
if (!configPath || !
|
|
22198
|
+
if (!configPath || !fs14.existsSync(configPath)) return;
|
|
21827
22199
|
const config = readJsonc(configPath);
|
|
21828
22200
|
const servers = config.mcpServers;
|
|
21829
22201
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -21868,7 +22240,7 @@ function findConfiguredAdapterScopes(adapters, projectRoot) {
|
|
|
21868
22240
|
return results;
|
|
21869
22241
|
}
|
|
21870
22242
|
function addClaudePermission(root, scope) {
|
|
21871
|
-
const settingsPath = scope === "global" ?
|
|
22243
|
+
const settingsPath = scope === "global" ? path15.join(homedir4(), ".claude", "settings.json") : path15.join(root, ".claude", "settings.json");
|
|
21872
22244
|
const config = readJsonc(settingsPath);
|
|
21873
22245
|
const permissions = config.permissions ?? {};
|
|
21874
22246
|
const allow = Array.isArray(permissions.allow) ? permissions.allow : [];
|
|
@@ -21876,8 +22248,8 @@ function addClaudePermission(root, scope) {
|
|
|
21876
22248
|
editJsoncFile(settingsPath, ["permissions", "allow"], [...allow, PERMISSION_RULE]);
|
|
21877
22249
|
}
|
|
21878
22250
|
function removeClaudePermission(root, scope) {
|
|
21879
|
-
const settingsPath = scope === "global" ?
|
|
21880
|
-
if (!
|
|
22251
|
+
const settingsPath = scope === "global" ? path15.join(homedir4(), ".claude", "settings.json") : path15.join(root, ".claude", "settings.json");
|
|
22252
|
+
if (!fs14.existsSync(settingsPath)) return;
|
|
21881
22253
|
const config = readJsonc(settingsPath);
|
|
21882
22254
|
const permissions = config?.permissions;
|
|
21883
22255
|
const allow = permissions?.allow;
|
|
@@ -21886,13 +22258,17 @@ function removeClaudePermission(root, scope) {
|
|
|
21886
22258
|
const next = allow.filter((rule) => rule !== PERMISSION_RULE);
|
|
21887
22259
|
editJsoncFile(settingsPath, ["permissions", "allow"], next.length > 0 ? next : void 0);
|
|
21888
22260
|
}
|
|
22261
|
+
function formatCopyDestination(target, writtenPath, root) {
|
|
22262
|
+
if (writtenPath === target.targetPath) return target.label;
|
|
22263
|
+
return `${target.label} -> ${formatManagedPathLabel(writtenPath, realpathOrSelf(root))}`;
|
|
22264
|
+
}
|
|
21889
22265
|
function formatManagedPathLabel(targetPath, root) {
|
|
21890
22266
|
const home = homedir4();
|
|
21891
|
-
if (targetPath === home || targetPath.startsWith(`${home}${
|
|
22267
|
+
if (targetPath === home || targetPath.startsWith(`${home}${path15.sep}`)) {
|
|
21892
22268
|
return `~${targetPath.slice(home.length)}`;
|
|
21893
22269
|
}
|
|
21894
|
-
const relative5 =
|
|
21895
|
-
if (relative5 && !relative5.startsWith("..") && !
|
|
22270
|
+
const relative5 = path15.relative(root, targetPath);
|
|
22271
|
+
if (relative5 && !relative5.startsWith("..") && !path15.isAbsolute(relative5)) {
|
|
21896
22272
|
return relative5;
|
|
21897
22273
|
}
|
|
21898
22274
|
return targetPath;
|
|
@@ -21906,7 +22282,7 @@ function addManagedTarget(targets, editorName, targetPath, root) {
|
|
|
21906
22282
|
}
|
|
21907
22283
|
function getAdapterBasePath(adapter, root, scope) {
|
|
21908
22284
|
const configPath = scope === "global" ? adapter.globalPath() : adapter.projectPath(root);
|
|
21909
|
-
return configPath ?
|
|
22285
|
+
return configPath ? path15.dirname(configPath) : null;
|
|
21910
22286
|
}
|
|
21911
22287
|
function getManagedContentTargets(adapters, root, scope) {
|
|
21912
22288
|
const targets = {
|
|
@@ -21920,13 +22296,13 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
21920
22296
|
addManagedTarget(
|
|
21921
22297
|
targets.skillTargets,
|
|
21922
22298
|
"skills",
|
|
21923
|
-
|
|
22299
|
+
path15.join(workspaceBase, ".agents", "skills"),
|
|
21924
22300
|
root
|
|
21925
22301
|
);
|
|
21926
22302
|
addManagedTarget(
|
|
21927
22303
|
targets.skillsLockTargets,
|
|
21928
22304
|
"skills",
|
|
21929
|
-
|
|
22305
|
+
path15.join(workspaceBase, "skills-lock.json"),
|
|
21930
22306
|
root
|
|
21931
22307
|
);
|
|
21932
22308
|
for (const adapter of adapters) {
|
|
@@ -21934,21 +22310,21 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
21934
22310
|
case "Cursor": {
|
|
21935
22311
|
const base = getAdapterBasePath(adapter, root, scope);
|
|
21936
22312
|
if (!base) break;
|
|
21937
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
21938
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22313
|
+
addManagedTarget(targets.skillTargets, adapter.name, path15.join(base, "skills"), root);
|
|
22314
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path15.join(base, "rules"), root);
|
|
21939
22315
|
break;
|
|
21940
22316
|
}
|
|
21941
22317
|
case "Claude Code": {
|
|
21942
|
-
const claudeBase = scope === "global" ?
|
|
21943
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
21944
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
21945
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22318
|
+
const claudeBase = scope === "global" ? path15.join(homedir4(), ".claude") : path15.join(root, ".claude");
|
|
22319
|
+
addManagedTarget(targets.skillTargets, adapter.name, path15.join(claudeBase, "skills"), root);
|
|
22320
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path15.join(claudeBase, "rules"), root);
|
|
22321
|
+
addManagedTarget(targets.agentTargets, adapter.name, path15.join(claudeBase, "agents"), root);
|
|
21946
22322
|
break;
|
|
21947
22323
|
}
|
|
21948
22324
|
case "Gemini": {
|
|
21949
|
-
const geminiBase = scope === "global" ?
|
|
21950
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
21951
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22325
|
+
const geminiBase = scope === "global" ? path15.join(homedir4(), ".gemini") : path15.join(root, ".gemini");
|
|
22326
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path15.join(geminiBase, "rules"), root);
|
|
22327
|
+
addManagedTarget(targets.agentTargets, adapter.name, path15.join(geminiBase, "agents"), root);
|
|
21952
22328
|
break;
|
|
21953
22329
|
}
|
|
21954
22330
|
case "Codex": {
|
|
@@ -21958,9 +22334,9 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
21958
22334
|
break;
|
|
21959
22335
|
}
|
|
21960
22336
|
case "opencode": {
|
|
21961
|
-
const base = scope === "global" ?
|
|
21962
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
21963
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22337
|
+
const base = scope === "global" ? path15.join(homedir4(), ".config", "opencode") : path15.join(root, ".opencode");
|
|
22338
|
+
addManagedTarget(targets.skillTargets, adapter.name, path15.join(base, "skills"), root);
|
|
22339
|
+
addManagedTarget(targets.agentTargets, adapter.name, path15.join(base, "agents"), root);
|
|
21964
22340
|
break;
|
|
21965
22341
|
}
|
|
21966
22342
|
}
|
|
@@ -21974,12 +22350,12 @@ function stripFrontmatter(content) {
|
|
|
21974
22350
|
return match ? content.slice(match[0].length).trim() : content.trim();
|
|
21975
22351
|
}
|
|
21976
22352
|
function readAndConcatRules(rulesDir) {
|
|
21977
|
-
if (!
|
|
21978
|
-
const files =
|
|
22353
|
+
if (!fs14.existsSync(rulesDir)) return null;
|
|
22354
|
+
const files = fs14.readdirSync(rulesDir).filter((f) => f.endsWith(".md")).sort();
|
|
21979
22355
|
if (files.length === 0) return null;
|
|
21980
22356
|
const parts = [];
|
|
21981
22357
|
for (const file of files) {
|
|
21982
|
-
const raw =
|
|
22358
|
+
const raw = fs14.readFileSync(path15.join(rulesDir, file), "utf8");
|
|
21983
22359
|
const stripped = stripFrontmatter(raw);
|
|
21984
22360
|
if (stripped) parts.push(stripped);
|
|
21985
22361
|
}
|
|
@@ -22014,7 +22390,7 @@ function injectCodexRules(configPath, rulesDir) {
|
|
|
22014
22390
|
return configPath;
|
|
22015
22391
|
}
|
|
22016
22392
|
function removeCodexRules(configPath) {
|
|
22017
|
-
if (!
|
|
22393
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
22018
22394
|
const config = readToml(configPath);
|
|
22019
22395
|
const existing = config.developer_instructions;
|
|
22020
22396
|
if (!existing || !existing.includes(ARGENT_RULES_START)) return false;
|
|
@@ -22032,10 +22408,9 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
|
|
|
22032
22408
|
const managedTargets = getManagedContentTargets(adapters, root, scope);
|
|
22033
22409
|
for (const target of managedTargets.ruleTargets) {
|
|
22034
22410
|
try {
|
|
22035
|
-
|
|
22036
|
-
|
|
22037
|
-
|
|
22038
|
-
results.push(` Copied rules to ${target.targetPath}`);
|
|
22411
|
+
const written = copyDir(rulesDir, target.targetPath);
|
|
22412
|
+
if (written) {
|
|
22413
|
+
results.push(` Copied rules to ${formatCopyDestination(target, written, root)}`);
|
|
22039
22414
|
}
|
|
22040
22415
|
} catch (err) {
|
|
22041
22416
|
results.push(` Could not copy rules to ${target.targetPath}: ${err}`);
|
|
@@ -22043,10 +22418,9 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
|
|
|
22043
22418
|
}
|
|
22044
22419
|
for (const target of managedTargets.agentTargets) {
|
|
22045
22420
|
try {
|
|
22046
|
-
|
|
22047
|
-
|
|
22048
|
-
|
|
22049
|
-
results.push(` Copied agents to ${target.targetPath}`);
|
|
22421
|
+
const written = copyDir(agentsDir, target.targetPath);
|
|
22422
|
+
if (written) {
|
|
22423
|
+
results.push(` Copied agents to ${formatCopyDestination(target, written, root)}`);
|
|
22050
22424
|
}
|
|
22051
22425
|
} catch (err) {
|
|
22052
22426
|
results.push(` Could not copy agents to ${target.targetPath}: ${err}`);
|
|
@@ -22304,7 +22678,7 @@ var ShellCommandError = class extends Error {
|
|
|
22304
22678
|
signal;
|
|
22305
22679
|
};
|
|
22306
22680
|
function runShellCommand(cmd, opts = {}) {
|
|
22307
|
-
return new Promise((
|
|
22681
|
+
return new Promise((resolve13, reject) => {
|
|
22308
22682
|
const child = spawn2(cmd.bin, cmd.args, {
|
|
22309
22683
|
stdio: ["ignore", "pipe", "pipe"],
|
|
22310
22684
|
shell: process.platform === "win32",
|
|
@@ -22315,7 +22689,7 @@ function runShellCommand(cmd, opts = {}) {
|
|
|
22315
22689
|
stderr += chunk.toString();
|
|
22316
22690
|
});
|
|
22317
22691
|
child.on("close", (code, signal) => {
|
|
22318
|
-
if (code === 0)
|
|
22692
|
+
if (code === 0) resolve13();
|
|
22319
22693
|
else
|
|
22320
22694
|
reject(
|
|
22321
22695
|
new ShellCommandError(
|
|
@@ -22752,7 +23126,7 @@ async function chooseAdapters(opts) {
|
|
|
22752
23126
|
// ../argent-installer/src/init-scope.ts
|
|
22753
23127
|
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
22754
23128
|
import { existsSync as existsSync12 } from "node:fs";
|
|
22755
|
-
import { resolve as
|
|
23129
|
+
import { resolve as resolve8 } from "node:path";
|
|
22756
23130
|
async function chooseScope(opts) {
|
|
22757
23131
|
if (opts.installMode === "local") {
|
|
22758
23132
|
return { scope: "local" };
|
|
@@ -22789,13 +23163,13 @@ async function chooseScope(opts) {
|
|
|
22789
23163
|
placeholder: process.cwd(),
|
|
22790
23164
|
validate(value) {
|
|
22791
23165
|
if (!value?.trim()) return "Path cannot be empty.";
|
|
22792
|
-
const resolved =
|
|
23166
|
+
const resolved = resolve8(value.trim());
|
|
22793
23167
|
if (!existsSync12(resolved))
|
|
22794
23168
|
return `Path does not exist: ${resolved}. Please verify and enter a valid path.`;
|
|
22795
23169
|
}
|
|
22796
23170
|
});
|
|
22797
23171
|
if (isCancel(customPathInput)) throw new InitCancelled("scope");
|
|
22798
|
-
return { scope: "custom", customRoot:
|
|
23172
|
+
return { scope: "custom", customRoot: resolve8(customPathInput.trim()) };
|
|
22799
23173
|
}
|
|
22800
23174
|
|
|
22801
23175
|
// ../argent-installer/src/init-mcp-write.ts
|
|
@@ -23190,7 +23564,7 @@ async function runSkillsStep(args) {
|
|
|
23190
23564
|
return skillsMethod;
|
|
23191
23565
|
}
|
|
23192
23566
|
function runNpxSkills(args, interactive, cwd) {
|
|
23193
|
-
return new Promise((
|
|
23567
|
+
return new Promise((resolve13, reject) => {
|
|
23194
23568
|
const npxCmd = process.platform === "win32" ? "npx.cmd" : "npx";
|
|
23195
23569
|
const child = spawn3(npxCmd, args, {
|
|
23196
23570
|
stdio: interactive ? "inherit" : ["ignore", "pipe", "pipe"],
|
|
@@ -23209,7 +23583,7 @@ function runNpxSkills(args, interactive, cwd) {
|
|
|
23209
23583
|
}
|
|
23210
23584
|
child.on("close", (code) => {
|
|
23211
23585
|
if (code === 0) {
|
|
23212
|
-
|
|
23586
|
+
resolve13();
|
|
23213
23587
|
} else {
|
|
23214
23588
|
const output = [stderr, stdout2].filter(Boolean).join("\n").trim();
|
|
23215
23589
|
reject(new Error(output || `npx skills exited with code ${code}`));
|
|
@@ -23482,7 +23856,7 @@ function printBanner() {
|
|
|
23482
23856
|
// ../argent-installer/src/update.ts
|
|
23483
23857
|
var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
23484
23858
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
23485
|
-
import * as
|
|
23859
|
+
import * as path19 from "node:path";
|
|
23486
23860
|
|
|
23487
23861
|
// ../argent-installer/src/update-target.ts
|
|
23488
23862
|
var import_update_core = __toESM(require_dist2(), 1);
|
|
@@ -23501,17 +23875,17 @@ async function resolveInstallableUpdateTarget(pm, current) {
|
|
|
23501
23875
|
|
|
23502
23876
|
// ../argent-tools-client/src/launcher.ts
|
|
23503
23877
|
import * as net from "node:net";
|
|
23504
|
-
import * as
|
|
23505
|
-
import * as
|
|
23878
|
+
import * as fs15 from "node:fs";
|
|
23879
|
+
import * as path16 from "node:path";
|
|
23506
23880
|
import * as readline from "node:readline";
|
|
23507
23881
|
import { homedir as homedir5 } from "node:os";
|
|
23508
23882
|
import { spawn as spawn4, execFileSync as execFileSync5 } from "node:child_process";
|
|
23509
23883
|
import { createHash as createHash2, randomBytes } from "node:crypto";
|
|
23510
23884
|
import { mkdir, writeFile, readFile, readdir, unlink, rename, chmod } from "node:fs/promises";
|
|
23511
|
-
var STATE_DIR =
|
|
23512
|
-
var STATE_FILE =
|
|
23513
|
-
var LOG_FILE =
|
|
23514
|
-
var LOCK_FILE =
|
|
23885
|
+
var STATE_DIR = path16.join(homedir5(), ".argent");
|
|
23886
|
+
var STATE_FILE = path16.join(STATE_DIR, "tool-server.json");
|
|
23887
|
+
var LOG_FILE = path16.join(STATE_DIR, "tool-server.log");
|
|
23888
|
+
var LOCK_FILE = path16.join(STATE_DIR, "tool-server.lock");
|
|
23515
23889
|
function isProcessAlive(pid) {
|
|
23516
23890
|
try {
|
|
23517
23891
|
process.kill(pid, 0);
|
|
@@ -23522,7 +23896,7 @@ function isProcessAlive(pid) {
|
|
|
23522
23896
|
}
|
|
23523
23897
|
function stateFileForBundle(bundlePath) {
|
|
23524
23898
|
const key = createHash2("sha256").update(bundlePath).digest("hex").slice(0, 12);
|
|
23525
|
-
return
|
|
23899
|
+
return path16.join(STATE_DIR, `tool-server-${key}.json`);
|
|
23526
23900
|
}
|
|
23527
23901
|
async function readStateFile(file) {
|
|
23528
23902
|
try {
|
|
@@ -23564,7 +23938,7 @@ async function readAllToolsServerStates() {
|
|
|
23564
23938
|
const out = [];
|
|
23565
23939
|
for (const name of names) {
|
|
23566
23940
|
if (!STATE_FILE_RE.test(name)) continue;
|
|
23567
|
-
const file =
|
|
23941
|
+
const file = path16.join(STATE_DIR, name);
|
|
23568
23942
|
const state2 = await readStateFile(file);
|
|
23569
23943
|
if (state2) out.push({ file, state: state2 });
|
|
23570
23944
|
}
|
|
@@ -23606,21 +23980,21 @@ async function killToolServer(bundlePath) {
|
|
|
23606
23980
|
await clearToolsServerState(bundlePath ?? state2.bundlePath);
|
|
23607
23981
|
}
|
|
23608
23982
|
function isPathWithin(child, parent) {
|
|
23609
|
-
const rel =
|
|
23610
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
23983
|
+
const rel = path16.relative(parent, child);
|
|
23984
|
+
return rel !== "" && !rel.startsWith("..") && !path16.isAbsolute(rel);
|
|
23611
23985
|
}
|
|
23612
23986
|
function tryRealpath(p) {
|
|
23613
23987
|
try {
|
|
23614
|
-
return
|
|
23988
|
+
return fs15.realpathSync(p);
|
|
23615
23989
|
} catch {
|
|
23616
23990
|
return p;
|
|
23617
23991
|
}
|
|
23618
23992
|
}
|
|
23619
23993
|
async function killToolServerForInstallDir(packageDir) {
|
|
23620
|
-
const parents = /* @__PURE__ */ new Set([
|
|
23994
|
+
const parents = /* @__PURE__ */ new Set([path16.resolve(packageDir), tryRealpath(packageDir)]);
|
|
23621
23995
|
let killed = 0;
|
|
23622
23996
|
for (const { file, state: state2 } of await readAllToolsServerStates()) {
|
|
23623
|
-
const bundles = /* @__PURE__ */ new Set([
|
|
23997
|
+
const bundles = /* @__PURE__ */ new Set([path16.resolve(state2.bundlePath), tryRealpath(state2.bundlePath)]);
|
|
23624
23998
|
const matches2 = [...bundles].some((b) => [...parents].some((p) => isPathWithin(b, p)));
|
|
23625
23999
|
if (!matches2) continue;
|
|
23626
24000
|
const fresh = await readStateFile(file);
|
|
@@ -23659,23 +24033,23 @@ function processCommandMatches(pid, marker) {
|
|
|
23659
24033
|
}
|
|
23660
24034
|
|
|
23661
24035
|
// ../argent-tools-client/src/link-config.ts
|
|
23662
|
-
import * as
|
|
24036
|
+
import * as path17 from "node:path";
|
|
23663
24037
|
import { homedir as homedir6 } from "node:os";
|
|
23664
24038
|
import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
|
|
23665
|
-
var LINK_DIR =
|
|
23666
|
-
var LINK_FILE =
|
|
24039
|
+
var LINK_DIR = path17.join(homedir6(), ".argent");
|
|
24040
|
+
var LINK_FILE = path17.join(LINK_DIR, "link.json");
|
|
23667
24041
|
|
|
23668
24042
|
// ../argent-tools-client/src/file-inputs.ts
|
|
23669
24043
|
import { createHash as createHash3, randomUUID as randomUUID6 } from "node:crypto";
|
|
23670
24044
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
23671
24045
|
import { mkdir as mkdir3, readFile as readFile3, rm as rm2, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
|
|
23672
24046
|
import { tmpdir } from "node:os";
|
|
23673
|
-
import * as
|
|
24047
|
+
import * as path18 from "node:path";
|
|
23674
24048
|
|
|
23675
24049
|
// ../archive/src/index.ts
|
|
23676
24050
|
import { execFile } from "node:child_process";
|
|
23677
24051
|
import { rm, readdir as readdir2 } from "node:fs/promises";
|
|
23678
|
-
import { basename as basename2, dirname as dirname11, join as
|
|
24052
|
+
import { basename as basename2, dirname as dirname11, join as join18, posix as posix2, resolve as resolve10, sep as sep5 } from "node:path";
|
|
23679
24053
|
import { promisify } from "node:util";
|
|
23680
24054
|
var execFileAsync = promisify(execFile);
|
|
23681
24055
|
|
|
@@ -23686,7 +24060,7 @@ var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
|
|
|
23686
24060
|
import { copyFile, mkdir as mkdir4, readFile as readFile4, realpath, rm as rm3, stat as stat3, writeFile as writeFile4 } from "node:fs/promises";
|
|
23687
24061
|
import { constants as fsConstants } from "node:fs";
|
|
23688
24062
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
23689
|
-
import { basename as basename4, dirname as dirname13, extname as extname2, isAbsolute as isAbsolute5, join as
|
|
24063
|
+
import { basename as basename4, dirname as dirname13, extname as extname2, isAbsolute as isAbsolute5, join as join20, normalize, resolve as resolve11, sep as sep6 } from "node:path";
|
|
23690
24064
|
import { createHash as createHash4 } from "node:crypto";
|
|
23691
24065
|
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize(".argent/recordings")]);
|
|
23692
24066
|
var RECORDINGS_SAVE_DIR = normalize(".argent/recordings");
|
|
@@ -24045,7 +24419,7 @@ async function update(args) {
|
|
|
24045
24419
|
process.exit(1);
|
|
24046
24420
|
}
|
|
24047
24421
|
const rootOverride = getProjectRootOverride(args);
|
|
24048
|
-
const projectRoot = rootOverride ?
|
|
24422
|
+
const projectRoot = rootOverride ? path19.resolve(rootOverride) : resolveProjectRoot2(process.cwd());
|
|
24049
24423
|
installMode = resolveInstallMode(projectRoot);
|
|
24050
24424
|
const flags = parseTargetFlags(args);
|
|
24051
24425
|
const localInstalled = installMode === "local" && probeLocalInstall(projectRoot).installed;
|
|
@@ -24216,8 +24590,8 @@ async function update(args) {
|
|
|
24216
24590
|
// ../argent-installer/src/uninstall.ts
|
|
24217
24591
|
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
24218
24592
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
24219
|
-
import * as
|
|
24220
|
-
import * as
|
|
24593
|
+
import * as fs16 from "node:fs";
|
|
24594
|
+
import * as path20 from "node:path";
|
|
24221
24595
|
var UNINSTALL_TOOLSERVER_STOP_FAILED = {
|
|
24222
24596
|
error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
|
|
24223
24597
|
failure_stage: "installer_uninstall_toolserver_stop",
|
|
@@ -24238,10 +24612,10 @@ var UNINSTALL_UNCLASSIFIED_FAILED = {
|
|
|
24238
24612
|
};
|
|
24239
24613
|
function removeDirIfEmpty2(dirPath) {
|
|
24240
24614
|
try {
|
|
24241
|
-
if (!
|
|
24242
|
-
if (!
|
|
24243
|
-
if (
|
|
24244
|
-
|
|
24615
|
+
if (!fs16.existsSync(dirPath)) return false;
|
|
24616
|
+
if (!fs16.statSync(dirPath).isDirectory()) return false;
|
|
24617
|
+
if (fs16.readdirSync(dirPath).length > 0) return false;
|
|
24618
|
+
fs16.rmdirSync(dirPath);
|
|
24245
24619
|
return true;
|
|
24246
24620
|
} catch {
|
|
24247
24621
|
return false;
|
|
@@ -24251,9 +24625,9 @@ function collectBundledPaths(sourceDir) {
|
|
|
24251
24625
|
const files = [];
|
|
24252
24626
|
const directories = [];
|
|
24253
24627
|
function walk(currentDir, relativeDir = "") {
|
|
24254
|
-
for (const entry of
|
|
24255
|
-
const relativePath = relativeDir ?
|
|
24256
|
-
const absolutePath =
|
|
24628
|
+
for (const entry of fs16.readdirSync(currentDir, { withFileTypes: true })) {
|
|
24629
|
+
const relativePath = relativeDir ? path20.join(relativeDir, entry.name) : entry.name;
|
|
24630
|
+
const absolutePath = path20.join(currentDir, entry.name);
|
|
24257
24631
|
if (entry.isDirectory()) {
|
|
24258
24632
|
walk(absolutePath, relativePath);
|
|
24259
24633
|
directories.push(relativePath);
|
|
@@ -24266,52 +24640,52 @@ function collectBundledPaths(sourceDir) {
|
|
|
24266
24640
|
return { files, directories };
|
|
24267
24641
|
}
|
|
24268
24642
|
function removeBundledContent(sourceDir, targetDir) {
|
|
24269
|
-
if (!
|
|
24643
|
+
if (!fs16.existsSync(sourceDir) || !fs16.existsSync(targetDir)) {
|
|
24270
24644
|
return { removedPaths: [], removedRoot: false };
|
|
24271
24645
|
}
|
|
24272
24646
|
const { files, directories } = collectBundledPaths(sourceDir);
|
|
24273
24647
|
const removedPaths = [];
|
|
24274
24648
|
for (const relativePath of files) {
|
|
24275
|
-
const targetPath =
|
|
24649
|
+
const targetPath = path20.join(targetDir, relativePath);
|
|
24276
24650
|
try {
|
|
24277
|
-
if (!
|
|
24278
|
-
if (
|
|
24279
|
-
|
|
24651
|
+
if (!fs16.existsSync(targetPath)) continue;
|
|
24652
|
+
if (fs16.lstatSync(targetPath).isDirectory()) continue;
|
|
24653
|
+
fs16.rmSync(targetPath, { force: true });
|
|
24280
24654
|
removedPaths.push(relativePath);
|
|
24281
24655
|
} catch {
|
|
24282
24656
|
}
|
|
24283
24657
|
}
|
|
24284
24658
|
directories.sort(
|
|
24285
|
-
(a3, b) => b.split(
|
|
24659
|
+
(a3, b) => b.split(path20.sep).length - a3.split(path20.sep).length || b.length - a3.length
|
|
24286
24660
|
);
|
|
24287
24661
|
for (const relativePath of directories) {
|
|
24288
|
-
const targetPath =
|
|
24662
|
+
const targetPath = path20.join(targetDir, relativePath);
|
|
24289
24663
|
try {
|
|
24290
|
-
if (!
|
|
24291
|
-
if (!
|
|
24292
|
-
if (
|
|
24293
|
-
|
|
24664
|
+
if (!fs16.existsSync(targetPath)) continue;
|
|
24665
|
+
if (!fs16.statSync(targetPath).isDirectory()) continue;
|
|
24666
|
+
if (fs16.readdirSync(targetPath).length > 0) continue;
|
|
24667
|
+
fs16.rmdirSync(targetPath);
|
|
24294
24668
|
} catch {
|
|
24295
24669
|
}
|
|
24296
24670
|
}
|
|
24297
24671
|
let removedRoot = false;
|
|
24298
24672
|
try {
|
|
24299
|
-
if (
|
|
24300
|
-
if (
|
|
24301
|
-
|
|
24673
|
+
if (fs16.existsSync(targetDir) && fs16.statSync(targetDir).isDirectory()) {
|
|
24674
|
+
if (fs16.readdirSync(targetDir).length === 0) {
|
|
24675
|
+
fs16.rmdirSync(targetDir);
|
|
24302
24676
|
removedRoot = true;
|
|
24303
24677
|
}
|
|
24304
24678
|
}
|
|
24305
24679
|
} catch {
|
|
24306
24680
|
}
|
|
24307
24681
|
if (removedRoot) {
|
|
24308
|
-
removeDirIfEmpty2(
|
|
24682
|
+
removeDirIfEmpty2(path20.dirname(targetDir));
|
|
24309
24683
|
}
|
|
24310
24684
|
return { removedPaths, removedRoot };
|
|
24311
24685
|
}
|
|
24312
24686
|
function readBundledSkillName(skillFilePath, fallbackName) {
|
|
24313
24687
|
try {
|
|
24314
|
-
const content =
|
|
24688
|
+
const content = fs16.readFileSync(skillFilePath, "utf8");
|
|
24315
24689
|
const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1];
|
|
24316
24690
|
if (!frontmatter) return fallbackName;
|
|
24317
24691
|
const data = (0, import_yaml3.parse)(frontmatter);
|
|
@@ -24322,30 +24696,30 @@ function readBundledSkillName(skillFilePath, fallbackName) {
|
|
|
24322
24696
|
}
|
|
24323
24697
|
}
|
|
24324
24698
|
function getBundledSkillNames(skillsDir) {
|
|
24325
|
-
if (!
|
|
24699
|
+
if (!fs16.existsSync(skillsDir)) return [];
|
|
24326
24700
|
const skillNames = [];
|
|
24327
|
-
for (const entry of
|
|
24701
|
+
for (const entry of fs16.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
24328
24702
|
if (!entry.isDirectory()) continue;
|
|
24329
|
-
const skillFilePath =
|
|
24330
|
-
if (!
|
|
24703
|
+
const skillFilePath = path20.join(skillsDir, entry.name, "SKILL.md");
|
|
24704
|
+
if (!fs16.existsSync(skillFilePath)) continue;
|
|
24331
24705
|
skillNames.push(readBundledSkillName(skillFilePath, entry.name));
|
|
24332
24706
|
}
|
|
24333
24707
|
return [...new Set(skillNames)].sort();
|
|
24334
24708
|
}
|
|
24335
24709
|
function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
24336
|
-
if (!
|
|
24710
|
+
if (!fs16.existsSync(targetDir)) {
|
|
24337
24711
|
return { removedPaths: [], removedRoot: false };
|
|
24338
24712
|
}
|
|
24339
24713
|
const removedPaths = [];
|
|
24340
24714
|
for (const skillName of skillNames) {
|
|
24341
|
-
const targetPath =
|
|
24715
|
+
const targetPath = path20.join(targetDir, skillName);
|
|
24342
24716
|
try {
|
|
24343
|
-
if (!
|
|
24344
|
-
const stats =
|
|
24717
|
+
if (!fs16.existsSync(targetPath)) continue;
|
|
24718
|
+
const stats = fs16.lstatSync(targetPath);
|
|
24345
24719
|
if (stats.isDirectory() && !stats.isSymbolicLink()) {
|
|
24346
|
-
|
|
24720
|
+
fs16.rmSync(targetPath, { recursive: true, force: true });
|
|
24347
24721
|
} else {
|
|
24348
|
-
|
|
24722
|
+
fs16.rmSync(targetPath, { force: true });
|
|
24349
24723
|
}
|
|
24350
24724
|
removedPaths.push(skillName);
|
|
24351
24725
|
} catch {
|
|
@@ -24353,17 +24727,17 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
|
24353
24727
|
}
|
|
24354
24728
|
const removedRoot = removeDirIfEmpty2(targetDir);
|
|
24355
24729
|
if (removedRoot) {
|
|
24356
|
-
removeDirIfEmpty2(
|
|
24730
|
+
removeDirIfEmpty2(path20.dirname(targetDir));
|
|
24357
24731
|
}
|
|
24358
24732
|
return { removedPaths, removedRoot };
|
|
24359
24733
|
}
|
|
24360
24734
|
function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
24361
|
-
if (!
|
|
24735
|
+
if (!fs16.existsSync(lockPath)) {
|
|
24362
24736
|
return { removedSkills: [], removedFile: false };
|
|
24363
24737
|
}
|
|
24364
24738
|
let parsed;
|
|
24365
24739
|
try {
|
|
24366
|
-
parsed = JSON.parse(
|
|
24740
|
+
parsed = JSON.parse(fs16.readFileSync(lockPath, "utf8"));
|
|
24367
24741
|
} catch {
|
|
24368
24742
|
return { removedSkills: [], removedFile: false };
|
|
24369
24743
|
}
|
|
@@ -24390,10 +24764,10 @@ function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
|
24390
24764
|
parsed.skills && typeof parsed.skills === "object" && Object.keys(parsed.skills).length > 0
|
|
24391
24765
|
);
|
|
24392
24766
|
if (!hasSkills && otherKeys.length === 0) {
|
|
24393
|
-
|
|
24767
|
+
fs16.rmSync(lockPath, { force: true });
|
|
24394
24768
|
return { removedSkills, removedFile: true };
|
|
24395
24769
|
}
|
|
24396
|
-
|
|
24770
|
+
fs16.writeFileSync(lockPath, JSON.stringify(parsed, null, 2) + "\n");
|
|
24397
24771
|
return { removedSkills, removedFile: false };
|
|
24398
24772
|
}
|
|
24399
24773
|
function cleanupBundledSkills(skillNames, targets) {
|