@ai-setting/roy-agent-cli 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/roy-agent.js +976 -719
- package/dist/index.js +976 -719
- package/dist/roy-agent-linux-x64/bin/roy-agent +0 -0
- package/package.json +1 -1
package/dist/bin/roy-agent.js
CHANGED
|
@@ -433,7 +433,7 @@ function parseSlashCommand(input) {
|
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
-
// ../../node_modules/.
|
|
436
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/identity.js
|
|
437
437
|
var require_identity = __commonJS((exports) => {
|
|
438
438
|
var ALIAS = Symbol.for("yaml.alias");
|
|
439
439
|
var DOC = Symbol.for("yaml.document");
|
|
@@ -487,7 +487,7 @@ var require_identity = __commonJS((exports) => {
|
|
|
487
487
|
exports.isSeq = isSeq;
|
|
488
488
|
});
|
|
489
489
|
|
|
490
|
-
// ../../node_modules/.
|
|
490
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/visit.js
|
|
491
491
|
var require_visit = __commonJS((exports) => {
|
|
492
492
|
var identity = require_identity();
|
|
493
493
|
var BREAK = Symbol("break visit");
|
|
@@ -642,7 +642,7 @@ var require_visit = __commonJS((exports) => {
|
|
|
642
642
|
exports.visitAsync = visitAsync;
|
|
643
643
|
});
|
|
644
644
|
|
|
645
|
-
// ../../node_modules/.
|
|
645
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/doc/directives.js
|
|
646
646
|
var require_directives = __commonJS((exports) => {
|
|
647
647
|
var identity = require_identity();
|
|
648
648
|
var visit = require_visit();
|
|
@@ -794,7 +794,7 @@ var require_directives = __commonJS((exports) => {
|
|
|
794
794
|
exports.Directives = Directives;
|
|
795
795
|
});
|
|
796
796
|
|
|
797
|
-
// ../../node_modules/.
|
|
797
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/doc/anchors.js
|
|
798
798
|
var require_anchors = __commonJS((exports) => {
|
|
799
799
|
var identity = require_identity();
|
|
800
800
|
var visit = require_visit();
|
|
@@ -856,7 +856,7 @@ var require_anchors = __commonJS((exports) => {
|
|
|
856
856
|
exports.findNewAnchor = findNewAnchor;
|
|
857
857
|
});
|
|
858
858
|
|
|
859
|
-
// ../../node_modules/.
|
|
859
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/doc/applyReviver.js
|
|
860
860
|
var require_applyReviver = __commonJS((exports) => {
|
|
861
861
|
function applyReviver(reviver, obj, key, val) {
|
|
862
862
|
if (val && typeof val === "object") {
|
|
@@ -903,7 +903,7 @@ var require_applyReviver = __commonJS((exports) => {
|
|
|
903
903
|
exports.applyReviver = applyReviver;
|
|
904
904
|
});
|
|
905
905
|
|
|
906
|
-
// ../../node_modules/.
|
|
906
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/toJS.js
|
|
907
907
|
var require_toJS = __commonJS((exports) => {
|
|
908
908
|
var identity = require_identity();
|
|
909
909
|
function toJS(value, arg, ctx) {
|
|
@@ -930,7 +930,7 @@ var require_toJS = __commonJS((exports) => {
|
|
|
930
930
|
exports.toJS = toJS;
|
|
931
931
|
});
|
|
932
932
|
|
|
933
|
-
// ../../node_modules/.
|
|
933
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/Node.js
|
|
934
934
|
var require_Node = __commonJS((exports) => {
|
|
935
935
|
var applyReviver = require_applyReviver();
|
|
936
936
|
var identity = require_identity();
|
|
@@ -967,7 +967,7 @@ var require_Node = __commonJS((exports) => {
|
|
|
967
967
|
exports.NodeBase = NodeBase;
|
|
968
968
|
});
|
|
969
969
|
|
|
970
|
-
// ../../node_modules/.
|
|
970
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/Alias.js
|
|
971
971
|
var require_Alias = __commonJS((exports) => {
|
|
972
972
|
var anchors = require_anchors();
|
|
973
973
|
var visit = require_visit();
|
|
@@ -1077,7 +1077,7 @@ var require_Alias = __commonJS((exports) => {
|
|
|
1077
1077
|
exports.Alias = Alias;
|
|
1078
1078
|
});
|
|
1079
1079
|
|
|
1080
|
-
// ../../node_modules/.
|
|
1080
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/Scalar.js
|
|
1081
1081
|
var require_Scalar = __commonJS((exports) => {
|
|
1082
1082
|
var identity = require_identity();
|
|
1083
1083
|
var Node = require_Node();
|
|
@@ -1105,7 +1105,7 @@ var require_Scalar = __commonJS((exports) => {
|
|
|
1105
1105
|
exports.isScalarValue = isScalarValue;
|
|
1106
1106
|
});
|
|
1107
1107
|
|
|
1108
|
-
// ../../node_modules/.
|
|
1108
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/doc/createNode.js
|
|
1109
1109
|
var require_createNode = __commonJS((exports) => {
|
|
1110
1110
|
var Alias = require_Alias();
|
|
1111
1111
|
var identity = require_identity();
|
|
@@ -1177,7 +1177,7 @@ var require_createNode = __commonJS((exports) => {
|
|
|
1177
1177
|
exports.createNode = createNode;
|
|
1178
1178
|
});
|
|
1179
1179
|
|
|
1180
|
-
// ../../node_modules/.
|
|
1180
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/Collection.js
|
|
1181
1181
|
var require_Collection = __commonJS((exports) => {
|
|
1182
1182
|
var createNode = require_createNode();
|
|
1183
1183
|
var identity = require_identity();
|
|
@@ -1292,7 +1292,7 @@ var require_Collection = __commonJS((exports) => {
|
|
|
1292
1292
|
exports.isEmptyPath = isEmptyPath;
|
|
1293
1293
|
});
|
|
1294
1294
|
|
|
1295
|
-
// ../../node_modules/.
|
|
1295
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/stringify/stringifyComment.js
|
|
1296
1296
|
var require_stringifyComment = __commonJS((exports) => {
|
|
1297
1297
|
var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
|
|
1298
1298
|
function indentComment(comment, indent) {
|
|
@@ -1309,7 +1309,7 @@ var require_stringifyComment = __commonJS((exports) => {
|
|
|
1309
1309
|
exports.stringifyComment = stringifyComment;
|
|
1310
1310
|
});
|
|
1311
1311
|
|
|
1312
|
-
// ../../node_modules/.
|
|
1312
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/stringify/foldFlowLines.js
|
|
1313
1313
|
var require_foldFlowLines = __commonJS((exports) => {
|
|
1314
1314
|
var FOLD_FLOW = "flow";
|
|
1315
1315
|
var FOLD_BLOCK = "block";
|
|
@@ -1446,7 +1446,7 @@ ${indent}${text.slice(fold + 1, end2)}`;
|
|
|
1446
1446
|
exports.foldFlowLines = foldFlowLines;
|
|
1447
1447
|
});
|
|
1448
1448
|
|
|
1449
|
-
// ../../node_modules/.
|
|
1449
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/stringify/stringifyString.js
|
|
1450
1450
|
var require_stringifyString = __commonJS((exports) => {
|
|
1451
1451
|
var Scalar = require_Scalar();
|
|
1452
1452
|
var foldFlowLines = require_foldFlowLines();
|
|
@@ -1744,7 +1744,7 @@ ${indent}`);
|
|
|
1744
1744
|
exports.stringifyString = stringifyString;
|
|
1745
1745
|
});
|
|
1746
1746
|
|
|
1747
|
-
// ../../node_modules/.
|
|
1747
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/stringify/stringify.js
|
|
1748
1748
|
var require_stringify = __commonJS((exports) => {
|
|
1749
1749
|
var anchors = require_anchors();
|
|
1750
1750
|
var identity = require_identity();
|
|
@@ -1865,7 +1865,7 @@ ${ctx.indent}${str}`;
|
|
|
1865
1865
|
exports.stringify = stringify;
|
|
1866
1866
|
});
|
|
1867
1867
|
|
|
1868
|
-
// ../../node_modules/.
|
|
1868
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/stringify/stringifyPair.js
|
|
1869
1869
|
var require_stringifyPair = __commonJS((exports) => {
|
|
1870
1870
|
var identity = require_identity();
|
|
1871
1871
|
var Scalar = require_Scalar();
|
|
@@ -2001,7 +2001,7 @@ ${ctx.indent}`;
|
|
|
2001
2001
|
exports.stringifyPair = stringifyPair;
|
|
2002
2002
|
});
|
|
2003
2003
|
|
|
2004
|
-
// ../../node_modules/.
|
|
2004
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/log.js
|
|
2005
2005
|
var require_log = __commonJS((exports) => {
|
|
2006
2006
|
var node_process = __require("process");
|
|
2007
2007
|
function debug(logLevel, ...messages) {
|
|
@@ -2020,7 +2020,7 @@ var require_log = __commonJS((exports) => {
|
|
|
2020
2020
|
exports.warn = warn;
|
|
2021
2021
|
});
|
|
2022
2022
|
|
|
2023
|
-
// ../../node_modules/.
|
|
2023
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/merge.js
|
|
2024
2024
|
var require_merge = __commonJS((exports) => {
|
|
2025
2025
|
var identity = require_identity();
|
|
2026
2026
|
var Scalar = require_Scalar();
|
|
@@ -2077,7 +2077,7 @@ var require_merge = __commonJS((exports) => {
|
|
|
2077
2077
|
exports.merge = merge;
|
|
2078
2078
|
});
|
|
2079
2079
|
|
|
2080
|
-
// ../../node_modules/.
|
|
2080
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/addPairToJSMap.js
|
|
2081
2081
|
var require_addPairToJSMap = __commonJS((exports) => {
|
|
2082
2082
|
var log = require_log();
|
|
2083
2083
|
var merge = require_merge();
|
|
@@ -2138,7 +2138,7 @@ var require_addPairToJSMap = __commonJS((exports) => {
|
|
|
2138
2138
|
exports.addPairToJSMap = addPairToJSMap;
|
|
2139
2139
|
});
|
|
2140
2140
|
|
|
2141
|
-
// ../../node_modules/.
|
|
2141
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/Pair.js
|
|
2142
2142
|
var require_Pair = __commonJS((exports) => {
|
|
2143
2143
|
var createNode = require_createNode();
|
|
2144
2144
|
var stringifyPair = require_stringifyPair();
|
|
@@ -2176,7 +2176,7 @@ var require_Pair = __commonJS((exports) => {
|
|
|
2176
2176
|
exports.createPair = createPair;
|
|
2177
2177
|
});
|
|
2178
2178
|
|
|
2179
|
-
// ../../node_modules/.
|
|
2179
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
2180
2180
|
var require_stringifyCollection = __commonJS((exports) => {
|
|
2181
2181
|
var identity = require_identity();
|
|
2182
2182
|
var stringify = require_stringify();
|
|
@@ -2328,7 +2328,7 @@ ${indent}${end}`;
|
|
|
2328
2328
|
exports.stringifyCollection = stringifyCollection;
|
|
2329
2329
|
});
|
|
2330
2330
|
|
|
2331
|
-
// ../../node_modules/.
|
|
2331
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/YAMLMap.js
|
|
2332
2332
|
var require_YAMLMap = __commonJS((exports) => {
|
|
2333
2333
|
var stringifyCollection = require_stringifyCollection();
|
|
2334
2334
|
var addPairToJSMap = require_addPairToJSMap();
|
|
@@ -2455,7 +2455,7 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
2455
2455
|
exports.findPair = findPair;
|
|
2456
2456
|
});
|
|
2457
2457
|
|
|
2458
|
-
// ../../node_modules/.
|
|
2458
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/common/map.js
|
|
2459
2459
|
var require_map = __commonJS((exports) => {
|
|
2460
2460
|
var identity = require_identity();
|
|
2461
2461
|
var YAMLMap = require_YAMLMap();
|
|
@@ -2474,7 +2474,7 @@ var require_map = __commonJS((exports) => {
|
|
|
2474
2474
|
exports.map = map;
|
|
2475
2475
|
});
|
|
2476
2476
|
|
|
2477
|
-
// ../../node_modules/.
|
|
2477
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
2478
2478
|
var require_YAMLSeq = __commonJS((exports) => {
|
|
2479
2479
|
var createNode = require_createNode();
|
|
2480
2480
|
var stringifyCollection = require_stringifyCollection();
|
|
@@ -2567,7 +2567,7 @@ var require_YAMLSeq = __commonJS((exports) => {
|
|
|
2567
2567
|
exports.YAMLSeq = YAMLSeq;
|
|
2568
2568
|
});
|
|
2569
2569
|
|
|
2570
|
-
// ../../node_modules/.
|
|
2570
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/common/seq.js
|
|
2571
2571
|
var require_seq = __commonJS((exports) => {
|
|
2572
2572
|
var identity = require_identity();
|
|
2573
2573
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -2586,7 +2586,7 @@ var require_seq = __commonJS((exports) => {
|
|
|
2586
2586
|
exports.seq = seq;
|
|
2587
2587
|
});
|
|
2588
2588
|
|
|
2589
|
-
// ../../node_modules/.
|
|
2589
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/common/string.js
|
|
2590
2590
|
var require_string = __commonJS((exports) => {
|
|
2591
2591
|
var stringifyString = require_stringifyString();
|
|
2592
2592
|
var string = {
|
|
@@ -2602,7 +2602,7 @@ var require_string = __commonJS((exports) => {
|
|
|
2602
2602
|
exports.string = string;
|
|
2603
2603
|
});
|
|
2604
2604
|
|
|
2605
|
-
// ../../node_modules/.
|
|
2605
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/common/null.js
|
|
2606
2606
|
var require_null = __commonJS((exports) => {
|
|
2607
2607
|
var Scalar = require_Scalar();
|
|
2608
2608
|
var nullTag = {
|
|
@@ -2617,7 +2617,7 @@ var require_null = __commonJS((exports) => {
|
|
|
2617
2617
|
exports.nullTag = nullTag;
|
|
2618
2618
|
});
|
|
2619
2619
|
|
|
2620
|
-
// ../../node_modules/.
|
|
2620
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/core/bool.js
|
|
2621
2621
|
var require_bool = __commonJS((exports) => {
|
|
2622
2622
|
var Scalar = require_Scalar();
|
|
2623
2623
|
var boolTag = {
|
|
@@ -2638,7 +2638,7 @@ var require_bool = __commonJS((exports) => {
|
|
|
2638
2638
|
exports.boolTag = boolTag;
|
|
2639
2639
|
});
|
|
2640
2640
|
|
|
2641
|
-
// ../../node_modules/.
|
|
2641
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/stringify/stringifyNumber.js
|
|
2642
2642
|
var require_stringifyNumber = __commonJS((exports) => {
|
|
2643
2643
|
function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
2644
2644
|
if (typeof value === "bigint")
|
|
@@ -2662,7 +2662,7 @@ var require_stringifyNumber = __commonJS((exports) => {
|
|
|
2662
2662
|
exports.stringifyNumber = stringifyNumber;
|
|
2663
2663
|
});
|
|
2664
2664
|
|
|
2665
|
-
// ../../node_modules/.
|
|
2665
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/core/float.js
|
|
2666
2666
|
var require_float = __commonJS((exports) => {
|
|
2667
2667
|
var Scalar = require_Scalar();
|
|
2668
2668
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -2705,7 +2705,7 @@ var require_float = __commonJS((exports) => {
|
|
|
2705
2705
|
exports.floatNaN = floatNaN;
|
|
2706
2706
|
});
|
|
2707
2707
|
|
|
2708
|
-
// ../../node_modules/.
|
|
2708
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/core/int.js
|
|
2709
2709
|
var require_int = __commonJS((exports) => {
|
|
2710
2710
|
var stringifyNumber = require_stringifyNumber();
|
|
2711
2711
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -2747,7 +2747,7 @@ var require_int = __commonJS((exports) => {
|
|
|
2747
2747
|
exports.intOct = intOct;
|
|
2748
2748
|
});
|
|
2749
2749
|
|
|
2750
|
-
// ../../node_modules/.
|
|
2750
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/core/schema.js
|
|
2751
2751
|
var require_schema = __commonJS((exports) => {
|
|
2752
2752
|
var map = require_map();
|
|
2753
2753
|
var _null = require_null();
|
|
@@ -2772,7 +2772,7 @@ var require_schema = __commonJS((exports) => {
|
|
|
2772
2772
|
exports.schema = schema;
|
|
2773
2773
|
});
|
|
2774
2774
|
|
|
2775
|
-
// ../../node_modules/.
|
|
2775
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/json/schema.js
|
|
2776
2776
|
var require_schema2 = __commonJS((exports) => {
|
|
2777
2777
|
var Scalar = require_Scalar();
|
|
2778
2778
|
var map = require_map();
|
|
@@ -2836,7 +2836,7 @@ var require_schema2 = __commonJS((exports) => {
|
|
|
2836
2836
|
exports.schema = schema;
|
|
2837
2837
|
});
|
|
2838
2838
|
|
|
2839
|
-
// ../../node_modules/.
|
|
2839
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
2840
2840
|
var require_binary = __commonJS((exports) => {
|
|
2841
2841
|
var node_buffer = __require("buffer");
|
|
2842
2842
|
var Scalar = require_Scalar();
|
|
@@ -2891,7 +2891,7 @@ var require_binary = __commonJS((exports) => {
|
|
|
2891
2891
|
exports.binary = binary;
|
|
2892
2892
|
});
|
|
2893
2893
|
|
|
2894
|
-
// ../../node_modules/.
|
|
2894
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
|
|
2895
2895
|
var require_pairs = __commonJS((exports) => {
|
|
2896
2896
|
var identity = require_identity();
|
|
2897
2897
|
var Pair = require_Pair();
|
|
@@ -2966,7 +2966,7 @@ ${cn.comment}` : item.comment;
|
|
|
2966
2966
|
exports.resolvePairs = resolvePairs;
|
|
2967
2967
|
});
|
|
2968
2968
|
|
|
2969
|
-
// ../../node_modules/.
|
|
2969
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/omap.js
|
|
2970
2970
|
var require_omap = __commonJS((exports) => {
|
|
2971
2971
|
var identity = require_identity();
|
|
2972
2972
|
var toJS = require_toJS();
|
|
@@ -3038,7 +3038,7 @@ var require_omap = __commonJS((exports) => {
|
|
|
3038
3038
|
exports.omap = omap;
|
|
3039
3039
|
});
|
|
3040
3040
|
|
|
3041
|
-
// ../../node_modules/.
|
|
3041
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
3042
3042
|
var require_bool2 = __commonJS((exports) => {
|
|
3043
3043
|
var Scalar = require_Scalar();
|
|
3044
3044
|
function boolStringify({ value, source }, ctx) {
|
|
@@ -3067,7 +3067,7 @@ var require_bool2 = __commonJS((exports) => {
|
|
|
3067
3067
|
exports.trueTag = trueTag;
|
|
3068
3068
|
});
|
|
3069
3069
|
|
|
3070
|
-
// ../../node_modules/.
|
|
3070
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/float.js
|
|
3071
3071
|
var require_float2 = __commonJS((exports) => {
|
|
3072
3072
|
var Scalar = require_Scalar();
|
|
3073
3073
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -3113,7 +3113,7 @@ var require_float2 = __commonJS((exports) => {
|
|
|
3113
3113
|
exports.floatNaN = floatNaN;
|
|
3114
3114
|
});
|
|
3115
3115
|
|
|
3116
|
-
// ../../node_modules/.
|
|
3116
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/int.js
|
|
3117
3117
|
var require_int2 = __commonJS((exports) => {
|
|
3118
3118
|
var stringifyNumber = require_stringifyNumber();
|
|
3119
3119
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -3189,7 +3189,7 @@ var require_int2 = __commonJS((exports) => {
|
|
|
3189
3189
|
exports.intOct = intOct;
|
|
3190
3190
|
});
|
|
3191
3191
|
|
|
3192
|
-
// ../../node_modules/.
|
|
3192
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/set.js
|
|
3193
3193
|
var require_set = __commonJS((exports) => {
|
|
3194
3194
|
var identity = require_identity();
|
|
3195
3195
|
var Pair = require_Pair();
|
|
@@ -3272,7 +3272,7 @@ var require_set = __commonJS((exports) => {
|
|
|
3272
3272
|
exports.set = set;
|
|
3273
3273
|
});
|
|
3274
3274
|
|
|
3275
|
-
// ../../node_modules/.
|
|
3275
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
|
|
3276
3276
|
var require_timestamp = __commonJS((exports) => {
|
|
3277
3277
|
var stringifyNumber = require_stringifyNumber();
|
|
3278
3278
|
function parseSexagesimal(str, asBigInt) {
|
|
@@ -3354,7 +3354,7 @@ var require_timestamp = __commonJS((exports) => {
|
|
|
3354
3354
|
exports.timestamp = timestamp;
|
|
3355
3355
|
});
|
|
3356
3356
|
|
|
3357
|
-
// ../../node_modules/.
|
|
3357
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
3358
3358
|
var require_schema3 = __commonJS((exports) => {
|
|
3359
3359
|
var map = require_map();
|
|
3360
3360
|
var _null = require_null();
|
|
@@ -3395,7 +3395,7 @@ var require_schema3 = __commonJS((exports) => {
|
|
|
3395
3395
|
exports.schema = schema;
|
|
3396
3396
|
});
|
|
3397
3397
|
|
|
3398
|
-
// ../../node_modules/.
|
|
3398
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/tags.js
|
|
3399
3399
|
var require_tags = __commonJS((exports) => {
|
|
3400
3400
|
var map = require_map();
|
|
3401
3401
|
var _null = require_null();
|
|
@@ -3486,7 +3486,7 @@ var require_tags = __commonJS((exports) => {
|
|
|
3486
3486
|
exports.getTags = getTags;
|
|
3487
3487
|
});
|
|
3488
3488
|
|
|
3489
|
-
// ../../node_modules/.
|
|
3489
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/Schema.js
|
|
3490
3490
|
var require_Schema = __commonJS((exports) => {
|
|
3491
3491
|
var identity = require_identity();
|
|
3492
3492
|
var map = require_map();
|
|
@@ -3516,7 +3516,7 @@ var require_Schema = __commonJS((exports) => {
|
|
|
3516
3516
|
exports.Schema = Schema;
|
|
3517
3517
|
});
|
|
3518
3518
|
|
|
3519
|
-
// ../../node_modules/.
|
|
3519
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
3520
3520
|
var require_stringifyDocument = __commonJS((exports) => {
|
|
3521
3521
|
var identity = require_identity();
|
|
3522
3522
|
var stringify = require_stringify();
|
|
@@ -3596,7 +3596,7 @@ var require_stringifyDocument = __commonJS((exports) => {
|
|
|
3596
3596
|
exports.stringifyDocument = stringifyDocument;
|
|
3597
3597
|
});
|
|
3598
3598
|
|
|
3599
|
-
// ../../node_modules/.
|
|
3599
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/doc/Document.js
|
|
3600
3600
|
var require_Document = __commonJS((exports) => {
|
|
3601
3601
|
var Alias = require_Alias();
|
|
3602
3602
|
var Collection = require_Collection();
|
|
@@ -3831,7 +3831,7 @@ var require_Document = __commonJS((exports) => {
|
|
|
3831
3831
|
exports.Document = Document;
|
|
3832
3832
|
});
|
|
3833
3833
|
|
|
3834
|
-
// ../../node_modules/.
|
|
3834
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/errors.js
|
|
3835
3835
|
var require_errors = __commonJS((exports) => {
|
|
3836
3836
|
class YAMLError extends Error {
|
|
3837
3837
|
constructor(name, pos, code, message) {
|
|
@@ -3896,7 +3896,7 @@ ${pointer}
|
|
|
3896
3896
|
exports.prettifyError = prettifyError;
|
|
3897
3897
|
});
|
|
3898
3898
|
|
|
3899
|
-
// ../../node_modules/.
|
|
3899
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/resolve-props.js
|
|
3900
3900
|
var require_resolve_props = __commonJS((exports) => {
|
|
3901
3901
|
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
|
|
3902
3902
|
let spaceBefore = false;
|
|
@@ -4026,7 +4026,7 @@ var require_resolve_props = __commonJS((exports) => {
|
|
|
4026
4026
|
exports.resolveProps = resolveProps;
|
|
4027
4027
|
});
|
|
4028
4028
|
|
|
4029
|
-
// ../../node_modules/.
|
|
4029
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/util-contains-newline.js
|
|
4030
4030
|
var require_util_contains_newline = __commonJS((exports) => {
|
|
4031
4031
|
function containsNewline(key) {
|
|
4032
4032
|
if (!key)
|
|
@@ -4066,7 +4066,7 @@ var require_util_contains_newline = __commonJS((exports) => {
|
|
|
4066
4066
|
exports.containsNewline = containsNewline;
|
|
4067
4067
|
});
|
|
4068
4068
|
|
|
4069
|
-
// ../../node_modules/.
|
|
4069
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/util-flow-indent-check.js
|
|
4070
4070
|
var require_util_flow_indent_check = __commonJS((exports) => {
|
|
4071
4071
|
var utilContainsNewline = require_util_contains_newline();
|
|
4072
4072
|
function flowIndentCheck(indent, fc, onError) {
|
|
@@ -4081,7 +4081,7 @@ var require_util_flow_indent_check = __commonJS((exports) => {
|
|
|
4081
4081
|
exports.flowIndentCheck = flowIndentCheck;
|
|
4082
4082
|
});
|
|
4083
4083
|
|
|
4084
|
-
// ../../node_modules/.
|
|
4084
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/util-map-includes.js
|
|
4085
4085
|
var require_util_map_includes = __commonJS((exports) => {
|
|
4086
4086
|
var identity = require_identity();
|
|
4087
4087
|
function mapIncludes(ctx, items, search) {
|
|
@@ -4094,7 +4094,7 @@ var require_util_map_includes = __commonJS((exports) => {
|
|
|
4094
4094
|
exports.mapIncludes = mapIncludes;
|
|
4095
4095
|
});
|
|
4096
4096
|
|
|
4097
|
-
// ../../node_modules/.
|
|
4097
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/resolve-block-map.js
|
|
4098
4098
|
var require_resolve_block_map = __commonJS((exports) => {
|
|
4099
4099
|
var Pair = require_Pair();
|
|
4100
4100
|
var YAMLMap = require_YAMLMap();
|
|
@@ -4201,7 +4201,7 @@ var require_resolve_block_map = __commonJS((exports) => {
|
|
|
4201
4201
|
exports.resolveBlockMap = resolveBlockMap;
|
|
4202
4202
|
});
|
|
4203
4203
|
|
|
4204
|
-
// ../../node_modules/.
|
|
4204
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/resolve-block-seq.js
|
|
4205
4205
|
var require_resolve_block_seq = __commonJS((exports) => {
|
|
4206
4206
|
var YAMLSeq = require_YAMLSeq();
|
|
4207
4207
|
var resolveProps = require_resolve_props();
|
|
@@ -4249,7 +4249,7 @@ var require_resolve_block_seq = __commonJS((exports) => {
|
|
|
4249
4249
|
exports.resolveBlockSeq = resolveBlockSeq;
|
|
4250
4250
|
});
|
|
4251
4251
|
|
|
4252
|
-
// ../../node_modules/.
|
|
4252
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/resolve-end.js
|
|
4253
4253
|
var require_resolve_end = __commonJS((exports) => {
|
|
4254
4254
|
function resolveEnd(end, offset, reqSpace, onError) {
|
|
4255
4255
|
let comment = "";
|
|
@@ -4289,7 +4289,7 @@ var require_resolve_end = __commonJS((exports) => {
|
|
|
4289
4289
|
exports.resolveEnd = resolveEnd;
|
|
4290
4290
|
});
|
|
4291
4291
|
|
|
4292
|
-
// ../../node_modules/.
|
|
4292
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/resolve-flow-collection.js
|
|
4293
4293
|
var require_resolve_flow_collection = __commonJS((exports) => {
|
|
4294
4294
|
var identity = require_identity();
|
|
4295
4295
|
var Pair = require_Pair();
|
|
@@ -4480,7 +4480,7 @@ var require_resolve_flow_collection = __commonJS((exports) => {
|
|
|
4480
4480
|
exports.resolveFlowCollection = resolveFlowCollection;
|
|
4481
4481
|
});
|
|
4482
4482
|
|
|
4483
|
-
// ../../node_modules/.
|
|
4483
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/compose-collection.js
|
|
4484
4484
|
var require_compose_collection = __commonJS((exports) => {
|
|
4485
4485
|
var identity = require_identity();
|
|
4486
4486
|
var Scalar = require_Scalar();
|
|
@@ -4542,7 +4542,7 @@ var require_compose_collection = __commonJS((exports) => {
|
|
|
4542
4542
|
exports.composeCollection = composeCollection;
|
|
4543
4543
|
});
|
|
4544
4544
|
|
|
4545
|
-
// ../../node_modules/.
|
|
4545
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/resolve-block-scalar.js
|
|
4546
4546
|
var require_resolve_block_scalar = __commonJS((exports) => {
|
|
4547
4547
|
var Scalar = require_Scalar();
|
|
4548
4548
|
function resolveBlockScalar(ctx, scalar, onError) {
|
|
@@ -4735,7 +4735,7 @@ var require_resolve_block_scalar = __commonJS((exports) => {
|
|
|
4735
4735
|
exports.resolveBlockScalar = resolveBlockScalar;
|
|
4736
4736
|
});
|
|
4737
4737
|
|
|
4738
|
-
// ../../node_modules/.
|
|
4738
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/resolve-flow-scalar.js
|
|
4739
4739
|
var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
4740
4740
|
var Scalar = require_Scalar();
|
|
4741
4741
|
var resolveEnd = require_resolve_end();
|
|
@@ -4952,7 +4952,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
4952
4952
|
exports.resolveFlowScalar = resolveFlowScalar;
|
|
4953
4953
|
});
|
|
4954
4954
|
|
|
4955
|
-
// ../../node_modules/.
|
|
4955
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/compose-scalar.js
|
|
4956
4956
|
var require_compose_scalar = __commonJS((exports) => {
|
|
4957
4957
|
var identity = require_identity();
|
|
4958
4958
|
var Scalar = require_Scalar();
|
|
@@ -5030,7 +5030,7 @@ var require_compose_scalar = __commonJS((exports) => {
|
|
|
5030
5030
|
exports.composeScalar = composeScalar;
|
|
5031
5031
|
});
|
|
5032
5032
|
|
|
5033
|
-
// ../../node_modules/.
|
|
5033
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/util-empty-scalar-position.js
|
|
5034
5034
|
var require_util_empty_scalar_position = __commonJS((exports) => {
|
|
5035
5035
|
function emptyScalarPosition(offset, before, pos) {
|
|
5036
5036
|
if (before) {
|
|
@@ -5057,7 +5057,7 @@ var require_util_empty_scalar_position = __commonJS((exports) => {
|
|
|
5057
5057
|
exports.emptyScalarPosition = emptyScalarPosition;
|
|
5058
5058
|
});
|
|
5059
5059
|
|
|
5060
|
-
// ../../node_modules/.
|
|
5060
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/compose-node.js
|
|
5061
5061
|
var require_compose_node = __commonJS((exports) => {
|
|
5062
5062
|
var Alias = require_Alias();
|
|
5063
5063
|
var identity = require_identity();
|
|
@@ -5160,7 +5160,7 @@ var require_compose_node = __commonJS((exports) => {
|
|
|
5160
5160
|
exports.composeNode = composeNode;
|
|
5161
5161
|
});
|
|
5162
5162
|
|
|
5163
|
-
// ../../node_modules/.
|
|
5163
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/compose-doc.js
|
|
5164
5164
|
var require_compose_doc = __commonJS((exports) => {
|
|
5165
5165
|
var Document = require_Document();
|
|
5166
5166
|
var composeNode = require_compose_node();
|
|
@@ -5200,7 +5200,7 @@ var require_compose_doc = __commonJS((exports) => {
|
|
|
5200
5200
|
exports.composeDoc = composeDoc;
|
|
5201
5201
|
});
|
|
5202
5202
|
|
|
5203
|
-
// ../../node_modules/.
|
|
5203
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/composer.js
|
|
5204
5204
|
var require_composer = __commonJS((exports) => {
|
|
5205
5205
|
var node_process = __require("process");
|
|
5206
5206
|
var directives = require_directives();
|
|
@@ -5286,10 +5286,8 @@ ${cb}` : comment;
|
|
|
5286
5286
|
}
|
|
5287
5287
|
}
|
|
5288
5288
|
if (afterDoc) {
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
for (let i = 0;i < this.warnings.length; ++i)
|
|
5292
|
-
doc.warnings.push(this.warnings[i]);
|
|
5289
|
+
Array.prototype.push.apply(doc.errors, this.errors);
|
|
5290
|
+
Array.prototype.push.apply(doc.warnings, this.warnings);
|
|
5293
5291
|
} else {
|
|
5294
5292
|
doc.errors = this.errors;
|
|
5295
5293
|
doc.warnings = this.warnings;
|
|
@@ -5391,7 +5389,7 @@ ${end.comment}` : end.comment;
|
|
|
5391
5389
|
exports.Composer = Composer;
|
|
5392
5390
|
});
|
|
5393
5391
|
|
|
5394
|
-
// ../../node_modules/.
|
|
5392
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/parse/cst-scalar.js
|
|
5395
5393
|
var require_cst_scalar = __commonJS((exports) => {
|
|
5396
5394
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
5397
5395
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
@@ -5581,7 +5579,7 @@ var require_cst_scalar = __commonJS((exports) => {
|
|
|
5581
5579
|
exports.setScalarValue = setScalarValue;
|
|
5582
5580
|
});
|
|
5583
5581
|
|
|
5584
|
-
// ../../node_modules/.
|
|
5582
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/parse/cst-stringify.js
|
|
5585
5583
|
var require_cst_stringify = __commonJS((exports) => {
|
|
5586
5584
|
var stringify = (cst) => ("type" in cst) ? stringifyToken(cst) : stringifyItem(cst);
|
|
5587
5585
|
function stringifyToken(token) {
|
|
@@ -5639,7 +5637,7 @@ var require_cst_stringify = __commonJS((exports) => {
|
|
|
5639
5637
|
exports.stringify = stringify;
|
|
5640
5638
|
});
|
|
5641
5639
|
|
|
5642
|
-
// ../../node_modules/.
|
|
5640
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/parse/cst-visit.js
|
|
5643
5641
|
var require_cst_visit = __commonJS((exports) => {
|
|
5644
5642
|
var BREAK = Symbol("break visit");
|
|
5645
5643
|
var SKIP = Symbol("skip children");
|
|
@@ -5698,7 +5696,7 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
5698
5696
|
exports.visit = visit;
|
|
5699
5697
|
});
|
|
5700
5698
|
|
|
5701
|
-
// ../../node_modules/.
|
|
5699
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/parse/cst.js
|
|
5702
5700
|
var require_cst = __commonJS((exports) => {
|
|
5703
5701
|
var cstScalar = require_cst_scalar();
|
|
5704
5702
|
var cstStringify = require_cst_stringify();
|
|
@@ -5799,7 +5797,7 @@ var require_cst = __commonJS((exports) => {
|
|
|
5799
5797
|
exports.tokenType = tokenType;
|
|
5800
5798
|
});
|
|
5801
5799
|
|
|
5802
|
-
// ../../node_modules/.
|
|
5800
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/parse/lexer.js
|
|
5803
5801
|
var require_lexer = __commonJS((exports) => {
|
|
5804
5802
|
var cst = require_cst();
|
|
5805
5803
|
function isEmpty(ch) {
|
|
@@ -6001,7 +5999,7 @@ var require_lexer = __commonJS((exports) => {
|
|
|
6001
5999
|
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
|
|
6002
6000
|
this.indentNext = this.indentValue + 1;
|
|
6003
6001
|
this.indentValue += n;
|
|
6004
|
-
return
|
|
6002
|
+
return yield* this.parseBlockStart();
|
|
6005
6003
|
}
|
|
6006
6004
|
return "doc";
|
|
6007
6005
|
}
|
|
@@ -6308,37 +6306,26 @@ var require_lexer = __commonJS((exports) => {
|
|
|
6308
6306
|
return 0;
|
|
6309
6307
|
}
|
|
6310
6308
|
*pushIndicators() {
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
const ch1 = this.charAt(1);
|
|
6328
|
-
if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
|
|
6329
|
-
if (!inFlow)
|
|
6330
|
-
this.indentNext = this.indentValue + 1;
|
|
6331
|
-
else if (this.flowKey)
|
|
6332
|
-
this.flowKey = false;
|
|
6333
|
-
n += yield* this.pushCount(1);
|
|
6334
|
-
n += yield* this.pushSpaces(true);
|
|
6335
|
-
continue loop;
|
|
6336
|
-
}
|
|
6337
|
-
}
|
|
6309
|
+
switch (this.charAt(0)) {
|
|
6310
|
+
case "!":
|
|
6311
|
+
return (yield* this.pushTag()) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
|
|
6312
|
+
case "&":
|
|
6313
|
+
return (yield* this.pushUntil(isNotAnchorChar)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
|
|
6314
|
+
case "-":
|
|
6315
|
+
case "?":
|
|
6316
|
+
case ":": {
|
|
6317
|
+
const inFlow = this.flowLevel > 0;
|
|
6318
|
+
const ch1 = this.charAt(1);
|
|
6319
|
+
if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
|
|
6320
|
+
if (!inFlow)
|
|
6321
|
+
this.indentNext = this.indentValue + 1;
|
|
6322
|
+
else if (this.flowKey)
|
|
6323
|
+
this.flowKey = false;
|
|
6324
|
+
return (yield* this.pushCount(1)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
|
|
6338
6325
|
}
|
|
6339
|
-
break loop;
|
|
6340
6326
|
}
|
|
6341
|
-
|
|
6327
|
+
}
|
|
6328
|
+
return 0;
|
|
6342
6329
|
}
|
|
6343
6330
|
*pushTag() {
|
|
6344
6331
|
if (this.charAt(1) === "<") {
|
|
@@ -6396,7 +6383,7 @@ var require_lexer = __commonJS((exports) => {
|
|
|
6396
6383
|
exports.Lexer = Lexer;
|
|
6397
6384
|
});
|
|
6398
6385
|
|
|
6399
|
-
// ../../node_modules/.
|
|
6386
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/parse/line-counter.js
|
|
6400
6387
|
var require_line_counter = __commonJS((exports) => {
|
|
6401
6388
|
class LineCounter {
|
|
6402
6389
|
constructor() {
|
|
@@ -6424,7 +6411,7 @@ var require_line_counter = __commonJS((exports) => {
|
|
|
6424
6411
|
exports.LineCounter = LineCounter;
|
|
6425
6412
|
});
|
|
6426
6413
|
|
|
6427
|
-
// ../../node_modules/.
|
|
6414
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/parse/parser.js
|
|
6428
6415
|
var require_parser = __commonJS((exports) => {
|
|
6429
6416
|
var node_process = __require("process");
|
|
6430
6417
|
var cst = require_cst();
|
|
@@ -6492,13 +6479,6 @@ var require_parser = __commonJS((exports) => {
|
|
|
6492
6479
|
while (prev[++i]?.type === "space") {}
|
|
6493
6480
|
return prev.splice(i, prev.length);
|
|
6494
6481
|
}
|
|
6495
|
-
function arrayPushArray(target, source) {
|
|
6496
|
-
if (source.length < 1e5)
|
|
6497
|
-
Array.prototype.push.apply(target, source);
|
|
6498
|
-
else
|
|
6499
|
-
for (let i = 0;i < source.length; ++i)
|
|
6500
|
-
target.push(source[i]);
|
|
6501
|
-
}
|
|
6502
6482
|
function fixFlowSeqItems(fc) {
|
|
6503
6483
|
if (fc.start.type === "flow-seq-start") {
|
|
6504
6484
|
for (const it of fc.items) {
|
|
@@ -6508,11 +6488,11 @@ var require_parser = __commonJS((exports) => {
|
|
|
6508
6488
|
delete it.key;
|
|
6509
6489
|
if (isFlowToken(it.value)) {
|
|
6510
6490
|
if (it.value.end)
|
|
6511
|
-
|
|
6491
|
+
Array.prototype.push.apply(it.value.end, it.sep);
|
|
6512
6492
|
else
|
|
6513
6493
|
it.value.end = it.sep;
|
|
6514
6494
|
} else
|
|
6515
|
-
|
|
6495
|
+
Array.prototype.push.apply(it.start, it.sep);
|
|
6516
6496
|
delete it.sep;
|
|
6517
6497
|
}
|
|
6518
6498
|
}
|
|
@@ -6852,7 +6832,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
6852
6832
|
const prev = map.items[map.items.length - 2];
|
|
6853
6833
|
const end = prev?.value?.end;
|
|
6854
6834
|
if (Array.isArray(end)) {
|
|
6855
|
-
|
|
6835
|
+
Array.prototype.push.apply(end, it.start);
|
|
6856
6836
|
end.push(this.sourceToken);
|
|
6857
6837
|
map.items.pop();
|
|
6858
6838
|
return;
|
|
@@ -7040,7 +7020,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
7040
7020
|
const prev = seq.items[seq.items.length - 2];
|
|
7041
7021
|
const end = prev?.value?.end;
|
|
7042
7022
|
if (Array.isArray(end)) {
|
|
7043
|
-
|
|
7023
|
+
Array.prototype.push.apply(end, it.start);
|
|
7044
7024
|
end.push(this.sourceToken);
|
|
7045
7025
|
seq.items.pop();
|
|
7046
7026
|
return;
|
|
@@ -7280,7 +7260,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
7280
7260
|
exports.Parser = Parser;
|
|
7281
7261
|
});
|
|
7282
7262
|
|
|
7283
|
-
// ../../node_modules/.
|
|
7263
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/public-api.js
|
|
7284
7264
|
var require_public_api = __commonJS((exports) => {
|
|
7285
7265
|
var composer = require_composer();
|
|
7286
7266
|
var Document = require_Document();
|
|
@@ -7374,7 +7354,7 @@ var require_public_api = __commonJS((exports) => {
|
|
|
7374
7354
|
exports.stringify = stringify;
|
|
7375
7355
|
});
|
|
7376
7356
|
|
|
7377
|
-
// ../../node_modules/.
|
|
7357
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/index.js
|
|
7378
7358
|
var require_dist = __commonJS((exports) => {
|
|
7379
7359
|
var composer = require_composer();
|
|
7380
7360
|
var Document = require_Document();
|
|
@@ -7427,7 +7407,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7427
7407
|
var require_package = __commonJS((exports, module) => {
|
|
7428
7408
|
module.exports = {
|
|
7429
7409
|
name: "@ai-setting/roy-agent-cli",
|
|
7430
|
-
version: "1.6.
|
|
7410
|
+
version: "1.6.2",
|
|
7431
7411
|
type: "module",
|
|
7432
7412
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7433
7413
|
main: "./dist/index.js",
|
|
@@ -7937,21 +7917,30 @@ class EnvironmentService {
|
|
|
7937
7917
|
env.registerComponent(memoryComponent);
|
|
7938
7918
|
env.registerComponent(eventSourceComponent);
|
|
7939
7919
|
env.registerComponent(workflowComponent);
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7920
|
+
if (options?.loadPlugins === true) {
|
|
7921
|
+
this.pluginComponent = new PluginComponent;
|
|
7922
|
+
const pluginComponent = this.pluginComponent;
|
|
7923
|
+
await pluginComponent.init({
|
|
7924
|
+
name: "plugin",
|
|
7925
|
+
version: "1.0.0",
|
|
7926
|
+
enabled: true,
|
|
7927
|
+
env,
|
|
7928
|
+
options: {
|
|
7929
|
+
configComponent
|
|
7930
|
+
}
|
|
7931
|
+
});
|
|
7932
|
+
env.registerComponent(pluginComponent);
|
|
7933
|
+
} else {
|
|
7934
|
+
logger.debug(`[EnvironmentService] Skipping PluginComponent init (command=${options?.commandName ?? "<unknown>"}, reason=loadPlugins=false)`);
|
|
7935
|
+
}
|
|
7949
7936
|
await env.init();
|
|
7950
7937
|
await env.start();
|
|
7951
7938
|
await agentComponent.refreshDependencies();
|
|
7952
7939
|
logger.debug("[EnvironmentService] AgentComponent dependencies refreshed after env.start()");
|
|
7953
|
-
if (options?.plugins && options.plugins.length > 0) {
|
|
7940
|
+
if (options?.loadPlugins === true && options?.plugins && options.plugins.length > 0) {
|
|
7954
7941
|
await this.loadPlugins(options.plugins);
|
|
7942
|
+
} else if (options?.loadPlugins !== true && options?.plugins && options.plugins.length > 0) {
|
|
7943
|
+
logger.debug(`[EnvironmentService] Skipping plugin loading because loadPlugins=false (command=${options?.commandName ?? "<unknown>"})`);
|
|
7955
7944
|
}
|
|
7956
7945
|
this.environment = env;
|
|
7957
7946
|
return env;
|
|
@@ -8665,7 +8654,9 @@ function createActCommand(externalEnvService) {
|
|
|
8665
8654
|
await envService.create({
|
|
8666
8655
|
envName: args.env,
|
|
8667
8656
|
configPath: args.config,
|
|
8668
|
-
plugins: [...otherPluginNames, ...coderPluginNames]
|
|
8657
|
+
plugins: [...otherPluginNames, ...coderPluginNames],
|
|
8658
|
+
loadPlugins: true,
|
|
8659
|
+
commandName: "act"
|
|
8669
8660
|
});
|
|
8670
8661
|
}
|
|
8671
8662
|
const env = envService.getEnvironment();
|
|
@@ -9771,6 +9762,68 @@ function joinResolvedSystemPrompts(prompts) {
|
|
|
9771
9762
|
// src/commands/shared/ask-user-handler.ts
|
|
9772
9763
|
import * as readline from "readline";
|
|
9773
9764
|
import chalk3 from "chalk";
|
|
9765
|
+
|
|
9766
|
+
// src/commands/shared/ask-user-timeout.ts
|
|
9767
|
+
var ASK_USER_TIMEOUT_MS = 120000;
|
|
9768
|
+
var ASK_USER_TIMEOUT_SENTINEL_PREFIX = "__ASK_USER_TIMEOUT__:";
|
|
9769
|
+
function isAskUserTimeoutSentinel(value) {
|
|
9770
|
+
return typeof value === "string" && value.length > ASK_USER_TIMEOUT_SENTINEL_PREFIX.length && value.startsWith(ASK_USER_TIMEOUT_SENTINEL_PREFIX);
|
|
9771
|
+
}
|
|
9772
|
+
function createAskUserTimeoutSentinel(errorInfo, timeoutMs, extra) {
|
|
9773
|
+
const payload = {
|
|
9774
|
+
query: errorInfo?.query ?? extra?.question ?? "",
|
|
9775
|
+
sessionId: errorInfo?.sessionId,
|
|
9776
|
+
agentSessionId: errorInfo?.agentSessionId,
|
|
9777
|
+
nodeId: errorInfo?.nodeId,
|
|
9778
|
+
nodeType: errorInfo?.nodeType,
|
|
9779
|
+
timestamp: Date.now(),
|
|
9780
|
+
timeoutMs,
|
|
9781
|
+
source: extra?.source ?? "repl"
|
|
9782
|
+
};
|
|
9783
|
+
return ASK_USER_TIMEOUT_SENTINEL_PREFIX + JSON.stringify(payload);
|
|
9784
|
+
}
|
|
9785
|
+
function withAskUserTimeoutRace(opts) {
|
|
9786
|
+
const { rl, timeoutMs, onLine, onTimeout } = opts;
|
|
9787
|
+
let resolved = false;
|
|
9788
|
+
let timer = null;
|
|
9789
|
+
const handleLine = (input) => {
|
|
9790
|
+
if (resolved)
|
|
9791
|
+
return;
|
|
9792
|
+
resolved = true;
|
|
9793
|
+
rl.removeListener("line", handleLine);
|
|
9794
|
+
if (timer) {
|
|
9795
|
+
clearTimeout(timer);
|
|
9796
|
+
timer = null;
|
|
9797
|
+
}
|
|
9798
|
+
onLine(input);
|
|
9799
|
+
};
|
|
9800
|
+
rl.on("line", handleLine);
|
|
9801
|
+
timer = setTimeout(() => {
|
|
9802
|
+
if (resolved)
|
|
9803
|
+
return;
|
|
9804
|
+
resolved = true;
|
|
9805
|
+
rl.removeListener("line", handleLine);
|
|
9806
|
+
onTimeout();
|
|
9807
|
+
timer = null;
|
|
9808
|
+
}, timeoutMs);
|
|
9809
|
+
if (timer && typeof timer.unref === "function") {
|
|
9810
|
+
timer.unref();
|
|
9811
|
+
}
|
|
9812
|
+
return {
|
|
9813
|
+
cancel() {
|
|
9814
|
+
if (resolved)
|
|
9815
|
+
return;
|
|
9816
|
+
resolved = true;
|
|
9817
|
+
rl.removeListener("line", handleLine);
|
|
9818
|
+
if (timer) {
|
|
9819
|
+
clearTimeout(timer);
|
|
9820
|
+
timer = null;
|
|
9821
|
+
}
|
|
9822
|
+
}
|
|
9823
|
+
};
|
|
9824
|
+
}
|
|
9825
|
+
|
|
9826
|
+
// src/commands/shared/ask-user-handler.ts
|
|
9774
9827
|
function parseOptionsFromQuery(query) {
|
|
9775
9828
|
const optionsMatch = query.match(/\(选项:\s*(.+)\)/);
|
|
9776
9829
|
if (optionsMatch) {
|
|
@@ -9825,7 +9878,6 @@ function parseUserInput(input, options) {
|
|
|
9825
9878
|
}
|
|
9826
9879
|
return { type: "text", value: trimmedInput };
|
|
9827
9880
|
}
|
|
9828
|
-
|
|
9829
9881
|
// src/commands/interactive-shutdown.ts
|
|
9830
9882
|
import { TempFileManager as TempFileManager2 } from "@ai-setting/roy-agent-core/utils/temp-file-manager";
|
|
9831
9883
|
async function shutdownInteractiveSteps(deps) {
|
|
@@ -9972,6 +10024,7 @@ class REPL {
|
|
|
9972
10024
|
sessionComponent = null;
|
|
9973
10025
|
lastAttachPath = undefined;
|
|
9974
10026
|
lastUsage = null;
|
|
10027
|
+
askUserTimeoutMs = ASK_USER_TIMEOUT_MS;
|
|
9975
10028
|
setLastUsage(usage) {
|
|
9976
10029
|
this.lastUsage = usage;
|
|
9977
10030
|
}
|
|
@@ -10359,22 +10412,27 @@ ${COLORS.error("❌ 执行失败: " + error)}
|
|
|
10359
10412
|
async handleAskUserInteraction(errorInfo) {
|
|
10360
10413
|
const { question, options } = parseOptionsFromQuery(errorInfo.query);
|
|
10361
10414
|
console.log(formatAskUserOutput({ ...errorInfo, query: question, options }));
|
|
10362
|
-
const userResponse = await this.promptUser(question, options);
|
|
10415
|
+
const userResponse = await this.promptUser(question, options, errorInfo);
|
|
10416
|
+
if (isAskUserTimeoutSentinel(userResponse)) {
|
|
10417
|
+
console.log(chalk5.dim(`
|
|
10418
|
+
请直接输入新指令继续,或使用 /abort 中断当前工作流。`));
|
|
10419
|
+
return;
|
|
10420
|
+
}
|
|
10363
10421
|
console.log(COLORS.userInput(`❯ ${userResponse.replace(/\n/g, `
|
|
10364
10422
|
` + COLORS.userInput("❯ "))}`));
|
|
10365
10423
|
await this.executeInternal(userResponse, { showPrompt: false });
|
|
10366
10424
|
}
|
|
10367
|
-
promptUser(question, options) {
|
|
10425
|
+
promptUser(question, options, errorInfo, opts) {
|
|
10426
|
+
const timeoutMs = opts?.timeoutMs ?? this.askUserTimeoutMs ?? ASK_USER_TIMEOUT_MS;
|
|
10368
10427
|
return new Promise((resolve) => {
|
|
10369
10428
|
this.rl.setPrompt(COLORS.userInput("❯ "));
|
|
10370
10429
|
this.rl.prompt(true);
|
|
10371
|
-
const
|
|
10372
|
-
this.rl.removeListener("line", handleLine);
|
|
10430
|
+
const finishWithUserInput = (input) => {
|
|
10373
10431
|
const trimmedInput = input.trim();
|
|
10374
10432
|
if (!trimmedInput) {
|
|
10375
10433
|
console.log(chalk5.yellow(`⚠️ 输入不能为空,请重新输入
|
|
10376
10434
|
`));
|
|
10377
|
-
this.promptUser(question, options).then(resolve);
|
|
10435
|
+
this.promptUser(question, options, errorInfo, opts).then(resolve);
|
|
10378
10436
|
return;
|
|
10379
10437
|
}
|
|
10380
10438
|
const parsed = parseUserInput(trimmedInput, options);
|
|
@@ -10389,7 +10447,21 @@ ${COLORS.error("❌ 执行失败: " + error)}
|
|
|
10389
10447
|
resolve(parsed.value);
|
|
10390
10448
|
}
|
|
10391
10449
|
};
|
|
10392
|
-
|
|
10450
|
+
withAskUserTimeoutRace({
|
|
10451
|
+
rl: this.rl,
|
|
10452
|
+
timeoutMs,
|
|
10453
|
+
onLine: (input) => {
|
|
10454
|
+
finishWithUserInput(input);
|
|
10455
|
+
},
|
|
10456
|
+
onTimeout: () => {
|
|
10457
|
+
console.log(chalk5.yellow(`
|
|
10458
|
+
⏱ ask_user 超时:${timeoutMs}ms 内未收到回应,已自动解除等待。`));
|
|
10459
|
+
resolve(createAskUserTimeoutSentinel(errorInfo, timeoutMs, {
|
|
10460
|
+
source: "repl",
|
|
10461
|
+
question
|
|
10462
|
+
}));
|
|
10463
|
+
}
|
|
10464
|
+
});
|
|
10393
10465
|
});
|
|
10394
10466
|
}
|
|
10395
10467
|
handleSigint() {
|
|
@@ -10576,7 +10648,9 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10576
10648
|
if (!externalEnvService) {
|
|
10577
10649
|
await envService.create({
|
|
10578
10650
|
configPath: args.config,
|
|
10579
|
-
plugins: [...componentPluginNames, ...coderPluginNames]
|
|
10651
|
+
plugins: [...componentPluginNames, ...coderPluginNames],
|
|
10652
|
+
loadPlugins: true,
|
|
10653
|
+
commandName: "interactive"
|
|
10580
10654
|
});
|
|
10581
10655
|
}
|
|
10582
10656
|
const env = envService.getEnvironment();
|
|
@@ -11057,6 +11131,42 @@ function inferStatus(session) {
|
|
|
11057
11131
|
return status;
|
|
11058
11132
|
return null;
|
|
11059
11133
|
}
|
|
11134
|
+
async function expandSessionAncestors(sessionComponent, sessions) {
|
|
11135
|
+
const sessionById = new Map;
|
|
11136
|
+
for (const s of sessions)
|
|
11137
|
+
sessionById.set(s.id, s);
|
|
11138
|
+
const queue = [];
|
|
11139
|
+
const visited = new Set;
|
|
11140
|
+
for (const s of sessions) {
|
|
11141
|
+
const pid = s.parentSessionId;
|
|
11142
|
+
if (pid !== null && pid !== undefined && pid !== "" && !sessionById.has(pid) && !visited.has(pid)) {
|
|
11143
|
+
queue.push(pid);
|
|
11144
|
+
visited.add(pid);
|
|
11145
|
+
}
|
|
11146
|
+
}
|
|
11147
|
+
while (queue.length > 0) {
|
|
11148
|
+
const id = queue.shift();
|
|
11149
|
+
const parent = await sessionComponent.get(id);
|
|
11150
|
+
if (!parent)
|
|
11151
|
+
continue;
|
|
11152
|
+
sessionById.set(parent.id, parent);
|
|
11153
|
+
const ppid = parent.parentSessionId;
|
|
11154
|
+
if (ppid !== null && ppid !== undefined && ppid !== "" && !sessionById.has(ppid) && !visited.has(ppid)) {
|
|
11155
|
+
queue.push(ppid);
|
|
11156
|
+
visited.add(ppid);
|
|
11157
|
+
}
|
|
11158
|
+
}
|
|
11159
|
+
const orderedIds = [];
|
|
11160
|
+
for (const s of sessions) {
|
|
11161
|
+
if (!orderedIds.includes(s.id))
|
|
11162
|
+
orderedIds.push(s.id);
|
|
11163
|
+
}
|
|
11164
|
+
for (const id of sessionById.keys()) {
|
|
11165
|
+
if (!orderedIds.includes(id))
|
|
11166
|
+
orderedIds.push(id);
|
|
11167
|
+
}
|
|
11168
|
+
return orderedIds.map((id) => sessionById.get(id));
|
|
11169
|
+
}
|
|
11060
11170
|
|
|
11061
11171
|
// src/commands/sessions/list.ts
|
|
11062
11172
|
var ListCommand = {
|
|
@@ -11100,7 +11210,8 @@ var ListCommand = {
|
|
|
11100
11210
|
const totalCount = await sessionComponent.getCount();
|
|
11101
11211
|
const activeSessionId = sessionComponent.getActiveSessionId();
|
|
11102
11212
|
if (args.graph) {
|
|
11103
|
-
const
|
|
11213
|
+
const expandedSessions = await expandSessionAncestors(sessionComponent, sessions);
|
|
11214
|
+
const tree = buildSessionTree(expandedSessions);
|
|
11104
11215
|
output.log(renderSessionTree(tree, { useShortId: args.shortId === true }));
|
|
11105
11216
|
return;
|
|
11106
11217
|
}
|
|
@@ -12754,7 +12865,7 @@ var SessionsCommand = {
|
|
|
12754
12865
|
};
|
|
12755
12866
|
|
|
12756
12867
|
// src/commands/tasks/list.ts
|
|
12757
|
-
import
|
|
12868
|
+
import chalk19 from "chalk";
|
|
12758
12869
|
|
|
12759
12870
|
// src/commands/tasks/_build-list-json.ts
|
|
12760
12871
|
function buildListTasksJson(tasks, total, args, extras) {
|
|
@@ -12783,6 +12894,150 @@ function buildListTasksJson(tasks, total, args, extras) {
|
|
|
12783
12894
|
};
|
|
12784
12895
|
}
|
|
12785
12896
|
|
|
12897
|
+
// src/commands/tasks/task-graph.ts
|
|
12898
|
+
import chalk18 from "chalk";
|
|
12899
|
+
function buildTaskTree(tasks) {
|
|
12900
|
+
const nodeById = new Map;
|
|
12901
|
+
const byParent = new Map;
|
|
12902
|
+
const roots = [];
|
|
12903
|
+
for (const t of tasks) {
|
|
12904
|
+
nodeById.set(t.id, { task: t, children: [] });
|
|
12905
|
+
}
|
|
12906
|
+
for (const t of tasks) {
|
|
12907
|
+
const pid = t.parent_task_id;
|
|
12908
|
+
if (pid !== undefined && pid !== null && nodeById.has(pid)) {
|
|
12909
|
+
const list = byParent.get(pid) || [];
|
|
12910
|
+
list.push(t);
|
|
12911
|
+
byParent.set(pid, list);
|
|
12912
|
+
} else {
|
|
12913
|
+
roots.push(t);
|
|
12914
|
+
}
|
|
12915
|
+
}
|
|
12916
|
+
for (const [parentId, children] of byParent.entries()) {
|
|
12917
|
+
const parentNode = nodeById.get(parentId);
|
|
12918
|
+
children.sort(compareTasksDesc);
|
|
12919
|
+
parentNode.children = children.map((c) => nodeById.get(c.id));
|
|
12920
|
+
}
|
|
12921
|
+
roots.sort(compareTasksDesc);
|
|
12922
|
+
return roots.map((r) => nodeById.get(r.id));
|
|
12923
|
+
}
|
|
12924
|
+
function compareTasksDesc(a, b) {
|
|
12925
|
+
if (a.updatedAt < b.updatedAt)
|
|
12926
|
+
return 1;
|
|
12927
|
+
if (a.updatedAt > b.updatedAt)
|
|
12928
|
+
return -1;
|
|
12929
|
+
if (a.id < b.id)
|
|
12930
|
+
return 1;
|
|
12931
|
+
if (a.id > b.id)
|
|
12932
|
+
return -1;
|
|
12933
|
+
return 0;
|
|
12934
|
+
}
|
|
12935
|
+
async function expandParentChain(taskComponent, tasks) {
|
|
12936
|
+
const taskById = new Map;
|
|
12937
|
+
for (const t of tasks)
|
|
12938
|
+
taskById.set(t.id, t);
|
|
12939
|
+
const queue = [];
|
|
12940
|
+
const visited = new Set;
|
|
12941
|
+
for (const t of tasks) {
|
|
12942
|
+
const pid = t.parent_task_id;
|
|
12943
|
+
if (pid !== undefined && pid !== null && !taskById.has(pid) && !visited.has(pid)) {
|
|
12944
|
+
queue.push(pid);
|
|
12945
|
+
visited.add(pid);
|
|
12946
|
+
}
|
|
12947
|
+
}
|
|
12948
|
+
while (queue.length > 0) {
|
|
12949
|
+
const id = queue.shift();
|
|
12950
|
+
const parent = await taskComponent.getTask(id);
|
|
12951
|
+
if (!parent)
|
|
12952
|
+
continue;
|
|
12953
|
+
taskById.set(parent.id, parent);
|
|
12954
|
+
const ppid = parent.parent_task_id;
|
|
12955
|
+
if (ppid !== undefined && ppid !== null && !taskById.has(ppid) && !visited.has(ppid)) {
|
|
12956
|
+
queue.push(ppid);
|
|
12957
|
+
visited.add(ppid);
|
|
12958
|
+
}
|
|
12959
|
+
}
|
|
12960
|
+
const orderedIds = [];
|
|
12961
|
+
for (const t of tasks) {
|
|
12962
|
+
if (!orderedIds.includes(t.id))
|
|
12963
|
+
orderedIds.push(t.id);
|
|
12964
|
+
}
|
|
12965
|
+
for (const id of taskById.keys()) {
|
|
12966
|
+
if (!orderedIds.includes(id))
|
|
12967
|
+
orderedIds.push(id);
|
|
12968
|
+
}
|
|
12969
|
+
return orderedIds.map((id) => taskById.get(id));
|
|
12970
|
+
}
|
|
12971
|
+
var TASK_TREE_BRANCH = "├─ ";
|
|
12972
|
+
var TASK_TREE_LAST = "└─ ";
|
|
12973
|
+
var TASK_TREE_VERTICAL = "│ ";
|
|
12974
|
+
var TASK_TREE_EMPTY = " ";
|
|
12975
|
+
function renderTaskTree(roots, options = {}) {
|
|
12976
|
+
if (roots.length === 0) {
|
|
12977
|
+
return "No tasks to display.";
|
|
12978
|
+
}
|
|
12979
|
+
const maxDepth = options.maxDepth !== undefined && options.maxDepth < 0 ? undefined : options.maxDepth;
|
|
12980
|
+
const totalCount = countDeep(roots);
|
|
12981
|
+
const headerSuffix = options.rootId !== undefined ? chalk18.gray(` — subtree of #${options.rootId}`) : "";
|
|
12982
|
+
const lines = [
|
|
12983
|
+
chalk18.bold(`Task Tree (${totalCount} tasks, ${roots.length} roots)`) + headerSuffix,
|
|
12984
|
+
""
|
|
12985
|
+
];
|
|
12986
|
+
for (let i = 0;i < roots.length; i++) {
|
|
12987
|
+
const isLast = i === roots.length - 1;
|
|
12988
|
+
renderNode2(roots[i], "", true, isLast, lines, 0, maxDepth);
|
|
12989
|
+
}
|
|
12990
|
+
return lines.join(`
|
|
12991
|
+
`);
|
|
12992
|
+
}
|
|
12993
|
+
function renderNode2(node, prefix, isRoot, isLast, lines, currentDepth, maxDepth) {
|
|
12994
|
+
if (maxDepth !== undefined && currentDepth > maxDepth) {
|
|
12995
|
+
return;
|
|
12996
|
+
}
|
|
12997
|
+
const connector = isRoot ? "" : isLast ? TASK_TREE_LAST : TASK_TREE_BRANCH;
|
|
12998
|
+
const statusColor = colorByStatus(node.task.status);
|
|
12999
|
+
const label = statusColor(formatTaskLabel(node.task));
|
|
13000
|
+
lines.push(prefix + connector + label);
|
|
13001
|
+
if (node.children.length > 0) {
|
|
13002
|
+
const childPrefix = isRoot ? prefix : prefix + (isLast ? TASK_TREE_EMPTY : TASK_TREE_VERTICAL);
|
|
13003
|
+
for (let i = 0;i < node.children.length; i++) {
|
|
13004
|
+
const isChildLast = i === node.children.length - 1;
|
|
13005
|
+
renderNode2(node.children[i], childPrefix, false, isChildLast, lines, currentDepth + 1, maxDepth);
|
|
13006
|
+
}
|
|
13007
|
+
}
|
|
13008
|
+
}
|
|
13009
|
+
function countDeep(roots) {
|
|
13010
|
+
let count = 0;
|
|
13011
|
+
function walk(n) {
|
|
13012
|
+
count++;
|
|
13013
|
+
for (const c of n.children)
|
|
13014
|
+
walk(c);
|
|
13015
|
+
}
|
|
13016
|
+
for (const r of roots)
|
|
13017
|
+
walk(r);
|
|
13018
|
+
return count;
|
|
13019
|
+
}
|
|
13020
|
+
function formatTaskLabel(task) {
|
|
13021
|
+
const idStr = `#${task.id}`;
|
|
13022
|
+
const typeLabel = task.type && task.type !== "normal" ? ` [${task.type}]` : "";
|
|
13023
|
+
const progressLabel = task.progress > 0 ? ` (${task.progress}%)` : "";
|
|
13024
|
+
return `${idStr}${typeLabel} ${task.title} ${chalk18.gray("[" + task.status + "]")}${progressLabel}`;
|
|
13025
|
+
}
|
|
13026
|
+
function colorByStatus(status) {
|
|
13027
|
+
switch (status) {
|
|
13028
|
+
case "completed":
|
|
13029
|
+
return chalk18.green;
|
|
13030
|
+
case "active":
|
|
13031
|
+
return chalk18.blue;
|
|
13032
|
+
case "paused":
|
|
13033
|
+
return chalk18.yellow;
|
|
13034
|
+
case "cancelled":
|
|
13035
|
+
return chalk18.strikethrough;
|
|
13036
|
+
default:
|
|
13037
|
+
return chalk18.gray;
|
|
13038
|
+
}
|
|
13039
|
+
}
|
|
13040
|
+
|
|
12786
13041
|
// src/commands/tasks/list.ts
|
|
12787
13042
|
var ListCommand2 = {
|
|
12788
13043
|
command: "list",
|
|
@@ -12809,7 +13064,7 @@ var ListCommand2 = {
|
|
|
12809
13064
|
type: "boolean",
|
|
12810
13065
|
default: false,
|
|
12811
13066
|
description: "是否包含已归档任务(status=archived 的任务默认被排除)"
|
|
12812
|
-
}).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }).option("quiet", { alias: "q", type: "boolean", hidden: true }),
|
|
13067
|
+
}).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }).option("quiet", { alias: "q", type: "boolean", hidden: true }).option("graph", { alias: "g", type: "boolean", default: false, description: "以层次化树形结构展示任务父子关系" }),
|
|
12813
13068
|
async handler(args) {
|
|
12814
13069
|
const output = new OutputService2;
|
|
12815
13070
|
const envService = new EnvironmentService(output);
|
|
@@ -12837,6 +13092,12 @@ var ListCommand2 = {
|
|
|
12837
13092
|
const listResult = await taskComponent.listTasks(listOptions);
|
|
12838
13093
|
const tasks = listResult.tasks;
|
|
12839
13094
|
const total = listResult.total;
|
|
13095
|
+
if (args.graph) {
|
|
13096
|
+
const expandedTasks = await expandParentChain(taskComponent, tasks);
|
|
13097
|
+
const tree = buildTaskTree(expandedTasks);
|
|
13098
|
+
output.log(renderTaskTree(tree, { maxDepth: args.depth }));
|
|
13099
|
+
return;
|
|
13100
|
+
}
|
|
12840
13101
|
if (args.json) {
|
|
12841
13102
|
output.json(buildListTasksJson(tasks, total, args));
|
|
12842
13103
|
} else if (args.quiet) {
|
|
@@ -12852,17 +13113,17 @@ var ListCommand2 = {
|
|
|
12852
13113
|
output.log(hint);
|
|
12853
13114
|
} else {
|
|
12854
13115
|
const header = [
|
|
12855
|
-
|
|
12856
|
-
|
|
12857
|
-
|
|
12858
|
-
|
|
12859
|
-
|
|
12860
|
-
|
|
12861
|
-
|
|
13116
|
+
chalk19.bold("#"),
|
|
13117
|
+
chalk19.bold("Title"),
|
|
13118
|
+
chalk19.bold("Status"),
|
|
13119
|
+
chalk19.bold("Priority"),
|
|
13120
|
+
chalk19.bold("Type"),
|
|
13121
|
+
chalk19.bold("Progress"),
|
|
13122
|
+
chalk19.bold("Parent")
|
|
12862
13123
|
].join(" │ ");
|
|
12863
13124
|
const rows = tasks.map((t, i) => {
|
|
12864
|
-
const statusColor = t.status === "completed" ?
|
|
12865
|
-
const priorityColor = t.priority === "high" ?
|
|
13125
|
+
const statusColor = t.status === "completed" ? chalk19.green : t.status === "active" ? chalk19.blue : t.status === "paused" ? chalk19.yellow : t.status === "cancelled" ? chalk19.strikethrough : chalk19.gray;
|
|
13126
|
+
const priorityColor = t.priority === "high" ? chalk19.red : t.priority === "medium" ? chalk19.yellow : chalk19.gray;
|
|
12866
13127
|
return [
|
|
12867
13128
|
(args.offset + i + 1).toString(),
|
|
12868
13129
|
t.title.length > 30 ? t.title.slice(0, 27) + "..." : t.title,
|
|
@@ -12870,11 +13131,11 @@ var ListCommand2 = {
|
|
|
12870
13131
|
priorityColor(t.priority),
|
|
12871
13132
|
t.type || "normal",
|
|
12872
13133
|
`${t.progress}%`,
|
|
12873
|
-
t.parent_task_id ? `#${t.parent_task_id}` :
|
|
13134
|
+
t.parent_task_id ? `#${t.parent_task_id}` : chalk19.gray("root")
|
|
12874
13135
|
].join(" │ ");
|
|
12875
13136
|
});
|
|
12876
|
-
const depthNote = args.depth !== undefined ?
|
|
12877
|
-
const archivedNote = args.includeArchived ?
|
|
13137
|
+
const depthNote = args.depth !== undefined ? chalk19.gray(` depth=${args.depth}`) : "";
|
|
13138
|
+
const archivedNote = args.includeArchived ? chalk19.gray(" include-archived") : "";
|
|
12878
13139
|
output.log([
|
|
12879
13140
|
`┌─ Tasks ${"─".repeat(55)}┐`,
|
|
12880
13141
|
`│${header}│`,
|
|
@@ -12882,7 +13143,7 @@ var ListCommand2 = {
|
|
|
12882
13143
|
...rows.map((r) => `│${r}│`),
|
|
12883
13144
|
"└" + "─".repeat(header.length + 2) + "┘",
|
|
12884
13145
|
"",
|
|
12885
|
-
|
|
13146
|
+
chalk19.gray(`Showing ${tasks.length} of ${total} tasks (offset=${args.offset}, limit=${args.limit})${depthNote}${archivedNote}`)
|
|
12886
13147
|
].join(`
|
|
12887
13148
|
`));
|
|
12888
13149
|
}
|
|
@@ -12896,7 +13157,7 @@ var ListCommand2 = {
|
|
|
12896
13157
|
};
|
|
12897
13158
|
|
|
12898
13159
|
// src/commands/tasks/get.ts
|
|
12899
|
-
import
|
|
13160
|
+
import chalk20 from "chalk";
|
|
12900
13161
|
var GetCommand2 = {
|
|
12901
13162
|
command: "get <id>",
|
|
12902
13163
|
aliases: ["show"],
|
|
@@ -12935,10 +13196,10 @@ var GetCommand2 = {
|
|
|
12935
13196
|
if (args.json) {
|
|
12936
13197
|
output.json(result);
|
|
12937
13198
|
} else {
|
|
12938
|
-
output.log(
|
|
13199
|
+
output.log(chalk20.bold(`
|
|
12939
13200
|
Task #${result.task.id}: ${result.task.title}
|
|
12940
13201
|
`));
|
|
12941
|
-
output.log(`Status: ${
|
|
13202
|
+
output.log(`Status: ${chalk20.blue(result.task.status)} | Priority: ${result.task.priority} | Type: ${result.task.type} | Progress: ${result.task.progress}%`);
|
|
12942
13203
|
output.log(`Created: ${result.task.createdAt} | Updated: ${result.task.updatedAt}`);
|
|
12943
13204
|
output.log(`Project Path: ${result.task.project_path}`);
|
|
12944
13205
|
output.log(`Context: ${result.task.context}`);
|
|
@@ -12946,7 +13207,7 @@ Task #${result.task.id}: ${result.task.title}
|
|
|
12946
13207
|
output.log(`
|
|
12947
13208
|
Current Status: ${result.task.current_status}`);
|
|
12948
13209
|
}
|
|
12949
|
-
output.log(
|
|
13210
|
+
output.log(chalk20.bold(`
|
|
12950
13211
|
Operations (${result.operations.length}):
|
|
12951
13212
|
`));
|
|
12952
13213
|
result.operations.forEach((op, i) => {
|
|
@@ -12966,10 +13227,10 @@ Operations (${result.operations.length}):
|
|
|
12966
13227
|
if (args.json) {
|
|
12967
13228
|
output.json(task);
|
|
12968
13229
|
} else {
|
|
12969
|
-
output.log(
|
|
13230
|
+
output.log(chalk20.bold(`
|
|
12970
13231
|
Task #${task.id}: ${task.title}
|
|
12971
13232
|
`));
|
|
12972
|
-
output.log(`Status: ${
|
|
13233
|
+
output.log(`Status: ${chalk20.blue(task.status)} | Priority: ${task.priority} | Type: ${task.type} | Progress: ${task.progress}%`);
|
|
12973
13234
|
output.log(`Created: ${task.createdAt} | Updated: ${task.updatedAt}`);
|
|
12974
13235
|
output.log(`Project Path: ${task.project_path}`);
|
|
12975
13236
|
output.log(`Context: ${task.context}`);
|
|
@@ -12993,7 +13254,7 @@ Description: ${task.description}`);
|
|
|
12993
13254
|
};
|
|
12994
13255
|
|
|
12995
13256
|
// src/commands/tasks/create.ts
|
|
12996
|
-
import
|
|
13257
|
+
import chalk21 from "chalk";
|
|
12997
13258
|
var CreateCommand = {
|
|
12998
13259
|
command: "create <title>",
|
|
12999
13260
|
aliases: ["add", "new"],
|
|
@@ -13071,7 +13332,7 @@ var CreateCommand = {
|
|
|
13071
13332
|
if (args.json) {
|
|
13072
13333
|
output.json(task);
|
|
13073
13334
|
} else {
|
|
13074
|
-
output.log(
|
|
13335
|
+
output.log(chalk21.green(`
|
|
13075
13336
|
✓ Task created: #${task.id}`));
|
|
13076
13337
|
output.log(` Title: ${task.title}`);
|
|
13077
13338
|
output.log(` Status: ${task.status}`);
|
|
@@ -13089,7 +13350,7 @@ var CreateCommand = {
|
|
|
13089
13350
|
};
|
|
13090
13351
|
|
|
13091
13352
|
// src/commands/tasks/update.ts
|
|
13092
|
-
import
|
|
13353
|
+
import chalk22 from "chalk";
|
|
13093
13354
|
var UpdateCommand = {
|
|
13094
13355
|
command: "update <id>",
|
|
13095
13356
|
aliases: ["set"],
|
|
@@ -13147,7 +13408,7 @@ var UpdateCommand = {
|
|
|
13147
13408
|
if (args.json) {
|
|
13148
13409
|
output.json(task);
|
|
13149
13410
|
} else {
|
|
13150
|
-
output.log(
|
|
13411
|
+
output.log(chalk22.green(`
|
|
13151
13412
|
✓ Task updated: #${task.id}`));
|
|
13152
13413
|
output.log(` Title: ${task.title}`);
|
|
13153
13414
|
output.log(` Status: ${task.status}`);
|
|
@@ -13170,7 +13431,7 @@ var UpdateCommand = {
|
|
|
13170
13431
|
};
|
|
13171
13432
|
|
|
13172
13433
|
// src/commands/tasks/delete.ts
|
|
13173
|
-
import
|
|
13434
|
+
import chalk23 from "chalk";
|
|
13174
13435
|
var DeleteCommand2 = {
|
|
13175
13436
|
command: "delete <id>",
|
|
13176
13437
|
aliases: ["remove", "rm", "del"],
|
|
@@ -13206,16 +13467,16 @@ var DeleteCommand2 = {
|
|
|
13206
13467
|
process.exit(1);
|
|
13207
13468
|
}
|
|
13208
13469
|
if (!args.force) {
|
|
13209
|
-
output.log(
|
|
13210
|
-
output.log(
|
|
13211
|
-
output.log(
|
|
13212
|
-
output.log(
|
|
13470
|
+
output.log(chalk23.yellow(`Are you sure you want to delete task #${args.id}?`));
|
|
13471
|
+
output.log(chalk23.yellow(` Title: ${task.title}`));
|
|
13472
|
+
output.log(chalk23.yellow(` Status: ${task.status}`));
|
|
13473
|
+
output.log(chalk23.yellow(`
|
|
13213
13474
|
Use --force to skip this confirmation`));
|
|
13214
13475
|
process.exit(1);
|
|
13215
13476
|
}
|
|
13216
13477
|
const deleted = await taskComponent.deleteTask(args.id);
|
|
13217
13478
|
if (deleted) {
|
|
13218
|
-
output.log(
|
|
13479
|
+
output.log(chalk23.green(`
|
|
13219
13480
|
✓ Task deleted: #${args.id}`));
|
|
13220
13481
|
} else {
|
|
13221
13482
|
output.error(`Failed to delete task: ${args.id}`);
|
|
@@ -13231,7 +13492,7 @@ Use --force to skip this confirmation`));
|
|
|
13231
13492
|
};
|
|
13232
13493
|
|
|
13233
13494
|
// src/commands/tasks/complete.ts
|
|
13234
|
-
import
|
|
13495
|
+
import chalk24 from "chalk";
|
|
13235
13496
|
var CompleteCommand = {
|
|
13236
13497
|
command: "complete <id>",
|
|
13237
13498
|
aliases: ["done", "finish"],
|
|
@@ -13252,7 +13513,9 @@ var CompleteCommand = {
|
|
|
13252
13513
|
try {
|
|
13253
13514
|
await envService.create({
|
|
13254
13515
|
configPath: args.config,
|
|
13255
|
-
plugins: args.plugin
|
|
13516
|
+
plugins: args.plugin,
|
|
13517
|
+
loadPlugins: true,
|
|
13518
|
+
commandName: "tasks:complete"
|
|
13256
13519
|
});
|
|
13257
13520
|
const env = envService.getEnvironment();
|
|
13258
13521
|
if (!env) {
|
|
@@ -13288,7 +13551,7 @@ var CompleteCommand = {
|
|
|
13288
13551
|
if (args.json) {
|
|
13289
13552
|
output.json(task);
|
|
13290
13553
|
} else {
|
|
13291
|
-
output.log(
|
|
13554
|
+
output.log(chalk24.green(`
|
|
13292
13555
|
✓ Task completed: #${task.id}`));
|
|
13293
13556
|
output.log(` Title: ${task.title}`);
|
|
13294
13557
|
output.log(` Progress: ${task.progress}%`);
|
|
@@ -13304,7 +13567,7 @@ var CompleteCommand = {
|
|
|
13304
13567
|
};
|
|
13305
13568
|
|
|
13306
13569
|
// src/commands/tasks/operations.ts
|
|
13307
|
-
import
|
|
13570
|
+
import chalk25 from "chalk";
|
|
13308
13571
|
var OperationsCommand = {
|
|
13309
13572
|
command: "operations <task-id>",
|
|
13310
13573
|
aliases: ["ops", "log"],
|
|
@@ -13354,23 +13617,23 @@ var OperationsCommand = {
|
|
|
13354
13617
|
operations
|
|
13355
13618
|
});
|
|
13356
13619
|
} else {
|
|
13357
|
-
output.log(
|
|
13620
|
+
output.log(chalk25.bold(`
|
|
13358
13621
|
Operations for Task #${task.id}: ${task.title}
|
|
13359
13622
|
`));
|
|
13360
13623
|
if (operations.length === 0) {
|
|
13361
|
-
output.log(
|
|
13624
|
+
output.log(chalk25.gray("No operations found."));
|
|
13362
13625
|
} else {
|
|
13363
13626
|
operations.forEach((op, i) => {
|
|
13364
|
-
const actionColor = op.actionType === "completed" ?
|
|
13365
|
-
output.log(`${
|
|
13366
|
-
output.log(` Session: ${
|
|
13627
|
+
const actionColor = op.actionType === "completed" ? chalk25.green : op.actionType === "milestone" ? chalk25.blue : op.actionType === "problem" ? chalk25.red : chalk25.gray;
|
|
13628
|
+
output.log(`${chalk25.bold(a.offset + i + 1)}. ` + actionColor(`[${op.actionType}]`) + ` ${op.actionTitle}`);
|
|
13629
|
+
output.log(` Session: ${chalk25.cyan(op.sessionId)} | Time: ${op.timestamp}`);
|
|
13367
13630
|
if (op.actionDescription) {
|
|
13368
13631
|
output.log(` ${op.actionDescription}`);
|
|
13369
13632
|
}
|
|
13370
13633
|
output.log("");
|
|
13371
13634
|
});
|
|
13372
13635
|
}
|
|
13373
|
-
output.log(
|
|
13636
|
+
output.log(chalk25.gray(`Total: ${operations.length} operations`));
|
|
13374
13637
|
}
|
|
13375
13638
|
} catch (error) {
|
|
13376
13639
|
output.error(`Failed to list operations: ${error}`);
|
|
@@ -13382,63 +13645,7 @@ Operations for Task #${task.id}: ${task.title}
|
|
|
13382
13645
|
};
|
|
13383
13646
|
|
|
13384
13647
|
// src/commands/tasks/tree.ts
|
|
13385
|
-
import
|
|
13386
|
-
function buildTree(tasks) {
|
|
13387
|
-
const byParent = new Map;
|
|
13388
|
-
const nodeById = new Map;
|
|
13389
|
-
const roots = [];
|
|
13390
|
-
for (const t of tasks) {
|
|
13391
|
-
nodeById.set(t.id, { task: t, children: [] });
|
|
13392
|
-
}
|
|
13393
|
-
for (const t of tasks) {
|
|
13394
|
-
if (t.parent_task_id !== undefined && t.parent_task_id !== null && nodeById.has(t.parent_task_id)) {
|
|
13395
|
-
const list = byParent.get(t.parent_task_id) || [];
|
|
13396
|
-
list.push(t);
|
|
13397
|
-
byParent.set(t.parent_task_id, list);
|
|
13398
|
-
} else {
|
|
13399
|
-
roots.push(t);
|
|
13400
|
-
}
|
|
13401
|
-
}
|
|
13402
|
-
for (const [parentId, children] of byParent.entries()) {
|
|
13403
|
-
const parentNode = nodeById.get(parentId);
|
|
13404
|
-
children.sort((a, b) => a.updatedAt < b.updatedAt ? 1 : -1);
|
|
13405
|
-
parentNode.children = children.map((c) => nodeById.get(c.id));
|
|
13406
|
-
}
|
|
13407
|
-
roots.sort((a, b) => a.updatedAt < b.updatedAt ? 1 : -1);
|
|
13408
|
-
return roots.map((r) => nodeById.get(r.id));
|
|
13409
|
-
}
|
|
13410
|
-
function printTree(nodes, prefix, isRoot, output, currentDepth, maxDepth) {
|
|
13411
|
-
if (maxDepth !== undefined && currentDepth > maxDepth)
|
|
13412
|
-
return;
|
|
13413
|
-
for (let i = 0;i < nodes.length; i++) {
|
|
13414
|
-
const node = nodes[i];
|
|
13415
|
-
const isLast = i === nodes.length - 1;
|
|
13416
|
-
const connector = isRoot ? "" : isLast ? "└─ " : "├─ ";
|
|
13417
|
-
const statusColor = colorByStatus(node.task.status);
|
|
13418
|
-
const typeLabel = node.task.type ? ` [${node.task.type}]` : "";
|
|
13419
|
-
const progressLabel = node.task.progress > 0 ? ` (${node.task.progress}%)` : "";
|
|
13420
|
-
const header = `#${node.task.id}${typeLabel} ${node.task.title} ${chalk25.gray("[" + node.task.status + "]")}${progressLabel}`;
|
|
13421
|
-
output.log(prefix + connector + statusColor(header));
|
|
13422
|
-
if (node.children.length > 0) {
|
|
13423
|
-
const childPrefix = isRoot ? prefix : prefix + (isLast ? " " : "│ ");
|
|
13424
|
-
printTree(node.children, childPrefix, false, output, currentDepth + 1, maxDepth);
|
|
13425
|
-
}
|
|
13426
|
-
}
|
|
13427
|
-
}
|
|
13428
|
-
function colorByStatus(status) {
|
|
13429
|
-
switch (status) {
|
|
13430
|
-
case "completed":
|
|
13431
|
-
return chalk25.green;
|
|
13432
|
-
case "active":
|
|
13433
|
-
return chalk25.blue;
|
|
13434
|
-
case "paused":
|
|
13435
|
-
return chalk25.yellow;
|
|
13436
|
-
case "cancelled":
|
|
13437
|
-
return chalk25.strikethrough;
|
|
13438
|
-
default:
|
|
13439
|
-
return chalk25.gray;
|
|
13440
|
-
}
|
|
13441
|
-
}
|
|
13648
|
+
import chalk26 from "chalk";
|
|
13442
13649
|
var TreeCommand = {
|
|
13443
13650
|
command: "tree",
|
|
13444
13651
|
describe: "以树形结构展示所有任务(基于 parent_task_id)",
|
|
@@ -13512,23 +13719,20 @@ var TreeCommand = {
|
|
|
13512
13719
|
}
|
|
13513
13720
|
tasks = tasks.filter((t) => allowed.has(t.id));
|
|
13514
13721
|
}
|
|
13722
|
+
const tree = buildTaskTree(tasks);
|
|
13515
13723
|
if (args.json) {
|
|
13516
|
-
const tree2 = buildTree(tasks);
|
|
13517
13724
|
output.json({
|
|
13518
13725
|
total: tasks.length,
|
|
13519
|
-
rootCount:
|
|
13520
|
-
tree
|
|
13726
|
+
rootCount: tree.length,
|
|
13727
|
+
tree
|
|
13521
13728
|
});
|
|
13522
13729
|
return;
|
|
13523
13730
|
}
|
|
13524
|
-
const tree = buildTree(tasks);
|
|
13525
13731
|
if (tree.length === 0) {
|
|
13526
|
-
output.log(
|
|
13732
|
+
output.log(chalk26.gray("No tasks to display."));
|
|
13527
13733
|
return;
|
|
13528
13734
|
}
|
|
13529
|
-
output.log(
|
|
13530
|
-
output.log("");
|
|
13531
|
-
printTree(tree, "", true, output, 0, args.maxDepth);
|
|
13735
|
+
output.log(renderTaskTree(tree, { maxDepth: args.maxDepth, rootId: args.rootId }));
|
|
13532
13736
|
} catch (error) {
|
|
13533
13737
|
output.error(`Failed to build task tree: ${error}`);
|
|
13534
13738
|
process.exit(1);
|
|
@@ -13539,7 +13743,7 @@ var TreeCommand = {
|
|
|
13539
13743
|
};
|
|
13540
13744
|
|
|
13541
13745
|
// src/commands/tasks/search.ts
|
|
13542
|
-
import
|
|
13746
|
+
import chalk27 from "chalk";
|
|
13543
13747
|
var SearchCommand = {
|
|
13544
13748
|
command: "search <keywords..>",
|
|
13545
13749
|
aliases: ["find", "grep"],
|
|
@@ -13612,26 +13816,26 @@ var SearchCommand = {
|
|
|
13612
13816
|
output.log(hint);
|
|
13613
13817
|
} else {
|
|
13614
13818
|
const keywordStr = args.keywords.join(" ");
|
|
13615
|
-
output.log(
|
|
13819
|
+
output.log(chalk27.bold(`
|
|
13616
13820
|
\uD83D\uDD0D Search: "${keywordStr}" — ${total} results
|
|
13617
13821
|
`));
|
|
13618
13822
|
if (tasks.length === 0) {
|
|
13619
|
-
output.log(
|
|
13823
|
+
output.log(chalk27.gray(" No matching tasks found."));
|
|
13620
13824
|
return;
|
|
13621
13825
|
}
|
|
13622
13826
|
for (const t of tasks) {
|
|
13623
|
-
const statusColor = t.status === "completed" ?
|
|
13624
|
-
const pid = t.parent_task_id ?
|
|
13827
|
+
const statusColor = t.status === "completed" ? chalk27.green : t.status === "active" ? chalk27.blue : t.status === "paused" ? chalk27.yellow : t.status === "cancelled" ? chalk27.strikethrough : t.status === "archived" ? chalk27.gray : chalk27.gray;
|
|
13828
|
+
const pid = t.parent_task_id ? chalk27.gray(` (#${t.parent_task_id})`) : "";
|
|
13625
13829
|
output.log(` #${t.id} ${statusColor("[" + t.status + "]")} ${t.title}${pid}`);
|
|
13626
13830
|
if (t.current_status) {
|
|
13627
|
-
output.log(` ${
|
|
13831
|
+
output.log(` ${chalk27.gray(t.current_status.slice(0, 80))}`);
|
|
13628
13832
|
}
|
|
13629
13833
|
}
|
|
13630
13834
|
if (total > tasks.length) {
|
|
13631
|
-
output.log(
|
|
13835
|
+
output.log(chalk27.gray(`
|
|
13632
13836
|
... and ${total - tasks.length} more. Use --offset and --limit to paginate.`));
|
|
13633
13837
|
}
|
|
13634
|
-
output.log(
|
|
13838
|
+
output.log(chalk27.gray(` Page: ${Math.floor((args.offset || 0) / (args.limit || 20)) + 1}/${Math.ceil(total / (args.limit || 20))}`));
|
|
13635
13839
|
}
|
|
13636
13840
|
} catch (error) {
|
|
13637
13841
|
output.error(`Failed to search tasks: ${error}`);
|
|
@@ -13891,7 +14095,7 @@ var TasksCommand = {
|
|
|
13891
14095
|
};
|
|
13892
14096
|
|
|
13893
14097
|
// src/commands/skills/list.ts
|
|
13894
|
-
import
|
|
14098
|
+
import chalk28 from "chalk";
|
|
13895
14099
|
var ListCommand3 = {
|
|
13896
14100
|
command: "list",
|
|
13897
14101
|
aliases: ["ls"],
|
|
@@ -13959,26 +14163,26 @@ var ListCommand3 = {
|
|
|
13959
14163
|
output.log(hint);
|
|
13960
14164
|
} else {
|
|
13961
14165
|
const header = [
|
|
13962
|
-
|
|
13963
|
-
|
|
13964
|
-
|
|
14166
|
+
chalk28.bold("Name"),
|
|
14167
|
+
chalk28.bold("Description"),
|
|
14168
|
+
chalk28.bold("Source")
|
|
13965
14169
|
].join(" | ");
|
|
13966
14170
|
const sourceColor = (source) => {
|
|
13967
14171
|
switch (source) {
|
|
13968
14172
|
case "project":
|
|
13969
|
-
return
|
|
14173
|
+
return chalk28.green;
|
|
13970
14174
|
case "user":
|
|
13971
|
-
return
|
|
14175
|
+
return chalk28.blue;
|
|
13972
14176
|
case "built-in":
|
|
13973
|
-
return
|
|
14177
|
+
return chalk28.gray;
|
|
13974
14178
|
default:
|
|
13975
|
-
return
|
|
14179
|
+
return chalk28.white;
|
|
13976
14180
|
}
|
|
13977
14181
|
};
|
|
13978
14182
|
const rows = skills.map((s) => {
|
|
13979
14183
|
const desc2 = s.description.length > 50 ? s.description.slice(0, 47) + "..." : s.description;
|
|
13980
14184
|
return [
|
|
13981
|
-
|
|
14185
|
+
chalk28.cyan(s.name),
|
|
13982
14186
|
desc2,
|
|
13983
14187
|
sourceColor(s.source)(`[${s.source}]`)
|
|
13984
14188
|
].join(" | ");
|
|
@@ -14011,7 +14215,7 @@ var ListCommand3 = {
|
|
|
14011
14215
|
};
|
|
14012
14216
|
|
|
14013
14217
|
// src/commands/skills/get.ts
|
|
14014
|
-
import
|
|
14218
|
+
import chalk29 from "chalk";
|
|
14015
14219
|
var GetCommand3 = {
|
|
14016
14220
|
command: "get <name>",
|
|
14017
14221
|
describe: "获取指定技能内容",
|
|
@@ -14055,13 +14259,13 @@ var GetCommand3 = {
|
|
|
14055
14259
|
content: skill.content
|
|
14056
14260
|
});
|
|
14057
14261
|
} else {
|
|
14058
|
-
output.log(
|
|
14262
|
+
output.log(chalk29.bold.cyan(`# ${skill.name}`));
|
|
14059
14263
|
output.log("");
|
|
14060
|
-
output.log(`${
|
|
14061
|
-
output.log(`${
|
|
14062
|
-
output.log(`${
|
|
14264
|
+
output.log(`${chalk29.gray("Description:")} ${skill.description}`);
|
|
14265
|
+
output.log(`${chalk29.gray("Source:")} ${skill.source}`);
|
|
14266
|
+
output.log(`${chalk29.gray("File:")} ${skill.filePath}`);
|
|
14063
14267
|
output.log("");
|
|
14064
|
-
output.log(
|
|
14268
|
+
output.log(chalk29.bold("--- Content ---"));
|
|
14065
14269
|
output.log("");
|
|
14066
14270
|
output.log(skill.content);
|
|
14067
14271
|
}
|
|
@@ -14075,7 +14279,7 @@ var GetCommand3 = {
|
|
|
14075
14279
|
};
|
|
14076
14280
|
|
|
14077
14281
|
// src/commands/skills/search.ts
|
|
14078
|
-
import
|
|
14282
|
+
import chalk30 from "chalk";
|
|
14079
14283
|
var SearchCommand2 = {
|
|
14080
14284
|
command: "search <term>",
|
|
14081
14285
|
aliases: ["find"],
|
|
@@ -14114,7 +14318,7 @@ var SearchCommand2 = {
|
|
|
14114
14318
|
const term = args.term.toLowerCase();
|
|
14115
14319
|
const results = allSkills.filter((s) => s.name.toLowerCase().includes(term) || s.description.toLowerCase().includes(term));
|
|
14116
14320
|
if (results.length === 0) {
|
|
14117
|
-
output.log(
|
|
14321
|
+
output.log(chalk30.yellow(`No skills found matching: ${args.term}`));
|
|
14118
14322
|
return;
|
|
14119
14323
|
}
|
|
14120
14324
|
if (args.json) {
|
|
@@ -14131,19 +14335,19 @@ var SearchCommand2 = {
|
|
|
14131
14335
|
} else if (args.quiet) {
|
|
14132
14336
|
results.forEach((s) => output.log(s.name));
|
|
14133
14337
|
} else {
|
|
14134
|
-
output.log(
|
|
14338
|
+
output.log(chalk30.bold(`Search results for "${args.term}":`));
|
|
14135
14339
|
output.log("");
|
|
14136
14340
|
const header = [
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14341
|
+
chalk30.bold("Name"),
|
|
14342
|
+
chalk30.bold("Description"),
|
|
14343
|
+
chalk30.bold("Match")
|
|
14140
14344
|
].join(" | ");
|
|
14141
14345
|
const rows = results.map((s) => {
|
|
14142
14346
|
const matchedIn = s.name.toLowerCase().includes(term) ? "name" : "description";
|
|
14143
|
-
const matchColor = matchedIn === "name" ?
|
|
14347
|
+
const matchColor = matchedIn === "name" ? chalk30.green : chalk30.blue;
|
|
14144
14348
|
const desc2 = s.description.length > 40 ? s.description.slice(0, 37) + "..." : s.description;
|
|
14145
14349
|
return [
|
|
14146
|
-
|
|
14350
|
+
chalk30.cyan(s.name),
|
|
14147
14351
|
desc2,
|
|
14148
14352
|
matchColor(`[${matchedIn}]`)
|
|
14149
14353
|
].join(" | ");
|
|
@@ -14155,7 +14359,7 @@ var SearchCommand2 = {
|
|
|
14155
14359
|
...rows.map((r) => `│${r}│`),
|
|
14156
14360
|
"└" + "─".repeat(header.length + 2) + "┘",
|
|
14157
14361
|
"",
|
|
14158
|
-
|
|
14362
|
+
chalk30.gray(`${results.length} matching skill(s) found.`)
|
|
14159
14363
|
].join(`
|
|
14160
14364
|
`));
|
|
14161
14365
|
}
|
|
@@ -14169,7 +14373,7 @@ var SearchCommand2 = {
|
|
|
14169
14373
|
};
|
|
14170
14374
|
|
|
14171
14375
|
// src/commands/skills/reload.ts
|
|
14172
|
-
import
|
|
14376
|
+
import chalk31 from "chalk";
|
|
14173
14377
|
var ReloadCommand = {
|
|
14174
14378
|
command: "reload",
|
|
14175
14379
|
describe: "重新扫描并更新 SkillTool",
|
|
@@ -14192,10 +14396,10 @@ var ReloadCommand = {
|
|
|
14192
14396
|
output.error("SkillComponent not available");
|
|
14193
14397
|
process.exit(1);
|
|
14194
14398
|
}
|
|
14195
|
-
output.log(
|
|
14399
|
+
output.log(chalk31.blue("Reloading skills..."));
|
|
14196
14400
|
await skillComponent.reload();
|
|
14197
14401
|
const skills = skillComponent.getSkillList();
|
|
14198
|
-
output.log(
|
|
14402
|
+
output.log(chalk31.green(`Successfully reloaded ${skills.length} skills`));
|
|
14199
14403
|
} catch (error) {
|
|
14200
14404
|
output.error(`Failed to reload skills: ${error}`);
|
|
14201
14405
|
process.exit(1);
|
|
@@ -14206,7 +14410,7 @@ var ReloadCommand = {
|
|
|
14206
14410
|
};
|
|
14207
14411
|
|
|
14208
14412
|
// src/commands/skills/show-config.ts
|
|
14209
|
-
import
|
|
14413
|
+
import chalk32 from "chalk";
|
|
14210
14414
|
var ShowConfigCommand = {
|
|
14211
14415
|
command: "show-config",
|
|
14212
14416
|
aliases: ["config"],
|
|
@@ -14231,38 +14435,38 @@ var ShowConfigCommand = {
|
|
|
14231
14435
|
process.exit(1);
|
|
14232
14436
|
}
|
|
14233
14437
|
const defaultConfig = skillComponent.getConfig?.();
|
|
14234
|
-
output.log(
|
|
14438
|
+
output.log(chalk32.bold.cyan(`# Skills Configuration
|
|
14235
14439
|
`));
|
|
14236
|
-
output.log(
|
|
14440
|
+
output.log(chalk32.bold(`## Scan Paths
|
|
14237
14441
|
`));
|
|
14238
14442
|
const paths = [
|
|
14239
14443
|
{ type: "user", desc: "用户路径", path: "~/.config/roy-agent/skills/" },
|
|
14240
14444
|
{ type: "project", desc: "项目路径", path: ".roy/skills/" }
|
|
14241
14445
|
];
|
|
14242
14446
|
for (const p of paths) {
|
|
14243
|
-
const typeColor = p.type === "project" ?
|
|
14244
|
-
output.log(` ${typeColor("[ " + p.type + " ]")} ${
|
|
14245
|
-
output.log(` ${
|
|
14447
|
+
const typeColor = p.type === "project" ? chalk32.green : chalk32.blue;
|
|
14448
|
+
output.log(` ${typeColor("[ " + p.type + " ]")} ${chalk32.gray(p.desc)}`);
|
|
14449
|
+
output.log(` ${chalk32.cyan(p.path)}
|
|
14246
14450
|
`);
|
|
14247
14451
|
}
|
|
14248
|
-
output.log(
|
|
14452
|
+
output.log(chalk32.bold(`## Scan Rules
|
|
14249
14453
|
`));
|
|
14250
|
-
output.log(` ${
|
|
14251
|
-
output.log(` ${
|
|
14252
|
-
output.log(` ${
|
|
14454
|
+
output.log(` ${chalk32.gray("Pattern:")} ${chalk32.cyan("**/SKILL.md")}`);
|
|
14455
|
+
output.log(` ${chalk32.gray("Recursive:")} ${chalk32.green("true")}`);
|
|
14456
|
+
output.log(` ${chalk32.gray("Ignore:")} ${chalk32.cyan("**/node_modules/**")}
|
|
14253
14457
|
`);
|
|
14254
|
-
output.log(
|
|
14458
|
+
output.log(chalk32.bold(`## Priority (High to Low)
|
|
14255
14459
|
`));
|
|
14256
|
-
output.log(` ${
|
|
14257
|
-
output.log(` ${
|
|
14258
|
-
output.log(` ${
|
|
14460
|
+
output.log(` ${chalk32.green("1. project")} - 项目路径(最高优先级)`);
|
|
14461
|
+
output.log(` ${chalk32.blue("2. user")} - 用户路径`);
|
|
14462
|
+
output.log(` ${chalk32.gray("3. built-in")} - 内置路径(预留)
|
|
14259
14463
|
`);
|
|
14260
|
-
output.log(
|
|
14464
|
+
output.log(chalk32.bold(`## Usage
|
|
14261
14465
|
`));
|
|
14262
|
-
output.log(` ${
|
|
14263
|
-
output.log(` ${
|
|
14264
|
-
output.log(` ${
|
|
14265
|
-
output.log(` ${
|
|
14466
|
+
output.log(` ${chalk32.cyan("roy-agent skills list")} ${chalk32.gray("- 列出所有技能")}`);
|
|
14467
|
+
output.log(` ${chalk32.cyan("roy-agent skills get <name>")} ${chalk32.gray("- 获取技能内容")}`);
|
|
14468
|
+
output.log(` ${chalk32.cyan("roy-agent skills search <term>")} ${chalk32.gray("- 搜索技能")}`);
|
|
14469
|
+
output.log(` ${chalk32.cyan("roy-agent skills reload")} ${chalk32.gray("- 重新扫描技能")}`);
|
|
14266
14470
|
} catch (error) {
|
|
14267
14471
|
output.error(`Failed to show config: ${error}`);
|
|
14268
14472
|
process.exit(1);
|
|
@@ -14283,7 +14487,7 @@ var SkillsCommand = {
|
|
|
14283
14487
|
};
|
|
14284
14488
|
|
|
14285
14489
|
// src/commands/agents/list.ts
|
|
14286
|
-
import
|
|
14490
|
+
import chalk33 from "chalk";
|
|
14287
14491
|
var ListCommand4 = {
|
|
14288
14492
|
command: "list",
|
|
14289
14493
|
aliases: ["ls"],
|
|
@@ -14369,27 +14573,27 @@ var ListCommand4 = {
|
|
|
14369
14573
|
output.log(hint);
|
|
14370
14574
|
} else {
|
|
14371
14575
|
const header = [
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14375
|
-
|
|
14376
|
-
|
|
14377
|
-
|
|
14576
|
+
chalk33.bold("Name"),
|
|
14577
|
+
chalk33.bold("Type"),
|
|
14578
|
+
chalk33.bold("Source"),
|
|
14579
|
+
chalk33.bold("Model"),
|
|
14580
|
+
chalk33.bold("Workflow"),
|
|
14581
|
+
chalk33.bold("Description")
|
|
14378
14582
|
].join(" | ");
|
|
14379
14583
|
const typeColor = (type) => {
|
|
14380
14584
|
if (type === "primary")
|
|
14381
|
-
return
|
|
14585
|
+
return chalk33.yellow;
|
|
14382
14586
|
if (type === "workflow")
|
|
14383
|
-
return
|
|
14384
|
-
return
|
|
14587
|
+
return chalk33.magenta;
|
|
14588
|
+
return chalk33.blue;
|
|
14385
14589
|
};
|
|
14386
14590
|
const rows = pagedAgents.map((a) => {
|
|
14387
14591
|
const desc2 = (a.description || "").length > 40 ? (a.description || "").slice(0, 37) + "..." : a.description || "-";
|
|
14388
|
-
const workflowDisplay = a.type === "workflow" && a.workflow ?
|
|
14389
|
-
const modelDisplay = a.model ?
|
|
14390
|
-
const sourceDisplay = builtInSubAgentNames.has(a.name) ?
|
|
14592
|
+
const workflowDisplay = a.type === "workflow" && a.workflow ? chalk33.cyan(a.workflow.length > 30 ? a.workflow.slice(0, 27) + "..." : a.workflow) : chalk33.gray("-");
|
|
14593
|
+
const modelDisplay = a.model ? chalk33.yellow(a.model.length > 20 ? a.model.slice(0, 17) + "..." : a.model) : chalk33.gray("-");
|
|
14594
|
+
const sourceDisplay = builtInSubAgentNames.has(a.name) ? chalk33.green("built-in") : chalk33.gray("user");
|
|
14391
14595
|
return [
|
|
14392
|
-
|
|
14596
|
+
chalk33.cyan(a.name),
|
|
14393
14597
|
typeColor(a.type)(a.type),
|
|
14394
14598
|
sourceDisplay,
|
|
14395
14599
|
modelDisplay,
|
|
@@ -14398,9 +14602,9 @@ var ListCommand4 = {
|
|
|
14398
14602
|
].join(" | ");
|
|
14399
14603
|
});
|
|
14400
14604
|
if (rows.length === 0) {
|
|
14401
|
-
output.log(
|
|
14605
|
+
output.log(chalk33.yellow("No agents found."));
|
|
14402
14606
|
output.log("");
|
|
14403
|
-
output.log(
|
|
14607
|
+
output.log(chalk33.gray("Tip: Create agent configs in ~/.local/share/roy-agent/agents/"));
|
|
14404
14608
|
} else {
|
|
14405
14609
|
output.log([
|
|
14406
14610
|
`┌─ Agents ${"─".repeat(50)}┐`,
|
|
@@ -14431,7 +14635,7 @@ var ListCommand4 = {
|
|
|
14431
14635
|
};
|
|
14432
14636
|
|
|
14433
14637
|
// src/commands/agents/get.ts
|
|
14434
|
-
import
|
|
14638
|
+
import chalk34 from "chalk";
|
|
14435
14639
|
var GetCommand4 = {
|
|
14436
14640
|
command: "get <name>",
|
|
14437
14641
|
describe: "获取指定 agent 的详细信息",
|
|
@@ -14490,69 +14694,69 @@ var GetCommand4 = {
|
|
|
14490
14694
|
filterHistory: agent.filterHistory
|
|
14491
14695
|
});
|
|
14492
14696
|
} else {
|
|
14493
|
-
output.log(
|
|
14697
|
+
output.log(chalk34.bold.cyan(`# Agent: ${agent.name}`));
|
|
14494
14698
|
output.log("");
|
|
14495
|
-
output.log(
|
|
14496
|
-
output.log(` ${
|
|
14497
|
-
output.log(` ${
|
|
14699
|
+
output.log(chalk34.bold("Basic Info:"));
|
|
14700
|
+
output.log(` ${chalk34.cyan("name:")} ${agent.name}`);
|
|
14701
|
+
output.log(` ${chalk34.cyan("type:")} ${agent.type}`);
|
|
14498
14702
|
if (agent.description) {
|
|
14499
|
-
output.log(` ${
|
|
14703
|
+
output.log(` ${chalk34.cyan("description:")} ${agent.description}`);
|
|
14500
14704
|
}
|
|
14501
14705
|
output.log("");
|
|
14502
14706
|
if (agent.type === "workflow") {
|
|
14503
|
-
output.log(
|
|
14707
|
+
output.log(chalk34.bold("Workflow:"));
|
|
14504
14708
|
if (agent.workflow) {
|
|
14505
|
-
output.log(` ${
|
|
14506
|
-
output.log(` ${
|
|
14709
|
+
output.log(` ${chalk34.cyan("workflow:")} ${agent.workflow}`);
|
|
14710
|
+
output.log(` ${chalk34.gray("→")} ${chalk34.gray(`roy-agent workflow run ${agent.workflow} --input '{"query":"..."}'`)}`);
|
|
14507
14711
|
} else {
|
|
14508
|
-
output.log(` ${
|
|
14712
|
+
output.log(` ${chalk34.gray("(no workflow configured)")}`);
|
|
14509
14713
|
}
|
|
14510
14714
|
output.log("");
|
|
14511
14715
|
}
|
|
14512
|
-
output.log(
|
|
14716
|
+
output.log(chalk34.bold("System Prompt:"));
|
|
14513
14717
|
if (agent.systemPromptRef) {
|
|
14514
|
-
output.log(` ${
|
|
14718
|
+
output.log(` ${chalk34.green("[ref]")} ${chalk34.cyan("systemPromptRef:")} ${agent.systemPromptRef}`);
|
|
14515
14719
|
}
|
|
14516
14720
|
if (agent.systemPrompt && !agent.systemPromptRef) {
|
|
14517
14721
|
const promptPreview = agent.systemPrompt.length > 100 ? agent.systemPrompt.slice(0, 97) + "..." : agent.systemPrompt;
|
|
14518
|
-
output.log(` ${
|
|
14519
|
-
output.log(` ${
|
|
14722
|
+
output.log(` ${chalk34.gray("[inline]")}`);
|
|
14723
|
+
output.log(` ${chalk34.gray(promptPreview.split(`
|
|
14520
14724
|
`).join(`
|
|
14521
14725
|
`))}`);
|
|
14522
14726
|
}
|
|
14523
14727
|
if (resolvedSystemPrompt) {
|
|
14524
14728
|
const resolvedPreview = resolvedSystemPrompt.length > 200 ? resolvedSystemPrompt.slice(0, 197) + "..." : resolvedSystemPrompt;
|
|
14525
|
-
output.log(` ${
|
|
14526
|
-
output.log(` ${
|
|
14729
|
+
output.log(` ${chalk34.green("[resolved]")}`);
|
|
14730
|
+
output.log(` ${chalk34.gray(resolvedPreview.split(`
|
|
14527
14731
|
`).join(`
|
|
14528
14732
|
`))}`);
|
|
14529
14733
|
}
|
|
14530
14734
|
if (!agent.systemPromptRef && !agent.systemPrompt && !resolvedSystemPrompt) {
|
|
14531
|
-
output.log(` ${
|
|
14735
|
+
output.log(` ${chalk34.gray("(none)")}`);
|
|
14532
14736
|
}
|
|
14533
14737
|
output.log("");
|
|
14534
14738
|
const hasOptions = agent.model || agent.maxIterations || agent.toolTimeout;
|
|
14535
14739
|
if (hasOptions) {
|
|
14536
|
-
output.log(
|
|
14740
|
+
output.log(chalk34.bold("Options:"));
|
|
14537
14741
|
if (agent.model) {
|
|
14538
|
-
output.log(` ${
|
|
14742
|
+
output.log(` ${chalk34.cyan("model:")} ${agent.model}`);
|
|
14539
14743
|
}
|
|
14540
14744
|
if (agent.maxIterations) {
|
|
14541
|
-
output.log(` ${
|
|
14745
|
+
output.log(` ${chalk34.cyan("maxIterations:")} ${agent.maxIterations}`);
|
|
14542
14746
|
}
|
|
14543
14747
|
if (agent.toolTimeout) {
|
|
14544
|
-
output.log(` ${
|
|
14748
|
+
output.log(` ${chalk34.cyan("toolTimeout:")} ${agent.toolTimeout}ms`);
|
|
14545
14749
|
}
|
|
14546
14750
|
output.log("");
|
|
14547
14751
|
}
|
|
14548
14752
|
const hasTools = agent.allowedTools?.length || agent.deniedTools?.length;
|
|
14549
14753
|
if (hasTools) {
|
|
14550
|
-
output.log(
|
|
14754
|
+
output.log(chalk34.bold("Tool Permissions:"));
|
|
14551
14755
|
if (agent.allowedTools?.length) {
|
|
14552
|
-
output.log(` ${
|
|
14756
|
+
output.log(` ${chalk34.green("allowed:")} ${agent.allowedTools.join(", ")}`);
|
|
14553
14757
|
}
|
|
14554
14758
|
if (agent.deniedTools?.length) {
|
|
14555
|
-
output.log(` ${
|
|
14759
|
+
output.log(` ${chalk34.red("denied:")} ${agent.deniedTools.join(", ")}`);
|
|
14556
14760
|
}
|
|
14557
14761
|
output.log("");
|
|
14558
14762
|
}
|
|
@@ -14567,7 +14771,7 @@ var GetCommand4 = {
|
|
|
14567
14771
|
};
|
|
14568
14772
|
|
|
14569
14773
|
// src/commands/agents/add.ts
|
|
14570
|
-
import
|
|
14774
|
+
import chalk35 from "chalk";
|
|
14571
14775
|
function parseToolList(value) {
|
|
14572
14776
|
if (!value?.trim()) {
|
|
14573
14777
|
return;
|
|
@@ -14659,8 +14863,8 @@ var AddCommand = {
|
|
|
14659
14863
|
if (args.json) {
|
|
14660
14864
|
output.json({ agent, filePath });
|
|
14661
14865
|
} else {
|
|
14662
|
-
output.log(
|
|
14663
|
-
output.log(
|
|
14866
|
+
output.log(chalk35.green(`✓ Agent '${args.name}' created`));
|
|
14867
|
+
output.log(chalk35.gray(` ${filePath}`));
|
|
14664
14868
|
}
|
|
14665
14869
|
} catch (error) {
|
|
14666
14870
|
output.error(`Failed to add agent: ${error}`);
|
|
@@ -14672,7 +14876,7 @@ var AddCommand = {
|
|
|
14672
14876
|
};
|
|
14673
14877
|
|
|
14674
14878
|
// src/commands/agents/delete.ts
|
|
14675
|
-
import
|
|
14879
|
+
import chalk36 from "chalk";
|
|
14676
14880
|
var DeleteCommand3 = {
|
|
14677
14881
|
command: "delete <name>",
|
|
14678
14882
|
describe: "删除 agent 配置文件",
|
|
@@ -14714,7 +14918,7 @@ var DeleteCommand3 = {
|
|
|
14714
14918
|
}
|
|
14715
14919
|
const filePath = registry.getAgentFilePath(args.name);
|
|
14716
14920
|
if (!args.yes) {
|
|
14717
|
-
output.log(
|
|
14921
|
+
output.log(chalk36.yellow(`Delete agent '${args.name}'? This removes ${filePath} (use --yes to skip confirmation)`));
|
|
14718
14922
|
process.exit(1);
|
|
14719
14923
|
}
|
|
14720
14924
|
const deleted = await registry.deleteAgent(args.name);
|
|
@@ -14725,7 +14929,7 @@ var DeleteCommand3 = {
|
|
|
14725
14929
|
if (args.json) {
|
|
14726
14930
|
output.json({ deleted: true, name: args.name, filePath });
|
|
14727
14931
|
} else {
|
|
14728
|
-
output.log(
|
|
14932
|
+
output.log(chalk36.green(`✓ Agent '${args.name}' deleted`));
|
|
14729
14933
|
}
|
|
14730
14934
|
} catch (error) {
|
|
14731
14935
|
output.error(`Failed to delete agent: ${error}`);
|
|
@@ -14737,7 +14941,7 @@ var DeleteCommand3 = {
|
|
|
14737
14941
|
};
|
|
14738
14942
|
|
|
14739
14943
|
// src/commands/agents/config-dir.ts
|
|
14740
|
-
import
|
|
14944
|
+
import chalk37 from "chalk";
|
|
14741
14945
|
var ConfigDirCommand = {
|
|
14742
14946
|
command: "config-dir",
|
|
14743
14947
|
describe: "显示 agent 配置目录路径",
|
|
@@ -14768,8 +14972,8 @@ var ConfigDirCommand = {
|
|
|
14768
14972
|
if (args.json) {
|
|
14769
14973
|
output.json({ configDir, exists });
|
|
14770
14974
|
} else {
|
|
14771
|
-
output.log(`${
|
|
14772
|
-
output.log(`${
|
|
14975
|
+
output.log(`${chalk37.cyan("Agent Config Directory:")} ${configDir}`);
|
|
14976
|
+
output.log(`${chalk37.gray("Exists:")} ${exists ? "yes" : "no"}`);
|
|
14773
14977
|
}
|
|
14774
14978
|
} catch (error) {
|
|
14775
14979
|
output.error(`Failed to get config dir: ${error}`);
|
|
@@ -14792,7 +14996,7 @@ var AgentsCommand = {
|
|
|
14792
14996
|
};
|
|
14793
14997
|
|
|
14794
14998
|
// src/commands/prompt/list.ts
|
|
14795
|
-
import
|
|
14999
|
+
import chalk38 from "chalk";
|
|
14796
15000
|
var ListCommand5 = {
|
|
14797
15001
|
command: "list",
|
|
14798
15002
|
aliases: ["ls"],
|
|
@@ -14861,17 +15065,17 @@ var ListCommand5 = {
|
|
|
14861
15065
|
output.log(hint);
|
|
14862
15066
|
} else {
|
|
14863
15067
|
const header = [
|
|
14864
|
-
|
|
14865
|
-
|
|
15068
|
+
chalk38.bold("Name"),
|
|
15069
|
+
chalk38.bold("Source")
|
|
14866
15070
|
].join(" | ");
|
|
14867
15071
|
const rows = prompts.map((p) => {
|
|
14868
15072
|
return [
|
|
14869
|
-
|
|
14870
|
-
|
|
15073
|
+
chalk38.cyan(p.name),
|
|
15074
|
+
chalk38.gray(`[${p.source}]`)
|
|
14871
15075
|
].join(" | ");
|
|
14872
15076
|
});
|
|
14873
15077
|
if (rows.length === 0) {
|
|
14874
|
-
output.log(
|
|
15078
|
+
output.log(chalk38.yellow("No prompts found."));
|
|
14875
15079
|
} else {
|
|
14876
15080
|
output.log([
|
|
14877
15081
|
`┌─ Prompts ${"─".repeat(50)}┐`,
|
|
@@ -14902,7 +15106,7 @@ var ListCommand5 = {
|
|
|
14902
15106
|
};
|
|
14903
15107
|
|
|
14904
15108
|
// src/commands/prompt/get.ts
|
|
14905
|
-
import
|
|
15109
|
+
import chalk39 from "chalk";
|
|
14906
15110
|
var GetCommand5 = {
|
|
14907
15111
|
command: "get <name>",
|
|
14908
15112
|
describe: "获取指定 prompt 的内容",
|
|
@@ -14949,16 +15153,16 @@ var GetCommand5 = {
|
|
|
14949
15153
|
variables: vars
|
|
14950
15154
|
});
|
|
14951
15155
|
} else {
|
|
14952
|
-
output.log(
|
|
15156
|
+
output.log(chalk39.bold.cyan(`# Prompt: ${args.name}`));
|
|
14953
15157
|
output.log("");
|
|
14954
15158
|
if (Object.keys(vars).length > 0) {
|
|
14955
|
-
output.log(
|
|
15159
|
+
output.log(chalk39.gray("Variables:"));
|
|
14956
15160
|
for (const [key, value] of Object.entries(vars)) {
|
|
14957
|
-
output.log(` ${
|
|
15161
|
+
output.log(` ${chalk39.cyan(key + ":")} ${value}`);
|
|
14958
15162
|
}
|
|
14959
15163
|
output.log("");
|
|
14960
15164
|
}
|
|
14961
|
-
output.log(
|
|
15165
|
+
output.log(chalk39.bold("Content:"));
|
|
14962
15166
|
output.log("─".repeat(60));
|
|
14963
15167
|
output.log(prompt);
|
|
14964
15168
|
output.log("─".repeat(60));
|
|
@@ -14988,7 +15192,7 @@ function parseVars(vars) {
|
|
|
14988
15192
|
|
|
14989
15193
|
// src/commands/prompt/add.ts
|
|
14990
15194
|
import { readFile as readFile2 } from "fs/promises";
|
|
14991
|
-
import
|
|
15195
|
+
import chalk40 from "chalk";
|
|
14992
15196
|
var AddCommand2 = {
|
|
14993
15197
|
command: "add <name>",
|
|
14994
15198
|
describe: "添加 prompt 并持久化到 ~/.local/share/roy-agent/prompts/",
|
|
@@ -15039,8 +15243,8 @@ var AddCommand2 = {
|
|
|
15039
15243
|
length: content.trim().length
|
|
15040
15244
|
});
|
|
15041
15245
|
} else {
|
|
15042
|
-
output.log(
|
|
15043
|
-
output.log(
|
|
15246
|
+
output.log(chalk40.green(`✓ Prompt '${args.name}' saved`));
|
|
15247
|
+
output.log(chalk40.gray(` ${filePath}`));
|
|
15044
15248
|
}
|
|
15045
15249
|
} catch (error) {
|
|
15046
15250
|
output.error(`Failed to add prompt: ${error}`);
|
|
@@ -15052,7 +15256,7 @@ var AddCommand2 = {
|
|
|
15052
15256
|
};
|
|
15053
15257
|
|
|
15054
15258
|
// src/commands/prompt/config-dir.ts
|
|
15055
|
-
import
|
|
15259
|
+
import chalk41 from "chalk";
|
|
15056
15260
|
var ConfigDirCommand2 = {
|
|
15057
15261
|
command: "config-dir",
|
|
15058
15262
|
describe: "显示 prompt 持久化目录路径",
|
|
@@ -15082,8 +15286,8 @@ var ConfigDirCommand2 = {
|
|
|
15082
15286
|
if (args.json) {
|
|
15083
15287
|
output.json({ configDir, exists });
|
|
15084
15288
|
} else {
|
|
15085
|
-
output.log(`${
|
|
15086
|
-
output.log(`${
|
|
15289
|
+
output.log(`${chalk41.cyan("Prompt Config Directory:")} ${configDir}`);
|
|
15290
|
+
output.log(`${chalk41.gray("Exists:")} ${exists ? "yes" : "no"}`);
|
|
15087
15291
|
}
|
|
15088
15292
|
} catch (error) {
|
|
15089
15293
|
output.error(`Failed to get config dir: ${error}`);
|
|
@@ -15105,7 +15309,7 @@ var PromptCommand = {
|
|
|
15105
15309
|
};
|
|
15106
15310
|
|
|
15107
15311
|
// src/commands/commands-list.ts
|
|
15108
|
-
import
|
|
15312
|
+
import chalk42 from "chalk";
|
|
15109
15313
|
function truncateVisual(str, maxWidth) {
|
|
15110
15314
|
let result = "";
|
|
15111
15315
|
let width = 0;
|
|
@@ -15120,16 +15324,16 @@ function truncateVisual(str, maxWidth) {
|
|
|
15120
15324
|
}
|
|
15121
15325
|
function formatCommandsTable(commands) {
|
|
15122
15326
|
if (commands.length === 0) {
|
|
15123
|
-
return
|
|
15327
|
+
return chalk42.yellow("命令目录为空,使用 'roy-agent commands add' 添加命令");
|
|
15124
15328
|
}
|
|
15125
15329
|
const NAME_WIDTH = 20;
|
|
15126
15330
|
const SOURCE_WIDTH = 10;
|
|
15127
15331
|
const DESC_WIDTH = 50;
|
|
15128
15332
|
const GAP = " ";
|
|
15129
15333
|
const headerLine = [
|
|
15130
|
-
|
|
15131
|
-
|
|
15132
|
-
|
|
15334
|
+
chalk42.bold("NAME".padEnd(NAME_WIDTH)),
|
|
15335
|
+
chalk42.bold("SOURCE".padEnd(SOURCE_WIDTH)),
|
|
15336
|
+
chalk42.bold("DESCRIPTION")
|
|
15133
15337
|
].join(GAP);
|
|
15134
15338
|
const sepLine = "─".repeat(NAME_WIDTH + SOURCE_WIDTH + DESC_WIDTH + GAP.length * 2);
|
|
15135
15339
|
const formatRow = (cmd) => {
|
|
@@ -15237,7 +15441,7 @@ var CommandsListCommand = {
|
|
|
15237
15441
|
};
|
|
15238
15442
|
|
|
15239
15443
|
// src/commands/commands-add.ts
|
|
15240
|
-
import
|
|
15444
|
+
import chalk43 from "chalk";
|
|
15241
15445
|
var CommandsAddCommand = {
|
|
15242
15446
|
command: "add <name> <target>",
|
|
15243
15447
|
describe: "添加收藏命令(自动创建 symlink)",
|
|
@@ -15298,10 +15502,10 @@ var CommandsAddCommand = {
|
|
|
15298
15502
|
});
|
|
15299
15503
|
const dirs = await commandsComponent.getCommandDirs();
|
|
15300
15504
|
const targetDir = source === "user" ? dirs.user : dirs.project;
|
|
15301
|
-
output.log(
|
|
15302
|
-
output.log(
|
|
15303
|
-
output.log(
|
|
15304
|
-
output.log(
|
|
15505
|
+
output.log(chalk43.green(`✅ 已添加命令 '${args.name}'`));
|
|
15506
|
+
output.log(chalk43.gray(` 目标: ${args.target}`));
|
|
15507
|
+
output.log(chalk43.gray(` 位置: ${targetDir}/${args.name}`));
|
|
15508
|
+
output.log(chalk43.gray(` 级别: ${source === "user" ? "USER" : "PROJECT"}`));
|
|
15305
15509
|
} catch (error) {
|
|
15306
15510
|
output.error(`添加失败: ${error.message}`);
|
|
15307
15511
|
process.exit(1);
|
|
@@ -15312,7 +15516,7 @@ var CommandsAddCommand = {
|
|
|
15312
15516
|
};
|
|
15313
15517
|
|
|
15314
15518
|
// src/commands/commands-remove.ts
|
|
15315
|
-
import
|
|
15519
|
+
import chalk44 from "chalk";
|
|
15316
15520
|
var CommandsRemoveCommand = {
|
|
15317
15521
|
command: "remove <name>",
|
|
15318
15522
|
aliases: ["rm"],
|
|
@@ -15356,7 +15560,7 @@ var CommandsRemoveCommand = {
|
|
|
15356
15560
|
name: args.name,
|
|
15357
15561
|
source: "user"
|
|
15358
15562
|
});
|
|
15359
|
-
output.log(
|
|
15563
|
+
output.log(chalk44.green(`✅ 已从用户目录移除命令 '${args.name}'`));
|
|
15360
15564
|
} catch (error) {
|
|
15361
15565
|
if (!error.message?.includes("不存在")) {
|
|
15362
15566
|
throw error;
|
|
@@ -15369,7 +15573,7 @@ var CommandsRemoveCommand = {
|
|
|
15369
15573
|
name: args.name,
|
|
15370
15574
|
source: "project"
|
|
15371
15575
|
});
|
|
15372
|
-
output.log(
|
|
15576
|
+
output.log(chalk44.green(`✅ 已从项目目录移除命令 '${args.name}'`));
|
|
15373
15577
|
} catch (error) {
|
|
15374
15578
|
if (!error.message?.includes("不存在")) {
|
|
15375
15579
|
throw error;
|
|
@@ -15383,7 +15587,7 @@ var CommandsRemoveCommand = {
|
|
|
15383
15587
|
name: args.name,
|
|
15384
15588
|
source: "user"
|
|
15385
15589
|
});
|
|
15386
|
-
output.log(
|
|
15590
|
+
output.log(chalk44.green(`✅ 已从用户目录移除命令 '${args.name}'`));
|
|
15387
15591
|
removed = true;
|
|
15388
15592
|
} catch (error) {
|
|
15389
15593
|
if (!error.message?.includes("不存在")) {
|
|
@@ -15395,7 +15599,7 @@ var CommandsRemoveCommand = {
|
|
|
15395
15599
|
name: args.name,
|
|
15396
15600
|
source: "project"
|
|
15397
15601
|
});
|
|
15398
|
-
output.log(
|
|
15602
|
+
output.log(chalk44.green(`✅ 已从项目目录移除命令 '${args.name}'`));
|
|
15399
15603
|
removed = true;
|
|
15400
15604
|
} catch (error) {
|
|
15401
15605
|
if (!error.message?.includes("不存在")) {
|
|
@@ -15417,7 +15621,7 @@ var CommandsRemoveCommand = {
|
|
|
15417
15621
|
};
|
|
15418
15622
|
|
|
15419
15623
|
// src/commands/commands-info.ts
|
|
15420
|
-
import
|
|
15624
|
+
import chalk45 from "chalk";
|
|
15421
15625
|
import { exec as exec2 } from "child_process";
|
|
15422
15626
|
import { promisify } from "util";
|
|
15423
15627
|
var execAsync2 = promisify(exec2);
|
|
@@ -15452,12 +15656,12 @@ var CommandsInfoCommand = {
|
|
|
15452
15656
|
output.error(`命令 '${args.name}' 不存在`);
|
|
15453
15657
|
process.exit(1);
|
|
15454
15658
|
}
|
|
15455
|
-
output.log(
|
|
15456
|
-
output.log(
|
|
15457
|
-
output.log(
|
|
15458
|
-
output.log(
|
|
15659
|
+
output.log(chalk45.bold("Name:") + ` ${info.name}`);
|
|
15660
|
+
output.log(chalk45.bold("Path:") + ` ${info.path}`);
|
|
15661
|
+
output.log(chalk45.bold("Source:") + ` ${info.source.toUpperCase()}`);
|
|
15662
|
+
output.log(chalk45.bold("Description:") + ` ${info.shortDescription || "-"}`);
|
|
15459
15663
|
output.log();
|
|
15460
|
-
output.log(
|
|
15664
|
+
output.log(chalk45.gray("─".repeat(50)));
|
|
15461
15665
|
output.log();
|
|
15462
15666
|
try {
|
|
15463
15667
|
const { stdout } = await execAsync2(`${info.path} --help`, { timeout: 5000 });
|
|
@@ -15467,7 +15671,7 @@ var CommandsInfoCommand = {
|
|
|
15467
15671
|
const { stdout } = await execAsync2(`${info.path} -h`, { timeout: 5000 });
|
|
15468
15672
|
output.log(stdout);
|
|
15469
15673
|
} catch {
|
|
15470
|
-
output.log(
|
|
15674
|
+
output.log(chalk45.gray("(无法获取帮助信息)"));
|
|
15471
15675
|
}
|
|
15472
15676
|
}
|
|
15473
15677
|
} catch (error) {
|
|
@@ -15480,7 +15684,7 @@ var CommandsInfoCommand = {
|
|
|
15480
15684
|
};
|
|
15481
15685
|
|
|
15482
15686
|
// src/commands/commands-dirs.ts
|
|
15483
|
-
import
|
|
15687
|
+
import chalk46 from "chalk";
|
|
15484
15688
|
var CommandsDirsCommand = {
|
|
15485
15689
|
command: "dirs",
|
|
15486
15690
|
describe: "显示命令目录",
|
|
@@ -15512,10 +15716,10 @@ var CommandsDirsCommand = {
|
|
|
15512
15716
|
if (args.json) {
|
|
15513
15717
|
output.json(dirs);
|
|
15514
15718
|
} else {
|
|
15515
|
-
output.log(
|
|
15719
|
+
output.log(chalk46.bold("命令目录:"));
|
|
15516
15720
|
output.log();
|
|
15517
|
-
output.log(
|
|
15518
|
-
output.log(
|
|
15721
|
+
output.log(chalk46.cyan("USER:") + ` ${dirs.user}`);
|
|
15722
|
+
output.log(chalk46.cyan("PROJECT:") + ` ${dirs.project}`);
|
|
15519
15723
|
}
|
|
15520
15724
|
} catch (error) {
|
|
15521
15725
|
output.error(`错误: ${error.message}`);
|
|
@@ -15535,7 +15739,7 @@ var CommandsCommand = {
|
|
|
15535
15739
|
};
|
|
15536
15740
|
|
|
15537
15741
|
// src/commands/config/list.ts
|
|
15538
|
-
import
|
|
15742
|
+
import chalk47 from "chalk";
|
|
15539
15743
|
|
|
15540
15744
|
// src/commands/config/config-service.ts
|
|
15541
15745
|
import * as fsSync from "fs";
|
|
@@ -15839,7 +16043,7 @@ var ConfigListCommand = {
|
|
|
15839
16043
|
output.log("");
|
|
15840
16044
|
output.log("Supported components:");
|
|
15841
16045
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
15842
|
-
output.log(` ${
|
|
16046
|
+
output.log(` ${chalk47.cyan(comp.padEnd(15))} ${COMPONENT_DESCRIPTIONS[comp] || ""}`);
|
|
15843
16047
|
}
|
|
15844
16048
|
process.exit(1);
|
|
15845
16049
|
}
|
|
@@ -15857,27 +16061,27 @@ var ConfigListCommand = {
|
|
|
15857
16061
|
}
|
|
15858
16062
|
};
|
|
15859
16063
|
function showHelp(output) {
|
|
15860
|
-
output.log(
|
|
16064
|
+
output.log(chalk47.bold.cyan("# roy-agent config list"));
|
|
15861
16065
|
output.log("");
|
|
15862
16066
|
output.log("查看 roy-agent 组件配置信息");
|
|
15863
16067
|
output.log("");
|
|
15864
|
-
output.log(
|
|
15865
|
-
output.log(` ${
|
|
16068
|
+
output.log(chalk47.bold("Usage:"));
|
|
16069
|
+
output.log(` ${chalk47.cyan("roy-agent config list [component] [options]")}`);
|
|
15866
16070
|
output.log("");
|
|
15867
|
-
output.log(
|
|
16071
|
+
output.log(chalk47.bold("Components:"));
|
|
15868
16072
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
15869
|
-
output.log(` ${
|
|
16073
|
+
output.log(` ${chalk47.cyan(comp.padEnd(15))} ${chalk47.gray(COMPONENT_DESCRIPTIONS[comp] || "")}`);
|
|
15870
16074
|
}
|
|
15871
|
-
output.log(` ${
|
|
16075
|
+
output.log(` ${chalk47.cyan("all".padEnd(15))} 显示所有 components 概览`);
|
|
15872
16076
|
output.log("");
|
|
15873
|
-
output.log(
|
|
15874
|
-
output.log(` ${
|
|
15875
|
-
output.log(` ${
|
|
15876
|
-
output.log(` ${
|
|
16077
|
+
output.log(chalk47.bold("Options:"));
|
|
16078
|
+
output.log(` ${chalk47.cyan("-j, --json")} JSON 格式输出`);
|
|
16079
|
+
output.log(` ${chalk47.cyan("-k, --keys")} 只显示配置键`);
|
|
16080
|
+
output.log(` ${chalk47.cyan("-s, --sources")} 只显示配置源`);
|
|
15877
16081
|
output.log("");
|
|
15878
|
-
output.log(
|
|
16082
|
+
output.log(chalk47.bold("Examples:"));
|
|
15879
16083
|
for (const { command: command2, description } of USAGE_COMMANDS) {
|
|
15880
|
-
output.log(` ${
|
|
16084
|
+
output.log(` ${chalk47.cyan(command2.padEnd(40))} ${chalk47.gray(description)}`);
|
|
15881
16085
|
}
|
|
15882
16086
|
}
|
|
15883
16087
|
async function showAllComponents(output, configService) {
|
|
@@ -15886,13 +16090,13 @@ async function showAllComponents(output, configService) {
|
|
|
15886
16090
|
const config = configService.getComponentConfig(compName);
|
|
15887
16091
|
components.push({ name: compName, config });
|
|
15888
16092
|
}
|
|
15889
|
-
output.log(
|
|
16093
|
+
output.log(chalk47.bold.cyan("# All Components Overview"));
|
|
15890
16094
|
output.log("");
|
|
15891
|
-
output.log(` ${
|
|
15892
|
-
output.log(` ${
|
|
16095
|
+
output.log(` ${chalk47.cyan("Component".padEnd(15))} ${chalk47.cyan("Keys".padEnd(10))} ${chalk47.gray("Description")}`);
|
|
16096
|
+
output.log(` ${chalk47.gray("─".repeat(60))}`);
|
|
15893
16097
|
for (const comp of components) {
|
|
15894
16098
|
const keyCount = Object.keys(comp.config).length;
|
|
15895
|
-
output.log(` ${
|
|
16099
|
+
output.log(` ${chalk47.cyan(comp.name.padEnd(15))} ${keyCount.toString().padEnd(10)} ${chalk47.gray(COMPONENT_DESCRIPTIONS[comp.name] || "")}`);
|
|
15896
16100
|
}
|
|
15897
16101
|
}
|
|
15898
16102
|
async function showComponentConfig(componentName, output, configService, options) {
|
|
@@ -15914,22 +16118,22 @@ async function showComponentConfig(componentName, output, configService, options
|
|
|
15914
16118
|
});
|
|
15915
16119
|
return;
|
|
15916
16120
|
}
|
|
15917
|
-
output.log(
|
|
16121
|
+
output.log(chalk47.bold.cyan(`# ${componentName} Component Configuration`));
|
|
15918
16122
|
output.log("");
|
|
15919
16123
|
if (filePath) {
|
|
15920
|
-
output.log(
|
|
15921
|
-
output.log(` ${
|
|
16124
|
+
output.log(chalk47.bold("File:"));
|
|
16125
|
+
output.log(` ${chalk47.cyan(filePath)}`);
|
|
15922
16126
|
output.log("");
|
|
15923
16127
|
}
|
|
15924
16128
|
if (!options.sources) {
|
|
15925
|
-
output.log(
|
|
16129
|
+
output.log(chalk47.bold("Configuration:"));
|
|
15926
16130
|
if (Object.keys(config).length === 0) {
|
|
15927
|
-
output.log(` ${
|
|
16131
|
+
output.log(` ${chalk47.gray("(无配置)")}`);
|
|
15928
16132
|
} else {
|
|
15929
16133
|
const flatConfig = flattenConfig(config);
|
|
15930
16134
|
for (const [key, value] of flatConfig) {
|
|
15931
16135
|
const displayValue = formatValue(value);
|
|
15932
|
-
output.log(` ${
|
|
16136
|
+
output.log(` ${chalk47.cyan(key + ":")} ${displayValue}`);
|
|
15933
16137
|
}
|
|
15934
16138
|
}
|
|
15935
16139
|
output.log("");
|
|
@@ -15944,17 +16148,17 @@ async function showAgentComponentConfig(output, configService, options) {
|
|
|
15944
16148
|
});
|
|
15945
16149
|
return;
|
|
15946
16150
|
}
|
|
15947
|
-
output.log(
|
|
16151
|
+
output.log(chalk47.bold.cyan("# Agent Component Configuration"));
|
|
15948
16152
|
output.log("");
|
|
15949
16153
|
if (!options.sources) {
|
|
15950
|
-
output.log(
|
|
16154
|
+
output.log(chalk47.bold("Configuration:"));
|
|
15951
16155
|
if (Object.keys(config).length === 0) {
|
|
15952
|
-
output.log(` ${
|
|
16156
|
+
output.log(` ${chalk47.gray("(无配置,使用默认值)")}`);
|
|
15953
16157
|
} else {
|
|
15954
16158
|
const flatConfig = flattenConfig(config);
|
|
15955
16159
|
for (const [key, value] of flatConfig) {
|
|
15956
16160
|
const displayValue = formatValue(value);
|
|
15957
|
-
output.log(` ${
|
|
16161
|
+
output.log(` ${chalk47.cyan(key + ":")} ${displayValue}`);
|
|
15958
16162
|
}
|
|
15959
16163
|
}
|
|
15960
16164
|
output.log("");
|
|
@@ -15968,10 +16172,10 @@ async function showAgentComponentConfig(output, configService, options) {
|
|
|
15968
16172
|
const configDir = registry.getConfigDir();
|
|
15969
16173
|
const exists = registry.configDirExists();
|
|
15970
16174
|
const agentCount = registry.list().length;
|
|
15971
|
-
output.log(
|
|
15972
|
-
output.log(` ${
|
|
15973
|
-
output.log(` ${
|
|
15974
|
-
output.log(` ${
|
|
16175
|
+
output.log(chalk47.bold("Agent Config Directory:"));
|
|
16176
|
+
output.log(` ${chalk47.cyan("path:")} ${configDir}`);
|
|
16177
|
+
output.log(` ${chalk47.cyan("exists:")} ${exists ? chalk47.green("yes") : chalk47.red("no")}`);
|
|
16178
|
+
output.log(` ${chalk47.cyan("agents:")} ${agentCount} loaded`);
|
|
15975
16179
|
output.log("");
|
|
15976
16180
|
}
|
|
15977
16181
|
}
|
|
@@ -15987,41 +16191,41 @@ async function showPromptComponentConfig(output, configService, options, envServ
|
|
|
15987
16191
|
});
|
|
15988
16192
|
return;
|
|
15989
16193
|
}
|
|
15990
|
-
output.log(
|
|
16194
|
+
output.log(chalk47.bold.cyan("# Prompt Component Configuration"));
|
|
15991
16195
|
output.log("");
|
|
15992
16196
|
if (filePath) {
|
|
15993
|
-
output.log(
|
|
15994
|
-
output.log(` ${
|
|
16197
|
+
output.log(chalk47.bold("File:"));
|
|
16198
|
+
output.log(` ${chalk47.cyan(filePath)}`);
|
|
15995
16199
|
output.log("");
|
|
15996
16200
|
}
|
|
15997
16201
|
if (!options.sources) {
|
|
15998
|
-
output.log(
|
|
16202
|
+
output.log(chalk47.bold("Configuration:"));
|
|
15999
16203
|
if (Object.keys(config).length === 0) {
|
|
16000
|
-
output.log(` ${
|
|
16204
|
+
output.log(` ${chalk47.gray("(无配置,使用默认值)")}`);
|
|
16001
16205
|
} else {
|
|
16002
16206
|
const flatConfig = flattenConfig(config);
|
|
16003
16207
|
for (const [key, value] of flatConfig) {
|
|
16004
16208
|
const displayValue = formatValue(value);
|
|
16005
|
-
output.log(` ${
|
|
16209
|
+
output.log(` ${chalk47.cyan(key + ":")} ${displayValue}`);
|
|
16006
16210
|
}
|
|
16007
16211
|
}
|
|
16008
16212
|
output.log("");
|
|
16009
16213
|
}
|
|
16010
|
-
output.log(
|
|
16011
|
-
output.log(` ${
|
|
16214
|
+
output.log(chalk47.bold("Prompts:"));
|
|
16215
|
+
output.log(` ${chalk47.gray("- 内置: 5 个(default, coding, review, project-memory, global-memory)")}`);
|
|
16012
16216
|
const promptPaths = config?.promptPaths;
|
|
16013
16217
|
if (promptPaths && Array.isArray(promptPaths) && promptPaths.length > 0) {
|
|
16014
|
-
output.log(` ${
|
|
16218
|
+
output.log(` ${chalk47.gray("- 外部: " + promptPaths.length + " 个路径")}`);
|
|
16015
16219
|
for (const p of promptPaths) {
|
|
16016
|
-
output.log(` ${
|
|
16220
|
+
output.log(` ${chalk47.cyan(p.path)} ${chalk47.gray("(type: " + p.type + ")")}`);
|
|
16017
16221
|
}
|
|
16018
16222
|
} else {
|
|
16019
|
-
output.log(` ${
|
|
16223
|
+
output.log(` ${chalk47.gray("- 外部: 0 个(未配置 promptPaths)")}`);
|
|
16020
16224
|
}
|
|
16021
16225
|
output.log("");
|
|
16022
16226
|
const defaultName = config?.defaultName || "default";
|
|
16023
|
-
output.log(
|
|
16024
|
-
output.log(` ${
|
|
16227
|
+
output.log(chalk47.bold("Default Prompt:"));
|
|
16228
|
+
output.log(` ${chalk47.cyan("defaultName:")} ${defaultName}`);
|
|
16025
16229
|
output.log("");
|
|
16026
16230
|
const env = envService?.getEnvironment?.();
|
|
16027
16231
|
if (env) {
|
|
@@ -16036,10 +16240,10 @@ async function showPromptComponentConfig(output, configService, options, envServ
|
|
|
16036
16240
|
const stored = await store?.loadAll?.();
|
|
16037
16241
|
promptCount = Array.isArray(stored) ? stored.length : 0;
|
|
16038
16242
|
} catch {}
|
|
16039
|
-
output.log(
|
|
16040
|
-
output.log(` ${
|
|
16041
|
-
output.log(` ${
|
|
16042
|
-
output.log(` ${
|
|
16243
|
+
output.log(chalk47.bold("Prompt Storage Directory:"));
|
|
16244
|
+
output.log(` ${chalk47.cyan("path:")} ${configDir}`);
|
|
16245
|
+
output.log(` ${chalk47.cyan("exists:")} ${exists ? chalk47.green("yes") : chalk47.red("no")}`);
|
|
16246
|
+
output.log(` ${chalk47.cyan("prompts:")} ${promptCount} loaded`);
|
|
16043
16247
|
output.log("");
|
|
16044
16248
|
}
|
|
16045
16249
|
}
|
|
@@ -16065,19 +16269,19 @@ function flattenConfig(obj, prefix = "") {
|
|
|
16065
16269
|
}
|
|
16066
16270
|
function formatValue(value) {
|
|
16067
16271
|
if (value === undefined) {
|
|
16068
|
-
return
|
|
16272
|
+
return chalk47.gray("undefined");
|
|
16069
16273
|
}
|
|
16070
16274
|
if (value === null) {
|
|
16071
|
-
return
|
|
16275
|
+
return chalk47.gray("null");
|
|
16072
16276
|
}
|
|
16073
16277
|
if (typeof value === "object") {
|
|
16074
|
-
return
|
|
16278
|
+
return chalk47.gray(JSON.stringify(value));
|
|
16075
16279
|
}
|
|
16076
16280
|
return String(value);
|
|
16077
16281
|
}
|
|
16078
16282
|
|
|
16079
16283
|
// src/commands/config/export.ts
|
|
16080
|
-
import
|
|
16284
|
+
import chalk48 from "chalk";
|
|
16081
16285
|
var ConfigExportCommand = {
|
|
16082
16286
|
command: "export <component>",
|
|
16083
16287
|
describe: "导出组件配置到文件",
|
|
@@ -16122,7 +16326,7 @@ var ConfigExportCommand = {
|
|
|
16122
16326
|
output.log("");
|
|
16123
16327
|
output.log("Supported components:");
|
|
16124
16328
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
16125
|
-
output.log(` ${
|
|
16329
|
+
output.log(` ${chalk48.cyan(comp)}`);
|
|
16126
16330
|
}
|
|
16127
16331
|
process.exit(1);
|
|
16128
16332
|
}
|
|
@@ -16140,7 +16344,7 @@ var ConfigExportCommand = {
|
|
|
16140
16344
|
};
|
|
16141
16345
|
|
|
16142
16346
|
// src/commands/config/import.ts
|
|
16143
|
-
import
|
|
16347
|
+
import chalk49 from "chalk";
|
|
16144
16348
|
var ConfigImportCommand = {
|
|
16145
16349
|
command: "import <component>",
|
|
16146
16350
|
describe: "从文件导入配置到组件的 file source",
|
|
@@ -16190,7 +16394,7 @@ var ConfigImportCommand = {
|
|
|
16190
16394
|
output.log("");
|
|
16191
16395
|
output.log("Supported components:");
|
|
16192
16396
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
16193
|
-
output.log(` ${
|
|
16397
|
+
output.log(` ${chalk49.cyan(comp)}`);
|
|
16194
16398
|
}
|
|
16195
16399
|
process.exit(1);
|
|
16196
16400
|
}
|
|
@@ -16205,7 +16409,7 @@ var ConfigImportCommand = {
|
|
|
16205
16409
|
}
|
|
16206
16410
|
if (result.merged && result.changes.length > 0 && args.verbose) {
|
|
16207
16411
|
output.log("");
|
|
16208
|
-
output.log(
|
|
16412
|
+
output.log(chalk49.bold("变更详情:"));
|
|
16209
16413
|
for (const change of result.changes) {
|
|
16210
16414
|
output.log(` ${change.key}: ${JSON.stringify(change.oldValue)} → ${JSON.stringify(change.newValue)}`);
|
|
16211
16415
|
}
|
|
@@ -16229,7 +16433,7 @@ var ConfigCommand = {
|
|
|
16229
16433
|
};
|
|
16230
16434
|
|
|
16231
16435
|
// src/commands/mcp/list.ts
|
|
16232
|
-
import
|
|
16436
|
+
import chalk50 from "chalk";
|
|
16233
16437
|
var ListCommand6 = {
|
|
16234
16438
|
command: "list",
|
|
16235
16439
|
aliases: ["ls"],
|
|
@@ -16289,30 +16493,30 @@ var ListCommand6 = {
|
|
|
16289
16493
|
output.log(hint);
|
|
16290
16494
|
} else {
|
|
16291
16495
|
if (servers.length === 0) {
|
|
16292
|
-
output.log(
|
|
16496
|
+
output.log(chalk50.yellow("No MCP servers configured"));
|
|
16293
16497
|
return;
|
|
16294
16498
|
}
|
|
16295
16499
|
const statusColor = (status) => {
|
|
16296
16500
|
switch (status) {
|
|
16297
16501
|
case "connected":
|
|
16298
|
-
return
|
|
16502
|
+
return chalk50.green;
|
|
16299
16503
|
case "connecting":
|
|
16300
|
-
return
|
|
16504
|
+
return chalk50.yellow;
|
|
16301
16505
|
case "error":
|
|
16302
|
-
return
|
|
16506
|
+
return chalk50.red;
|
|
16303
16507
|
case "disconnected":
|
|
16304
|
-
return
|
|
16508
|
+
return chalk50.gray;
|
|
16305
16509
|
default:
|
|
16306
|
-
return
|
|
16510
|
+
return chalk50.white;
|
|
16307
16511
|
}
|
|
16308
16512
|
};
|
|
16309
16513
|
const header = [
|
|
16310
|
-
|
|
16311
|
-
|
|
16312
|
-
|
|
16514
|
+
chalk50.bold("Name"),
|
|
16515
|
+
chalk50.bold("Status"),
|
|
16516
|
+
chalk50.bold("Tools")
|
|
16313
16517
|
].join(" | ");
|
|
16314
16518
|
const rows = servers.map((s) => [
|
|
16315
|
-
|
|
16519
|
+
chalk50.cyan(s.name),
|
|
16316
16520
|
statusColor(s.status)(`[${s.status}]`),
|
|
16317
16521
|
s.toolsCount !== undefined ? String(s.toolsCount) : "-"
|
|
16318
16522
|
].join(" | "));
|
|
@@ -16343,7 +16547,7 @@ var ListCommand6 = {
|
|
|
16343
16547
|
};
|
|
16344
16548
|
|
|
16345
16549
|
// src/commands/mcp/tools.ts
|
|
16346
|
-
import
|
|
16550
|
+
import chalk51 from "chalk";
|
|
16347
16551
|
var ToolsCommand = {
|
|
16348
16552
|
command: "tools",
|
|
16349
16553
|
aliases: ["t"],
|
|
@@ -16396,7 +16600,7 @@ var ToolsCommand = {
|
|
|
16396
16600
|
tools.forEach((t) => output.log(t.name));
|
|
16397
16601
|
} else {
|
|
16398
16602
|
if (tools.length === 0) {
|
|
16399
|
-
output.log(
|
|
16603
|
+
output.log(chalk51.yellow("No MCP tools available"));
|
|
16400
16604
|
return;
|
|
16401
16605
|
}
|
|
16402
16606
|
const byServer = new Map;
|
|
@@ -16408,15 +16612,15 @@ var ToolsCommand = {
|
|
|
16408
16612
|
byServer.get(serverName).push(tool);
|
|
16409
16613
|
}
|
|
16410
16614
|
for (const [serverName, serverTools] of byServer) {
|
|
16411
|
-
output.log(
|
|
16615
|
+
output.log(chalk51.bold.cyan(`
|
|
16412
16616
|
[${serverName}] ${serverTools.length} tools`));
|
|
16413
16617
|
for (const tool of serverTools) {
|
|
16414
16618
|
const desc2 = tool.description.length > 80 ? tool.description.slice(0, 77) + "..." : tool.description;
|
|
16415
|
-
output.log(` ${
|
|
16416
|
-
output.log(` ${
|
|
16619
|
+
output.log(` ${chalk51.green("+")} ${chalk51.white(tool.name)}`);
|
|
16620
|
+
output.log(` ${chalk51.gray(desc2)}`);
|
|
16417
16621
|
}
|
|
16418
16622
|
}
|
|
16419
|
-
output.log(
|
|
16623
|
+
output.log(chalk51.gray(`
|
|
16420
16624
|
Total: ${tools.length} tools across ${byServer.size} servers`));
|
|
16421
16625
|
}
|
|
16422
16626
|
} catch (error) {
|
|
@@ -16429,7 +16633,7 @@ Total: ${tools.length} tools across ${byServer.size} servers`));
|
|
|
16429
16633
|
};
|
|
16430
16634
|
|
|
16431
16635
|
// src/commands/mcp/reload.ts
|
|
16432
|
-
import
|
|
16636
|
+
import chalk52 from "chalk";
|
|
16433
16637
|
var ReloadCommand2 = {
|
|
16434
16638
|
command: "reload",
|
|
16435
16639
|
aliases: ["r"],
|
|
@@ -16450,19 +16654,19 @@ var ReloadCommand2 = {
|
|
|
16450
16654
|
output.error("McpComponent not available");
|
|
16451
16655
|
process.exit(1);
|
|
16452
16656
|
}
|
|
16453
|
-
output.log(
|
|
16657
|
+
output.log(chalk52.cyan("Reloading MCP servers..."));
|
|
16454
16658
|
await mcpComponent.reload();
|
|
16455
16659
|
const servers = mcpComponent.listServers();
|
|
16456
16660
|
const connected = servers.filter((s) => s.status === "connected").length;
|
|
16457
16661
|
const errors = servers.filter((s) => s.status === "error").length;
|
|
16458
|
-
output.log(
|
|
16662
|
+
output.log(chalk52.green(`✓ Reloaded ${servers.length} servers`));
|
|
16459
16663
|
if (connected > 0) {
|
|
16460
|
-
output.log(
|
|
16664
|
+
output.log(chalk52.green(` • ${connected} connected`));
|
|
16461
16665
|
}
|
|
16462
16666
|
if (errors > 0) {
|
|
16463
16667
|
output.warn(` • ${errors} failed`);
|
|
16464
16668
|
for (const server of servers.filter((s) => s.status === "error")) {
|
|
16465
|
-
output.log(
|
|
16669
|
+
output.log(chalk52.gray(` - ${server.name}: ${server.error}`));
|
|
16466
16670
|
}
|
|
16467
16671
|
}
|
|
16468
16672
|
} catch (error) {
|
|
@@ -16483,7 +16687,7 @@ var McpCommand = {
|
|
|
16483
16687
|
};
|
|
16484
16688
|
|
|
16485
16689
|
// src/commands/tools/list.ts
|
|
16486
|
-
import
|
|
16690
|
+
import chalk53 from "chalk";
|
|
16487
16691
|
var ListCommand7 = {
|
|
16488
16692
|
command: "list",
|
|
16489
16693
|
aliases: ["ls"],
|
|
@@ -16542,16 +16746,16 @@ var ListCommand7 = {
|
|
|
16542
16746
|
output.log(hint);
|
|
16543
16747
|
} else {
|
|
16544
16748
|
const header = [
|
|
16545
|
-
|
|
16546
|
-
|
|
16547
|
-
|
|
16749
|
+
chalk53.bold("Name"),
|
|
16750
|
+
chalk53.bold("Description"),
|
|
16751
|
+
chalk53.bold("Category")
|
|
16548
16752
|
].join(" | ");
|
|
16549
16753
|
const rows = tools.map((t) => {
|
|
16550
16754
|
const desc2 = t.description.length > 40 ? t.description.slice(0, 37) + "..." : t.description;
|
|
16551
16755
|
return [
|
|
16552
|
-
|
|
16756
|
+
chalk53.cyan(t.name),
|
|
16553
16757
|
desc2,
|
|
16554
|
-
t.metadata?.category ?
|
|
16758
|
+
t.metadata?.category ? chalk53.gray(`[${t.metadata.category}]`) : "-"
|
|
16555
16759
|
].join(" | ");
|
|
16556
16760
|
});
|
|
16557
16761
|
output.log([
|
|
@@ -16581,7 +16785,7 @@ var ListCommand7 = {
|
|
|
16581
16785
|
};
|
|
16582
16786
|
|
|
16583
16787
|
// src/commands/tools/get.ts
|
|
16584
|
-
import
|
|
16788
|
+
import chalk54 from "chalk";
|
|
16585
16789
|
|
|
16586
16790
|
// src/commands/tools/shared/schema-helper.ts
|
|
16587
16791
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
@@ -16656,8 +16860,8 @@ var GetCommand6 = {
|
|
|
16656
16860
|
}))
|
|
16657
16861
|
});
|
|
16658
16862
|
} else {
|
|
16659
|
-
output.log(
|
|
16660
|
-
output.log(
|
|
16863
|
+
output.log(chalk54.bold.cyan(`Tool: ${tool.name}`));
|
|
16864
|
+
output.log(chalk54.gray("─".repeat(60)));
|
|
16661
16865
|
output.log(`Description: ${tool.description}`);
|
|
16662
16866
|
if (tool.metadata?.category) {
|
|
16663
16867
|
output.log(`Category: ${tool.metadata.category}`);
|
|
@@ -16666,9 +16870,9 @@ var GetCommand6 = {
|
|
|
16666
16870
|
output.log(`Tags: ${tool.metadata.tags.join(", ")}`);
|
|
16667
16871
|
}
|
|
16668
16872
|
output.log("");
|
|
16669
|
-
output.log(
|
|
16873
|
+
output.log(chalk54.bold("Parameters:"));
|
|
16670
16874
|
for (const param of params) {
|
|
16671
|
-
const required = param.required ?
|
|
16875
|
+
const required = param.required ? chalk54.red("(required)") : chalk54.gray("(optional)");
|
|
16672
16876
|
const defaultVal = param.default !== undefined ? ` [default: ${JSON.stringify(param.default)}]` : "";
|
|
16673
16877
|
output.log(` --${param.name} <${param.type}> ${required}`);
|
|
16674
16878
|
output.log(` ${param.description}${defaultVal}`);
|
|
@@ -16777,14 +16981,14 @@ var ToolsCommand2 = {
|
|
|
16777
16981
|
};
|
|
16778
16982
|
|
|
16779
16983
|
// src/commands/memory/record.ts
|
|
16780
|
-
import
|
|
16984
|
+
import chalk55 from "chalk";
|
|
16781
16985
|
import { createMemoryAgentTools, getBuiltInPrompt } from "@ai-setting/roy-agent-core";
|
|
16782
16986
|
import { bashTool, globTool, readFileTool } from "@ai-setting/roy-agent-core";
|
|
16783
16987
|
async function runExtractMode(output, memoryComponent, agentComponent, sessionComponent, env, options) {
|
|
16784
16988
|
const { scope, sessionId, require: userRequirement } = options;
|
|
16785
|
-
output.log(
|
|
16989
|
+
output.log(chalk55.blue(`
|
|
16786
16990
|
\uD83D\uDD0D Memory Extract Mode (${scope})`));
|
|
16787
|
-
output.log(
|
|
16991
|
+
output.log(chalk55.gray(`正在分析会话历史,生成记忆...
|
|
16788
16992
|
`));
|
|
16789
16993
|
try {
|
|
16790
16994
|
const currentMemory = await memoryComponent.recallMemory(scope) || "(无现有记忆)";
|
|
@@ -16830,13 +17034,13 @@ async function runExtractMode(output, memoryComponent, agentComponent, sessionCo
|
|
|
16830
17034
|
for (const tool of agentTools) {
|
|
16831
17035
|
try {
|
|
16832
17036
|
toolComponent.register(tool);
|
|
16833
|
-
output.log(
|
|
17037
|
+
output.log(chalk55.gray(`Tool registered: ${tool.name}`));
|
|
16834
17038
|
} catch (err) {
|
|
16835
|
-
output.log(
|
|
17039
|
+
output.log(chalk55.gray(`Tool already registered: ${tool.name}`));
|
|
16836
17040
|
}
|
|
16837
17041
|
}
|
|
16838
17042
|
}
|
|
16839
|
-
output.log(
|
|
17043
|
+
output.log(chalk55.gray(`Agent "${agentName}" registered with ${agentTools.length} tools`));
|
|
16840
17044
|
const query = `请分析会话历史,提炼${scope === "project" ? "项目" : "全局"}记忆并写入记忆文件。`;
|
|
16841
17045
|
let result;
|
|
16842
17046
|
try {
|
|
@@ -16850,12 +17054,12 @@ async function runExtractMode(output, memoryComponent, agentComponent, sessionCo
|
|
|
16850
17054
|
if (result && result.startsWith("执行失败")) {
|
|
16851
17055
|
output.error(`提取失败: ${result}`);
|
|
16852
17056
|
} else if (result) {
|
|
16853
|
-
output.log(
|
|
17057
|
+
output.log(chalk55.green(`
|
|
16854
17058
|
✅ 记忆提取完成`));
|
|
16855
|
-
output.log(
|
|
17059
|
+
output.log(chalk55.gray(`记忆已保存到 memory 文件。
|
|
16856
17060
|
`));
|
|
16857
17061
|
if (result.length > 0 && result !== "✅ 记忆提取完成") {
|
|
16858
|
-
output.log(
|
|
17062
|
+
output.log(chalk55.gray(`执行摘要: ${result.substring(0, 200)}${result.length > 200 ? "..." : ""}`));
|
|
16859
17063
|
}
|
|
16860
17064
|
}
|
|
16861
17065
|
agentComponent.unregisterAgent(agentName);
|
|
@@ -16973,11 +17177,11 @@ var RecordCommand = {
|
|
|
16973
17177
|
prepend: "已插入内容到记忆文件开头",
|
|
16974
17178
|
delete: "已删除记忆文件"
|
|
16975
17179
|
};
|
|
16976
|
-
output.log(
|
|
16977
|
-
output.log(
|
|
17180
|
+
output.log(chalk55.green(`✓ ${actionMessages[result.action]}`));
|
|
17181
|
+
output.log(chalk55.gray(`路径: ${result.path}`));
|
|
16978
17182
|
if (result.action !== "delete" && a.content) {
|
|
16979
17183
|
const preview = a.content.substring(0, 100);
|
|
16980
|
-
output.log(
|
|
17184
|
+
output.log(chalk55.gray(`内容预览: ${preview}${a.content.length > 100 ? "..." : ""}`));
|
|
16981
17185
|
}
|
|
16982
17186
|
} catch (error) {
|
|
16983
17187
|
output.error(`Failed to record memory: ${error}`);
|
|
@@ -16989,7 +17193,7 @@ var RecordCommand = {
|
|
|
16989
17193
|
};
|
|
16990
17194
|
|
|
16991
17195
|
// src/commands/memory/recall.ts
|
|
16992
|
-
import
|
|
17196
|
+
import chalk56 from "chalk";
|
|
16993
17197
|
var RecallCommand = {
|
|
16994
17198
|
command: "recall",
|
|
16995
17199
|
aliases: ["load"],
|
|
@@ -17025,7 +17229,7 @@ var RecallCommand = {
|
|
|
17025
17229
|
}
|
|
17026
17230
|
const content = await memoryComponent.recallMemory(a.scope);
|
|
17027
17231
|
if (!content) {
|
|
17028
|
-
output.log(
|
|
17232
|
+
output.log(chalk56.gray("(No memory files found)"));
|
|
17029
17233
|
return;
|
|
17030
17234
|
}
|
|
17031
17235
|
if (a.json) {
|
|
@@ -17051,7 +17255,7 @@ var MemoryCommand = {
|
|
|
17051
17255
|
handler: () => {}
|
|
17052
17256
|
};
|
|
17053
17257
|
// src/commands/eventsource/list.ts
|
|
17054
|
-
import
|
|
17258
|
+
import chalk57 from "chalk";
|
|
17055
17259
|
function truncateVisual2(str, maxWidth) {
|
|
17056
17260
|
let result = "";
|
|
17057
17261
|
let width = 0;
|
|
@@ -17066,7 +17270,7 @@ function truncateVisual2(str, maxWidth) {
|
|
|
17066
17270
|
}
|
|
17067
17271
|
function formatSourcesTable(sources) {
|
|
17068
17272
|
if (sources.length === 0) {
|
|
17069
|
-
return
|
|
17273
|
+
return chalk57.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加");
|
|
17070
17274
|
}
|
|
17071
17275
|
const ID_WIDTH = 10;
|
|
17072
17276
|
const NAME_WIDTH = 20;
|
|
@@ -17075,11 +17279,11 @@ function formatSourcesTable(sources) {
|
|
|
17075
17279
|
const ENABLED_WIDTH = 8;
|
|
17076
17280
|
const GAP = " ";
|
|
17077
17281
|
const headerLine = [
|
|
17078
|
-
|
|
17079
|
-
|
|
17080
|
-
|
|
17081
|
-
|
|
17082
|
-
|
|
17282
|
+
chalk57.bold("ID".padEnd(ID_WIDTH)),
|
|
17283
|
+
chalk57.bold("NAME".padEnd(NAME_WIDTH)),
|
|
17284
|
+
chalk57.bold("TYPE".padEnd(TYPE_WIDTH)),
|
|
17285
|
+
chalk57.bold("STATUS".padEnd(STATUS_WIDTH)),
|
|
17286
|
+
chalk57.bold("ENABLED".padEnd(ENABLED_WIDTH))
|
|
17083
17287
|
].join(GAP);
|
|
17084
17288
|
const sepLine = "─".repeat(ID_WIDTH + NAME_WIDTH + TYPE_WIDTH + STATUS_WIDTH + ENABLED_WIDTH + GAP.length * 4);
|
|
17085
17289
|
const formatRow = (src) => {
|
|
@@ -17137,7 +17341,7 @@ var EventSourceListCommand = {
|
|
|
17137
17341
|
sources: []
|
|
17138
17342
|
});
|
|
17139
17343
|
} else {
|
|
17140
|
-
output.log(
|
|
17344
|
+
output.log(chalk57.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加"));
|
|
17141
17345
|
}
|
|
17142
17346
|
return;
|
|
17143
17347
|
}
|
|
@@ -17172,21 +17376,21 @@ var EventSourceListCommand = {
|
|
|
17172
17376
|
const rows = sources.map((s) => {
|
|
17173
17377
|
const status = esComponent.getStatus(s.id) || "unknown";
|
|
17174
17378
|
const statusColorMap = {
|
|
17175
|
-
running:
|
|
17176
|
-
stopped:
|
|
17177
|
-
error:
|
|
17178
|
-
starting:
|
|
17179
|
-
created:
|
|
17180
|
-
stopping:
|
|
17181
|
-
unknown:
|
|
17379
|
+
running: chalk57.green,
|
|
17380
|
+
stopped: chalk57.gray,
|
|
17381
|
+
error: chalk57.red,
|
|
17382
|
+
starting: chalk57.yellow,
|
|
17383
|
+
created: chalk57.gray,
|
|
17384
|
+
stopping: chalk57.yellow,
|
|
17385
|
+
unknown: chalk57.gray
|
|
17182
17386
|
};
|
|
17183
|
-
const statusColor = statusColorMap[status] ||
|
|
17387
|
+
const statusColor = statusColorMap[status] || chalk57.gray;
|
|
17184
17388
|
return {
|
|
17185
17389
|
id: s.id.substring(0, 8),
|
|
17186
17390
|
name: s.name,
|
|
17187
17391
|
type: s.type,
|
|
17188
17392
|
status: statusColor(status),
|
|
17189
|
-
enabled: s.enabled ?
|
|
17393
|
+
enabled: s.enabled ? chalk57.green("✓") : chalk57.gray("✗")
|
|
17190
17394
|
};
|
|
17191
17395
|
});
|
|
17192
17396
|
output.log(formatSourcesTable(rows));
|
|
@@ -17208,11 +17412,11 @@ var EventSourceListCommand = {
|
|
|
17208
17412
|
};
|
|
17209
17413
|
|
|
17210
17414
|
// src/commands/eventsource/add.ts
|
|
17211
|
-
import
|
|
17415
|
+
import chalk59 from "chalk";
|
|
17212
17416
|
import { generateId } from "@ai-setting/roy-agent-core";
|
|
17213
17417
|
|
|
17214
17418
|
// src/commands/eventsource/server-url-option.ts
|
|
17215
|
-
import
|
|
17419
|
+
import chalk58 from "chalk";
|
|
17216
17420
|
function addServerUrlOption(yargs) {
|
|
17217
17421
|
return yargs.option("server-url", {
|
|
17218
17422
|
alias: "s",
|
|
@@ -17228,7 +17432,7 @@ function resolveServerUrl(serverUrl, fallback) {
|
|
|
17228
17432
|
return fallback;
|
|
17229
17433
|
const trimmed = serverUrl.replace(/\/+$/, "");
|
|
17230
17434
|
if (!/^(https?|wss?):\/\//.test(trimmed)) {
|
|
17231
|
-
console.error(
|
|
17435
|
+
console.error(chalk58.red(`
|
|
17232
17436
|
✗ Invalid --server-url: "${serverUrl}". Must start with http://, https://, ws://, or wss://
|
|
17233
17437
|
`));
|
|
17234
17438
|
process.exit(1);
|
|
@@ -17321,39 +17525,39 @@ var EventSourceAddCommand = {
|
|
|
17321
17525
|
options: a.prompt ? { prompt: a.prompt } : undefined
|
|
17322
17526
|
};
|
|
17323
17527
|
esComponent.register(config);
|
|
17324
|
-
output.success(
|
|
17528
|
+
output.success(chalk59.green(`事件源 '${a.name}' 添加成功!`));
|
|
17325
17529
|
output.log("");
|
|
17326
|
-
output.log(` ID: ${
|
|
17327
|
-
output.log(` Type: ${
|
|
17530
|
+
output.log(` ID: ${chalk59.gray(config.id)}`);
|
|
17531
|
+
output.log(` Type: ${chalk59.cyan(a.type)}`);
|
|
17328
17532
|
if (eventTypes?.length) {
|
|
17329
|
-
output.log(` Event Types: ${
|
|
17533
|
+
output.log(` Event Types: ${chalk59.gray(eventTypes.join(", "))}`);
|
|
17330
17534
|
}
|
|
17331
17535
|
if (a.command) {
|
|
17332
|
-
output.log(` Command: ${
|
|
17536
|
+
output.log(` Command: ${chalk59.gray(a.command)}`);
|
|
17333
17537
|
}
|
|
17334
17538
|
if (a.interval) {
|
|
17335
|
-
output.log(` Interval: ${
|
|
17539
|
+
output.log(` Interval: ${chalk59.gray(`${a.interval}ms`)}`);
|
|
17336
17540
|
}
|
|
17337
17541
|
if (a.profile) {
|
|
17338
|
-
output.log(` Profile: ${
|
|
17542
|
+
output.log(` Profile: ${chalk59.gray(a.profile)}`);
|
|
17339
17543
|
}
|
|
17340
17544
|
if (a.address) {
|
|
17341
|
-
output.log(` Address: ${
|
|
17545
|
+
output.log(` Address: ${chalk59.gray(a.address)}`);
|
|
17342
17546
|
}
|
|
17343
17547
|
if (a.imServerUrl) {
|
|
17344
|
-
output.log(` IM Server URL: ${
|
|
17548
|
+
output.log(` IM Server URL: ${chalk59.gray(a.imServerUrl)}`);
|
|
17345
17549
|
}
|
|
17346
17550
|
if (resolvedServerUrl) {
|
|
17347
|
-
output.log(` Server URL: ${
|
|
17551
|
+
output.log(` Server URL: ${chalk59.gray(resolvedServerUrl)}`);
|
|
17348
17552
|
}
|
|
17349
17553
|
if (a.tlsSkipVerify) {
|
|
17350
|
-
output.log(` TLS Skip Verify: ${
|
|
17554
|
+
output.log(` TLS Skip Verify: ${chalk59.yellow("⚠ true (自签名场景)")}`);
|
|
17351
17555
|
}
|
|
17352
17556
|
if (a.prompt) {
|
|
17353
|
-
output.log(` Prompt: ${
|
|
17557
|
+
output.log(` Prompt: ${chalk59.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
|
|
17354
17558
|
}
|
|
17355
17559
|
output.log("");
|
|
17356
|
-
output.log(
|
|
17560
|
+
output.log(chalk59.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
|
|
17357
17561
|
} finally {
|
|
17358
17562
|
await envService.dispose();
|
|
17359
17563
|
}
|
|
@@ -17361,7 +17565,7 @@ var EventSourceAddCommand = {
|
|
|
17361
17565
|
};
|
|
17362
17566
|
|
|
17363
17567
|
// src/commands/eventsource/update.ts
|
|
17364
|
-
import
|
|
17568
|
+
import chalk60 from "chalk";
|
|
17365
17569
|
function findSource(esComponent, id) {
|
|
17366
17570
|
const sources = esComponent.list();
|
|
17367
17571
|
const matched = sources.find((s) => s.id === id || s.id.startsWith(id));
|
|
@@ -17433,7 +17637,7 @@ var EventSourceUpdateCommand = {
|
|
|
17433
17637
|
const all = esComponent.list();
|
|
17434
17638
|
if (all.length > 0) {
|
|
17435
17639
|
output.info("");
|
|
17436
|
-
output.info(
|
|
17640
|
+
output.info(chalk60.gray("可用的事件源:"));
|
|
17437
17641
|
for (const s of all) {
|
|
17438
17642
|
output.info(` - ${s.id.substring(0, 8)}: ${s.name} (${s.type})`);
|
|
17439
17643
|
}
|
|
@@ -17475,19 +17679,19 @@ var EventSourceUpdateCommand = {
|
|
|
17475
17679
|
}
|
|
17476
17680
|
try {
|
|
17477
17681
|
const result = await esComponent.update(match.fullId, partial);
|
|
17478
|
-
output.success(
|
|
17682
|
+
output.success(chalk60.green(`✅ 事件源已更新: ${match.source.name}`));
|
|
17479
17683
|
output.log("");
|
|
17480
|
-
output.log(
|
|
17684
|
+
output.log(chalk60.bold("修改字段:"));
|
|
17481
17685
|
const before = match.source;
|
|
17482
17686
|
const after = result.updated;
|
|
17483
17687
|
for (const field of result.fields) {
|
|
17484
17688
|
const beforeVal = JSON.stringify(before[field] ?? before.options?.[field]);
|
|
17485
17689
|
const afterVal = JSON.stringify(after[field] ?? after.options?.[field]);
|
|
17486
|
-
output.log(` ${
|
|
17690
|
+
output.log(` ${chalk60.cyan(field)}: ${chalk60.gray(beforeVal)} ${chalk60.gray("→")} ${chalk60.green(afterVal)}`);
|
|
17487
17691
|
}
|
|
17488
17692
|
output.log("");
|
|
17489
17693
|
if (result.wasRunning) {
|
|
17490
|
-
output.info(
|
|
17694
|
+
output.info(chalk60.yellow(`⚠️ 事件源在更新前正在运行,已自动停止。请使用 'roy-agent eventsource start ${match.fullId.substring(0, 8)}' 手动启动以应用新配置。`));
|
|
17491
17695
|
}
|
|
17492
17696
|
} catch (error) {
|
|
17493
17697
|
output.error(`❌ 更新失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -17500,7 +17704,7 @@ var EventSourceUpdateCommand = {
|
|
|
17500
17704
|
};
|
|
17501
17705
|
|
|
17502
17706
|
// src/commands/eventsource/remove.ts
|
|
17503
|
-
import
|
|
17707
|
+
import chalk61 from "chalk";
|
|
17504
17708
|
var EventSourceRemoveCommand = {
|
|
17505
17709
|
command: "remove <id>",
|
|
17506
17710
|
aliases: ["rm"],
|
|
@@ -17539,7 +17743,7 @@ var EventSourceRemoveCommand = {
|
|
|
17539
17743
|
const status = esComponent.getStatus(matchedSource.id);
|
|
17540
17744
|
if (status === "running" && !args.force) {
|
|
17541
17745
|
output.error(`事件源正在运行中,请先停止: ${matchedSource.name} (${status})`);
|
|
17542
|
-
output.log(
|
|
17746
|
+
output.log(chalk61.gray(`使用 --force 强制移除或 'roy-agent eventsource stop ${matchedSource.id.substring(0, 8)}' 先停止`));
|
|
17543
17747
|
process.exit(1);
|
|
17544
17748
|
}
|
|
17545
17749
|
if (status === "running") {
|
|
@@ -17548,7 +17752,7 @@ var EventSourceRemoveCommand = {
|
|
|
17548
17752
|
}
|
|
17549
17753
|
const result = esComponent.unregister(matchedSource.id);
|
|
17550
17754
|
if (result) {
|
|
17551
|
-
output.success(
|
|
17755
|
+
output.success(chalk61.green(`事件源已移除: ${matchedSource.name}`));
|
|
17552
17756
|
} else {
|
|
17553
17757
|
output.error("移除失败");
|
|
17554
17758
|
process.exit(1);
|
|
@@ -17560,7 +17764,7 @@ var EventSourceRemoveCommand = {
|
|
|
17560
17764
|
};
|
|
17561
17765
|
|
|
17562
17766
|
// src/commands/eventsource/start.ts
|
|
17563
|
-
import
|
|
17767
|
+
import chalk62 from "chalk";
|
|
17564
17768
|
var EventSourceStartCommand = {
|
|
17565
17769
|
command: "start <id>",
|
|
17566
17770
|
describe: "启动指定的事件源",
|
|
@@ -17597,15 +17801,15 @@ var EventSourceStartCommand = {
|
|
|
17597
17801
|
}
|
|
17598
17802
|
const status = esComponent.getStatus(matchedSource.id);
|
|
17599
17803
|
if (status === "running") {
|
|
17600
|
-
output.log(
|
|
17804
|
+
output.log(chalk62.yellow(`事件源已在运行: ${matchedSource.name}`));
|
|
17601
17805
|
return;
|
|
17602
17806
|
}
|
|
17603
17807
|
output.info(`正在启动事件源 '${matchedSource.name}'...`);
|
|
17604
17808
|
try {
|
|
17605
17809
|
await esComponent.startSource(matchedSource.id);
|
|
17606
|
-
output.success(
|
|
17810
|
+
output.success(chalk62.green(`事件源已启动: ${matchedSource.name}`));
|
|
17607
17811
|
if (!args.background) {
|
|
17608
|
-
output.log(
|
|
17812
|
+
output.log(chalk62.gray("按 Ctrl+C 停止..."));
|
|
17609
17813
|
await new Promise((resolve) => {
|
|
17610
17814
|
const cleanup = () => {
|
|
17611
17815
|
process.removeListener("SIGINT", cleanup);
|
|
@@ -17627,7 +17831,7 @@ var EventSourceStartCommand = {
|
|
|
17627
17831
|
};
|
|
17628
17832
|
|
|
17629
17833
|
// src/commands/eventsource/stop.ts
|
|
17630
|
-
import
|
|
17834
|
+
import chalk63 from "chalk";
|
|
17631
17835
|
var EventSourceStopCommand = {
|
|
17632
17836
|
command: "stop <id>",
|
|
17633
17837
|
aliases: ["kill"],
|
|
@@ -17665,13 +17869,13 @@ var EventSourceStopCommand = {
|
|
|
17665
17869
|
}
|
|
17666
17870
|
const status = esComponent.getStatus(matchedSource.id);
|
|
17667
17871
|
if (status !== "running") {
|
|
17668
|
-
output.log(
|
|
17872
|
+
output.log(chalk63.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
|
|
17669
17873
|
return;
|
|
17670
17874
|
}
|
|
17671
17875
|
output.info(`正在停止事件源 '${matchedSource.name}'...`);
|
|
17672
17876
|
try {
|
|
17673
17877
|
await esComponent.stopSource(matchedSource.id);
|
|
17674
|
-
output.success(
|
|
17878
|
+
output.success(chalk63.green(`事件源已停止: ${matchedSource.name}`));
|
|
17675
17879
|
} catch (error) {
|
|
17676
17880
|
output.error(`停止失败: ${error}`);
|
|
17677
17881
|
process.exit(1);
|
|
@@ -17683,14 +17887,14 @@ var EventSourceStopCommand = {
|
|
|
17683
17887
|
};
|
|
17684
17888
|
|
|
17685
17889
|
// src/commands/eventsource/status.ts
|
|
17686
|
-
import
|
|
17890
|
+
import chalk64 from "chalk";
|
|
17687
17891
|
var STATUS_COLORS = {
|
|
17688
|
-
created:
|
|
17689
|
-
starting:
|
|
17690
|
-
running:
|
|
17691
|
-
stopping:
|
|
17692
|
-
stopped:
|
|
17693
|
-
error:
|
|
17892
|
+
created: chalk64.gray,
|
|
17893
|
+
starting: chalk64.yellow,
|
|
17894
|
+
running: chalk64.green,
|
|
17895
|
+
stopping: chalk64.yellow,
|
|
17896
|
+
stopped: chalk64.gray,
|
|
17897
|
+
error: chalk64.red
|
|
17694
17898
|
};
|
|
17695
17899
|
var STATUS_ICONS = {
|
|
17696
17900
|
created: "○",
|
|
@@ -17744,7 +17948,7 @@ var EventSourceStatusCommand = {
|
|
|
17744
17948
|
process.exit(1);
|
|
17745
17949
|
}
|
|
17746
17950
|
const status = esComponent.getStatus(matchedSource.id) || "unknown";
|
|
17747
|
-
const statusColor = STATUS_COLORS[status] ||
|
|
17951
|
+
const statusColor = STATUS_COLORS[status] || chalk64.gray;
|
|
17748
17952
|
if (args.json) {
|
|
17749
17953
|
output.json({
|
|
17750
17954
|
id: matchedSource.id,
|
|
@@ -17761,31 +17965,31 @@ var EventSourceStatusCommand = {
|
|
|
17761
17965
|
});
|
|
17762
17966
|
return;
|
|
17763
17967
|
}
|
|
17764
|
-
output.log(
|
|
17968
|
+
output.log(chalk64.bold("事件源详情"));
|
|
17765
17969
|
output.log("─".repeat(50));
|
|
17766
|
-
output.log(` ID: ${
|
|
17767
|
-
output.log(` Name: ${
|
|
17768
|
-
output.log(` Type: ${
|
|
17970
|
+
output.log(` ID: ${chalk64.gray(matchedSource.id)}`);
|
|
17971
|
+
output.log(` Name: ${chalk64.cyan(matchedSource.name)}`);
|
|
17972
|
+
output.log(` Type: ${chalk64.cyan(matchedSource.type)}`);
|
|
17769
17973
|
output.log(` Status: ${statusColor(`${STATUS_ICONS[status]} ${STATUS_LABELS[status]}`)}`);
|
|
17770
|
-
output.log(` Enabled: ${matchedSource.enabled ?
|
|
17974
|
+
output.log(` Enabled: ${matchedSource.enabled ? chalk64.green("是") : chalk64.gray("否")}`);
|
|
17771
17975
|
if (matchedSource.eventTypes?.length) {
|
|
17772
|
-
output.log(` Events: ${
|
|
17976
|
+
output.log(` Events: ${chalk64.gray(matchedSource.eventTypes.join(", "))}`);
|
|
17773
17977
|
}
|
|
17774
17978
|
if (matchedSource.command) {
|
|
17775
|
-
output.log(` Command: ${
|
|
17979
|
+
output.log(` Command: ${chalk64.gray(matchedSource.command)}`);
|
|
17776
17980
|
}
|
|
17777
17981
|
if (matchedSource.interval) {
|
|
17778
|
-
output.log(` Interval: ${
|
|
17982
|
+
output.log(` Interval: ${chalk64.gray(`${matchedSource.interval}ms`)}`);
|
|
17779
17983
|
}
|
|
17780
17984
|
if (matchedSource.url) {
|
|
17781
|
-
output.log(` URL: ${
|
|
17985
|
+
output.log(` URL: ${chalk64.gray(matchedSource.url)}`);
|
|
17782
17986
|
}
|
|
17783
17987
|
output.log("");
|
|
17784
17988
|
return;
|
|
17785
17989
|
}
|
|
17786
17990
|
const sources = esComponent.list();
|
|
17787
17991
|
if (sources.length === 0) {
|
|
17788
|
-
output.log(
|
|
17992
|
+
output.log(chalk64.yellow("没有配置的事件源"));
|
|
17789
17993
|
return;
|
|
17790
17994
|
}
|
|
17791
17995
|
if (args.json) {
|
|
@@ -17799,21 +18003,21 @@ var EventSourceStatusCommand = {
|
|
|
17799
18003
|
output.json({ sources: sourcesWithStatus, count: sources.length });
|
|
17800
18004
|
return;
|
|
17801
18005
|
}
|
|
17802
|
-
output.log(
|
|
18006
|
+
output.log(chalk64.bold("事件源状态概览"));
|
|
17803
18007
|
output.log("─".repeat(60));
|
|
17804
18008
|
for (const source of sources) {
|
|
17805
18009
|
const status = esComponent.getStatus(source.id) || "unknown";
|
|
17806
|
-
const statusColor = STATUS_COLORS[status] ||
|
|
18010
|
+
const statusColor = STATUS_COLORS[status] || chalk64.gray;
|
|
17807
18011
|
const icon = STATUS_ICONS[status] || "?";
|
|
17808
18012
|
const label = STATUS_LABELS[status] || status;
|
|
17809
18013
|
output.log("");
|
|
17810
|
-
output.log(` ${
|
|
18014
|
+
output.log(` ${chalk64.cyan(source.name)} ${chalk64.gray(`(${source.type})`)}`);
|
|
17811
18015
|
output.log(` └─ Status: ${statusColor(`${icon} ${label}`)}`);
|
|
17812
|
-
output.log(` ID: ${
|
|
18016
|
+
output.log(` ID: ${chalk64.gray(source.id.substring(0, 8))}...`);
|
|
17813
18017
|
}
|
|
17814
18018
|
output.log("");
|
|
17815
18019
|
const runningCount = sources.filter((s) => esComponent.getStatus(s.id) === "running").length;
|
|
17816
|
-
output.log(
|
|
18020
|
+
output.log(chalk64.green(`✅ ${runningCount}/${sources.length} 运行中`));
|
|
17817
18021
|
} finally {
|
|
17818
18022
|
await envService.dispose();
|
|
17819
18023
|
}
|
|
@@ -18126,7 +18330,7 @@ var DebugCommand = {
|
|
|
18126
18330
|
};
|
|
18127
18331
|
|
|
18128
18332
|
// src/commands/workflow/renderers.ts
|
|
18129
|
-
import
|
|
18333
|
+
import chalk65 from "chalk";
|
|
18130
18334
|
function truncateVisual3(str, maxWidth) {
|
|
18131
18335
|
if (!str)
|
|
18132
18336
|
return "-";
|
|
@@ -18161,18 +18365,18 @@ function formatDuration(ms) {
|
|
|
18161
18365
|
function statusColor(status) {
|
|
18162
18366
|
switch (status) {
|
|
18163
18367
|
case "completed":
|
|
18164
|
-
return
|
|
18368
|
+
return chalk65.green;
|
|
18165
18369
|
case "running":
|
|
18166
18370
|
case "idle":
|
|
18167
|
-
return
|
|
18371
|
+
return chalk65.blue;
|
|
18168
18372
|
case "paused":
|
|
18169
|
-
return
|
|
18373
|
+
return chalk65.yellow;
|
|
18170
18374
|
case "failed":
|
|
18171
|
-
return
|
|
18375
|
+
return chalk65.red;
|
|
18172
18376
|
case "stopped":
|
|
18173
|
-
return
|
|
18377
|
+
return chalk65.gray;
|
|
18174
18378
|
default:
|
|
18175
|
-
return
|
|
18379
|
+
return chalk65.white;
|
|
18176
18380
|
}
|
|
18177
18381
|
}
|
|
18178
18382
|
function renderWorkflowList(workflows, options) {
|
|
@@ -18191,7 +18395,7 @@ function renderWorkflowList(workflows, options) {
|
|
|
18191
18395
|
}, null, 2);
|
|
18192
18396
|
}
|
|
18193
18397
|
if (workflows.length === 0) {
|
|
18194
|
-
return
|
|
18398
|
+
return chalk65.yellow("No workflows found");
|
|
18195
18399
|
}
|
|
18196
18400
|
const NAME_WIDTH = 30;
|
|
18197
18401
|
const VERSION_WIDTH = 10;
|
|
@@ -18199,10 +18403,10 @@ function renderWorkflowList(workflows, options) {
|
|
|
18199
18403
|
const UPDATED_WIDTH = 20;
|
|
18200
18404
|
const GAP = " ";
|
|
18201
18405
|
const headerLine = [
|
|
18202
|
-
|
|
18203
|
-
|
|
18204
|
-
|
|
18205
|
-
|
|
18406
|
+
chalk65.bold("NAME".padEnd(NAME_WIDTH)),
|
|
18407
|
+
chalk65.bold("VER".padEnd(VERSION_WIDTH)),
|
|
18408
|
+
chalk65.bold("TAGS".padEnd(TAGS_WIDTH)),
|
|
18409
|
+
chalk65.bold("UPDATED")
|
|
18206
18410
|
].join(GAP);
|
|
18207
18411
|
const sepLine = "─".repeat(NAME_WIDTH + VERSION_WIDTH + TAGS_WIDTH + UPDATED_WIDTH + GAP.length * 3);
|
|
18208
18412
|
const rows = workflows.map((w) => {
|
|
@@ -18217,18 +18421,18 @@ function renderWorkflowList(workflows, options) {
|
|
|
18217
18421
|
}
|
|
18218
18422
|
function renderWorkflowDetail(workflow, options) {
|
|
18219
18423
|
const lines = [];
|
|
18220
|
-
lines.push(
|
|
18424
|
+
lines.push(chalk65.bold(`
|
|
18221
18425
|
\uD83D\uDCCB Workflow Details
|
|
18222
18426
|
`));
|
|
18223
|
-
lines.push(` ${
|
|
18224
|
-
lines.push(` ${
|
|
18225
|
-
lines.push(` ${
|
|
18226
|
-
lines.push(` ${
|
|
18227
|
-
lines.push(` ${
|
|
18228
|
-
lines.push(` ${
|
|
18229
|
-
lines.push(` ${
|
|
18427
|
+
lines.push(` ${chalk65.cyan("ID:")} ${workflow.id}`);
|
|
18428
|
+
lines.push(` ${chalk65.cyan("Name:")} ${workflow.name}`);
|
|
18429
|
+
lines.push(` ${chalk65.cyan("Version:")} ${workflow.version}`);
|
|
18430
|
+
lines.push(` ${chalk65.cyan("Description:")} ${workflow.description || "-"}`);
|
|
18431
|
+
lines.push(` ${chalk65.cyan("Tags:")} ${workflow.tags.join(", ") || "-"}`);
|
|
18432
|
+
lines.push(` ${chalk65.cyan("Created:")} ${formatDate(workflow.createdAt)}`);
|
|
18433
|
+
lines.push(` ${chalk65.cyan("Updated:")} ${formatDate(workflow.updatedAt)}`);
|
|
18230
18434
|
const nodeCount = workflow.definition.nodes.length;
|
|
18231
|
-
lines.push(
|
|
18435
|
+
lines.push(chalk65.bold(`
|
|
18232
18436
|
\uD83D\uDCCA Nodes Summary
|
|
18233
18437
|
`));
|
|
18234
18438
|
lines.push(` Total: ${nodeCount} nodes`);
|
|
@@ -18240,7 +18444,7 @@ function renderWorkflowDetail(workflow, options) {
|
|
|
18240
18444
|
lines.push(` - ${type}: ${count}`);
|
|
18241
18445
|
}
|
|
18242
18446
|
if (workflow.definition.config) {
|
|
18243
|
-
lines.push(
|
|
18447
|
+
lines.push(chalk65.bold(`
|
|
18244
18448
|
⚙️ Configuration
|
|
18245
18449
|
`));
|
|
18246
18450
|
if (workflow.definition.config.parallel_limit !== undefined) {
|
|
@@ -18254,7 +18458,7 @@ function renderWorkflowDetail(workflow, options) {
|
|
|
18254
18458
|
}
|
|
18255
18459
|
}
|
|
18256
18460
|
if (options?.includeRuns && options.includeRuns.length > 0) {
|
|
18257
|
-
lines.push(
|
|
18461
|
+
lines.push(chalk65.bold(`
|
|
18258
18462
|
\uD83D\uDCDC Recent Runs
|
|
18259
18463
|
`));
|
|
18260
18464
|
lines.push(renderRunsList(options.includeRuns.slice(0, 5)));
|
|
@@ -18278,7 +18482,7 @@ function renderRunsList(runs, options) {
|
|
|
18278
18482
|
}, null, 2);
|
|
18279
18483
|
}
|
|
18280
18484
|
if (runs.length === 0) {
|
|
18281
|
-
return
|
|
18485
|
+
return chalk65.yellow("No runs found");
|
|
18282
18486
|
}
|
|
18283
18487
|
const ID_WIDTH = 20;
|
|
18284
18488
|
const STATUS_WIDTH = 12;
|
|
@@ -18286,10 +18490,10 @@ function renderRunsList(runs, options) {
|
|
|
18286
18490
|
const UPDATED_WIDTH = 20;
|
|
18287
18491
|
const GAP = " ";
|
|
18288
18492
|
const headerLine = [
|
|
18289
|
-
|
|
18290
|
-
|
|
18291
|
-
|
|
18292
|
-
|
|
18493
|
+
chalk65.bold("RUN ID".padEnd(ID_WIDTH)),
|
|
18494
|
+
chalk65.bold("STATUS".padEnd(STATUS_WIDTH)),
|
|
18495
|
+
chalk65.bold("DURATION".padEnd(DURATION_WIDTH)),
|
|
18496
|
+
chalk65.bold("STARTED")
|
|
18293
18497
|
].join(GAP);
|
|
18294
18498
|
const sepLine = "─".repeat(ID_WIDTH + STATUS_WIDTH + DURATION_WIDTH + UPDATED_WIDTH + GAP.length * 3);
|
|
18295
18499
|
const rows = runs.map((r) => {
|
|
@@ -18304,34 +18508,34 @@ function renderRunsList(runs, options) {
|
|
|
18304
18508
|
}
|
|
18305
18509
|
function renderRunDetail(run) {
|
|
18306
18510
|
const lines = [];
|
|
18307
|
-
lines.push(
|
|
18511
|
+
lines.push(chalk65.bold(`
|
|
18308
18512
|
\uD83C\uDFC3 Run Details
|
|
18309
18513
|
`));
|
|
18310
|
-
lines.push(` ${
|
|
18311
|
-
lines.push(` ${
|
|
18312
|
-
lines.push(` ${
|
|
18313
|
-
lines.push(` ${
|
|
18514
|
+
lines.push(` ${chalk65.cyan("Run ID:")} ${run.id}`);
|
|
18515
|
+
lines.push(` ${chalk65.cyan("Workflow:")} ${run.workflowId}`);
|
|
18516
|
+
lines.push(` ${chalk65.cyan("Status:")} ${statusColor(run.status)(run.status)}`);
|
|
18517
|
+
lines.push(` ${chalk65.cyan("Started:")} ${formatDate(run.startedAt)}`);
|
|
18314
18518
|
if (run.pausedAt) {
|
|
18315
|
-
lines.push(` ${
|
|
18519
|
+
lines.push(` ${chalk65.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
|
|
18316
18520
|
}
|
|
18317
18521
|
if (run.resumedAt) {
|
|
18318
|
-
lines.push(` ${
|
|
18522
|
+
lines.push(` ${chalk65.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
|
|
18319
18523
|
}
|
|
18320
18524
|
if (run.stoppedAt) {
|
|
18321
|
-
lines.push(` ${
|
|
18525
|
+
lines.push(` ${chalk65.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
|
|
18322
18526
|
}
|
|
18323
18527
|
if (run.completedAt) {
|
|
18324
|
-
lines.push(` ${
|
|
18528
|
+
lines.push(` ${chalk65.cyan("Completed:")} ${formatDate(run.completedAt)}`);
|
|
18325
18529
|
}
|
|
18326
|
-
lines.push(` ${
|
|
18530
|
+
lines.push(` ${chalk65.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
|
|
18327
18531
|
if (run.error) {
|
|
18328
|
-
lines.push(
|
|
18532
|
+
lines.push(chalk65.bold(`
|
|
18329
18533
|
❌ Error
|
|
18330
18534
|
`));
|
|
18331
|
-
lines.push(` ${
|
|
18535
|
+
lines.push(` ${chalk65.red(run.error)}`);
|
|
18332
18536
|
}
|
|
18333
18537
|
if (run.output) {
|
|
18334
|
-
lines.push(
|
|
18538
|
+
lines.push(chalk65.bold(`
|
|
18335
18539
|
\uD83D\uDCE4 Output
|
|
18336
18540
|
`));
|
|
18337
18541
|
lines.push(" " + JSON.stringify(run.output, null, 2).split(`
|
|
@@ -18342,36 +18546,49 @@ function renderRunDetail(run) {
|
|
|
18342
18546
|
`);
|
|
18343
18547
|
}
|
|
18344
18548
|
function renderWorkflowAdded(workflow) {
|
|
18345
|
-
return
|
|
18549
|
+
return chalk65.green(`
|
|
18346
18550
|
✅ Workflow '${workflow.name}' added successfully
|
|
18347
18551
|
`) + ` ID: ${workflow.id}
|
|
18348
18552
|
` + ` Version: ${workflow.version}
|
|
18349
18553
|
`;
|
|
18350
18554
|
}
|
|
18351
18555
|
function renderWorkflowUpdated(workflow) {
|
|
18352
|
-
return
|
|
18556
|
+
return chalk65.green(`
|
|
18353
18557
|
✅ Workflow '${workflow.name}' updated successfully
|
|
18354
18558
|
`) + ` ID: ${workflow.id}
|
|
18355
18559
|
`;
|
|
18356
18560
|
}
|
|
18357
18561
|
function renderWorkflowDeleted(name) {
|
|
18358
|
-
return
|
|
18562
|
+
return chalk65.green(`
|
|
18359
18563
|
✅ Workflow '${name}' deleted successfully
|
|
18360
18564
|
`);
|
|
18361
18565
|
}
|
|
18362
18566
|
function renderRunResult(result) {
|
|
18363
18567
|
const lines = [];
|
|
18364
18568
|
if (result.status === "completed") {
|
|
18365
|
-
lines.push(
|
|
18569
|
+
lines.push(chalk65.green(`
|
|
18366
18570
|
✅ Workflow completed successfully`));
|
|
18367
18571
|
} else if (result.status === "failed") {
|
|
18368
|
-
lines.push(
|
|
18572
|
+
lines.push(chalk65.red(`
|
|
18369
18573
|
❌ Workflow failed`));
|
|
18370
18574
|
} else if (result.status === "stopped") {
|
|
18371
|
-
lines.push(
|
|
18575
|
+
lines.push(chalk65.yellow(`
|
|
18372
18576
|
⚠️ Workflow stopped`));
|
|
18577
|
+
} else if (result.status === "paused") {
|
|
18578
|
+
lines.push(chalk65.yellow(`
|
|
18579
|
+
⏸️ Workflow paused`));
|
|
18580
|
+
if (result.pendingNodeId) {
|
|
18581
|
+
lines.push(chalk65.gray(` Pending node: ${result.pendingNodeId}`));
|
|
18582
|
+
}
|
|
18583
|
+
if (result.query) {
|
|
18584
|
+
lines.push("");
|
|
18585
|
+
lines.push(chalk65.bold("\uD83D\uDCAC Agent asked: ") + chalk65.white(result.query));
|
|
18586
|
+
}
|
|
18587
|
+
if (result.agentSessionId) {
|
|
18588
|
+
lines.push(chalk65.gray(` Agent sub-session: ${result.agentSessionId}`));
|
|
18589
|
+
}
|
|
18373
18590
|
} else {
|
|
18374
|
-
lines.push(
|
|
18591
|
+
lines.push(chalk65.blue(`
|
|
18375
18592
|
\uD83D\uDD04 Workflow ${result.status}`));
|
|
18376
18593
|
}
|
|
18377
18594
|
lines.push(` Run ID: ${result.runId}`);
|
|
@@ -18379,11 +18596,11 @@ function renderRunResult(result) {
|
|
|
18379
18596
|
lines.push(` Duration: ${formatDuration(result.durationMs)}`);
|
|
18380
18597
|
}
|
|
18381
18598
|
if (result.error) {
|
|
18382
|
-
lines.push(
|
|
18599
|
+
lines.push(chalk65.red(`
|
|
18383
18600
|
Error: ${result.error}`));
|
|
18384
18601
|
}
|
|
18385
18602
|
if (result.output) {
|
|
18386
|
-
lines.push(
|
|
18603
|
+
lines.push(chalk65.bold(`
|
|
18387
18604
|
\uD83D\uDCE4 Output:`));
|
|
18388
18605
|
lines.push(JSON.stringify(result.output, null, 2));
|
|
18389
18606
|
}
|
|
@@ -18397,10 +18614,10 @@ function renderNodesList(nodes) {
|
|
|
18397
18614
|
const DEPS_WIDTH = 20;
|
|
18398
18615
|
const GAP = " ";
|
|
18399
18616
|
const headerLine = [
|
|
18400
|
-
|
|
18401
|
-
|
|
18402
|
-
|
|
18403
|
-
|
|
18617
|
+
chalk65.bold("NODE ID".padEnd(ID_WIDTH)),
|
|
18618
|
+
chalk65.bold("TYPE".padEnd(TYPE_WIDTH)),
|
|
18619
|
+
chalk65.bold("NAME".padEnd(NAME_WIDTH)),
|
|
18620
|
+
chalk65.bold("DEPENDS ON")
|
|
18404
18621
|
].join(GAP);
|
|
18405
18622
|
const sepLine = "─".repeat(ID_WIDTH + TYPE_WIDTH + NAME_WIDTH + DEPS_WIDTH + GAP.length * 3);
|
|
18406
18623
|
const rows = nodes.map((n) => {
|
|
@@ -18415,7 +18632,7 @@ function renderNodesList(nodes) {
|
|
|
18415
18632
|
}
|
|
18416
18633
|
|
|
18417
18634
|
// src/commands/workflow/commands/list.ts
|
|
18418
|
-
import
|
|
18635
|
+
import chalk66 from "chalk";
|
|
18419
18636
|
import { createWorkflowListTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
18420
18637
|
function buildListWorkflowsJson(workflows, total, args, availableTags) {
|
|
18421
18638
|
const output = {
|
|
@@ -18575,20 +18792,20 @@ var WorkflowListCommand = {
|
|
|
18575
18792
|
if (total > workflows.length) {
|
|
18576
18793
|
const start = finalOffset + 1;
|
|
18577
18794
|
const end = finalOffset + workflows.length;
|
|
18578
|
-
output.log(
|
|
18795
|
+
output.log(chalk66.green(`
|
|
18579
18796
|
✅ 显示 ${start}-${end} / 共 ${total} 个 Workflow`));
|
|
18580
18797
|
const totalPages = Math.ceil(total / pageSize);
|
|
18581
18798
|
const currentPage = Math.floor(finalOffset / pageSize) + 1;
|
|
18582
18799
|
if (totalPages > 1) {
|
|
18583
|
-
output.log(
|
|
18800
|
+
output.log(chalk66.cyan(`\uD83D\uDCC4 第 ${currentPage} / ${totalPages} 页`));
|
|
18584
18801
|
}
|
|
18585
18802
|
} else {
|
|
18586
|
-
output.log(
|
|
18803
|
+
output.log(chalk66.green(`
|
|
18587
18804
|
✅ 共 ${total} 个 Workflow`));
|
|
18588
18805
|
}
|
|
18589
18806
|
if (availableTags.length > 0) {
|
|
18590
18807
|
const tagsLine = availableTags.map((t) => `${t.name}(${t.count})`).join(", ");
|
|
18591
|
-
output.log(
|
|
18808
|
+
output.log(chalk66.cyan(`
|
|
18592
18809
|
\uD83C\uDFF7️ Available tags: ${tagsLine}`));
|
|
18593
18810
|
}
|
|
18594
18811
|
}
|
|
@@ -19192,7 +19409,7 @@ class WorkflowValidator {
|
|
|
19192
19409
|
|
|
19193
19410
|
// src/commands/workflow/commands/add.ts
|
|
19194
19411
|
import { validateWorkflowDefinition } from "@ai-setting/roy-agent-core/env/workflow/utils";
|
|
19195
|
-
import
|
|
19412
|
+
import chalk67 from "chalk";
|
|
19196
19413
|
import fs3 from "fs";
|
|
19197
19414
|
import path6 from "path";
|
|
19198
19415
|
async function parseWorkflowContent(content, filename) {
|
|
@@ -19334,7 +19551,7 @@ var WorkflowAddCommand = {
|
|
|
19334
19551
|
definition = await parseWorkflowContent(content, filePath);
|
|
19335
19552
|
workflowName = a.name || definition.name || path6.basename(filePath);
|
|
19336
19553
|
if (a.validate) {
|
|
19337
|
-
output.log(
|
|
19554
|
+
output.log(chalk67.blue("\uD83D\uDD0D Validating workflow..."));
|
|
19338
19555
|
const dagResult = validateWorkflowDefinition(definition);
|
|
19339
19556
|
if (!dagResult.valid) {
|
|
19340
19557
|
output.error(`
|
|
@@ -19358,11 +19575,11 @@ var WorkflowAddCommand = {
|
|
|
19358
19575
|
});
|
|
19359
19576
|
process.exit(1);
|
|
19360
19577
|
}
|
|
19361
|
-
output.log(
|
|
19578
|
+
output.log(chalk67.green(`✅ Workflow validation passed
|
|
19362
19579
|
`));
|
|
19363
19580
|
}
|
|
19364
19581
|
} else if (a.desc) {
|
|
19365
|
-
output.log(
|
|
19582
|
+
output.log(chalk67.blue(`\uD83E\uDD16 Generating workflow from description...
|
|
19366
19583
|
`));
|
|
19367
19584
|
const agentComponent = env.getComponent("agent");
|
|
19368
19585
|
if (!agentComponent) {
|
|
@@ -19384,20 +19601,20 @@ ${a.desc}
|
|
|
19384
19601
|
1. 先用 \`roy-agent workflow nodes\` 查看可用的节点类型
|
|
19385
19602
|
2. 生成的 YAML 必须通过 \`roy-agent workflow validate --yaml "<yaml>"\` 验证
|
|
19386
19603
|
3. 验证通过后才输出最终 YAML`;
|
|
19387
|
-
output.log(
|
|
19604
|
+
output.log(chalk67.gray("Running workflow-extract agent..."));
|
|
19388
19605
|
const result = await agentComponent.run("workflow-extract", prompt);
|
|
19389
19606
|
const agentOutput = result.finalText || "";
|
|
19390
19607
|
definition = parseYamlFromAgentOutput(agentOutput);
|
|
19391
19608
|
if (definition === null) {
|
|
19392
19609
|
output.error("Failed to parse workflow from agent output");
|
|
19393
|
-
output.log(
|
|
19610
|
+
output.log(chalk67.gray(`
|
|
19394
19611
|
Agent output:
|
|
19395
19612
|
` + agentOutput.slice(0, 500)));
|
|
19396
19613
|
process.exit(1);
|
|
19397
19614
|
}
|
|
19398
19615
|
workflowName = a.name || definition.name;
|
|
19399
19616
|
if (a.validate) {
|
|
19400
|
-
output.log(
|
|
19617
|
+
output.log(chalk67.blue(`
|
|
19401
19618
|
\uD83D\uDD0D Validating generated workflow...`));
|
|
19402
19619
|
const dagResult = validateWorkflowDefinition(definition);
|
|
19403
19620
|
if (!dagResult.valid) {
|
|
@@ -19406,7 +19623,7 @@ Agent output:
|
|
|
19406
19623
|
dagResult.errors.forEach((msg, i) => {
|
|
19407
19624
|
output.error(`[Error ${i + 1}/${dagResult.errors.length}] ${msg}`);
|
|
19408
19625
|
});
|
|
19409
|
-
output.log(
|
|
19626
|
+
output.log(chalk67.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
|
|
19410
19627
|
process.exit(1);
|
|
19411
19628
|
}
|
|
19412
19629
|
const validator = new WorkflowValidator;
|
|
@@ -19421,16 +19638,16 @@ Agent output:
|
|
|
19421
19638
|
output.error(` Fix: ${error.fix}
|
|
19422
19639
|
`);
|
|
19423
19640
|
});
|
|
19424
|
-
output.log(
|
|
19641
|
+
output.log(chalk67.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
|
|
19425
19642
|
process.exit(1);
|
|
19426
19643
|
}
|
|
19427
|
-
output.log(
|
|
19644
|
+
output.log(chalk67.green(`✅ Generated workflow validation passed
|
|
19428
19645
|
`));
|
|
19429
19646
|
}
|
|
19430
19647
|
const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
|
|
19431
|
-
output.log(
|
|
19648
|
+
output.log(chalk67.gray("--- Generated YAML ---"));
|
|
19432
19649
|
output.log(yaml.stringify(definition));
|
|
19433
|
-
output.log(
|
|
19650
|
+
output.log(chalk67.gray(`------------------------
|
|
19434
19651
|
`));
|
|
19435
19652
|
} else {
|
|
19436
19653
|
output.error("Please provide --file or --desc option");
|
|
@@ -19456,10 +19673,10 @@ Agent output:
|
|
|
19456
19673
|
force: a.force
|
|
19457
19674
|
});
|
|
19458
19675
|
output.log(renderWorkflowAdded(workflow));
|
|
19459
|
-
output.log(
|
|
19676
|
+
output.log(chalk67.bold(`
|
|
19460
19677
|
\uD83D\uDCCA Nodes Summary:`));
|
|
19461
19678
|
output.log(renderNodesList(definition.nodes));
|
|
19462
|
-
output.log(
|
|
19679
|
+
output.log(chalk67.green(`
|
|
19463
19680
|
✅ Workflow '${workflowName}' added successfully`));
|
|
19464
19681
|
} catch (error) {
|
|
19465
19682
|
if (error.message?.includes("already exists") && !a.force) {
|
|
@@ -19476,7 +19693,7 @@ Agent output:
|
|
|
19476
19693
|
};
|
|
19477
19694
|
|
|
19478
19695
|
// src/commands/workflow/commands/get.ts
|
|
19479
|
-
import
|
|
19696
|
+
import chalk68 from "chalk";
|
|
19480
19697
|
import { createWorkflowGetTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
19481
19698
|
var WorkflowGetCommand = {
|
|
19482
19699
|
command: "get <identifier>",
|
|
@@ -19614,15 +19831,15 @@ var WorkflowGetCommand = {
|
|
|
19614
19831
|
} else {
|
|
19615
19832
|
output.log(renderWorkflowDetail(workflow, { includeRuns: runs }));
|
|
19616
19833
|
if (args.includeNodes) {
|
|
19617
|
-
output.log(
|
|
19834
|
+
output.log(chalk68.bold(`
|
|
19618
19835
|
\uD83D\uDCCB All Nodes:`));
|
|
19619
19836
|
output.log(renderNodesList(data.nodes || []));
|
|
19620
19837
|
}
|
|
19621
19838
|
const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
|
|
19622
19839
|
const defYaml = yaml.stringify(data.definition || {}, { indent: 2 });
|
|
19623
|
-
output.log(
|
|
19840
|
+
output.log(chalk68.bold(`
|
|
19624
19841
|
\uD83D\uDCC4 Definition (YAML):`));
|
|
19625
|
-
output.log(
|
|
19842
|
+
output.log(chalk68.gray(defYaml));
|
|
19626
19843
|
}
|
|
19627
19844
|
}
|
|
19628
19845
|
} catch (error) {
|
|
@@ -19635,7 +19852,7 @@ var WorkflowGetCommand = {
|
|
|
19635
19852
|
};
|
|
19636
19853
|
|
|
19637
19854
|
// src/commands/workflow/commands/update.ts
|
|
19638
|
-
import
|
|
19855
|
+
import chalk69 from "chalk";
|
|
19639
19856
|
import fs4 from "fs";
|
|
19640
19857
|
import path7 from "path";
|
|
19641
19858
|
import { parseWorkflowFile } from "@ai-setting/roy-agent-core/env/workflow/types";
|
|
@@ -19708,7 +19925,7 @@ var WorkflowUpdateCommand = {
|
|
|
19708
19925
|
const tags = a.tags ? a.tags.split(",").map((t) => t.trim()) : undefined;
|
|
19709
19926
|
const workflow = await service.updateWorkflow(a.name, updates, { tags });
|
|
19710
19927
|
output.log(renderWorkflowUpdated(workflow));
|
|
19711
|
-
output.log(
|
|
19928
|
+
output.log(chalk69.green(`
|
|
19712
19929
|
✅ Workflow '${a.name}' updated successfully`));
|
|
19713
19930
|
} catch (error) {
|
|
19714
19931
|
output.error(`Failed to update workflow: ${error}`);
|
|
@@ -19720,7 +19937,7 @@ var WorkflowUpdateCommand = {
|
|
|
19720
19937
|
};
|
|
19721
19938
|
|
|
19722
19939
|
// src/commands/workflow/commands/remove.ts
|
|
19723
|
-
import
|
|
19940
|
+
import chalk70 from "chalk";
|
|
19724
19941
|
var WorkflowRemoveCommand = {
|
|
19725
19942
|
command: "remove <name>",
|
|
19726
19943
|
describe: "删除 Workflow",
|
|
@@ -19759,8 +19976,8 @@ var WorkflowRemoveCommand = {
|
|
|
19759
19976
|
process.exit(1);
|
|
19760
19977
|
}
|
|
19761
19978
|
if (!args.force) {
|
|
19762
|
-
output.log(
|
|
19763
|
-
output.log(
|
|
19979
|
+
output.log(chalk70.yellow(`Are you sure you want to delete workflow '${args.name}'?`));
|
|
19980
|
+
output.log(chalk70.gray("Use --force to skip confirmation"));
|
|
19764
19981
|
process.exit(1);
|
|
19765
19982
|
}
|
|
19766
19983
|
const deleted = await service.deleteWorkflow(args.name);
|
|
@@ -19780,7 +19997,7 @@ var WorkflowRemoveCommand = {
|
|
|
19780
19997
|
|
|
19781
19998
|
// src/commands/workflow/commands/run.ts
|
|
19782
19999
|
var import_yaml = __toESM(require_dist(), 1);
|
|
19783
|
-
import
|
|
20000
|
+
import chalk71 from "chalk";
|
|
19784
20001
|
import fs5 from "fs";
|
|
19785
20002
|
import path8 from "path";
|
|
19786
20003
|
import { createRunWorkflowTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
@@ -19848,6 +20065,20 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19848
20065
|
input = args.session ? args.input : undefined;
|
|
19849
20066
|
}
|
|
19850
20067
|
}
|
|
20068
|
+
let nodeConfig;
|
|
20069
|
+
if (args.nodeConfig) {
|
|
20070
|
+
try {
|
|
20071
|
+
const parsed = JSON.parse(args.nodeConfig);
|
|
20072
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
20073
|
+
output.error(`Invalid --node-config: expected a JSON object mapping nodeId → overrides, got: ${args.nodeConfig}`);
|
|
20074
|
+
process.exit(1);
|
|
20075
|
+
}
|
|
20076
|
+
nodeConfig = parsed;
|
|
20077
|
+
} catch (err) {
|
|
20078
|
+
output.error(`Invalid --node-config JSON: ${err instanceof Error ? err.message : String(err)}`);
|
|
20079
|
+
process.exit(1);
|
|
20080
|
+
}
|
|
20081
|
+
}
|
|
19851
20082
|
if (args.session && !args.session.startsWith("workflow_")) {
|
|
19852
20083
|
output.error(`Invalid session ID: must start with 'workflow_' (got: ${args.session})`);
|
|
19853
20084
|
process.exit(1);
|
|
@@ -19855,7 +20086,8 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19855
20086
|
const runOptions = {
|
|
19856
20087
|
debug: args.debug,
|
|
19857
20088
|
parallelLimit: args.parallelLimit,
|
|
19858
|
-
timeout: args.timeout
|
|
20089
|
+
timeout: args.timeout,
|
|
20090
|
+
...nodeConfig ? { nodeConfig } : {}
|
|
19859
20091
|
};
|
|
19860
20092
|
const rawEnvParentId = process.env["ROY_PARENT_SESSION_ID"];
|
|
19861
20093
|
if (typeof rawEnvParentId === "string" && rawEnvParentId.length > 0) {
|
|
@@ -19867,7 +20099,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19867
20099
|
}
|
|
19868
20100
|
if (args.session) {
|
|
19869
20101
|
const sessionId = args.session;
|
|
19870
|
-
output.log(
|
|
20102
|
+
output.log(chalk71.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
|
|
19871
20103
|
try {
|
|
19872
20104
|
const resumeInput = typeof input === "string" ? { userQuery: input } : input;
|
|
19873
20105
|
const result = await service.resumeSession(sessionId, {
|
|
@@ -19879,7 +20111,10 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19879
20111
|
status: result.status,
|
|
19880
20112
|
output: result.output,
|
|
19881
20113
|
error: result.error,
|
|
19882
|
-
durationMs: result.durationMs
|
|
20114
|
+
durationMs: result.durationMs,
|
|
20115
|
+
...result.pendingNodeId ? { pendingNodeId: result.pendingNodeId } : {},
|
|
20116
|
+
...result.query ? { query: result.query } : {},
|
|
20117
|
+
...result.agentSessionId ? { agentSessionId: result.agentSessionId } : {}
|
|
19883
20118
|
}));
|
|
19884
20119
|
} catch (err) {
|
|
19885
20120
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -19910,35 +20145,40 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19910
20145
|
definition = { ...definition, name: args.name };
|
|
19911
20146
|
}
|
|
19912
20147
|
const workflow = await service.createWorkflow(definition, { force: true });
|
|
19913
|
-
output.log(
|
|
19914
|
-
output.log(
|
|
20148
|
+
output.log(chalk71.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
|
|
20149
|
+
output.log(chalk71.green(`✅ Workflow registered: ${workflow.name} (${workflow.id})`));
|
|
19915
20150
|
if (args.registerOnly) {
|
|
19916
|
-
output.log(
|
|
20151
|
+
output.log(chalk71.gray("ℹ️ Use --register-only, skipping execution"));
|
|
19917
20152
|
if (workflowSpan) {
|
|
19918
20153
|
workflowSpan.end();
|
|
19919
20154
|
}
|
|
19920
20155
|
await envService.dispose();
|
|
19921
20156
|
process.exit(0);
|
|
19922
20157
|
}
|
|
19923
|
-
output.log(
|
|
19924
|
-
const
|
|
20158
|
+
output.log(chalk71.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
|
|
20159
|
+
const fileBranchInput = typeof input === "string" ? undefined : input;
|
|
20160
|
+
const result = await service.runWorkflow(definition, fileBranchInput, runOptions);
|
|
19925
20161
|
output.log(renderRunResult({
|
|
19926
20162
|
runId: result.runId,
|
|
19927
20163
|
status: result.status,
|
|
19928
20164
|
output: result.output,
|
|
19929
20165
|
error: result.error,
|
|
19930
|
-
durationMs: result.durationMs
|
|
20166
|
+
durationMs: result.durationMs,
|
|
20167
|
+
...result.pendingNodeId ? { pendingNodeId: result.pendingNodeId } : {},
|
|
20168
|
+
...result.query ? { query: result.query } : {},
|
|
20169
|
+
...result.agentSessionId ? { agentSessionId: result.agentSessionId } : {}
|
|
19931
20170
|
}));
|
|
19932
20171
|
if (result.status === "paused") {
|
|
19933
|
-
output.log(
|
|
19934
|
-
\uD83D\uDCA1
|
|
20172
|
+
output.log(chalk71.gray(`
|
|
20173
|
+
\uD83D\uDCA1 Resume with: roy-agent workflow run ${result.runId} --session ${result.runId} --input "<your answer>"`));
|
|
19935
20174
|
}
|
|
19936
20175
|
} else {
|
|
19937
20176
|
const tool = createRunWorkflowTool(service);
|
|
19938
20177
|
const toolResult = await tool.execute({
|
|
19939
20178
|
workflow_name: args.identifier,
|
|
19940
|
-
input: input || undefined,
|
|
19941
|
-
timeout: args.timeout
|
|
20179
|
+
input: typeof input === "string" ? undefined : input || undefined,
|
|
20180
|
+
timeout: args.timeout,
|
|
20181
|
+
...nodeConfig ? { node_config: nodeConfig } : {}
|
|
19942
20182
|
}, {});
|
|
19943
20183
|
if (!toolResult.success) {
|
|
19944
20184
|
const outAny = toolResult.output;
|
|
@@ -19946,7 +20186,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19946
20186
|
output.error(toolResult.error || `Failed to run workflow: ${args.identifier}`);
|
|
19947
20187
|
if (runId) {
|
|
19948
20188
|
output.error(`Run ID: ${runId}`);
|
|
19949
|
-
output.error(
|
|
20189
|
+
output.error(chalk71.gray(`
|
|
19950
20190
|
\uD83D\uDCA1 Use "roy-agent workflow status ${runId}" to check progress, or "roy-agent workflow run ${args.identifier} --session ${runId}" to resume`));
|
|
19951
20191
|
}
|
|
19952
20192
|
process.exit(1);
|
|
@@ -19957,11 +20197,14 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19957
20197
|
status: runData.status,
|
|
19958
20198
|
output: runData.output,
|
|
19959
20199
|
error: runData.error,
|
|
19960
|
-
durationMs: runData.duration_ms
|
|
20200
|
+
durationMs: runData.duration_ms,
|
|
20201
|
+
...runData.pending_node_id ? { pendingNodeId: runData.pending_node_id } : {},
|
|
20202
|
+
...runData.query ? { query: runData.query } : {},
|
|
20203
|
+
...runData.agent_session_id ? { agentSessionId: runData.agent_session_id } : {}
|
|
19961
20204
|
}));
|
|
19962
20205
|
if (runData.status === "paused") {
|
|
19963
|
-
output.log(
|
|
19964
|
-
\uD83D\uDCA1
|
|
20206
|
+
output.log(chalk71.gray(`
|
|
20207
|
+
\uD83D\uDCA1 Resume with: roy-agent workflow run ${args.identifier} --session ${runData.run_id} --input "<your answer>"`));
|
|
19965
20208
|
}
|
|
19966
20209
|
}
|
|
19967
20210
|
if (workflowSpan) {
|
|
@@ -20027,12 +20270,15 @@ var WorkflowRunCommand = {
|
|
|
20027
20270
|
alias: "s",
|
|
20028
20271
|
describe: "从已有 session 恢复运行(支持 workflow pause/interrupt 恢复;runId == sessionId,传 workflow run 的 runId 即可)",
|
|
20029
20272
|
type: "string"
|
|
20273
|
+
}).option("node-config", {
|
|
20274
|
+
describe: `Per-node runtime config overrides (Task #1974). JSON string: { "<nodeId>": { "timeout": 5000 } }. Shallow-merged into each node's effective config; input wins over nodeDef.config.`,
|
|
20275
|
+
type: "string"
|
|
20030
20276
|
}),
|
|
20031
20277
|
handler: runWorkflow
|
|
20032
20278
|
};
|
|
20033
20279
|
|
|
20034
20280
|
// src/commands/workflow/commands/stop.ts
|
|
20035
|
-
import
|
|
20281
|
+
import chalk72 from "chalk";
|
|
20036
20282
|
import { createWorkflowRunStopTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
20037
20283
|
import { wrapFunction as wrapFunction2 } from "@ai-setting/roy-agent-core";
|
|
20038
20284
|
var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
|
|
@@ -20057,7 +20303,7 @@ var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
|
|
|
20057
20303
|
output.error(result.error || `Failed to stop workflow: ${args.runId}`);
|
|
20058
20304
|
process.exit(1);
|
|
20059
20305
|
}
|
|
20060
|
-
output.log(
|
|
20306
|
+
output.log(chalk72.red(`
|
|
20061
20307
|
⏹️ Workflow stopped: ${args.runId}`));
|
|
20062
20308
|
} catch (error) {
|
|
20063
20309
|
output.error(`Failed to stop workflow: ${error}`);
|
|
@@ -20081,7 +20327,7 @@ var WorkflowStopCommand = {
|
|
|
20081
20327
|
};
|
|
20082
20328
|
|
|
20083
20329
|
// src/commands/workflow/commands/status.ts
|
|
20084
|
-
import
|
|
20330
|
+
import chalk73 from "chalk";
|
|
20085
20331
|
import { createWorkflowRunStatusTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
20086
20332
|
var WorkflowStatusCommand = {
|
|
20087
20333
|
command: "status <runId>",
|
|
@@ -20174,7 +20420,7 @@ var WorkflowStatusCommand = {
|
|
|
20174
20420
|
stopped: "⏹️"
|
|
20175
20421
|
};
|
|
20176
20422
|
const emoji = statusEmoji[status] || "❓";
|
|
20177
|
-
output.log(
|
|
20423
|
+
output.log(chalk73.bold(`
|
|
20178
20424
|
${emoji} Status: ${status.toUpperCase()}`));
|
|
20179
20425
|
}
|
|
20180
20426
|
} catch (error) {
|
|
@@ -20187,7 +20433,7 @@ ${emoji} Status: ${status.toUpperCase()}`));
|
|
|
20187
20433
|
};
|
|
20188
20434
|
|
|
20189
20435
|
// src/commands/workflow/commands/nodes.ts
|
|
20190
|
-
import
|
|
20436
|
+
import chalk74 from "chalk";
|
|
20191
20437
|
var BUILT_IN_NODES = [
|
|
20192
20438
|
{
|
|
20193
20439
|
name: "ToolNode",
|
|
@@ -20524,7 +20770,7 @@ nodes:
|
|
|
20524
20770
|
];
|
|
20525
20771
|
function renderNodeTypesTable(nodes) {
|
|
20526
20772
|
const lines = [];
|
|
20527
|
-
lines.push(
|
|
20773
|
+
lines.push(chalk74.bold(`
|
|
20528
20774
|
\uD83D\uDCE6 Built-in Node Types
|
|
20529
20775
|
`));
|
|
20530
20776
|
lines.push("┌────────────┬────────────────────┬─────────────────────────────────────────────────────────────┐");
|
|
@@ -20542,29 +20788,29 @@ function renderNodeTypesTable(nodes) {
|
|
|
20542
20788
|
}
|
|
20543
20789
|
function renderNodeDetail(node) {
|
|
20544
20790
|
const lines = [];
|
|
20545
|
-
lines.push(
|
|
20791
|
+
lines.push(chalk74.bold(`
|
|
20546
20792
|
[${node.type}] ${node.name}`));
|
|
20547
|
-
lines.push(
|
|
20793
|
+
lines.push(chalk74.dim("─".repeat(60)) + `
|
|
20548
20794
|
`);
|
|
20549
|
-
lines.push(
|
|
20795
|
+
lines.push(chalk74.bold("Description:"));
|
|
20550
20796
|
lines.push(` ${node.description}
|
|
20551
20797
|
`);
|
|
20552
|
-
lines.push(
|
|
20798
|
+
lines.push(chalk74.bold("Configuration:"));
|
|
20553
20799
|
lines.push(' type: "' + node.type + '"');
|
|
20554
20800
|
lines.push(" config:");
|
|
20555
20801
|
for (const input of node.inputs) {
|
|
20556
|
-
const required = input.required ?
|
|
20802
|
+
const required = input.required ? chalk74.red("*") : " ";
|
|
20557
20803
|
lines.push(` ${input.name} (${input.type})${required}`);
|
|
20558
20804
|
lines.push(` ${input.description}`);
|
|
20559
20805
|
}
|
|
20560
20806
|
lines.push(`
|
|
20561
|
-
${
|
|
20807
|
+
${chalk74.bold("Output:")} ${node.output}`);
|
|
20562
20808
|
if (node.example) {
|
|
20563
|
-
lines.push(
|
|
20809
|
+
lines.push(chalk74.bold(`
|
|
20564
20810
|
Example:`));
|
|
20565
|
-
lines.push(
|
|
20811
|
+
lines.push(chalk74.gray("```yaml"));
|
|
20566
20812
|
lines.push(node.example);
|
|
20567
|
-
lines.push(
|
|
20813
|
+
lines.push(chalk74.gray("```"));
|
|
20568
20814
|
}
|
|
20569
20815
|
return lines.join(`
|
|
20570
20816
|
`);
|
|
@@ -20580,16 +20826,16 @@ var WorkflowNodesCommand = {
|
|
|
20580
20826
|
const nodeType = args.type?.toLowerCase();
|
|
20581
20827
|
if (!nodeType) {
|
|
20582
20828
|
console.log(renderNodeTypesTable(BUILT_IN_NODES));
|
|
20583
|
-
console.log(
|
|
20584
|
-
Use `) +
|
|
20585
|
-
console.log(
|
|
20829
|
+
console.log(chalk74.gray(`
|
|
20830
|
+
Use `) + chalk74.cyan("roy-agent workflow nodes <type>") + chalk74.gray(" for detailed information"));
|
|
20831
|
+
console.log(chalk74.gray("Available types: ") + chalk74.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
|
|
20586
20832
|
return;
|
|
20587
20833
|
}
|
|
20588
20834
|
const node = BUILT_IN_NODES.find((n) => n.type === nodeType);
|
|
20589
20835
|
if (!node) {
|
|
20590
|
-
console.log(
|
|
20836
|
+
console.log(chalk74.red(`
|
|
20591
20837
|
❌ Unknown node type: ${nodeType}`));
|
|
20592
|
-
console.log(
|
|
20838
|
+
console.log(chalk74.gray("Available types: ") + chalk74.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
|
|
20593
20839
|
process.exit(1);
|
|
20594
20840
|
}
|
|
20595
20841
|
console.log(renderNodeDetail(node));
|
|
@@ -20597,7 +20843,7 @@ Use `) + chalk73.cyan("roy-agent workflow nodes <type>") + chalk73.gray(" for de
|
|
|
20597
20843
|
};
|
|
20598
20844
|
|
|
20599
20845
|
// src/commands/workflow/commands/validate.ts
|
|
20600
|
-
import
|
|
20846
|
+
import chalk75 from "chalk";
|
|
20601
20847
|
import { readFileSync } from "fs";
|
|
20602
20848
|
async function parseWorkflowInput(input, yamlStr) {
|
|
20603
20849
|
const parseYaml = async (content) => {
|
|
@@ -20630,25 +20876,25 @@ function renderResult(result, options) {
|
|
|
20630
20876
|
return;
|
|
20631
20877
|
}
|
|
20632
20878
|
if (result.valid) {
|
|
20633
|
-
console.log(
|
|
20879
|
+
console.log(chalk75.green(`
|
|
20634
20880
|
✅ Workflow validation PASSED
|
|
20635
20881
|
`));
|
|
20636
|
-
console.log(
|
|
20882
|
+
console.log(chalk75.bold(`Workflow: ${result.workflowName}`));
|
|
20637
20883
|
console.log(`Nodes: ${result.nodeCount}`);
|
|
20638
20884
|
console.log(`
|
|
20639
20885
|
Valid nodes:`);
|
|
20640
|
-
console.log(
|
|
20886
|
+
console.log(chalk75.green(" ✓ All nodes passed validation"));
|
|
20641
20887
|
} else {
|
|
20642
|
-
console.log(
|
|
20888
|
+
console.log(chalk75.red(`
|
|
20643
20889
|
❌ Workflow validation FAILED (${result.errors.length} errors found)
|
|
20644
20890
|
`));
|
|
20645
20891
|
result.errors.forEach((error, index) => {
|
|
20646
|
-
console.log(
|
|
20647
|
-
console.log(` ${
|
|
20648
|
-
console.log(` ${
|
|
20649
|
-
console.log(` ${
|
|
20650
|
-
console.log(` ${
|
|
20651
|
-
console.log(` ${
|
|
20892
|
+
console.log(chalk75.red(`[Error ${index + 1}/${result.errors.length}]${error.nodeId ? ` Node "${error.nodeId}"` : ""}`));
|
|
20893
|
+
console.log(` ${chalk75.bold("Type:")} ${error.type}`);
|
|
20894
|
+
console.log(` ${chalk75.bold("Description:")} ${error.description}`);
|
|
20895
|
+
console.log(` ${chalk75.bold("Expected:")} ${error.expected}`);
|
|
20896
|
+
console.log(` ${chalk75.bold("Actual:")} ${error.actual}`);
|
|
20897
|
+
console.log(` ${chalk75.green("Fix:")} ${error.fix}`);
|
|
20652
20898
|
console.log();
|
|
20653
20899
|
});
|
|
20654
20900
|
}
|
|
@@ -20673,7 +20919,7 @@ var WorkflowValidateCommand = {
|
|
|
20673
20919
|
try {
|
|
20674
20920
|
const workflow = await parseWorkflowInput(options.input, options.yaml);
|
|
20675
20921
|
if (!workflow) {
|
|
20676
|
-
console.error(
|
|
20922
|
+
console.error(chalk75.red("Failed to parse workflow input"));
|
|
20677
20923
|
process.exit(1);
|
|
20678
20924
|
}
|
|
20679
20925
|
const validator = new WorkflowValidator;
|
|
@@ -20681,7 +20927,7 @@ var WorkflowValidateCommand = {
|
|
|
20681
20927
|
renderResult(result, options);
|
|
20682
20928
|
process.exit(result.valid ? 0 : 1);
|
|
20683
20929
|
} catch (error) {
|
|
20684
|
-
console.error(
|
|
20930
|
+
console.error(chalk75.red(`
|
|
20685
20931
|
Error: ${error.message}`));
|
|
20686
20932
|
process.exit(1);
|
|
20687
20933
|
}
|
|
@@ -20689,7 +20935,7 @@ Error: ${error.message}`));
|
|
|
20689
20935
|
};
|
|
20690
20936
|
|
|
20691
20937
|
// src/commands/workflow/commands/search.ts
|
|
20692
|
-
import
|
|
20938
|
+
import chalk76 from "chalk";
|
|
20693
20939
|
import { wrapFunction as wrapFunction3 } from "@ai-setting/roy-agent-core";
|
|
20694
20940
|
var WorkflowSearchCommand = {
|
|
20695
20941
|
command: "search",
|
|
@@ -20846,22 +21092,22 @@ var _runWorkflowSearchImpl = async function(opts) {
|
|
|
20846
21092
|
metadata: {}
|
|
20847
21093
|
}));
|
|
20848
21094
|
if (renderWorkflows.length === 0) {
|
|
20849
|
-
output.log(
|
|
20850
|
-
output.log(
|
|
20851
|
-
output.log(
|
|
21095
|
+
output.log(chalk76.yellow("\uD83D\uDD0D No workflows matched the search criteria."));
|
|
21096
|
+
output.log(chalk76.gray(` keyword: ${keyword || "(none)"}`));
|
|
21097
|
+
output.log(chalk76.gray(` tags: ${tags && tags.length > 0 ? tags.join(", ") : "(none)"}`));
|
|
20852
21098
|
} else {
|
|
20853
|
-
output.log(
|
|
21099
|
+
output.log(chalk76.bold(`\uD83D\uDD0D Search results (${renderWorkflows.length}):`));
|
|
20854
21100
|
output.log(renderWorkflowList(renderWorkflows));
|
|
20855
|
-
output.log(
|
|
21101
|
+
output.log(chalk76.green(`
|
|
20856
21102
|
✅ Found ${renderWorkflows.length} workflow(s)`));
|
|
20857
21103
|
}
|
|
20858
21104
|
if (availableTags.length > 0) {
|
|
20859
21105
|
output.log("");
|
|
20860
|
-
output.log(
|
|
21106
|
+
output.log(chalk76.bold("\uD83D\uDCDA Available tags (sorted by usage_count):"));
|
|
20861
21107
|
for (const t of availableTags) {
|
|
20862
21108
|
const name = t.name ?? t.tag;
|
|
20863
21109
|
const count = t.count ?? t.usage_count;
|
|
20864
|
-
output.log(
|
|
21110
|
+
output.log(chalk76.gray(` - ${name} (${count})`));
|
|
20865
21111
|
}
|
|
20866
21112
|
}
|
|
20867
21113
|
};
|
|
@@ -20873,7 +21119,7 @@ var runWorkflowSearch = wrapFunction3(_runWorkflowSearchImpl, "workflow.cli.sear
|
|
|
20873
21119
|
|
|
20874
21120
|
// src/commands/workflow/commands/tag.ts
|
|
20875
21121
|
import { wrapFunction as wrapFunction4 } from "@ai-setting/roy-agent-core";
|
|
20876
|
-
import
|
|
21122
|
+
import chalk77 from "chalk";
|
|
20877
21123
|
var WorkflowTagListCommand = {
|
|
20878
21124
|
command: "list",
|
|
20879
21125
|
describe: "List all workflow tags from the workflow_tags table (sorted by usage_count DESC by default). Use this BEFORE `workflow add` to discover existing tags and reuse them for semantic consistency.",
|
|
@@ -20994,17 +21240,17 @@ var _runWorkflowTagListImpl = async function(opts) {
|
|
|
20994
21240
|
return;
|
|
20995
21241
|
}
|
|
20996
21242
|
if (result.tags.length === 0) {
|
|
20997
|
-
output.log(
|
|
20998
|
-
output.log(
|
|
21243
|
+
output.log(chalk77.yellow("\uD83C\uDFF7️ No tags in the workflow_tags table yet."));
|
|
21244
|
+
output.log(chalk77.gray(" Tags are created automatically when you run `workflow add --tags <name>`."));
|
|
20999
21245
|
return;
|
|
21000
21246
|
}
|
|
21001
|
-
output.log(
|
|
21002
|
-
output.log(
|
|
21247
|
+
output.log(chalk77.bold(`\uD83C\uDFF7️ Workflow tags (${result.total}):`));
|
|
21248
|
+
output.log(chalk77.gray(` ${padRight("NAME", 24)}${padRight("USAGE", 8)}${padRight("CREATED", 22)}`));
|
|
21003
21249
|
for (const t of result.tags) {
|
|
21004
21250
|
const line = ` ${padRight(t.name, 24)}${padRight(String(t.usage_count), 8)}${padRight(formatDate2(t.created_at), 22)}`;
|
|
21005
21251
|
output.log(line);
|
|
21006
21252
|
}
|
|
21007
|
-
output.log(
|
|
21253
|
+
output.log(chalk77.gray(`
|
|
21008
21254
|
\uD83D\uDCA1 Tip: when adding a new workflow, prefer tags from this list to ensure semantic consistency.`));
|
|
21009
21255
|
};
|
|
21010
21256
|
var _runWorkflowTagGetImpl = async function(opts) {
|
|
@@ -21031,7 +21277,7 @@ var _runWorkflowTagGetImpl = async function(opts) {
|
|
|
21031
21277
|
output.json({ error: "Tag not found", name: opts.name });
|
|
21032
21278
|
} else {
|
|
21033
21279
|
output.error(`Tag "${opts.name}" not found in the workflow_tags table.`);
|
|
21034
|
-
output.log(
|
|
21280
|
+
output.log(chalk77.gray(`Tip: run \`roy-agent workflow tag list\` to see available tags.`));
|
|
21035
21281
|
}
|
|
21036
21282
|
process.exitCode = 1;
|
|
21037
21283
|
return;
|
|
@@ -21040,10 +21286,10 @@ var _runWorkflowTagGetImpl = async function(opts) {
|
|
|
21040
21286
|
output.json(tag);
|
|
21041
21287
|
return;
|
|
21042
21288
|
}
|
|
21043
|
-
output.log(
|
|
21044
|
-
output.log(
|
|
21045
|
-
output.log(
|
|
21046
|
-
output.log(
|
|
21289
|
+
output.log(chalk77.bold(`\uD83C\uDFF7️ Tag: ${tag.name}`));
|
|
21290
|
+
output.log(chalk77.gray(` usage_count: ${tag.usage_count}`));
|
|
21291
|
+
output.log(chalk77.gray(` created_at: ${tag.created_at}`));
|
|
21292
|
+
output.log(chalk77.gray(` updated_at: ${tag.updated_at}`));
|
|
21047
21293
|
};
|
|
21048
21294
|
async function callListTags(service, options) {
|
|
21049
21295
|
if (typeof service.listTags !== "function") {
|
|
@@ -21394,7 +21640,11 @@ function readPackageInfo(packageName) {
|
|
|
21394
21640
|
join4(process.cwd(), "node_modules", packageName, "package.json"),
|
|
21395
21641
|
resolve(process.cwd(), "..", "node_modules", packageName, "package.json"),
|
|
21396
21642
|
join4(process.cwd(), ".roy", "plugins", packageName, "package.json"),
|
|
21397
|
-
join4(homedir3(), ".roy-agent", "node_modules", packageName, "package.json")
|
|
21643
|
+
join4(homedir3(), ".roy-agent", "node_modules", packageName, "package.json"),
|
|
21644
|
+
...(() => {
|
|
21645
|
+
const globalRoot = getNpmGlobalRoot();
|
|
21646
|
+
return globalRoot ? [join4(globalRoot, packageName, "package.json")] : [];
|
|
21647
|
+
})()
|
|
21398
21648
|
];
|
|
21399
21649
|
for (const pkgPath of searchPaths) {
|
|
21400
21650
|
try {
|
|
@@ -21414,6 +21664,13 @@ function readPackageInfo(packageName) {
|
|
|
21414
21664
|
console.warn(`⚠️ Could not find package.json for '${packageName}' (searched ${searchPaths.length} paths)`);
|
|
21415
21665
|
return null;
|
|
21416
21666
|
}
|
|
21667
|
+
function getNpmGlobalRoot() {
|
|
21668
|
+
const result = spawnSync("npm", ["root", "-g"], { encoding: "utf-8" });
|
|
21669
|
+
if (result.status === 0 && result.stdout) {
|
|
21670
|
+
return String(result.stdout).trim();
|
|
21671
|
+
}
|
|
21672
|
+
return null;
|
|
21673
|
+
}
|
|
21417
21674
|
function getPackageManagerCommand() {
|
|
21418
21675
|
if (existsSync3(join4(process.cwd(), "pnpm-lock.yaml"))) {
|
|
21419
21676
|
if (existsSync3(join4(process.cwd(), "pnpm-workspace.yaml"))) {
|