@ai-setting/roy-agent-cli 1.6.0 → 1.6.1
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 +837 -703
- package/dist/index.js +837 -703
- package/dist/roy-agent-linux-x64/bin/roy-agent +0 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -432,7 +432,7 @@ function parseSlashCommand(input) {
|
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
434
|
|
|
435
|
-
// ../../node_modules/.
|
|
435
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/identity.js
|
|
436
436
|
var require_identity = __commonJS((exports) => {
|
|
437
437
|
var ALIAS = Symbol.for("yaml.alias");
|
|
438
438
|
var DOC = Symbol.for("yaml.document");
|
|
@@ -486,7 +486,7 @@ var require_identity = __commonJS((exports) => {
|
|
|
486
486
|
exports.isSeq = isSeq;
|
|
487
487
|
});
|
|
488
488
|
|
|
489
|
-
// ../../node_modules/.
|
|
489
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/visit.js
|
|
490
490
|
var require_visit = __commonJS((exports) => {
|
|
491
491
|
var identity = require_identity();
|
|
492
492
|
var BREAK = Symbol("break visit");
|
|
@@ -641,7 +641,7 @@ var require_visit = __commonJS((exports) => {
|
|
|
641
641
|
exports.visitAsync = visitAsync;
|
|
642
642
|
});
|
|
643
643
|
|
|
644
|
-
// ../../node_modules/.
|
|
644
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/doc/directives.js
|
|
645
645
|
var require_directives = __commonJS((exports) => {
|
|
646
646
|
var identity = require_identity();
|
|
647
647
|
var visit = require_visit();
|
|
@@ -793,7 +793,7 @@ var require_directives = __commonJS((exports) => {
|
|
|
793
793
|
exports.Directives = Directives;
|
|
794
794
|
});
|
|
795
795
|
|
|
796
|
-
// ../../node_modules/.
|
|
796
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/doc/anchors.js
|
|
797
797
|
var require_anchors = __commonJS((exports) => {
|
|
798
798
|
var identity = require_identity();
|
|
799
799
|
var visit = require_visit();
|
|
@@ -855,7 +855,7 @@ var require_anchors = __commonJS((exports) => {
|
|
|
855
855
|
exports.findNewAnchor = findNewAnchor;
|
|
856
856
|
});
|
|
857
857
|
|
|
858
|
-
// ../../node_modules/.
|
|
858
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/doc/applyReviver.js
|
|
859
859
|
var require_applyReviver = __commonJS((exports) => {
|
|
860
860
|
function applyReviver(reviver, obj, key, val) {
|
|
861
861
|
if (val && typeof val === "object") {
|
|
@@ -902,7 +902,7 @@ var require_applyReviver = __commonJS((exports) => {
|
|
|
902
902
|
exports.applyReviver = applyReviver;
|
|
903
903
|
});
|
|
904
904
|
|
|
905
|
-
// ../../node_modules/.
|
|
905
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/toJS.js
|
|
906
906
|
var require_toJS = __commonJS((exports) => {
|
|
907
907
|
var identity = require_identity();
|
|
908
908
|
function toJS(value, arg, ctx) {
|
|
@@ -929,7 +929,7 @@ var require_toJS = __commonJS((exports) => {
|
|
|
929
929
|
exports.toJS = toJS;
|
|
930
930
|
});
|
|
931
931
|
|
|
932
|
-
// ../../node_modules/.
|
|
932
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/Node.js
|
|
933
933
|
var require_Node = __commonJS((exports) => {
|
|
934
934
|
var applyReviver = require_applyReviver();
|
|
935
935
|
var identity = require_identity();
|
|
@@ -966,7 +966,7 @@ var require_Node = __commonJS((exports) => {
|
|
|
966
966
|
exports.NodeBase = NodeBase;
|
|
967
967
|
});
|
|
968
968
|
|
|
969
|
-
// ../../node_modules/.
|
|
969
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/Alias.js
|
|
970
970
|
var require_Alias = __commonJS((exports) => {
|
|
971
971
|
var anchors = require_anchors();
|
|
972
972
|
var visit = require_visit();
|
|
@@ -1076,7 +1076,7 @@ var require_Alias = __commonJS((exports) => {
|
|
|
1076
1076
|
exports.Alias = Alias;
|
|
1077
1077
|
});
|
|
1078
1078
|
|
|
1079
|
-
// ../../node_modules/.
|
|
1079
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/Scalar.js
|
|
1080
1080
|
var require_Scalar = __commonJS((exports) => {
|
|
1081
1081
|
var identity = require_identity();
|
|
1082
1082
|
var Node = require_Node();
|
|
@@ -1104,7 +1104,7 @@ var require_Scalar = __commonJS((exports) => {
|
|
|
1104
1104
|
exports.isScalarValue = isScalarValue;
|
|
1105
1105
|
});
|
|
1106
1106
|
|
|
1107
|
-
// ../../node_modules/.
|
|
1107
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/doc/createNode.js
|
|
1108
1108
|
var require_createNode = __commonJS((exports) => {
|
|
1109
1109
|
var Alias = require_Alias();
|
|
1110
1110
|
var identity = require_identity();
|
|
@@ -1176,7 +1176,7 @@ var require_createNode = __commonJS((exports) => {
|
|
|
1176
1176
|
exports.createNode = createNode;
|
|
1177
1177
|
});
|
|
1178
1178
|
|
|
1179
|
-
// ../../node_modules/.
|
|
1179
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/Collection.js
|
|
1180
1180
|
var require_Collection = __commonJS((exports) => {
|
|
1181
1181
|
var createNode = require_createNode();
|
|
1182
1182
|
var identity = require_identity();
|
|
@@ -1291,7 +1291,7 @@ var require_Collection = __commonJS((exports) => {
|
|
|
1291
1291
|
exports.isEmptyPath = isEmptyPath;
|
|
1292
1292
|
});
|
|
1293
1293
|
|
|
1294
|
-
// ../../node_modules/.
|
|
1294
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/stringify/stringifyComment.js
|
|
1295
1295
|
var require_stringifyComment = __commonJS((exports) => {
|
|
1296
1296
|
var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
|
|
1297
1297
|
function indentComment(comment, indent) {
|
|
@@ -1308,7 +1308,7 @@ var require_stringifyComment = __commonJS((exports) => {
|
|
|
1308
1308
|
exports.stringifyComment = stringifyComment;
|
|
1309
1309
|
});
|
|
1310
1310
|
|
|
1311
|
-
// ../../node_modules/.
|
|
1311
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/stringify/foldFlowLines.js
|
|
1312
1312
|
var require_foldFlowLines = __commonJS((exports) => {
|
|
1313
1313
|
var FOLD_FLOW = "flow";
|
|
1314
1314
|
var FOLD_BLOCK = "block";
|
|
@@ -1445,7 +1445,7 @@ ${indent}${text.slice(fold + 1, end2)}`;
|
|
|
1445
1445
|
exports.foldFlowLines = foldFlowLines;
|
|
1446
1446
|
});
|
|
1447
1447
|
|
|
1448
|
-
// ../../node_modules/.
|
|
1448
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/stringify/stringifyString.js
|
|
1449
1449
|
var require_stringifyString = __commonJS((exports) => {
|
|
1450
1450
|
var Scalar = require_Scalar();
|
|
1451
1451
|
var foldFlowLines = require_foldFlowLines();
|
|
@@ -1743,7 +1743,7 @@ ${indent}`);
|
|
|
1743
1743
|
exports.stringifyString = stringifyString;
|
|
1744
1744
|
});
|
|
1745
1745
|
|
|
1746
|
-
// ../../node_modules/.
|
|
1746
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/stringify/stringify.js
|
|
1747
1747
|
var require_stringify = __commonJS((exports) => {
|
|
1748
1748
|
var anchors = require_anchors();
|
|
1749
1749
|
var identity = require_identity();
|
|
@@ -1864,7 +1864,7 @@ ${ctx.indent}${str}`;
|
|
|
1864
1864
|
exports.stringify = stringify;
|
|
1865
1865
|
});
|
|
1866
1866
|
|
|
1867
|
-
// ../../node_modules/.
|
|
1867
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/stringify/stringifyPair.js
|
|
1868
1868
|
var require_stringifyPair = __commonJS((exports) => {
|
|
1869
1869
|
var identity = require_identity();
|
|
1870
1870
|
var Scalar = require_Scalar();
|
|
@@ -2000,7 +2000,7 @@ ${ctx.indent}`;
|
|
|
2000
2000
|
exports.stringifyPair = stringifyPair;
|
|
2001
2001
|
});
|
|
2002
2002
|
|
|
2003
|
-
// ../../node_modules/.
|
|
2003
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/log.js
|
|
2004
2004
|
var require_log = __commonJS((exports) => {
|
|
2005
2005
|
var node_process = __require("process");
|
|
2006
2006
|
function debug(logLevel, ...messages) {
|
|
@@ -2019,7 +2019,7 @@ var require_log = __commonJS((exports) => {
|
|
|
2019
2019
|
exports.warn = warn;
|
|
2020
2020
|
});
|
|
2021
2021
|
|
|
2022
|
-
// ../../node_modules/.
|
|
2022
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/merge.js
|
|
2023
2023
|
var require_merge = __commonJS((exports) => {
|
|
2024
2024
|
var identity = require_identity();
|
|
2025
2025
|
var Scalar = require_Scalar();
|
|
@@ -2076,7 +2076,7 @@ var require_merge = __commonJS((exports) => {
|
|
|
2076
2076
|
exports.merge = merge;
|
|
2077
2077
|
});
|
|
2078
2078
|
|
|
2079
|
-
// ../../node_modules/.
|
|
2079
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/addPairToJSMap.js
|
|
2080
2080
|
var require_addPairToJSMap = __commonJS((exports) => {
|
|
2081
2081
|
var log = require_log();
|
|
2082
2082
|
var merge = require_merge();
|
|
@@ -2137,7 +2137,7 @@ var require_addPairToJSMap = __commonJS((exports) => {
|
|
|
2137
2137
|
exports.addPairToJSMap = addPairToJSMap;
|
|
2138
2138
|
});
|
|
2139
2139
|
|
|
2140
|
-
// ../../node_modules/.
|
|
2140
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/Pair.js
|
|
2141
2141
|
var require_Pair = __commonJS((exports) => {
|
|
2142
2142
|
var createNode = require_createNode();
|
|
2143
2143
|
var stringifyPair = require_stringifyPair();
|
|
@@ -2175,7 +2175,7 @@ var require_Pair = __commonJS((exports) => {
|
|
|
2175
2175
|
exports.createPair = createPair;
|
|
2176
2176
|
});
|
|
2177
2177
|
|
|
2178
|
-
// ../../node_modules/.
|
|
2178
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
2179
2179
|
var require_stringifyCollection = __commonJS((exports) => {
|
|
2180
2180
|
var identity = require_identity();
|
|
2181
2181
|
var stringify = require_stringify();
|
|
@@ -2327,7 +2327,7 @@ ${indent}${end}`;
|
|
|
2327
2327
|
exports.stringifyCollection = stringifyCollection;
|
|
2328
2328
|
});
|
|
2329
2329
|
|
|
2330
|
-
// ../../node_modules/.
|
|
2330
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/YAMLMap.js
|
|
2331
2331
|
var require_YAMLMap = __commonJS((exports) => {
|
|
2332
2332
|
var stringifyCollection = require_stringifyCollection();
|
|
2333
2333
|
var addPairToJSMap = require_addPairToJSMap();
|
|
@@ -2454,7 +2454,7 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
2454
2454
|
exports.findPair = findPair;
|
|
2455
2455
|
});
|
|
2456
2456
|
|
|
2457
|
-
// ../../node_modules/.
|
|
2457
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/common/map.js
|
|
2458
2458
|
var require_map = __commonJS((exports) => {
|
|
2459
2459
|
var identity = require_identity();
|
|
2460
2460
|
var YAMLMap = require_YAMLMap();
|
|
@@ -2473,7 +2473,7 @@ var require_map = __commonJS((exports) => {
|
|
|
2473
2473
|
exports.map = map;
|
|
2474
2474
|
});
|
|
2475
2475
|
|
|
2476
|
-
// ../../node_modules/.
|
|
2476
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
2477
2477
|
var require_YAMLSeq = __commonJS((exports) => {
|
|
2478
2478
|
var createNode = require_createNode();
|
|
2479
2479
|
var stringifyCollection = require_stringifyCollection();
|
|
@@ -2566,7 +2566,7 @@ var require_YAMLSeq = __commonJS((exports) => {
|
|
|
2566
2566
|
exports.YAMLSeq = YAMLSeq;
|
|
2567
2567
|
});
|
|
2568
2568
|
|
|
2569
|
-
// ../../node_modules/.
|
|
2569
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/common/seq.js
|
|
2570
2570
|
var require_seq = __commonJS((exports) => {
|
|
2571
2571
|
var identity = require_identity();
|
|
2572
2572
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -2585,7 +2585,7 @@ var require_seq = __commonJS((exports) => {
|
|
|
2585
2585
|
exports.seq = seq;
|
|
2586
2586
|
});
|
|
2587
2587
|
|
|
2588
|
-
// ../../node_modules/.
|
|
2588
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/common/string.js
|
|
2589
2589
|
var require_string = __commonJS((exports) => {
|
|
2590
2590
|
var stringifyString = require_stringifyString();
|
|
2591
2591
|
var string = {
|
|
@@ -2601,7 +2601,7 @@ var require_string = __commonJS((exports) => {
|
|
|
2601
2601
|
exports.string = string;
|
|
2602
2602
|
});
|
|
2603
2603
|
|
|
2604
|
-
// ../../node_modules/.
|
|
2604
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/common/null.js
|
|
2605
2605
|
var require_null = __commonJS((exports) => {
|
|
2606
2606
|
var Scalar = require_Scalar();
|
|
2607
2607
|
var nullTag = {
|
|
@@ -2616,7 +2616,7 @@ var require_null = __commonJS((exports) => {
|
|
|
2616
2616
|
exports.nullTag = nullTag;
|
|
2617
2617
|
});
|
|
2618
2618
|
|
|
2619
|
-
// ../../node_modules/.
|
|
2619
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/core/bool.js
|
|
2620
2620
|
var require_bool = __commonJS((exports) => {
|
|
2621
2621
|
var Scalar = require_Scalar();
|
|
2622
2622
|
var boolTag = {
|
|
@@ -2637,7 +2637,7 @@ var require_bool = __commonJS((exports) => {
|
|
|
2637
2637
|
exports.boolTag = boolTag;
|
|
2638
2638
|
});
|
|
2639
2639
|
|
|
2640
|
-
// ../../node_modules/.
|
|
2640
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/stringify/stringifyNumber.js
|
|
2641
2641
|
var require_stringifyNumber = __commonJS((exports) => {
|
|
2642
2642
|
function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
2643
2643
|
if (typeof value === "bigint")
|
|
@@ -2661,7 +2661,7 @@ var require_stringifyNumber = __commonJS((exports) => {
|
|
|
2661
2661
|
exports.stringifyNumber = stringifyNumber;
|
|
2662
2662
|
});
|
|
2663
2663
|
|
|
2664
|
-
// ../../node_modules/.
|
|
2664
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/core/float.js
|
|
2665
2665
|
var require_float = __commonJS((exports) => {
|
|
2666
2666
|
var Scalar = require_Scalar();
|
|
2667
2667
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -2704,7 +2704,7 @@ var require_float = __commonJS((exports) => {
|
|
|
2704
2704
|
exports.floatNaN = floatNaN;
|
|
2705
2705
|
});
|
|
2706
2706
|
|
|
2707
|
-
// ../../node_modules/.
|
|
2707
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/core/int.js
|
|
2708
2708
|
var require_int = __commonJS((exports) => {
|
|
2709
2709
|
var stringifyNumber = require_stringifyNumber();
|
|
2710
2710
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -2746,7 +2746,7 @@ var require_int = __commonJS((exports) => {
|
|
|
2746
2746
|
exports.intOct = intOct;
|
|
2747
2747
|
});
|
|
2748
2748
|
|
|
2749
|
-
// ../../node_modules/.
|
|
2749
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/core/schema.js
|
|
2750
2750
|
var require_schema = __commonJS((exports) => {
|
|
2751
2751
|
var map = require_map();
|
|
2752
2752
|
var _null = require_null();
|
|
@@ -2771,7 +2771,7 @@ var require_schema = __commonJS((exports) => {
|
|
|
2771
2771
|
exports.schema = schema;
|
|
2772
2772
|
});
|
|
2773
2773
|
|
|
2774
|
-
// ../../node_modules/.
|
|
2774
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/json/schema.js
|
|
2775
2775
|
var require_schema2 = __commonJS((exports) => {
|
|
2776
2776
|
var Scalar = require_Scalar();
|
|
2777
2777
|
var map = require_map();
|
|
@@ -2835,7 +2835,7 @@ var require_schema2 = __commonJS((exports) => {
|
|
|
2835
2835
|
exports.schema = schema;
|
|
2836
2836
|
});
|
|
2837
2837
|
|
|
2838
|
-
// ../../node_modules/.
|
|
2838
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
2839
2839
|
var require_binary = __commonJS((exports) => {
|
|
2840
2840
|
var node_buffer = __require("buffer");
|
|
2841
2841
|
var Scalar = require_Scalar();
|
|
@@ -2890,7 +2890,7 @@ var require_binary = __commonJS((exports) => {
|
|
|
2890
2890
|
exports.binary = binary;
|
|
2891
2891
|
});
|
|
2892
2892
|
|
|
2893
|
-
// ../../node_modules/.
|
|
2893
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
|
|
2894
2894
|
var require_pairs = __commonJS((exports) => {
|
|
2895
2895
|
var identity = require_identity();
|
|
2896
2896
|
var Pair = require_Pair();
|
|
@@ -2965,7 +2965,7 @@ ${cn.comment}` : item.comment;
|
|
|
2965
2965
|
exports.resolvePairs = resolvePairs;
|
|
2966
2966
|
});
|
|
2967
2967
|
|
|
2968
|
-
// ../../node_modules/.
|
|
2968
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/omap.js
|
|
2969
2969
|
var require_omap = __commonJS((exports) => {
|
|
2970
2970
|
var identity = require_identity();
|
|
2971
2971
|
var toJS = require_toJS();
|
|
@@ -3037,7 +3037,7 @@ var require_omap = __commonJS((exports) => {
|
|
|
3037
3037
|
exports.omap = omap;
|
|
3038
3038
|
});
|
|
3039
3039
|
|
|
3040
|
-
// ../../node_modules/.
|
|
3040
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
3041
3041
|
var require_bool2 = __commonJS((exports) => {
|
|
3042
3042
|
var Scalar = require_Scalar();
|
|
3043
3043
|
function boolStringify({ value, source }, ctx) {
|
|
@@ -3066,7 +3066,7 @@ var require_bool2 = __commonJS((exports) => {
|
|
|
3066
3066
|
exports.trueTag = trueTag;
|
|
3067
3067
|
});
|
|
3068
3068
|
|
|
3069
|
-
// ../../node_modules/.
|
|
3069
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/float.js
|
|
3070
3070
|
var require_float2 = __commonJS((exports) => {
|
|
3071
3071
|
var Scalar = require_Scalar();
|
|
3072
3072
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -3112,7 +3112,7 @@ var require_float2 = __commonJS((exports) => {
|
|
|
3112
3112
|
exports.floatNaN = floatNaN;
|
|
3113
3113
|
});
|
|
3114
3114
|
|
|
3115
|
-
// ../../node_modules/.
|
|
3115
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/int.js
|
|
3116
3116
|
var require_int2 = __commonJS((exports) => {
|
|
3117
3117
|
var stringifyNumber = require_stringifyNumber();
|
|
3118
3118
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -3188,7 +3188,7 @@ var require_int2 = __commonJS((exports) => {
|
|
|
3188
3188
|
exports.intOct = intOct;
|
|
3189
3189
|
});
|
|
3190
3190
|
|
|
3191
|
-
// ../../node_modules/.
|
|
3191
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/set.js
|
|
3192
3192
|
var require_set = __commonJS((exports) => {
|
|
3193
3193
|
var identity = require_identity();
|
|
3194
3194
|
var Pair = require_Pair();
|
|
@@ -3271,7 +3271,7 @@ var require_set = __commonJS((exports) => {
|
|
|
3271
3271
|
exports.set = set;
|
|
3272
3272
|
});
|
|
3273
3273
|
|
|
3274
|
-
// ../../node_modules/.
|
|
3274
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
|
|
3275
3275
|
var require_timestamp = __commonJS((exports) => {
|
|
3276
3276
|
var stringifyNumber = require_stringifyNumber();
|
|
3277
3277
|
function parseSexagesimal(str, asBigInt) {
|
|
@@ -3353,7 +3353,7 @@ var require_timestamp = __commonJS((exports) => {
|
|
|
3353
3353
|
exports.timestamp = timestamp;
|
|
3354
3354
|
});
|
|
3355
3355
|
|
|
3356
|
-
// ../../node_modules/.
|
|
3356
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
3357
3357
|
var require_schema3 = __commonJS((exports) => {
|
|
3358
3358
|
var map = require_map();
|
|
3359
3359
|
var _null = require_null();
|
|
@@ -3394,7 +3394,7 @@ var require_schema3 = __commonJS((exports) => {
|
|
|
3394
3394
|
exports.schema = schema;
|
|
3395
3395
|
});
|
|
3396
3396
|
|
|
3397
|
-
// ../../node_modules/.
|
|
3397
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/tags.js
|
|
3398
3398
|
var require_tags = __commonJS((exports) => {
|
|
3399
3399
|
var map = require_map();
|
|
3400
3400
|
var _null = require_null();
|
|
@@ -3485,7 +3485,7 @@ var require_tags = __commonJS((exports) => {
|
|
|
3485
3485
|
exports.getTags = getTags;
|
|
3486
3486
|
});
|
|
3487
3487
|
|
|
3488
|
-
// ../../node_modules/.
|
|
3488
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/schema/Schema.js
|
|
3489
3489
|
var require_Schema = __commonJS((exports) => {
|
|
3490
3490
|
var identity = require_identity();
|
|
3491
3491
|
var map = require_map();
|
|
@@ -3515,7 +3515,7 @@ var require_Schema = __commonJS((exports) => {
|
|
|
3515
3515
|
exports.Schema = Schema;
|
|
3516
3516
|
});
|
|
3517
3517
|
|
|
3518
|
-
// ../../node_modules/.
|
|
3518
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
3519
3519
|
var require_stringifyDocument = __commonJS((exports) => {
|
|
3520
3520
|
var identity = require_identity();
|
|
3521
3521
|
var stringify = require_stringify();
|
|
@@ -3595,7 +3595,7 @@ var require_stringifyDocument = __commonJS((exports) => {
|
|
|
3595
3595
|
exports.stringifyDocument = stringifyDocument;
|
|
3596
3596
|
});
|
|
3597
3597
|
|
|
3598
|
-
// ../../node_modules/.
|
|
3598
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/doc/Document.js
|
|
3599
3599
|
var require_Document = __commonJS((exports) => {
|
|
3600
3600
|
var Alias = require_Alias();
|
|
3601
3601
|
var Collection = require_Collection();
|
|
@@ -3830,7 +3830,7 @@ var require_Document = __commonJS((exports) => {
|
|
|
3830
3830
|
exports.Document = Document;
|
|
3831
3831
|
});
|
|
3832
3832
|
|
|
3833
|
-
// ../../node_modules/.
|
|
3833
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/errors.js
|
|
3834
3834
|
var require_errors = __commonJS((exports) => {
|
|
3835
3835
|
class YAMLError extends Error {
|
|
3836
3836
|
constructor(name, pos, code, message) {
|
|
@@ -3895,7 +3895,7 @@ ${pointer}
|
|
|
3895
3895
|
exports.prettifyError = prettifyError;
|
|
3896
3896
|
});
|
|
3897
3897
|
|
|
3898
|
-
// ../../node_modules/.
|
|
3898
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/resolve-props.js
|
|
3899
3899
|
var require_resolve_props = __commonJS((exports) => {
|
|
3900
3900
|
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
|
|
3901
3901
|
let spaceBefore = false;
|
|
@@ -4025,7 +4025,7 @@ var require_resolve_props = __commonJS((exports) => {
|
|
|
4025
4025
|
exports.resolveProps = resolveProps;
|
|
4026
4026
|
});
|
|
4027
4027
|
|
|
4028
|
-
// ../../node_modules/.
|
|
4028
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/util-contains-newline.js
|
|
4029
4029
|
var require_util_contains_newline = __commonJS((exports) => {
|
|
4030
4030
|
function containsNewline(key) {
|
|
4031
4031
|
if (!key)
|
|
@@ -4065,7 +4065,7 @@ var require_util_contains_newline = __commonJS((exports) => {
|
|
|
4065
4065
|
exports.containsNewline = containsNewline;
|
|
4066
4066
|
});
|
|
4067
4067
|
|
|
4068
|
-
// ../../node_modules/.
|
|
4068
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/util-flow-indent-check.js
|
|
4069
4069
|
var require_util_flow_indent_check = __commonJS((exports) => {
|
|
4070
4070
|
var utilContainsNewline = require_util_contains_newline();
|
|
4071
4071
|
function flowIndentCheck(indent, fc, onError) {
|
|
@@ -4080,7 +4080,7 @@ var require_util_flow_indent_check = __commonJS((exports) => {
|
|
|
4080
4080
|
exports.flowIndentCheck = flowIndentCheck;
|
|
4081
4081
|
});
|
|
4082
4082
|
|
|
4083
|
-
// ../../node_modules/.
|
|
4083
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/util-map-includes.js
|
|
4084
4084
|
var require_util_map_includes = __commonJS((exports) => {
|
|
4085
4085
|
var identity = require_identity();
|
|
4086
4086
|
function mapIncludes(ctx, items, search) {
|
|
@@ -4093,7 +4093,7 @@ var require_util_map_includes = __commonJS((exports) => {
|
|
|
4093
4093
|
exports.mapIncludes = mapIncludes;
|
|
4094
4094
|
});
|
|
4095
4095
|
|
|
4096
|
-
// ../../node_modules/.
|
|
4096
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/resolve-block-map.js
|
|
4097
4097
|
var require_resolve_block_map = __commonJS((exports) => {
|
|
4098
4098
|
var Pair = require_Pair();
|
|
4099
4099
|
var YAMLMap = require_YAMLMap();
|
|
@@ -4200,7 +4200,7 @@ var require_resolve_block_map = __commonJS((exports) => {
|
|
|
4200
4200
|
exports.resolveBlockMap = resolveBlockMap;
|
|
4201
4201
|
});
|
|
4202
4202
|
|
|
4203
|
-
// ../../node_modules/.
|
|
4203
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/resolve-block-seq.js
|
|
4204
4204
|
var require_resolve_block_seq = __commonJS((exports) => {
|
|
4205
4205
|
var YAMLSeq = require_YAMLSeq();
|
|
4206
4206
|
var resolveProps = require_resolve_props();
|
|
@@ -4248,7 +4248,7 @@ var require_resolve_block_seq = __commonJS((exports) => {
|
|
|
4248
4248
|
exports.resolveBlockSeq = resolveBlockSeq;
|
|
4249
4249
|
});
|
|
4250
4250
|
|
|
4251
|
-
// ../../node_modules/.
|
|
4251
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/resolve-end.js
|
|
4252
4252
|
var require_resolve_end = __commonJS((exports) => {
|
|
4253
4253
|
function resolveEnd(end, offset, reqSpace, onError) {
|
|
4254
4254
|
let comment = "";
|
|
@@ -4288,7 +4288,7 @@ var require_resolve_end = __commonJS((exports) => {
|
|
|
4288
4288
|
exports.resolveEnd = resolveEnd;
|
|
4289
4289
|
});
|
|
4290
4290
|
|
|
4291
|
-
// ../../node_modules/.
|
|
4291
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/resolve-flow-collection.js
|
|
4292
4292
|
var require_resolve_flow_collection = __commonJS((exports) => {
|
|
4293
4293
|
var identity = require_identity();
|
|
4294
4294
|
var Pair = require_Pair();
|
|
@@ -4479,7 +4479,7 @@ var require_resolve_flow_collection = __commonJS((exports) => {
|
|
|
4479
4479
|
exports.resolveFlowCollection = resolveFlowCollection;
|
|
4480
4480
|
});
|
|
4481
4481
|
|
|
4482
|
-
// ../../node_modules/.
|
|
4482
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/compose-collection.js
|
|
4483
4483
|
var require_compose_collection = __commonJS((exports) => {
|
|
4484
4484
|
var identity = require_identity();
|
|
4485
4485
|
var Scalar = require_Scalar();
|
|
@@ -4541,7 +4541,7 @@ var require_compose_collection = __commonJS((exports) => {
|
|
|
4541
4541
|
exports.composeCollection = composeCollection;
|
|
4542
4542
|
});
|
|
4543
4543
|
|
|
4544
|
-
// ../../node_modules/.
|
|
4544
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/resolve-block-scalar.js
|
|
4545
4545
|
var require_resolve_block_scalar = __commonJS((exports) => {
|
|
4546
4546
|
var Scalar = require_Scalar();
|
|
4547
4547
|
function resolveBlockScalar(ctx, scalar, onError) {
|
|
@@ -4734,7 +4734,7 @@ var require_resolve_block_scalar = __commonJS((exports) => {
|
|
|
4734
4734
|
exports.resolveBlockScalar = resolveBlockScalar;
|
|
4735
4735
|
});
|
|
4736
4736
|
|
|
4737
|
-
// ../../node_modules/.
|
|
4737
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/resolve-flow-scalar.js
|
|
4738
4738
|
var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
4739
4739
|
var Scalar = require_Scalar();
|
|
4740
4740
|
var resolveEnd = require_resolve_end();
|
|
@@ -4951,7 +4951,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
4951
4951
|
exports.resolveFlowScalar = resolveFlowScalar;
|
|
4952
4952
|
});
|
|
4953
4953
|
|
|
4954
|
-
// ../../node_modules/.
|
|
4954
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/compose-scalar.js
|
|
4955
4955
|
var require_compose_scalar = __commonJS((exports) => {
|
|
4956
4956
|
var identity = require_identity();
|
|
4957
4957
|
var Scalar = require_Scalar();
|
|
@@ -5029,7 +5029,7 @@ var require_compose_scalar = __commonJS((exports) => {
|
|
|
5029
5029
|
exports.composeScalar = composeScalar;
|
|
5030
5030
|
});
|
|
5031
5031
|
|
|
5032
|
-
// ../../node_modules/.
|
|
5032
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/util-empty-scalar-position.js
|
|
5033
5033
|
var require_util_empty_scalar_position = __commonJS((exports) => {
|
|
5034
5034
|
function emptyScalarPosition(offset, before, pos) {
|
|
5035
5035
|
if (before) {
|
|
@@ -5056,7 +5056,7 @@ var require_util_empty_scalar_position = __commonJS((exports) => {
|
|
|
5056
5056
|
exports.emptyScalarPosition = emptyScalarPosition;
|
|
5057
5057
|
});
|
|
5058
5058
|
|
|
5059
|
-
// ../../node_modules/.
|
|
5059
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/compose-node.js
|
|
5060
5060
|
var require_compose_node = __commonJS((exports) => {
|
|
5061
5061
|
var Alias = require_Alias();
|
|
5062
5062
|
var identity = require_identity();
|
|
@@ -5159,7 +5159,7 @@ var require_compose_node = __commonJS((exports) => {
|
|
|
5159
5159
|
exports.composeNode = composeNode;
|
|
5160
5160
|
});
|
|
5161
5161
|
|
|
5162
|
-
// ../../node_modules/.
|
|
5162
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/compose-doc.js
|
|
5163
5163
|
var require_compose_doc = __commonJS((exports) => {
|
|
5164
5164
|
var Document = require_Document();
|
|
5165
5165
|
var composeNode = require_compose_node();
|
|
@@ -5199,7 +5199,7 @@ var require_compose_doc = __commonJS((exports) => {
|
|
|
5199
5199
|
exports.composeDoc = composeDoc;
|
|
5200
5200
|
});
|
|
5201
5201
|
|
|
5202
|
-
// ../../node_modules/.
|
|
5202
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/compose/composer.js
|
|
5203
5203
|
var require_composer = __commonJS((exports) => {
|
|
5204
5204
|
var node_process = __require("process");
|
|
5205
5205
|
var directives = require_directives();
|
|
@@ -5285,10 +5285,8 @@ ${cb}` : comment;
|
|
|
5285
5285
|
}
|
|
5286
5286
|
}
|
|
5287
5287
|
if (afterDoc) {
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
for (let i = 0;i < this.warnings.length; ++i)
|
|
5291
|
-
doc.warnings.push(this.warnings[i]);
|
|
5288
|
+
Array.prototype.push.apply(doc.errors, this.errors);
|
|
5289
|
+
Array.prototype.push.apply(doc.warnings, this.warnings);
|
|
5292
5290
|
} else {
|
|
5293
5291
|
doc.errors = this.errors;
|
|
5294
5292
|
doc.warnings = this.warnings;
|
|
@@ -5390,7 +5388,7 @@ ${end.comment}` : end.comment;
|
|
|
5390
5388
|
exports.Composer = Composer;
|
|
5391
5389
|
});
|
|
5392
5390
|
|
|
5393
|
-
// ../../node_modules/.
|
|
5391
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/parse/cst-scalar.js
|
|
5394
5392
|
var require_cst_scalar = __commonJS((exports) => {
|
|
5395
5393
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
5396
5394
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
@@ -5580,7 +5578,7 @@ var require_cst_scalar = __commonJS((exports) => {
|
|
|
5580
5578
|
exports.setScalarValue = setScalarValue;
|
|
5581
5579
|
});
|
|
5582
5580
|
|
|
5583
|
-
// ../../node_modules/.
|
|
5581
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/parse/cst-stringify.js
|
|
5584
5582
|
var require_cst_stringify = __commonJS((exports) => {
|
|
5585
5583
|
var stringify = (cst) => ("type" in cst) ? stringifyToken(cst) : stringifyItem(cst);
|
|
5586
5584
|
function stringifyToken(token) {
|
|
@@ -5638,7 +5636,7 @@ var require_cst_stringify = __commonJS((exports) => {
|
|
|
5638
5636
|
exports.stringify = stringify;
|
|
5639
5637
|
});
|
|
5640
5638
|
|
|
5641
|
-
// ../../node_modules/.
|
|
5639
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/parse/cst-visit.js
|
|
5642
5640
|
var require_cst_visit = __commonJS((exports) => {
|
|
5643
5641
|
var BREAK = Symbol("break visit");
|
|
5644
5642
|
var SKIP = Symbol("skip children");
|
|
@@ -5697,7 +5695,7 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
5697
5695
|
exports.visit = visit;
|
|
5698
5696
|
});
|
|
5699
5697
|
|
|
5700
|
-
// ../../node_modules/.
|
|
5698
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/parse/cst.js
|
|
5701
5699
|
var require_cst = __commonJS((exports) => {
|
|
5702
5700
|
var cstScalar = require_cst_scalar();
|
|
5703
5701
|
var cstStringify = require_cst_stringify();
|
|
@@ -5798,7 +5796,7 @@ var require_cst = __commonJS((exports) => {
|
|
|
5798
5796
|
exports.tokenType = tokenType;
|
|
5799
5797
|
});
|
|
5800
5798
|
|
|
5801
|
-
// ../../node_modules/.
|
|
5799
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/parse/lexer.js
|
|
5802
5800
|
var require_lexer = __commonJS((exports) => {
|
|
5803
5801
|
var cst = require_cst();
|
|
5804
5802
|
function isEmpty(ch) {
|
|
@@ -6000,7 +5998,7 @@ var require_lexer = __commonJS((exports) => {
|
|
|
6000
5998
|
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
|
|
6001
5999
|
this.indentNext = this.indentValue + 1;
|
|
6002
6000
|
this.indentValue += n;
|
|
6003
|
-
return
|
|
6001
|
+
return yield* this.parseBlockStart();
|
|
6004
6002
|
}
|
|
6005
6003
|
return "doc";
|
|
6006
6004
|
}
|
|
@@ -6307,37 +6305,26 @@ var require_lexer = __commonJS((exports) => {
|
|
|
6307
6305
|
return 0;
|
|
6308
6306
|
}
|
|
6309
6307
|
*pushIndicators() {
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
const ch1 = this.charAt(1);
|
|
6327
|
-
if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
|
|
6328
|
-
if (!inFlow)
|
|
6329
|
-
this.indentNext = this.indentValue + 1;
|
|
6330
|
-
else if (this.flowKey)
|
|
6331
|
-
this.flowKey = false;
|
|
6332
|
-
n += yield* this.pushCount(1);
|
|
6333
|
-
n += yield* this.pushSpaces(true);
|
|
6334
|
-
continue loop;
|
|
6335
|
-
}
|
|
6336
|
-
}
|
|
6308
|
+
switch (this.charAt(0)) {
|
|
6309
|
+
case "!":
|
|
6310
|
+
return (yield* this.pushTag()) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
|
|
6311
|
+
case "&":
|
|
6312
|
+
return (yield* this.pushUntil(isNotAnchorChar)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
|
|
6313
|
+
case "-":
|
|
6314
|
+
case "?":
|
|
6315
|
+
case ":": {
|
|
6316
|
+
const inFlow = this.flowLevel > 0;
|
|
6317
|
+
const ch1 = this.charAt(1);
|
|
6318
|
+
if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
|
|
6319
|
+
if (!inFlow)
|
|
6320
|
+
this.indentNext = this.indentValue + 1;
|
|
6321
|
+
else if (this.flowKey)
|
|
6322
|
+
this.flowKey = false;
|
|
6323
|
+
return (yield* this.pushCount(1)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
|
|
6337
6324
|
}
|
|
6338
|
-
break loop;
|
|
6339
6325
|
}
|
|
6340
|
-
|
|
6326
|
+
}
|
|
6327
|
+
return 0;
|
|
6341
6328
|
}
|
|
6342
6329
|
*pushTag() {
|
|
6343
6330
|
if (this.charAt(1) === "<") {
|
|
@@ -6395,7 +6382,7 @@ var require_lexer = __commonJS((exports) => {
|
|
|
6395
6382
|
exports.Lexer = Lexer;
|
|
6396
6383
|
});
|
|
6397
6384
|
|
|
6398
|
-
// ../../node_modules/.
|
|
6385
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/parse/line-counter.js
|
|
6399
6386
|
var require_line_counter = __commonJS((exports) => {
|
|
6400
6387
|
class LineCounter {
|
|
6401
6388
|
constructor() {
|
|
@@ -6423,7 +6410,7 @@ var require_line_counter = __commonJS((exports) => {
|
|
|
6423
6410
|
exports.LineCounter = LineCounter;
|
|
6424
6411
|
});
|
|
6425
6412
|
|
|
6426
|
-
// ../../node_modules/.
|
|
6413
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/parse/parser.js
|
|
6427
6414
|
var require_parser = __commonJS((exports) => {
|
|
6428
6415
|
var node_process = __require("process");
|
|
6429
6416
|
var cst = require_cst();
|
|
@@ -6491,13 +6478,6 @@ var require_parser = __commonJS((exports) => {
|
|
|
6491
6478
|
while (prev[++i]?.type === "space") {}
|
|
6492
6479
|
return prev.splice(i, prev.length);
|
|
6493
6480
|
}
|
|
6494
|
-
function arrayPushArray(target, source) {
|
|
6495
|
-
if (source.length < 1e5)
|
|
6496
|
-
Array.prototype.push.apply(target, source);
|
|
6497
|
-
else
|
|
6498
|
-
for (let i = 0;i < source.length; ++i)
|
|
6499
|
-
target.push(source[i]);
|
|
6500
|
-
}
|
|
6501
6481
|
function fixFlowSeqItems(fc) {
|
|
6502
6482
|
if (fc.start.type === "flow-seq-start") {
|
|
6503
6483
|
for (const it of fc.items) {
|
|
@@ -6507,11 +6487,11 @@ var require_parser = __commonJS((exports) => {
|
|
|
6507
6487
|
delete it.key;
|
|
6508
6488
|
if (isFlowToken(it.value)) {
|
|
6509
6489
|
if (it.value.end)
|
|
6510
|
-
|
|
6490
|
+
Array.prototype.push.apply(it.value.end, it.sep);
|
|
6511
6491
|
else
|
|
6512
6492
|
it.value.end = it.sep;
|
|
6513
6493
|
} else
|
|
6514
|
-
|
|
6494
|
+
Array.prototype.push.apply(it.start, it.sep);
|
|
6515
6495
|
delete it.sep;
|
|
6516
6496
|
}
|
|
6517
6497
|
}
|
|
@@ -6851,7 +6831,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
6851
6831
|
const prev = map.items[map.items.length - 2];
|
|
6852
6832
|
const end = prev?.value?.end;
|
|
6853
6833
|
if (Array.isArray(end)) {
|
|
6854
|
-
|
|
6834
|
+
Array.prototype.push.apply(end, it.start);
|
|
6855
6835
|
end.push(this.sourceToken);
|
|
6856
6836
|
map.items.pop();
|
|
6857
6837
|
return;
|
|
@@ -7039,7 +7019,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
7039
7019
|
const prev = seq.items[seq.items.length - 2];
|
|
7040
7020
|
const end = prev?.value?.end;
|
|
7041
7021
|
if (Array.isArray(end)) {
|
|
7042
|
-
|
|
7022
|
+
Array.prototype.push.apply(end, it.start);
|
|
7043
7023
|
end.push(this.sourceToken);
|
|
7044
7024
|
seq.items.pop();
|
|
7045
7025
|
return;
|
|
@@ -7279,7 +7259,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
7279
7259
|
exports.Parser = Parser;
|
|
7280
7260
|
});
|
|
7281
7261
|
|
|
7282
|
-
// ../../node_modules/.
|
|
7262
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/public-api.js
|
|
7283
7263
|
var require_public_api = __commonJS((exports) => {
|
|
7284
7264
|
var composer = require_composer();
|
|
7285
7265
|
var Document = require_Document();
|
|
@@ -7373,7 +7353,7 @@ var require_public_api = __commonJS((exports) => {
|
|
|
7373
7353
|
exports.stringify = stringify;
|
|
7374
7354
|
});
|
|
7375
7355
|
|
|
7376
|
-
// ../../node_modules/.
|
|
7356
|
+
// ../../node_modules/.pnpm/yaml@2.8.4/node_modules/yaml/dist/index.js
|
|
7377
7357
|
var require_dist = __commonJS((exports) => {
|
|
7378
7358
|
var composer = require_composer();
|
|
7379
7359
|
var Document = require_Document();
|
|
@@ -7426,7 +7406,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7426
7406
|
var require_package = __commonJS((exports, module) => {
|
|
7427
7407
|
module.exports = {
|
|
7428
7408
|
name: "@ai-setting/roy-agent-cli",
|
|
7429
|
-
version: "1.6.
|
|
7409
|
+
version: "1.6.1",
|
|
7430
7410
|
type: "module",
|
|
7431
7411
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7432
7412
|
main: "./dist/index.js",
|
|
@@ -7936,21 +7916,30 @@ class EnvironmentService {
|
|
|
7936
7916
|
env.registerComponent(memoryComponent);
|
|
7937
7917
|
env.registerComponent(eventSourceComponent);
|
|
7938
7918
|
env.registerComponent(workflowComponent);
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7919
|
+
if (options?.loadPlugins === true) {
|
|
7920
|
+
this.pluginComponent = new PluginComponent;
|
|
7921
|
+
const pluginComponent = this.pluginComponent;
|
|
7922
|
+
await pluginComponent.init({
|
|
7923
|
+
name: "plugin",
|
|
7924
|
+
version: "1.0.0",
|
|
7925
|
+
enabled: true,
|
|
7926
|
+
env,
|
|
7927
|
+
options: {
|
|
7928
|
+
configComponent
|
|
7929
|
+
}
|
|
7930
|
+
});
|
|
7931
|
+
env.registerComponent(pluginComponent);
|
|
7932
|
+
} else {
|
|
7933
|
+
logger.debug(`[EnvironmentService] Skipping PluginComponent init (command=${options?.commandName ?? "<unknown>"}, reason=loadPlugins=false)`);
|
|
7934
|
+
}
|
|
7948
7935
|
await env.init();
|
|
7949
7936
|
await env.start();
|
|
7950
7937
|
await agentComponent.refreshDependencies();
|
|
7951
7938
|
logger.debug("[EnvironmentService] AgentComponent dependencies refreshed after env.start()");
|
|
7952
|
-
if (options?.plugins && options.plugins.length > 0) {
|
|
7939
|
+
if (options?.loadPlugins === true && options?.plugins && options.plugins.length > 0) {
|
|
7953
7940
|
await this.loadPlugins(options.plugins);
|
|
7941
|
+
} else if (options?.loadPlugins !== true && options?.plugins && options.plugins.length > 0) {
|
|
7942
|
+
logger.debug(`[EnvironmentService] Skipping plugin loading because loadPlugins=false (command=${options?.commandName ?? "<unknown>"})`);
|
|
7954
7943
|
}
|
|
7955
7944
|
this.environment = env;
|
|
7956
7945
|
return env;
|
|
@@ -8664,7 +8653,9 @@ function createActCommand(externalEnvService) {
|
|
|
8664
8653
|
await envService.create({
|
|
8665
8654
|
envName: args.env,
|
|
8666
8655
|
configPath: args.config,
|
|
8667
|
-
plugins: [...otherPluginNames, ...coderPluginNames]
|
|
8656
|
+
plugins: [...otherPluginNames, ...coderPluginNames],
|
|
8657
|
+
loadPlugins: true,
|
|
8658
|
+
commandName: "act"
|
|
8668
8659
|
});
|
|
8669
8660
|
}
|
|
8670
8661
|
const env = envService.getEnvironment();
|
|
@@ -10575,7 +10566,9 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10575
10566
|
if (!externalEnvService) {
|
|
10576
10567
|
await envService.create({
|
|
10577
10568
|
configPath: args.config,
|
|
10578
|
-
plugins: [...componentPluginNames, ...coderPluginNames]
|
|
10569
|
+
plugins: [...componentPluginNames, ...coderPluginNames],
|
|
10570
|
+
loadPlugins: true,
|
|
10571
|
+
commandName: "interactive"
|
|
10579
10572
|
});
|
|
10580
10573
|
}
|
|
10581
10574
|
const env = envService.getEnvironment();
|
|
@@ -11056,6 +11049,42 @@ function inferStatus(session) {
|
|
|
11056
11049
|
return status;
|
|
11057
11050
|
return null;
|
|
11058
11051
|
}
|
|
11052
|
+
async function expandSessionAncestors(sessionComponent, sessions) {
|
|
11053
|
+
const sessionById = new Map;
|
|
11054
|
+
for (const s of sessions)
|
|
11055
|
+
sessionById.set(s.id, s);
|
|
11056
|
+
const queue = [];
|
|
11057
|
+
const visited = new Set;
|
|
11058
|
+
for (const s of sessions) {
|
|
11059
|
+
const pid = s.parentSessionId;
|
|
11060
|
+
if (pid !== null && pid !== undefined && pid !== "" && !sessionById.has(pid) && !visited.has(pid)) {
|
|
11061
|
+
queue.push(pid);
|
|
11062
|
+
visited.add(pid);
|
|
11063
|
+
}
|
|
11064
|
+
}
|
|
11065
|
+
while (queue.length > 0) {
|
|
11066
|
+
const id = queue.shift();
|
|
11067
|
+
const parent = await sessionComponent.get(id);
|
|
11068
|
+
if (!parent)
|
|
11069
|
+
continue;
|
|
11070
|
+
sessionById.set(parent.id, parent);
|
|
11071
|
+
const ppid = parent.parentSessionId;
|
|
11072
|
+
if (ppid !== null && ppid !== undefined && ppid !== "" && !sessionById.has(ppid) && !visited.has(ppid)) {
|
|
11073
|
+
queue.push(ppid);
|
|
11074
|
+
visited.add(ppid);
|
|
11075
|
+
}
|
|
11076
|
+
}
|
|
11077
|
+
const orderedIds = [];
|
|
11078
|
+
for (const s of sessions) {
|
|
11079
|
+
if (!orderedIds.includes(s.id))
|
|
11080
|
+
orderedIds.push(s.id);
|
|
11081
|
+
}
|
|
11082
|
+
for (const id of sessionById.keys()) {
|
|
11083
|
+
if (!orderedIds.includes(id))
|
|
11084
|
+
orderedIds.push(id);
|
|
11085
|
+
}
|
|
11086
|
+
return orderedIds.map((id) => sessionById.get(id));
|
|
11087
|
+
}
|
|
11059
11088
|
|
|
11060
11089
|
// src/commands/sessions/list.ts
|
|
11061
11090
|
var ListCommand = {
|
|
@@ -11099,7 +11128,8 @@ var ListCommand = {
|
|
|
11099
11128
|
const totalCount = await sessionComponent.getCount();
|
|
11100
11129
|
const activeSessionId = sessionComponent.getActiveSessionId();
|
|
11101
11130
|
if (args.graph) {
|
|
11102
|
-
const
|
|
11131
|
+
const expandedSessions = await expandSessionAncestors(sessionComponent, sessions);
|
|
11132
|
+
const tree = buildSessionTree(expandedSessions);
|
|
11103
11133
|
output.log(renderSessionTree(tree, { useShortId: args.shortId === true }));
|
|
11104
11134
|
return;
|
|
11105
11135
|
}
|
|
@@ -12753,7 +12783,7 @@ var SessionsCommand = {
|
|
|
12753
12783
|
};
|
|
12754
12784
|
|
|
12755
12785
|
// src/commands/tasks/list.ts
|
|
12756
|
-
import
|
|
12786
|
+
import chalk19 from "chalk";
|
|
12757
12787
|
|
|
12758
12788
|
// src/commands/tasks/_build-list-json.ts
|
|
12759
12789
|
function buildListTasksJson(tasks, total, args, extras) {
|
|
@@ -12782,6 +12812,150 @@ function buildListTasksJson(tasks, total, args, extras) {
|
|
|
12782
12812
|
};
|
|
12783
12813
|
}
|
|
12784
12814
|
|
|
12815
|
+
// src/commands/tasks/task-graph.ts
|
|
12816
|
+
import chalk18 from "chalk";
|
|
12817
|
+
function buildTaskTree(tasks) {
|
|
12818
|
+
const nodeById = new Map;
|
|
12819
|
+
const byParent = new Map;
|
|
12820
|
+
const roots = [];
|
|
12821
|
+
for (const t of tasks) {
|
|
12822
|
+
nodeById.set(t.id, { task: t, children: [] });
|
|
12823
|
+
}
|
|
12824
|
+
for (const t of tasks) {
|
|
12825
|
+
const pid = t.parent_task_id;
|
|
12826
|
+
if (pid !== undefined && pid !== null && nodeById.has(pid)) {
|
|
12827
|
+
const list = byParent.get(pid) || [];
|
|
12828
|
+
list.push(t);
|
|
12829
|
+
byParent.set(pid, list);
|
|
12830
|
+
} else {
|
|
12831
|
+
roots.push(t);
|
|
12832
|
+
}
|
|
12833
|
+
}
|
|
12834
|
+
for (const [parentId, children] of byParent.entries()) {
|
|
12835
|
+
const parentNode = nodeById.get(parentId);
|
|
12836
|
+
children.sort(compareTasksDesc);
|
|
12837
|
+
parentNode.children = children.map((c) => nodeById.get(c.id));
|
|
12838
|
+
}
|
|
12839
|
+
roots.sort(compareTasksDesc);
|
|
12840
|
+
return roots.map((r) => nodeById.get(r.id));
|
|
12841
|
+
}
|
|
12842
|
+
function compareTasksDesc(a, b) {
|
|
12843
|
+
if (a.updatedAt < b.updatedAt)
|
|
12844
|
+
return 1;
|
|
12845
|
+
if (a.updatedAt > b.updatedAt)
|
|
12846
|
+
return -1;
|
|
12847
|
+
if (a.id < b.id)
|
|
12848
|
+
return 1;
|
|
12849
|
+
if (a.id > b.id)
|
|
12850
|
+
return -1;
|
|
12851
|
+
return 0;
|
|
12852
|
+
}
|
|
12853
|
+
async function expandParentChain(taskComponent, tasks) {
|
|
12854
|
+
const taskById = new Map;
|
|
12855
|
+
for (const t of tasks)
|
|
12856
|
+
taskById.set(t.id, t);
|
|
12857
|
+
const queue = [];
|
|
12858
|
+
const visited = new Set;
|
|
12859
|
+
for (const t of tasks) {
|
|
12860
|
+
const pid = t.parent_task_id;
|
|
12861
|
+
if (pid !== undefined && pid !== null && !taskById.has(pid) && !visited.has(pid)) {
|
|
12862
|
+
queue.push(pid);
|
|
12863
|
+
visited.add(pid);
|
|
12864
|
+
}
|
|
12865
|
+
}
|
|
12866
|
+
while (queue.length > 0) {
|
|
12867
|
+
const id = queue.shift();
|
|
12868
|
+
const parent = await taskComponent.getTask(id);
|
|
12869
|
+
if (!parent)
|
|
12870
|
+
continue;
|
|
12871
|
+
taskById.set(parent.id, parent);
|
|
12872
|
+
const ppid = parent.parent_task_id;
|
|
12873
|
+
if (ppid !== undefined && ppid !== null && !taskById.has(ppid) && !visited.has(ppid)) {
|
|
12874
|
+
queue.push(ppid);
|
|
12875
|
+
visited.add(ppid);
|
|
12876
|
+
}
|
|
12877
|
+
}
|
|
12878
|
+
const orderedIds = [];
|
|
12879
|
+
for (const t of tasks) {
|
|
12880
|
+
if (!orderedIds.includes(t.id))
|
|
12881
|
+
orderedIds.push(t.id);
|
|
12882
|
+
}
|
|
12883
|
+
for (const id of taskById.keys()) {
|
|
12884
|
+
if (!orderedIds.includes(id))
|
|
12885
|
+
orderedIds.push(id);
|
|
12886
|
+
}
|
|
12887
|
+
return orderedIds.map((id) => taskById.get(id));
|
|
12888
|
+
}
|
|
12889
|
+
var TASK_TREE_BRANCH = "├─ ";
|
|
12890
|
+
var TASK_TREE_LAST = "└─ ";
|
|
12891
|
+
var TASK_TREE_VERTICAL = "│ ";
|
|
12892
|
+
var TASK_TREE_EMPTY = " ";
|
|
12893
|
+
function renderTaskTree(roots, options = {}) {
|
|
12894
|
+
if (roots.length === 0) {
|
|
12895
|
+
return "No tasks to display.";
|
|
12896
|
+
}
|
|
12897
|
+
const maxDepth = options.maxDepth !== undefined && options.maxDepth < 0 ? undefined : options.maxDepth;
|
|
12898
|
+
const totalCount = countDeep(roots);
|
|
12899
|
+
const headerSuffix = options.rootId !== undefined ? chalk18.gray(` — subtree of #${options.rootId}`) : "";
|
|
12900
|
+
const lines = [
|
|
12901
|
+
chalk18.bold(`Task Tree (${totalCount} tasks, ${roots.length} roots)`) + headerSuffix,
|
|
12902
|
+
""
|
|
12903
|
+
];
|
|
12904
|
+
for (let i = 0;i < roots.length; i++) {
|
|
12905
|
+
const isLast = i === roots.length - 1;
|
|
12906
|
+
renderNode2(roots[i], "", true, isLast, lines, 0, maxDepth);
|
|
12907
|
+
}
|
|
12908
|
+
return lines.join(`
|
|
12909
|
+
`);
|
|
12910
|
+
}
|
|
12911
|
+
function renderNode2(node, prefix, isRoot, isLast, lines, currentDepth, maxDepth) {
|
|
12912
|
+
if (maxDepth !== undefined && currentDepth > maxDepth) {
|
|
12913
|
+
return;
|
|
12914
|
+
}
|
|
12915
|
+
const connector = isRoot ? "" : isLast ? TASK_TREE_LAST : TASK_TREE_BRANCH;
|
|
12916
|
+
const statusColor = colorByStatus(node.task.status);
|
|
12917
|
+
const label = statusColor(formatTaskLabel(node.task));
|
|
12918
|
+
lines.push(prefix + connector + label);
|
|
12919
|
+
if (node.children.length > 0) {
|
|
12920
|
+
const childPrefix = isRoot ? prefix : prefix + (isLast ? TASK_TREE_EMPTY : TASK_TREE_VERTICAL);
|
|
12921
|
+
for (let i = 0;i < node.children.length; i++) {
|
|
12922
|
+
const isChildLast = i === node.children.length - 1;
|
|
12923
|
+
renderNode2(node.children[i], childPrefix, false, isChildLast, lines, currentDepth + 1, maxDepth);
|
|
12924
|
+
}
|
|
12925
|
+
}
|
|
12926
|
+
}
|
|
12927
|
+
function countDeep(roots) {
|
|
12928
|
+
let count = 0;
|
|
12929
|
+
function walk(n) {
|
|
12930
|
+
count++;
|
|
12931
|
+
for (const c of n.children)
|
|
12932
|
+
walk(c);
|
|
12933
|
+
}
|
|
12934
|
+
for (const r of roots)
|
|
12935
|
+
walk(r);
|
|
12936
|
+
return count;
|
|
12937
|
+
}
|
|
12938
|
+
function formatTaskLabel(task) {
|
|
12939
|
+
const idStr = `#${task.id}`;
|
|
12940
|
+
const typeLabel = task.type && task.type !== "normal" ? ` [${task.type}]` : "";
|
|
12941
|
+
const progressLabel = task.progress > 0 ? ` (${task.progress}%)` : "";
|
|
12942
|
+
return `${idStr}${typeLabel} ${task.title} ${chalk18.gray("[" + task.status + "]")}${progressLabel}`;
|
|
12943
|
+
}
|
|
12944
|
+
function colorByStatus(status) {
|
|
12945
|
+
switch (status) {
|
|
12946
|
+
case "completed":
|
|
12947
|
+
return chalk18.green;
|
|
12948
|
+
case "active":
|
|
12949
|
+
return chalk18.blue;
|
|
12950
|
+
case "paused":
|
|
12951
|
+
return chalk18.yellow;
|
|
12952
|
+
case "cancelled":
|
|
12953
|
+
return chalk18.strikethrough;
|
|
12954
|
+
default:
|
|
12955
|
+
return chalk18.gray;
|
|
12956
|
+
}
|
|
12957
|
+
}
|
|
12958
|
+
|
|
12785
12959
|
// src/commands/tasks/list.ts
|
|
12786
12960
|
var ListCommand2 = {
|
|
12787
12961
|
command: "list",
|
|
@@ -12808,7 +12982,7 @@ var ListCommand2 = {
|
|
|
12808
12982
|
type: "boolean",
|
|
12809
12983
|
default: false,
|
|
12810
12984
|
description: "是否包含已归档任务(status=archived 的任务默认被排除)"
|
|
12811
|
-
}).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }).option("quiet", { alias: "q", type: "boolean", hidden: true }),
|
|
12985
|
+
}).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: "以层次化树形结构展示任务父子关系" }),
|
|
12812
12986
|
async handler(args) {
|
|
12813
12987
|
const output = new OutputService2;
|
|
12814
12988
|
const envService = new EnvironmentService(output);
|
|
@@ -12836,6 +13010,12 @@ var ListCommand2 = {
|
|
|
12836
13010
|
const listResult = await taskComponent.listTasks(listOptions);
|
|
12837
13011
|
const tasks = listResult.tasks;
|
|
12838
13012
|
const total = listResult.total;
|
|
13013
|
+
if (args.graph) {
|
|
13014
|
+
const expandedTasks = await expandParentChain(taskComponent, tasks);
|
|
13015
|
+
const tree = buildTaskTree(expandedTasks);
|
|
13016
|
+
output.log(renderTaskTree(tree, { maxDepth: args.depth }));
|
|
13017
|
+
return;
|
|
13018
|
+
}
|
|
12839
13019
|
if (args.json) {
|
|
12840
13020
|
output.json(buildListTasksJson(tasks, total, args));
|
|
12841
13021
|
} else if (args.quiet) {
|
|
@@ -12851,17 +13031,17 @@ var ListCommand2 = {
|
|
|
12851
13031
|
output.log(hint);
|
|
12852
13032
|
} else {
|
|
12853
13033
|
const header = [
|
|
12854
|
-
|
|
12855
|
-
|
|
12856
|
-
|
|
12857
|
-
|
|
12858
|
-
|
|
12859
|
-
|
|
12860
|
-
|
|
13034
|
+
chalk19.bold("#"),
|
|
13035
|
+
chalk19.bold("Title"),
|
|
13036
|
+
chalk19.bold("Status"),
|
|
13037
|
+
chalk19.bold("Priority"),
|
|
13038
|
+
chalk19.bold("Type"),
|
|
13039
|
+
chalk19.bold("Progress"),
|
|
13040
|
+
chalk19.bold("Parent")
|
|
12861
13041
|
].join(" │ ");
|
|
12862
13042
|
const rows = tasks.map((t, i) => {
|
|
12863
|
-
const statusColor = t.status === "completed" ?
|
|
12864
|
-
const priorityColor = t.priority === "high" ?
|
|
13043
|
+
const statusColor = t.status === "completed" ? chalk19.green : t.status === "active" ? chalk19.blue : t.status === "paused" ? chalk19.yellow : t.status === "cancelled" ? chalk19.strikethrough : chalk19.gray;
|
|
13044
|
+
const priorityColor = t.priority === "high" ? chalk19.red : t.priority === "medium" ? chalk19.yellow : chalk19.gray;
|
|
12865
13045
|
return [
|
|
12866
13046
|
(args.offset + i + 1).toString(),
|
|
12867
13047
|
t.title.length > 30 ? t.title.slice(0, 27) + "..." : t.title,
|
|
@@ -12869,11 +13049,11 @@ var ListCommand2 = {
|
|
|
12869
13049
|
priorityColor(t.priority),
|
|
12870
13050
|
t.type || "normal",
|
|
12871
13051
|
`${t.progress}%`,
|
|
12872
|
-
t.parent_task_id ? `#${t.parent_task_id}` :
|
|
13052
|
+
t.parent_task_id ? `#${t.parent_task_id}` : chalk19.gray("root")
|
|
12873
13053
|
].join(" │ ");
|
|
12874
13054
|
});
|
|
12875
|
-
const depthNote = args.depth !== undefined ?
|
|
12876
|
-
const archivedNote = args.includeArchived ?
|
|
13055
|
+
const depthNote = args.depth !== undefined ? chalk19.gray(` depth=${args.depth}`) : "";
|
|
13056
|
+
const archivedNote = args.includeArchived ? chalk19.gray(" include-archived") : "";
|
|
12877
13057
|
output.log([
|
|
12878
13058
|
`┌─ Tasks ${"─".repeat(55)}┐`,
|
|
12879
13059
|
`│${header}│`,
|
|
@@ -12881,7 +13061,7 @@ var ListCommand2 = {
|
|
|
12881
13061
|
...rows.map((r) => `│${r}│`),
|
|
12882
13062
|
"└" + "─".repeat(header.length + 2) + "┘",
|
|
12883
13063
|
"",
|
|
12884
|
-
|
|
13064
|
+
chalk19.gray(`Showing ${tasks.length} of ${total} tasks (offset=${args.offset}, limit=${args.limit})${depthNote}${archivedNote}`)
|
|
12885
13065
|
].join(`
|
|
12886
13066
|
`));
|
|
12887
13067
|
}
|
|
@@ -12895,7 +13075,7 @@ var ListCommand2 = {
|
|
|
12895
13075
|
};
|
|
12896
13076
|
|
|
12897
13077
|
// src/commands/tasks/get.ts
|
|
12898
|
-
import
|
|
13078
|
+
import chalk20 from "chalk";
|
|
12899
13079
|
var GetCommand2 = {
|
|
12900
13080
|
command: "get <id>",
|
|
12901
13081
|
aliases: ["show"],
|
|
@@ -12934,10 +13114,10 @@ var GetCommand2 = {
|
|
|
12934
13114
|
if (args.json) {
|
|
12935
13115
|
output.json(result);
|
|
12936
13116
|
} else {
|
|
12937
|
-
output.log(
|
|
13117
|
+
output.log(chalk20.bold(`
|
|
12938
13118
|
Task #${result.task.id}: ${result.task.title}
|
|
12939
13119
|
`));
|
|
12940
|
-
output.log(`Status: ${
|
|
13120
|
+
output.log(`Status: ${chalk20.blue(result.task.status)} | Priority: ${result.task.priority} | Type: ${result.task.type} | Progress: ${result.task.progress}%`);
|
|
12941
13121
|
output.log(`Created: ${result.task.createdAt} | Updated: ${result.task.updatedAt}`);
|
|
12942
13122
|
output.log(`Project Path: ${result.task.project_path}`);
|
|
12943
13123
|
output.log(`Context: ${result.task.context}`);
|
|
@@ -12945,7 +13125,7 @@ Task #${result.task.id}: ${result.task.title}
|
|
|
12945
13125
|
output.log(`
|
|
12946
13126
|
Current Status: ${result.task.current_status}`);
|
|
12947
13127
|
}
|
|
12948
|
-
output.log(
|
|
13128
|
+
output.log(chalk20.bold(`
|
|
12949
13129
|
Operations (${result.operations.length}):
|
|
12950
13130
|
`));
|
|
12951
13131
|
result.operations.forEach((op, i) => {
|
|
@@ -12965,10 +13145,10 @@ Operations (${result.operations.length}):
|
|
|
12965
13145
|
if (args.json) {
|
|
12966
13146
|
output.json(task);
|
|
12967
13147
|
} else {
|
|
12968
|
-
output.log(
|
|
13148
|
+
output.log(chalk20.bold(`
|
|
12969
13149
|
Task #${task.id}: ${task.title}
|
|
12970
13150
|
`));
|
|
12971
|
-
output.log(`Status: ${
|
|
13151
|
+
output.log(`Status: ${chalk20.blue(task.status)} | Priority: ${task.priority} | Type: ${task.type} | Progress: ${task.progress}%`);
|
|
12972
13152
|
output.log(`Created: ${task.createdAt} | Updated: ${task.updatedAt}`);
|
|
12973
13153
|
output.log(`Project Path: ${task.project_path}`);
|
|
12974
13154
|
output.log(`Context: ${task.context}`);
|
|
@@ -12992,7 +13172,7 @@ Description: ${task.description}`);
|
|
|
12992
13172
|
};
|
|
12993
13173
|
|
|
12994
13174
|
// src/commands/tasks/create.ts
|
|
12995
|
-
import
|
|
13175
|
+
import chalk21 from "chalk";
|
|
12996
13176
|
var CreateCommand = {
|
|
12997
13177
|
command: "create <title>",
|
|
12998
13178
|
aliases: ["add", "new"],
|
|
@@ -13070,7 +13250,7 @@ var CreateCommand = {
|
|
|
13070
13250
|
if (args.json) {
|
|
13071
13251
|
output.json(task);
|
|
13072
13252
|
} else {
|
|
13073
|
-
output.log(
|
|
13253
|
+
output.log(chalk21.green(`
|
|
13074
13254
|
✓ Task created: #${task.id}`));
|
|
13075
13255
|
output.log(` Title: ${task.title}`);
|
|
13076
13256
|
output.log(` Status: ${task.status}`);
|
|
@@ -13088,7 +13268,7 @@ var CreateCommand = {
|
|
|
13088
13268
|
};
|
|
13089
13269
|
|
|
13090
13270
|
// src/commands/tasks/update.ts
|
|
13091
|
-
import
|
|
13271
|
+
import chalk22 from "chalk";
|
|
13092
13272
|
var UpdateCommand = {
|
|
13093
13273
|
command: "update <id>",
|
|
13094
13274
|
aliases: ["set"],
|
|
@@ -13146,7 +13326,7 @@ var UpdateCommand = {
|
|
|
13146
13326
|
if (args.json) {
|
|
13147
13327
|
output.json(task);
|
|
13148
13328
|
} else {
|
|
13149
|
-
output.log(
|
|
13329
|
+
output.log(chalk22.green(`
|
|
13150
13330
|
✓ Task updated: #${task.id}`));
|
|
13151
13331
|
output.log(` Title: ${task.title}`);
|
|
13152
13332
|
output.log(` Status: ${task.status}`);
|
|
@@ -13169,7 +13349,7 @@ var UpdateCommand = {
|
|
|
13169
13349
|
};
|
|
13170
13350
|
|
|
13171
13351
|
// src/commands/tasks/delete.ts
|
|
13172
|
-
import
|
|
13352
|
+
import chalk23 from "chalk";
|
|
13173
13353
|
var DeleteCommand2 = {
|
|
13174
13354
|
command: "delete <id>",
|
|
13175
13355
|
aliases: ["remove", "rm", "del"],
|
|
@@ -13205,16 +13385,16 @@ var DeleteCommand2 = {
|
|
|
13205
13385
|
process.exit(1);
|
|
13206
13386
|
}
|
|
13207
13387
|
if (!args.force) {
|
|
13208
|
-
output.log(
|
|
13209
|
-
output.log(
|
|
13210
|
-
output.log(
|
|
13211
|
-
output.log(
|
|
13388
|
+
output.log(chalk23.yellow(`Are you sure you want to delete task #${args.id}?`));
|
|
13389
|
+
output.log(chalk23.yellow(` Title: ${task.title}`));
|
|
13390
|
+
output.log(chalk23.yellow(` Status: ${task.status}`));
|
|
13391
|
+
output.log(chalk23.yellow(`
|
|
13212
13392
|
Use --force to skip this confirmation`));
|
|
13213
13393
|
process.exit(1);
|
|
13214
13394
|
}
|
|
13215
13395
|
const deleted = await taskComponent.deleteTask(args.id);
|
|
13216
13396
|
if (deleted) {
|
|
13217
|
-
output.log(
|
|
13397
|
+
output.log(chalk23.green(`
|
|
13218
13398
|
✓ Task deleted: #${args.id}`));
|
|
13219
13399
|
} else {
|
|
13220
13400
|
output.error(`Failed to delete task: ${args.id}`);
|
|
@@ -13230,7 +13410,7 @@ Use --force to skip this confirmation`));
|
|
|
13230
13410
|
};
|
|
13231
13411
|
|
|
13232
13412
|
// src/commands/tasks/complete.ts
|
|
13233
|
-
import
|
|
13413
|
+
import chalk24 from "chalk";
|
|
13234
13414
|
var CompleteCommand = {
|
|
13235
13415
|
command: "complete <id>",
|
|
13236
13416
|
aliases: ["done", "finish"],
|
|
@@ -13251,7 +13431,9 @@ var CompleteCommand = {
|
|
|
13251
13431
|
try {
|
|
13252
13432
|
await envService.create({
|
|
13253
13433
|
configPath: args.config,
|
|
13254
|
-
plugins: args.plugin
|
|
13434
|
+
plugins: args.plugin,
|
|
13435
|
+
loadPlugins: true,
|
|
13436
|
+
commandName: "tasks:complete"
|
|
13255
13437
|
});
|
|
13256
13438
|
const env = envService.getEnvironment();
|
|
13257
13439
|
if (!env) {
|
|
@@ -13287,7 +13469,7 @@ var CompleteCommand = {
|
|
|
13287
13469
|
if (args.json) {
|
|
13288
13470
|
output.json(task);
|
|
13289
13471
|
} else {
|
|
13290
|
-
output.log(
|
|
13472
|
+
output.log(chalk24.green(`
|
|
13291
13473
|
✓ Task completed: #${task.id}`));
|
|
13292
13474
|
output.log(` Title: ${task.title}`);
|
|
13293
13475
|
output.log(` Progress: ${task.progress}%`);
|
|
@@ -13303,7 +13485,7 @@ var CompleteCommand = {
|
|
|
13303
13485
|
};
|
|
13304
13486
|
|
|
13305
13487
|
// src/commands/tasks/operations.ts
|
|
13306
|
-
import
|
|
13488
|
+
import chalk25 from "chalk";
|
|
13307
13489
|
var OperationsCommand = {
|
|
13308
13490
|
command: "operations <task-id>",
|
|
13309
13491
|
aliases: ["ops", "log"],
|
|
@@ -13353,23 +13535,23 @@ var OperationsCommand = {
|
|
|
13353
13535
|
operations
|
|
13354
13536
|
});
|
|
13355
13537
|
} else {
|
|
13356
|
-
output.log(
|
|
13538
|
+
output.log(chalk25.bold(`
|
|
13357
13539
|
Operations for Task #${task.id}: ${task.title}
|
|
13358
13540
|
`));
|
|
13359
13541
|
if (operations.length === 0) {
|
|
13360
|
-
output.log(
|
|
13542
|
+
output.log(chalk25.gray("No operations found."));
|
|
13361
13543
|
} else {
|
|
13362
13544
|
operations.forEach((op, i) => {
|
|
13363
|
-
const actionColor = op.actionType === "completed" ?
|
|
13364
|
-
output.log(`${
|
|
13365
|
-
output.log(` Session: ${
|
|
13545
|
+
const actionColor = op.actionType === "completed" ? chalk25.green : op.actionType === "milestone" ? chalk25.blue : op.actionType === "problem" ? chalk25.red : chalk25.gray;
|
|
13546
|
+
output.log(`${chalk25.bold(a.offset + i + 1)}. ` + actionColor(`[${op.actionType}]`) + ` ${op.actionTitle}`);
|
|
13547
|
+
output.log(` Session: ${chalk25.cyan(op.sessionId)} | Time: ${op.timestamp}`);
|
|
13366
13548
|
if (op.actionDescription) {
|
|
13367
13549
|
output.log(` ${op.actionDescription}`);
|
|
13368
13550
|
}
|
|
13369
13551
|
output.log("");
|
|
13370
13552
|
});
|
|
13371
13553
|
}
|
|
13372
|
-
output.log(
|
|
13554
|
+
output.log(chalk25.gray(`Total: ${operations.length} operations`));
|
|
13373
13555
|
}
|
|
13374
13556
|
} catch (error) {
|
|
13375
13557
|
output.error(`Failed to list operations: ${error}`);
|
|
@@ -13381,63 +13563,7 @@ Operations for Task #${task.id}: ${task.title}
|
|
|
13381
13563
|
};
|
|
13382
13564
|
|
|
13383
13565
|
// src/commands/tasks/tree.ts
|
|
13384
|
-
import
|
|
13385
|
-
function buildTree(tasks) {
|
|
13386
|
-
const byParent = new Map;
|
|
13387
|
-
const nodeById = new Map;
|
|
13388
|
-
const roots = [];
|
|
13389
|
-
for (const t of tasks) {
|
|
13390
|
-
nodeById.set(t.id, { task: t, children: [] });
|
|
13391
|
-
}
|
|
13392
|
-
for (const t of tasks) {
|
|
13393
|
-
if (t.parent_task_id !== undefined && t.parent_task_id !== null && nodeById.has(t.parent_task_id)) {
|
|
13394
|
-
const list = byParent.get(t.parent_task_id) || [];
|
|
13395
|
-
list.push(t);
|
|
13396
|
-
byParent.set(t.parent_task_id, list);
|
|
13397
|
-
} else {
|
|
13398
|
-
roots.push(t);
|
|
13399
|
-
}
|
|
13400
|
-
}
|
|
13401
|
-
for (const [parentId, children] of byParent.entries()) {
|
|
13402
|
-
const parentNode = nodeById.get(parentId);
|
|
13403
|
-
children.sort((a, b) => a.updatedAt < b.updatedAt ? 1 : -1);
|
|
13404
|
-
parentNode.children = children.map((c) => nodeById.get(c.id));
|
|
13405
|
-
}
|
|
13406
|
-
roots.sort((a, b) => a.updatedAt < b.updatedAt ? 1 : -1);
|
|
13407
|
-
return roots.map((r) => nodeById.get(r.id));
|
|
13408
|
-
}
|
|
13409
|
-
function printTree(nodes, prefix, isRoot, output, currentDepth, maxDepth) {
|
|
13410
|
-
if (maxDepth !== undefined && currentDepth > maxDepth)
|
|
13411
|
-
return;
|
|
13412
|
-
for (let i = 0;i < nodes.length; i++) {
|
|
13413
|
-
const node = nodes[i];
|
|
13414
|
-
const isLast = i === nodes.length - 1;
|
|
13415
|
-
const connector = isRoot ? "" : isLast ? "└─ " : "├─ ";
|
|
13416
|
-
const statusColor = colorByStatus(node.task.status);
|
|
13417
|
-
const typeLabel = node.task.type ? ` [${node.task.type}]` : "";
|
|
13418
|
-
const progressLabel = node.task.progress > 0 ? ` (${node.task.progress}%)` : "";
|
|
13419
|
-
const header = `#${node.task.id}${typeLabel} ${node.task.title} ${chalk25.gray("[" + node.task.status + "]")}${progressLabel}`;
|
|
13420
|
-
output.log(prefix + connector + statusColor(header));
|
|
13421
|
-
if (node.children.length > 0) {
|
|
13422
|
-
const childPrefix = isRoot ? prefix : prefix + (isLast ? " " : "│ ");
|
|
13423
|
-
printTree(node.children, childPrefix, false, output, currentDepth + 1, maxDepth);
|
|
13424
|
-
}
|
|
13425
|
-
}
|
|
13426
|
-
}
|
|
13427
|
-
function colorByStatus(status) {
|
|
13428
|
-
switch (status) {
|
|
13429
|
-
case "completed":
|
|
13430
|
-
return chalk25.green;
|
|
13431
|
-
case "active":
|
|
13432
|
-
return chalk25.blue;
|
|
13433
|
-
case "paused":
|
|
13434
|
-
return chalk25.yellow;
|
|
13435
|
-
case "cancelled":
|
|
13436
|
-
return chalk25.strikethrough;
|
|
13437
|
-
default:
|
|
13438
|
-
return chalk25.gray;
|
|
13439
|
-
}
|
|
13440
|
-
}
|
|
13566
|
+
import chalk26 from "chalk";
|
|
13441
13567
|
var TreeCommand = {
|
|
13442
13568
|
command: "tree",
|
|
13443
13569
|
describe: "以树形结构展示所有任务(基于 parent_task_id)",
|
|
@@ -13511,23 +13637,20 @@ var TreeCommand = {
|
|
|
13511
13637
|
}
|
|
13512
13638
|
tasks = tasks.filter((t) => allowed.has(t.id));
|
|
13513
13639
|
}
|
|
13640
|
+
const tree = buildTaskTree(tasks);
|
|
13514
13641
|
if (args.json) {
|
|
13515
|
-
const tree2 = buildTree(tasks);
|
|
13516
13642
|
output.json({
|
|
13517
13643
|
total: tasks.length,
|
|
13518
|
-
rootCount:
|
|
13519
|
-
tree
|
|
13644
|
+
rootCount: tree.length,
|
|
13645
|
+
tree
|
|
13520
13646
|
});
|
|
13521
13647
|
return;
|
|
13522
13648
|
}
|
|
13523
|
-
const tree = buildTree(tasks);
|
|
13524
13649
|
if (tree.length === 0) {
|
|
13525
|
-
output.log(
|
|
13650
|
+
output.log(chalk26.gray("No tasks to display."));
|
|
13526
13651
|
return;
|
|
13527
13652
|
}
|
|
13528
|
-
output.log(
|
|
13529
|
-
output.log("");
|
|
13530
|
-
printTree(tree, "", true, output, 0, args.maxDepth);
|
|
13653
|
+
output.log(renderTaskTree(tree, { maxDepth: args.maxDepth, rootId: args.rootId }));
|
|
13531
13654
|
} catch (error) {
|
|
13532
13655
|
output.error(`Failed to build task tree: ${error}`);
|
|
13533
13656
|
process.exit(1);
|
|
@@ -13538,7 +13661,7 @@ var TreeCommand = {
|
|
|
13538
13661
|
};
|
|
13539
13662
|
|
|
13540
13663
|
// src/commands/tasks/search.ts
|
|
13541
|
-
import
|
|
13664
|
+
import chalk27 from "chalk";
|
|
13542
13665
|
var SearchCommand = {
|
|
13543
13666
|
command: "search <keywords..>",
|
|
13544
13667
|
aliases: ["find", "grep"],
|
|
@@ -13611,26 +13734,26 @@ var SearchCommand = {
|
|
|
13611
13734
|
output.log(hint);
|
|
13612
13735
|
} else {
|
|
13613
13736
|
const keywordStr = args.keywords.join(" ");
|
|
13614
|
-
output.log(
|
|
13737
|
+
output.log(chalk27.bold(`
|
|
13615
13738
|
\uD83D\uDD0D Search: "${keywordStr}" — ${total} results
|
|
13616
13739
|
`));
|
|
13617
13740
|
if (tasks.length === 0) {
|
|
13618
|
-
output.log(
|
|
13741
|
+
output.log(chalk27.gray(" No matching tasks found."));
|
|
13619
13742
|
return;
|
|
13620
13743
|
}
|
|
13621
13744
|
for (const t of tasks) {
|
|
13622
|
-
const statusColor = t.status === "completed" ?
|
|
13623
|
-
const pid = t.parent_task_id ?
|
|
13745
|
+
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;
|
|
13746
|
+
const pid = t.parent_task_id ? chalk27.gray(` (#${t.parent_task_id})`) : "";
|
|
13624
13747
|
output.log(` #${t.id} ${statusColor("[" + t.status + "]")} ${t.title}${pid}`);
|
|
13625
13748
|
if (t.current_status) {
|
|
13626
|
-
output.log(` ${
|
|
13749
|
+
output.log(` ${chalk27.gray(t.current_status.slice(0, 80))}`);
|
|
13627
13750
|
}
|
|
13628
13751
|
}
|
|
13629
13752
|
if (total > tasks.length) {
|
|
13630
|
-
output.log(
|
|
13753
|
+
output.log(chalk27.gray(`
|
|
13631
13754
|
... and ${total - tasks.length} more. Use --offset and --limit to paginate.`));
|
|
13632
13755
|
}
|
|
13633
|
-
output.log(
|
|
13756
|
+
output.log(chalk27.gray(` Page: ${Math.floor((args.offset || 0) / (args.limit || 20)) + 1}/${Math.ceil(total / (args.limit || 20))}`));
|
|
13634
13757
|
}
|
|
13635
13758
|
} catch (error) {
|
|
13636
13759
|
output.error(`Failed to search tasks: ${error}`);
|
|
@@ -13890,7 +14013,7 @@ var TasksCommand = {
|
|
|
13890
14013
|
};
|
|
13891
14014
|
|
|
13892
14015
|
// src/commands/skills/list.ts
|
|
13893
|
-
import
|
|
14016
|
+
import chalk28 from "chalk";
|
|
13894
14017
|
var ListCommand3 = {
|
|
13895
14018
|
command: "list",
|
|
13896
14019
|
aliases: ["ls"],
|
|
@@ -13958,26 +14081,26 @@ var ListCommand3 = {
|
|
|
13958
14081
|
output.log(hint);
|
|
13959
14082
|
} else {
|
|
13960
14083
|
const header = [
|
|
13961
|
-
|
|
13962
|
-
|
|
13963
|
-
|
|
14084
|
+
chalk28.bold("Name"),
|
|
14085
|
+
chalk28.bold("Description"),
|
|
14086
|
+
chalk28.bold("Source")
|
|
13964
14087
|
].join(" | ");
|
|
13965
14088
|
const sourceColor = (source) => {
|
|
13966
14089
|
switch (source) {
|
|
13967
14090
|
case "project":
|
|
13968
|
-
return
|
|
14091
|
+
return chalk28.green;
|
|
13969
14092
|
case "user":
|
|
13970
|
-
return
|
|
14093
|
+
return chalk28.blue;
|
|
13971
14094
|
case "built-in":
|
|
13972
|
-
return
|
|
14095
|
+
return chalk28.gray;
|
|
13973
14096
|
default:
|
|
13974
|
-
return
|
|
14097
|
+
return chalk28.white;
|
|
13975
14098
|
}
|
|
13976
14099
|
};
|
|
13977
14100
|
const rows = skills.map((s) => {
|
|
13978
14101
|
const desc2 = s.description.length > 50 ? s.description.slice(0, 47) + "..." : s.description;
|
|
13979
14102
|
return [
|
|
13980
|
-
|
|
14103
|
+
chalk28.cyan(s.name),
|
|
13981
14104
|
desc2,
|
|
13982
14105
|
sourceColor(s.source)(`[${s.source}]`)
|
|
13983
14106
|
].join(" | ");
|
|
@@ -14010,7 +14133,7 @@ var ListCommand3 = {
|
|
|
14010
14133
|
};
|
|
14011
14134
|
|
|
14012
14135
|
// src/commands/skills/get.ts
|
|
14013
|
-
import
|
|
14136
|
+
import chalk29 from "chalk";
|
|
14014
14137
|
var GetCommand3 = {
|
|
14015
14138
|
command: "get <name>",
|
|
14016
14139
|
describe: "获取指定技能内容",
|
|
@@ -14054,13 +14177,13 @@ var GetCommand3 = {
|
|
|
14054
14177
|
content: skill.content
|
|
14055
14178
|
});
|
|
14056
14179
|
} else {
|
|
14057
|
-
output.log(
|
|
14180
|
+
output.log(chalk29.bold.cyan(`# ${skill.name}`));
|
|
14058
14181
|
output.log("");
|
|
14059
|
-
output.log(`${
|
|
14060
|
-
output.log(`${
|
|
14061
|
-
output.log(`${
|
|
14182
|
+
output.log(`${chalk29.gray("Description:")} ${skill.description}`);
|
|
14183
|
+
output.log(`${chalk29.gray("Source:")} ${skill.source}`);
|
|
14184
|
+
output.log(`${chalk29.gray("File:")} ${skill.filePath}`);
|
|
14062
14185
|
output.log("");
|
|
14063
|
-
output.log(
|
|
14186
|
+
output.log(chalk29.bold("--- Content ---"));
|
|
14064
14187
|
output.log("");
|
|
14065
14188
|
output.log(skill.content);
|
|
14066
14189
|
}
|
|
@@ -14074,7 +14197,7 @@ var GetCommand3 = {
|
|
|
14074
14197
|
};
|
|
14075
14198
|
|
|
14076
14199
|
// src/commands/skills/search.ts
|
|
14077
|
-
import
|
|
14200
|
+
import chalk30 from "chalk";
|
|
14078
14201
|
var SearchCommand2 = {
|
|
14079
14202
|
command: "search <term>",
|
|
14080
14203
|
aliases: ["find"],
|
|
@@ -14113,7 +14236,7 @@ var SearchCommand2 = {
|
|
|
14113
14236
|
const term = args.term.toLowerCase();
|
|
14114
14237
|
const results = allSkills.filter((s) => s.name.toLowerCase().includes(term) || s.description.toLowerCase().includes(term));
|
|
14115
14238
|
if (results.length === 0) {
|
|
14116
|
-
output.log(
|
|
14239
|
+
output.log(chalk30.yellow(`No skills found matching: ${args.term}`));
|
|
14117
14240
|
return;
|
|
14118
14241
|
}
|
|
14119
14242
|
if (args.json) {
|
|
@@ -14130,19 +14253,19 @@ var SearchCommand2 = {
|
|
|
14130
14253
|
} else if (args.quiet) {
|
|
14131
14254
|
results.forEach((s) => output.log(s.name));
|
|
14132
14255
|
} else {
|
|
14133
|
-
output.log(
|
|
14256
|
+
output.log(chalk30.bold(`Search results for "${args.term}":`));
|
|
14134
14257
|
output.log("");
|
|
14135
14258
|
const header = [
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14259
|
+
chalk30.bold("Name"),
|
|
14260
|
+
chalk30.bold("Description"),
|
|
14261
|
+
chalk30.bold("Match")
|
|
14139
14262
|
].join(" | ");
|
|
14140
14263
|
const rows = results.map((s) => {
|
|
14141
14264
|
const matchedIn = s.name.toLowerCase().includes(term) ? "name" : "description";
|
|
14142
|
-
const matchColor = matchedIn === "name" ?
|
|
14265
|
+
const matchColor = matchedIn === "name" ? chalk30.green : chalk30.blue;
|
|
14143
14266
|
const desc2 = s.description.length > 40 ? s.description.slice(0, 37) + "..." : s.description;
|
|
14144
14267
|
return [
|
|
14145
|
-
|
|
14268
|
+
chalk30.cyan(s.name),
|
|
14146
14269
|
desc2,
|
|
14147
14270
|
matchColor(`[${matchedIn}]`)
|
|
14148
14271
|
].join(" | ");
|
|
@@ -14154,7 +14277,7 @@ var SearchCommand2 = {
|
|
|
14154
14277
|
...rows.map((r) => `│${r}│`),
|
|
14155
14278
|
"└" + "─".repeat(header.length + 2) + "┘",
|
|
14156
14279
|
"",
|
|
14157
|
-
|
|
14280
|
+
chalk30.gray(`${results.length} matching skill(s) found.`)
|
|
14158
14281
|
].join(`
|
|
14159
14282
|
`));
|
|
14160
14283
|
}
|
|
@@ -14168,7 +14291,7 @@ var SearchCommand2 = {
|
|
|
14168
14291
|
};
|
|
14169
14292
|
|
|
14170
14293
|
// src/commands/skills/reload.ts
|
|
14171
|
-
import
|
|
14294
|
+
import chalk31 from "chalk";
|
|
14172
14295
|
var ReloadCommand = {
|
|
14173
14296
|
command: "reload",
|
|
14174
14297
|
describe: "重新扫描并更新 SkillTool",
|
|
@@ -14191,10 +14314,10 @@ var ReloadCommand = {
|
|
|
14191
14314
|
output.error("SkillComponent not available");
|
|
14192
14315
|
process.exit(1);
|
|
14193
14316
|
}
|
|
14194
|
-
output.log(
|
|
14317
|
+
output.log(chalk31.blue("Reloading skills..."));
|
|
14195
14318
|
await skillComponent.reload();
|
|
14196
14319
|
const skills = skillComponent.getSkillList();
|
|
14197
|
-
output.log(
|
|
14320
|
+
output.log(chalk31.green(`Successfully reloaded ${skills.length} skills`));
|
|
14198
14321
|
} catch (error) {
|
|
14199
14322
|
output.error(`Failed to reload skills: ${error}`);
|
|
14200
14323
|
process.exit(1);
|
|
@@ -14205,7 +14328,7 @@ var ReloadCommand = {
|
|
|
14205
14328
|
};
|
|
14206
14329
|
|
|
14207
14330
|
// src/commands/skills/show-config.ts
|
|
14208
|
-
import
|
|
14331
|
+
import chalk32 from "chalk";
|
|
14209
14332
|
var ShowConfigCommand = {
|
|
14210
14333
|
command: "show-config",
|
|
14211
14334
|
aliases: ["config"],
|
|
@@ -14230,38 +14353,38 @@ var ShowConfigCommand = {
|
|
|
14230
14353
|
process.exit(1);
|
|
14231
14354
|
}
|
|
14232
14355
|
const defaultConfig = skillComponent.getConfig?.();
|
|
14233
|
-
output.log(
|
|
14356
|
+
output.log(chalk32.bold.cyan(`# Skills Configuration
|
|
14234
14357
|
`));
|
|
14235
|
-
output.log(
|
|
14358
|
+
output.log(chalk32.bold(`## Scan Paths
|
|
14236
14359
|
`));
|
|
14237
14360
|
const paths = [
|
|
14238
14361
|
{ type: "user", desc: "用户路径", path: "~/.config/roy-agent/skills/" },
|
|
14239
14362
|
{ type: "project", desc: "项目路径", path: ".roy/skills/" }
|
|
14240
14363
|
];
|
|
14241
14364
|
for (const p of paths) {
|
|
14242
|
-
const typeColor = p.type === "project" ?
|
|
14243
|
-
output.log(` ${typeColor("[ " + p.type + " ]")} ${
|
|
14244
|
-
output.log(` ${
|
|
14365
|
+
const typeColor = p.type === "project" ? chalk32.green : chalk32.blue;
|
|
14366
|
+
output.log(` ${typeColor("[ " + p.type + " ]")} ${chalk32.gray(p.desc)}`);
|
|
14367
|
+
output.log(` ${chalk32.cyan(p.path)}
|
|
14245
14368
|
`);
|
|
14246
14369
|
}
|
|
14247
|
-
output.log(
|
|
14370
|
+
output.log(chalk32.bold(`## Scan Rules
|
|
14248
14371
|
`));
|
|
14249
|
-
output.log(` ${
|
|
14250
|
-
output.log(` ${
|
|
14251
|
-
output.log(` ${
|
|
14372
|
+
output.log(` ${chalk32.gray("Pattern:")} ${chalk32.cyan("**/SKILL.md")}`);
|
|
14373
|
+
output.log(` ${chalk32.gray("Recursive:")} ${chalk32.green("true")}`);
|
|
14374
|
+
output.log(` ${chalk32.gray("Ignore:")} ${chalk32.cyan("**/node_modules/**")}
|
|
14252
14375
|
`);
|
|
14253
|
-
output.log(
|
|
14376
|
+
output.log(chalk32.bold(`## Priority (High to Low)
|
|
14254
14377
|
`));
|
|
14255
|
-
output.log(` ${
|
|
14256
|
-
output.log(` ${
|
|
14257
|
-
output.log(` ${
|
|
14378
|
+
output.log(` ${chalk32.green("1. project")} - 项目路径(最高优先级)`);
|
|
14379
|
+
output.log(` ${chalk32.blue("2. user")} - 用户路径`);
|
|
14380
|
+
output.log(` ${chalk32.gray("3. built-in")} - 内置路径(预留)
|
|
14258
14381
|
`);
|
|
14259
|
-
output.log(
|
|
14382
|
+
output.log(chalk32.bold(`## Usage
|
|
14260
14383
|
`));
|
|
14261
|
-
output.log(` ${
|
|
14262
|
-
output.log(` ${
|
|
14263
|
-
output.log(` ${
|
|
14264
|
-
output.log(` ${
|
|
14384
|
+
output.log(` ${chalk32.cyan("roy-agent skills list")} ${chalk32.gray("- 列出所有技能")}`);
|
|
14385
|
+
output.log(` ${chalk32.cyan("roy-agent skills get <name>")} ${chalk32.gray("- 获取技能内容")}`);
|
|
14386
|
+
output.log(` ${chalk32.cyan("roy-agent skills search <term>")} ${chalk32.gray("- 搜索技能")}`);
|
|
14387
|
+
output.log(` ${chalk32.cyan("roy-agent skills reload")} ${chalk32.gray("- 重新扫描技能")}`);
|
|
14265
14388
|
} catch (error) {
|
|
14266
14389
|
output.error(`Failed to show config: ${error}`);
|
|
14267
14390
|
process.exit(1);
|
|
@@ -14282,7 +14405,7 @@ var SkillsCommand = {
|
|
|
14282
14405
|
};
|
|
14283
14406
|
|
|
14284
14407
|
// src/commands/agents/list.ts
|
|
14285
|
-
import
|
|
14408
|
+
import chalk33 from "chalk";
|
|
14286
14409
|
var ListCommand4 = {
|
|
14287
14410
|
command: "list",
|
|
14288
14411
|
aliases: ["ls"],
|
|
@@ -14368,27 +14491,27 @@ var ListCommand4 = {
|
|
|
14368
14491
|
output.log(hint);
|
|
14369
14492
|
} else {
|
|
14370
14493
|
const header = [
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14375
|
-
|
|
14376
|
-
|
|
14494
|
+
chalk33.bold("Name"),
|
|
14495
|
+
chalk33.bold("Type"),
|
|
14496
|
+
chalk33.bold("Source"),
|
|
14497
|
+
chalk33.bold("Model"),
|
|
14498
|
+
chalk33.bold("Workflow"),
|
|
14499
|
+
chalk33.bold("Description")
|
|
14377
14500
|
].join(" | ");
|
|
14378
14501
|
const typeColor = (type) => {
|
|
14379
14502
|
if (type === "primary")
|
|
14380
|
-
return
|
|
14503
|
+
return chalk33.yellow;
|
|
14381
14504
|
if (type === "workflow")
|
|
14382
|
-
return
|
|
14383
|
-
return
|
|
14505
|
+
return chalk33.magenta;
|
|
14506
|
+
return chalk33.blue;
|
|
14384
14507
|
};
|
|
14385
14508
|
const rows = pagedAgents.map((a) => {
|
|
14386
14509
|
const desc2 = (a.description || "").length > 40 ? (a.description || "").slice(0, 37) + "..." : a.description || "-";
|
|
14387
|
-
const workflowDisplay = a.type === "workflow" && a.workflow ?
|
|
14388
|
-
const modelDisplay = a.model ?
|
|
14389
|
-
const sourceDisplay = builtInSubAgentNames.has(a.name) ?
|
|
14510
|
+
const workflowDisplay = a.type === "workflow" && a.workflow ? chalk33.cyan(a.workflow.length > 30 ? a.workflow.slice(0, 27) + "..." : a.workflow) : chalk33.gray("-");
|
|
14511
|
+
const modelDisplay = a.model ? chalk33.yellow(a.model.length > 20 ? a.model.slice(0, 17) + "..." : a.model) : chalk33.gray("-");
|
|
14512
|
+
const sourceDisplay = builtInSubAgentNames.has(a.name) ? chalk33.green("built-in") : chalk33.gray("user");
|
|
14390
14513
|
return [
|
|
14391
|
-
|
|
14514
|
+
chalk33.cyan(a.name),
|
|
14392
14515
|
typeColor(a.type)(a.type),
|
|
14393
14516
|
sourceDisplay,
|
|
14394
14517
|
modelDisplay,
|
|
@@ -14397,9 +14520,9 @@ var ListCommand4 = {
|
|
|
14397
14520
|
].join(" | ");
|
|
14398
14521
|
});
|
|
14399
14522
|
if (rows.length === 0) {
|
|
14400
|
-
output.log(
|
|
14523
|
+
output.log(chalk33.yellow("No agents found."));
|
|
14401
14524
|
output.log("");
|
|
14402
|
-
output.log(
|
|
14525
|
+
output.log(chalk33.gray("Tip: Create agent configs in ~/.local/share/roy-agent/agents/"));
|
|
14403
14526
|
} else {
|
|
14404
14527
|
output.log([
|
|
14405
14528
|
`┌─ Agents ${"─".repeat(50)}┐`,
|
|
@@ -14430,7 +14553,7 @@ var ListCommand4 = {
|
|
|
14430
14553
|
};
|
|
14431
14554
|
|
|
14432
14555
|
// src/commands/agents/get.ts
|
|
14433
|
-
import
|
|
14556
|
+
import chalk34 from "chalk";
|
|
14434
14557
|
var GetCommand4 = {
|
|
14435
14558
|
command: "get <name>",
|
|
14436
14559
|
describe: "获取指定 agent 的详细信息",
|
|
@@ -14489,69 +14612,69 @@ var GetCommand4 = {
|
|
|
14489
14612
|
filterHistory: agent.filterHistory
|
|
14490
14613
|
});
|
|
14491
14614
|
} else {
|
|
14492
|
-
output.log(
|
|
14615
|
+
output.log(chalk34.bold.cyan(`# Agent: ${agent.name}`));
|
|
14493
14616
|
output.log("");
|
|
14494
|
-
output.log(
|
|
14495
|
-
output.log(` ${
|
|
14496
|
-
output.log(` ${
|
|
14617
|
+
output.log(chalk34.bold("Basic Info:"));
|
|
14618
|
+
output.log(` ${chalk34.cyan("name:")} ${agent.name}`);
|
|
14619
|
+
output.log(` ${chalk34.cyan("type:")} ${agent.type}`);
|
|
14497
14620
|
if (agent.description) {
|
|
14498
|
-
output.log(` ${
|
|
14621
|
+
output.log(` ${chalk34.cyan("description:")} ${agent.description}`);
|
|
14499
14622
|
}
|
|
14500
14623
|
output.log("");
|
|
14501
14624
|
if (agent.type === "workflow") {
|
|
14502
|
-
output.log(
|
|
14625
|
+
output.log(chalk34.bold("Workflow:"));
|
|
14503
14626
|
if (agent.workflow) {
|
|
14504
|
-
output.log(` ${
|
|
14505
|
-
output.log(` ${
|
|
14627
|
+
output.log(` ${chalk34.cyan("workflow:")} ${agent.workflow}`);
|
|
14628
|
+
output.log(` ${chalk34.gray("→")} ${chalk34.gray(`roy-agent workflow run ${agent.workflow} --input '{"query":"..."}'`)}`);
|
|
14506
14629
|
} else {
|
|
14507
|
-
output.log(` ${
|
|
14630
|
+
output.log(` ${chalk34.gray("(no workflow configured)")}`);
|
|
14508
14631
|
}
|
|
14509
14632
|
output.log("");
|
|
14510
14633
|
}
|
|
14511
|
-
output.log(
|
|
14634
|
+
output.log(chalk34.bold("System Prompt:"));
|
|
14512
14635
|
if (agent.systemPromptRef) {
|
|
14513
|
-
output.log(` ${
|
|
14636
|
+
output.log(` ${chalk34.green("[ref]")} ${chalk34.cyan("systemPromptRef:")} ${agent.systemPromptRef}`);
|
|
14514
14637
|
}
|
|
14515
14638
|
if (agent.systemPrompt && !agent.systemPromptRef) {
|
|
14516
14639
|
const promptPreview = agent.systemPrompt.length > 100 ? agent.systemPrompt.slice(0, 97) + "..." : agent.systemPrompt;
|
|
14517
|
-
output.log(` ${
|
|
14518
|
-
output.log(` ${
|
|
14640
|
+
output.log(` ${chalk34.gray("[inline]")}`);
|
|
14641
|
+
output.log(` ${chalk34.gray(promptPreview.split(`
|
|
14519
14642
|
`).join(`
|
|
14520
14643
|
`))}`);
|
|
14521
14644
|
}
|
|
14522
14645
|
if (resolvedSystemPrompt) {
|
|
14523
14646
|
const resolvedPreview = resolvedSystemPrompt.length > 200 ? resolvedSystemPrompt.slice(0, 197) + "..." : resolvedSystemPrompt;
|
|
14524
|
-
output.log(` ${
|
|
14525
|
-
output.log(` ${
|
|
14647
|
+
output.log(` ${chalk34.green("[resolved]")}`);
|
|
14648
|
+
output.log(` ${chalk34.gray(resolvedPreview.split(`
|
|
14526
14649
|
`).join(`
|
|
14527
14650
|
`))}`);
|
|
14528
14651
|
}
|
|
14529
14652
|
if (!agent.systemPromptRef && !agent.systemPrompt && !resolvedSystemPrompt) {
|
|
14530
|
-
output.log(` ${
|
|
14653
|
+
output.log(` ${chalk34.gray("(none)")}`);
|
|
14531
14654
|
}
|
|
14532
14655
|
output.log("");
|
|
14533
14656
|
const hasOptions = agent.model || agent.maxIterations || agent.toolTimeout;
|
|
14534
14657
|
if (hasOptions) {
|
|
14535
|
-
output.log(
|
|
14658
|
+
output.log(chalk34.bold("Options:"));
|
|
14536
14659
|
if (agent.model) {
|
|
14537
|
-
output.log(` ${
|
|
14660
|
+
output.log(` ${chalk34.cyan("model:")} ${agent.model}`);
|
|
14538
14661
|
}
|
|
14539
14662
|
if (agent.maxIterations) {
|
|
14540
|
-
output.log(` ${
|
|
14663
|
+
output.log(` ${chalk34.cyan("maxIterations:")} ${agent.maxIterations}`);
|
|
14541
14664
|
}
|
|
14542
14665
|
if (agent.toolTimeout) {
|
|
14543
|
-
output.log(` ${
|
|
14666
|
+
output.log(` ${chalk34.cyan("toolTimeout:")} ${agent.toolTimeout}ms`);
|
|
14544
14667
|
}
|
|
14545
14668
|
output.log("");
|
|
14546
14669
|
}
|
|
14547
14670
|
const hasTools = agent.allowedTools?.length || agent.deniedTools?.length;
|
|
14548
14671
|
if (hasTools) {
|
|
14549
|
-
output.log(
|
|
14672
|
+
output.log(chalk34.bold("Tool Permissions:"));
|
|
14550
14673
|
if (agent.allowedTools?.length) {
|
|
14551
|
-
output.log(` ${
|
|
14674
|
+
output.log(` ${chalk34.green("allowed:")} ${agent.allowedTools.join(", ")}`);
|
|
14552
14675
|
}
|
|
14553
14676
|
if (agent.deniedTools?.length) {
|
|
14554
|
-
output.log(` ${
|
|
14677
|
+
output.log(` ${chalk34.red("denied:")} ${agent.deniedTools.join(", ")}`);
|
|
14555
14678
|
}
|
|
14556
14679
|
output.log("");
|
|
14557
14680
|
}
|
|
@@ -14566,7 +14689,7 @@ var GetCommand4 = {
|
|
|
14566
14689
|
};
|
|
14567
14690
|
|
|
14568
14691
|
// src/commands/agents/add.ts
|
|
14569
|
-
import
|
|
14692
|
+
import chalk35 from "chalk";
|
|
14570
14693
|
function parseToolList(value) {
|
|
14571
14694
|
if (!value?.trim()) {
|
|
14572
14695
|
return;
|
|
@@ -14658,8 +14781,8 @@ var AddCommand = {
|
|
|
14658
14781
|
if (args.json) {
|
|
14659
14782
|
output.json({ agent, filePath });
|
|
14660
14783
|
} else {
|
|
14661
|
-
output.log(
|
|
14662
|
-
output.log(
|
|
14784
|
+
output.log(chalk35.green(`✓ Agent '${args.name}' created`));
|
|
14785
|
+
output.log(chalk35.gray(` ${filePath}`));
|
|
14663
14786
|
}
|
|
14664
14787
|
} catch (error) {
|
|
14665
14788
|
output.error(`Failed to add agent: ${error}`);
|
|
@@ -14671,7 +14794,7 @@ var AddCommand = {
|
|
|
14671
14794
|
};
|
|
14672
14795
|
|
|
14673
14796
|
// src/commands/agents/delete.ts
|
|
14674
|
-
import
|
|
14797
|
+
import chalk36 from "chalk";
|
|
14675
14798
|
var DeleteCommand3 = {
|
|
14676
14799
|
command: "delete <name>",
|
|
14677
14800
|
describe: "删除 agent 配置文件",
|
|
@@ -14713,7 +14836,7 @@ var DeleteCommand3 = {
|
|
|
14713
14836
|
}
|
|
14714
14837
|
const filePath = registry.getAgentFilePath(args.name);
|
|
14715
14838
|
if (!args.yes) {
|
|
14716
|
-
output.log(
|
|
14839
|
+
output.log(chalk36.yellow(`Delete agent '${args.name}'? This removes ${filePath} (use --yes to skip confirmation)`));
|
|
14717
14840
|
process.exit(1);
|
|
14718
14841
|
}
|
|
14719
14842
|
const deleted = await registry.deleteAgent(args.name);
|
|
@@ -14724,7 +14847,7 @@ var DeleteCommand3 = {
|
|
|
14724
14847
|
if (args.json) {
|
|
14725
14848
|
output.json({ deleted: true, name: args.name, filePath });
|
|
14726
14849
|
} else {
|
|
14727
|
-
output.log(
|
|
14850
|
+
output.log(chalk36.green(`✓ Agent '${args.name}' deleted`));
|
|
14728
14851
|
}
|
|
14729
14852
|
} catch (error) {
|
|
14730
14853
|
output.error(`Failed to delete agent: ${error}`);
|
|
@@ -14736,7 +14859,7 @@ var DeleteCommand3 = {
|
|
|
14736
14859
|
};
|
|
14737
14860
|
|
|
14738
14861
|
// src/commands/agents/config-dir.ts
|
|
14739
|
-
import
|
|
14862
|
+
import chalk37 from "chalk";
|
|
14740
14863
|
var ConfigDirCommand = {
|
|
14741
14864
|
command: "config-dir",
|
|
14742
14865
|
describe: "显示 agent 配置目录路径",
|
|
@@ -14767,8 +14890,8 @@ var ConfigDirCommand = {
|
|
|
14767
14890
|
if (args.json) {
|
|
14768
14891
|
output.json({ configDir, exists });
|
|
14769
14892
|
} else {
|
|
14770
|
-
output.log(`${
|
|
14771
|
-
output.log(`${
|
|
14893
|
+
output.log(`${chalk37.cyan("Agent Config Directory:")} ${configDir}`);
|
|
14894
|
+
output.log(`${chalk37.gray("Exists:")} ${exists ? "yes" : "no"}`);
|
|
14772
14895
|
}
|
|
14773
14896
|
} catch (error) {
|
|
14774
14897
|
output.error(`Failed to get config dir: ${error}`);
|
|
@@ -14791,7 +14914,7 @@ var AgentsCommand = {
|
|
|
14791
14914
|
};
|
|
14792
14915
|
|
|
14793
14916
|
// src/commands/prompt/list.ts
|
|
14794
|
-
import
|
|
14917
|
+
import chalk38 from "chalk";
|
|
14795
14918
|
var ListCommand5 = {
|
|
14796
14919
|
command: "list",
|
|
14797
14920
|
aliases: ["ls"],
|
|
@@ -14860,17 +14983,17 @@ var ListCommand5 = {
|
|
|
14860
14983
|
output.log(hint);
|
|
14861
14984
|
} else {
|
|
14862
14985
|
const header = [
|
|
14863
|
-
|
|
14864
|
-
|
|
14986
|
+
chalk38.bold("Name"),
|
|
14987
|
+
chalk38.bold("Source")
|
|
14865
14988
|
].join(" | ");
|
|
14866
14989
|
const rows = prompts.map((p) => {
|
|
14867
14990
|
return [
|
|
14868
|
-
|
|
14869
|
-
|
|
14991
|
+
chalk38.cyan(p.name),
|
|
14992
|
+
chalk38.gray(`[${p.source}]`)
|
|
14870
14993
|
].join(" | ");
|
|
14871
14994
|
});
|
|
14872
14995
|
if (rows.length === 0) {
|
|
14873
|
-
output.log(
|
|
14996
|
+
output.log(chalk38.yellow("No prompts found."));
|
|
14874
14997
|
} else {
|
|
14875
14998
|
output.log([
|
|
14876
14999
|
`┌─ Prompts ${"─".repeat(50)}┐`,
|
|
@@ -14901,7 +15024,7 @@ var ListCommand5 = {
|
|
|
14901
15024
|
};
|
|
14902
15025
|
|
|
14903
15026
|
// src/commands/prompt/get.ts
|
|
14904
|
-
import
|
|
15027
|
+
import chalk39 from "chalk";
|
|
14905
15028
|
var GetCommand5 = {
|
|
14906
15029
|
command: "get <name>",
|
|
14907
15030
|
describe: "获取指定 prompt 的内容",
|
|
@@ -14948,16 +15071,16 @@ var GetCommand5 = {
|
|
|
14948
15071
|
variables: vars
|
|
14949
15072
|
});
|
|
14950
15073
|
} else {
|
|
14951
|
-
output.log(
|
|
15074
|
+
output.log(chalk39.bold.cyan(`# Prompt: ${args.name}`));
|
|
14952
15075
|
output.log("");
|
|
14953
15076
|
if (Object.keys(vars).length > 0) {
|
|
14954
|
-
output.log(
|
|
15077
|
+
output.log(chalk39.gray("Variables:"));
|
|
14955
15078
|
for (const [key, value] of Object.entries(vars)) {
|
|
14956
|
-
output.log(` ${
|
|
15079
|
+
output.log(` ${chalk39.cyan(key + ":")} ${value}`);
|
|
14957
15080
|
}
|
|
14958
15081
|
output.log("");
|
|
14959
15082
|
}
|
|
14960
|
-
output.log(
|
|
15083
|
+
output.log(chalk39.bold("Content:"));
|
|
14961
15084
|
output.log("─".repeat(60));
|
|
14962
15085
|
output.log(prompt);
|
|
14963
15086
|
output.log("─".repeat(60));
|
|
@@ -14987,7 +15110,7 @@ function parseVars(vars) {
|
|
|
14987
15110
|
|
|
14988
15111
|
// src/commands/prompt/add.ts
|
|
14989
15112
|
import { readFile as readFile2 } from "fs/promises";
|
|
14990
|
-
import
|
|
15113
|
+
import chalk40 from "chalk";
|
|
14991
15114
|
var AddCommand2 = {
|
|
14992
15115
|
command: "add <name>",
|
|
14993
15116
|
describe: "添加 prompt 并持久化到 ~/.local/share/roy-agent/prompts/",
|
|
@@ -15038,8 +15161,8 @@ var AddCommand2 = {
|
|
|
15038
15161
|
length: content.trim().length
|
|
15039
15162
|
});
|
|
15040
15163
|
} else {
|
|
15041
|
-
output.log(
|
|
15042
|
-
output.log(
|
|
15164
|
+
output.log(chalk40.green(`✓ Prompt '${args.name}' saved`));
|
|
15165
|
+
output.log(chalk40.gray(` ${filePath}`));
|
|
15043
15166
|
}
|
|
15044
15167
|
} catch (error) {
|
|
15045
15168
|
output.error(`Failed to add prompt: ${error}`);
|
|
@@ -15051,7 +15174,7 @@ var AddCommand2 = {
|
|
|
15051
15174
|
};
|
|
15052
15175
|
|
|
15053
15176
|
// src/commands/prompt/config-dir.ts
|
|
15054
|
-
import
|
|
15177
|
+
import chalk41 from "chalk";
|
|
15055
15178
|
var ConfigDirCommand2 = {
|
|
15056
15179
|
command: "config-dir",
|
|
15057
15180
|
describe: "显示 prompt 持久化目录路径",
|
|
@@ -15081,8 +15204,8 @@ var ConfigDirCommand2 = {
|
|
|
15081
15204
|
if (args.json) {
|
|
15082
15205
|
output.json({ configDir, exists });
|
|
15083
15206
|
} else {
|
|
15084
|
-
output.log(`${
|
|
15085
|
-
output.log(`${
|
|
15207
|
+
output.log(`${chalk41.cyan("Prompt Config Directory:")} ${configDir}`);
|
|
15208
|
+
output.log(`${chalk41.gray("Exists:")} ${exists ? "yes" : "no"}`);
|
|
15086
15209
|
}
|
|
15087
15210
|
} catch (error) {
|
|
15088
15211
|
output.error(`Failed to get config dir: ${error}`);
|
|
@@ -15104,7 +15227,7 @@ var PromptCommand = {
|
|
|
15104
15227
|
};
|
|
15105
15228
|
|
|
15106
15229
|
// src/commands/commands-list.ts
|
|
15107
|
-
import
|
|
15230
|
+
import chalk42 from "chalk";
|
|
15108
15231
|
function truncateVisual(str, maxWidth) {
|
|
15109
15232
|
let result = "";
|
|
15110
15233
|
let width = 0;
|
|
@@ -15119,16 +15242,16 @@ function truncateVisual(str, maxWidth) {
|
|
|
15119
15242
|
}
|
|
15120
15243
|
function formatCommandsTable(commands) {
|
|
15121
15244
|
if (commands.length === 0) {
|
|
15122
|
-
return
|
|
15245
|
+
return chalk42.yellow("命令目录为空,使用 'roy-agent commands add' 添加命令");
|
|
15123
15246
|
}
|
|
15124
15247
|
const NAME_WIDTH = 20;
|
|
15125
15248
|
const SOURCE_WIDTH = 10;
|
|
15126
15249
|
const DESC_WIDTH = 50;
|
|
15127
15250
|
const GAP = " ";
|
|
15128
15251
|
const headerLine = [
|
|
15129
|
-
|
|
15130
|
-
|
|
15131
|
-
|
|
15252
|
+
chalk42.bold("NAME".padEnd(NAME_WIDTH)),
|
|
15253
|
+
chalk42.bold("SOURCE".padEnd(SOURCE_WIDTH)),
|
|
15254
|
+
chalk42.bold("DESCRIPTION")
|
|
15132
15255
|
].join(GAP);
|
|
15133
15256
|
const sepLine = "─".repeat(NAME_WIDTH + SOURCE_WIDTH + DESC_WIDTH + GAP.length * 2);
|
|
15134
15257
|
const formatRow = (cmd) => {
|
|
@@ -15236,7 +15359,7 @@ var CommandsListCommand = {
|
|
|
15236
15359
|
};
|
|
15237
15360
|
|
|
15238
15361
|
// src/commands/commands-add.ts
|
|
15239
|
-
import
|
|
15362
|
+
import chalk43 from "chalk";
|
|
15240
15363
|
var CommandsAddCommand = {
|
|
15241
15364
|
command: "add <name> <target>",
|
|
15242
15365
|
describe: "添加收藏命令(自动创建 symlink)",
|
|
@@ -15297,10 +15420,10 @@ var CommandsAddCommand = {
|
|
|
15297
15420
|
});
|
|
15298
15421
|
const dirs = await commandsComponent.getCommandDirs();
|
|
15299
15422
|
const targetDir = source === "user" ? dirs.user : dirs.project;
|
|
15300
|
-
output.log(
|
|
15301
|
-
output.log(
|
|
15302
|
-
output.log(
|
|
15303
|
-
output.log(
|
|
15423
|
+
output.log(chalk43.green(`✅ 已添加命令 '${args.name}'`));
|
|
15424
|
+
output.log(chalk43.gray(` 目标: ${args.target}`));
|
|
15425
|
+
output.log(chalk43.gray(` 位置: ${targetDir}/${args.name}`));
|
|
15426
|
+
output.log(chalk43.gray(` 级别: ${source === "user" ? "USER" : "PROJECT"}`));
|
|
15304
15427
|
} catch (error) {
|
|
15305
15428
|
output.error(`添加失败: ${error.message}`);
|
|
15306
15429
|
process.exit(1);
|
|
@@ -15311,7 +15434,7 @@ var CommandsAddCommand = {
|
|
|
15311
15434
|
};
|
|
15312
15435
|
|
|
15313
15436
|
// src/commands/commands-remove.ts
|
|
15314
|
-
import
|
|
15437
|
+
import chalk44 from "chalk";
|
|
15315
15438
|
var CommandsRemoveCommand = {
|
|
15316
15439
|
command: "remove <name>",
|
|
15317
15440
|
aliases: ["rm"],
|
|
@@ -15355,7 +15478,7 @@ var CommandsRemoveCommand = {
|
|
|
15355
15478
|
name: args.name,
|
|
15356
15479
|
source: "user"
|
|
15357
15480
|
});
|
|
15358
|
-
output.log(
|
|
15481
|
+
output.log(chalk44.green(`✅ 已从用户目录移除命令 '${args.name}'`));
|
|
15359
15482
|
} catch (error) {
|
|
15360
15483
|
if (!error.message?.includes("不存在")) {
|
|
15361
15484
|
throw error;
|
|
@@ -15368,7 +15491,7 @@ var CommandsRemoveCommand = {
|
|
|
15368
15491
|
name: args.name,
|
|
15369
15492
|
source: "project"
|
|
15370
15493
|
});
|
|
15371
|
-
output.log(
|
|
15494
|
+
output.log(chalk44.green(`✅ 已从项目目录移除命令 '${args.name}'`));
|
|
15372
15495
|
} catch (error) {
|
|
15373
15496
|
if (!error.message?.includes("不存在")) {
|
|
15374
15497
|
throw error;
|
|
@@ -15382,7 +15505,7 @@ var CommandsRemoveCommand = {
|
|
|
15382
15505
|
name: args.name,
|
|
15383
15506
|
source: "user"
|
|
15384
15507
|
});
|
|
15385
|
-
output.log(
|
|
15508
|
+
output.log(chalk44.green(`✅ 已从用户目录移除命令 '${args.name}'`));
|
|
15386
15509
|
removed = true;
|
|
15387
15510
|
} catch (error) {
|
|
15388
15511
|
if (!error.message?.includes("不存在")) {
|
|
@@ -15394,7 +15517,7 @@ var CommandsRemoveCommand = {
|
|
|
15394
15517
|
name: args.name,
|
|
15395
15518
|
source: "project"
|
|
15396
15519
|
});
|
|
15397
|
-
output.log(
|
|
15520
|
+
output.log(chalk44.green(`✅ 已从项目目录移除命令 '${args.name}'`));
|
|
15398
15521
|
removed = true;
|
|
15399
15522
|
} catch (error) {
|
|
15400
15523
|
if (!error.message?.includes("不存在")) {
|
|
@@ -15416,7 +15539,7 @@ var CommandsRemoveCommand = {
|
|
|
15416
15539
|
};
|
|
15417
15540
|
|
|
15418
15541
|
// src/commands/commands-info.ts
|
|
15419
|
-
import
|
|
15542
|
+
import chalk45 from "chalk";
|
|
15420
15543
|
import { exec as exec2 } from "child_process";
|
|
15421
15544
|
import { promisify } from "util";
|
|
15422
15545
|
var execAsync2 = promisify(exec2);
|
|
@@ -15451,12 +15574,12 @@ var CommandsInfoCommand = {
|
|
|
15451
15574
|
output.error(`命令 '${args.name}' 不存在`);
|
|
15452
15575
|
process.exit(1);
|
|
15453
15576
|
}
|
|
15454
|
-
output.log(
|
|
15455
|
-
output.log(
|
|
15456
|
-
output.log(
|
|
15457
|
-
output.log(
|
|
15577
|
+
output.log(chalk45.bold("Name:") + ` ${info.name}`);
|
|
15578
|
+
output.log(chalk45.bold("Path:") + ` ${info.path}`);
|
|
15579
|
+
output.log(chalk45.bold("Source:") + ` ${info.source.toUpperCase()}`);
|
|
15580
|
+
output.log(chalk45.bold("Description:") + ` ${info.shortDescription || "-"}`);
|
|
15458
15581
|
output.log();
|
|
15459
|
-
output.log(
|
|
15582
|
+
output.log(chalk45.gray("─".repeat(50)));
|
|
15460
15583
|
output.log();
|
|
15461
15584
|
try {
|
|
15462
15585
|
const { stdout } = await execAsync2(`${info.path} --help`, { timeout: 5000 });
|
|
@@ -15466,7 +15589,7 @@ var CommandsInfoCommand = {
|
|
|
15466
15589
|
const { stdout } = await execAsync2(`${info.path} -h`, { timeout: 5000 });
|
|
15467
15590
|
output.log(stdout);
|
|
15468
15591
|
} catch {
|
|
15469
|
-
output.log(
|
|
15592
|
+
output.log(chalk45.gray("(无法获取帮助信息)"));
|
|
15470
15593
|
}
|
|
15471
15594
|
}
|
|
15472
15595
|
} catch (error) {
|
|
@@ -15479,7 +15602,7 @@ var CommandsInfoCommand = {
|
|
|
15479
15602
|
};
|
|
15480
15603
|
|
|
15481
15604
|
// src/commands/commands-dirs.ts
|
|
15482
|
-
import
|
|
15605
|
+
import chalk46 from "chalk";
|
|
15483
15606
|
var CommandsDirsCommand = {
|
|
15484
15607
|
command: "dirs",
|
|
15485
15608
|
describe: "显示命令目录",
|
|
@@ -15511,10 +15634,10 @@ var CommandsDirsCommand = {
|
|
|
15511
15634
|
if (args.json) {
|
|
15512
15635
|
output.json(dirs);
|
|
15513
15636
|
} else {
|
|
15514
|
-
output.log(
|
|
15637
|
+
output.log(chalk46.bold("命令目录:"));
|
|
15515
15638
|
output.log();
|
|
15516
|
-
output.log(
|
|
15517
|
-
output.log(
|
|
15639
|
+
output.log(chalk46.cyan("USER:") + ` ${dirs.user}`);
|
|
15640
|
+
output.log(chalk46.cyan("PROJECT:") + ` ${dirs.project}`);
|
|
15518
15641
|
}
|
|
15519
15642
|
} catch (error) {
|
|
15520
15643
|
output.error(`错误: ${error.message}`);
|
|
@@ -15534,7 +15657,7 @@ var CommandsCommand = {
|
|
|
15534
15657
|
};
|
|
15535
15658
|
|
|
15536
15659
|
// src/commands/config/list.ts
|
|
15537
|
-
import
|
|
15660
|
+
import chalk47 from "chalk";
|
|
15538
15661
|
|
|
15539
15662
|
// src/commands/config/config-service.ts
|
|
15540
15663
|
import * as fsSync from "fs";
|
|
@@ -15838,7 +15961,7 @@ var ConfigListCommand = {
|
|
|
15838
15961
|
output.log("");
|
|
15839
15962
|
output.log("Supported components:");
|
|
15840
15963
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
15841
|
-
output.log(` ${
|
|
15964
|
+
output.log(` ${chalk47.cyan(comp.padEnd(15))} ${COMPONENT_DESCRIPTIONS[comp] || ""}`);
|
|
15842
15965
|
}
|
|
15843
15966
|
process.exit(1);
|
|
15844
15967
|
}
|
|
@@ -15856,27 +15979,27 @@ var ConfigListCommand = {
|
|
|
15856
15979
|
}
|
|
15857
15980
|
};
|
|
15858
15981
|
function showHelp(output) {
|
|
15859
|
-
output.log(
|
|
15982
|
+
output.log(chalk47.bold.cyan("# roy-agent config list"));
|
|
15860
15983
|
output.log("");
|
|
15861
15984
|
output.log("查看 roy-agent 组件配置信息");
|
|
15862
15985
|
output.log("");
|
|
15863
|
-
output.log(
|
|
15864
|
-
output.log(` ${
|
|
15986
|
+
output.log(chalk47.bold("Usage:"));
|
|
15987
|
+
output.log(` ${chalk47.cyan("roy-agent config list [component] [options]")}`);
|
|
15865
15988
|
output.log("");
|
|
15866
|
-
output.log(
|
|
15989
|
+
output.log(chalk47.bold("Components:"));
|
|
15867
15990
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
15868
|
-
output.log(` ${
|
|
15991
|
+
output.log(` ${chalk47.cyan(comp.padEnd(15))} ${chalk47.gray(COMPONENT_DESCRIPTIONS[comp] || "")}`);
|
|
15869
15992
|
}
|
|
15870
|
-
output.log(` ${
|
|
15993
|
+
output.log(` ${chalk47.cyan("all".padEnd(15))} 显示所有 components 概览`);
|
|
15871
15994
|
output.log("");
|
|
15872
|
-
output.log(
|
|
15873
|
-
output.log(` ${
|
|
15874
|
-
output.log(` ${
|
|
15875
|
-
output.log(` ${
|
|
15995
|
+
output.log(chalk47.bold("Options:"));
|
|
15996
|
+
output.log(` ${chalk47.cyan("-j, --json")} JSON 格式输出`);
|
|
15997
|
+
output.log(` ${chalk47.cyan("-k, --keys")} 只显示配置键`);
|
|
15998
|
+
output.log(` ${chalk47.cyan("-s, --sources")} 只显示配置源`);
|
|
15876
15999
|
output.log("");
|
|
15877
|
-
output.log(
|
|
16000
|
+
output.log(chalk47.bold("Examples:"));
|
|
15878
16001
|
for (const { command: command2, description } of USAGE_COMMANDS) {
|
|
15879
|
-
output.log(` ${
|
|
16002
|
+
output.log(` ${chalk47.cyan(command2.padEnd(40))} ${chalk47.gray(description)}`);
|
|
15880
16003
|
}
|
|
15881
16004
|
}
|
|
15882
16005
|
async function showAllComponents(output, configService) {
|
|
@@ -15885,13 +16008,13 @@ async function showAllComponents(output, configService) {
|
|
|
15885
16008
|
const config = configService.getComponentConfig(compName);
|
|
15886
16009
|
components.push({ name: compName, config });
|
|
15887
16010
|
}
|
|
15888
|
-
output.log(
|
|
16011
|
+
output.log(chalk47.bold.cyan("# All Components Overview"));
|
|
15889
16012
|
output.log("");
|
|
15890
|
-
output.log(` ${
|
|
15891
|
-
output.log(` ${
|
|
16013
|
+
output.log(` ${chalk47.cyan("Component".padEnd(15))} ${chalk47.cyan("Keys".padEnd(10))} ${chalk47.gray("Description")}`);
|
|
16014
|
+
output.log(` ${chalk47.gray("─".repeat(60))}`);
|
|
15892
16015
|
for (const comp of components) {
|
|
15893
16016
|
const keyCount = Object.keys(comp.config).length;
|
|
15894
|
-
output.log(` ${
|
|
16017
|
+
output.log(` ${chalk47.cyan(comp.name.padEnd(15))} ${keyCount.toString().padEnd(10)} ${chalk47.gray(COMPONENT_DESCRIPTIONS[comp.name] || "")}`);
|
|
15895
16018
|
}
|
|
15896
16019
|
}
|
|
15897
16020
|
async function showComponentConfig(componentName, output, configService, options) {
|
|
@@ -15913,22 +16036,22 @@ async function showComponentConfig(componentName, output, configService, options
|
|
|
15913
16036
|
});
|
|
15914
16037
|
return;
|
|
15915
16038
|
}
|
|
15916
|
-
output.log(
|
|
16039
|
+
output.log(chalk47.bold.cyan(`# ${componentName} Component Configuration`));
|
|
15917
16040
|
output.log("");
|
|
15918
16041
|
if (filePath) {
|
|
15919
|
-
output.log(
|
|
15920
|
-
output.log(` ${
|
|
16042
|
+
output.log(chalk47.bold("File:"));
|
|
16043
|
+
output.log(` ${chalk47.cyan(filePath)}`);
|
|
15921
16044
|
output.log("");
|
|
15922
16045
|
}
|
|
15923
16046
|
if (!options.sources) {
|
|
15924
|
-
output.log(
|
|
16047
|
+
output.log(chalk47.bold("Configuration:"));
|
|
15925
16048
|
if (Object.keys(config).length === 0) {
|
|
15926
|
-
output.log(` ${
|
|
16049
|
+
output.log(` ${chalk47.gray("(无配置)")}`);
|
|
15927
16050
|
} else {
|
|
15928
16051
|
const flatConfig = flattenConfig(config);
|
|
15929
16052
|
for (const [key, value] of flatConfig) {
|
|
15930
16053
|
const displayValue = formatValue(value);
|
|
15931
|
-
output.log(` ${
|
|
16054
|
+
output.log(` ${chalk47.cyan(key + ":")} ${displayValue}`);
|
|
15932
16055
|
}
|
|
15933
16056
|
}
|
|
15934
16057
|
output.log("");
|
|
@@ -15943,17 +16066,17 @@ async function showAgentComponentConfig(output, configService, options) {
|
|
|
15943
16066
|
});
|
|
15944
16067
|
return;
|
|
15945
16068
|
}
|
|
15946
|
-
output.log(
|
|
16069
|
+
output.log(chalk47.bold.cyan("# Agent Component Configuration"));
|
|
15947
16070
|
output.log("");
|
|
15948
16071
|
if (!options.sources) {
|
|
15949
|
-
output.log(
|
|
16072
|
+
output.log(chalk47.bold("Configuration:"));
|
|
15950
16073
|
if (Object.keys(config).length === 0) {
|
|
15951
|
-
output.log(` ${
|
|
16074
|
+
output.log(` ${chalk47.gray("(无配置,使用默认值)")}`);
|
|
15952
16075
|
} else {
|
|
15953
16076
|
const flatConfig = flattenConfig(config);
|
|
15954
16077
|
for (const [key, value] of flatConfig) {
|
|
15955
16078
|
const displayValue = formatValue(value);
|
|
15956
|
-
output.log(` ${
|
|
16079
|
+
output.log(` ${chalk47.cyan(key + ":")} ${displayValue}`);
|
|
15957
16080
|
}
|
|
15958
16081
|
}
|
|
15959
16082
|
output.log("");
|
|
@@ -15967,10 +16090,10 @@ async function showAgentComponentConfig(output, configService, options) {
|
|
|
15967
16090
|
const configDir = registry.getConfigDir();
|
|
15968
16091
|
const exists = registry.configDirExists();
|
|
15969
16092
|
const agentCount = registry.list().length;
|
|
15970
|
-
output.log(
|
|
15971
|
-
output.log(` ${
|
|
15972
|
-
output.log(` ${
|
|
15973
|
-
output.log(` ${
|
|
16093
|
+
output.log(chalk47.bold("Agent Config Directory:"));
|
|
16094
|
+
output.log(` ${chalk47.cyan("path:")} ${configDir}`);
|
|
16095
|
+
output.log(` ${chalk47.cyan("exists:")} ${exists ? chalk47.green("yes") : chalk47.red("no")}`);
|
|
16096
|
+
output.log(` ${chalk47.cyan("agents:")} ${agentCount} loaded`);
|
|
15974
16097
|
output.log("");
|
|
15975
16098
|
}
|
|
15976
16099
|
}
|
|
@@ -15986,41 +16109,41 @@ async function showPromptComponentConfig(output, configService, options, envServ
|
|
|
15986
16109
|
});
|
|
15987
16110
|
return;
|
|
15988
16111
|
}
|
|
15989
|
-
output.log(
|
|
16112
|
+
output.log(chalk47.bold.cyan("# Prompt Component Configuration"));
|
|
15990
16113
|
output.log("");
|
|
15991
16114
|
if (filePath) {
|
|
15992
|
-
output.log(
|
|
15993
|
-
output.log(` ${
|
|
16115
|
+
output.log(chalk47.bold("File:"));
|
|
16116
|
+
output.log(` ${chalk47.cyan(filePath)}`);
|
|
15994
16117
|
output.log("");
|
|
15995
16118
|
}
|
|
15996
16119
|
if (!options.sources) {
|
|
15997
|
-
output.log(
|
|
16120
|
+
output.log(chalk47.bold("Configuration:"));
|
|
15998
16121
|
if (Object.keys(config).length === 0) {
|
|
15999
|
-
output.log(` ${
|
|
16122
|
+
output.log(` ${chalk47.gray("(无配置,使用默认值)")}`);
|
|
16000
16123
|
} else {
|
|
16001
16124
|
const flatConfig = flattenConfig(config);
|
|
16002
16125
|
for (const [key, value] of flatConfig) {
|
|
16003
16126
|
const displayValue = formatValue(value);
|
|
16004
|
-
output.log(` ${
|
|
16127
|
+
output.log(` ${chalk47.cyan(key + ":")} ${displayValue}`);
|
|
16005
16128
|
}
|
|
16006
16129
|
}
|
|
16007
16130
|
output.log("");
|
|
16008
16131
|
}
|
|
16009
|
-
output.log(
|
|
16010
|
-
output.log(` ${
|
|
16132
|
+
output.log(chalk47.bold("Prompts:"));
|
|
16133
|
+
output.log(` ${chalk47.gray("- 内置: 5 个(default, coding, review, project-memory, global-memory)")}`);
|
|
16011
16134
|
const promptPaths = config?.promptPaths;
|
|
16012
16135
|
if (promptPaths && Array.isArray(promptPaths) && promptPaths.length > 0) {
|
|
16013
|
-
output.log(` ${
|
|
16136
|
+
output.log(` ${chalk47.gray("- 外部: " + promptPaths.length + " 个路径")}`);
|
|
16014
16137
|
for (const p of promptPaths) {
|
|
16015
|
-
output.log(` ${
|
|
16138
|
+
output.log(` ${chalk47.cyan(p.path)} ${chalk47.gray("(type: " + p.type + ")")}`);
|
|
16016
16139
|
}
|
|
16017
16140
|
} else {
|
|
16018
|
-
output.log(` ${
|
|
16141
|
+
output.log(` ${chalk47.gray("- 外部: 0 个(未配置 promptPaths)")}`);
|
|
16019
16142
|
}
|
|
16020
16143
|
output.log("");
|
|
16021
16144
|
const defaultName = config?.defaultName || "default";
|
|
16022
|
-
output.log(
|
|
16023
|
-
output.log(` ${
|
|
16145
|
+
output.log(chalk47.bold("Default Prompt:"));
|
|
16146
|
+
output.log(` ${chalk47.cyan("defaultName:")} ${defaultName}`);
|
|
16024
16147
|
output.log("");
|
|
16025
16148
|
const env = envService?.getEnvironment?.();
|
|
16026
16149
|
if (env) {
|
|
@@ -16035,10 +16158,10 @@ async function showPromptComponentConfig(output, configService, options, envServ
|
|
|
16035
16158
|
const stored = await store?.loadAll?.();
|
|
16036
16159
|
promptCount = Array.isArray(stored) ? stored.length : 0;
|
|
16037
16160
|
} catch {}
|
|
16038
|
-
output.log(
|
|
16039
|
-
output.log(` ${
|
|
16040
|
-
output.log(` ${
|
|
16041
|
-
output.log(` ${
|
|
16161
|
+
output.log(chalk47.bold("Prompt Storage Directory:"));
|
|
16162
|
+
output.log(` ${chalk47.cyan("path:")} ${configDir}`);
|
|
16163
|
+
output.log(` ${chalk47.cyan("exists:")} ${exists ? chalk47.green("yes") : chalk47.red("no")}`);
|
|
16164
|
+
output.log(` ${chalk47.cyan("prompts:")} ${promptCount} loaded`);
|
|
16042
16165
|
output.log("");
|
|
16043
16166
|
}
|
|
16044
16167
|
}
|
|
@@ -16064,19 +16187,19 @@ function flattenConfig(obj, prefix = "") {
|
|
|
16064
16187
|
}
|
|
16065
16188
|
function formatValue(value) {
|
|
16066
16189
|
if (value === undefined) {
|
|
16067
|
-
return
|
|
16190
|
+
return chalk47.gray("undefined");
|
|
16068
16191
|
}
|
|
16069
16192
|
if (value === null) {
|
|
16070
|
-
return
|
|
16193
|
+
return chalk47.gray("null");
|
|
16071
16194
|
}
|
|
16072
16195
|
if (typeof value === "object") {
|
|
16073
|
-
return
|
|
16196
|
+
return chalk47.gray(JSON.stringify(value));
|
|
16074
16197
|
}
|
|
16075
16198
|
return String(value);
|
|
16076
16199
|
}
|
|
16077
16200
|
|
|
16078
16201
|
// src/commands/config/export.ts
|
|
16079
|
-
import
|
|
16202
|
+
import chalk48 from "chalk";
|
|
16080
16203
|
var ConfigExportCommand = {
|
|
16081
16204
|
command: "export <component>",
|
|
16082
16205
|
describe: "导出组件配置到文件",
|
|
@@ -16121,7 +16244,7 @@ var ConfigExportCommand = {
|
|
|
16121
16244
|
output.log("");
|
|
16122
16245
|
output.log("Supported components:");
|
|
16123
16246
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
16124
|
-
output.log(` ${
|
|
16247
|
+
output.log(` ${chalk48.cyan(comp)}`);
|
|
16125
16248
|
}
|
|
16126
16249
|
process.exit(1);
|
|
16127
16250
|
}
|
|
@@ -16139,7 +16262,7 @@ var ConfigExportCommand = {
|
|
|
16139
16262
|
};
|
|
16140
16263
|
|
|
16141
16264
|
// src/commands/config/import.ts
|
|
16142
|
-
import
|
|
16265
|
+
import chalk49 from "chalk";
|
|
16143
16266
|
var ConfigImportCommand = {
|
|
16144
16267
|
command: "import <component>",
|
|
16145
16268
|
describe: "从文件导入配置到组件的 file source",
|
|
@@ -16189,7 +16312,7 @@ var ConfigImportCommand = {
|
|
|
16189
16312
|
output.log("");
|
|
16190
16313
|
output.log("Supported components:");
|
|
16191
16314
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
16192
|
-
output.log(` ${
|
|
16315
|
+
output.log(` ${chalk49.cyan(comp)}`);
|
|
16193
16316
|
}
|
|
16194
16317
|
process.exit(1);
|
|
16195
16318
|
}
|
|
@@ -16204,7 +16327,7 @@ var ConfigImportCommand = {
|
|
|
16204
16327
|
}
|
|
16205
16328
|
if (result.merged && result.changes.length > 0 && args.verbose) {
|
|
16206
16329
|
output.log("");
|
|
16207
|
-
output.log(
|
|
16330
|
+
output.log(chalk49.bold("变更详情:"));
|
|
16208
16331
|
for (const change of result.changes) {
|
|
16209
16332
|
output.log(` ${change.key}: ${JSON.stringify(change.oldValue)} → ${JSON.stringify(change.newValue)}`);
|
|
16210
16333
|
}
|
|
@@ -16228,7 +16351,7 @@ var ConfigCommand = {
|
|
|
16228
16351
|
};
|
|
16229
16352
|
|
|
16230
16353
|
// src/commands/mcp/list.ts
|
|
16231
|
-
import
|
|
16354
|
+
import chalk50 from "chalk";
|
|
16232
16355
|
var ListCommand6 = {
|
|
16233
16356
|
command: "list",
|
|
16234
16357
|
aliases: ["ls"],
|
|
@@ -16288,30 +16411,30 @@ var ListCommand6 = {
|
|
|
16288
16411
|
output.log(hint);
|
|
16289
16412
|
} else {
|
|
16290
16413
|
if (servers.length === 0) {
|
|
16291
|
-
output.log(
|
|
16414
|
+
output.log(chalk50.yellow("No MCP servers configured"));
|
|
16292
16415
|
return;
|
|
16293
16416
|
}
|
|
16294
16417
|
const statusColor = (status) => {
|
|
16295
16418
|
switch (status) {
|
|
16296
16419
|
case "connected":
|
|
16297
|
-
return
|
|
16420
|
+
return chalk50.green;
|
|
16298
16421
|
case "connecting":
|
|
16299
|
-
return
|
|
16422
|
+
return chalk50.yellow;
|
|
16300
16423
|
case "error":
|
|
16301
|
-
return
|
|
16424
|
+
return chalk50.red;
|
|
16302
16425
|
case "disconnected":
|
|
16303
|
-
return
|
|
16426
|
+
return chalk50.gray;
|
|
16304
16427
|
default:
|
|
16305
|
-
return
|
|
16428
|
+
return chalk50.white;
|
|
16306
16429
|
}
|
|
16307
16430
|
};
|
|
16308
16431
|
const header = [
|
|
16309
|
-
|
|
16310
|
-
|
|
16311
|
-
|
|
16432
|
+
chalk50.bold("Name"),
|
|
16433
|
+
chalk50.bold("Status"),
|
|
16434
|
+
chalk50.bold("Tools")
|
|
16312
16435
|
].join(" | ");
|
|
16313
16436
|
const rows = servers.map((s) => [
|
|
16314
|
-
|
|
16437
|
+
chalk50.cyan(s.name),
|
|
16315
16438
|
statusColor(s.status)(`[${s.status}]`),
|
|
16316
16439
|
s.toolsCount !== undefined ? String(s.toolsCount) : "-"
|
|
16317
16440
|
].join(" | "));
|
|
@@ -16342,7 +16465,7 @@ var ListCommand6 = {
|
|
|
16342
16465
|
};
|
|
16343
16466
|
|
|
16344
16467
|
// src/commands/mcp/tools.ts
|
|
16345
|
-
import
|
|
16468
|
+
import chalk51 from "chalk";
|
|
16346
16469
|
var ToolsCommand = {
|
|
16347
16470
|
command: "tools",
|
|
16348
16471
|
aliases: ["t"],
|
|
@@ -16395,7 +16518,7 @@ var ToolsCommand = {
|
|
|
16395
16518
|
tools.forEach((t) => output.log(t.name));
|
|
16396
16519
|
} else {
|
|
16397
16520
|
if (tools.length === 0) {
|
|
16398
|
-
output.log(
|
|
16521
|
+
output.log(chalk51.yellow("No MCP tools available"));
|
|
16399
16522
|
return;
|
|
16400
16523
|
}
|
|
16401
16524
|
const byServer = new Map;
|
|
@@ -16407,15 +16530,15 @@ var ToolsCommand = {
|
|
|
16407
16530
|
byServer.get(serverName).push(tool);
|
|
16408
16531
|
}
|
|
16409
16532
|
for (const [serverName, serverTools] of byServer) {
|
|
16410
|
-
output.log(
|
|
16533
|
+
output.log(chalk51.bold.cyan(`
|
|
16411
16534
|
[${serverName}] ${serverTools.length} tools`));
|
|
16412
16535
|
for (const tool of serverTools) {
|
|
16413
16536
|
const desc2 = tool.description.length > 80 ? tool.description.slice(0, 77) + "..." : tool.description;
|
|
16414
|
-
output.log(` ${
|
|
16415
|
-
output.log(` ${
|
|
16537
|
+
output.log(` ${chalk51.green("+")} ${chalk51.white(tool.name)}`);
|
|
16538
|
+
output.log(` ${chalk51.gray(desc2)}`);
|
|
16416
16539
|
}
|
|
16417
16540
|
}
|
|
16418
|
-
output.log(
|
|
16541
|
+
output.log(chalk51.gray(`
|
|
16419
16542
|
Total: ${tools.length} tools across ${byServer.size} servers`));
|
|
16420
16543
|
}
|
|
16421
16544
|
} catch (error) {
|
|
@@ -16428,7 +16551,7 @@ Total: ${tools.length} tools across ${byServer.size} servers`));
|
|
|
16428
16551
|
};
|
|
16429
16552
|
|
|
16430
16553
|
// src/commands/mcp/reload.ts
|
|
16431
|
-
import
|
|
16554
|
+
import chalk52 from "chalk";
|
|
16432
16555
|
var ReloadCommand2 = {
|
|
16433
16556
|
command: "reload",
|
|
16434
16557
|
aliases: ["r"],
|
|
@@ -16449,19 +16572,19 @@ var ReloadCommand2 = {
|
|
|
16449
16572
|
output.error("McpComponent not available");
|
|
16450
16573
|
process.exit(1);
|
|
16451
16574
|
}
|
|
16452
|
-
output.log(
|
|
16575
|
+
output.log(chalk52.cyan("Reloading MCP servers..."));
|
|
16453
16576
|
await mcpComponent.reload();
|
|
16454
16577
|
const servers = mcpComponent.listServers();
|
|
16455
16578
|
const connected = servers.filter((s) => s.status === "connected").length;
|
|
16456
16579
|
const errors = servers.filter((s) => s.status === "error").length;
|
|
16457
|
-
output.log(
|
|
16580
|
+
output.log(chalk52.green(`✓ Reloaded ${servers.length} servers`));
|
|
16458
16581
|
if (connected > 0) {
|
|
16459
|
-
output.log(
|
|
16582
|
+
output.log(chalk52.green(` • ${connected} connected`));
|
|
16460
16583
|
}
|
|
16461
16584
|
if (errors > 0) {
|
|
16462
16585
|
output.warn(` • ${errors} failed`);
|
|
16463
16586
|
for (const server of servers.filter((s) => s.status === "error")) {
|
|
16464
|
-
output.log(
|
|
16587
|
+
output.log(chalk52.gray(` - ${server.name}: ${server.error}`));
|
|
16465
16588
|
}
|
|
16466
16589
|
}
|
|
16467
16590
|
} catch (error) {
|
|
@@ -16482,7 +16605,7 @@ var McpCommand = {
|
|
|
16482
16605
|
};
|
|
16483
16606
|
|
|
16484
16607
|
// src/commands/tools/list.ts
|
|
16485
|
-
import
|
|
16608
|
+
import chalk53 from "chalk";
|
|
16486
16609
|
var ListCommand7 = {
|
|
16487
16610
|
command: "list",
|
|
16488
16611
|
aliases: ["ls"],
|
|
@@ -16541,16 +16664,16 @@ var ListCommand7 = {
|
|
|
16541
16664
|
output.log(hint);
|
|
16542
16665
|
} else {
|
|
16543
16666
|
const header = [
|
|
16544
|
-
|
|
16545
|
-
|
|
16546
|
-
|
|
16667
|
+
chalk53.bold("Name"),
|
|
16668
|
+
chalk53.bold("Description"),
|
|
16669
|
+
chalk53.bold("Category")
|
|
16547
16670
|
].join(" | ");
|
|
16548
16671
|
const rows = tools.map((t) => {
|
|
16549
16672
|
const desc2 = t.description.length > 40 ? t.description.slice(0, 37) + "..." : t.description;
|
|
16550
16673
|
return [
|
|
16551
|
-
|
|
16674
|
+
chalk53.cyan(t.name),
|
|
16552
16675
|
desc2,
|
|
16553
|
-
t.metadata?.category ?
|
|
16676
|
+
t.metadata?.category ? chalk53.gray(`[${t.metadata.category}]`) : "-"
|
|
16554
16677
|
].join(" | ");
|
|
16555
16678
|
});
|
|
16556
16679
|
output.log([
|
|
@@ -16580,7 +16703,7 @@ var ListCommand7 = {
|
|
|
16580
16703
|
};
|
|
16581
16704
|
|
|
16582
16705
|
// src/commands/tools/get.ts
|
|
16583
|
-
import
|
|
16706
|
+
import chalk54 from "chalk";
|
|
16584
16707
|
|
|
16585
16708
|
// src/commands/tools/shared/schema-helper.ts
|
|
16586
16709
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
@@ -16655,8 +16778,8 @@ var GetCommand6 = {
|
|
|
16655
16778
|
}))
|
|
16656
16779
|
});
|
|
16657
16780
|
} else {
|
|
16658
|
-
output.log(
|
|
16659
|
-
output.log(
|
|
16781
|
+
output.log(chalk54.bold.cyan(`Tool: ${tool.name}`));
|
|
16782
|
+
output.log(chalk54.gray("─".repeat(60)));
|
|
16660
16783
|
output.log(`Description: ${tool.description}`);
|
|
16661
16784
|
if (tool.metadata?.category) {
|
|
16662
16785
|
output.log(`Category: ${tool.metadata.category}`);
|
|
@@ -16665,9 +16788,9 @@ var GetCommand6 = {
|
|
|
16665
16788
|
output.log(`Tags: ${tool.metadata.tags.join(", ")}`);
|
|
16666
16789
|
}
|
|
16667
16790
|
output.log("");
|
|
16668
|
-
output.log(
|
|
16791
|
+
output.log(chalk54.bold("Parameters:"));
|
|
16669
16792
|
for (const param of params) {
|
|
16670
|
-
const required = param.required ?
|
|
16793
|
+
const required = param.required ? chalk54.red("(required)") : chalk54.gray("(optional)");
|
|
16671
16794
|
const defaultVal = param.default !== undefined ? ` [default: ${JSON.stringify(param.default)}]` : "";
|
|
16672
16795
|
output.log(` --${param.name} <${param.type}> ${required}`);
|
|
16673
16796
|
output.log(` ${param.description}${defaultVal}`);
|
|
@@ -16776,14 +16899,14 @@ var ToolsCommand2 = {
|
|
|
16776
16899
|
};
|
|
16777
16900
|
|
|
16778
16901
|
// src/commands/memory/record.ts
|
|
16779
|
-
import
|
|
16902
|
+
import chalk55 from "chalk";
|
|
16780
16903
|
import { createMemoryAgentTools, getBuiltInPrompt } from "@ai-setting/roy-agent-core";
|
|
16781
16904
|
import { bashTool, globTool, readFileTool } from "@ai-setting/roy-agent-core";
|
|
16782
16905
|
async function runExtractMode(output, memoryComponent, agentComponent, sessionComponent, env, options) {
|
|
16783
16906
|
const { scope, sessionId, require: userRequirement } = options;
|
|
16784
|
-
output.log(
|
|
16907
|
+
output.log(chalk55.blue(`
|
|
16785
16908
|
\uD83D\uDD0D Memory Extract Mode (${scope})`));
|
|
16786
|
-
output.log(
|
|
16909
|
+
output.log(chalk55.gray(`正在分析会话历史,生成记忆...
|
|
16787
16910
|
`));
|
|
16788
16911
|
try {
|
|
16789
16912
|
const currentMemory = await memoryComponent.recallMemory(scope) || "(无现有记忆)";
|
|
@@ -16829,13 +16952,13 @@ async function runExtractMode(output, memoryComponent, agentComponent, sessionCo
|
|
|
16829
16952
|
for (const tool of agentTools) {
|
|
16830
16953
|
try {
|
|
16831
16954
|
toolComponent.register(tool);
|
|
16832
|
-
output.log(
|
|
16955
|
+
output.log(chalk55.gray(`Tool registered: ${tool.name}`));
|
|
16833
16956
|
} catch (err) {
|
|
16834
|
-
output.log(
|
|
16957
|
+
output.log(chalk55.gray(`Tool already registered: ${tool.name}`));
|
|
16835
16958
|
}
|
|
16836
16959
|
}
|
|
16837
16960
|
}
|
|
16838
|
-
output.log(
|
|
16961
|
+
output.log(chalk55.gray(`Agent "${agentName}" registered with ${agentTools.length} tools`));
|
|
16839
16962
|
const query = `请分析会话历史,提炼${scope === "project" ? "项目" : "全局"}记忆并写入记忆文件。`;
|
|
16840
16963
|
let result;
|
|
16841
16964
|
try {
|
|
@@ -16849,12 +16972,12 @@ async function runExtractMode(output, memoryComponent, agentComponent, sessionCo
|
|
|
16849
16972
|
if (result && result.startsWith("执行失败")) {
|
|
16850
16973
|
output.error(`提取失败: ${result}`);
|
|
16851
16974
|
} else if (result) {
|
|
16852
|
-
output.log(
|
|
16975
|
+
output.log(chalk55.green(`
|
|
16853
16976
|
✅ 记忆提取完成`));
|
|
16854
|
-
output.log(
|
|
16977
|
+
output.log(chalk55.gray(`记忆已保存到 memory 文件。
|
|
16855
16978
|
`));
|
|
16856
16979
|
if (result.length > 0 && result !== "✅ 记忆提取完成") {
|
|
16857
|
-
output.log(
|
|
16980
|
+
output.log(chalk55.gray(`执行摘要: ${result.substring(0, 200)}${result.length > 200 ? "..." : ""}`));
|
|
16858
16981
|
}
|
|
16859
16982
|
}
|
|
16860
16983
|
agentComponent.unregisterAgent(agentName);
|
|
@@ -16972,11 +17095,11 @@ var RecordCommand = {
|
|
|
16972
17095
|
prepend: "已插入内容到记忆文件开头",
|
|
16973
17096
|
delete: "已删除记忆文件"
|
|
16974
17097
|
};
|
|
16975
|
-
output.log(
|
|
16976
|
-
output.log(
|
|
17098
|
+
output.log(chalk55.green(`✓ ${actionMessages[result.action]}`));
|
|
17099
|
+
output.log(chalk55.gray(`路径: ${result.path}`));
|
|
16977
17100
|
if (result.action !== "delete" && a.content) {
|
|
16978
17101
|
const preview = a.content.substring(0, 100);
|
|
16979
|
-
output.log(
|
|
17102
|
+
output.log(chalk55.gray(`内容预览: ${preview}${a.content.length > 100 ? "..." : ""}`));
|
|
16980
17103
|
}
|
|
16981
17104
|
} catch (error) {
|
|
16982
17105
|
output.error(`Failed to record memory: ${error}`);
|
|
@@ -16988,7 +17111,7 @@ var RecordCommand = {
|
|
|
16988
17111
|
};
|
|
16989
17112
|
|
|
16990
17113
|
// src/commands/memory/recall.ts
|
|
16991
|
-
import
|
|
17114
|
+
import chalk56 from "chalk";
|
|
16992
17115
|
var RecallCommand = {
|
|
16993
17116
|
command: "recall",
|
|
16994
17117
|
aliases: ["load"],
|
|
@@ -17024,7 +17147,7 @@ var RecallCommand = {
|
|
|
17024
17147
|
}
|
|
17025
17148
|
const content = await memoryComponent.recallMemory(a.scope);
|
|
17026
17149
|
if (!content) {
|
|
17027
|
-
output.log(
|
|
17150
|
+
output.log(chalk56.gray("(No memory files found)"));
|
|
17028
17151
|
return;
|
|
17029
17152
|
}
|
|
17030
17153
|
if (a.json) {
|
|
@@ -17050,7 +17173,7 @@ var MemoryCommand = {
|
|
|
17050
17173
|
handler: () => {}
|
|
17051
17174
|
};
|
|
17052
17175
|
// src/commands/eventsource/list.ts
|
|
17053
|
-
import
|
|
17176
|
+
import chalk57 from "chalk";
|
|
17054
17177
|
function truncateVisual2(str, maxWidth) {
|
|
17055
17178
|
let result = "";
|
|
17056
17179
|
let width = 0;
|
|
@@ -17065,7 +17188,7 @@ function truncateVisual2(str, maxWidth) {
|
|
|
17065
17188
|
}
|
|
17066
17189
|
function formatSourcesTable(sources) {
|
|
17067
17190
|
if (sources.length === 0) {
|
|
17068
|
-
return
|
|
17191
|
+
return chalk57.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加");
|
|
17069
17192
|
}
|
|
17070
17193
|
const ID_WIDTH = 10;
|
|
17071
17194
|
const NAME_WIDTH = 20;
|
|
@@ -17074,11 +17197,11 @@ function formatSourcesTable(sources) {
|
|
|
17074
17197
|
const ENABLED_WIDTH = 8;
|
|
17075
17198
|
const GAP = " ";
|
|
17076
17199
|
const headerLine = [
|
|
17077
|
-
|
|
17078
|
-
|
|
17079
|
-
|
|
17080
|
-
|
|
17081
|
-
|
|
17200
|
+
chalk57.bold("ID".padEnd(ID_WIDTH)),
|
|
17201
|
+
chalk57.bold("NAME".padEnd(NAME_WIDTH)),
|
|
17202
|
+
chalk57.bold("TYPE".padEnd(TYPE_WIDTH)),
|
|
17203
|
+
chalk57.bold("STATUS".padEnd(STATUS_WIDTH)),
|
|
17204
|
+
chalk57.bold("ENABLED".padEnd(ENABLED_WIDTH))
|
|
17082
17205
|
].join(GAP);
|
|
17083
17206
|
const sepLine = "─".repeat(ID_WIDTH + NAME_WIDTH + TYPE_WIDTH + STATUS_WIDTH + ENABLED_WIDTH + GAP.length * 4);
|
|
17084
17207
|
const formatRow = (src) => {
|
|
@@ -17136,7 +17259,7 @@ var EventSourceListCommand = {
|
|
|
17136
17259
|
sources: []
|
|
17137
17260
|
});
|
|
17138
17261
|
} else {
|
|
17139
|
-
output.log(
|
|
17262
|
+
output.log(chalk57.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加"));
|
|
17140
17263
|
}
|
|
17141
17264
|
return;
|
|
17142
17265
|
}
|
|
@@ -17171,21 +17294,21 @@ var EventSourceListCommand = {
|
|
|
17171
17294
|
const rows = sources.map((s) => {
|
|
17172
17295
|
const status = esComponent.getStatus(s.id) || "unknown";
|
|
17173
17296
|
const statusColorMap = {
|
|
17174
|
-
running:
|
|
17175
|
-
stopped:
|
|
17176
|
-
error:
|
|
17177
|
-
starting:
|
|
17178
|
-
created:
|
|
17179
|
-
stopping:
|
|
17180
|
-
unknown:
|
|
17297
|
+
running: chalk57.green,
|
|
17298
|
+
stopped: chalk57.gray,
|
|
17299
|
+
error: chalk57.red,
|
|
17300
|
+
starting: chalk57.yellow,
|
|
17301
|
+
created: chalk57.gray,
|
|
17302
|
+
stopping: chalk57.yellow,
|
|
17303
|
+
unknown: chalk57.gray
|
|
17181
17304
|
};
|
|
17182
|
-
const statusColor = statusColorMap[status] ||
|
|
17305
|
+
const statusColor = statusColorMap[status] || chalk57.gray;
|
|
17183
17306
|
return {
|
|
17184
17307
|
id: s.id.substring(0, 8),
|
|
17185
17308
|
name: s.name,
|
|
17186
17309
|
type: s.type,
|
|
17187
17310
|
status: statusColor(status),
|
|
17188
|
-
enabled: s.enabled ?
|
|
17311
|
+
enabled: s.enabled ? chalk57.green("✓") : chalk57.gray("✗")
|
|
17189
17312
|
};
|
|
17190
17313
|
});
|
|
17191
17314
|
output.log(formatSourcesTable(rows));
|
|
@@ -17207,11 +17330,11 @@ var EventSourceListCommand = {
|
|
|
17207
17330
|
};
|
|
17208
17331
|
|
|
17209
17332
|
// src/commands/eventsource/add.ts
|
|
17210
|
-
import
|
|
17333
|
+
import chalk59 from "chalk";
|
|
17211
17334
|
import { generateId } from "@ai-setting/roy-agent-core";
|
|
17212
17335
|
|
|
17213
17336
|
// src/commands/eventsource/server-url-option.ts
|
|
17214
|
-
import
|
|
17337
|
+
import chalk58 from "chalk";
|
|
17215
17338
|
function addServerUrlOption(yargs) {
|
|
17216
17339
|
return yargs.option("server-url", {
|
|
17217
17340
|
alias: "s",
|
|
@@ -17227,7 +17350,7 @@ function resolveServerUrl(serverUrl, fallback) {
|
|
|
17227
17350
|
return fallback;
|
|
17228
17351
|
const trimmed = serverUrl.replace(/\/+$/, "");
|
|
17229
17352
|
if (!/^(https?|wss?):\/\//.test(trimmed)) {
|
|
17230
|
-
console.error(
|
|
17353
|
+
console.error(chalk58.red(`
|
|
17231
17354
|
✗ Invalid --server-url: "${serverUrl}". Must start with http://, https://, ws://, or wss://
|
|
17232
17355
|
`));
|
|
17233
17356
|
process.exit(1);
|
|
@@ -17320,39 +17443,39 @@ var EventSourceAddCommand = {
|
|
|
17320
17443
|
options: a.prompt ? { prompt: a.prompt } : undefined
|
|
17321
17444
|
};
|
|
17322
17445
|
esComponent.register(config);
|
|
17323
|
-
output.success(
|
|
17446
|
+
output.success(chalk59.green(`事件源 '${a.name}' 添加成功!`));
|
|
17324
17447
|
output.log("");
|
|
17325
|
-
output.log(` ID: ${
|
|
17326
|
-
output.log(` Type: ${
|
|
17448
|
+
output.log(` ID: ${chalk59.gray(config.id)}`);
|
|
17449
|
+
output.log(` Type: ${chalk59.cyan(a.type)}`);
|
|
17327
17450
|
if (eventTypes?.length) {
|
|
17328
|
-
output.log(` Event Types: ${
|
|
17451
|
+
output.log(` Event Types: ${chalk59.gray(eventTypes.join(", "))}`);
|
|
17329
17452
|
}
|
|
17330
17453
|
if (a.command) {
|
|
17331
|
-
output.log(` Command: ${
|
|
17454
|
+
output.log(` Command: ${chalk59.gray(a.command)}`);
|
|
17332
17455
|
}
|
|
17333
17456
|
if (a.interval) {
|
|
17334
|
-
output.log(` Interval: ${
|
|
17457
|
+
output.log(` Interval: ${chalk59.gray(`${a.interval}ms`)}`);
|
|
17335
17458
|
}
|
|
17336
17459
|
if (a.profile) {
|
|
17337
|
-
output.log(` Profile: ${
|
|
17460
|
+
output.log(` Profile: ${chalk59.gray(a.profile)}`);
|
|
17338
17461
|
}
|
|
17339
17462
|
if (a.address) {
|
|
17340
|
-
output.log(` Address: ${
|
|
17463
|
+
output.log(` Address: ${chalk59.gray(a.address)}`);
|
|
17341
17464
|
}
|
|
17342
17465
|
if (a.imServerUrl) {
|
|
17343
|
-
output.log(` IM Server URL: ${
|
|
17466
|
+
output.log(` IM Server URL: ${chalk59.gray(a.imServerUrl)}`);
|
|
17344
17467
|
}
|
|
17345
17468
|
if (resolvedServerUrl) {
|
|
17346
|
-
output.log(` Server URL: ${
|
|
17469
|
+
output.log(` Server URL: ${chalk59.gray(resolvedServerUrl)}`);
|
|
17347
17470
|
}
|
|
17348
17471
|
if (a.tlsSkipVerify) {
|
|
17349
|
-
output.log(` TLS Skip Verify: ${
|
|
17472
|
+
output.log(` TLS Skip Verify: ${chalk59.yellow("⚠ true (自签名场景)")}`);
|
|
17350
17473
|
}
|
|
17351
17474
|
if (a.prompt) {
|
|
17352
|
-
output.log(` Prompt: ${
|
|
17475
|
+
output.log(` Prompt: ${chalk59.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
|
|
17353
17476
|
}
|
|
17354
17477
|
output.log("");
|
|
17355
|
-
output.log(
|
|
17478
|
+
output.log(chalk59.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
|
|
17356
17479
|
} finally {
|
|
17357
17480
|
await envService.dispose();
|
|
17358
17481
|
}
|
|
@@ -17360,7 +17483,7 @@ var EventSourceAddCommand = {
|
|
|
17360
17483
|
};
|
|
17361
17484
|
|
|
17362
17485
|
// src/commands/eventsource/update.ts
|
|
17363
|
-
import
|
|
17486
|
+
import chalk60 from "chalk";
|
|
17364
17487
|
function findSource(esComponent, id) {
|
|
17365
17488
|
const sources = esComponent.list();
|
|
17366
17489
|
const matched = sources.find((s) => s.id === id || s.id.startsWith(id));
|
|
@@ -17432,7 +17555,7 @@ var EventSourceUpdateCommand = {
|
|
|
17432
17555
|
const all = esComponent.list();
|
|
17433
17556
|
if (all.length > 0) {
|
|
17434
17557
|
output.info("");
|
|
17435
|
-
output.info(
|
|
17558
|
+
output.info(chalk60.gray("可用的事件源:"));
|
|
17436
17559
|
for (const s of all) {
|
|
17437
17560
|
output.info(` - ${s.id.substring(0, 8)}: ${s.name} (${s.type})`);
|
|
17438
17561
|
}
|
|
@@ -17474,19 +17597,19 @@ var EventSourceUpdateCommand = {
|
|
|
17474
17597
|
}
|
|
17475
17598
|
try {
|
|
17476
17599
|
const result = await esComponent.update(match.fullId, partial);
|
|
17477
|
-
output.success(
|
|
17600
|
+
output.success(chalk60.green(`✅ 事件源已更新: ${match.source.name}`));
|
|
17478
17601
|
output.log("");
|
|
17479
|
-
output.log(
|
|
17602
|
+
output.log(chalk60.bold("修改字段:"));
|
|
17480
17603
|
const before = match.source;
|
|
17481
17604
|
const after = result.updated;
|
|
17482
17605
|
for (const field of result.fields) {
|
|
17483
17606
|
const beforeVal = JSON.stringify(before[field] ?? before.options?.[field]);
|
|
17484
17607
|
const afterVal = JSON.stringify(after[field] ?? after.options?.[field]);
|
|
17485
|
-
output.log(` ${
|
|
17608
|
+
output.log(` ${chalk60.cyan(field)}: ${chalk60.gray(beforeVal)} ${chalk60.gray("→")} ${chalk60.green(afterVal)}`);
|
|
17486
17609
|
}
|
|
17487
17610
|
output.log("");
|
|
17488
17611
|
if (result.wasRunning) {
|
|
17489
|
-
output.info(
|
|
17612
|
+
output.info(chalk60.yellow(`⚠️ 事件源在更新前正在运行,已自动停止。请使用 'roy-agent eventsource start ${match.fullId.substring(0, 8)}' 手动启动以应用新配置。`));
|
|
17490
17613
|
}
|
|
17491
17614
|
} catch (error) {
|
|
17492
17615
|
output.error(`❌ 更新失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -17499,7 +17622,7 @@ var EventSourceUpdateCommand = {
|
|
|
17499
17622
|
};
|
|
17500
17623
|
|
|
17501
17624
|
// src/commands/eventsource/remove.ts
|
|
17502
|
-
import
|
|
17625
|
+
import chalk61 from "chalk";
|
|
17503
17626
|
var EventSourceRemoveCommand = {
|
|
17504
17627
|
command: "remove <id>",
|
|
17505
17628
|
aliases: ["rm"],
|
|
@@ -17538,7 +17661,7 @@ var EventSourceRemoveCommand = {
|
|
|
17538
17661
|
const status = esComponent.getStatus(matchedSource.id);
|
|
17539
17662
|
if (status === "running" && !args.force) {
|
|
17540
17663
|
output.error(`事件源正在运行中,请先停止: ${matchedSource.name} (${status})`);
|
|
17541
|
-
output.log(
|
|
17664
|
+
output.log(chalk61.gray(`使用 --force 强制移除或 'roy-agent eventsource stop ${matchedSource.id.substring(0, 8)}' 先停止`));
|
|
17542
17665
|
process.exit(1);
|
|
17543
17666
|
}
|
|
17544
17667
|
if (status === "running") {
|
|
@@ -17547,7 +17670,7 @@ var EventSourceRemoveCommand = {
|
|
|
17547
17670
|
}
|
|
17548
17671
|
const result = esComponent.unregister(matchedSource.id);
|
|
17549
17672
|
if (result) {
|
|
17550
|
-
output.success(
|
|
17673
|
+
output.success(chalk61.green(`事件源已移除: ${matchedSource.name}`));
|
|
17551
17674
|
} else {
|
|
17552
17675
|
output.error("移除失败");
|
|
17553
17676
|
process.exit(1);
|
|
@@ -17559,7 +17682,7 @@ var EventSourceRemoveCommand = {
|
|
|
17559
17682
|
};
|
|
17560
17683
|
|
|
17561
17684
|
// src/commands/eventsource/start.ts
|
|
17562
|
-
import
|
|
17685
|
+
import chalk62 from "chalk";
|
|
17563
17686
|
var EventSourceStartCommand = {
|
|
17564
17687
|
command: "start <id>",
|
|
17565
17688
|
describe: "启动指定的事件源",
|
|
@@ -17596,15 +17719,15 @@ var EventSourceStartCommand = {
|
|
|
17596
17719
|
}
|
|
17597
17720
|
const status = esComponent.getStatus(matchedSource.id);
|
|
17598
17721
|
if (status === "running") {
|
|
17599
|
-
output.log(
|
|
17722
|
+
output.log(chalk62.yellow(`事件源已在运行: ${matchedSource.name}`));
|
|
17600
17723
|
return;
|
|
17601
17724
|
}
|
|
17602
17725
|
output.info(`正在启动事件源 '${matchedSource.name}'...`);
|
|
17603
17726
|
try {
|
|
17604
17727
|
await esComponent.startSource(matchedSource.id);
|
|
17605
|
-
output.success(
|
|
17728
|
+
output.success(chalk62.green(`事件源已启动: ${matchedSource.name}`));
|
|
17606
17729
|
if (!args.background) {
|
|
17607
|
-
output.log(
|
|
17730
|
+
output.log(chalk62.gray("按 Ctrl+C 停止..."));
|
|
17608
17731
|
await new Promise((resolve) => {
|
|
17609
17732
|
const cleanup = () => {
|
|
17610
17733
|
process.removeListener("SIGINT", cleanup);
|
|
@@ -17626,7 +17749,7 @@ var EventSourceStartCommand = {
|
|
|
17626
17749
|
};
|
|
17627
17750
|
|
|
17628
17751
|
// src/commands/eventsource/stop.ts
|
|
17629
|
-
import
|
|
17752
|
+
import chalk63 from "chalk";
|
|
17630
17753
|
var EventSourceStopCommand = {
|
|
17631
17754
|
command: "stop <id>",
|
|
17632
17755
|
aliases: ["kill"],
|
|
@@ -17664,13 +17787,13 @@ var EventSourceStopCommand = {
|
|
|
17664
17787
|
}
|
|
17665
17788
|
const status = esComponent.getStatus(matchedSource.id);
|
|
17666
17789
|
if (status !== "running") {
|
|
17667
|
-
output.log(
|
|
17790
|
+
output.log(chalk63.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
|
|
17668
17791
|
return;
|
|
17669
17792
|
}
|
|
17670
17793
|
output.info(`正在停止事件源 '${matchedSource.name}'...`);
|
|
17671
17794
|
try {
|
|
17672
17795
|
await esComponent.stopSource(matchedSource.id);
|
|
17673
|
-
output.success(
|
|
17796
|
+
output.success(chalk63.green(`事件源已停止: ${matchedSource.name}`));
|
|
17674
17797
|
} catch (error) {
|
|
17675
17798
|
output.error(`停止失败: ${error}`);
|
|
17676
17799
|
process.exit(1);
|
|
@@ -17682,14 +17805,14 @@ var EventSourceStopCommand = {
|
|
|
17682
17805
|
};
|
|
17683
17806
|
|
|
17684
17807
|
// src/commands/eventsource/status.ts
|
|
17685
|
-
import
|
|
17808
|
+
import chalk64 from "chalk";
|
|
17686
17809
|
var STATUS_COLORS = {
|
|
17687
|
-
created:
|
|
17688
|
-
starting:
|
|
17689
|
-
running:
|
|
17690
|
-
stopping:
|
|
17691
|
-
stopped:
|
|
17692
|
-
error:
|
|
17810
|
+
created: chalk64.gray,
|
|
17811
|
+
starting: chalk64.yellow,
|
|
17812
|
+
running: chalk64.green,
|
|
17813
|
+
stopping: chalk64.yellow,
|
|
17814
|
+
stopped: chalk64.gray,
|
|
17815
|
+
error: chalk64.red
|
|
17693
17816
|
};
|
|
17694
17817
|
var STATUS_ICONS = {
|
|
17695
17818
|
created: "○",
|
|
@@ -17743,7 +17866,7 @@ var EventSourceStatusCommand = {
|
|
|
17743
17866
|
process.exit(1);
|
|
17744
17867
|
}
|
|
17745
17868
|
const status = esComponent.getStatus(matchedSource.id) || "unknown";
|
|
17746
|
-
const statusColor = STATUS_COLORS[status] ||
|
|
17869
|
+
const statusColor = STATUS_COLORS[status] || chalk64.gray;
|
|
17747
17870
|
if (args.json) {
|
|
17748
17871
|
output.json({
|
|
17749
17872
|
id: matchedSource.id,
|
|
@@ -17760,31 +17883,31 @@ var EventSourceStatusCommand = {
|
|
|
17760
17883
|
});
|
|
17761
17884
|
return;
|
|
17762
17885
|
}
|
|
17763
|
-
output.log(
|
|
17886
|
+
output.log(chalk64.bold("事件源详情"));
|
|
17764
17887
|
output.log("─".repeat(50));
|
|
17765
|
-
output.log(` ID: ${
|
|
17766
|
-
output.log(` Name: ${
|
|
17767
|
-
output.log(` Type: ${
|
|
17888
|
+
output.log(` ID: ${chalk64.gray(matchedSource.id)}`);
|
|
17889
|
+
output.log(` Name: ${chalk64.cyan(matchedSource.name)}`);
|
|
17890
|
+
output.log(` Type: ${chalk64.cyan(matchedSource.type)}`);
|
|
17768
17891
|
output.log(` Status: ${statusColor(`${STATUS_ICONS[status]} ${STATUS_LABELS[status]}`)}`);
|
|
17769
|
-
output.log(` Enabled: ${matchedSource.enabled ?
|
|
17892
|
+
output.log(` Enabled: ${matchedSource.enabled ? chalk64.green("是") : chalk64.gray("否")}`);
|
|
17770
17893
|
if (matchedSource.eventTypes?.length) {
|
|
17771
|
-
output.log(` Events: ${
|
|
17894
|
+
output.log(` Events: ${chalk64.gray(matchedSource.eventTypes.join(", "))}`);
|
|
17772
17895
|
}
|
|
17773
17896
|
if (matchedSource.command) {
|
|
17774
|
-
output.log(` Command: ${
|
|
17897
|
+
output.log(` Command: ${chalk64.gray(matchedSource.command)}`);
|
|
17775
17898
|
}
|
|
17776
17899
|
if (matchedSource.interval) {
|
|
17777
|
-
output.log(` Interval: ${
|
|
17900
|
+
output.log(` Interval: ${chalk64.gray(`${matchedSource.interval}ms`)}`);
|
|
17778
17901
|
}
|
|
17779
17902
|
if (matchedSource.url) {
|
|
17780
|
-
output.log(` URL: ${
|
|
17903
|
+
output.log(` URL: ${chalk64.gray(matchedSource.url)}`);
|
|
17781
17904
|
}
|
|
17782
17905
|
output.log("");
|
|
17783
17906
|
return;
|
|
17784
17907
|
}
|
|
17785
17908
|
const sources = esComponent.list();
|
|
17786
17909
|
if (sources.length === 0) {
|
|
17787
|
-
output.log(
|
|
17910
|
+
output.log(chalk64.yellow("没有配置的事件源"));
|
|
17788
17911
|
return;
|
|
17789
17912
|
}
|
|
17790
17913
|
if (args.json) {
|
|
@@ -17798,21 +17921,21 @@ var EventSourceStatusCommand = {
|
|
|
17798
17921
|
output.json({ sources: sourcesWithStatus, count: sources.length });
|
|
17799
17922
|
return;
|
|
17800
17923
|
}
|
|
17801
|
-
output.log(
|
|
17924
|
+
output.log(chalk64.bold("事件源状态概览"));
|
|
17802
17925
|
output.log("─".repeat(60));
|
|
17803
17926
|
for (const source of sources) {
|
|
17804
17927
|
const status = esComponent.getStatus(source.id) || "unknown";
|
|
17805
|
-
const statusColor = STATUS_COLORS[status] ||
|
|
17928
|
+
const statusColor = STATUS_COLORS[status] || chalk64.gray;
|
|
17806
17929
|
const icon = STATUS_ICONS[status] || "?";
|
|
17807
17930
|
const label = STATUS_LABELS[status] || status;
|
|
17808
17931
|
output.log("");
|
|
17809
|
-
output.log(` ${
|
|
17932
|
+
output.log(` ${chalk64.cyan(source.name)} ${chalk64.gray(`(${source.type})`)}`);
|
|
17810
17933
|
output.log(` └─ Status: ${statusColor(`${icon} ${label}`)}`);
|
|
17811
|
-
output.log(` ID: ${
|
|
17934
|
+
output.log(` ID: ${chalk64.gray(source.id.substring(0, 8))}...`);
|
|
17812
17935
|
}
|
|
17813
17936
|
output.log("");
|
|
17814
17937
|
const runningCount = sources.filter((s) => esComponent.getStatus(s.id) === "running").length;
|
|
17815
|
-
output.log(
|
|
17938
|
+
output.log(chalk64.green(`✅ ${runningCount}/${sources.length} 运行中`));
|
|
17816
17939
|
} finally {
|
|
17817
17940
|
await envService.dispose();
|
|
17818
17941
|
}
|
|
@@ -18125,7 +18248,7 @@ var DebugCommand = {
|
|
|
18125
18248
|
};
|
|
18126
18249
|
|
|
18127
18250
|
// src/commands/workflow/renderers.ts
|
|
18128
|
-
import
|
|
18251
|
+
import chalk65 from "chalk";
|
|
18129
18252
|
function truncateVisual3(str, maxWidth) {
|
|
18130
18253
|
if (!str)
|
|
18131
18254
|
return "-";
|
|
@@ -18160,18 +18283,18 @@ function formatDuration(ms) {
|
|
|
18160
18283
|
function statusColor(status) {
|
|
18161
18284
|
switch (status) {
|
|
18162
18285
|
case "completed":
|
|
18163
|
-
return
|
|
18286
|
+
return chalk65.green;
|
|
18164
18287
|
case "running":
|
|
18165
18288
|
case "idle":
|
|
18166
|
-
return
|
|
18289
|
+
return chalk65.blue;
|
|
18167
18290
|
case "paused":
|
|
18168
|
-
return
|
|
18291
|
+
return chalk65.yellow;
|
|
18169
18292
|
case "failed":
|
|
18170
|
-
return
|
|
18293
|
+
return chalk65.red;
|
|
18171
18294
|
case "stopped":
|
|
18172
|
-
return
|
|
18295
|
+
return chalk65.gray;
|
|
18173
18296
|
default:
|
|
18174
|
-
return
|
|
18297
|
+
return chalk65.white;
|
|
18175
18298
|
}
|
|
18176
18299
|
}
|
|
18177
18300
|
function renderWorkflowList(workflows, options) {
|
|
@@ -18190,7 +18313,7 @@ function renderWorkflowList(workflows, options) {
|
|
|
18190
18313
|
}, null, 2);
|
|
18191
18314
|
}
|
|
18192
18315
|
if (workflows.length === 0) {
|
|
18193
|
-
return
|
|
18316
|
+
return chalk65.yellow("No workflows found");
|
|
18194
18317
|
}
|
|
18195
18318
|
const NAME_WIDTH = 30;
|
|
18196
18319
|
const VERSION_WIDTH = 10;
|
|
@@ -18198,10 +18321,10 @@ function renderWorkflowList(workflows, options) {
|
|
|
18198
18321
|
const UPDATED_WIDTH = 20;
|
|
18199
18322
|
const GAP = " ";
|
|
18200
18323
|
const headerLine = [
|
|
18201
|
-
|
|
18202
|
-
|
|
18203
|
-
|
|
18204
|
-
|
|
18324
|
+
chalk65.bold("NAME".padEnd(NAME_WIDTH)),
|
|
18325
|
+
chalk65.bold("VER".padEnd(VERSION_WIDTH)),
|
|
18326
|
+
chalk65.bold("TAGS".padEnd(TAGS_WIDTH)),
|
|
18327
|
+
chalk65.bold("UPDATED")
|
|
18205
18328
|
].join(GAP);
|
|
18206
18329
|
const sepLine = "─".repeat(NAME_WIDTH + VERSION_WIDTH + TAGS_WIDTH + UPDATED_WIDTH + GAP.length * 3);
|
|
18207
18330
|
const rows = workflows.map((w) => {
|
|
@@ -18216,18 +18339,18 @@ function renderWorkflowList(workflows, options) {
|
|
|
18216
18339
|
}
|
|
18217
18340
|
function renderWorkflowDetail(workflow, options) {
|
|
18218
18341
|
const lines = [];
|
|
18219
|
-
lines.push(
|
|
18342
|
+
lines.push(chalk65.bold(`
|
|
18220
18343
|
\uD83D\uDCCB Workflow Details
|
|
18221
18344
|
`));
|
|
18222
|
-
lines.push(` ${
|
|
18223
|
-
lines.push(` ${
|
|
18224
|
-
lines.push(` ${
|
|
18225
|
-
lines.push(` ${
|
|
18226
|
-
lines.push(` ${
|
|
18227
|
-
lines.push(` ${
|
|
18228
|
-
lines.push(` ${
|
|
18345
|
+
lines.push(` ${chalk65.cyan("ID:")} ${workflow.id}`);
|
|
18346
|
+
lines.push(` ${chalk65.cyan("Name:")} ${workflow.name}`);
|
|
18347
|
+
lines.push(` ${chalk65.cyan("Version:")} ${workflow.version}`);
|
|
18348
|
+
lines.push(` ${chalk65.cyan("Description:")} ${workflow.description || "-"}`);
|
|
18349
|
+
lines.push(` ${chalk65.cyan("Tags:")} ${workflow.tags.join(", ") || "-"}`);
|
|
18350
|
+
lines.push(` ${chalk65.cyan("Created:")} ${formatDate(workflow.createdAt)}`);
|
|
18351
|
+
lines.push(` ${chalk65.cyan("Updated:")} ${formatDate(workflow.updatedAt)}`);
|
|
18229
18352
|
const nodeCount = workflow.definition.nodes.length;
|
|
18230
|
-
lines.push(
|
|
18353
|
+
lines.push(chalk65.bold(`
|
|
18231
18354
|
\uD83D\uDCCA Nodes Summary
|
|
18232
18355
|
`));
|
|
18233
18356
|
lines.push(` Total: ${nodeCount} nodes`);
|
|
@@ -18239,7 +18362,7 @@ function renderWorkflowDetail(workflow, options) {
|
|
|
18239
18362
|
lines.push(` - ${type}: ${count}`);
|
|
18240
18363
|
}
|
|
18241
18364
|
if (workflow.definition.config) {
|
|
18242
|
-
lines.push(
|
|
18365
|
+
lines.push(chalk65.bold(`
|
|
18243
18366
|
⚙️ Configuration
|
|
18244
18367
|
`));
|
|
18245
18368
|
if (workflow.definition.config.parallel_limit !== undefined) {
|
|
@@ -18253,7 +18376,7 @@ function renderWorkflowDetail(workflow, options) {
|
|
|
18253
18376
|
}
|
|
18254
18377
|
}
|
|
18255
18378
|
if (options?.includeRuns && options.includeRuns.length > 0) {
|
|
18256
|
-
lines.push(
|
|
18379
|
+
lines.push(chalk65.bold(`
|
|
18257
18380
|
\uD83D\uDCDC Recent Runs
|
|
18258
18381
|
`));
|
|
18259
18382
|
lines.push(renderRunsList(options.includeRuns.slice(0, 5)));
|
|
@@ -18277,7 +18400,7 @@ function renderRunsList(runs, options) {
|
|
|
18277
18400
|
}, null, 2);
|
|
18278
18401
|
}
|
|
18279
18402
|
if (runs.length === 0) {
|
|
18280
|
-
return
|
|
18403
|
+
return chalk65.yellow("No runs found");
|
|
18281
18404
|
}
|
|
18282
18405
|
const ID_WIDTH = 20;
|
|
18283
18406
|
const STATUS_WIDTH = 12;
|
|
@@ -18285,10 +18408,10 @@ function renderRunsList(runs, options) {
|
|
|
18285
18408
|
const UPDATED_WIDTH = 20;
|
|
18286
18409
|
const GAP = " ";
|
|
18287
18410
|
const headerLine = [
|
|
18288
|
-
|
|
18289
|
-
|
|
18290
|
-
|
|
18291
|
-
|
|
18411
|
+
chalk65.bold("RUN ID".padEnd(ID_WIDTH)),
|
|
18412
|
+
chalk65.bold("STATUS".padEnd(STATUS_WIDTH)),
|
|
18413
|
+
chalk65.bold("DURATION".padEnd(DURATION_WIDTH)),
|
|
18414
|
+
chalk65.bold("STARTED")
|
|
18292
18415
|
].join(GAP);
|
|
18293
18416
|
const sepLine = "─".repeat(ID_WIDTH + STATUS_WIDTH + DURATION_WIDTH + UPDATED_WIDTH + GAP.length * 3);
|
|
18294
18417
|
const rows = runs.map((r) => {
|
|
@@ -18303,34 +18426,34 @@ function renderRunsList(runs, options) {
|
|
|
18303
18426
|
}
|
|
18304
18427
|
function renderRunDetail(run) {
|
|
18305
18428
|
const lines = [];
|
|
18306
|
-
lines.push(
|
|
18429
|
+
lines.push(chalk65.bold(`
|
|
18307
18430
|
\uD83C\uDFC3 Run Details
|
|
18308
18431
|
`));
|
|
18309
|
-
lines.push(` ${
|
|
18310
|
-
lines.push(` ${
|
|
18311
|
-
lines.push(` ${
|
|
18312
|
-
lines.push(` ${
|
|
18432
|
+
lines.push(` ${chalk65.cyan("Run ID:")} ${run.id}`);
|
|
18433
|
+
lines.push(` ${chalk65.cyan("Workflow:")} ${run.workflowId}`);
|
|
18434
|
+
lines.push(` ${chalk65.cyan("Status:")} ${statusColor(run.status)(run.status)}`);
|
|
18435
|
+
lines.push(` ${chalk65.cyan("Started:")} ${formatDate(run.startedAt)}`);
|
|
18313
18436
|
if (run.pausedAt) {
|
|
18314
|
-
lines.push(` ${
|
|
18437
|
+
lines.push(` ${chalk65.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
|
|
18315
18438
|
}
|
|
18316
18439
|
if (run.resumedAt) {
|
|
18317
|
-
lines.push(` ${
|
|
18440
|
+
lines.push(` ${chalk65.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
|
|
18318
18441
|
}
|
|
18319
18442
|
if (run.stoppedAt) {
|
|
18320
|
-
lines.push(` ${
|
|
18443
|
+
lines.push(` ${chalk65.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
|
|
18321
18444
|
}
|
|
18322
18445
|
if (run.completedAt) {
|
|
18323
|
-
lines.push(` ${
|
|
18446
|
+
lines.push(` ${chalk65.cyan("Completed:")} ${formatDate(run.completedAt)}`);
|
|
18324
18447
|
}
|
|
18325
|
-
lines.push(` ${
|
|
18448
|
+
lines.push(` ${chalk65.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
|
|
18326
18449
|
if (run.error) {
|
|
18327
|
-
lines.push(
|
|
18450
|
+
lines.push(chalk65.bold(`
|
|
18328
18451
|
❌ Error
|
|
18329
18452
|
`));
|
|
18330
|
-
lines.push(` ${
|
|
18453
|
+
lines.push(` ${chalk65.red(run.error)}`);
|
|
18331
18454
|
}
|
|
18332
18455
|
if (run.output) {
|
|
18333
|
-
lines.push(
|
|
18456
|
+
lines.push(chalk65.bold(`
|
|
18334
18457
|
\uD83D\uDCE4 Output
|
|
18335
18458
|
`));
|
|
18336
18459
|
lines.push(" " + JSON.stringify(run.output, null, 2).split(`
|
|
@@ -18341,36 +18464,36 @@ function renderRunDetail(run) {
|
|
|
18341
18464
|
`);
|
|
18342
18465
|
}
|
|
18343
18466
|
function renderWorkflowAdded(workflow) {
|
|
18344
|
-
return
|
|
18467
|
+
return chalk65.green(`
|
|
18345
18468
|
✅ Workflow '${workflow.name}' added successfully
|
|
18346
18469
|
`) + ` ID: ${workflow.id}
|
|
18347
18470
|
` + ` Version: ${workflow.version}
|
|
18348
18471
|
`;
|
|
18349
18472
|
}
|
|
18350
18473
|
function renderWorkflowUpdated(workflow) {
|
|
18351
|
-
return
|
|
18474
|
+
return chalk65.green(`
|
|
18352
18475
|
✅ Workflow '${workflow.name}' updated successfully
|
|
18353
18476
|
`) + ` ID: ${workflow.id}
|
|
18354
18477
|
`;
|
|
18355
18478
|
}
|
|
18356
18479
|
function renderWorkflowDeleted(name) {
|
|
18357
|
-
return
|
|
18480
|
+
return chalk65.green(`
|
|
18358
18481
|
✅ Workflow '${name}' deleted successfully
|
|
18359
18482
|
`);
|
|
18360
18483
|
}
|
|
18361
18484
|
function renderRunResult(result) {
|
|
18362
18485
|
const lines = [];
|
|
18363
18486
|
if (result.status === "completed") {
|
|
18364
|
-
lines.push(
|
|
18487
|
+
lines.push(chalk65.green(`
|
|
18365
18488
|
✅ Workflow completed successfully`));
|
|
18366
18489
|
} else if (result.status === "failed") {
|
|
18367
|
-
lines.push(
|
|
18490
|
+
lines.push(chalk65.red(`
|
|
18368
18491
|
❌ Workflow failed`));
|
|
18369
18492
|
} else if (result.status === "stopped") {
|
|
18370
|
-
lines.push(
|
|
18493
|
+
lines.push(chalk65.yellow(`
|
|
18371
18494
|
⚠️ Workflow stopped`));
|
|
18372
18495
|
} else {
|
|
18373
|
-
lines.push(
|
|
18496
|
+
lines.push(chalk65.blue(`
|
|
18374
18497
|
\uD83D\uDD04 Workflow ${result.status}`));
|
|
18375
18498
|
}
|
|
18376
18499
|
lines.push(` Run ID: ${result.runId}`);
|
|
@@ -18378,11 +18501,11 @@ function renderRunResult(result) {
|
|
|
18378
18501
|
lines.push(` Duration: ${formatDuration(result.durationMs)}`);
|
|
18379
18502
|
}
|
|
18380
18503
|
if (result.error) {
|
|
18381
|
-
lines.push(
|
|
18504
|
+
lines.push(chalk65.red(`
|
|
18382
18505
|
Error: ${result.error}`));
|
|
18383
18506
|
}
|
|
18384
18507
|
if (result.output) {
|
|
18385
|
-
lines.push(
|
|
18508
|
+
lines.push(chalk65.bold(`
|
|
18386
18509
|
\uD83D\uDCE4 Output:`));
|
|
18387
18510
|
lines.push(JSON.stringify(result.output, null, 2));
|
|
18388
18511
|
}
|
|
@@ -18396,10 +18519,10 @@ function renderNodesList(nodes) {
|
|
|
18396
18519
|
const DEPS_WIDTH = 20;
|
|
18397
18520
|
const GAP = " ";
|
|
18398
18521
|
const headerLine = [
|
|
18399
|
-
|
|
18400
|
-
|
|
18401
|
-
|
|
18402
|
-
|
|
18522
|
+
chalk65.bold("NODE ID".padEnd(ID_WIDTH)),
|
|
18523
|
+
chalk65.bold("TYPE".padEnd(TYPE_WIDTH)),
|
|
18524
|
+
chalk65.bold("NAME".padEnd(NAME_WIDTH)),
|
|
18525
|
+
chalk65.bold("DEPENDS ON")
|
|
18403
18526
|
].join(GAP);
|
|
18404
18527
|
const sepLine = "─".repeat(ID_WIDTH + TYPE_WIDTH + NAME_WIDTH + DEPS_WIDTH + GAP.length * 3);
|
|
18405
18528
|
const rows = nodes.map((n) => {
|
|
@@ -18414,7 +18537,7 @@ function renderNodesList(nodes) {
|
|
|
18414
18537
|
}
|
|
18415
18538
|
|
|
18416
18539
|
// src/commands/workflow/commands/list.ts
|
|
18417
|
-
import
|
|
18540
|
+
import chalk66 from "chalk";
|
|
18418
18541
|
import { createWorkflowListTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
18419
18542
|
function buildListWorkflowsJson(workflows, total, args, availableTags) {
|
|
18420
18543
|
const output = {
|
|
@@ -18574,20 +18697,20 @@ var WorkflowListCommand = {
|
|
|
18574
18697
|
if (total > workflows.length) {
|
|
18575
18698
|
const start = finalOffset + 1;
|
|
18576
18699
|
const end = finalOffset + workflows.length;
|
|
18577
|
-
output.log(
|
|
18700
|
+
output.log(chalk66.green(`
|
|
18578
18701
|
✅ 显示 ${start}-${end} / 共 ${total} 个 Workflow`));
|
|
18579
18702
|
const totalPages = Math.ceil(total / pageSize);
|
|
18580
18703
|
const currentPage = Math.floor(finalOffset / pageSize) + 1;
|
|
18581
18704
|
if (totalPages > 1) {
|
|
18582
|
-
output.log(
|
|
18705
|
+
output.log(chalk66.cyan(`\uD83D\uDCC4 第 ${currentPage} / ${totalPages} 页`));
|
|
18583
18706
|
}
|
|
18584
18707
|
} else {
|
|
18585
|
-
output.log(
|
|
18708
|
+
output.log(chalk66.green(`
|
|
18586
18709
|
✅ 共 ${total} 个 Workflow`));
|
|
18587
18710
|
}
|
|
18588
18711
|
if (availableTags.length > 0) {
|
|
18589
18712
|
const tagsLine = availableTags.map((t) => `${t.name}(${t.count})`).join(", ");
|
|
18590
|
-
output.log(
|
|
18713
|
+
output.log(chalk66.cyan(`
|
|
18591
18714
|
\uD83C\uDFF7️ Available tags: ${tagsLine}`));
|
|
18592
18715
|
}
|
|
18593
18716
|
}
|
|
@@ -19191,7 +19314,7 @@ class WorkflowValidator {
|
|
|
19191
19314
|
|
|
19192
19315
|
// src/commands/workflow/commands/add.ts
|
|
19193
19316
|
import { validateWorkflowDefinition } from "@ai-setting/roy-agent-core/env/workflow/utils";
|
|
19194
|
-
import
|
|
19317
|
+
import chalk67 from "chalk";
|
|
19195
19318
|
import fs3 from "fs";
|
|
19196
19319
|
import path6 from "path";
|
|
19197
19320
|
async function parseWorkflowContent(content, filename) {
|
|
@@ -19333,7 +19456,7 @@ var WorkflowAddCommand = {
|
|
|
19333
19456
|
definition = await parseWorkflowContent(content, filePath);
|
|
19334
19457
|
workflowName = a.name || definition.name || path6.basename(filePath);
|
|
19335
19458
|
if (a.validate) {
|
|
19336
|
-
output.log(
|
|
19459
|
+
output.log(chalk67.blue("\uD83D\uDD0D Validating workflow..."));
|
|
19337
19460
|
const dagResult = validateWorkflowDefinition(definition);
|
|
19338
19461
|
if (!dagResult.valid) {
|
|
19339
19462
|
output.error(`
|
|
@@ -19357,11 +19480,11 @@ var WorkflowAddCommand = {
|
|
|
19357
19480
|
});
|
|
19358
19481
|
process.exit(1);
|
|
19359
19482
|
}
|
|
19360
|
-
output.log(
|
|
19483
|
+
output.log(chalk67.green(`✅ Workflow validation passed
|
|
19361
19484
|
`));
|
|
19362
19485
|
}
|
|
19363
19486
|
} else if (a.desc) {
|
|
19364
|
-
output.log(
|
|
19487
|
+
output.log(chalk67.blue(`\uD83E\uDD16 Generating workflow from description...
|
|
19365
19488
|
`));
|
|
19366
19489
|
const agentComponent = env.getComponent("agent");
|
|
19367
19490
|
if (!agentComponent) {
|
|
@@ -19383,20 +19506,20 @@ ${a.desc}
|
|
|
19383
19506
|
1. 先用 \`roy-agent workflow nodes\` 查看可用的节点类型
|
|
19384
19507
|
2. 生成的 YAML 必须通过 \`roy-agent workflow validate --yaml "<yaml>"\` 验证
|
|
19385
19508
|
3. 验证通过后才输出最终 YAML`;
|
|
19386
|
-
output.log(
|
|
19509
|
+
output.log(chalk67.gray("Running workflow-extract agent..."));
|
|
19387
19510
|
const result = await agentComponent.run("workflow-extract", prompt);
|
|
19388
19511
|
const agentOutput = result.finalText || "";
|
|
19389
19512
|
definition = parseYamlFromAgentOutput(agentOutput);
|
|
19390
19513
|
if (definition === null) {
|
|
19391
19514
|
output.error("Failed to parse workflow from agent output");
|
|
19392
|
-
output.log(
|
|
19515
|
+
output.log(chalk67.gray(`
|
|
19393
19516
|
Agent output:
|
|
19394
19517
|
` + agentOutput.slice(0, 500)));
|
|
19395
19518
|
process.exit(1);
|
|
19396
19519
|
}
|
|
19397
19520
|
workflowName = a.name || definition.name;
|
|
19398
19521
|
if (a.validate) {
|
|
19399
|
-
output.log(
|
|
19522
|
+
output.log(chalk67.blue(`
|
|
19400
19523
|
\uD83D\uDD0D Validating generated workflow...`));
|
|
19401
19524
|
const dagResult = validateWorkflowDefinition(definition);
|
|
19402
19525
|
if (!dagResult.valid) {
|
|
@@ -19405,7 +19528,7 @@ Agent output:
|
|
|
19405
19528
|
dagResult.errors.forEach((msg, i) => {
|
|
19406
19529
|
output.error(`[Error ${i + 1}/${dagResult.errors.length}] ${msg}`);
|
|
19407
19530
|
});
|
|
19408
|
-
output.log(
|
|
19531
|
+
output.log(chalk67.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
|
|
19409
19532
|
process.exit(1);
|
|
19410
19533
|
}
|
|
19411
19534
|
const validator = new WorkflowValidator;
|
|
@@ -19420,16 +19543,16 @@ Agent output:
|
|
|
19420
19543
|
output.error(` Fix: ${error.fix}
|
|
19421
19544
|
`);
|
|
19422
19545
|
});
|
|
19423
|
-
output.log(
|
|
19546
|
+
output.log(chalk67.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
|
|
19424
19547
|
process.exit(1);
|
|
19425
19548
|
}
|
|
19426
|
-
output.log(
|
|
19549
|
+
output.log(chalk67.green(`✅ Generated workflow validation passed
|
|
19427
19550
|
`));
|
|
19428
19551
|
}
|
|
19429
19552
|
const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
|
|
19430
|
-
output.log(
|
|
19553
|
+
output.log(chalk67.gray("--- Generated YAML ---"));
|
|
19431
19554
|
output.log(yaml.stringify(definition));
|
|
19432
|
-
output.log(
|
|
19555
|
+
output.log(chalk67.gray(`------------------------
|
|
19433
19556
|
`));
|
|
19434
19557
|
} else {
|
|
19435
19558
|
output.error("Please provide --file or --desc option");
|
|
@@ -19455,10 +19578,10 @@ Agent output:
|
|
|
19455
19578
|
force: a.force
|
|
19456
19579
|
});
|
|
19457
19580
|
output.log(renderWorkflowAdded(workflow));
|
|
19458
|
-
output.log(
|
|
19581
|
+
output.log(chalk67.bold(`
|
|
19459
19582
|
\uD83D\uDCCA Nodes Summary:`));
|
|
19460
19583
|
output.log(renderNodesList(definition.nodes));
|
|
19461
|
-
output.log(
|
|
19584
|
+
output.log(chalk67.green(`
|
|
19462
19585
|
✅ Workflow '${workflowName}' added successfully`));
|
|
19463
19586
|
} catch (error) {
|
|
19464
19587
|
if (error.message?.includes("already exists") && !a.force) {
|
|
@@ -19475,7 +19598,7 @@ Agent output:
|
|
|
19475
19598
|
};
|
|
19476
19599
|
|
|
19477
19600
|
// src/commands/workflow/commands/get.ts
|
|
19478
|
-
import
|
|
19601
|
+
import chalk68 from "chalk";
|
|
19479
19602
|
import { createWorkflowGetTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
19480
19603
|
var WorkflowGetCommand = {
|
|
19481
19604
|
command: "get <identifier>",
|
|
@@ -19613,15 +19736,15 @@ var WorkflowGetCommand = {
|
|
|
19613
19736
|
} else {
|
|
19614
19737
|
output.log(renderWorkflowDetail(workflow, { includeRuns: runs }));
|
|
19615
19738
|
if (args.includeNodes) {
|
|
19616
|
-
output.log(
|
|
19739
|
+
output.log(chalk68.bold(`
|
|
19617
19740
|
\uD83D\uDCCB All Nodes:`));
|
|
19618
19741
|
output.log(renderNodesList(data.nodes || []));
|
|
19619
19742
|
}
|
|
19620
19743
|
const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
|
|
19621
19744
|
const defYaml = yaml.stringify(data.definition || {}, { indent: 2 });
|
|
19622
|
-
output.log(
|
|
19745
|
+
output.log(chalk68.bold(`
|
|
19623
19746
|
\uD83D\uDCC4 Definition (YAML):`));
|
|
19624
|
-
output.log(
|
|
19747
|
+
output.log(chalk68.gray(defYaml));
|
|
19625
19748
|
}
|
|
19626
19749
|
}
|
|
19627
19750
|
} catch (error) {
|
|
@@ -19634,7 +19757,7 @@ var WorkflowGetCommand = {
|
|
|
19634
19757
|
};
|
|
19635
19758
|
|
|
19636
19759
|
// src/commands/workflow/commands/update.ts
|
|
19637
|
-
import
|
|
19760
|
+
import chalk69 from "chalk";
|
|
19638
19761
|
import fs4 from "fs";
|
|
19639
19762
|
import path7 from "path";
|
|
19640
19763
|
import { parseWorkflowFile } from "@ai-setting/roy-agent-core/env/workflow/types";
|
|
@@ -19707,7 +19830,7 @@ var WorkflowUpdateCommand = {
|
|
|
19707
19830
|
const tags = a.tags ? a.tags.split(",").map((t) => t.trim()) : undefined;
|
|
19708
19831
|
const workflow = await service.updateWorkflow(a.name, updates, { tags });
|
|
19709
19832
|
output.log(renderWorkflowUpdated(workflow));
|
|
19710
|
-
output.log(
|
|
19833
|
+
output.log(chalk69.green(`
|
|
19711
19834
|
✅ Workflow '${a.name}' updated successfully`));
|
|
19712
19835
|
} catch (error) {
|
|
19713
19836
|
output.error(`Failed to update workflow: ${error}`);
|
|
@@ -19719,7 +19842,7 @@ var WorkflowUpdateCommand = {
|
|
|
19719
19842
|
};
|
|
19720
19843
|
|
|
19721
19844
|
// src/commands/workflow/commands/remove.ts
|
|
19722
|
-
import
|
|
19845
|
+
import chalk70 from "chalk";
|
|
19723
19846
|
var WorkflowRemoveCommand = {
|
|
19724
19847
|
command: "remove <name>",
|
|
19725
19848
|
describe: "删除 Workflow",
|
|
@@ -19758,8 +19881,8 @@ var WorkflowRemoveCommand = {
|
|
|
19758
19881
|
process.exit(1);
|
|
19759
19882
|
}
|
|
19760
19883
|
if (!args.force) {
|
|
19761
|
-
output.log(
|
|
19762
|
-
output.log(
|
|
19884
|
+
output.log(chalk70.yellow(`Are you sure you want to delete workflow '${args.name}'?`));
|
|
19885
|
+
output.log(chalk70.gray("Use --force to skip confirmation"));
|
|
19763
19886
|
process.exit(1);
|
|
19764
19887
|
}
|
|
19765
19888
|
const deleted = await service.deleteWorkflow(args.name);
|
|
@@ -19779,7 +19902,7 @@ var WorkflowRemoveCommand = {
|
|
|
19779
19902
|
|
|
19780
19903
|
// src/commands/workflow/commands/run.ts
|
|
19781
19904
|
var import_yaml = __toESM(require_dist(), 1);
|
|
19782
|
-
import
|
|
19905
|
+
import chalk71 from "chalk";
|
|
19783
19906
|
import fs5 from "fs";
|
|
19784
19907
|
import path8 from "path";
|
|
19785
19908
|
import { createRunWorkflowTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
@@ -19866,7 +19989,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19866
19989
|
}
|
|
19867
19990
|
if (args.session) {
|
|
19868
19991
|
const sessionId = args.session;
|
|
19869
|
-
output.log(
|
|
19992
|
+
output.log(chalk71.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
|
|
19870
19993
|
try {
|
|
19871
19994
|
const resumeInput = typeof input === "string" ? { userQuery: input } : input;
|
|
19872
19995
|
const result = await service.resumeSession(sessionId, {
|
|
@@ -19909,17 +20032,17 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19909
20032
|
definition = { ...definition, name: args.name };
|
|
19910
20033
|
}
|
|
19911
20034
|
const workflow = await service.createWorkflow(definition, { force: true });
|
|
19912
|
-
output.log(
|
|
19913
|
-
output.log(
|
|
20035
|
+
output.log(chalk71.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
|
|
20036
|
+
output.log(chalk71.green(`✅ Workflow registered: ${workflow.name} (${workflow.id})`));
|
|
19914
20037
|
if (args.registerOnly) {
|
|
19915
|
-
output.log(
|
|
20038
|
+
output.log(chalk71.gray("ℹ️ Use --register-only, skipping execution"));
|
|
19916
20039
|
if (workflowSpan) {
|
|
19917
20040
|
workflowSpan.end();
|
|
19918
20041
|
}
|
|
19919
20042
|
await envService.dispose();
|
|
19920
20043
|
process.exit(0);
|
|
19921
20044
|
}
|
|
19922
|
-
output.log(
|
|
20045
|
+
output.log(chalk71.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
|
|
19923
20046
|
const result = await service.runWorkflow(definition, input, runOptions);
|
|
19924
20047
|
output.log(renderRunResult({
|
|
19925
20048
|
runId: result.runId,
|
|
@@ -19929,7 +20052,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19929
20052
|
durationMs: result.durationMs
|
|
19930
20053
|
}));
|
|
19931
20054
|
if (result.status === "paused") {
|
|
19932
|
-
output.log(
|
|
20055
|
+
output.log(chalk71.gray(`
|
|
19933
20056
|
\uD83D\uDCA1 Use "roy-agent workflow run ${result.runId} --session ${result.runId} --input '<response>'" to resume`));
|
|
19934
20057
|
}
|
|
19935
20058
|
} else {
|
|
@@ -19945,7 +20068,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19945
20068
|
output.error(toolResult.error || `Failed to run workflow: ${args.identifier}`);
|
|
19946
20069
|
if (runId) {
|
|
19947
20070
|
output.error(`Run ID: ${runId}`);
|
|
19948
|
-
output.error(
|
|
20071
|
+
output.error(chalk71.gray(`
|
|
19949
20072
|
\uD83D\uDCA1 Use "roy-agent workflow status ${runId}" to check progress, or "roy-agent workflow run ${args.identifier} --session ${runId}" to resume`));
|
|
19950
20073
|
}
|
|
19951
20074
|
process.exit(1);
|
|
@@ -19959,7 +20082,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19959
20082
|
durationMs: runData.duration_ms
|
|
19960
20083
|
}));
|
|
19961
20084
|
if (runData.status === "paused") {
|
|
19962
|
-
output.log(
|
|
20085
|
+
output.log(chalk71.gray(`
|
|
19963
20086
|
\uD83D\uDCA1 Use "roy-agent workflow run ${runData.run_id} --session ${runData.run_id} --input '<response>'" to resume`));
|
|
19964
20087
|
}
|
|
19965
20088
|
}
|
|
@@ -20031,7 +20154,7 @@ var WorkflowRunCommand = {
|
|
|
20031
20154
|
};
|
|
20032
20155
|
|
|
20033
20156
|
// src/commands/workflow/commands/stop.ts
|
|
20034
|
-
import
|
|
20157
|
+
import chalk72 from "chalk";
|
|
20035
20158
|
import { createWorkflowRunStopTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
20036
20159
|
import { wrapFunction as wrapFunction2 } from "@ai-setting/roy-agent-core";
|
|
20037
20160
|
var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
|
|
@@ -20056,7 +20179,7 @@ var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
|
|
|
20056
20179
|
output.error(result.error || `Failed to stop workflow: ${args.runId}`);
|
|
20057
20180
|
process.exit(1);
|
|
20058
20181
|
}
|
|
20059
|
-
output.log(
|
|
20182
|
+
output.log(chalk72.red(`
|
|
20060
20183
|
⏹️ Workflow stopped: ${args.runId}`));
|
|
20061
20184
|
} catch (error) {
|
|
20062
20185
|
output.error(`Failed to stop workflow: ${error}`);
|
|
@@ -20080,7 +20203,7 @@ var WorkflowStopCommand = {
|
|
|
20080
20203
|
};
|
|
20081
20204
|
|
|
20082
20205
|
// src/commands/workflow/commands/status.ts
|
|
20083
|
-
import
|
|
20206
|
+
import chalk73 from "chalk";
|
|
20084
20207
|
import { createWorkflowRunStatusTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
20085
20208
|
var WorkflowStatusCommand = {
|
|
20086
20209
|
command: "status <runId>",
|
|
@@ -20173,7 +20296,7 @@ var WorkflowStatusCommand = {
|
|
|
20173
20296
|
stopped: "⏹️"
|
|
20174
20297
|
};
|
|
20175
20298
|
const emoji = statusEmoji[status] || "❓";
|
|
20176
|
-
output.log(
|
|
20299
|
+
output.log(chalk73.bold(`
|
|
20177
20300
|
${emoji} Status: ${status.toUpperCase()}`));
|
|
20178
20301
|
}
|
|
20179
20302
|
} catch (error) {
|
|
@@ -20186,7 +20309,7 @@ ${emoji} Status: ${status.toUpperCase()}`));
|
|
|
20186
20309
|
};
|
|
20187
20310
|
|
|
20188
20311
|
// src/commands/workflow/commands/nodes.ts
|
|
20189
|
-
import
|
|
20312
|
+
import chalk74 from "chalk";
|
|
20190
20313
|
var BUILT_IN_NODES = [
|
|
20191
20314
|
{
|
|
20192
20315
|
name: "ToolNode",
|
|
@@ -20523,7 +20646,7 @@ nodes:
|
|
|
20523
20646
|
];
|
|
20524
20647
|
function renderNodeTypesTable(nodes) {
|
|
20525
20648
|
const lines = [];
|
|
20526
|
-
lines.push(
|
|
20649
|
+
lines.push(chalk74.bold(`
|
|
20527
20650
|
\uD83D\uDCE6 Built-in Node Types
|
|
20528
20651
|
`));
|
|
20529
20652
|
lines.push("┌────────────┬────────────────────┬─────────────────────────────────────────────────────────────┐");
|
|
@@ -20541,29 +20664,29 @@ function renderNodeTypesTable(nodes) {
|
|
|
20541
20664
|
}
|
|
20542
20665
|
function renderNodeDetail(node) {
|
|
20543
20666
|
const lines = [];
|
|
20544
|
-
lines.push(
|
|
20667
|
+
lines.push(chalk74.bold(`
|
|
20545
20668
|
[${node.type}] ${node.name}`));
|
|
20546
|
-
lines.push(
|
|
20669
|
+
lines.push(chalk74.dim("─".repeat(60)) + `
|
|
20547
20670
|
`);
|
|
20548
|
-
lines.push(
|
|
20671
|
+
lines.push(chalk74.bold("Description:"));
|
|
20549
20672
|
lines.push(` ${node.description}
|
|
20550
20673
|
`);
|
|
20551
|
-
lines.push(
|
|
20674
|
+
lines.push(chalk74.bold("Configuration:"));
|
|
20552
20675
|
lines.push(' type: "' + node.type + '"');
|
|
20553
20676
|
lines.push(" config:");
|
|
20554
20677
|
for (const input of node.inputs) {
|
|
20555
|
-
const required = input.required ?
|
|
20678
|
+
const required = input.required ? chalk74.red("*") : " ";
|
|
20556
20679
|
lines.push(` ${input.name} (${input.type})${required}`);
|
|
20557
20680
|
lines.push(` ${input.description}`);
|
|
20558
20681
|
}
|
|
20559
20682
|
lines.push(`
|
|
20560
|
-
${
|
|
20683
|
+
${chalk74.bold("Output:")} ${node.output}`);
|
|
20561
20684
|
if (node.example) {
|
|
20562
|
-
lines.push(
|
|
20685
|
+
lines.push(chalk74.bold(`
|
|
20563
20686
|
Example:`));
|
|
20564
|
-
lines.push(
|
|
20687
|
+
lines.push(chalk74.gray("```yaml"));
|
|
20565
20688
|
lines.push(node.example);
|
|
20566
|
-
lines.push(
|
|
20689
|
+
lines.push(chalk74.gray("```"));
|
|
20567
20690
|
}
|
|
20568
20691
|
return lines.join(`
|
|
20569
20692
|
`);
|
|
@@ -20579,16 +20702,16 @@ var WorkflowNodesCommand = {
|
|
|
20579
20702
|
const nodeType = args.type?.toLowerCase();
|
|
20580
20703
|
if (!nodeType) {
|
|
20581
20704
|
console.log(renderNodeTypesTable(BUILT_IN_NODES));
|
|
20582
|
-
console.log(
|
|
20583
|
-
Use `) +
|
|
20584
|
-
console.log(
|
|
20705
|
+
console.log(chalk74.gray(`
|
|
20706
|
+
Use `) + chalk74.cyan("roy-agent workflow nodes <type>") + chalk74.gray(" for detailed information"));
|
|
20707
|
+
console.log(chalk74.gray("Available types: ") + chalk74.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
|
|
20585
20708
|
return;
|
|
20586
20709
|
}
|
|
20587
20710
|
const node = BUILT_IN_NODES.find((n) => n.type === nodeType);
|
|
20588
20711
|
if (!node) {
|
|
20589
|
-
console.log(
|
|
20712
|
+
console.log(chalk74.red(`
|
|
20590
20713
|
❌ Unknown node type: ${nodeType}`));
|
|
20591
|
-
console.log(
|
|
20714
|
+
console.log(chalk74.gray("Available types: ") + chalk74.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
|
|
20592
20715
|
process.exit(1);
|
|
20593
20716
|
}
|
|
20594
20717
|
console.log(renderNodeDetail(node));
|
|
@@ -20596,7 +20719,7 @@ Use `) + chalk73.cyan("roy-agent workflow nodes <type>") + chalk73.gray(" for de
|
|
|
20596
20719
|
};
|
|
20597
20720
|
|
|
20598
20721
|
// src/commands/workflow/commands/validate.ts
|
|
20599
|
-
import
|
|
20722
|
+
import chalk75 from "chalk";
|
|
20600
20723
|
import { readFileSync } from "fs";
|
|
20601
20724
|
async function parseWorkflowInput(input, yamlStr) {
|
|
20602
20725
|
const parseYaml = async (content) => {
|
|
@@ -20629,25 +20752,25 @@ function renderResult(result, options) {
|
|
|
20629
20752
|
return;
|
|
20630
20753
|
}
|
|
20631
20754
|
if (result.valid) {
|
|
20632
|
-
console.log(
|
|
20755
|
+
console.log(chalk75.green(`
|
|
20633
20756
|
✅ Workflow validation PASSED
|
|
20634
20757
|
`));
|
|
20635
|
-
console.log(
|
|
20758
|
+
console.log(chalk75.bold(`Workflow: ${result.workflowName}`));
|
|
20636
20759
|
console.log(`Nodes: ${result.nodeCount}`);
|
|
20637
20760
|
console.log(`
|
|
20638
20761
|
Valid nodes:`);
|
|
20639
|
-
console.log(
|
|
20762
|
+
console.log(chalk75.green(" ✓ All nodes passed validation"));
|
|
20640
20763
|
} else {
|
|
20641
|
-
console.log(
|
|
20764
|
+
console.log(chalk75.red(`
|
|
20642
20765
|
❌ Workflow validation FAILED (${result.errors.length} errors found)
|
|
20643
20766
|
`));
|
|
20644
20767
|
result.errors.forEach((error, index) => {
|
|
20645
|
-
console.log(
|
|
20646
|
-
console.log(` ${
|
|
20647
|
-
console.log(` ${
|
|
20648
|
-
console.log(` ${
|
|
20649
|
-
console.log(` ${
|
|
20650
|
-
console.log(` ${
|
|
20768
|
+
console.log(chalk75.red(`[Error ${index + 1}/${result.errors.length}]${error.nodeId ? ` Node "${error.nodeId}"` : ""}`));
|
|
20769
|
+
console.log(` ${chalk75.bold("Type:")} ${error.type}`);
|
|
20770
|
+
console.log(` ${chalk75.bold("Description:")} ${error.description}`);
|
|
20771
|
+
console.log(` ${chalk75.bold("Expected:")} ${error.expected}`);
|
|
20772
|
+
console.log(` ${chalk75.bold("Actual:")} ${error.actual}`);
|
|
20773
|
+
console.log(` ${chalk75.green("Fix:")} ${error.fix}`);
|
|
20651
20774
|
console.log();
|
|
20652
20775
|
});
|
|
20653
20776
|
}
|
|
@@ -20672,7 +20795,7 @@ var WorkflowValidateCommand = {
|
|
|
20672
20795
|
try {
|
|
20673
20796
|
const workflow = await parseWorkflowInput(options.input, options.yaml);
|
|
20674
20797
|
if (!workflow) {
|
|
20675
|
-
console.error(
|
|
20798
|
+
console.error(chalk75.red("Failed to parse workflow input"));
|
|
20676
20799
|
process.exit(1);
|
|
20677
20800
|
}
|
|
20678
20801
|
const validator = new WorkflowValidator;
|
|
@@ -20680,7 +20803,7 @@ var WorkflowValidateCommand = {
|
|
|
20680
20803
|
renderResult(result, options);
|
|
20681
20804
|
process.exit(result.valid ? 0 : 1);
|
|
20682
20805
|
} catch (error) {
|
|
20683
|
-
console.error(
|
|
20806
|
+
console.error(chalk75.red(`
|
|
20684
20807
|
Error: ${error.message}`));
|
|
20685
20808
|
process.exit(1);
|
|
20686
20809
|
}
|
|
@@ -20688,7 +20811,7 @@ Error: ${error.message}`));
|
|
|
20688
20811
|
};
|
|
20689
20812
|
|
|
20690
20813
|
// src/commands/workflow/commands/search.ts
|
|
20691
|
-
import
|
|
20814
|
+
import chalk76 from "chalk";
|
|
20692
20815
|
import { wrapFunction as wrapFunction3 } from "@ai-setting/roy-agent-core";
|
|
20693
20816
|
var WorkflowSearchCommand = {
|
|
20694
20817
|
command: "search",
|
|
@@ -20845,22 +20968,22 @@ var _runWorkflowSearchImpl = async function(opts) {
|
|
|
20845
20968
|
metadata: {}
|
|
20846
20969
|
}));
|
|
20847
20970
|
if (renderWorkflows.length === 0) {
|
|
20848
|
-
output.log(
|
|
20849
|
-
output.log(
|
|
20850
|
-
output.log(
|
|
20971
|
+
output.log(chalk76.yellow("\uD83D\uDD0D No workflows matched the search criteria."));
|
|
20972
|
+
output.log(chalk76.gray(` keyword: ${keyword || "(none)"}`));
|
|
20973
|
+
output.log(chalk76.gray(` tags: ${tags && tags.length > 0 ? tags.join(", ") : "(none)"}`));
|
|
20851
20974
|
} else {
|
|
20852
|
-
output.log(
|
|
20975
|
+
output.log(chalk76.bold(`\uD83D\uDD0D Search results (${renderWorkflows.length}):`));
|
|
20853
20976
|
output.log(renderWorkflowList(renderWorkflows));
|
|
20854
|
-
output.log(
|
|
20977
|
+
output.log(chalk76.green(`
|
|
20855
20978
|
✅ Found ${renderWorkflows.length} workflow(s)`));
|
|
20856
20979
|
}
|
|
20857
20980
|
if (availableTags.length > 0) {
|
|
20858
20981
|
output.log("");
|
|
20859
|
-
output.log(
|
|
20982
|
+
output.log(chalk76.bold("\uD83D\uDCDA Available tags (sorted by usage_count):"));
|
|
20860
20983
|
for (const t of availableTags) {
|
|
20861
20984
|
const name = t.name ?? t.tag;
|
|
20862
20985
|
const count = t.count ?? t.usage_count;
|
|
20863
|
-
output.log(
|
|
20986
|
+
output.log(chalk76.gray(` - ${name} (${count})`));
|
|
20864
20987
|
}
|
|
20865
20988
|
}
|
|
20866
20989
|
};
|
|
@@ -20872,7 +20995,7 @@ var runWorkflowSearch = wrapFunction3(_runWorkflowSearchImpl, "workflow.cli.sear
|
|
|
20872
20995
|
|
|
20873
20996
|
// src/commands/workflow/commands/tag.ts
|
|
20874
20997
|
import { wrapFunction as wrapFunction4 } from "@ai-setting/roy-agent-core";
|
|
20875
|
-
import
|
|
20998
|
+
import chalk77 from "chalk";
|
|
20876
20999
|
var WorkflowTagListCommand = {
|
|
20877
21000
|
command: "list",
|
|
20878
21001
|
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.",
|
|
@@ -20993,17 +21116,17 @@ var _runWorkflowTagListImpl = async function(opts) {
|
|
|
20993
21116
|
return;
|
|
20994
21117
|
}
|
|
20995
21118
|
if (result.tags.length === 0) {
|
|
20996
|
-
output.log(
|
|
20997
|
-
output.log(
|
|
21119
|
+
output.log(chalk77.yellow("\uD83C\uDFF7️ No tags in the workflow_tags table yet."));
|
|
21120
|
+
output.log(chalk77.gray(" Tags are created automatically when you run `workflow add --tags <name>`."));
|
|
20998
21121
|
return;
|
|
20999
21122
|
}
|
|
21000
|
-
output.log(
|
|
21001
|
-
output.log(
|
|
21123
|
+
output.log(chalk77.bold(`\uD83C\uDFF7️ Workflow tags (${result.total}):`));
|
|
21124
|
+
output.log(chalk77.gray(` ${padRight("NAME", 24)}${padRight("USAGE", 8)}${padRight("CREATED", 22)}`));
|
|
21002
21125
|
for (const t of result.tags) {
|
|
21003
21126
|
const line = ` ${padRight(t.name, 24)}${padRight(String(t.usage_count), 8)}${padRight(formatDate2(t.created_at), 22)}`;
|
|
21004
21127
|
output.log(line);
|
|
21005
21128
|
}
|
|
21006
|
-
output.log(
|
|
21129
|
+
output.log(chalk77.gray(`
|
|
21007
21130
|
\uD83D\uDCA1 Tip: when adding a new workflow, prefer tags from this list to ensure semantic consistency.`));
|
|
21008
21131
|
};
|
|
21009
21132
|
var _runWorkflowTagGetImpl = async function(opts) {
|
|
@@ -21030,7 +21153,7 @@ var _runWorkflowTagGetImpl = async function(opts) {
|
|
|
21030
21153
|
output.json({ error: "Tag not found", name: opts.name });
|
|
21031
21154
|
} else {
|
|
21032
21155
|
output.error(`Tag "${opts.name}" not found in the workflow_tags table.`);
|
|
21033
|
-
output.log(
|
|
21156
|
+
output.log(chalk77.gray(`Tip: run \`roy-agent workflow tag list\` to see available tags.`));
|
|
21034
21157
|
}
|
|
21035
21158
|
process.exitCode = 1;
|
|
21036
21159
|
return;
|
|
@@ -21039,10 +21162,10 @@ var _runWorkflowTagGetImpl = async function(opts) {
|
|
|
21039
21162
|
output.json(tag);
|
|
21040
21163
|
return;
|
|
21041
21164
|
}
|
|
21042
|
-
output.log(
|
|
21043
|
-
output.log(
|
|
21044
|
-
output.log(
|
|
21045
|
-
output.log(
|
|
21165
|
+
output.log(chalk77.bold(`\uD83C\uDFF7️ Tag: ${tag.name}`));
|
|
21166
|
+
output.log(chalk77.gray(` usage_count: ${tag.usage_count}`));
|
|
21167
|
+
output.log(chalk77.gray(` created_at: ${tag.created_at}`));
|
|
21168
|
+
output.log(chalk77.gray(` updated_at: ${tag.updated_at}`));
|
|
21046
21169
|
};
|
|
21047
21170
|
async function callListTags(service, options) {
|
|
21048
21171
|
if (typeof service.listTags !== "function") {
|
|
@@ -21393,7 +21516,11 @@ function readPackageInfo(packageName) {
|
|
|
21393
21516
|
join4(process.cwd(), "node_modules", packageName, "package.json"),
|
|
21394
21517
|
resolve(process.cwd(), "..", "node_modules", packageName, "package.json"),
|
|
21395
21518
|
join4(process.cwd(), ".roy", "plugins", packageName, "package.json"),
|
|
21396
|
-
join4(homedir3(), ".roy-agent", "node_modules", packageName, "package.json")
|
|
21519
|
+
join4(homedir3(), ".roy-agent", "node_modules", packageName, "package.json"),
|
|
21520
|
+
...(() => {
|
|
21521
|
+
const globalRoot = getNpmGlobalRoot();
|
|
21522
|
+
return globalRoot ? [join4(globalRoot, packageName, "package.json")] : [];
|
|
21523
|
+
})()
|
|
21397
21524
|
];
|
|
21398
21525
|
for (const pkgPath of searchPaths) {
|
|
21399
21526
|
try {
|
|
@@ -21413,6 +21540,13 @@ function readPackageInfo(packageName) {
|
|
|
21413
21540
|
console.warn(`⚠️ Could not find package.json for '${packageName}' (searched ${searchPaths.length} paths)`);
|
|
21414
21541
|
return null;
|
|
21415
21542
|
}
|
|
21543
|
+
function getNpmGlobalRoot() {
|
|
21544
|
+
const result = spawnSync("npm", ["root", "-g"], { encoding: "utf-8" });
|
|
21545
|
+
if (result.status === 0 && result.stdout) {
|
|
21546
|
+
return String(result.stdout).trim();
|
|
21547
|
+
}
|
|
21548
|
+
return null;
|
|
21549
|
+
}
|
|
21416
21550
|
function getPackageManagerCommand() {
|
|
21417
21551
|
if (existsSync3(join4(process.cwd(), "pnpm-lock.yaml"))) {
|
|
21418
21552
|
if (existsSync3(join4(process.cwd(), "pnpm-workspace.yaml"))) {
|