@swmansion/argent 0.18.1-next.2 → 0.18.1-next.21
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/dist/cli-cmds.mjs +955 -197
- package/dist/cli.js +10 -6
- 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 +834 -464
- package/dist/mcp-server.mjs +402 -68
- package/dist/tool-server.cjs +2376 -1740
- package/package.json +4 -1
- package/skills/argent-create-flow/SKILL.md +6 -1
- 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) {
|
|
@@ -16034,6 +16353,7 @@ var FAILURE_CODES = {
|
|
|
16034
16353
|
CLI_RUN_FLAG_PARSE_FAILED: "CLI_RUN_FLAG_PARSE_FAILED",
|
|
16035
16354
|
CLI_RUN_ARGS_NOT_OBJECT: "CLI_RUN_ARGS_NOT_OBJECT",
|
|
16036
16355
|
CLI_RUN_ARGS_JSON_INVALID: "CLI_RUN_ARGS_JSON_INVALID",
|
|
16356
|
+
CLI_RUN_INPUT_VALIDATION_FAILED: "CLI_RUN_INPUT_VALIDATION_FAILED",
|
|
16037
16357
|
CLI_RUN_TOOL_CALL_FAILED: "CLI_RUN_TOOL_CALL_FAILED",
|
|
16038
16358
|
CLI_RUN_SAVE_IMAGE_FAILED: "CLI_RUN_SAVE_IMAGE_FAILED",
|
|
16039
16359
|
TOOL_CAPABILITY_UNSUPPORTED_OPERATION: "TOOL_CAPABILITY_UNSUPPORTED_OPERATION",
|
|
@@ -16235,6 +16555,7 @@ var FAILURE_CODES = {
|
|
|
16235
16555
|
CHROMIUM_DEVICE_ID_INVALID: "CHROMIUM_DEVICE_ID_INVALID",
|
|
16236
16556
|
CHROMIUM_PARAM_INVALID: "CHROMIUM_PARAM_INVALID",
|
|
16237
16557
|
CHROMIUM_INPUT_INVALID: "CHROMIUM_INPUT_INVALID",
|
|
16558
|
+
CHROMIUM_WINDOW_HIDDEN: "CHROMIUM_WINDOW_HIDDEN",
|
|
16238
16559
|
CHROMIUM_VIEWPORT_READ_FAILED: "CHROMIUM_VIEWPORT_READ_FAILED",
|
|
16239
16560
|
CHROMIUM_SCREENSHOT_FAILED: "CHROMIUM_SCREENSHOT_FAILED",
|
|
16240
16561
|
CHROMIUM_STORAGE_EVAL_FAILED: "CHROMIUM_STORAGE_EVAL_FAILED",
|
|
@@ -16621,9 +16942,9 @@ function isReplitAgent(env) {
|
|
|
16621
16942
|
}
|
|
16622
16943
|
var DEVIN_MARKER_PATH = "/opt/.devin";
|
|
16623
16944
|
var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
16624
|
-
function safeExists(fileExists,
|
|
16945
|
+
function safeExists(fileExists, path21) {
|
|
16625
16946
|
try {
|
|
16626
|
-
return fileExists(
|
|
16947
|
+
return fileExists(path21);
|
|
16627
16948
|
} catch {
|
|
16628
16949
|
return false;
|
|
16629
16950
|
}
|
|
@@ -17044,7 +17365,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
17044
17365
|
var SESSION_ID = randomUUID3();
|
|
17045
17366
|
function readCliVersion() {
|
|
17046
17367
|
if (true) {
|
|
17047
|
-
return "0.18.
|
|
17368
|
+
return "0.18.1";
|
|
17048
17369
|
}
|
|
17049
17370
|
return "0.0.0";
|
|
17050
17371
|
}
|
|
@@ -17078,11 +17399,11 @@ function getBaseProps(runtime) {
|
|
|
17078
17399
|
|
|
17079
17400
|
// ../telemetry/src/identity.ts
|
|
17080
17401
|
import * as crypto2 from "node:crypto";
|
|
17081
|
-
import * as
|
|
17082
|
-
import * as
|
|
17402
|
+
import * as fs4 from "node:fs";
|
|
17403
|
+
import * as path7 from "node:path";
|
|
17083
17404
|
|
|
17084
17405
|
// ../telemetry/src/paths.ts
|
|
17085
|
-
import * as
|
|
17406
|
+
import * as path6 from "node:path";
|
|
17086
17407
|
|
|
17087
17408
|
// ../configuration-core/src/flags.ts
|
|
17088
17409
|
import * as fs from "node:fs";
|
|
@@ -17217,15 +17538,20 @@ function updateConfig(mutate, scope = "global", options = {}) {
|
|
|
17217
17538
|
}
|
|
17218
17539
|
}
|
|
17219
17540
|
|
|
17220
|
-
// ../configuration-core/src/
|
|
17541
|
+
// ../configuration-core/src/secrets.ts
|
|
17542
|
+
var import_dotenv = __toESM(require_main(), 1);
|
|
17543
|
+
import * as fs3 from "node:fs";
|
|
17221
17544
|
import * as path4 from "node:path";
|
|
17222
17545
|
|
|
17546
|
+
// ../configuration-core/src/config-access.ts
|
|
17547
|
+
import * as path5 from "node:path";
|
|
17548
|
+
|
|
17223
17549
|
// ../telemetry/src/paths.ts
|
|
17224
17550
|
function identityFilePath() {
|
|
17225
|
-
return
|
|
17551
|
+
return path6.join(argentHomeDir(), "telemetry-id");
|
|
17226
17552
|
}
|
|
17227
17553
|
function debugLogPath() {
|
|
17228
|
-
return
|
|
17554
|
+
return path6.join(argentHomeDir(), "telemetry-debug.log");
|
|
17229
17555
|
}
|
|
17230
17556
|
|
|
17231
17557
|
// ../telemetry/src/identity.ts
|
|
@@ -17335,66 +17661,66 @@ function resolveFingerprintOnce(resolveFingerprint) {
|
|
|
17335
17661
|
function isCorruptIdFile(filePath) {
|
|
17336
17662
|
let isRegularFile;
|
|
17337
17663
|
try {
|
|
17338
|
-
isRegularFile =
|
|
17664
|
+
isRegularFile = fs4.lstatSync(filePath).isFile();
|
|
17339
17665
|
} catch {
|
|
17340
17666
|
return false;
|
|
17341
17667
|
}
|
|
17342
17668
|
return isRegularFile && tryReadId(filePath) === null;
|
|
17343
17669
|
}
|
|
17344
17670
|
function writeIdFileAtomic(finalPath, id) {
|
|
17345
|
-
|
|
17671
|
+
fs4.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17346
17672
|
let occupant;
|
|
17347
17673
|
try {
|
|
17348
|
-
occupant =
|
|
17674
|
+
occupant = fs4.lstatSync(finalPath);
|
|
17349
17675
|
} catch (err) {
|
|
17350
17676
|
if (err.code !== "ENOENT") throw err;
|
|
17351
17677
|
}
|
|
17352
17678
|
if (occupant && !occupant.isFile()) {
|
|
17353
17679
|
throw new Error("telemetry: refusing to replace a non-regular file at the identity path");
|
|
17354
17680
|
}
|
|
17355
|
-
const tmpPath =
|
|
17681
|
+
const tmpPath = path7.join(
|
|
17356
17682
|
argentHomeDir(),
|
|
17357
17683
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17358
17684
|
);
|
|
17359
|
-
const fd =
|
|
17685
|
+
const fd = fs4.openSync(tmpPath, "wx", 384);
|
|
17360
17686
|
try {
|
|
17361
17687
|
try {
|
|
17362
|
-
|
|
17363
|
-
|
|
17688
|
+
fs4.writeSync(fd, id);
|
|
17689
|
+
fs4.fsyncSync(fd);
|
|
17364
17690
|
} finally {
|
|
17365
|
-
|
|
17691
|
+
fs4.closeSync(fd);
|
|
17366
17692
|
}
|
|
17367
|
-
|
|
17693
|
+
fs4.renameSync(tmpPath, finalPath);
|
|
17368
17694
|
} finally {
|
|
17369
17695
|
try {
|
|
17370
|
-
|
|
17696
|
+
fs4.unlinkSync(tmpPath);
|
|
17371
17697
|
} catch {
|
|
17372
17698
|
}
|
|
17373
17699
|
}
|
|
17374
17700
|
}
|
|
17375
17701
|
function mintRandomId(finalPath) {
|
|
17376
|
-
|
|
17702
|
+
fs4.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17377
17703
|
let value = crypto2.randomUUID();
|
|
17378
17704
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
17379
|
-
const tmpPath =
|
|
17705
|
+
const tmpPath = path7.join(
|
|
17380
17706
|
argentHomeDir(),
|
|
17381
17707
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17382
17708
|
);
|
|
17383
17709
|
let fd;
|
|
17384
17710
|
try {
|
|
17385
|
-
fd =
|
|
17711
|
+
fd = fs4.openSync(tmpPath, "wx", 384);
|
|
17386
17712
|
} catch (err) {
|
|
17387
17713
|
if (err.code === "EEXIST") continue;
|
|
17388
17714
|
throw err;
|
|
17389
17715
|
}
|
|
17390
17716
|
try {
|
|
17391
17717
|
try {
|
|
17392
|
-
|
|
17393
|
-
|
|
17718
|
+
fs4.writeSync(fd, value);
|
|
17719
|
+
fs4.fsyncSync(fd);
|
|
17394
17720
|
} finally {
|
|
17395
|
-
|
|
17721
|
+
fs4.closeSync(fd);
|
|
17396
17722
|
}
|
|
17397
|
-
|
|
17723
|
+
fs4.linkSync(tmpPath, finalPath);
|
|
17398
17724
|
cached = { path: finalPath, id: value };
|
|
17399
17725
|
return value;
|
|
17400
17726
|
} catch (err) {
|
|
@@ -17413,7 +17739,7 @@ function mintRandomId(finalPath) {
|
|
|
17413
17739
|
throw err;
|
|
17414
17740
|
} finally {
|
|
17415
17741
|
try {
|
|
17416
|
-
|
|
17742
|
+
fs4.unlinkSync(tmpPath);
|
|
17417
17743
|
} catch {
|
|
17418
17744
|
}
|
|
17419
17745
|
}
|
|
@@ -17421,12 +17747,12 @@ function mintRandomId(finalPath) {
|
|
|
17421
17747
|
throw new Error("telemetry: failed to create identity after retries");
|
|
17422
17748
|
}
|
|
17423
17749
|
function claimCorruptOccupant(finalPath) {
|
|
17424
|
-
const claimed =
|
|
17750
|
+
const claimed = path7.join(
|
|
17425
17751
|
argentHomeDir(),
|
|
17426
17752
|
`.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
|
|
17427
17753
|
);
|
|
17428
17754
|
try {
|
|
17429
|
-
|
|
17755
|
+
fs4.renameSync(finalPath, claimed);
|
|
17430
17756
|
} catch {
|
|
17431
17757
|
return null;
|
|
17432
17758
|
}
|
|
@@ -17435,7 +17761,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17435
17761
|
grabbed = tryReadId(claimed);
|
|
17436
17762
|
} finally {
|
|
17437
17763
|
try {
|
|
17438
|
-
|
|
17764
|
+
fs4.unlinkSync(claimed);
|
|
17439
17765
|
} catch {
|
|
17440
17766
|
}
|
|
17441
17767
|
}
|
|
@@ -17444,7 +17770,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17444
17770
|
function deleteAnonId() {
|
|
17445
17771
|
cached = null;
|
|
17446
17772
|
try {
|
|
17447
|
-
|
|
17773
|
+
fs4.unlinkSync(identityFilePath());
|
|
17448
17774
|
} catch (err) {
|
|
17449
17775
|
if (err.code !== "ENOENT") throw err;
|
|
17450
17776
|
}
|
|
@@ -17452,9 +17778,9 @@ function deleteAnonId() {
|
|
|
17452
17778
|
function tryReadId(filePath) {
|
|
17453
17779
|
let raw;
|
|
17454
17780
|
try {
|
|
17455
|
-
const stats =
|
|
17781
|
+
const stats = fs4.lstatSync(filePath);
|
|
17456
17782
|
if (!stats.isFile()) return null;
|
|
17457
|
-
raw =
|
|
17783
|
+
raw = fs4.readFileSync(filePath, "utf8");
|
|
17458
17784
|
} catch (err) {
|
|
17459
17785
|
if (err.code === "ENOENT") return null;
|
|
17460
17786
|
return null;
|
|
@@ -17468,12 +17794,12 @@ function tryReadId(filePath) {
|
|
|
17468
17794
|
import { execFileSync, spawn } from "node:child_process";
|
|
17469
17795
|
|
|
17470
17796
|
// ../native-devtools-ios/src/index.ts
|
|
17471
|
-
import * as
|
|
17472
|
-
import * as
|
|
17473
|
-
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ??
|
|
17474
|
-
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ??
|
|
17475
|
-
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ??
|
|
17476
|
-
var DYLIB_TVOS_DIR =
|
|
17797
|
+
import * as path8 from "node:path";
|
|
17798
|
+
import * as fs5 from "node:fs";
|
|
17799
|
+
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path8.join(__dirname, "..", "dylibs");
|
|
17800
|
+
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path8.join(__dirname, "..", "bin");
|
|
17801
|
+
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path8.join(DYLIB_DIR, "tcp");
|
|
17802
|
+
var DYLIB_TVOS_DIR = path8.join(DYLIB_DIR, "tvos");
|
|
17477
17803
|
function hostPlatformKey() {
|
|
17478
17804
|
if (process.platform === "linux" && process.arch === "arm64") {
|
|
17479
17805
|
return "linux-arm64";
|
|
@@ -17484,14 +17810,14 @@ function simulatorServerBinaryName() {
|
|
|
17484
17810
|
return process.platform === "win32" ? "simulator-server.exe" : "simulator-server";
|
|
17485
17811
|
}
|
|
17486
17812
|
function platformBinDir() {
|
|
17487
|
-
return
|
|
17813
|
+
return path8.join(BIN_DIR, hostPlatformKey());
|
|
17488
17814
|
}
|
|
17489
17815
|
function simulatorServerBinaryPath() {
|
|
17490
17816
|
const binaryName = simulatorServerBinaryName();
|
|
17491
|
-
const p =
|
|
17492
|
-
if (!
|
|
17493
|
-
const flat =
|
|
17494
|
-
const migrationHint =
|
|
17817
|
+
const p = path8.join(platformBinDir(), binaryName);
|
|
17818
|
+
if (!fs5.existsSync(p)) {
|
|
17819
|
+
const flat = path8.join(BIN_DIR, binaryName);
|
|
17820
|
+
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.` : "";
|
|
17495
17821
|
throw new Error(
|
|
17496
17822
|
`simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
|
|
17497
17823
|
);
|
|
@@ -17524,12 +17850,12 @@ function resolveHostFingerprint() {
|
|
|
17524
17850
|
}
|
|
17525
17851
|
}
|
|
17526
17852
|
function resolveHostFingerprintAsync() {
|
|
17527
|
-
return new Promise((
|
|
17853
|
+
return new Promise((resolve13) => {
|
|
17528
17854
|
let binary;
|
|
17529
17855
|
try {
|
|
17530
17856
|
binary = simulatorServerBinaryPath();
|
|
17531
17857
|
} catch {
|
|
17532
|
-
|
|
17858
|
+
resolve13(null);
|
|
17533
17859
|
return;
|
|
17534
17860
|
}
|
|
17535
17861
|
let settled = false;
|
|
@@ -17542,7 +17868,7 @@ function resolveHostFingerprintAsync() {
|
|
|
17542
17868
|
child?.kill("SIGKILL");
|
|
17543
17869
|
} catch {
|
|
17544
17870
|
}
|
|
17545
|
-
|
|
17871
|
+
resolve13(value);
|
|
17546
17872
|
};
|
|
17547
17873
|
const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
|
|
17548
17874
|
watchdog.unref?.();
|
|
@@ -17575,13 +17901,13 @@ function resolveHostFingerprintAsync() {
|
|
|
17575
17901
|
}
|
|
17576
17902
|
|
|
17577
17903
|
// ../telemetry/src/consent.ts
|
|
17578
|
-
import * as
|
|
17904
|
+
import * as fs6 from "node:fs";
|
|
17579
17905
|
var cache = { current: null };
|
|
17580
17906
|
var sessionOverride = null;
|
|
17581
17907
|
function readConfigOverride() {
|
|
17582
17908
|
let stats;
|
|
17583
17909
|
try {
|
|
17584
|
-
stats =
|
|
17910
|
+
stats = fs6.lstatSync(configFilePath());
|
|
17585
17911
|
} catch (err) {
|
|
17586
17912
|
if (err.code === "ENOENT") {
|
|
17587
17913
|
cache.current = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
@@ -17601,7 +17927,7 @@ function readConfigOverride() {
|
|
|
17601
17927
|
}
|
|
17602
17928
|
let parsedEnabled = null;
|
|
17603
17929
|
try {
|
|
17604
|
-
const raw =
|
|
17930
|
+
const raw = fs6.readFileSync(configFilePath(), "utf8");
|
|
17605
17931
|
const json = JSON.parse(raw);
|
|
17606
17932
|
if (json && typeof json === "object") {
|
|
17607
17933
|
const t2 = json.telemetry;
|
|
@@ -17665,7 +17991,7 @@ function setSessionConsentOverride(enabled) {
|
|
|
17665
17991
|
}
|
|
17666
17992
|
|
|
17667
17993
|
// ../telemetry/src/debug.ts
|
|
17668
|
-
import * as
|
|
17994
|
+
import * as fs7 from "node:fs";
|
|
17669
17995
|
function isDebugEnabled(env = process.env) {
|
|
17670
17996
|
const v = env.ARGENT_TELEMETRY_DEBUG;
|
|
17671
17997
|
if (!v) return false;
|
|
@@ -17692,8 +18018,8 @@ function emitDebugPayload(payload) {
|
|
|
17692
18018
|
} catch {
|
|
17693
18019
|
}
|
|
17694
18020
|
try {
|
|
17695
|
-
|
|
17696
|
-
|
|
18021
|
+
fs7.mkdirSync(argentHomeDir(), { recursive: true });
|
|
18022
|
+
fs7.appendFileSync(debugLogPath(), line + "\n");
|
|
17697
18023
|
} catch {
|
|
17698
18024
|
}
|
|
17699
18025
|
}
|
|
@@ -17840,7 +18166,7 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
|
17840
18166
|
try {
|
|
17841
18167
|
await Promise.race([
|
|
17842
18168
|
client2.shutdown(timeoutMs),
|
|
17843
|
-
new Promise((
|
|
18169
|
+
new Promise((resolve13) => setTimeout(resolve13, timeoutMs + 250).unref())
|
|
17844
18170
|
]);
|
|
17845
18171
|
} catch (err) {
|
|
17846
18172
|
emitDebugError("shutdown failed", err);
|
|
@@ -17851,8 +18177,8 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
|
17851
18177
|
}
|
|
17852
18178
|
|
|
17853
18179
|
// ../argent-installer/src/mcp-configs.ts
|
|
17854
|
-
import * as
|
|
17855
|
-
import * as
|
|
18180
|
+
import * as fs14 from "node:fs";
|
|
18181
|
+
import * as path15 from "node:path";
|
|
17856
18182
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
17857
18183
|
import { homedir as homedir4 } from "node:os";
|
|
17858
18184
|
|
|
@@ -17866,8 +18192,8 @@ var CURSOR_ALLOWLIST_PATTERN = "argent:*";
|
|
|
17866
18192
|
|
|
17867
18193
|
// ../argent-installer/src/utils.ts
|
|
17868
18194
|
var import_semver2 = __toESM(require_semver2(), 1);
|
|
17869
|
-
import * as
|
|
17870
|
-
import * as
|
|
18195
|
+
import * as fs13 from "node:fs";
|
|
18196
|
+
import * as path14 from "node:path";
|
|
17871
18197
|
import * as dns from "node:dns";
|
|
17872
18198
|
import * as os2 from "node:os";
|
|
17873
18199
|
import { execSync as execSync2 } from "node:child_process";
|
|
@@ -19492,12 +19818,12 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
19492
19818
|
}
|
|
19493
19819
|
return result;
|
|
19494
19820
|
}
|
|
19495
|
-
function findNodeAtLocation(root,
|
|
19821
|
+
function findNodeAtLocation(root, path21) {
|
|
19496
19822
|
if (!root) {
|
|
19497
19823
|
return void 0;
|
|
19498
19824
|
}
|
|
19499
19825
|
let node = root;
|
|
19500
|
-
for (let segment of
|
|
19826
|
+
for (let segment of path21) {
|
|
19501
19827
|
if (typeof segment === "string") {
|
|
19502
19828
|
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
19503
19829
|
return void 0;
|
|
@@ -19851,14 +20177,14 @@ function getNodeType(value) {
|
|
|
19851
20177
|
|
|
19852
20178
|
// ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
19853
20179
|
function setProperty(text2, originalPath, value, options) {
|
|
19854
|
-
const
|
|
20180
|
+
const path21 = originalPath.slice();
|
|
19855
20181
|
const errors = [];
|
|
19856
20182
|
const root = parseTree(text2, errors);
|
|
19857
20183
|
let parent = void 0;
|
|
19858
20184
|
let lastSegment = void 0;
|
|
19859
|
-
while (
|
|
19860
|
-
lastSegment =
|
|
19861
|
-
parent = findNodeAtLocation(root,
|
|
20185
|
+
while (path21.length > 0) {
|
|
20186
|
+
lastSegment = path21.pop();
|
|
20187
|
+
parent = findNodeAtLocation(root, path21);
|
|
19862
20188
|
if (parent === void 0 && value !== void 0) {
|
|
19863
20189
|
if (typeof lastSegment === "string") {
|
|
19864
20190
|
value = { [lastSegment]: value };
|
|
@@ -20044,8 +20370,8 @@ var ParseErrorCode;
|
|
|
20044
20370
|
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
20045
20371
|
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
20046
20372
|
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
20047
|
-
function modify(text2,
|
|
20048
|
-
return setProperty(text2,
|
|
20373
|
+
function modify(text2, path21, value, options) {
|
|
20374
|
+
return setProperty(text2, path21, value, options);
|
|
20049
20375
|
}
|
|
20050
20376
|
function applyEdits(text2, edits) {
|
|
20051
20377
|
let sortedEdits = edits.slice(0).sort((a3, b) => {
|
|
@@ -20069,21 +20395,21 @@ function applyEdits(text2, edits) {
|
|
|
20069
20395
|
}
|
|
20070
20396
|
|
|
20071
20397
|
// ../argent-installer/src/package-root.ts
|
|
20072
|
-
import * as
|
|
20073
|
-
import * as
|
|
20398
|
+
import * as fs8 from "node:fs";
|
|
20399
|
+
import * as path9 from "node:path";
|
|
20074
20400
|
function resolvePackageRoot(dirname15) {
|
|
20075
|
-
let current =
|
|
20401
|
+
let current = path9.resolve(dirname15);
|
|
20076
20402
|
while (true) {
|
|
20077
|
-
if (
|
|
20078
|
-
const parent =
|
|
20079
|
-
if (parent === current) return
|
|
20403
|
+
if (fs8.existsSync(path9.join(current, "package.json"))) return current;
|
|
20404
|
+
const parent = path9.dirname(current);
|
|
20405
|
+
if (parent === current) return path9.resolve(dirname15);
|
|
20080
20406
|
current = parent;
|
|
20081
20407
|
}
|
|
20082
20408
|
}
|
|
20083
20409
|
|
|
20084
20410
|
// ../argent-installer/src/package-manager.ts
|
|
20085
|
-
import * as
|
|
20086
|
-
import * as
|
|
20411
|
+
import * as fs9 from "node:fs";
|
|
20412
|
+
import * as path10 from "node:path";
|
|
20087
20413
|
function formatShellCommand(cmd) {
|
|
20088
20414
|
const parts = [cmd.bin, ...cmd.args.map((a3) => a3.includes(" ") ? `"${a3}"` : a3)];
|
|
20089
20415
|
return parts.join(" ");
|
|
@@ -20100,7 +20426,7 @@ function asKnownPm(name) {
|
|
|
20100
20426
|
}
|
|
20101
20427
|
function pmFromPackageManagerField(dir) {
|
|
20102
20428
|
try {
|
|
20103
|
-
const pkg = JSON.parse(
|
|
20429
|
+
const pkg = JSON.parse(fs9.readFileSync(path10.join(dir, "package.json"), "utf8"));
|
|
20104
20430
|
if (typeof pkg.packageManager === "string") {
|
|
20105
20431
|
return asKnownPm(pkg.packageManager.split("@")[0]);
|
|
20106
20432
|
}
|
|
@@ -20111,7 +20437,7 @@ function pmFromPackageManagerField(dir) {
|
|
|
20111
20437
|
}
|
|
20112
20438
|
function pmFromDevEngines(dir) {
|
|
20113
20439
|
try {
|
|
20114
|
-
const pkg = JSON.parse(
|
|
20440
|
+
const pkg = JSON.parse(fs9.readFileSync(path10.join(dir, "package.json"), "utf8"));
|
|
20115
20441
|
const devEnginesPm = pkg.devEngines?.packageManager;
|
|
20116
20442
|
const names = /* @__PURE__ */ new Set();
|
|
20117
20443
|
for (const entry of Array.isArray(devEnginesPm) ? devEnginesPm : [devEnginesPm]) {
|
|
@@ -20124,7 +20450,7 @@ function pmFromDevEngines(dir) {
|
|
|
20124
20450
|
}
|
|
20125
20451
|
}
|
|
20126
20452
|
function pmFromLockfile(dir) {
|
|
20127
|
-
const has = (file) =>
|
|
20453
|
+
const has = (file) => fs9.existsSync(path10.join(dir, file));
|
|
20128
20454
|
if (has("pnpm-lock.yaml")) return "pnpm";
|
|
20129
20455
|
if (has("yarn.lock")) return "yarn";
|
|
20130
20456
|
if (has("bun.lock") || has("bun.lockb")) return "bun";
|
|
@@ -20132,15 +20458,15 @@ function pmFromLockfile(dir) {
|
|
|
20132
20458
|
return null;
|
|
20133
20459
|
}
|
|
20134
20460
|
function pmFromWorkspaceMarker(dir) {
|
|
20135
|
-
return
|
|
20461
|
+
return fs9.existsSync(path10.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
|
|
20136
20462
|
}
|
|
20137
20463
|
function detectProjectPackageManager(projectRoot) {
|
|
20138
|
-
let dir =
|
|
20464
|
+
let dir = path10.resolve(projectRoot);
|
|
20139
20465
|
for (; ; ) {
|
|
20140
20466
|
const pm = pmFromPackageManagerField(dir) ?? pmFromLockfile(dir) ?? pmFromDevEngines(dir) ?? pmFromWorkspaceMarker(dir);
|
|
20141
20467
|
if (pm) return pm;
|
|
20142
|
-
if (
|
|
20143
|
-
const parent =
|
|
20468
|
+
if (fs9.existsSync(path10.join(dir, ".git"))) break;
|
|
20469
|
+
const parent = path10.dirname(dir);
|
|
20144
20470
|
if (parent === dir) break;
|
|
20145
20471
|
dir = parent;
|
|
20146
20472
|
}
|
|
@@ -20208,19 +20534,19 @@ function localUninstallCommand(pm, pkg) {
|
|
|
20208
20534
|
}
|
|
20209
20535
|
|
|
20210
20536
|
// ../argent-installer/src/preflight.ts
|
|
20211
|
-
import * as
|
|
20212
|
-
import * as
|
|
20537
|
+
import * as fs10 from "node:fs";
|
|
20538
|
+
import * as path11 from "node:path";
|
|
20213
20539
|
function hasProjectPackageJson(projectRoot) {
|
|
20214
|
-
return
|
|
20540
|
+
return fs10.existsSync(path11.join(projectRoot, "package.json"));
|
|
20215
20541
|
}
|
|
20216
20542
|
function isYarnPnp(projectRoot) {
|
|
20217
|
-
return
|
|
20543
|
+
return fs10.existsSync(path11.join(projectRoot, ".pnp.cjs")) || fs10.existsSync(path11.join(projectRoot, ".pnp.loader.mjs"));
|
|
20218
20544
|
}
|
|
20219
20545
|
|
|
20220
20546
|
// ../argent-installer/src/topology.ts
|
|
20221
20547
|
var import_semver = __toESM(require_semver2(), 1);
|
|
20222
|
-
import * as
|
|
20223
|
-
import * as
|
|
20548
|
+
import * as fs11 from "node:fs";
|
|
20549
|
+
import * as path12 from "node:path";
|
|
20224
20550
|
import { createRequire } from "node:module";
|
|
20225
20551
|
import { execSync } from "node:child_process";
|
|
20226
20552
|
var TEMP_RUNNER_MARKERS = [
|
|
@@ -20252,9 +20578,9 @@ function getGloballyInstalledPackageRoot() {
|
|
|
20252
20578
|
const binaryPath = getGlobalBinaryPath();
|
|
20253
20579
|
if (!binaryPath) return null;
|
|
20254
20580
|
try {
|
|
20255
|
-
const realPath =
|
|
20256
|
-
const root = resolvePackageRoot(
|
|
20257
|
-
const pkg = JSON.parse(
|
|
20581
|
+
const realPath = fs11.realpathSync(binaryPath);
|
|
20582
|
+
const root = resolvePackageRoot(path12.dirname(realPath));
|
|
20583
|
+
const pkg = JSON.parse(fs11.readFileSync(path12.join(root, "package.json"), "utf8"));
|
|
20258
20584
|
return pkg.name === PACKAGE_NAME ? root : null;
|
|
20259
20585
|
} catch {
|
|
20260
20586
|
return null;
|
|
@@ -20264,7 +20590,7 @@ function getGloballyInstalledVersion() {
|
|
|
20264
20590
|
const pkgRoot = getGloballyInstalledPackageRoot();
|
|
20265
20591
|
if (!pkgRoot) return null;
|
|
20266
20592
|
try {
|
|
20267
|
-
const pkg = JSON.parse(
|
|
20593
|
+
const pkg = JSON.parse(fs11.readFileSync(path12.join(pkgRoot, "package.json"), "utf8"));
|
|
20268
20594
|
return pkg.version ?? null;
|
|
20269
20595
|
} catch {
|
|
20270
20596
|
return null;
|
|
@@ -20273,7 +20599,7 @@ function getGloballyInstalledVersion() {
|
|
|
20273
20599
|
function readManifestDeclaration(projectRoot) {
|
|
20274
20600
|
try {
|
|
20275
20601
|
const pkg = JSON.parse(
|
|
20276
|
-
|
|
20602
|
+
fs11.readFileSync(path12.join(projectRoot, "package.json"), "utf8")
|
|
20277
20603
|
);
|
|
20278
20604
|
const spec = pkg.devDependencies?.[PACKAGE_NAME] ?? pkg.dependencies?.[PACKAGE_NAME] ?? pkg.optionalDependencies?.[PACKAGE_NAME];
|
|
20279
20605
|
return typeof spec === "string" ? spec : null;
|
|
@@ -20286,11 +20612,11 @@ function isDeclaredLocally(projectRoot) {
|
|
|
20286
20612
|
}
|
|
20287
20613
|
function resolveLocalArgentDir(projectRoot) {
|
|
20288
20614
|
try {
|
|
20289
|
-
const req = createRequire(
|
|
20290
|
-
return
|
|
20615
|
+
const req = createRequire(path12.join(projectRoot, "package.json"));
|
|
20616
|
+
return path12.dirname(req.resolve(`${PACKAGE_NAME}/package.json`));
|
|
20291
20617
|
} catch {
|
|
20292
|
-
const plain =
|
|
20293
|
-
return
|
|
20618
|
+
const plain = path12.join(projectRoot, "node_modules", PACKAGE_NAME);
|
|
20619
|
+
return fs11.existsSync(path12.join(plain, "package.json")) ? plain : null;
|
|
20294
20620
|
}
|
|
20295
20621
|
}
|
|
20296
20622
|
function probeLocalInstall(projectRoot) {
|
|
@@ -20298,7 +20624,7 @@ function probeLocalInstall(projectRoot) {
|
|
|
20298
20624
|
if (packageDir) {
|
|
20299
20625
|
let version2;
|
|
20300
20626
|
try {
|
|
20301
|
-
const pkg = JSON.parse(
|
|
20627
|
+
const pkg = JSON.parse(fs11.readFileSync(path12.join(packageDir, "package.json"), "utf8"));
|
|
20302
20628
|
version2 = pkg.version ?? null;
|
|
20303
20629
|
} catch {
|
|
20304
20630
|
version2 = null;
|
|
@@ -20321,8 +20647,8 @@ function getLocallyInstalledVersion(projectRoot) {
|
|
|
20321
20647
|
}
|
|
20322
20648
|
function readLocalPackageVersionUncached(projectRoot) {
|
|
20323
20649
|
try {
|
|
20324
|
-
const pkgPath =
|
|
20325
|
-
const pkg = JSON.parse(
|
|
20650
|
+
const pkgPath = path12.join(projectRoot, "node_modules", PACKAGE_NAME, "package.json");
|
|
20651
|
+
const pkg = JSON.parse(fs11.readFileSync(pkgPath, "utf8"));
|
|
20326
20652
|
return pkg.version ?? null;
|
|
20327
20653
|
} catch {
|
|
20328
20654
|
return null;
|
|
@@ -20333,7 +20659,7 @@ function getLocalArgentBinRelPath(projectRoot) {
|
|
|
20333
20659
|
if (!pkgDir) return null;
|
|
20334
20660
|
let binSub;
|
|
20335
20661
|
try {
|
|
20336
|
-
const pkg = JSON.parse(
|
|
20662
|
+
const pkg = JSON.parse(fs11.readFileSync(path12.join(pkgDir, "package.json"), "utf8"));
|
|
20337
20663
|
if (typeof pkg.bin === "string") binSub = pkg.bin;
|
|
20338
20664
|
else if (pkg.bin && typeof pkg.bin === "object")
|
|
20339
20665
|
binSub = pkg.bin[MCP_BINARY_NAME] ?? Object.values(pkg.bin)[0];
|
|
@@ -20343,28 +20669,28 @@ function getLocalArgentBinRelPath(projectRoot) {
|
|
|
20343
20669
|
if (!binSub) return null;
|
|
20344
20670
|
let root = projectRoot;
|
|
20345
20671
|
try {
|
|
20346
|
-
root =
|
|
20672
|
+
root = fs11.realpathSync(projectRoot);
|
|
20347
20673
|
} catch {
|
|
20348
20674
|
}
|
|
20349
|
-
const stableRel =
|
|
20350
|
-
if (
|
|
20351
|
-
return stableRel.split(
|
|
20675
|
+
const stableRel = path12.join("node_modules", PACKAGE_NAME, binSub);
|
|
20676
|
+
if (fs11.existsSync(path12.join(root, stableRel))) {
|
|
20677
|
+
return stableRel.split(path12.sep).join("/");
|
|
20352
20678
|
}
|
|
20353
|
-
const abs =
|
|
20354
|
-
if (!
|
|
20355
|
-
return
|
|
20679
|
+
const abs = path12.join(pkgDir, binSub);
|
|
20680
|
+
if (!fs11.existsSync(abs)) return null;
|
|
20681
|
+
return path12.relative(root, abs).split(path12.sep).join("/");
|
|
20356
20682
|
}
|
|
20357
20683
|
|
|
20358
20684
|
// ../argent-installer/src/install-record.ts
|
|
20359
|
-
import * as
|
|
20360
|
-
import * as
|
|
20685
|
+
import * as fs12 from "node:fs";
|
|
20686
|
+
import * as path13 from "node:path";
|
|
20361
20687
|
function getInstallRecordPath(projectRoot) {
|
|
20362
|
-
return
|
|
20688
|
+
return path13.join(projectRoot, ".argent", "install.json");
|
|
20363
20689
|
}
|
|
20364
20690
|
function readInstallRecord(projectRoot) {
|
|
20365
20691
|
try {
|
|
20366
20692
|
const parsed = JSON.parse(
|
|
20367
|
-
|
|
20693
|
+
fs12.readFileSync(getInstallRecordPath(projectRoot), "utf8")
|
|
20368
20694
|
);
|
|
20369
20695
|
if (parsed && (parsed.mode === "local" || parsed.mode === "global")) return parsed;
|
|
20370
20696
|
return null;
|
|
@@ -20374,17 +20700,17 @@ function readInstallRecord(projectRoot) {
|
|
|
20374
20700
|
}
|
|
20375
20701
|
function writeInstallRecord(projectRoot, record) {
|
|
20376
20702
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20377
|
-
|
|
20378
|
-
|
|
20703
|
+
fs12.mkdirSync(path13.dirname(recordPath), { recursive: true });
|
|
20704
|
+
fs12.writeFileSync(recordPath, JSON.stringify(record, null, 2) + "\n");
|
|
20379
20705
|
}
|
|
20380
20706
|
function removeInstallRecord(projectRoot) {
|
|
20381
20707
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20382
20708
|
try {
|
|
20383
|
-
if (!
|
|
20384
|
-
|
|
20385
|
-
const dir =
|
|
20709
|
+
if (!fs12.existsSync(recordPath)) return false;
|
|
20710
|
+
fs12.rmSync(recordPath, { force: true });
|
|
20711
|
+
const dir = path13.dirname(recordPath);
|
|
20386
20712
|
try {
|
|
20387
|
-
if (
|
|
20713
|
+
if (fs12.existsSync(dir) && fs12.readdirSync(dir).length === 0) fs12.rmdirSync(dir);
|
|
20388
20714
|
} catch {
|
|
20389
20715
|
}
|
|
20390
20716
|
return true;
|
|
@@ -20458,9 +20784,9 @@ async function promptInstallTargets(verb) {
|
|
|
20458
20784
|
// ../argent-installer/src/utils.ts
|
|
20459
20785
|
var PACKAGE_ROOT = resolvePackageRoot(import.meta.dirname);
|
|
20460
20786
|
function resolveBundledDir(dirName) {
|
|
20461
|
-
const packagedDir =
|
|
20462
|
-
if (
|
|
20463
|
-
return
|
|
20787
|
+
const packagedDir = path14.join(PACKAGE_ROOT, dirName);
|
|
20788
|
+
if (fs13.existsSync(packagedDir)) return packagedDir;
|
|
20789
|
+
return path14.resolve(PACKAGE_ROOT, "..", "skills", dirName);
|
|
20464
20790
|
}
|
|
20465
20791
|
var SKILLS_DIR = resolveBundledDir("skills");
|
|
20466
20792
|
var RULES_DIR = resolveBundledDir("rules");
|
|
@@ -20472,23 +20798,23 @@ function buildArgentSkillsSource(version2) {
|
|
|
20472
20798
|
}
|
|
20473
20799
|
function listBundledSkills(skillsDir = SKILLS_DIR) {
|
|
20474
20800
|
try {
|
|
20475
|
-
return
|
|
20801
|
+
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();
|
|
20476
20802
|
} catch {
|
|
20477
20803
|
return [];
|
|
20478
20804
|
}
|
|
20479
20805
|
}
|
|
20480
20806
|
function getProjectSkillLockPath(cwd = process.cwd()) {
|
|
20481
|
-
return
|
|
20807
|
+
return path14.join(cwd, "skills-lock.json");
|
|
20482
20808
|
}
|
|
20483
20809
|
function getGlobalSkillLockPath() {
|
|
20484
20810
|
const xdgStateHome = process.env.XDG_STATE_HOME;
|
|
20485
|
-
if (xdgStateHome) return
|
|
20486
|
-
return
|
|
20811
|
+
if (xdgStateHome) return path14.join(xdgStateHome, "skills", ".skill-lock.json");
|
|
20812
|
+
return path14.join(os2.homedir(), ".agents", ".skill-lock.json");
|
|
20487
20813
|
}
|
|
20488
20814
|
var ARGENT_SKILL_PREFIX = "argent-";
|
|
20489
20815
|
function listArgentSkillsInLock(lockPath) {
|
|
20490
20816
|
try {
|
|
20491
|
-
const raw =
|
|
20817
|
+
const raw = fs13.readFileSync(lockPath, "utf8");
|
|
20492
20818
|
const lock = JSON.parse(raw);
|
|
20493
20819
|
const tracked = lock.skills ?? {};
|
|
20494
20820
|
return Object.keys(tracked).filter((name) => name.startsWith(ARGENT_SKILL_PREFIX)).sort();
|
|
@@ -20512,16 +20838,16 @@ var PROJECT_ROOT_MARKERS = [
|
|
|
20512
20838
|
"skills-lock.json"
|
|
20513
20839
|
];
|
|
20514
20840
|
function resolveProjectRoot2(startDir) {
|
|
20515
|
-
const initialDir =
|
|
20841
|
+
const initialDir = path14.resolve(startDir);
|
|
20516
20842
|
let currentDir = initialDir;
|
|
20517
20843
|
while (true) {
|
|
20518
|
-
if (PROJECT_ROOT_MARKERS.some((marker) =>
|
|
20844
|
+
if (PROJECT_ROOT_MARKERS.some((marker) => fs13.existsSync(path14.join(currentDir, marker)))) {
|
|
20519
20845
|
return currentDir;
|
|
20520
20846
|
}
|
|
20521
|
-
if (
|
|
20847
|
+
if (fs13.existsSync(path14.join(currentDir, ".git"))) {
|
|
20522
20848
|
return currentDir;
|
|
20523
20849
|
}
|
|
20524
|
-
const parentDir =
|
|
20850
|
+
const parentDir = path14.dirname(currentDir);
|
|
20525
20851
|
if (parentDir === currentDir) {
|
|
20526
20852
|
return initialDir;
|
|
20527
20853
|
}
|
|
@@ -20529,20 +20855,20 @@ function resolveProjectRoot2(startDir) {
|
|
|
20529
20855
|
}
|
|
20530
20856
|
}
|
|
20531
20857
|
function readToml(filePath) {
|
|
20532
|
-
if (!
|
|
20858
|
+
if (!fs13.existsSync(filePath)) return {};
|
|
20533
20859
|
try {
|
|
20534
|
-
return parse(
|
|
20860
|
+
return parse(fs13.readFileSync(filePath, "utf8"));
|
|
20535
20861
|
} catch {
|
|
20536
20862
|
return {};
|
|
20537
20863
|
}
|
|
20538
20864
|
}
|
|
20539
20865
|
function writeToml(filePath, data) {
|
|
20540
|
-
|
|
20541
|
-
|
|
20866
|
+
fs13.mkdirSync(path14.dirname(filePath), { recursive: true });
|
|
20867
|
+
fs13.writeFileSync(filePath, stringify(data) + "\n");
|
|
20542
20868
|
}
|
|
20543
20869
|
function readYaml(filePath) {
|
|
20544
|
-
if (!
|
|
20545
|
-
const text2 =
|
|
20870
|
+
if (!fs13.existsSync(filePath)) return new import_yaml.Document({});
|
|
20871
|
+
const text2 = fs13.readFileSync(filePath, "utf8");
|
|
20546
20872
|
const doc = (0, import_yaml.parseDocument)(text2);
|
|
20547
20873
|
if (doc.errors.length > 0) {
|
|
20548
20874
|
const messages = doc.errors.map((e) => e.message).join("; ");
|
|
@@ -20551,20 +20877,20 @@ function readYaml(filePath) {
|
|
|
20551
20877
|
return doc;
|
|
20552
20878
|
}
|
|
20553
20879
|
function writeYaml(filePath, doc) {
|
|
20554
|
-
|
|
20555
|
-
|
|
20880
|
+
fs13.mkdirSync(path14.dirname(filePath), { recursive: true });
|
|
20881
|
+
fs13.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
|
|
20556
20882
|
}
|
|
20557
20883
|
function readJson(filePath) {
|
|
20558
|
-
if (!
|
|
20884
|
+
if (!fs13.existsSync(filePath)) return {};
|
|
20559
20885
|
try {
|
|
20560
|
-
return JSON.parse(
|
|
20886
|
+
return JSON.parse(fs13.readFileSync(filePath, "utf8"));
|
|
20561
20887
|
} catch {
|
|
20562
20888
|
return {};
|
|
20563
20889
|
}
|
|
20564
20890
|
}
|
|
20565
20891
|
function writeJson(filePath, data) {
|
|
20566
|
-
|
|
20567
|
-
|
|
20892
|
+
fs13.mkdirSync(path14.dirname(filePath), { recursive: true });
|
|
20893
|
+
fs13.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
|
|
20568
20894
|
}
|
|
20569
20895
|
var JSONC_FORMATTING = { tabSize: 2, insertSpaces: true };
|
|
20570
20896
|
function setJsoncIn(text2, jsonPath, value) {
|
|
@@ -20572,8 +20898,8 @@ function setJsoncIn(text2, jsonPath, value) {
|
|
|
20572
20898
|
return applyEdits(text2, edits);
|
|
20573
20899
|
}
|
|
20574
20900
|
function readJsoncFileRaw(filePath) {
|
|
20575
|
-
if (!
|
|
20576
|
-
let text2 =
|
|
20901
|
+
if (!fs13.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
|
|
20902
|
+
let text2 = fs13.readFileSync(filePath, "utf8");
|
|
20577
20903
|
const hadBom = text2.charCodeAt(0) === 65279;
|
|
20578
20904
|
if (hadBom) text2 = text2.slice(1);
|
|
20579
20905
|
const wasEmpty = text2.trim() === "";
|
|
@@ -20593,16 +20919,16 @@ function isEmptyPlainObject(value) {
|
|
|
20593
20919
|
}
|
|
20594
20920
|
function rmEmptyDir(dirPath) {
|
|
20595
20921
|
try {
|
|
20596
|
-
if (!
|
|
20597
|
-
if (!
|
|
20598
|
-
if (
|
|
20599
|
-
|
|
20922
|
+
if (!fs13.existsSync(dirPath)) return;
|
|
20923
|
+
if (!fs13.statSync(dirPath).isDirectory()) return;
|
|
20924
|
+
if (fs13.readdirSync(dirPath).length > 0) return;
|
|
20925
|
+
fs13.rmdirSync(dirPath);
|
|
20600
20926
|
} catch {
|
|
20601
20927
|
}
|
|
20602
20928
|
}
|
|
20603
20929
|
function readJsonc(filePath) {
|
|
20604
|
-
if (!
|
|
20605
|
-
let raw =
|
|
20930
|
+
if (!fs13.existsSync(filePath)) return {};
|
|
20931
|
+
let raw = fs13.readFileSync(filePath, "utf8");
|
|
20606
20932
|
if (raw.charCodeAt(0) === 65279) raw = raw.slice(1);
|
|
20607
20933
|
if (raw.trim() === "") return {};
|
|
20608
20934
|
const parsed = parse3(raw, [], { allowTrailingComma: true });
|
|
@@ -20621,25 +20947,67 @@ function editJsoncFile(filePath, jsonPath, value) {
|
|
|
20621
20947
|
}
|
|
20622
20948
|
const parsed = parse3(text2, [], { allowTrailingComma: true });
|
|
20623
20949
|
if (isEmptyPlainObject(parsed)) {
|
|
20624
|
-
|
|
20625
|
-
rmEmptyDir(
|
|
20950
|
+
fs13.rmSync(filePath, { force: true });
|
|
20951
|
+
rmEmptyDir(path14.dirname(filePath));
|
|
20626
20952
|
return;
|
|
20627
20953
|
}
|
|
20628
|
-
|
|
20954
|
+
fs13.mkdirSync(path14.dirname(filePath), { recursive: true });
|
|
20629
20955
|
const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
|
|
20630
|
-
|
|
20956
|
+
fs13.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
|
|
20957
|
+
}
|
|
20958
|
+
var MAX_SYMLINK_HOPS = 40;
|
|
20959
|
+
function realpathOrSelf(p) {
|
|
20960
|
+
try {
|
|
20961
|
+
return fs13.realpathSync(p);
|
|
20962
|
+
} catch {
|
|
20963
|
+
return p;
|
|
20964
|
+
}
|
|
20965
|
+
}
|
|
20966
|
+
function resolveLinkedDestination(dest) {
|
|
20967
|
+
let current = dest;
|
|
20968
|
+
for (let hop = 0; hop < MAX_SYMLINK_HOPS; hop++) {
|
|
20969
|
+
let entry;
|
|
20970
|
+
try {
|
|
20971
|
+
entry = fs13.lstatSync(current);
|
|
20972
|
+
} catch {
|
|
20973
|
+
return current === dest || dirExists(path14.dirname(current)) ? current : dest;
|
|
20974
|
+
}
|
|
20975
|
+
if (!entry.isSymbolicLink()) return current;
|
|
20976
|
+
try {
|
|
20977
|
+
current = path14.resolve(realpathOrSelf(path14.dirname(current)), fs13.readlinkSync(current));
|
|
20978
|
+
} catch {
|
|
20979
|
+
return dest;
|
|
20980
|
+
}
|
|
20981
|
+
}
|
|
20982
|
+
return dest;
|
|
20983
|
+
}
|
|
20984
|
+
function copyDir(src, dest) {
|
|
20985
|
+
if (!fs13.existsSync(src)) return null;
|
|
20986
|
+
const target = resolveLinkedDestination(dest);
|
|
20987
|
+
copyTree(src, target);
|
|
20988
|
+
return target;
|
|
20989
|
+
}
|
|
20990
|
+
function copyTree(src, dest) {
|
|
20991
|
+
const entries = fs13.readdirSync(src, { withFileTypes: true });
|
|
20992
|
+
fs13.mkdirSync(dest, { recursive: true });
|
|
20993
|
+
for (const entry of entries) {
|
|
20994
|
+
const from = path14.join(src, entry.name);
|
|
20995
|
+
const to = resolveLinkedDestination(path14.join(dest, entry.name));
|
|
20996
|
+
if (entry.isDirectory()) copyTree(from, to);
|
|
20997
|
+
else fs13.copyFileSync(from, to);
|
|
20998
|
+
}
|
|
20631
20999
|
}
|
|
20632
21000
|
function dirExists(p) {
|
|
20633
21001
|
try {
|
|
20634
|
-
return
|
|
21002
|
+
return fs13.statSync(p).isDirectory();
|
|
20635
21003
|
} catch {
|
|
20636
21004
|
return false;
|
|
20637
21005
|
}
|
|
20638
21006
|
}
|
|
20639
21007
|
function getInstalledVersion() {
|
|
20640
21008
|
try {
|
|
20641
|
-
const pkgPath =
|
|
20642
|
-
const pkg = JSON.parse(
|
|
21009
|
+
const pkgPath = path14.join(PACKAGE_ROOT, "package.json");
|
|
21010
|
+
const pkg = JSON.parse(fs13.readFileSync(pkgPath, "utf8"));
|
|
20643
21011
|
return pkg.version ?? null;
|
|
20644
21012
|
} catch {
|
|
20645
21013
|
return null;
|
|
@@ -20678,12 +21046,12 @@ async function isOnline(timeoutMs = PROBE_TIMEOUT_MS) {
|
|
|
20678
21046
|
} catch {
|
|
20679
21047
|
return false;
|
|
20680
21048
|
}
|
|
20681
|
-
return new Promise((
|
|
20682
|
-
const timer = setTimeout(() =>
|
|
21049
|
+
return new Promise((resolve13) => {
|
|
21050
|
+
const timer = setTimeout(() => resolve13(false), timeoutMs);
|
|
20683
21051
|
timer.unref();
|
|
20684
21052
|
dns.lookup(host, (err) => {
|
|
20685
21053
|
clearTimeout(timer);
|
|
20686
|
-
|
|
21054
|
+
resolve13(!err);
|
|
20687
21055
|
});
|
|
20688
21056
|
});
|
|
20689
21057
|
}
|
|
@@ -20700,7 +21068,7 @@ function escapeStringRegexp(string) {
|
|
|
20700
21068
|
}
|
|
20701
21069
|
|
|
20702
21070
|
// ../argent-installer/src/mcp-configs.ts
|
|
20703
|
-
var TOOL_SERVER_BUNDLE =
|
|
21071
|
+
var TOOL_SERVER_BUNDLE = path15.join(import.meta.dirname, "tool-server.cjs");
|
|
20704
21072
|
function getAvailableToolIds() {
|
|
20705
21073
|
const out = execFileSync2("node", [TOOL_SERVER_BUNDLE, "-t"], { encoding: "utf8" });
|
|
20706
21074
|
const tools = JSON.parse(out);
|
|
@@ -20739,10 +21107,10 @@ function hasCustomizingEnv(entry) {
|
|
|
20739
21107
|
}
|
|
20740
21108
|
function removeDirIfEmpty(dirPath) {
|
|
20741
21109
|
try {
|
|
20742
|
-
if (!
|
|
20743
|
-
if (!
|
|
20744
|
-
if (
|
|
20745
|
-
|
|
21110
|
+
if (!fs14.existsSync(dirPath)) return;
|
|
21111
|
+
if (!fs14.statSync(dirPath).isDirectory()) return;
|
|
21112
|
+
if (fs14.readdirSync(dirPath).length > 0) return;
|
|
21113
|
+
fs14.rmdirSync(dirPath);
|
|
20746
21114
|
} catch {
|
|
20747
21115
|
}
|
|
20748
21116
|
}
|
|
@@ -20779,7 +21147,7 @@ function isArgentManagedEntry(entry) {
|
|
|
20779
21147
|
return args.length === 1 && args[0] === "mcp";
|
|
20780
21148
|
case "node": {
|
|
20781
21149
|
if (args.length !== 2 || args[1] !== "mcp" || !args[0]) return false;
|
|
20782
|
-
if (
|
|
21150
|
+
if (path15.isAbsolute(args[0])) return false;
|
|
20783
21151
|
const normalized = args[0].split("\\").join("/");
|
|
20784
21152
|
return normalized.includes(`node_modules/${PACKAGE_NAME}/`);
|
|
20785
21153
|
}
|
|
@@ -20793,8 +21161,8 @@ function isArgentManagedEntry(entry) {
|
|
|
20793
21161
|
}
|
|
20794
21162
|
function writeTomlOrRemove(filePath, data) {
|
|
20795
21163
|
if (Object.keys(data).length === 0) {
|
|
20796
|
-
|
|
20797
|
-
removeDirIfEmpty(
|
|
21164
|
+
fs14.rmSync(filePath, { force: true });
|
|
21165
|
+
removeDirIfEmpty(path15.dirname(filePath));
|
|
20798
21166
|
return;
|
|
20799
21167
|
}
|
|
20800
21168
|
writeToml(filePath, data);
|
|
@@ -20803,12 +21171,12 @@ function dirHasEditorEvidence(dir, looksArgentOnly) {
|
|
|
20803
21171
|
return dirExists(dir) && !looksArgentOnly(dir);
|
|
20804
21172
|
}
|
|
20805
21173
|
function fileHasEditorEvidence(filePath, looksArgentOnly) {
|
|
20806
|
-
return
|
|
21174
|
+
return fs14.existsSync(filePath) && !looksArgentOnly(filePath);
|
|
20807
21175
|
}
|
|
20808
21176
|
function parseJsoncStrict(filePath) {
|
|
20809
21177
|
let raw;
|
|
20810
21178
|
try {
|
|
20811
|
-
raw =
|
|
21179
|
+
raw = fs14.readFileSync(filePath, "utf8");
|
|
20812
21180
|
} catch {
|
|
20813
21181
|
return null;
|
|
20814
21182
|
}
|
|
@@ -20821,14 +21189,14 @@ function parseJsoncStrict(filePath) {
|
|
|
20821
21189
|
}
|
|
20822
21190
|
function parseTomlStrict(filePath) {
|
|
20823
21191
|
try {
|
|
20824
|
-
return parse(
|
|
21192
|
+
return parse(fs14.readFileSync(filePath, "utf8"));
|
|
20825
21193
|
} catch {
|
|
20826
21194
|
return null;
|
|
20827
21195
|
}
|
|
20828
21196
|
}
|
|
20829
21197
|
function parseYamlStrict(filePath) {
|
|
20830
21198
|
try {
|
|
20831
|
-
const parsed = (0, import_yaml2.parse)(
|
|
21199
|
+
const parsed = (0, import_yaml2.parse)(fs14.readFileSync(filePath, "utf8"));
|
|
20832
21200
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
20833
21201
|
return parsed;
|
|
20834
21202
|
} catch {
|
|
@@ -20851,7 +21219,7 @@ function bundledManagedNames(kind) {
|
|
|
20851
21219
|
if (cached2) return cached2;
|
|
20852
21220
|
let names;
|
|
20853
21221
|
try {
|
|
20854
|
-
names = new Set(
|
|
21222
|
+
names = new Set(fs14.readdirSync(kind === "rules" ? RULES_DIR : AGENTS_DIR));
|
|
20855
21223
|
} catch {
|
|
20856
21224
|
names = /* @__PURE__ */ new Set();
|
|
20857
21225
|
}
|
|
@@ -20861,7 +21229,7 @@ function bundledManagedNames(kind) {
|
|
|
20861
21229
|
function managedDirLooksArgentOnly(dir, kind) {
|
|
20862
21230
|
let entries;
|
|
20863
21231
|
try {
|
|
20864
|
-
entries =
|
|
21232
|
+
entries = fs14.readdirSync(dir);
|
|
20865
21233
|
} catch {
|
|
20866
21234
|
return false;
|
|
20867
21235
|
}
|
|
@@ -20873,13 +21241,13 @@ function managedDirLooksArgentOnly(dir, kind) {
|
|
|
20873
21241
|
function cursorDirLooksArgentOnly(dir) {
|
|
20874
21242
|
let entries;
|
|
20875
21243
|
try {
|
|
20876
|
-
entries =
|
|
21244
|
+
entries = fs14.readdirSync(dir);
|
|
20877
21245
|
} catch {
|
|
20878
21246
|
return false;
|
|
20879
21247
|
}
|
|
20880
21248
|
if (entries.length === 0) return false;
|
|
20881
21249
|
return entries.every((entry) => {
|
|
20882
|
-
const full =
|
|
21250
|
+
const full = path15.join(dir, entry);
|
|
20883
21251
|
if (entry === "mcp.json") {
|
|
20884
21252
|
return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
20885
21253
|
}
|
|
@@ -20912,13 +21280,13 @@ function claudeSettingsLooksArgentOnly(filePath) {
|
|
|
20912
21280
|
function claudeDirLooksArgentOnly(dir) {
|
|
20913
21281
|
let entries;
|
|
20914
21282
|
try {
|
|
20915
|
-
entries =
|
|
21283
|
+
entries = fs14.readdirSync(dir);
|
|
20916
21284
|
} catch {
|
|
20917
21285
|
return false;
|
|
20918
21286
|
}
|
|
20919
21287
|
if (entries.length === 0) return false;
|
|
20920
21288
|
return entries.every((entry) => {
|
|
20921
|
-
const full =
|
|
21289
|
+
const full = path15.join(dir, entry);
|
|
20922
21290
|
if (entry === "settings.json") return claudeSettingsLooksArgentOnly(full);
|
|
20923
21291
|
if (entry === "rules" || entry === "agents" || entry === "skills") {
|
|
20924
21292
|
return managedDirLooksArgentOnly(full, entry);
|
|
@@ -20929,25 +21297,25 @@ function claudeDirLooksArgentOnly(dir) {
|
|
|
20929
21297
|
function vscodeDirLooksArgentOnly(dir) {
|
|
20930
21298
|
let entries;
|
|
20931
21299
|
try {
|
|
20932
|
-
entries =
|
|
21300
|
+
entries = fs14.readdirSync(dir);
|
|
20933
21301
|
} catch {
|
|
20934
21302
|
return false;
|
|
20935
21303
|
}
|
|
20936
21304
|
if (entries.length === 0) return false;
|
|
20937
21305
|
return entries.every(
|
|
20938
|
-
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(
|
|
21306
|
+
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(path15.join(dir, entry), "servers")
|
|
20939
21307
|
);
|
|
20940
21308
|
}
|
|
20941
21309
|
function windsurfDirLooksArgentOnly(dir) {
|
|
20942
21310
|
let entries;
|
|
20943
21311
|
try {
|
|
20944
|
-
entries =
|
|
21312
|
+
entries = fs14.readdirSync(dir);
|
|
20945
21313
|
} catch {
|
|
20946
21314
|
return false;
|
|
20947
21315
|
}
|
|
20948
21316
|
if (entries.length === 0) return false;
|
|
20949
21317
|
return entries.every(
|
|
20950
|
-
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(
|
|
21318
|
+
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(path15.join(dir, entry), "mcpServers")
|
|
20951
21319
|
);
|
|
20952
21320
|
}
|
|
20953
21321
|
function zedSettingsLooksArgentOnly(filePath) {
|
|
@@ -20978,25 +21346,25 @@ function zedSettingsLooksArgentOnly(filePath) {
|
|
|
20978
21346
|
function zedDirLooksArgentOnly(dir) {
|
|
20979
21347
|
let entries;
|
|
20980
21348
|
try {
|
|
20981
|
-
entries =
|
|
21349
|
+
entries = fs14.readdirSync(dir);
|
|
20982
21350
|
} catch {
|
|
20983
21351
|
return false;
|
|
20984
21352
|
}
|
|
20985
21353
|
if (entries.length === 0) return false;
|
|
20986
21354
|
return entries.every(
|
|
20987
|
-
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(
|
|
21355
|
+
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(path15.join(dir, entry))
|
|
20988
21356
|
);
|
|
20989
21357
|
}
|
|
20990
21358
|
function geminiDirLooksArgentOnly(dir) {
|
|
20991
21359
|
let entries;
|
|
20992
21360
|
try {
|
|
20993
|
-
entries =
|
|
21361
|
+
entries = fs14.readdirSync(dir);
|
|
20994
21362
|
} catch {
|
|
20995
21363
|
return false;
|
|
20996
21364
|
}
|
|
20997
21365
|
if (entries.length === 0) return false;
|
|
20998
21366
|
return entries.every((entry) => {
|
|
20999
|
-
const full =
|
|
21367
|
+
const full = path15.join(dir, entry);
|
|
21000
21368
|
if (entry === "settings.json") return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
21001
21369
|
if (entry === "rules" || entry === "agents") return managedDirLooksArgentOnly(full, entry);
|
|
21002
21370
|
return false;
|
|
@@ -21015,48 +21383,48 @@ function hermesConfigLooksArgentOnly(filePath) {
|
|
|
21015
21383
|
function hermesDirLooksArgentOnly(dir) {
|
|
21016
21384
|
let entries;
|
|
21017
21385
|
try {
|
|
21018
|
-
entries =
|
|
21386
|
+
entries = fs14.readdirSync(dir);
|
|
21019
21387
|
} catch {
|
|
21020
21388
|
return false;
|
|
21021
21389
|
}
|
|
21022
21390
|
if (entries.length === 0) return false;
|
|
21023
21391
|
return entries.every(
|
|
21024
|
-
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(
|
|
21392
|
+
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(path15.join(dir, entry))
|
|
21025
21393
|
);
|
|
21026
21394
|
}
|
|
21027
21395
|
function kiroDirLooksArgentOnly(dir) {
|
|
21028
21396
|
let entries;
|
|
21029
21397
|
try {
|
|
21030
|
-
entries =
|
|
21398
|
+
entries = fs14.readdirSync(dir);
|
|
21031
21399
|
} catch {
|
|
21032
21400
|
return false;
|
|
21033
21401
|
}
|
|
21034
21402
|
if (entries.length === 0) return false;
|
|
21035
21403
|
return entries.every((entry) => {
|
|
21036
21404
|
if (entry !== "settings") return false;
|
|
21037
|
-
const settingsDir =
|
|
21405
|
+
const settingsDir = path15.join(dir, entry);
|
|
21038
21406
|
let settingsEntries;
|
|
21039
21407
|
try {
|
|
21040
|
-
settingsEntries =
|
|
21408
|
+
settingsEntries = fs14.readdirSync(settingsDir);
|
|
21041
21409
|
} catch {
|
|
21042
21410
|
return false;
|
|
21043
21411
|
}
|
|
21044
21412
|
if (settingsEntries.length === 0) return false;
|
|
21045
21413
|
return settingsEntries.every(
|
|
21046
|
-
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(
|
|
21414
|
+
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(path15.join(settingsDir, name), "mcpServers")
|
|
21047
21415
|
);
|
|
21048
21416
|
});
|
|
21049
21417
|
}
|
|
21050
21418
|
function codexDirLooksArgentOnly(dir) {
|
|
21051
21419
|
let entries;
|
|
21052
21420
|
try {
|
|
21053
|
-
entries =
|
|
21421
|
+
entries = fs14.readdirSync(dir);
|
|
21054
21422
|
} catch {
|
|
21055
21423
|
return false;
|
|
21056
21424
|
}
|
|
21057
21425
|
if (entries.length === 0) return false;
|
|
21058
21426
|
return entries.every((entry) => {
|
|
21059
|
-
const full =
|
|
21427
|
+
const full = path15.join(dir, entry);
|
|
21060
21428
|
if (entry === "config.toml") {
|
|
21061
21429
|
const config = parseTomlStrict(full);
|
|
21062
21430
|
if (config === null) return false;
|
|
@@ -21083,13 +21451,13 @@ function codexDirLooksArgentOnly(dir) {
|
|
|
21083
21451
|
var cursorAdapter = {
|
|
21084
21452
|
name: "Cursor",
|
|
21085
21453
|
detect() {
|
|
21086
|
-
return dirHasEditorEvidence(
|
|
21454
|
+
return dirHasEditorEvidence(path15.join(homedir4(), ".cursor"), cursorDirLooksArgentOnly) || dirHasEditorEvidence(path15.join(process.cwd(), ".cursor"), cursorDirLooksArgentOnly);
|
|
21087
21455
|
},
|
|
21088
21456
|
projectPath(root) {
|
|
21089
|
-
return
|
|
21457
|
+
return path15.join(root, ".cursor", "mcp.json");
|
|
21090
21458
|
},
|
|
21091
21459
|
globalPath() {
|
|
21092
|
-
return
|
|
21460
|
+
return path15.join(homedir4(), ".cursor", "mcp.json");
|
|
21093
21461
|
},
|
|
21094
21462
|
// Cursor is a VS Code fork: .cursor/mcp.json is JSONC (line/block comments,
|
|
21095
21463
|
// trailing commas). Routing write/remove/hasArgentEntry through readJsonc /
|
|
@@ -21105,7 +21473,7 @@ var cursorAdapter = {
|
|
|
21105
21473
|
});
|
|
21106
21474
|
},
|
|
21107
21475
|
remove(configPath) {
|
|
21108
|
-
if (!
|
|
21476
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21109
21477
|
const config = readJsonc(configPath);
|
|
21110
21478
|
const servers = config.mcpServers;
|
|
21111
21479
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21113,7 +21481,7 @@ var cursorAdapter = {
|
|
|
21113
21481
|
return true;
|
|
21114
21482
|
},
|
|
21115
21483
|
getArgentEntry(configPath) {
|
|
21116
|
-
if (!
|
|
21484
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21117
21485
|
const config = readJsonc(configPath);
|
|
21118
21486
|
const servers = config.mcpServers;
|
|
21119
21487
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21130,7 +21498,7 @@ var cursorAdapter = {
|
|
|
21130
21498
|
// because `hasArgentEntry` now reads mcp.json with readJsonc, so `update`
|
|
21131
21499
|
// detects a commented config as configured and calls this.
|
|
21132
21500
|
addAllowlist() {
|
|
21133
|
-
const permPath =
|
|
21501
|
+
const permPath = path15.join(homedir4(), ".cursor", "permissions.json");
|
|
21134
21502
|
const config = readJsonc(permPath);
|
|
21135
21503
|
const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : [];
|
|
21136
21504
|
if (list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
@@ -21138,8 +21506,8 @@ var cursorAdapter = {
|
|
|
21138
21506
|
},
|
|
21139
21507
|
removeAllowlist(_root, scope) {
|
|
21140
21508
|
if (scope !== "global") return;
|
|
21141
|
-
const permPath =
|
|
21142
|
-
if (!
|
|
21509
|
+
const permPath = path15.join(homedir4(), ".cursor", "permissions.json");
|
|
21510
|
+
if (!fs14.existsSync(permPath)) return;
|
|
21143
21511
|
const config = readJsonc(permPath);
|
|
21144
21512
|
const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : void 0;
|
|
21145
21513
|
if (!list || !list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
@@ -21150,16 +21518,16 @@ var cursorAdapter = {
|
|
|
21150
21518
|
function claudeProjectKeysForRoot(projects, root) {
|
|
21151
21519
|
const canonical = (value) => {
|
|
21152
21520
|
try {
|
|
21153
|
-
return
|
|
21521
|
+
return fs14.realpathSync.native(value);
|
|
21154
21522
|
} catch {
|
|
21155
|
-
return
|
|
21523
|
+
return path15.resolve(value);
|
|
21156
21524
|
}
|
|
21157
21525
|
};
|
|
21158
21526
|
const target = canonical(root);
|
|
21159
21527
|
return Object.keys(projects).filter((key) => key === root || canonical(key) === target);
|
|
21160
21528
|
}
|
|
21161
21529
|
function claudeDisabledListFinding(settingsPath, label, projectConfined) {
|
|
21162
|
-
if (!
|
|
21530
|
+
if (!fs14.existsSync(settingsPath)) return null;
|
|
21163
21531
|
const disabled = readJson(settingsPath).disabledMcpjsonServers;
|
|
21164
21532
|
if (!Array.isArray(disabled) || !disabled.includes(MCP_SERVER_KEY)) return null;
|
|
21165
21533
|
return {
|
|
@@ -21188,13 +21556,13 @@ var claudeAdapter = {
|
|
|
21188
21556
|
name: "Claude Code",
|
|
21189
21557
|
detect() {
|
|
21190
21558
|
const mcpJsonArgentOnly = (p) => jsonLooksArgentServerOnly(p, "mcpServers");
|
|
21191
|
-
return fileHasEditorEvidence(
|
|
21559
|
+
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);
|
|
21192
21560
|
},
|
|
21193
21561
|
projectPath(root) {
|
|
21194
|
-
return
|
|
21562
|
+
return path15.join(root, ".mcp.json");
|
|
21195
21563
|
},
|
|
21196
21564
|
globalPath() {
|
|
21197
|
-
return
|
|
21565
|
+
return path15.join(homedir4(), ".claude.json");
|
|
21198
21566
|
},
|
|
21199
21567
|
// JSONC is a superset of JSON, so routing through readJsonc / editJsoncFile is
|
|
21200
21568
|
// safe for this strict-JSON config and keeps every MCP-entry write on the one
|
|
@@ -21208,7 +21576,7 @@ var claudeAdapter = {
|
|
|
21208
21576
|
});
|
|
21209
21577
|
},
|
|
21210
21578
|
remove(configPath) {
|
|
21211
|
-
if (!
|
|
21579
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21212
21580
|
const config = readJsonc(configPath);
|
|
21213
21581
|
const servers = config.mcpServers;
|
|
21214
21582
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21222,7 +21590,7 @@ var claudeAdapter = {
|
|
|
21222
21590
|
return true;
|
|
21223
21591
|
},
|
|
21224
21592
|
getArgentEntry(configPath) {
|
|
21225
|
-
if (!
|
|
21593
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21226
21594
|
const config = readJsonc(configPath);
|
|
21227
21595
|
const servers = config.mcpServers;
|
|
21228
21596
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21238,7 +21606,7 @@ var claudeAdapter = {
|
|
|
21238
21606
|
// reports recorded .mcp.json rejections (see claudeDisabledListFinding).
|
|
21239
21607
|
findShadowingConfigs(root, writtenScope) {
|
|
21240
21608
|
const findings = [];
|
|
21241
|
-
const claudeJsonPath =
|
|
21609
|
+
const claudeJsonPath = path15.join(homedir4(), ".claude.json");
|
|
21242
21610
|
const projects = readJson(claudeJsonPath).projects;
|
|
21243
21611
|
if (isRecord(projects)) {
|
|
21244
21612
|
for (const key of claudeProjectKeysForRoot(projects, root)) {
|
|
@@ -21275,9 +21643,9 @@ var claudeAdapter = {
|
|
|
21275
21643
|
}
|
|
21276
21644
|
if (writtenScope === "local") {
|
|
21277
21645
|
const candidates = [
|
|
21278
|
-
[
|
|
21279
|
-
[
|
|
21280
|
-
[
|
|
21646
|
+
[path15.join(root, ".claude", "settings.json"), ".claude/settings.json", true],
|
|
21647
|
+
[path15.join(root, ".claude", "settings.local.json"), ".claude/settings.local.json", true],
|
|
21648
|
+
[path15.join(homedir4(), ".claude", "settings.json"), "~/.claude/settings.json", false]
|
|
21281
21649
|
];
|
|
21282
21650
|
for (const [settingsPath, label, projectConfined] of candidates) {
|
|
21283
21651
|
const finding = claudeDisabledListFinding(settingsPath, label, projectConfined);
|
|
@@ -21296,10 +21664,10 @@ var claudeAdapter = {
|
|
|
21296
21664
|
var vscodeAdapter = {
|
|
21297
21665
|
name: "VS Code",
|
|
21298
21666
|
detect() {
|
|
21299
|
-
return dirHasEditorEvidence(
|
|
21667
|
+
return dirHasEditorEvidence(path15.join(process.cwd(), ".vscode"), vscodeDirLooksArgentOnly) || dirExists(path15.join(homedir4(), ".vscode"));
|
|
21300
21668
|
},
|
|
21301
21669
|
projectPath(root) {
|
|
21302
|
-
return
|
|
21670
|
+
return path15.join(root, ".vscode", "mcp.json");
|
|
21303
21671
|
},
|
|
21304
21672
|
globalPath() {
|
|
21305
21673
|
return null;
|
|
@@ -21320,7 +21688,7 @@ var vscodeAdapter = {
|
|
|
21320
21688
|
});
|
|
21321
21689
|
},
|
|
21322
21690
|
remove(configPath) {
|
|
21323
|
-
if (!
|
|
21691
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21324
21692
|
const config = readJsonc(configPath);
|
|
21325
21693
|
const servers = config.servers;
|
|
21326
21694
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21328,7 +21696,7 @@ var vscodeAdapter = {
|
|
|
21328
21696
|
return true;
|
|
21329
21697
|
},
|
|
21330
21698
|
getArgentEntry(configPath) {
|
|
21331
|
-
if (!
|
|
21699
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21332
21700
|
const config = readJsonc(configPath);
|
|
21333
21701
|
const servers = config.servers;
|
|
21334
21702
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21344,7 +21712,7 @@ var vscodeAdapter = {
|
|
|
21344
21712
|
findShadowingConfigs(_root, _writtenScope) {
|
|
21345
21713
|
const findings = [];
|
|
21346
21714
|
for (const userDir of vscodeUserDirs()) {
|
|
21347
|
-
const configPath =
|
|
21715
|
+
const configPath = path15.join(userDir, "mcp.json");
|
|
21348
21716
|
const entry = this.getArgentEntry(configPath);
|
|
21349
21717
|
if (!entry) continue;
|
|
21350
21718
|
findings.push({
|
|
@@ -21361,16 +21729,16 @@ var vscodeAdapter = {
|
|
|
21361
21729
|
function vscodeUserDirs() {
|
|
21362
21730
|
const bases = [];
|
|
21363
21731
|
if (process.platform === "darwin") {
|
|
21364
|
-
bases.push(
|
|
21732
|
+
bases.push(path15.join(homedir4(), "Library", "Application Support"));
|
|
21365
21733
|
} else if (process.platform === "win32") {
|
|
21366
21734
|
if (process.env.APPDATA) bases.push(process.env.APPDATA);
|
|
21367
21735
|
} else {
|
|
21368
|
-
bases.push(
|
|
21736
|
+
bases.push(path15.join(homedir4(), ".config"));
|
|
21369
21737
|
}
|
|
21370
21738
|
const dirs = [];
|
|
21371
21739
|
for (const base of bases) {
|
|
21372
21740
|
for (const product of ["Code", "Code - Insiders"]) {
|
|
21373
|
-
const dir =
|
|
21741
|
+
const dir = path15.join(base, product, "User");
|
|
21374
21742
|
if (dirExists(dir)) dirs.push(dir);
|
|
21375
21743
|
}
|
|
21376
21744
|
}
|
|
@@ -21380,7 +21748,7 @@ var windsurfAdapter = {
|
|
|
21380
21748
|
name: "Windsurf",
|
|
21381
21749
|
detect() {
|
|
21382
21750
|
return dirHasEditorEvidence(
|
|
21383
|
-
|
|
21751
|
+
path15.join(homedir4(), ".codeium", "windsurf"),
|
|
21384
21752
|
windsurfDirLooksArgentOnly
|
|
21385
21753
|
);
|
|
21386
21754
|
},
|
|
@@ -21388,7 +21756,7 @@ var windsurfAdapter = {
|
|
|
21388
21756
|
return null;
|
|
21389
21757
|
},
|
|
21390
21758
|
globalPath() {
|
|
21391
|
-
return
|
|
21759
|
+
return path15.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
|
|
21392
21760
|
},
|
|
21393
21761
|
// JSONC-safe MCP-entry writes (see the Cursor adapter): editJsoncFile
|
|
21394
21762
|
// preserves comments and pre-existing foreign servers on this JSON config.
|
|
@@ -21400,7 +21768,7 @@ var windsurfAdapter = {
|
|
|
21400
21768
|
});
|
|
21401
21769
|
},
|
|
21402
21770
|
remove(configPath) {
|
|
21403
|
-
if (!
|
|
21771
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21404
21772
|
const config = readJsonc(configPath);
|
|
21405
21773
|
const servers = config.mcpServers;
|
|
21406
21774
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21408,7 +21776,7 @@ var windsurfAdapter = {
|
|
|
21408
21776
|
return true;
|
|
21409
21777
|
},
|
|
21410
21778
|
getArgentEntry(configPath) {
|
|
21411
|
-
if (!
|
|
21779
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21412
21780
|
const config = readJsonc(configPath);
|
|
21413
21781
|
const servers = config.mcpServers;
|
|
21414
21782
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21422,7 +21790,7 @@ var windsurfAdapter = {
|
|
|
21422
21790
|
// silently skipped the toggle; editJsoncFile targets just the argent entry's
|
|
21423
21791
|
// alwaysAllow key so comments and foreign servers survive.
|
|
21424
21792
|
addAllowlist() {
|
|
21425
|
-
const configPath =
|
|
21793
|
+
const configPath = path15.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
|
|
21426
21794
|
const config = readJsonc(configPath);
|
|
21427
21795
|
const servers = config.mcpServers;
|
|
21428
21796
|
if (!servers?.[MCP_SERVER_KEY]) return;
|
|
@@ -21430,8 +21798,8 @@ var windsurfAdapter = {
|
|
|
21430
21798
|
},
|
|
21431
21799
|
removeAllowlist(_root, scope) {
|
|
21432
21800
|
if (scope !== "global") return;
|
|
21433
|
-
const configPath =
|
|
21434
|
-
if (!
|
|
21801
|
+
const configPath = path15.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
|
|
21802
|
+
if (!fs14.existsSync(configPath)) return;
|
|
21435
21803
|
const config = readJsonc(configPath);
|
|
21436
21804
|
const servers = config.mcpServers;
|
|
21437
21805
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -21442,13 +21810,13 @@ var windsurfAdapter = {
|
|
|
21442
21810
|
var zedAdapter = {
|
|
21443
21811
|
name: "Zed",
|
|
21444
21812
|
detect() {
|
|
21445
|
-
return dirHasEditorEvidence(
|
|
21813
|
+
return dirHasEditorEvidence(path15.join(homedir4(), ".config", "zed"), zedDirLooksArgentOnly);
|
|
21446
21814
|
},
|
|
21447
21815
|
projectPath(root) {
|
|
21448
|
-
return
|
|
21816
|
+
return path15.join(root, ".zed", "settings.json");
|
|
21449
21817
|
},
|
|
21450
21818
|
globalPath() {
|
|
21451
|
-
return
|
|
21819
|
+
return path15.join(homedir4(), ".config", "zed", "settings.json");
|
|
21452
21820
|
},
|
|
21453
21821
|
// Zed's settings.json is JSONC (line + block comments, trailing commas).
|
|
21454
21822
|
// The previous JSON.parse → mutate → JSON.stringify path silently stripped
|
|
@@ -21464,7 +21832,7 @@ var zedAdapter = {
|
|
|
21464
21832
|
});
|
|
21465
21833
|
},
|
|
21466
21834
|
remove(configPath) {
|
|
21467
|
-
if (!
|
|
21835
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21468
21836
|
const config = readJsonc(configPath);
|
|
21469
21837
|
const servers = config.context_servers;
|
|
21470
21838
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21472,7 +21840,7 @@ var zedAdapter = {
|
|
|
21472
21840
|
return true;
|
|
21473
21841
|
},
|
|
21474
21842
|
getArgentEntry(configPath) {
|
|
21475
|
-
if (!
|
|
21843
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21476
21844
|
const config = readJsonc(configPath);
|
|
21477
21845
|
const servers = config.context_servers;
|
|
21478
21846
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21485,12 +21853,12 @@ var zedAdapter = {
|
|
|
21485
21853
|
// documented opt-in; built-in security rules still protect against
|
|
21486
21854
|
// destructive operations.
|
|
21487
21855
|
addAllowlist(root, scope) {
|
|
21488
|
-
const settingsPath = scope === "global" ?
|
|
21856
|
+
const settingsPath = scope === "global" ? path15.join(homedir4(), ".config", "zed", "settings.json") : path15.join(root, ".zed", "settings.json");
|
|
21489
21857
|
editJsoncFile(settingsPath, ["agent", "tool_permissions", "default"], "allow");
|
|
21490
21858
|
},
|
|
21491
21859
|
removeAllowlist(root, scope) {
|
|
21492
|
-
const settingsPath = scope === "global" ?
|
|
21493
|
-
if (!
|
|
21860
|
+
const settingsPath = scope === "global" ? path15.join(homedir4(), ".config", "zed", "settings.json") : path15.join(root, ".zed", "settings.json");
|
|
21861
|
+
if (!fs14.existsSync(settingsPath)) return;
|
|
21494
21862
|
const config = readJsonc(settingsPath);
|
|
21495
21863
|
const perms = config.agent?.tool_permissions;
|
|
21496
21864
|
if (!perms || perms.default !== "allow") return;
|
|
@@ -21500,13 +21868,13 @@ var zedAdapter = {
|
|
|
21500
21868
|
var geminiAdapter = {
|
|
21501
21869
|
name: "Gemini",
|
|
21502
21870
|
detect() {
|
|
21503
|
-
return dirHasEditorEvidence(
|
|
21871
|
+
return dirHasEditorEvidence(path15.join(homedir4(), ".gemini"), geminiDirLooksArgentOnly) || dirHasEditorEvidence(path15.join(process.cwd(), ".gemini"), geminiDirLooksArgentOnly);
|
|
21504
21872
|
},
|
|
21505
21873
|
projectPath(root) {
|
|
21506
|
-
return
|
|
21874
|
+
return path15.join(root, ".gemini", "settings.json");
|
|
21507
21875
|
},
|
|
21508
21876
|
globalPath() {
|
|
21509
|
-
return
|
|
21877
|
+
return path15.join(homedir4(), ".gemini", "settings.json");
|
|
21510
21878
|
},
|
|
21511
21879
|
// JSONC-safe MCP-entry writes (see the Cursor adapter): editJsoncFile
|
|
21512
21880
|
// preserves comments and pre-existing foreign servers on this JSON config.
|
|
@@ -21518,7 +21886,7 @@ var geminiAdapter = {
|
|
|
21518
21886
|
});
|
|
21519
21887
|
},
|
|
21520
21888
|
remove(configPath) {
|
|
21521
|
-
if (!
|
|
21889
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21522
21890
|
const config = readJsonc(configPath);
|
|
21523
21891
|
const servers = config.mcpServers;
|
|
21524
21892
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21526,7 +21894,7 @@ var geminiAdapter = {
|
|
|
21526
21894
|
return true;
|
|
21527
21895
|
},
|
|
21528
21896
|
getArgentEntry(configPath) {
|
|
21529
|
-
if (!
|
|
21897
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21530
21898
|
const config = readJsonc(configPath);
|
|
21531
21899
|
const servers = config.mcpServers;
|
|
21532
21900
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21551,7 +21919,7 @@ var geminiAdapter = {
|
|
|
21551
21919
|
},
|
|
21552
21920
|
removeAllowlist(root, scope) {
|
|
21553
21921
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21554
|
-
if (!configPath || !
|
|
21922
|
+
if (!configPath || !fs14.existsSync(configPath)) {
|
|
21555
21923
|
return;
|
|
21556
21924
|
}
|
|
21557
21925
|
const config = readJsonc(configPath);
|
|
@@ -21565,13 +21933,13 @@ var CODEX_FILENAME = ".codex";
|
|
|
21565
21933
|
var codexAdapter = {
|
|
21566
21934
|
name: "Codex",
|
|
21567
21935
|
detect() {
|
|
21568
|
-
return dirHasEditorEvidence(
|
|
21936
|
+
return dirHasEditorEvidence(path15.join(homedir4(), CODEX_FILENAME), codexDirLooksArgentOnly) || dirHasEditorEvidence(path15.join(process.cwd(), CODEX_FILENAME), codexDirLooksArgentOnly);
|
|
21569
21937
|
},
|
|
21570
21938
|
projectPath(root) {
|
|
21571
|
-
return
|
|
21939
|
+
return path15.join(root, CODEX_FILENAME, "config.toml");
|
|
21572
21940
|
},
|
|
21573
21941
|
globalPath() {
|
|
21574
|
-
return
|
|
21942
|
+
return path15.join(homedir4(), CODEX_FILENAME, "config.toml");
|
|
21575
21943
|
},
|
|
21576
21944
|
write(configPath, entry) {
|
|
21577
21945
|
const config = readToml(configPath);
|
|
@@ -21585,7 +21953,7 @@ var codexAdapter = {
|
|
|
21585
21953
|
writeToml(configPath, config);
|
|
21586
21954
|
},
|
|
21587
21955
|
remove(configPath) {
|
|
21588
|
-
if (!
|
|
21956
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21589
21957
|
const config = readToml(configPath);
|
|
21590
21958
|
const servers = config.mcp_servers;
|
|
21591
21959
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21595,7 +21963,7 @@ var codexAdapter = {
|
|
|
21595
21963
|
return true;
|
|
21596
21964
|
},
|
|
21597
21965
|
getArgentEntry(configPath) {
|
|
21598
|
-
if (!
|
|
21966
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21599
21967
|
const config = readToml(configPath);
|
|
21600
21968
|
const servers = config.mcp_servers;
|
|
21601
21969
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21643,13 +22011,13 @@ var codexAdapter = {
|
|
|
21643
22011
|
var hermesAdapter = {
|
|
21644
22012
|
name: "Hermes",
|
|
21645
22013
|
detect() {
|
|
21646
|
-
return dirHasEditorEvidence(
|
|
22014
|
+
return dirHasEditorEvidence(path15.join(homedir4(), ".hermes"), hermesDirLooksArgentOnly);
|
|
21647
22015
|
},
|
|
21648
22016
|
projectPath() {
|
|
21649
22017
|
return null;
|
|
21650
22018
|
},
|
|
21651
22019
|
globalPath() {
|
|
21652
|
-
return
|
|
22020
|
+
return path15.join(homedir4(), ".hermes", "config.yaml");
|
|
21653
22021
|
},
|
|
21654
22022
|
write(configPath, entry) {
|
|
21655
22023
|
const doc = readYaml(configPath);
|
|
@@ -21668,7 +22036,7 @@ var hermesAdapter = {
|
|
|
21668
22036
|
writeYaml(configPath, doc);
|
|
21669
22037
|
},
|
|
21670
22038
|
remove(configPath) {
|
|
21671
|
-
if (!
|
|
22039
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21672
22040
|
const doc = readYaml(configPath);
|
|
21673
22041
|
const servers = doc.get("mcp_servers");
|
|
21674
22042
|
if (!(0, import_yaml2.isMap)(servers)) return false;
|
|
@@ -21681,7 +22049,7 @@ var hermesAdapter = {
|
|
|
21681
22049
|
return true;
|
|
21682
22050
|
},
|
|
21683
22051
|
getArgentEntry(configPath) {
|
|
21684
|
-
if (!
|
|
22052
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21685
22053
|
const doc = readYaml(configPath);
|
|
21686
22054
|
const servers = doc.get("mcp_servers");
|
|
21687
22055
|
if (!(0, import_yaml2.isMap)(servers)) return null;
|
|
@@ -21708,10 +22076,10 @@ function hasOpenCodeBinary() {
|
|
|
21708
22076
|
}
|
|
21709
22077
|
function pickOpencodeConfig(dir, candidates) {
|
|
21710
22078
|
for (const name of candidates) {
|
|
21711
|
-
const candidate =
|
|
21712
|
-
if (
|
|
22079
|
+
const candidate = path15.join(dir, name);
|
|
22080
|
+
if (fs14.existsSync(candidate)) return candidate;
|
|
21713
22081
|
}
|
|
21714
|
-
return
|
|
22082
|
+
return path15.join(dir, "opencode.json");
|
|
21715
22083
|
}
|
|
21716
22084
|
var openCodeAdapter = {
|
|
21717
22085
|
name: "opencode",
|
|
@@ -21722,7 +22090,7 @@ var openCodeAdapter = {
|
|
|
21722
22090
|
return pickOpencodeConfig(root, OPENCODE_PROJECT_FILES);
|
|
21723
22091
|
},
|
|
21724
22092
|
globalPath() {
|
|
21725
|
-
return pickOpencodeConfig(
|
|
22093
|
+
return pickOpencodeConfig(path15.join(homedir4(), ".config", "opencode"), OPENCODE_GLOBAL_FILES);
|
|
21726
22094
|
},
|
|
21727
22095
|
write(configPath, entry) {
|
|
21728
22096
|
editJsoncFile(configPath, ["mcp", MCP_SERVER_KEY], {
|
|
@@ -21733,7 +22101,7 @@ var openCodeAdapter = {
|
|
|
21733
22101
|
});
|
|
21734
22102
|
},
|
|
21735
22103
|
remove(configPath) {
|
|
21736
|
-
if (!
|
|
22104
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21737
22105
|
const config = readJsonc(configPath);
|
|
21738
22106
|
const servers = config.mcp;
|
|
21739
22107
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21741,7 +22109,7 @@ var openCodeAdapter = {
|
|
|
21741
22109
|
return true;
|
|
21742
22110
|
},
|
|
21743
22111
|
getArgentEntry(configPath) {
|
|
21744
|
-
if (!
|
|
22112
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21745
22113
|
const config = readJsonc(configPath);
|
|
21746
22114
|
const servers = config.mcp;
|
|
21747
22115
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21756,7 +22124,7 @@ var openCodeAdapter = {
|
|
|
21756
22124
|
},
|
|
21757
22125
|
removeAllowlist(root, scope) {
|
|
21758
22126
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21759
|
-
if (!configPath || !
|
|
22127
|
+
if (!configPath || !fs14.existsSync(configPath)) return;
|
|
21760
22128
|
const config = readJsonc(configPath);
|
|
21761
22129
|
const tools = config.tools;
|
|
21762
22130
|
if (!tools || !(OPENCODE_ALLOWLIST_PATTERN in tools)) return;
|
|
@@ -21767,13 +22135,13 @@ var KIRO_AUTO_APPROVE_ALL = ["*"];
|
|
|
21767
22135
|
var kiroAdapter = {
|
|
21768
22136
|
name: "Kiro",
|
|
21769
22137
|
detect() {
|
|
21770
|
-
return dirHasEditorEvidence(
|
|
22138
|
+
return dirHasEditorEvidence(path15.join(homedir4(), ".kiro"), kiroDirLooksArgentOnly) || dirHasEditorEvidence(path15.join(process.cwd(), ".kiro"), kiroDirLooksArgentOnly);
|
|
21771
22139
|
},
|
|
21772
22140
|
projectPath(root) {
|
|
21773
|
-
return
|
|
22141
|
+
return path15.join(root, ".kiro", "settings", "mcp.json");
|
|
21774
22142
|
},
|
|
21775
22143
|
globalPath() {
|
|
21776
|
-
return
|
|
22144
|
+
return path15.join(homedir4(), ".kiro", "settings", "mcp.json");
|
|
21777
22145
|
},
|
|
21778
22146
|
// Kiro is a VS Code fork: .kiro/settings/mcp.json is JSONC. As with Cursor,
|
|
21779
22147
|
// route write/remove/hasArgentEntry through readJsonc / editJsoncFile so
|
|
@@ -21787,7 +22155,7 @@ var kiroAdapter = {
|
|
|
21787
22155
|
});
|
|
21788
22156
|
},
|
|
21789
22157
|
remove(configPath) {
|
|
21790
|
-
if (!
|
|
22158
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
21791
22159
|
const config = readJsonc(configPath);
|
|
21792
22160
|
const servers = config.mcpServers;
|
|
21793
22161
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21795,7 +22163,7 @@ var kiroAdapter = {
|
|
|
21795
22163
|
return true;
|
|
21796
22164
|
},
|
|
21797
22165
|
getArgentEntry(configPath) {
|
|
21798
|
-
if (!
|
|
22166
|
+
if (!fs14.existsSync(configPath)) return null;
|
|
21799
22167
|
const config = readJsonc(configPath);
|
|
21800
22168
|
const servers = config.mcpServers;
|
|
21801
22169
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21822,7 +22190,7 @@ var kiroAdapter = {
|
|
|
21822
22190
|
},
|
|
21823
22191
|
removeAllowlist(root, scope) {
|
|
21824
22192
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21825
|
-
if (!configPath || !
|
|
22193
|
+
if (!configPath || !fs14.existsSync(configPath)) return;
|
|
21826
22194
|
const config = readJsonc(configPath);
|
|
21827
22195
|
const servers = config.mcpServers;
|
|
21828
22196
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -21867,7 +22235,7 @@ function findConfiguredAdapterScopes(adapters, projectRoot) {
|
|
|
21867
22235
|
return results;
|
|
21868
22236
|
}
|
|
21869
22237
|
function addClaudePermission(root, scope) {
|
|
21870
|
-
const settingsPath = scope === "global" ?
|
|
22238
|
+
const settingsPath = scope === "global" ? path15.join(homedir4(), ".claude", "settings.json") : path15.join(root, ".claude", "settings.json");
|
|
21871
22239
|
const config = readJsonc(settingsPath);
|
|
21872
22240
|
const permissions = config.permissions ?? {};
|
|
21873
22241
|
const allow = Array.isArray(permissions.allow) ? permissions.allow : [];
|
|
@@ -21875,8 +22243,8 @@ function addClaudePermission(root, scope) {
|
|
|
21875
22243
|
editJsoncFile(settingsPath, ["permissions", "allow"], [...allow, PERMISSION_RULE]);
|
|
21876
22244
|
}
|
|
21877
22245
|
function removeClaudePermission(root, scope) {
|
|
21878
|
-
const settingsPath = scope === "global" ?
|
|
21879
|
-
if (!
|
|
22246
|
+
const settingsPath = scope === "global" ? path15.join(homedir4(), ".claude", "settings.json") : path15.join(root, ".claude", "settings.json");
|
|
22247
|
+
if (!fs14.existsSync(settingsPath)) return;
|
|
21880
22248
|
const config = readJsonc(settingsPath);
|
|
21881
22249
|
const permissions = config?.permissions;
|
|
21882
22250
|
const allow = permissions?.allow;
|
|
@@ -21885,13 +22253,17 @@ function removeClaudePermission(root, scope) {
|
|
|
21885
22253
|
const next = allow.filter((rule) => rule !== PERMISSION_RULE);
|
|
21886
22254
|
editJsoncFile(settingsPath, ["permissions", "allow"], next.length > 0 ? next : void 0);
|
|
21887
22255
|
}
|
|
22256
|
+
function formatCopyDestination(target, writtenPath, root) {
|
|
22257
|
+
if (writtenPath === target.targetPath) return target.label;
|
|
22258
|
+
return `${target.label} -> ${formatManagedPathLabel(writtenPath, realpathOrSelf(root))}`;
|
|
22259
|
+
}
|
|
21888
22260
|
function formatManagedPathLabel(targetPath, root) {
|
|
21889
22261
|
const home = homedir4();
|
|
21890
|
-
if (targetPath === home || targetPath.startsWith(`${home}${
|
|
22262
|
+
if (targetPath === home || targetPath.startsWith(`${home}${path15.sep}`)) {
|
|
21891
22263
|
return `~${targetPath.slice(home.length)}`;
|
|
21892
22264
|
}
|
|
21893
|
-
const relative5 =
|
|
21894
|
-
if (relative5 && !relative5.startsWith("..") && !
|
|
22265
|
+
const relative5 = path15.relative(root, targetPath);
|
|
22266
|
+
if (relative5 && !relative5.startsWith("..") && !path15.isAbsolute(relative5)) {
|
|
21895
22267
|
return relative5;
|
|
21896
22268
|
}
|
|
21897
22269
|
return targetPath;
|
|
@@ -21905,7 +22277,7 @@ function addManagedTarget(targets, editorName, targetPath, root) {
|
|
|
21905
22277
|
}
|
|
21906
22278
|
function getAdapterBasePath(adapter, root, scope) {
|
|
21907
22279
|
const configPath = scope === "global" ? adapter.globalPath() : adapter.projectPath(root);
|
|
21908
|
-
return configPath ?
|
|
22280
|
+
return configPath ? path15.dirname(configPath) : null;
|
|
21909
22281
|
}
|
|
21910
22282
|
function getManagedContentTargets(adapters, root, scope) {
|
|
21911
22283
|
const targets = {
|
|
@@ -21919,13 +22291,13 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
21919
22291
|
addManagedTarget(
|
|
21920
22292
|
targets.skillTargets,
|
|
21921
22293
|
"skills",
|
|
21922
|
-
|
|
22294
|
+
path15.join(workspaceBase, ".agents", "skills"),
|
|
21923
22295
|
root
|
|
21924
22296
|
);
|
|
21925
22297
|
addManagedTarget(
|
|
21926
22298
|
targets.skillsLockTargets,
|
|
21927
22299
|
"skills",
|
|
21928
|
-
|
|
22300
|
+
path15.join(workspaceBase, "skills-lock.json"),
|
|
21929
22301
|
root
|
|
21930
22302
|
);
|
|
21931
22303
|
for (const adapter of adapters) {
|
|
@@ -21933,21 +22305,21 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
21933
22305
|
case "Cursor": {
|
|
21934
22306
|
const base = getAdapterBasePath(adapter, root, scope);
|
|
21935
22307
|
if (!base) break;
|
|
21936
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
21937
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22308
|
+
addManagedTarget(targets.skillTargets, adapter.name, path15.join(base, "skills"), root);
|
|
22309
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path15.join(base, "rules"), root);
|
|
21938
22310
|
break;
|
|
21939
22311
|
}
|
|
21940
22312
|
case "Claude Code": {
|
|
21941
|
-
const claudeBase = scope === "global" ?
|
|
21942
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
21943
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
21944
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22313
|
+
const claudeBase = scope === "global" ? path15.join(homedir4(), ".claude") : path15.join(root, ".claude");
|
|
22314
|
+
addManagedTarget(targets.skillTargets, adapter.name, path15.join(claudeBase, "skills"), root);
|
|
22315
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path15.join(claudeBase, "rules"), root);
|
|
22316
|
+
addManagedTarget(targets.agentTargets, adapter.name, path15.join(claudeBase, "agents"), root);
|
|
21945
22317
|
break;
|
|
21946
22318
|
}
|
|
21947
22319
|
case "Gemini": {
|
|
21948
|
-
const geminiBase = scope === "global" ?
|
|
21949
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
21950
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22320
|
+
const geminiBase = scope === "global" ? path15.join(homedir4(), ".gemini") : path15.join(root, ".gemini");
|
|
22321
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path15.join(geminiBase, "rules"), root);
|
|
22322
|
+
addManagedTarget(targets.agentTargets, adapter.name, path15.join(geminiBase, "agents"), root);
|
|
21951
22323
|
break;
|
|
21952
22324
|
}
|
|
21953
22325
|
case "Codex": {
|
|
@@ -21957,9 +22329,9 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
21957
22329
|
break;
|
|
21958
22330
|
}
|
|
21959
22331
|
case "opencode": {
|
|
21960
|
-
const base = scope === "global" ?
|
|
21961
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
21962
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22332
|
+
const base = scope === "global" ? path15.join(homedir4(), ".config", "opencode") : path15.join(root, ".opencode");
|
|
22333
|
+
addManagedTarget(targets.skillTargets, adapter.name, path15.join(base, "skills"), root);
|
|
22334
|
+
addManagedTarget(targets.agentTargets, adapter.name, path15.join(base, "agents"), root);
|
|
21963
22335
|
break;
|
|
21964
22336
|
}
|
|
21965
22337
|
}
|
|
@@ -21973,12 +22345,12 @@ function stripFrontmatter(content) {
|
|
|
21973
22345
|
return match ? content.slice(match[0].length).trim() : content.trim();
|
|
21974
22346
|
}
|
|
21975
22347
|
function readAndConcatRules(rulesDir) {
|
|
21976
|
-
if (!
|
|
21977
|
-
const files =
|
|
22348
|
+
if (!fs14.existsSync(rulesDir)) return null;
|
|
22349
|
+
const files = fs14.readdirSync(rulesDir).filter((f) => f.endsWith(".md")).sort();
|
|
21978
22350
|
if (files.length === 0) return null;
|
|
21979
22351
|
const parts = [];
|
|
21980
22352
|
for (const file of files) {
|
|
21981
|
-
const raw =
|
|
22353
|
+
const raw = fs14.readFileSync(path15.join(rulesDir, file), "utf8");
|
|
21982
22354
|
const stripped = stripFrontmatter(raw);
|
|
21983
22355
|
if (stripped) parts.push(stripped);
|
|
21984
22356
|
}
|
|
@@ -22013,7 +22385,7 @@ function injectCodexRules(configPath, rulesDir) {
|
|
|
22013
22385
|
return configPath;
|
|
22014
22386
|
}
|
|
22015
22387
|
function removeCodexRules(configPath) {
|
|
22016
|
-
if (!
|
|
22388
|
+
if (!fs14.existsSync(configPath)) return false;
|
|
22017
22389
|
const config = readToml(configPath);
|
|
22018
22390
|
const existing = config.developer_instructions;
|
|
22019
22391
|
if (!existing || !existing.includes(ARGENT_RULES_START)) return false;
|
|
@@ -22031,10 +22403,9 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
|
|
|
22031
22403
|
const managedTargets = getManagedContentTargets(adapters, root, scope);
|
|
22032
22404
|
for (const target of managedTargets.ruleTargets) {
|
|
22033
22405
|
try {
|
|
22034
|
-
|
|
22035
|
-
|
|
22036
|
-
|
|
22037
|
-
results.push(` Copied rules to ${target.targetPath}`);
|
|
22406
|
+
const written = copyDir(rulesDir, target.targetPath);
|
|
22407
|
+
if (written) {
|
|
22408
|
+
results.push(` Copied rules to ${formatCopyDestination(target, written, root)}`);
|
|
22038
22409
|
}
|
|
22039
22410
|
} catch (err) {
|
|
22040
22411
|
results.push(` Could not copy rules to ${target.targetPath}: ${err}`);
|
|
@@ -22042,10 +22413,9 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
|
|
|
22042
22413
|
}
|
|
22043
22414
|
for (const target of managedTargets.agentTargets) {
|
|
22044
22415
|
try {
|
|
22045
|
-
|
|
22046
|
-
|
|
22047
|
-
|
|
22048
|
-
results.push(` Copied agents to ${target.targetPath}`);
|
|
22416
|
+
const written = copyDir(agentsDir, target.targetPath);
|
|
22417
|
+
if (written) {
|
|
22418
|
+
results.push(` Copied agents to ${formatCopyDestination(target, written, root)}`);
|
|
22049
22419
|
}
|
|
22050
22420
|
} catch (err) {
|
|
22051
22421
|
results.push(` Could not copy agents to ${target.targetPath}: ${err}`);
|
|
@@ -22303,7 +22673,7 @@ var ShellCommandError = class extends Error {
|
|
|
22303
22673
|
signal;
|
|
22304
22674
|
};
|
|
22305
22675
|
function runShellCommand(cmd, opts = {}) {
|
|
22306
|
-
return new Promise((
|
|
22676
|
+
return new Promise((resolve13, reject) => {
|
|
22307
22677
|
const child = spawn2(cmd.bin, cmd.args, {
|
|
22308
22678
|
stdio: ["ignore", "pipe", "pipe"],
|
|
22309
22679
|
shell: process.platform === "win32",
|
|
@@ -22314,7 +22684,7 @@ function runShellCommand(cmd, opts = {}) {
|
|
|
22314
22684
|
stderr += chunk.toString();
|
|
22315
22685
|
});
|
|
22316
22686
|
child.on("close", (code, signal) => {
|
|
22317
|
-
if (code === 0)
|
|
22687
|
+
if (code === 0) resolve13();
|
|
22318
22688
|
else
|
|
22319
22689
|
reject(
|
|
22320
22690
|
new ShellCommandError(
|
|
@@ -22751,7 +23121,7 @@ async function chooseAdapters(opts) {
|
|
|
22751
23121
|
// ../argent-installer/src/init-scope.ts
|
|
22752
23122
|
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
22753
23123
|
import { existsSync as existsSync12 } from "node:fs";
|
|
22754
|
-
import { resolve as
|
|
23124
|
+
import { resolve as resolve8 } from "node:path";
|
|
22755
23125
|
async function chooseScope(opts) {
|
|
22756
23126
|
if (opts.installMode === "local") {
|
|
22757
23127
|
return { scope: "local" };
|
|
@@ -22788,13 +23158,13 @@ async function chooseScope(opts) {
|
|
|
22788
23158
|
placeholder: process.cwd(),
|
|
22789
23159
|
validate(value) {
|
|
22790
23160
|
if (!value?.trim()) return "Path cannot be empty.";
|
|
22791
|
-
const resolved =
|
|
23161
|
+
const resolved = resolve8(value.trim());
|
|
22792
23162
|
if (!existsSync12(resolved))
|
|
22793
23163
|
return `Path does not exist: ${resolved}. Please verify and enter a valid path.`;
|
|
22794
23164
|
}
|
|
22795
23165
|
});
|
|
22796
23166
|
if (isCancel(customPathInput)) throw new InitCancelled("scope");
|
|
22797
|
-
return { scope: "custom", customRoot:
|
|
23167
|
+
return { scope: "custom", customRoot: resolve8(customPathInput.trim()) };
|
|
22798
23168
|
}
|
|
22799
23169
|
|
|
22800
23170
|
// ../argent-installer/src/init-mcp-write.ts
|
|
@@ -23189,7 +23559,7 @@ async function runSkillsStep(args) {
|
|
|
23189
23559
|
return skillsMethod;
|
|
23190
23560
|
}
|
|
23191
23561
|
function runNpxSkills(args, interactive, cwd) {
|
|
23192
|
-
return new Promise((
|
|
23562
|
+
return new Promise((resolve13, reject) => {
|
|
23193
23563
|
const npxCmd = process.platform === "win32" ? "npx.cmd" : "npx";
|
|
23194
23564
|
const child = spawn3(npxCmd, args, {
|
|
23195
23565
|
stdio: interactive ? "inherit" : ["ignore", "pipe", "pipe"],
|
|
@@ -23208,7 +23578,7 @@ function runNpxSkills(args, interactive, cwd) {
|
|
|
23208
23578
|
}
|
|
23209
23579
|
child.on("close", (code) => {
|
|
23210
23580
|
if (code === 0) {
|
|
23211
|
-
|
|
23581
|
+
resolve13();
|
|
23212
23582
|
} else {
|
|
23213
23583
|
const output = [stderr, stdout2].filter(Boolean).join("\n").trim();
|
|
23214
23584
|
reject(new Error(output || `npx skills exited with code ${code}`));
|
|
@@ -23481,7 +23851,7 @@ function printBanner() {
|
|
|
23481
23851
|
// ../argent-installer/src/update.ts
|
|
23482
23852
|
var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
23483
23853
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
23484
|
-
import * as
|
|
23854
|
+
import * as path19 from "node:path";
|
|
23485
23855
|
|
|
23486
23856
|
// ../argent-installer/src/update-target.ts
|
|
23487
23857
|
var import_update_core = __toESM(require_dist2(), 1);
|
|
@@ -23500,17 +23870,17 @@ async function resolveInstallableUpdateTarget(pm, current) {
|
|
|
23500
23870
|
|
|
23501
23871
|
// ../argent-tools-client/src/launcher.ts
|
|
23502
23872
|
import * as net from "node:net";
|
|
23503
|
-
import * as
|
|
23504
|
-
import * as
|
|
23873
|
+
import * as fs15 from "node:fs";
|
|
23874
|
+
import * as path16 from "node:path";
|
|
23505
23875
|
import * as readline from "node:readline";
|
|
23506
23876
|
import { homedir as homedir5 } from "node:os";
|
|
23507
23877
|
import { spawn as spawn4, execFileSync as execFileSync5 } from "node:child_process";
|
|
23508
23878
|
import { createHash as createHash2, randomBytes } from "node:crypto";
|
|
23509
23879
|
import { mkdir, writeFile, readFile, readdir, unlink, rename, chmod } from "node:fs/promises";
|
|
23510
|
-
var STATE_DIR =
|
|
23511
|
-
var STATE_FILE =
|
|
23512
|
-
var LOG_FILE =
|
|
23513
|
-
var LOCK_FILE =
|
|
23880
|
+
var STATE_DIR = path16.join(homedir5(), ".argent");
|
|
23881
|
+
var STATE_FILE = path16.join(STATE_DIR, "tool-server.json");
|
|
23882
|
+
var LOG_FILE = path16.join(STATE_DIR, "tool-server.log");
|
|
23883
|
+
var LOCK_FILE = path16.join(STATE_DIR, "tool-server.lock");
|
|
23514
23884
|
function isProcessAlive(pid) {
|
|
23515
23885
|
try {
|
|
23516
23886
|
process.kill(pid, 0);
|
|
@@ -23521,7 +23891,7 @@ function isProcessAlive(pid) {
|
|
|
23521
23891
|
}
|
|
23522
23892
|
function stateFileForBundle(bundlePath) {
|
|
23523
23893
|
const key = createHash2("sha256").update(bundlePath).digest("hex").slice(0, 12);
|
|
23524
|
-
return
|
|
23894
|
+
return path16.join(STATE_DIR, `tool-server-${key}.json`);
|
|
23525
23895
|
}
|
|
23526
23896
|
async function readStateFile(file) {
|
|
23527
23897
|
try {
|
|
@@ -23563,7 +23933,7 @@ async function readAllToolsServerStates() {
|
|
|
23563
23933
|
const out = [];
|
|
23564
23934
|
for (const name of names) {
|
|
23565
23935
|
if (!STATE_FILE_RE.test(name)) continue;
|
|
23566
|
-
const file =
|
|
23936
|
+
const file = path16.join(STATE_DIR, name);
|
|
23567
23937
|
const state2 = await readStateFile(file);
|
|
23568
23938
|
if (state2) out.push({ file, state: state2 });
|
|
23569
23939
|
}
|
|
@@ -23605,21 +23975,21 @@ async function killToolServer(bundlePath) {
|
|
|
23605
23975
|
await clearToolsServerState(bundlePath ?? state2.bundlePath);
|
|
23606
23976
|
}
|
|
23607
23977
|
function isPathWithin(child, parent) {
|
|
23608
|
-
const rel =
|
|
23609
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
23978
|
+
const rel = path16.relative(parent, child);
|
|
23979
|
+
return rel !== "" && !rel.startsWith("..") && !path16.isAbsolute(rel);
|
|
23610
23980
|
}
|
|
23611
23981
|
function tryRealpath(p) {
|
|
23612
23982
|
try {
|
|
23613
|
-
return
|
|
23983
|
+
return fs15.realpathSync(p);
|
|
23614
23984
|
} catch {
|
|
23615
23985
|
return p;
|
|
23616
23986
|
}
|
|
23617
23987
|
}
|
|
23618
23988
|
async function killToolServerForInstallDir(packageDir) {
|
|
23619
|
-
const parents = /* @__PURE__ */ new Set([
|
|
23989
|
+
const parents = /* @__PURE__ */ new Set([path16.resolve(packageDir), tryRealpath(packageDir)]);
|
|
23620
23990
|
let killed = 0;
|
|
23621
23991
|
for (const { file, state: state2 } of await readAllToolsServerStates()) {
|
|
23622
|
-
const bundles = /* @__PURE__ */ new Set([
|
|
23992
|
+
const bundles = /* @__PURE__ */ new Set([path16.resolve(state2.bundlePath), tryRealpath(state2.bundlePath)]);
|
|
23623
23993
|
const matches2 = [...bundles].some((b) => [...parents].some((p) => isPathWithin(b, p)));
|
|
23624
23994
|
if (!matches2) continue;
|
|
23625
23995
|
const fresh = await readStateFile(file);
|
|
@@ -23658,23 +24028,23 @@ function processCommandMatches(pid, marker) {
|
|
|
23658
24028
|
}
|
|
23659
24029
|
|
|
23660
24030
|
// ../argent-tools-client/src/link-config.ts
|
|
23661
|
-
import * as
|
|
24031
|
+
import * as path17 from "node:path";
|
|
23662
24032
|
import { homedir as homedir6 } from "node:os";
|
|
23663
24033
|
import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
|
|
23664
|
-
var LINK_DIR =
|
|
23665
|
-
var LINK_FILE =
|
|
24034
|
+
var LINK_DIR = path17.join(homedir6(), ".argent");
|
|
24035
|
+
var LINK_FILE = path17.join(LINK_DIR, "link.json");
|
|
23666
24036
|
|
|
23667
24037
|
// ../argent-tools-client/src/file-inputs.ts
|
|
23668
24038
|
import { createHash as createHash3, randomUUID as randomUUID6 } from "node:crypto";
|
|
23669
24039
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
23670
24040
|
import { mkdir as mkdir3, readFile as readFile3, rm as rm2, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
|
|
23671
24041
|
import { tmpdir } from "node:os";
|
|
23672
|
-
import * as
|
|
24042
|
+
import * as path18 from "node:path";
|
|
23673
24043
|
|
|
23674
24044
|
// ../archive/src/index.ts
|
|
23675
24045
|
import { execFile } from "node:child_process";
|
|
23676
24046
|
import { rm, readdir as readdir2 } from "node:fs/promises";
|
|
23677
|
-
import { basename as basename2, dirname as dirname11, join as
|
|
24047
|
+
import { basename as basename2, dirname as dirname11, join as join18, posix as posix2, resolve as resolve10, sep as sep5 } from "node:path";
|
|
23678
24048
|
import { promisify } from "node:util";
|
|
23679
24049
|
var execFileAsync = promisify(execFile);
|
|
23680
24050
|
|
|
@@ -23685,7 +24055,7 @@ var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
|
|
|
23685
24055
|
import { copyFile, mkdir as mkdir4, readFile as readFile4, realpath, rm as rm3, stat as stat3, writeFile as writeFile4 } from "node:fs/promises";
|
|
23686
24056
|
import { constants as fsConstants } from "node:fs";
|
|
23687
24057
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
23688
|
-
import { basename as basename4, dirname as dirname13, extname as extname2, isAbsolute as isAbsolute5, join as
|
|
24058
|
+
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";
|
|
23689
24059
|
import { createHash as createHash4 } from "node:crypto";
|
|
23690
24060
|
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize(".argent/recordings")]);
|
|
23691
24061
|
var RECORDINGS_SAVE_DIR = normalize(".argent/recordings");
|
|
@@ -24044,7 +24414,7 @@ async function update(args) {
|
|
|
24044
24414
|
process.exit(1);
|
|
24045
24415
|
}
|
|
24046
24416
|
const rootOverride = getProjectRootOverride(args);
|
|
24047
|
-
const projectRoot = rootOverride ?
|
|
24417
|
+
const projectRoot = rootOverride ? path19.resolve(rootOverride) : resolveProjectRoot2(process.cwd());
|
|
24048
24418
|
installMode = resolveInstallMode(projectRoot);
|
|
24049
24419
|
const flags = parseTargetFlags(args);
|
|
24050
24420
|
const localInstalled = installMode === "local" && probeLocalInstall(projectRoot).installed;
|
|
@@ -24215,8 +24585,8 @@ async function update(args) {
|
|
|
24215
24585
|
// ../argent-installer/src/uninstall.ts
|
|
24216
24586
|
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
24217
24587
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
24218
|
-
import * as
|
|
24219
|
-
import * as
|
|
24588
|
+
import * as fs16 from "node:fs";
|
|
24589
|
+
import * as path20 from "node:path";
|
|
24220
24590
|
var UNINSTALL_TOOLSERVER_STOP_FAILED = {
|
|
24221
24591
|
error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
|
|
24222
24592
|
failure_stage: "installer_uninstall_toolserver_stop",
|
|
@@ -24237,10 +24607,10 @@ var UNINSTALL_UNCLASSIFIED_FAILED = {
|
|
|
24237
24607
|
};
|
|
24238
24608
|
function removeDirIfEmpty2(dirPath) {
|
|
24239
24609
|
try {
|
|
24240
|
-
if (!
|
|
24241
|
-
if (!
|
|
24242
|
-
if (
|
|
24243
|
-
|
|
24610
|
+
if (!fs16.existsSync(dirPath)) return false;
|
|
24611
|
+
if (!fs16.statSync(dirPath).isDirectory()) return false;
|
|
24612
|
+
if (fs16.readdirSync(dirPath).length > 0) return false;
|
|
24613
|
+
fs16.rmdirSync(dirPath);
|
|
24244
24614
|
return true;
|
|
24245
24615
|
} catch {
|
|
24246
24616
|
return false;
|
|
@@ -24250,9 +24620,9 @@ function collectBundledPaths(sourceDir) {
|
|
|
24250
24620
|
const files = [];
|
|
24251
24621
|
const directories = [];
|
|
24252
24622
|
function walk(currentDir, relativeDir = "") {
|
|
24253
|
-
for (const entry of
|
|
24254
|
-
const relativePath = relativeDir ?
|
|
24255
|
-
const absolutePath =
|
|
24623
|
+
for (const entry of fs16.readdirSync(currentDir, { withFileTypes: true })) {
|
|
24624
|
+
const relativePath = relativeDir ? path20.join(relativeDir, entry.name) : entry.name;
|
|
24625
|
+
const absolutePath = path20.join(currentDir, entry.name);
|
|
24256
24626
|
if (entry.isDirectory()) {
|
|
24257
24627
|
walk(absolutePath, relativePath);
|
|
24258
24628
|
directories.push(relativePath);
|
|
@@ -24265,52 +24635,52 @@ function collectBundledPaths(sourceDir) {
|
|
|
24265
24635
|
return { files, directories };
|
|
24266
24636
|
}
|
|
24267
24637
|
function removeBundledContent(sourceDir, targetDir) {
|
|
24268
|
-
if (!
|
|
24638
|
+
if (!fs16.existsSync(sourceDir) || !fs16.existsSync(targetDir)) {
|
|
24269
24639
|
return { removedPaths: [], removedRoot: false };
|
|
24270
24640
|
}
|
|
24271
24641
|
const { files, directories } = collectBundledPaths(sourceDir);
|
|
24272
24642
|
const removedPaths = [];
|
|
24273
24643
|
for (const relativePath of files) {
|
|
24274
|
-
const targetPath =
|
|
24644
|
+
const targetPath = path20.join(targetDir, relativePath);
|
|
24275
24645
|
try {
|
|
24276
|
-
if (!
|
|
24277
|
-
if (
|
|
24278
|
-
|
|
24646
|
+
if (!fs16.existsSync(targetPath)) continue;
|
|
24647
|
+
if (fs16.lstatSync(targetPath).isDirectory()) continue;
|
|
24648
|
+
fs16.rmSync(targetPath, { force: true });
|
|
24279
24649
|
removedPaths.push(relativePath);
|
|
24280
24650
|
} catch {
|
|
24281
24651
|
}
|
|
24282
24652
|
}
|
|
24283
24653
|
directories.sort(
|
|
24284
|
-
(a3, b) => b.split(
|
|
24654
|
+
(a3, b) => b.split(path20.sep).length - a3.split(path20.sep).length || b.length - a3.length
|
|
24285
24655
|
);
|
|
24286
24656
|
for (const relativePath of directories) {
|
|
24287
|
-
const targetPath =
|
|
24657
|
+
const targetPath = path20.join(targetDir, relativePath);
|
|
24288
24658
|
try {
|
|
24289
|
-
if (!
|
|
24290
|
-
if (!
|
|
24291
|
-
if (
|
|
24292
|
-
|
|
24659
|
+
if (!fs16.existsSync(targetPath)) continue;
|
|
24660
|
+
if (!fs16.statSync(targetPath).isDirectory()) continue;
|
|
24661
|
+
if (fs16.readdirSync(targetPath).length > 0) continue;
|
|
24662
|
+
fs16.rmdirSync(targetPath);
|
|
24293
24663
|
} catch {
|
|
24294
24664
|
}
|
|
24295
24665
|
}
|
|
24296
24666
|
let removedRoot = false;
|
|
24297
24667
|
try {
|
|
24298
|
-
if (
|
|
24299
|
-
if (
|
|
24300
|
-
|
|
24668
|
+
if (fs16.existsSync(targetDir) && fs16.statSync(targetDir).isDirectory()) {
|
|
24669
|
+
if (fs16.readdirSync(targetDir).length === 0) {
|
|
24670
|
+
fs16.rmdirSync(targetDir);
|
|
24301
24671
|
removedRoot = true;
|
|
24302
24672
|
}
|
|
24303
24673
|
}
|
|
24304
24674
|
} catch {
|
|
24305
24675
|
}
|
|
24306
24676
|
if (removedRoot) {
|
|
24307
|
-
removeDirIfEmpty2(
|
|
24677
|
+
removeDirIfEmpty2(path20.dirname(targetDir));
|
|
24308
24678
|
}
|
|
24309
24679
|
return { removedPaths, removedRoot };
|
|
24310
24680
|
}
|
|
24311
24681
|
function readBundledSkillName(skillFilePath, fallbackName) {
|
|
24312
24682
|
try {
|
|
24313
|
-
const content =
|
|
24683
|
+
const content = fs16.readFileSync(skillFilePath, "utf8");
|
|
24314
24684
|
const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1];
|
|
24315
24685
|
if (!frontmatter) return fallbackName;
|
|
24316
24686
|
const data = (0, import_yaml3.parse)(frontmatter);
|
|
@@ -24321,30 +24691,30 @@ function readBundledSkillName(skillFilePath, fallbackName) {
|
|
|
24321
24691
|
}
|
|
24322
24692
|
}
|
|
24323
24693
|
function getBundledSkillNames(skillsDir) {
|
|
24324
|
-
if (!
|
|
24694
|
+
if (!fs16.existsSync(skillsDir)) return [];
|
|
24325
24695
|
const skillNames = [];
|
|
24326
|
-
for (const entry of
|
|
24696
|
+
for (const entry of fs16.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
24327
24697
|
if (!entry.isDirectory()) continue;
|
|
24328
|
-
const skillFilePath =
|
|
24329
|
-
if (!
|
|
24698
|
+
const skillFilePath = path20.join(skillsDir, entry.name, "SKILL.md");
|
|
24699
|
+
if (!fs16.existsSync(skillFilePath)) continue;
|
|
24330
24700
|
skillNames.push(readBundledSkillName(skillFilePath, entry.name));
|
|
24331
24701
|
}
|
|
24332
24702
|
return [...new Set(skillNames)].sort();
|
|
24333
24703
|
}
|
|
24334
24704
|
function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
24335
|
-
if (!
|
|
24705
|
+
if (!fs16.existsSync(targetDir)) {
|
|
24336
24706
|
return { removedPaths: [], removedRoot: false };
|
|
24337
24707
|
}
|
|
24338
24708
|
const removedPaths = [];
|
|
24339
24709
|
for (const skillName of skillNames) {
|
|
24340
|
-
const targetPath =
|
|
24710
|
+
const targetPath = path20.join(targetDir, skillName);
|
|
24341
24711
|
try {
|
|
24342
|
-
if (!
|
|
24343
|
-
const stats =
|
|
24712
|
+
if (!fs16.existsSync(targetPath)) continue;
|
|
24713
|
+
const stats = fs16.lstatSync(targetPath);
|
|
24344
24714
|
if (stats.isDirectory() && !stats.isSymbolicLink()) {
|
|
24345
|
-
|
|
24715
|
+
fs16.rmSync(targetPath, { recursive: true, force: true });
|
|
24346
24716
|
} else {
|
|
24347
|
-
|
|
24717
|
+
fs16.rmSync(targetPath, { force: true });
|
|
24348
24718
|
}
|
|
24349
24719
|
removedPaths.push(skillName);
|
|
24350
24720
|
} catch {
|
|
@@ -24352,17 +24722,17 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
|
24352
24722
|
}
|
|
24353
24723
|
const removedRoot = removeDirIfEmpty2(targetDir);
|
|
24354
24724
|
if (removedRoot) {
|
|
24355
|
-
removeDirIfEmpty2(
|
|
24725
|
+
removeDirIfEmpty2(path20.dirname(targetDir));
|
|
24356
24726
|
}
|
|
24357
24727
|
return { removedPaths, removedRoot };
|
|
24358
24728
|
}
|
|
24359
24729
|
function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
24360
|
-
if (!
|
|
24730
|
+
if (!fs16.existsSync(lockPath)) {
|
|
24361
24731
|
return { removedSkills: [], removedFile: false };
|
|
24362
24732
|
}
|
|
24363
24733
|
let parsed;
|
|
24364
24734
|
try {
|
|
24365
|
-
parsed = JSON.parse(
|
|
24735
|
+
parsed = JSON.parse(fs16.readFileSync(lockPath, "utf8"));
|
|
24366
24736
|
} catch {
|
|
24367
24737
|
return { removedSkills: [], removedFile: false };
|
|
24368
24738
|
}
|
|
@@ -24389,10 +24759,10 @@ function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
|
24389
24759
|
parsed.skills && typeof parsed.skills === "object" && Object.keys(parsed.skills).length > 0
|
|
24390
24760
|
);
|
|
24391
24761
|
if (!hasSkills && otherKeys.length === 0) {
|
|
24392
|
-
|
|
24762
|
+
fs16.rmSync(lockPath, { force: true });
|
|
24393
24763
|
return { removedSkills, removedFile: true };
|
|
24394
24764
|
}
|
|
24395
|
-
|
|
24765
|
+
fs16.writeFileSync(lockPath, JSON.stringify(parsed, null, 2) + "\n");
|
|
24396
24766
|
return { removedSkills, removedFile: false };
|
|
24397
24767
|
}
|
|
24398
24768
|
function cleanupBundledSkills(skillNames, targets) {
|