@swmansion/argent 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -10
- package/assets/argent.tracecfg.pbtxt +133 -0
- package/assets/queries/README.md +93 -0
- package/assets/queries/cpu-hotspots.sql +106 -0
- package/assets/queries/function-callers.sql +62 -0
- package/assets/queries/hang-folds-batched.sql +88 -0
- package/assets/queries/hang-main-thread-samples.sql +32 -0
- package/assets/queries/hang-state-breakdown.sql +44 -0
- package/assets/queries/memory-rss.sql +25 -0
- package/assets/queries/thread-breakdown.sql +34 -0
- package/assets/queries/trace-bounds.sql +6 -0
- package/assets/queries/ui-hangs.sql +59 -0
- package/assets/trace-processor/LICENSE +235 -0
- package/assets/trace-processor/SHA256SUMS +4 -0
- package/assets/trace-processor/engine.mjs +42423 -0
- package/assets/trace-processor/engine_bundle.node.js +11130 -0
- package/assets/trace-processor/trace_processor.wasm +0 -0
- package/{dist → bin}/argent-android-devtools-0.1.0.apk +0 -0
- package/bin/argent-simulator-server.cjs +56 -0
- package/bin/{ax-service → darwin/ax-service} +0 -0
- package/bin/{simulator-server → darwin/simulator-server} +0 -0
- package/bin/linux/simulator-server +0 -0
- package/dist/cli-cmds.mjs +2540 -85
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +23 -2
- package/dist/cli.js.map +1 -1
- package/dist/installer.mjs +241 -107
- package/dist/mcp-server.mjs +440 -110
- package/dist/tool-server.cjs +4297 -1895
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +3 -3
- package/skills/argent-android-emulator-setup/SKILL.md +1 -1
- package/skills/argent-native-profiler/SKILL.md +5 -5
- /package/{dist → assets}/Argent.tracetemplate +0 -0
- /package/{manifest.json → assets/manifest.json} +0 -0
package/dist/installer.mjs
CHANGED
|
@@ -2209,17 +2209,17 @@ var require_visit = __commonJS({
|
|
|
2209
2209
|
visit2.BREAK = BREAK;
|
|
2210
2210
|
visit2.SKIP = SKIP;
|
|
2211
2211
|
visit2.REMOVE = REMOVE;
|
|
2212
|
-
function visit_(key, node, visitor,
|
|
2213
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
2212
|
+
function visit_(key, node, visitor, path6) {
|
|
2213
|
+
const ctrl = callVisitor(key, node, visitor, path6);
|
|
2214
2214
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
2215
|
-
replaceNode(key,
|
|
2216
|
-
return visit_(key, ctrl, visitor,
|
|
2215
|
+
replaceNode(key, path6, ctrl);
|
|
2216
|
+
return visit_(key, ctrl, visitor, path6);
|
|
2217
2217
|
}
|
|
2218
2218
|
if (typeof ctrl !== "symbol") {
|
|
2219
2219
|
if (identity.isCollection(node)) {
|
|
2220
|
-
|
|
2220
|
+
path6 = Object.freeze(path6.concat(node));
|
|
2221
2221
|
for (let i = 0; i < node.items.length; ++i) {
|
|
2222
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
2222
|
+
const ci = visit_(i, node.items[i], visitor, path6);
|
|
2223
2223
|
if (typeof ci === "number")
|
|
2224
2224
|
i = ci - 1;
|
|
2225
2225
|
else if (ci === BREAK)
|
|
@@ -2230,13 +2230,13 @@ var require_visit = __commonJS({
|
|
|
2230
2230
|
}
|
|
2231
2231
|
}
|
|
2232
2232
|
} else if (identity.isPair(node)) {
|
|
2233
|
-
|
|
2234
|
-
const ck = visit_("key", node.key, visitor,
|
|
2233
|
+
path6 = Object.freeze(path6.concat(node));
|
|
2234
|
+
const ck = visit_("key", node.key, visitor, path6);
|
|
2235
2235
|
if (ck === BREAK)
|
|
2236
2236
|
return BREAK;
|
|
2237
2237
|
else if (ck === REMOVE)
|
|
2238
2238
|
node.key = null;
|
|
2239
|
-
const cv = visit_("value", node.value, visitor,
|
|
2239
|
+
const cv = visit_("value", node.value, visitor, path6);
|
|
2240
2240
|
if (cv === BREAK)
|
|
2241
2241
|
return BREAK;
|
|
2242
2242
|
else if (cv === REMOVE)
|
|
@@ -2257,17 +2257,17 @@ var require_visit = __commonJS({
|
|
|
2257
2257
|
visitAsync.BREAK = BREAK;
|
|
2258
2258
|
visitAsync.SKIP = SKIP;
|
|
2259
2259
|
visitAsync.REMOVE = REMOVE;
|
|
2260
|
-
async function visitAsync_(key, node, visitor,
|
|
2261
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
2260
|
+
async function visitAsync_(key, node, visitor, path6) {
|
|
2261
|
+
const ctrl = await callVisitor(key, node, visitor, path6);
|
|
2262
2262
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
2263
|
-
replaceNode(key,
|
|
2264
|
-
return visitAsync_(key, ctrl, visitor,
|
|
2263
|
+
replaceNode(key, path6, ctrl);
|
|
2264
|
+
return visitAsync_(key, ctrl, visitor, path6);
|
|
2265
2265
|
}
|
|
2266
2266
|
if (typeof ctrl !== "symbol") {
|
|
2267
2267
|
if (identity.isCollection(node)) {
|
|
2268
|
-
|
|
2268
|
+
path6 = Object.freeze(path6.concat(node));
|
|
2269
2269
|
for (let i = 0; i < node.items.length; ++i) {
|
|
2270
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
2270
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path6);
|
|
2271
2271
|
if (typeof ci === "number")
|
|
2272
2272
|
i = ci - 1;
|
|
2273
2273
|
else if (ci === BREAK)
|
|
@@ -2278,13 +2278,13 @@ var require_visit = __commonJS({
|
|
|
2278
2278
|
}
|
|
2279
2279
|
}
|
|
2280
2280
|
} else if (identity.isPair(node)) {
|
|
2281
|
-
|
|
2282
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
2281
|
+
path6 = Object.freeze(path6.concat(node));
|
|
2282
|
+
const ck = await visitAsync_("key", node.key, visitor, path6);
|
|
2283
2283
|
if (ck === BREAK)
|
|
2284
2284
|
return BREAK;
|
|
2285
2285
|
else if (ck === REMOVE)
|
|
2286
2286
|
node.key = null;
|
|
2287
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
2287
|
+
const cv = await visitAsync_("value", node.value, visitor, path6);
|
|
2288
2288
|
if (cv === BREAK)
|
|
2289
2289
|
return BREAK;
|
|
2290
2290
|
else if (cv === REMOVE)
|
|
@@ -2311,23 +2311,23 @@ var require_visit = __commonJS({
|
|
|
2311
2311
|
}
|
|
2312
2312
|
return visitor;
|
|
2313
2313
|
}
|
|
2314
|
-
function callVisitor(key, node, visitor,
|
|
2314
|
+
function callVisitor(key, node, visitor, path6) {
|
|
2315
2315
|
if (typeof visitor === "function")
|
|
2316
|
-
return visitor(key, node,
|
|
2316
|
+
return visitor(key, node, path6);
|
|
2317
2317
|
if (identity.isMap(node))
|
|
2318
|
-
return visitor.Map?.(key, node,
|
|
2318
|
+
return visitor.Map?.(key, node, path6);
|
|
2319
2319
|
if (identity.isSeq(node))
|
|
2320
|
-
return visitor.Seq?.(key, node,
|
|
2320
|
+
return visitor.Seq?.(key, node, path6);
|
|
2321
2321
|
if (identity.isPair(node))
|
|
2322
|
-
return visitor.Pair?.(key, node,
|
|
2322
|
+
return visitor.Pair?.(key, node, path6);
|
|
2323
2323
|
if (identity.isScalar(node))
|
|
2324
|
-
return visitor.Scalar?.(key, node,
|
|
2324
|
+
return visitor.Scalar?.(key, node, path6);
|
|
2325
2325
|
if (identity.isAlias(node))
|
|
2326
|
-
return visitor.Alias?.(key, node,
|
|
2326
|
+
return visitor.Alias?.(key, node, path6);
|
|
2327
2327
|
return void 0;
|
|
2328
2328
|
}
|
|
2329
|
-
function replaceNode(key,
|
|
2330
|
-
const parent =
|
|
2329
|
+
function replaceNode(key, path6, node) {
|
|
2330
|
+
const parent = path6[path6.length - 1];
|
|
2331
2331
|
if (identity.isCollection(parent)) {
|
|
2332
2332
|
parent.items[key] = node;
|
|
2333
2333
|
} else if (identity.isPair(parent)) {
|
|
@@ -2937,10 +2937,10 @@ var require_Collection = __commonJS({
|
|
|
2937
2937
|
var createNode = require_createNode();
|
|
2938
2938
|
var identity = require_identity();
|
|
2939
2939
|
var Node = require_Node();
|
|
2940
|
-
function collectionFromPath(schema,
|
|
2940
|
+
function collectionFromPath(schema, path6, value) {
|
|
2941
2941
|
let v2 = value;
|
|
2942
|
-
for (let i =
|
|
2943
|
-
const k2 =
|
|
2942
|
+
for (let i = path6.length - 1; i >= 0; --i) {
|
|
2943
|
+
const k2 = path6[i];
|
|
2944
2944
|
if (typeof k2 === "number" && Number.isInteger(k2) && k2 >= 0) {
|
|
2945
2945
|
const a = [];
|
|
2946
2946
|
a[k2] = v2;
|
|
@@ -2959,7 +2959,7 @@ var require_Collection = __commonJS({
|
|
|
2959
2959
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
2960
2960
|
});
|
|
2961
2961
|
}
|
|
2962
|
-
var isEmptyPath = (
|
|
2962
|
+
var isEmptyPath = (path6) => path6 == null || typeof path6 === "object" && !!path6[Symbol.iterator]().next().done;
|
|
2963
2963
|
var Collection = class extends Node.NodeBase {
|
|
2964
2964
|
constructor(type, schema) {
|
|
2965
2965
|
super(type);
|
|
@@ -2989,11 +2989,11 @@ var require_Collection = __commonJS({
|
|
|
2989
2989
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
2990
2990
|
* that already exists in the map.
|
|
2991
2991
|
*/
|
|
2992
|
-
addIn(
|
|
2993
|
-
if (isEmptyPath(
|
|
2992
|
+
addIn(path6, value) {
|
|
2993
|
+
if (isEmptyPath(path6))
|
|
2994
2994
|
this.add(value);
|
|
2995
2995
|
else {
|
|
2996
|
-
const [key, ...rest] =
|
|
2996
|
+
const [key, ...rest] = path6;
|
|
2997
2997
|
const node = this.get(key, true);
|
|
2998
2998
|
if (identity.isCollection(node))
|
|
2999
2999
|
node.addIn(rest, value);
|
|
@@ -3007,8 +3007,8 @@ var require_Collection = __commonJS({
|
|
|
3007
3007
|
* Removes a value from the collection.
|
|
3008
3008
|
* @returns `true` if the item was found and removed.
|
|
3009
3009
|
*/
|
|
3010
|
-
deleteIn(
|
|
3011
|
-
const [key, ...rest] =
|
|
3010
|
+
deleteIn(path6) {
|
|
3011
|
+
const [key, ...rest] = path6;
|
|
3012
3012
|
if (rest.length === 0)
|
|
3013
3013
|
return this.delete(key);
|
|
3014
3014
|
const node = this.get(key, true);
|
|
@@ -3022,8 +3022,8 @@ var require_Collection = __commonJS({
|
|
|
3022
3022
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3023
3023
|
* `true` (collections are always returned intact).
|
|
3024
3024
|
*/
|
|
3025
|
-
getIn(
|
|
3026
|
-
const [key, ...rest] =
|
|
3025
|
+
getIn(path6, keepScalar) {
|
|
3026
|
+
const [key, ...rest] = path6;
|
|
3027
3027
|
const node = this.get(key, true);
|
|
3028
3028
|
if (rest.length === 0)
|
|
3029
3029
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -3041,8 +3041,8 @@ var require_Collection = __commonJS({
|
|
|
3041
3041
|
/**
|
|
3042
3042
|
* Checks if the collection includes a value with the key `key`.
|
|
3043
3043
|
*/
|
|
3044
|
-
hasIn(
|
|
3045
|
-
const [key, ...rest] =
|
|
3044
|
+
hasIn(path6) {
|
|
3045
|
+
const [key, ...rest] = path6;
|
|
3046
3046
|
if (rest.length === 0)
|
|
3047
3047
|
return this.has(key);
|
|
3048
3048
|
const node = this.get(key, true);
|
|
@@ -3052,8 +3052,8 @@ var require_Collection = __commonJS({
|
|
|
3052
3052
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
3053
3053
|
* boolean to add/remove the item from the set.
|
|
3054
3054
|
*/
|
|
3055
|
-
setIn(
|
|
3056
|
-
const [key, ...rest] =
|
|
3055
|
+
setIn(path6, value) {
|
|
3056
|
+
const [key, ...rest] = path6;
|
|
3057
3057
|
if (rest.length === 0) {
|
|
3058
3058
|
this.set(key, value);
|
|
3059
3059
|
} else {
|
|
@@ -5568,9 +5568,9 @@ var require_Document = __commonJS({
|
|
|
5568
5568
|
this.contents.add(value);
|
|
5569
5569
|
}
|
|
5570
5570
|
/** Adds a value to the document. */
|
|
5571
|
-
addIn(
|
|
5571
|
+
addIn(path6, value) {
|
|
5572
5572
|
if (assertCollection(this.contents))
|
|
5573
|
-
this.contents.addIn(
|
|
5573
|
+
this.contents.addIn(path6, value);
|
|
5574
5574
|
}
|
|
5575
5575
|
/**
|
|
5576
5576
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -5645,14 +5645,14 @@ var require_Document = __commonJS({
|
|
|
5645
5645
|
* Removes a value from the document.
|
|
5646
5646
|
* @returns `true` if the item was found and removed.
|
|
5647
5647
|
*/
|
|
5648
|
-
deleteIn(
|
|
5649
|
-
if (Collection.isEmptyPath(
|
|
5648
|
+
deleteIn(path6) {
|
|
5649
|
+
if (Collection.isEmptyPath(path6)) {
|
|
5650
5650
|
if (this.contents == null)
|
|
5651
5651
|
return false;
|
|
5652
5652
|
this.contents = null;
|
|
5653
5653
|
return true;
|
|
5654
5654
|
}
|
|
5655
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
5655
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path6) : false;
|
|
5656
5656
|
}
|
|
5657
5657
|
/**
|
|
5658
5658
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -5667,10 +5667,10 @@ var require_Document = __commonJS({
|
|
|
5667
5667
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
5668
5668
|
* `true` (collections are always returned intact).
|
|
5669
5669
|
*/
|
|
5670
|
-
getIn(
|
|
5671
|
-
if (Collection.isEmptyPath(
|
|
5670
|
+
getIn(path6, keepScalar) {
|
|
5671
|
+
if (Collection.isEmptyPath(path6))
|
|
5672
5672
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
5673
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
5673
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path6, keepScalar) : void 0;
|
|
5674
5674
|
}
|
|
5675
5675
|
/**
|
|
5676
5676
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -5681,10 +5681,10 @@ var require_Document = __commonJS({
|
|
|
5681
5681
|
/**
|
|
5682
5682
|
* Checks if the document includes a value at `path`.
|
|
5683
5683
|
*/
|
|
5684
|
-
hasIn(
|
|
5685
|
-
if (Collection.isEmptyPath(
|
|
5684
|
+
hasIn(path6) {
|
|
5685
|
+
if (Collection.isEmptyPath(path6))
|
|
5686
5686
|
return this.contents !== void 0;
|
|
5687
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
5687
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path6) : false;
|
|
5688
5688
|
}
|
|
5689
5689
|
/**
|
|
5690
5690
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -5701,13 +5701,13 @@ var require_Document = __commonJS({
|
|
|
5701
5701
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
5702
5702
|
* boolean to add/remove the item from the set.
|
|
5703
5703
|
*/
|
|
5704
|
-
setIn(
|
|
5705
|
-
if (Collection.isEmptyPath(
|
|
5704
|
+
setIn(path6, value) {
|
|
5705
|
+
if (Collection.isEmptyPath(path6)) {
|
|
5706
5706
|
this.contents = value;
|
|
5707
5707
|
} else if (this.contents == null) {
|
|
5708
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
5708
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path6), value);
|
|
5709
5709
|
} else if (assertCollection(this.contents)) {
|
|
5710
|
-
this.contents.setIn(
|
|
5710
|
+
this.contents.setIn(path6, value);
|
|
5711
5711
|
}
|
|
5712
5712
|
}
|
|
5713
5713
|
/**
|
|
@@ -7667,9 +7667,9 @@ var require_cst_visit = __commonJS({
|
|
|
7667
7667
|
visit2.BREAK = BREAK;
|
|
7668
7668
|
visit2.SKIP = SKIP;
|
|
7669
7669
|
visit2.REMOVE = REMOVE;
|
|
7670
|
-
visit2.itemAtPath = (cst,
|
|
7670
|
+
visit2.itemAtPath = (cst, path6) => {
|
|
7671
7671
|
let item = cst;
|
|
7672
|
-
for (const [field, index] of
|
|
7672
|
+
for (const [field, index] of path6) {
|
|
7673
7673
|
const tok = item?.[field];
|
|
7674
7674
|
if (tok && "items" in tok) {
|
|
7675
7675
|
item = tok.items[index];
|
|
@@ -7678,23 +7678,23 @@ var require_cst_visit = __commonJS({
|
|
|
7678
7678
|
}
|
|
7679
7679
|
return item;
|
|
7680
7680
|
};
|
|
7681
|
-
visit2.parentCollection = (cst,
|
|
7682
|
-
const parent = visit2.itemAtPath(cst,
|
|
7683
|
-
const field =
|
|
7681
|
+
visit2.parentCollection = (cst, path6) => {
|
|
7682
|
+
const parent = visit2.itemAtPath(cst, path6.slice(0, -1));
|
|
7683
|
+
const field = path6[path6.length - 1][0];
|
|
7684
7684
|
const coll = parent?.[field];
|
|
7685
7685
|
if (coll && "items" in coll)
|
|
7686
7686
|
return coll;
|
|
7687
7687
|
throw new Error("Parent collection not found");
|
|
7688
7688
|
};
|
|
7689
|
-
function _visit(
|
|
7690
|
-
let ctrl = visitor(item,
|
|
7689
|
+
function _visit(path6, item, visitor) {
|
|
7690
|
+
let ctrl = visitor(item, path6);
|
|
7691
7691
|
if (typeof ctrl === "symbol")
|
|
7692
7692
|
return ctrl;
|
|
7693
7693
|
for (const field of ["key", "value"]) {
|
|
7694
7694
|
const token = item[field];
|
|
7695
7695
|
if (token && "items" in token) {
|
|
7696
7696
|
for (let i = 0; i < token.items.length; ++i) {
|
|
7697
|
-
const ci = _visit(Object.freeze(
|
|
7697
|
+
const ci = _visit(Object.freeze(path6.concat([[field, i]])), token.items[i], visitor);
|
|
7698
7698
|
if (typeof ci === "number")
|
|
7699
7699
|
i = ci - 1;
|
|
7700
7700
|
else if (ci === BREAK)
|
|
@@ -7705,10 +7705,10 @@ var require_cst_visit = __commonJS({
|
|
|
7705
7705
|
}
|
|
7706
7706
|
}
|
|
7707
7707
|
if (typeof ctrl === "function" && field === "key")
|
|
7708
|
-
ctrl = ctrl(item,
|
|
7708
|
+
ctrl = ctrl(item, path6);
|
|
7709
7709
|
}
|
|
7710
7710
|
}
|
|
7711
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
7711
|
+
return typeof ctrl === "function" ? ctrl(item, path6) : ctrl;
|
|
7712
7712
|
}
|
|
7713
7713
|
exports.visit = visit2;
|
|
7714
7714
|
}
|
|
@@ -12412,12 +12412,12 @@ function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
12412
12412
|
}
|
|
12413
12413
|
return result;
|
|
12414
12414
|
}
|
|
12415
|
-
function findNodeAtLocation(root,
|
|
12415
|
+
function findNodeAtLocation(root, path6) {
|
|
12416
12416
|
if (!root) {
|
|
12417
12417
|
return void 0;
|
|
12418
12418
|
}
|
|
12419
12419
|
let node = root;
|
|
12420
|
-
for (let segment of
|
|
12420
|
+
for (let segment of path6) {
|
|
12421
12421
|
if (typeof segment === "string") {
|
|
12422
12422
|
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
12423
12423
|
return void 0;
|
|
@@ -12771,14 +12771,14 @@ function getNodeType(value) {
|
|
|
12771
12771
|
|
|
12772
12772
|
// ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
12773
12773
|
function setProperty(text, originalPath, value, options) {
|
|
12774
|
-
const
|
|
12774
|
+
const path6 = originalPath.slice();
|
|
12775
12775
|
const errors = [];
|
|
12776
12776
|
const root = parseTree(text, errors);
|
|
12777
12777
|
let parent = void 0;
|
|
12778
12778
|
let lastSegment = void 0;
|
|
12779
|
-
while (
|
|
12780
|
-
lastSegment =
|
|
12781
|
-
parent = findNodeAtLocation(root,
|
|
12779
|
+
while (path6.length > 0) {
|
|
12780
|
+
lastSegment = path6.pop();
|
|
12781
|
+
parent = findNodeAtLocation(root, path6);
|
|
12782
12782
|
if (parent === void 0 && value !== void 0) {
|
|
12783
12783
|
if (typeof lastSegment === "string") {
|
|
12784
12784
|
value = { [lastSegment]: value };
|
|
@@ -12964,8 +12964,8 @@ var ParseErrorCode;
|
|
|
12964
12964
|
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
12965
12965
|
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
12966
12966
|
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
12967
|
-
function modify(text,
|
|
12968
|
-
return setProperty(text,
|
|
12967
|
+
function modify(text, path6, value, options) {
|
|
12968
|
+
return setProperty(text, path6, value, options);
|
|
12969
12969
|
}
|
|
12970
12970
|
function applyEdits(text, edits) {
|
|
12971
12971
|
let sortedEdits = edits.slice(0).sort((a, b2) => {
|
|
@@ -13391,6 +13391,12 @@ var cursorAdapter = {
|
|
|
13391
13391
|
writeJsonOrRemove(configPath, config);
|
|
13392
13392
|
return true;
|
|
13393
13393
|
},
|
|
13394
|
+
hasArgentEntry(configPath) {
|
|
13395
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13396
|
+
const config = readJson(configPath);
|
|
13397
|
+
const servers = config.mcpServers;
|
|
13398
|
+
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
13399
|
+
},
|
|
13394
13400
|
addAllowlist() {
|
|
13395
13401
|
const permPath = path2.join(homedir2(), ".cursor", "permissions.json");
|
|
13396
13402
|
const config = readJson(permPath);
|
|
@@ -13446,6 +13452,12 @@ var claudeAdapter = {
|
|
|
13446
13452
|
writeJsonOrRemove(configPath, config);
|
|
13447
13453
|
return true;
|
|
13448
13454
|
},
|
|
13455
|
+
hasArgentEntry(configPath) {
|
|
13456
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13457
|
+
const config = readJson(configPath);
|
|
13458
|
+
const servers = config.mcpServers;
|
|
13459
|
+
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
13460
|
+
},
|
|
13449
13461
|
addAllowlist(root, scope) {
|
|
13450
13462
|
addClaudePermission(root, scope);
|
|
13451
13463
|
},
|
|
@@ -13484,6 +13496,12 @@ var vscodeAdapter = {
|
|
|
13484
13496
|
delete servers[MCP_SERVER_KEY];
|
|
13485
13497
|
writeJsonOrRemove(configPath, config);
|
|
13486
13498
|
return true;
|
|
13499
|
+
},
|
|
13500
|
+
hasArgentEntry(configPath) {
|
|
13501
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13502
|
+
const config = readJson(configPath);
|
|
13503
|
+
const servers = config.servers;
|
|
13504
|
+
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
13487
13505
|
}
|
|
13488
13506
|
};
|
|
13489
13507
|
var windsurfAdapter = {
|
|
@@ -13517,6 +13535,12 @@ var windsurfAdapter = {
|
|
|
13517
13535
|
writeJsonOrRemove(configPath, config);
|
|
13518
13536
|
return true;
|
|
13519
13537
|
},
|
|
13538
|
+
hasArgentEntry(configPath) {
|
|
13539
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13540
|
+
const config = readJson(configPath);
|
|
13541
|
+
const servers = config.mcpServers;
|
|
13542
|
+
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
13543
|
+
},
|
|
13520
13544
|
addAllowlist() {
|
|
13521
13545
|
const configPath = path2.join(homedir2(), ".codeium", "windsurf", "mcp_config.json");
|
|
13522
13546
|
const config = readJson(configPath);
|
|
@@ -13569,6 +13593,12 @@ var zedAdapter = {
|
|
|
13569
13593
|
editJsoncFile(configPath, ["context_servers", MCP_SERVER_KEY], void 0);
|
|
13570
13594
|
return true;
|
|
13571
13595
|
},
|
|
13596
|
+
hasArgentEntry(configPath) {
|
|
13597
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13598
|
+
const config = readJsonc(configPath);
|
|
13599
|
+
const servers = config.context_servers;
|
|
13600
|
+
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
13601
|
+
},
|
|
13572
13602
|
// Zed doesn't support server-level wildcards for MCP tools — each tool
|
|
13573
13603
|
// would need its own entry. Setting the global default to "allow" is the
|
|
13574
13604
|
// documented opt-in; built-in security rules still protect against
|
|
@@ -13617,6 +13647,12 @@ var geminiAdapter = {
|
|
|
13617
13647
|
writeJsonOrRemove(configPath, config);
|
|
13618
13648
|
return true;
|
|
13619
13649
|
},
|
|
13650
|
+
hasArgentEntry(configPath) {
|
|
13651
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13652
|
+
const config = readJson(configPath);
|
|
13653
|
+
const servers = config.mcpServers;
|
|
13654
|
+
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
13655
|
+
},
|
|
13620
13656
|
addAllowlist(root, scope) {
|
|
13621
13657
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
13622
13658
|
if (!configPath) {
|
|
@@ -13674,6 +13710,12 @@ var codexAdapter = {
|
|
|
13674
13710
|
writeTomlOrRemove(configPath, config);
|
|
13675
13711
|
return true;
|
|
13676
13712
|
},
|
|
13713
|
+
hasArgentEntry(configPath) {
|
|
13714
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13715
|
+
const config = readToml(configPath);
|
|
13716
|
+
const servers = config.mcp_servers;
|
|
13717
|
+
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
13718
|
+
},
|
|
13677
13719
|
addAllowlist(root, scope) {
|
|
13678
13720
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
13679
13721
|
if (!configPath) {
|
|
@@ -13750,6 +13792,13 @@ var hermesAdapter = {
|
|
|
13750
13792
|
}
|
|
13751
13793
|
writeYaml(configPath, doc);
|
|
13752
13794
|
return true;
|
|
13795
|
+
},
|
|
13796
|
+
hasArgentEntry(configPath) {
|
|
13797
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13798
|
+
const doc = readYaml(configPath);
|
|
13799
|
+
const servers = doc.get("mcp_servers");
|
|
13800
|
+
if (!(0, import_yaml2.isMap)(servers)) return false;
|
|
13801
|
+
return servers.has(MCP_SERVER_KEY);
|
|
13753
13802
|
}
|
|
13754
13803
|
};
|
|
13755
13804
|
var OPENCODE_BINARY = "opencode";
|
|
@@ -13799,6 +13848,12 @@ var openCodeAdapter = {
|
|
|
13799
13848
|
editJsoncFile(configPath, ["mcp", MCP_SERVER_KEY], void 0);
|
|
13800
13849
|
return true;
|
|
13801
13850
|
},
|
|
13851
|
+
hasArgentEntry(configPath) {
|
|
13852
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13853
|
+
const config = readJsonc(configPath);
|
|
13854
|
+
const servers = config.mcp;
|
|
13855
|
+
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
13856
|
+
},
|
|
13802
13857
|
addAllowlist(root, scope) {
|
|
13803
13858
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
13804
13859
|
if (!configPath) return;
|
|
@@ -13827,6 +13882,27 @@ var ALL_ADAPTERS = [
|
|
|
13827
13882
|
function detectAdapters() {
|
|
13828
13883
|
return ALL_ADAPTERS.filter((a) => a.detect());
|
|
13829
13884
|
}
|
|
13885
|
+
function findConfiguredAdapterScopes(adapters, projectRoot) {
|
|
13886
|
+
const results = [];
|
|
13887
|
+
const hasEntry = (adapter, configPath) => {
|
|
13888
|
+
try {
|
|
13889
|
+
return adapter.hasArgentEntry(configPath);
|
|
13890
|
+
} catch {
|
|
13891
|
+
return false;
|
|
13892
|
+
}
|
|
13893
|
+
};
|
|
13894
|
+
for (const adapter of adapters) {
|
|
13895
|
+
const projectPath = adapter.projectPath(projectRoot);
|
|
13896
|
+
if (projectPath && hasEntry(adapter, projectPath)) {
|
|
13897
|
+
results.push({ adapter, scope: "project", configPath: projectPath });
|
|
13898
|
+
}
|
|
13899
|
+
const globalPath = adapter.globalPath();
|
|
13900
|
+
if (globalPath && hasEntry(adapter, globalPath)) {
|
|
13901
|
+
results.push({ adapter, scope: "global", configPath: globalPath });
|
|
13902
|
+
}
|
|
13903
|
+
}
|
|
13904
|
+
return results;
|
|
13905
|
+
}
|
|
13830
13906
|
function addClaudePermission(root, scope) {
|
|
13831
13907
|
const settingsPath = scope === "global" ? path2.join(homedir2(), ".claude", "settings.json") : path2.join(root, ".claude", "settings.json");
|
|
13832
13908
|
const config = readJson(settingsPath);
|
|
@@ -14636,11 +14712,20 @@ import * as path3 from "node:path";
|
|
|
14636
14712
|
import * as readline from "node:readline";
|
|
14637
14713
|
import { homedir as homedir3 } from "node:os";
|
|
14638
14714
|
import { spawn as spawn2 } from "node:child_process";
|
|
14639
|
-
import {
|
|
14715
|
+
import { randomBytes } from "node:crypto";
|
|
14716
|
+
import { mkdir, writeFile, readFile, unlink, rename, chmod } from "node:fs/promises";
|
|
14640
14717
|
var STATE_DIR = path3.join(homedir3(), ".argent");
|
|
14641
14718
|
var STATE_FILE = path3.join(STATE_DIR, "tool-server.json");
|
|
14642
14719
|
var LOG_FILE = path3.join(STATE_DIR, "tool-server.log");
|
|
14643
|
-
|
|
14720
|
+
function isProcessAlive(pid) {
|
|
14721
|
+
try {
|
|
14722
|
+
process.kill(pid, 0);
|
|
14723
|
+
return true;
|
|
14724
|
+
} catch {
|
|
14725
|
+
return false;
|
|
14726
|
+
}
|
|
14727
|
+
}
|
|
14728
|
+
async function readToolsServerState() {
|
|
14644
14729
|
try {
|
|
14645
14730
|
const raw = await readFile(STATE_FILE, "utf8");
|
|
14646
14731
|
return JSON.parse(raw);
|
|
@@ -14648,22 +14733,68 @@ async function readState() {
|
|
|
14648
14733
|
return null;
|
|
14649
14734
|
}
|
|
14650
14735
|
}
|
|
14651
|
-
async function
|
|
14736
|
+
async function clearToolsServerState() {
|
|
14652
14737
|
try {
|
|
14653
14738
|
await unlink(STATE_FILE);
|
|
14654
14739
|
} catch {
|
|
14655
14740
|
}
|
|
14656
14741
|
}
|
|
14742
|
+
var readState = readToolsServerState;
|
|
14743
|
+
var clearState = clearToolsServerState;
|
|
14744
|
+
var SIGTERM_GRACE_MS = 6e3;
|
|
14745
|
+
var SIGKILL_GRACE_MS = 1e3;
|
|
14746
|
+
var KILL_POLL_MS = 100;
|
|
14747
|
+
async function waitForExit(pid, timeoutMs) {
|
|
14748
|
+
const deadline = Date.now() + timeoutMs;
|
|
14749
|
+
while (Date.now() < deadline) {
|
|
14750
|
+
if (!isProcessAlive(pid)) return true;
|
|
14751
|
+
await new Promise((r) => setTimeout(r, KILL_POLL_MS));
|
|
14752
|
+
}
|
|
14753
|
+
return !isProcessAlive(pid);
|
|
14754
|
+
}
|
|
14657
14755
|
async function killToolServer() {
|
|
14658
14756
|
const state = await readState();
|
|
14659
14757
|
if (!state) return;
|
|
14660
|
-
|
|
14661
|
-
|
|
14662
|
-
|
|
14758
|
+
let exited = !isProcessAlive(state.pid);
|
|
14759
|
+
if (!exited) {
|
|
14760
|
+
try {
|
|
14761
|
+
process.kill(state.pid, "SIGTERM");
|
|
14762
|
+
} catch {
|
|
14763
|
+
exited = true;
|
|
14764
|
+
}
|
|
14765
|
+
}
|
|
14766
|
+
if (!exited) {
|
|
14767
|
+
exited = await waitForExit(state.pid, SIGTERM_GRACE_MS);
|
|
14768
|
+
}
|
|
14769
|
+
if (!exited) {
|
|
14770
|
+
try {
|
|
14771
|
+
process.kill(state.pid, "SIGKILL");
|
|
14772
|
+
} catch {
|
|
14773
|
+
exited = true;
|
|
14774
|
+
}
|
|
14775
|
+
if (!exited) {
|
|
14776
|
+
await waitForExit(state.pid, SIGKILL_GRACE_MS);
|
|
14777
|
+
}
|
|
14663
14778
|
}
|
|
14664
14779
|
await clearState();
|
|
14665
14780
|
}
|
|
14666
14781
|
|
|
14782
|
+
// ../argent-tools-client/src/link-config.ts
|
|
14783
|
+
import * as path4 from "node:path";
|
|
14784
|
+
import { homedir as homedir4 } from "node:os";
|
|
14785
|
+
import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
|
|
14786
|
+
var LINK_DIR = path4.join(homedir4(), ".argent");
|
|
14787
|
+
var LINK_FILE = path4.join(LINK_DIR, "link.json");
|
|
14788
|
+
|
|
14789
|
+
// ../argent-tools-client/src/artifacts.ts
|
|
14790
|
+
import { mkdir as mkdir3, readFile as readFile3, rm, stat, writeFile as writeFile3 } from "node:fs/promises";
|
|
14791
|
+
import { tmpdir } from "node:os";
|
|
14792
|
+
import { basename, join as join5 } from "node:path";
|
|
14793
|
+
import { createHash } from "node:crypto";
|
|
14794
|
+
import { execFile } from "node:child_process";
|
|
14795
|
+
import { promisify } from "node:util";
|
|
14796
|
+
var execFileAsync = promisify(execFile);
|
|
14797
|
+
|
|
14667
14798
|
// ../argent-installer/src/update.ts
|
|
14668
14799
|
function getRequestedVersion(args) {
|
|
14669
14800
|
for (let i = 0; i < args.length; i += 1) {
|
|
@@ -14776,32 +14907,35 @@ async function update(args) {
|
|
|
14776
14907
|
}
|
|
14777
14908
|
spinner.start("Refreshing workspace configuration...");
|
|
14778
14909
|
const projectRoot = resolveProjectRoot(process.cwd());
|
|
14779
|
-
const detected = detectAdapters();
|
|
14780
14910
|
const mcpEntry = getMcpEntry();
|
|
14781
14911
|
const results = [];
|
|
14782
|
-
|
|
14783
|
-
|
|
14784
|
-
|
|
14785
|
-
|
|
14786
|
-
|
|
14787
|
-
|
|
14788
|
-
|
|
14789
|
-
|
|
14790
|
-
}
|
|
14912
|
+
const configuredScopes = findConfiguredAdapterScopes(ALL_ADAPTERS, projectRoot);
|
|
14913
|
+
const adaptersByScope = /* @__PURE__ */ new Map([
|
|
14914
|
+
["local", /* @__PURE__ */ new Set()],
|
|
14915
|
+
["global", /* @__PURE__ */ new Set()]
|
|
14916
|
+
]);
|
|
14917
|
+
for (const { adapter, scope, configPath } of configuredScopes) {
|
|
14918
|
+
try {
|
|
14919
|
+
adapter.write(configPath, mcpEntry);
|
|
14920
|
+
results.push(`${import_picocolors3.default.green("+")} ${adapter.name} ${import_picocolors3.default.dim(configPath)}`);
|
|
14921
|
+
} catch {
|
|
14791
14922
|
}
|
|
14923
|
+
adaptersByScope.get(scope === "project" ? "local" : "global").add(adapter);
|
|
14792
14924
|
}
|
|
14793
|
-
for (const
|
|
14794
|
-
|
|
14795
|
-
|
|
14925
|
+
for (const [scope, adapters] of adaptersByScope) {
|
|
14926
|
+
for (const adapter of adapters) {
|
|
14927
|
+
if (!adapter.addAllowlist) continue;
|
|
14796
14928
|
try {
|
|
14797
|
-
adapter.addAllowlist(projectRoot,
|
|
14929
|
+
adapter.addAllowlist(projectRoot, scope);
|
|
14798
14930
|
} catch {
|
|
14799
14931
|
}
|
|
14800
14932
|
}
|
|
14801
14933
|
}
|
|
14934
|
+
const localAdapters = [...adaptersByScope.get("local")];
|
|
14935
|
+
const globalAdapters = [...adaptersByScope.get("global")];
|
|
14802
14936
|
const ruleResults = [
|
|
14803
|
-
...copyRulesAndAgents(
|
|
14804
|
-
...copyRulesAndAgents(
|
|
14937
|
+
...copyRulesAndAgents(globalAdapters, projectRoot, "global", RULES_DIR, AGENTS_DIR),
|
|
14938
|
+
...copyRulesAndAgents(localAdapters, projectRoot, "local", RULES_DIR, AGENTS_DIR)
|
|
14805
14939
|
];
|
|
14806
14940
|
spinner.stop("Configuration refreshed.");
|
|
14807
14941
|
if (results.length > 0) {
|
|
@@ -14820,7 +14954,7 @@ async function update(args) {
|
|
|
14820
14954
|
// ../argent-installer/src/uninstall.ts
|
|
14821
14955
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
14822
14956
|
import * as fs4 from "node:fs";
|
|
14823
|
-
import * as
|
|
14957
|
+
import * as path5 from "node:path";
|
|
14824
14958
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
14825
14959
|
function removeDirIfEmpty2(dirPath) {
|
|
14826
14960
|
try {
|
|
@@ -14838,8 +14972,8 @@ function collectBundledPaths(sourceDir) {
|
|
|
14838
14972
|
const directories = [];
|
|
14839
14973
|
function walk(currentDir, relativeDir = "") {
|
|
14840
14974
|
for (const entry of fs4.readdirSync(currentDir, { withFileTypes: true })) {
|
|
14841
|
-
const relativePath = relativeDir ?
|
|
14842
|
-
const absolutePath =
|
|
14975
|
+
const relativePath = relativeDir ? path5.join(relativeDir, entry.name) : entry.name;
|
|
14976
|
+
const absolutePath = path5.join(currentDir, entry.name);
|
|
14843
14977
|
if (entry.isDirectory()) {
|
|
14844
14978
|
walk(absolutePath, relativePath);
|
|
14845
14979
|
directories.push(relativePath);
|
|
@@ -14858,7 +14992,7 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
14858
14992
|
const { files, directories } = collectBundledPaths(sourceDir);
|
|
14859
14993
|
const removedPaths = [];
|
|
14860
14994
|
for (const relativePath of files) {
|
|
14861
|
-
const targetPath =
|
|
14995
|
+
const targetPath = path5.join(targetDir, relativePath);
|
|
14862
14996
|
try {
|
|
14863
14997
|
if (!fs4.existsSync(targetPath)) continue;
|
|
14864
14998
|
if (fs4.lstatSync(targetPath).isDirectory()) continue;
|
|
@@ -14868,10 +15002,10 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
14868
15002
|
}
|
|
14869
15003
|
}
|
|
14870
15004
|
directories.sort(
|
|
14871
|
-
(a, b2) => b2.split(
|
|
15005
|
+
(a, b2) => b2.split(path5.sep).length - a.split(path5.sep).length || b2.length - a.length
|
|
14872
15006
|
);
|
|
14873
15007
|
for (const relativePath of directories) {
|
|
14874
|
-
const targetPath =
|
|
15008
|
+
const targetPath = path5.join(targetDir, relativePath);
|
|
14875
15009
|
try {
|
|
14876
15010
|
if (!fs4.existsSync(targetPath)) continue;
|
|
14877
15011
|
if (!fs4.statSync(targetPath).isDirectory()) continue;
|
|
@@ -14891,7 +15025,7 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
14891
15025
|
} catch {
|
|
14892
15026
|
}
|
|
14893
15027
|
if (removedRoot) {
|
|
14894
|
-
removeDirIfEmpty2(
|
|
15028
|
+
removeDirIfEmpty2(path5.dirname(targetDir));
|
|
14895
15029
|
}
|
|
14896
15030
|
return { removedPaths, removedRoot };
|
|
14897
15031
|
}
|
|
@@ -14910,7 +15044,7 @@ function getBundledSkillNames(skillsDir) {
|
|
|
14910
15044
|
const skillNames = [];
|
|
14911
15045
|
for (const entry of fs4.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
14912
15046
|
if (!entry.isDirectory()) continue;
|
|
14913
|
-
const skillFilePath =
|
|
15047
|
+
const skillFilePath = path5.join(skillsDir, entry.name, "SKILL.md");
|
|
14914
15048
|
if (!fs4.existsSync(skillFilePath)) continue;
|
|
14915
15049
|
skillNames.push(readBundledSkillName(skillFilePath, entry.name));
|
|
14916
15050
|
}
|
|
@@ -14922,7 +15056,7 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
|
14922
15056
|
}
|
|
14923
15057
|
const removedPaths = [];
|
|
14924
15058
|
for (const skillName of skillNames) {
|
|
14925
|
-
const targetPath =
|
|
15059
|
+
const targetPath = path5.join(targetDir, skillName);
|
|
14926
15060
|
try {
|
|
14927
15061
|
if (!fs4.existsSync(targetPath)) continue;
|
|
14928
15062
|
const stats = fs4.lstatSync(targetPath);
|
|
@@ -14937,7 +15071,7 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
|
14937
15071
|
}
|
|
14938
15072
|
const removedRoot = removeDirIfEmpty2(targetDir);
|
|
14939
15073
|
if (removedRoot) {
|
|
14940
|
-
removeDirIfEmpty2(
|
|
15074
|
+
removeDirIfEmpty2(path5.dirname(targetDir));
|
|
14941
15075
|
}
|
|
14942
15076
|
return { removedPaths, removedRoot };
|
|
14943
15077
|
}
|