@ai-setting/roy-agent-cli 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/roy-agent.js +976 -719
- package/dist/index.js +976 -719
- package/dist/roy-agent-linux-x64/bin/roy-agent +0 -0
- package/package.json +1 -1
package/dist/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.2",
|
|
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();
|
|
@@ -9770,6 +9761,68 @@ function joinResolvedSystemPrompts(prompts) {
|
|
|
9770
9761
|
// src/commands/shared/ask-user-handler.ts
|
|
9771
9762
|
import * as readline from "readline";
|
|
9772
9763
|
import chalk3 from "chalk";
|
|
9764
|
+
|
|
9765
|
+
// src/commands/shared/ask-user-timeout.ts
|
|
9766
|
+
var ASK_USER_TIMEOUT_MS = 120000;
|
|
9767
|
+
var ASK_USER_TIMEOUT_SENTINEL_PREFIX = "__ASK_USER_TIMEOUT__:";
|
|
9768
|
+
function isAskUserTimeoutSentinel(value) {
|
|
9769
|
+
return typeof value === "string" && value.length > ASK_USER_TIMEOUT_SENTINEL_PREFIX.length && value.startsWith(ASK_USER_TIMEOUT_SENTINEL_PREFIX);
|
|
9770
|
+
}
|
|
9771
|
+
function createAskUserTimeoutSentinel(errorInfo, timeoutMs, extra) {
|
|
9772
|
+
const payload = {
|
|
9773
|
+
query: errorInfo?.query ?? extra?.question ?? "",
|
|
9774
|
+
sessionId: errorInfo?.sessionId,
|
|
9775
|
+
agentSessionId: errorInfo?.agentSessionId,
|
|
9776
|
+
nodeId: errorInfo?.nodeId,
|
|
9777
|
+
nodeType: errorInfo?.nodeType,
|
|
9778
|
+
timestamp: Date.now(),
|
|
9779
|
+
timeoutMs,
|
|
9780
|
+
source: extra?.source ?? "repl"
|
|
9781
|
+
};
|
|
9782
|
+
return ASK_USER_TIMEOUT_SENTINEL_PREFIX + JSON.stringify(payload);
|
|
9783
|
+
}
|
|
9784
|
+
function withAskUserTimeoutRace(opts) {
|
|
9785
|
+
const { rl, timeoutMs, onLine, onTimeout } = opts;
|
|
9786
|
+
let resolved = false;
|
|
9787
|
+
let timer = null;
|
|
9788
|
+
const handleLine = (input) => {
|
|
9789
|
+
if (resolved)
|
|
9790
|
+
return;
|
|
9791
|
+
resolved = true;
|
|
9792
|
+
rl.removeListener("line", handleLine);
|
|
9793
|
+
if (timer) {
|
|
9794
|
+
clearTimeout(timer);
|
|
9795
|
+
timer = null;
|
|
9796
|
+
}
|
|
9797
|
+
onLine(input);
|
|
9798
|
+
};
|
|
9799
|
+
rl.on("line", handleLine);
|
|
9800
|
+
timer = setTimeout(() => {
|
|
9801
|
+
if (resolved)
|
|
9802
|
+
return;
|
|
9803
|
+
resolved = true;
|
|
9804
|
+
rl.removeListener("line", handleLine);
|
|
9805
|
+
onTimeout();
|
|
9806
|
+
timer = null;
|
|
9807
|
+
}, timeoutMs);
|
|
9808
|
+
if (timer && typeof timer.unref === "function") {
|
|
9809
|
+
timer.unref();
|
|
9810
|
+
}
|
|
9811
|
+
return {
|
|
9812
|
+
cancel() {
|
|
9813
|
+
if (resolved)
|
|
9814
|
+
return;
|
|
9815
|
+
resolved = true;
|
|
9816
|
+
rl.removeListener("line", handleLine);
|
|
9817
|
+
if (timer) {
|
|
9818
|
+
clearTimeout(timer);
|
|
9819
|
+
timer = null;
|
|
9820
|
+
}
|
|
9821
|
+
}
|
|
9822
|
+
};
|
|
9823
|
+
}
|
|
9824
|
+
|
|
9825
|
+
// src/commands/shared/ask-user-handler.ts
|
|
9773
9826
|
function parseOptionsFromQuery(query) {
|
|
9774
9827
|
const optionsMatch = query.match(/\(选项:\s*(.+)\)/);
|
|
9775
9828
|
if (optionsMatch) {
|
|
@@ -9824,7 +9877,6 @@ function parseUserInput(input, options) {
|
|
|
9824
9877
|
}
|
|
9825
9878
|
return { type: "text", value: trimmedInput };
|
|
9826
9879
|
}
|
|
9827
|
-
|
|
9828
9880
|
// src/commands/interactive-shutdown.ts
|
|
9829
9881
|
import { TempFileManager as TempFileManager2 } from "@ai-setting/roy-agent-core/utils/temp-file-manager";
|
|
9830
9882
|
async function shutdownInteractiveSteps(deps) {
|
|
@@ -9971,6 +10023,7 @@ class REPL {
|
|
|
9971
10023
|
sessionComponent = null;
|
|
9972
10024
|
lastAttachPath = undefined;
|
|
9973
10025
|
lastUsage = null;
|
|
10026
|
+
askUserTimeoutMs = ASK_USER_TIMEOUT_MS;
|
|
9974
10027
|
setLastUsage(usage) {
|
|
9975
10028
|
this.lastUsage = usage;
|
|
9976
10029
|
}
|
|
@@ -10358,22 +10411,27 @@ ${COLORS.error("❌ 执行失败: " + error)}
|
|
|
10358
10411
|
async handleAskUserInteraction(errorInfo) {
|
|
10359
10412
|
const { question, options } = parseOptionsFromQuery(errorInfo.query);
|
|
10360
10413
|
console.log(formatAskUserOutput({ ...errorInfo, query: question, options }));
|
|
10361
|
-
const userResponse = await this.promptUser(question, options);
|
|
10414
|
+
const userResponse = await this.promptUser(question, options, errorInfo);
|
|
10415
|
+
if (isAskUserTimeoutSentinel(userResponse)) {
|
|
10416
|
+
console.log(chalk5.dim(`
|
|
10417
|
+
请直接输入新指令继续,或使用 /abort 中断当前工作流。`));
|
|
10418
|
+
return;
|
|
10419
|
+
}
|
|
10362
10420
|
console.log(COLORS.userInput(`❯ ${userResponse.replace(/\n/g, `
|
|
10363
10421
|
` + COLORS.userInput("❯ "))}`));
|
|
10364
10422
|
await this.executeInternal(userResponse, { showPrompt: false });
|
|
10365
10423
|
}
|
|
10366
|
-
promptUser(question, options) {
|
|
10424
|
+
promptUser(question, options, errorInfo, opts) {
|
|
10425
|
+
const timeoutMs = opts?.timeoutMs ?? this.askUserTimeoutMs ?? ASK_USER_TIMEOUT_MS;
|
|
10367
10426
|
return new Promise((resolve) => {
|
|
10368
10427
|
this.rl.setPrompt(COLORS.userInput("❯ "));
|
|
10369
10428
|
this.rl.prompt(true);
|
|
10370
|
-
const
|
|
10371
|
-
this.rl.removeListener("line", handleLine);
|
|
10429
|
+
const finishWithUserInput = (input) => {
|
|
10372
10430
|
const trimmedInput = input.trim();
|
|
10373
10431
|
if (!trimmedInput) {
|
|
10374
10432
|
console.log(chalk5.yellow(`⚠️ 输入不能为空,请重新输入
|
|
10375
10433
|
`));
|
|
10376
|
-
this.promptUser(question, options).then(resolve);
|
|
10434
|
+
this.promptUser(question, options, errorInfo, opts).then(resolve);
|
|
10377
10435
|
return;
|
|
10378
10436
|
}
|
|
10379
10437
|
const parsed = parseUserInput(trimmedInput, options);
|
|
@@ -10388,7 +10446,21 @@ ${COLORS.error("❌ 执行失败: " + error)}
|
|
|
10388
10446
|
resolve(parsed.value);
|
|
10389
10447
|
}
|
|
10390
10448
|
};
|
|
10391
|
-
|
|
10449
|
+
withAskUserTimeoutRace({
|
|
10450
|
+
rl: this.rl,
|
|
10451
|
+
timeoutMs,
|
|
10452
|
+
onLine: (input) => {
|
|
10453
|
+
finishWithUserInput(input);
|
|
10454
|
+
},
|
|
10455
|
+
onTimeout: () => {
|
|
10456
|
+
console.log(chalk5.yellow(`
|
|
10457
|
+
⏱ ask_user 超时:${timeoutMs}ms 内未收到回应,已自动解除等待。`));
|
|
10458
|
+
resolve(createAskUserTimeoutSentinel(errorInfo, timeoutMs, {
|
|
10459
|
+
source: "repl",
|
|
10460
|
+
question
|
|
10461
|
+
}));
|
|
10462
|
+
}
|
|
10463
|
+
});
|
|
10392
10464
|
});
|
|
10393
10465
|
}
|
|
10394
10466
|
handleSigint() {
|
|
@@ -10575,7 +10647,9 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10575
10647
|
if (!externalEnvService) {
|
|
10576
10648
|
await envService.create({
|
|
10577
10649
|
configPath: args.config,
|
|
10578
|
-
plugins: [...componentPluginNames, ...coderPluginNames]
|
|
10650
|
+
plugins: [...componentPluginNames, ...coderPluginNames],
|
|
10651
|
+
loadPlugins: true,
|
|
10652
|
+
commandName: "interactive"
|
|
10579
10653
|
});
|
|
10580
10654
|
}
|
|
10581
10655
|
const env = envService.getEnvironment();
|
|
@@ -11056,6 +11130,42 @@ function inferStatus(session) {
|
|
|
11056
11130
|
return status;
|
|
11057
11131
|
return null;
|
|
11058
11132
|
}
|
|
11133
|
+
async function expandSessionAncestors(sessionComponent, sessions) {
|
|
11134
|
+
const sessionById = new Map;
|
|
11135
|
+
for (const s of sessions)
|
|
11136
|
+
sessionById.set(s.id, s);
|
|
11137
|
+
const queue = [];
|
|
11138
|
+
const visited = new Set;
|
|
11139
|
+
for (const s of sessions) {
|
|
11140
|
+
const pid = s.parentSessionId;
|
|
11141
|
+
if (pid !== null && pid !== undefined && pid !== "" && !sessionById.has(pid) && !visited.has(pid)) {
|
|
11142
|
+
queue.push(pid);
|
|
11143
|
+
visited.add(pid);
|
|
11144
|
+
}
|
|
11145
|
+
}
|
|
11146
|
+
while (queue.length > 0) {
|
|
11147
|
+
const id = queue.shift();
|
|
11148
|
+
const parent = await sessionComponent.get(id);
|
|
11149
|
+
if (!parent)
|
|
11150
|
+
continue;
|
|
11151
|
+
sessionById.set(parent.id, parent);
|
|
11152
|
+
const ppid = parent.parentSessionId;
|
|
11153
|
+
if (ppid !== null && ppid !== undefined && ppid !== "" && !sessionById.has(ppid) && !visited.has(ppid)) {
|
|
11154
|
+
queue.push(ppid);
|
|
11155
|
+
visited.add(ppid);
|
|
11156
|
+
}
|
|
11157
|
+
}
|
|
11158
|
+
const orderedIds = [];
|
|
11159
|
+
for (const s of sessions) {
|
|
11160
|
+
if (!orderedIds.includes(s.id))
|
|
11161
|
+
orderedIds.push(s.id);
|
|
11162
|
+
}
|
|
11163
|
+
for (const id of sessionById.keys()) {
|
|
11164
|
+
if (!orderedIds.includes(id))
|
|
11165
|
+
orderedIds.push(id);
|
|
11166
|
+
}
|
|
11167
|
+
return orderedIds.map((id) => sessionById.get(id));
|
|
11168
|
+
}
|
|
11059
11169
|
|
|
11060
11170
|
// src/commands/sessions/list.ts
|
|
11061
11171
|
var ListCommand = {
|
|
@@ -11099,7 +11209,8 @@ var ListCommand = {
|
|
|
11099
11209
|
const totalCount = await sessionComponent.getCount();
|
|
11100
11210
|
const activeSessionId = sessionComponent.getActiveSessionId();
|
|
11101
11211
|
if (args.graph) {
|
|
11102
|
-
const
|
|
11212
|
+
const expandedSessions = await expandSessionAncestors(sessionComponent, sessions);
|
|
11213
|
+
const tree = buildSessionTree(expandedSessions);
|
|
11103
11214
|
output.log(renderSessionTree(tree, { useShortId: args.shortId === true }));
|
|
11104
11215
|
return;
|
|
11105
11216
|
}
|
|
@@ -12753,7 +12864,7 @@ var SessionsCommand = {
|
|
|
12753
12864
|
};
|
|
12754
12865
|
|
|
12755
12866
|
// src/commands/tasks/list.ts
|
|
12756
|
-
import
|
|
12867
|
+
import chalk19 from "chalk";
|
|
12757
12868
|
|
|
12758
12869
|
// src/commands/tasks/_build-list-json.ts
|
|
12759
12870
|
function buildListTasksJson(tasks, total, args, extras) {
|
|
@@ -12782,6 +12893,150 @@ function buildListTasksJson(tasks, total, args, extras) {
|
|
|
12782
12893
|
};
|
|
12783
12894
|
}
|
|
12784
12895
|
|
|
12896
|
+
// src/commands/tasks/task-graph.ts
|
|
12897
|
+
import chalk18 from "chalk";
|
|
12898
|
+
function buildTaskTree(tasks) {
|
|
12899
|
+
const nodeById = new Map;
|
|
12900
|
+
const byParent = new Map;
|
|
12901
|
+
const roots = [];
|
|
12902
|
+
for (const t of tasks) {
|
|
12903
|
+
nodeById.set(t.id, { task: t, children: [] });
|
|
12904
|
+
}
|
|
12905
|
+
for (const t of tasks) {
|
|
12906
|
+
const pid = t.parent_task_id;
|
|
12907
|
+
if (pid !== undefined && pid !== null && nodeById.has(pid)) {
|
|
12908
|
+
const list = byParent.get(pid) || [];
|
|
12909
|
+
list.push(t);
|
|
12910
|
+
byParent.set(pid, list);
|
|
12911
|
+
} else {
|
|
12912
|
+
roots.push(t);
|
|
12913
|
+
}
|
|
12914
|
+
}
|
|
12915
|
+
for (const [parentId, children] of byParent.entries()) {
|
|
12916
|
+
const parentNode = nodeById.get(parentId);
|
|
12917
|
+
children.sort(compareTasksDesc);
|
|
12918
|
+
parentNode.children = children.map((c) => nodeById.get(c.id));
|
|
12919
|
+
}
|
|
12920
|
+
roots.sort(compareTasksDesc);
|
|
12921
|
+
return roots.map((r) => nodeById.get(r.id));
|
|
12922
|
+
}
|
|
12923
|
+
function compareTasksDesc(a, b) {
|
|
12924
|
+
if (a.updatedAt < b.updatedAt)
|
|
12925
|
+
return 1;
|
|
12926
|
+
if (a.updatedAt > b.updatedAt)
|
|
12927
|
+
return -1;
|
|
12928
|
+
if (a.id < b.id)
|
|
12929
|
+
return 1;
|
|
12930
|
+
if (a.id > b.id)
|
|
12931
|
+
return -1;
|
|
12932
|
+
return 0;
|
|
12933
|
+
}
|
|
12934
|
+
async function expandParentChain(taskComponent, tasks) {
|
|
12935
|
+
const taskById = new Map;
|
|
12936
|
+
for (const t of tasks)
|
|
12937
|
+
taskById.set(t.id, t);
|
|
12938
|
+
const queue = [];
|
|
12939
|
+
const visited = new Set;
|
|
12940
|
+
for (const t of tasks) {
|
|
12941
|
+
const pid = t.parent_task_id;
|
|
12942
|
+
if (pid !== undefined && pid !== null && !taskById.has(pid) && !visited.has(pid)) {
|
|
12943
|
+
queue.push(pid);
|
|
12944
|
+
visited.add(pid);
|
|
12945
|
+
}
|
|
12946
|
+
}
|
|
12947
|
+
while (queue.length > 0) {
|
|
12948
|
+
const id = queue.shift();
|
|
12949
|
+
const parent = await taskComponent.getTask(id);
|
|
12950
|
+
if (!parent)
|
|
12951
|
+
continue;
|
|
12952
|
+
taskById.set(parent.id, parent);
|
|
12953
|
+
const ppid = parent.parent_task_id;
|
|
12954
|
+
if (ppid !== undefined && ppid !== null && !taskById.has(ppid) && !visited.has(ppid)) {
|
|
12955
|
+
queue.push(ppid);
|
|
12956
|
+
visited.add(ppid);
|
|
12957
|
+
}
|
|
12958
|
+
}
|
|
12959
|
+
const orderedIds = [];
|
|
12960
|
+
for (const t of tasks) {
|
|
12961
|
+
if (!orderedIds.includes(t.id))
|
|
12962
|
+
orderedIds.push(t.id);
|
|
12963
|
+
}
|
|
12964
|
+
for (const id of taskById.keys()) {
|
|
12965
|
+
if (!orderedIds.includes(id))
|
|
12966
|
+
orderedIds.push(id);
|
|
12967
|
+
}
|
|
12968
|
+
return orderedIds.map((id) => taskById.get(id));
|
|
12969
|
+
}
|
|
12970
|
+
var TASK_TREE_BRANCH = "├─ ";
|
|
12971
|
+
var TASK_TREE_LAST = "└─ ";
|
|
12972
|
+
var TASK_TREE_VERTICAL = "│ ";
|
|
12973
|
+
var TASK_TREE_EMPTY = " ";
|
|
12974
|
+
function renderTaskTree(roots, options = {}) {
|
|
12975
|
+
if (roots.length === 0) {
|
|
12976
|
+
return "No tasks to display.";
|
|
12977
|
+
}
|
|
12978
|
+
const maxDepth = options.maxDepth !== undefined && options.maxDepth < 0 ? undefined : options.maxDepth;
|
|
12979
|
+
const totalCount = countDeep(roots);
|
|
12980
|
+
const headerSuffix = options.rootId !== undefined ? chalk18.gray(` — subtree of #${options.rootId}`) : "";
|
|
12981
|
+
const lines = [
|
|
12982
|
+
chalk18.bold(`Task Tree (${totalCount} tasks, ${roots.length} roots)`) + headerSuffix,
|
|
12983
|
+
""
|
|
12984
|
+
];
|
|
12985
|
+
for (let i = 0;i < roots.length; i++) {
|
|
12986
|
+
const isLast = i === roots.length - 1;
|
|
12987
|
+
renderNode2(roots[i], "", true, isLast, lines, 0, maxDepth);
|
|
12988
|
+
}
|
|
12989
|
+
return lines.join(`
|
|
12990
|
+
`);
|
|
12991
|
+
}
|
|
12992
|
+
function renderNode2(node, prefix, isRoot, isLast, lines, currentDepth, maxDepth) {
|
|
12993
|
+
if (maxDepth !== undefined && currentDepth > maxDepth) {
|
|
12994
|
+
return;
|
|
12995
|
+
}
|
|
12996
|
+
const connector = isRoot ? "" : isLast ? TASK_TREE_LAST : TASK_TREE_BRANCH;
|
|
12997
|
+
const statusColor = colorByStatus(node.task.status);
|
|
12998
|
+
const label = statusColor(formatTaskLabel(node.task));
|
|
12999
|
+
lines.push(prefix + connector + label);
|
|
13000
|
+
if (node.children.length > 0) {
|
|
13001
|
+
const childPrefix = isRoot ? prefix : prefix + (isLast ? TASK_TREE_EMPTY : TASK_TREE_VERTICAL);
|
|
13002
|
+
for (let i = 0;i < node.children.length; i++) {
|
|
13003
|
+
const isChildLast = i === node.children.length - 1;
|
|
13004
|
+
renderNode2(node.children[i], childPrefix, false, isChildLast, lines, currentDepth + 1, maxDepth);
|
|
13005
|
+
}
|
|
13006
|
+
}
|
|
13007
|
+
}
|
|
13008
|
+
function countDeep(roots) {
|
|
13009
|
+
let count = 0;
|
|
13010
|
+
function walk(n) {
|
|
13011
|
+
count++;
|
|
13012
|
+
for (const c of n.children)
|
|
13013
|
+
walk(c);
|
|
13014
|
+
}
|
|
13015
|
+
for (const r of roots)
|
|
13016
|
+
walk(r);
|
|
13017
|
+
return count;
|
|
13018
|
+
}
|
|
13019
|
+
function formatTaskLabel(task) {
|
|
13020
|
+
const idStr = `#${task.id}`;
|
|
13021
|
+
const typeLabel = task.type && task.type !== "normal" ? ` [${task.type}]` : "";
|
|
13022
|
+
const progressLabel = task.progress > 0 ? ` (${task.progress}%)` : "";
|
|
13023
|
+
return `${idStr}${typeLabel} ${task.title} ${chalk18.gray("[" + task.status + "]")}${progressLabel}`;
|
|
13024
|
+
}
|
|
13025
|
+
function colorByStatus(status) {
|
|
13026
|
+
switch (status) {
|
|
13027
|
+
case "completed":
|
|
13028
|
+
return chalk18.green;
|
|
13029
|
+
case "active":
|
|
13030
|
+
return chalk18.blue;
|
|
13031
|
+
case "paused":
|
|
13032
|
+
return chalk18.yellow;
|
|
13033
|
+
case "cancelled":
|
|
13034
|
+
return chalk18.strikethrough;
|
|
13035
|
+
default:
|
|
13036
|
+
return chalk18.gray;
|
|
13037
|
+
}
|
|
13038
|
+
}
|
|
13039
|
+
|
|
12785
13040
|
// src/commands/tasks/list.ts
|
|
12786
13041
|
var ListCommand2 = {
|
|
12787
13042
|
command: "list",
|
|
@@ -12808,7 +13063,7 @@ var ListCommand2 = {
|
|
|
12808
13063
|
type: "boolean",
|
|
12809
13064
|
default: false,
|
|
12810
13065
|
description: "是否包含已归档任务(status=archived 的任务默认被排除)"
|
|
12811
|
-
}).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }).option("quiet", { alias: "q", type: "boolean", hidden: true }),
|
|
13066
|
+
}).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
13067
|
async handler(args) {
|
|
12813
13068
|
const output = new OutputService2;
|
|
12814
13069
|
const envService = new EnvironmentService(output);
|
|
@@ -12836,6 +13091,12 @@ var ListCommand2 = {
|
|
|
12836
13091
|
const listResult = await taskComponent.listTasks(listOptions);
|
|
12837
13092
|
const tasks = listResult.tasks;
|
|
12838
13093
|
const total = listResult.total;
|
|
13094
|
+
if (args.graph) {
|
|
13095
|
+
const expandedTasks = await expandParentChain(taskComponent, tasks);
|
|
13096
|
+
const tree = buildTaskTree(expandedTasks);
|
|
13097
|
+
output.log(renderTaskTree(tree, { maxDepth: args.depth }));
|
|
13098
|
+
return;
|
|
13099
|
+
}
|
|
12839
13100
|
if (args.json) {
|
|
12840
13101
|
output.json(buildListTasksJson(tasks, total, args));
|
|
12841
13102
|
} else if (args.quiet) {
|
|
@@ -12851,17 +13112,17 @@ var ListCommand2 = {
|
|
|
12851
13112
|
output.log(hint);
|
|
12852
13113
|
} else {
|
|
12853
13114
|
const header = [
|
|
12854
|
-
|
|
12855
|
-
|
|
12856
|
-
|
|
12857
|
-
|
|
12858
|
-
|
|
12859
|
-
|
|
12860
|
-
|
|
13115
|
+
chalk19.bold("#"),
|
|
13116
|
+
chalk19.bold("Title"),
|
|
13117
|
+
chalk19.bold("Status"),
|
|
13118
|
+
chalk19.bold("Priority"),
|
|
13119
|
+
chalk19.bold("Type"),
|
|
13120
|
+
chalk19.bold("Progress"),
|
|
13121
|
+
chalk19.bold("Parent")
|
|
12861
13122
|
].join(" │ ");
|
|
12862
13123
|
const rows = tasks.map((t, i) => {
|
|
12863
|
-
const statusColor = t.status === "completed" ?
|
|
12864
|
-
const priorityColor = t.priority === "high" ?
|
|
13124
|
+
const statusColor = t.status === "completed" ? chalk19.green : t.status === "active" ? chalk19.blue : t.status === "paused" ? chalk19.yellow : t.status === "cancelled" ? chalk19.strikethrough : chalk19.gray;
|
|
13125
|
+
const priorityColor = t.priority === "high" ? chalk19.red : t.priority === "medium" ? chalk19.yellow : chalk19.gray;
|
|
12865
13126
|
return [
|
|
12866
13127
|
(args.offset + i + 1).toString(),
|
|
12867
13128
|
t.title.length > 30 ? t.title.slice(0, 27) + "..." : t.title,
|
|
@@ -12869,11 +13130,11 @@ var ListCommand2 = {
|
|
|
12869
13130
|
priorityColor(t.priority),
|
|
12870
13131
|
t.type || "normal",
|
|
12871
13132
|
`${t.progress}%`,
|
|
12872
|
-
t.parent_task_id ? `#${t.parent_task_id}` :
|
|
13133
|
+
t.parent_task_id ? `#${t.parent_task_id}` : chalk19.gray("root")
|
|
12873
13134
|
].join(" │ ");
|
|
12874
13135
|
});
|
|
12875
|
-
const depthNote = args.depth !== undefined ?
|
|
12876
|
-
const archivedNote = args.includeArchived ?
|
|
13136
|
+
const depthNote = args.depth !== undefined ? chalk19.gray(` depth=${args.depth}`) : "";
|
|
13137
|
+
const archivedNote = args.includeArchived ? chalk19.gray(" include-archived") : "";
|
|
12877
13138
|
output.log([
|
|
12878
13139
|
`┌─ Tasks ${"─".repeat(55)}┐`,
|
|
12879
13140
|
`│${header}│`,
|
|
@@ -12881,7 +13142,7 @@ var ListCommand2 = {
|
|
|
12881
13142
|
...rows.map((r) => `│${r}│`),
|
|
12882
13143
|
"└" + "─".repeat(header.length + 2) + "┘",
|
|
12883
13144
|
"",
|
|
12884
|
-
|
|
13145
|
+
chalk19.gray(`Showing ${tasks.length} of ${total} tasks (offset=${args.offset}, limit=${args.limit})${depthNote}${archivedNote}`)
|
|
12885
13146
|
].join(`
|
|
12886
13147
|
`));
|
|
12887
13148
|
}
|
|
@@ -12895,7 +13156,7 @@ var ListCommand2 = {
|
|
|
12895
13156
|
};
|
|
12896
13157
|
|
|
12897
13158
|
// src/commands/tasks/get.ts
|
|
12898
|
-
import
|
|
13159
|
+
import chalk20 from "chalk";
|
|
12899
13160
|
var GetCommand2 = {
|
|
12900
13161
|
command: "get <id>",
|
|
12901
13162
|
aliases: ["show"],
|
|
@@ -12934,10 +13195,10 @@ var GetCommand2 = {
|
|
|
12934
13195
|
if (args.json) {
|
|
12935
13196
|
output.json(result);
|
|
12936
13197
|
} else {
|
|
12937
|
-
output.log(
|
|
13198
|
+
output.log(chalk20.bold(`
|
|
12938
13199
|
Task #${result.task.id}: ${result.task.title}
|
|
12939
13200
|
`));
|
|
12940
|
-
output.log(`Status: ${
|
|
13201
|
+
output.log(`Status: ${chalk20.blue(result.task.status)} | Priority: ${result.task.priority} | Type: ${result.task.type} | Progress: ${result.task.progress}%`);
|
|
12941
13202
|
output.log(`Created: ${result.task.createdAt} | Updated: ${result.task.updatedAt}`);
|
|
12942
13203
|
output.log(`Project Path: ${result.task.project_path}`);
|
|
12943
13204
|
output.log(`Context: ${result.task.context}`);
|
|
@@ -12945,7 +13206,7 @@ Task #${result.task.id}: ${result.task.title}
|
|
|
12945
13206
|
output.log(`
|
|
12946
13207
|
Current Status: ${result.task.current_status}`);
|
|
12947
13208
|
}
|
|
12948
|
-
output.log(
|
|
13209
|
+
output.log(chalk20.bold(`
|
|
12949
13210
|
Operations (${result.operations.length}):
|
|
12950
13211
|
`));
|
|
12951
13212
|
result.operations.forEach((op, i) => {
|
|
@@ -12965,10 +13226,10 @@ Operations (${result.operations.length}):
|
|
|
12965
13226
|
if (args.json) {
|
|
12966
13227
|
output.json(task);
|
|
12967
13228
|
} else {
|
|
12968
|
-
output.log(
|
|
13229
|
+
output.log(chalk20.bold(`
|
|
12969
13230
|
Task #${task.id}: ${task.title}
|
|
12970
13231
|
`));
|
|
12971
|
-
output.log(`Status: ${
|
|
13232
|
+
output.log(`Status: ${chalk20.blue(task.status)} | Priority: ${task.priority} | Type: ${task.type} | Progress: ${task.progress}%`);
|
|
12972
13233
|
output.log(`Created: ${task.createdAt} | Updated: ${task.updatedAt}`);
|
|
12973
13234
|
output.log(`Project Path: ${task.project_path}`);
|
|
12974
13235
|
output.log(`Context: ${task.context}`);
|
|
@@ -12992,7 +13253,7 @@ Description: ${task.description}`);
|
|
|
12992
13253
|
};
|
|
12993
13254
|
|
|
12994
13255
|
// src/commands/tasks/create.ts
|
|
12995
|
-
import
|
|
13256
|
+
import chalk21 from "chalk";
|
|
12996
13257
|
var CreateCommand = {
|
|
12997
13258
|
command: "create <title>",
|
|
12998
13259
|
aliases: ["add", "new"],
|
|
@@ -13070,7 +13331,7 @@ var CreateCommand = {
|
|
|
13070
13331
|
if (args.json) {
|
|
13071
13332
|
output.json(task);
|
|
13072
13333
|
} else {
|
|
13073
|
-
output.log(
|
|
13334
|
+
output.log(chalk21.green(`
|
|
13074
13335
|
✓ Task created: #${task.id}`));
|
|
13075
13336
|
output.log(` Title: ${task.title}`);
|
|
13076
13337
|
output.log(` Status: ${task.status}`);
|
|
@@ -13088,7 +13349,7 @@ var CreateCommand = {
|
|
|
13088
13349
|
};
|
|
13089
13350
|
|
|
13090
13351
|
// src/commands/tasks/update.ts
|
|
13091
|
-
import
|
|
13352
|
+
import chalk22 from "chalk";
|
|
13092
13353
|
var UpdateCommand = {
|
|
13093
13354
|
command: "update <id>",
|
|
13094
13355
|
aliases: ["set"],
|
|
@@ -13146,7 +13407,7 @@ var UpdateCommand = {
|
|
|
13146
13407
|
if (args.json) {
|
|
13147
13408
|
output.json(task);
|
|
13148
13409
|
} else {
|
|
13149
|
-
output.log(
|
|
13410
|
+
output.log(chalk22.green(`
|
|
13150
13411
|
✓ Task updated: #${task.id}`));
|
|
13151
13412
|
output.log(` Title: ${task.title}`);
|
|
13152
13413
|
output.log(` Status: ${task.status}`);
|
|
@@ -13169,7 +13430,7 @@ var UpdateCommand = {
|
|
|
13169
13430
|
};
|
|
13170
13431
|
|
|
13171
13432
|
// src/commands/tasks/delete.ts
|
|
13172
|
-
import
|
|
13433
|
+
import chalk23 from "chalk";
|
|
13173
13434
|
var DeleteCommand2 = {
|
|
13174
13435
|
command: "delete <id>",
|
|
13175
13436
|
aliases: ["remove", "rm", "del"],
|
|
@@ -13205,16 +13466,16 @@ var DeleteCommand2 = {
|
|
|
13205
13466
|
process.exit(1);
|
|
13206
13467
|
}
|
|
13207
13468
|
if (!args.force) {
|
|
13208
|
-
output.log(
|
|
13209
|
-
output.log(
|
|
13210
|
-
output.log(
|
|
13211
|
-
output.log(
|
|
13469
|
+
output.log(chalk23.yellow(`Are you sure you want to delete task #${args.id}?`));
|
|
13470
|
+
output.log(chalk23.yellow(` Title: ${task.title}`));
|
|
13471
|
+
output.log(chalk23.yellow(` Status: ${task.status}`));
|
|
13472
|
+
output.log(chalk23.yellow(`
|
|
13212
13473
|
Use --force to skip this confirmation`));
|
|
13213
13474
|
process.exit(1);
|
|
13214
13475
|
}
|
|
13215
13476
|
const deleted = await taskComponent.deleteTask(args.id);
|
|
13216
13477
|
if (deleted) {
|
|
13217
|
-
output.log(
|
|
13478
|
+
output.log(chalk23.green(`
|
|
13218
13479
|
✓ Task deleted: #${args.id}`));
|
|
13219
13480
|
} else {
|
|
13220
13481
|
output.error(`Failed to delete task: ${args.id}`);
|
|
@@ -13230,7 +13491,7 @@ Use --force to skip this confirmation`));
|
|
|
13230
13491
|
};
|
|
13231
13492
|
|
|
13232
13493
|
// src/commands/tasks/complete.ts
|
|
13233
|
-
import
|
|
13494
|
+
import chalk24 from "chalk";
|
|
13234
13495
|
var CompleteCommand = {
|
|
13235
13496
|
command: "complete <id>",
|
|
13236
13497
|
aliases: ["done", "finish"],
|
|
@@ -13251,7 +13512,9 @@ var CompleteCommand = {
|
|
|
13251
13512
|
try {
|
|
13252
13513
|
await envService.create({
|
|
13253
13514
|
configPath: args.config,
|
|
13254
|
-
plugins: args.plugin
|
|
13515
|
+
plugins: args.plugin,
|
|
13516
|
+
loadPlugins: true,
|
|
13517
|
+
commandName: "tasks:complete"
|
|
13255
13518
|
});
|
|
13256
13519
|
const env = envService.getEnvironment();
|
|
13257
13520
|
if (!env) {
|
|
@@ -13287,7 +13550,7 @@ var CompleteCommand = {
|
|
|
13287
13550
|
if (args.json) {
|
|
13288
13551
|
output.json(task);
|
|
13289
13552
|
} else {
|
|
13290
|
-
output.log(
|
|
13553
|
+
output.log(chalk24.green(`
|
|
13291
13554
|
✓ Task completed: #${task.id}`));
|
|
13292
13555
|
output.log(` Title: ${task.title}`);
|
|
13293
13556
|
output.log(` Progress: ${task.progress}%`);
|
|
@@ -13303,7 +13566,7 @@ var CompleteCommand = {
|
|
|
13303
13566
|
};
|
|
13304
13567
|
|
|
13305
13568
|
// src/commands/tasks/operations.ts
|
|
13306
|
-
import
|
|
13569
|
+
import chalk25 from "chalk";
|
|
13307
13570
|
var OperationsCommand = {
|
|
13308
13571
|
command: "operations <task-id>",
|
|
13309
13572
|
aliases: ["ops", "log"],
|
|
@@ -13353,23 +13616,23 @@ var OperationsCommand = {
|
|
|
13353
13616
|
operations
|
|
13354
13617
|
});
|
|
13355
13618
|
} else {
|
|
13356
|
-
output.log(
|
|
13619
|
+
output.log(chalk25.bold(`
|
|
13357
13620
|
Operations for Task #${task.id}: ${task.title}
|
|
13358
13621
|
`));
|
|
13359
13622
|
if (operations.length === 0) {
|
|
13360
|
-
output.log(
|
|
13623
|
+
output.log(chalk25.gray("No operations found."));
|
|
13361
13624
|
} else {
|
|
13362
13625
|
operations.forEach((op, i) => {
|
|
13363
|
-
const actionColor = op.actionType === "completed" ?
|
|
13364
|
-
output.log(`${
|
|
13365
|
-
output.log(` Session: ${
|
|
13626
|
+
const actionColor = op.actionType === "completed" ? chalk25.green : op.actionType === "milestone" ? chalk25.blue : op.actionType === "problem" ? chalk25.red : chalk25.gray;
|
|
13627
|
+
output.log(`${chalk25.bold(a.offset + i + 1)}. ` + actionColor(`[${op.actionType}]`) + ` ${op.actionTitle}`);
|
|
13628
|
+
output.log(` Session: ${chalk25.cyan(op.sessionId)} | Time: ${op.timestamp}`);
|
|
13366
13629
|
if (op.actionDescription) {
|
|
13367
13630
|
output.log(` ${op.actionDescription}`);
|
|
13368
13631
|
}
|
|
13369
13632
|
output.log("");
|
|
13370
13633
|
});
|
|
13371
13634
|
}
|
|
13372
|
-
output.log(
|
|
13635
|
+
output.log(chalk25.gray(`Total: ${operations.length} operations`));
|
|
13373
13636
|
}
|
|
13374
13637
|
} catch (error) {
|
|
13375
13638
|
output.error(`Failed to list operations: ${error}`);
|
|
@@ -13381,63 +13644,7 @@ Operations for Task #${task.id}: ${task.title}
|
|
|
13381
13644
|
};
|
|
13382
13645
|
|
|
13383
13646
|
// 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
|
-
}
|
|
13647
|
+
import chalk26 from "chalk";
|
|
13441
13648
|
var TreeCommand = {
|
|
13442
13649
|
command: "tree",
|
|
13443
13650
|
describe: "以树形结构展示所有任务(基于 parent_task_id)",
|
|
@@ -13511,23 +13718,20 @@ var TreeCommand = {
|
|
|
13511
13718
|
}
|
|
13512
13719
|
tasks = tasks.filter((t) => allowed.has(t.id));
|
|
13513
13720
|
}
|
|
13721
|
+
const tree = buildTaskTree(tasks);
|
|
13514
13722
|
if (args.json) {
|
|
13515
|
-
const tree2 = buildTree(tasks);
|
|
13516
13723
|
output.json({
|
|
13517
13724
|
total: tasks.length,
|
|
13518
|
-
rootCount:
|
|
13519
|
-
tree
|
|
13725
|
+
rootCount: tree.length,
|
|
13726
|
+
tree
|
|
13520
13727
|
});
|
|
13521
13728
|
return;
|
|
13522
13729
|
}
|
|
13523
|
-
const tree = buildTree(tasks);
|
|
13524
13730
|
if (tree.length === 0) {
|
|
13525
|
-
output.log(
|
|
13731
|
+
output.log(chalk26.gray("No tasks to display."));
|
|
13526
13732
|
return;
|
|
13527
13733
|
}
|
|
13528
|
-
output.log(
|
|
13529
|
-
output.log("");
|
|
13530
|
-
printTree(tree, "", true, output, 0, args.maxDepth);
|
|
13734
|
+
output.log(renderTaskTree(tree, { maxDepth: args.maxDepth, rootId: args.rootId }));
|
|
13531
13735
|
} catch (error) {
|
|
13532
13736
|
output.error(`Failed to build task tree: ${error}`);
|
|
13533
13737
|
process.exit(1);
|
|
@@ -13538,7 +13742,7 @@ var TreeCommand = {
|
|
|
13538
13742
|
};
|
|
13539
13743
|
|
|
13540
13744
|
// src/commands/tasks/search.ts
|
|
13541
|
-
import
|
|
13745
|
+
import chalk27 from "chalk";
|
|
13542
13746
|
var SearchCommand = {
|
|
13543
13747
|
command: "search <keywords..>",
|
|
13544
13748
|
aliases: ["find", "grep"],
|
|
@@ -13611,26 +13815,26 @@ var SearchCommand = {
|
|
|
13611
13815
|
output.log(hint);
|
|
13612
13816
|
} else {
|
|
13613
13817
|
const keywordStr = args.keywords.join(" ");
|
|
13614
|
-
output.log(
|
|
13818
|
+
output.log(chalk27.bold(`
|
|
13615
13819
|
\uD83D\uDD0D Search: "${keywordStr}" — ${total} results
|
|
13616
13820
|
`));
|
|
13617
13821
|
if (tasks.length === 0) {
|
|
13618
|
-
output.log(
|
|
13822
|
+
output.log(chalk27.gray(" No matching tasks found."));
|
|
13619
13823
|
return;
|
|
13620
13824
|
}
|
|
13621
13825
|
for (const t of tasks) {
|
|
13622
|
-
const statusColor = t.status === "completed" ?
|
|
13623
|
-
const pid = t.parent_task_id ?
|
|
13826
|
+
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;
|
|
13827
|
+
const pid = t.parent_task_id ? chalk27.gray(` (#${t.parent_task_id})`) : "";
|
|
13624
13828
|
output.log(` #${t.id} ${statusColor("[" + t.status + "]")} ${t.title}${pid}`);
|
|
13625
13829
|
if (t.current_status) {
|
|
13626
|
-
output.log(` ${
|
|
13830
|
+
output.log(` ${chalk27.gray(t.current_status.slice(0, 80))}`);
|
|
13627
13831
|
}
|
|
13628
13832
|
}
|
|
13629
13833
|
if (total > tasks.length) {
|
|
13630
|
-
output.log(
|
|
13834
|
+
output.log(chalk27.gray(`
|
|
13631
13835
|
... and ${total - tasks.length} more. Use --offset and --limit to paginate.`));
|
|
13632
13836
|
}
|
|
13633
|
-
output.log(
|
|
13837
|
+
output.log(chalk27.gray(` Page: ${Math.floor((args.offset || 0) / (args.limit || 20)) + 1}/${Math.ceil(total / (args.limit || 20))}`));
|
|
13634
13838
|
}
|
|
13635
13839
|
} catch (error) {
|
|
13636
13840
|
output.error(`Failed to search tasks: ${error}`);
|
|
@@ -13890,7 +14094,7 @@ var TasksCommand = {
|
|
|
13890
14094
|
};
|
|
13891
14095
|
|
|
13892
14096
|
// src/commands/skills/list.ts
|
|
13893
|
-
import
|
|
14097
|
+
import chalk28 from "chalk";
|
|
13894
14098
|
var ListCommand3 = {
|
|
13895
14099
|
command: "list",
|
|
13896
14100
|
aliases: ["ls"],
|
|
@@ -13958,26 +14162,26 @@ var ListCommand3 = {
|
|
|
13958
14162
|
output.log(hint);
|
|
13959
14163
|
} else {
|
|
13960
14164
|
const header = [
|
|
13961
|
-
|
|
13962
|
-
|
|
13963
|
-
|
|
14165
|
+
chalk28.bold("Name"),
|
|
14166
|
+
chalk28.bold("Description"),
|
|
14167
|
+
chalk28.bold("Source")
|
|
13964
14168
|
].join(" | ");
|
|
13965
14169
|
const sourceColor = (source) => {
|
|
13966
14170
|
switch (source) {
|
|
13967
14171
|
case "project":
|
|
13968
|
-
return
|
|
14172
|
+
return chalk28.green;
|
|
13969
14173
|
case "user":
|
|
13970
|
-
return
|
|
14174
|
+
return chalk28.blue;
|
|
13971
14175
|
case "built-in":
|
|
13972
|
-
return
|
|
14176
|
+
return chalk28.gray;
|
|
13973
14177
|
default:
|
|
13974
|
-
return
|
|
14178
|
+
return chalk28.white;
|
|
13975
14179
|
}
|
|
13976
14180
|
};
|
|
13977
14181
|
const rows = skills.map((s) => {
|
|
13978
14182
|
const desc2 = s.description.length > 50 ? s.description.slice(0, 47) + "..." : s.description;
|
|
13979
14183
|
return [
|
|
13980
|
-
|
|
14184
|
+
chalk28.cyan(s.name),
|
|
13981
14185
|
desc2,
|
|
13982
14186
|
sourceColor(s.source)(`[${s.source}]`)
|
|
13983
14187
|
].join(" | ");
|
|
@@ -14010,7 +14214,7 @@ var ListCommand3 = {
|
|
|
14010
14214
|
};
|
|
14011
14215
|
|
|
14012
14216
|
// src/commands/skills/get.ts
|
|
14013
|
-
import
|
|
14217
|
+
import chalk29 from "chalk";
|
|
14014
14218
|
var GetCommand3 = {
|
|
14015
14219
|
command: "get <name>",
|
|
14016
14220
|
describe: "获取指定技能内容",
|
|
@@ -14054,13 +14258,13 @@ var GetCommand3 = {
|
|
|
14054
14258
|
content: skill.content
|
|
14055
14259
|
});
|
|
14056
14260
|
} else {
|
|
14057
|
-
output.log(
|
|
14261
|
+
output.log(chalk29.bold.cyan(`# ${skill.name}`));
|
|
14058
14262
|
output.log("");
|
|
14059
|
-
output.log(`${
|
|
14060
|
-
output.log(`${
|
|
14061
|
-
output.log(`${
|
|
14263
|
+
output.log(`${chalk29.gray("Description:")} ${skill.description}`);
|
|
14264
|
+
output.log(`${chalk29.gray("Source:")} ${skill.source}`);
|
|
14265
|
+
output.log(`${chalk29.gray("File:")} ${skill.filePath}`);
|
|
14062
14266
|
output.log("");
|
|
14063
|
-
output.log(
|
|
14267
|
+
output.log(chalk29.bold("--- Content ---"));
|
|
14064
14268
|
output.log("");
|
|
14065
14269
|
output.log(skill.content);
|
|
14066
14270
|
}
|
|
@@ -14074,7 +14278,7 @@ var GetCommand3 = {
|
|
|
14074
14278
|
};
|
|
14075
14279
|
|
|
14076
14280
|
// src/commands/skills/search.ts
|
|
14077
|
-
import
|
|
14281
|
+
import chalk30 from "chalk";
|
|
14078
14282
|
var SearchCommand2 = {
|
|
14079
14283
|
command: "search <term>",
|
|
14080
14284
|
aliases: ["find"],
|
|
@@ -14113,7 +14317,7 @@ var SearchCommand2 = {
|
|
|
14113
14317
|
const term = args.term.toLowerCase();
|
|
14114
14318
|
const results = allSkills.filter((s) => s.name.toLowerCase().includes(term) || s.description.toLowerCase().includes(term));
|
|
14115
14319
|
if (results.length === 0) {
|
|
14116
|
-
output.log(
|
|
14320
|
+
output.log(chalk30.yellow(`No skills found matching: ${args.term}`));
|
|
14117
14321
|
return;
|
|
14118
14322
|
}
|
|
14119
14323
|
if (args.json) {
|
|
@@ -14130,19 +14334,19 @@ var SearchCommand2 = {
|
|
|
14130
14334
|
} else if (args.quiet) {
|
|
14131
14335
|
results.forEach((s) => output.log(s.name));
|
|
14132
14336
|
} else {
|
|
14133
|
-
output.log(
|
|
14337
|
+
output.log(chalk30.bold(`Search results for "${args.term}":`));
|
|
14134
14338
|
output.log("");
|
|
14135
14339
|
const header = [
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14340
|
+
chalk30.bold("Name"),
|
|
14341
|
+
chalk30.bold("Description"),
|
|
14342
|
+
chalk30.bold("Match")
|
|
14139
14343
|
].join(" | ");
|
|
14140
14344
|
const rows = results.map((s) => {
|
|
14141
14345
|
const matchedIn = s.name.toLowerCase().includes(term) ? "name" : "description";
|
|
14142
|
-
const matchColor = matchedIn === "name" ?
|
|
14346
|
+
const matchColor = matchedIn === "name" ? chalk30.green : chalk30.blue;
|
|
14143
14347
|
const desc2 = s.description.length > 40 ? s.description.slice(0, 37) + "..." : s.description;
|
|
14144
14348
|
return [
|
|
14145
|
-
|
|
14349
|
+
chalk30.cyan(s.name),
|
|
14146
14350
|
desc2,
|
|
14147
14351
|
matchColor(`[${matchedIn}]`)
|
|
14148
14352
|
].join(" | ");
|
|
@@ -14154,7 +14358,7 @@ var SearchCommand2 = {
|
|
|
14154
14358
|
...rows.map((r) => `│${r}│`),
|
|
14155
14359
|
"└" + "─".repeat(header.length + 2) + "┘",
|
|
14156
14360
|
"",
|
|
14157
|
-
|
|
14361
|
+
chalk30.gray(`${results.length} matching skill(s) found.`)
|
|
14158
14362
|
].join(`
|
|
14159
14363
|
`));
|
|
14160
14364
|
}
|
|
@@ -14168,7 +14372,7 @@ var SearchCommand2 = {
|
|
|
14168
14372
|
};
|
|
14169
14373
|
|
|
14170
14374
|
// src/commands/skills/reload.ts
|
|
14171
|
-
import
|
|
14375
|
+
import chalk31 from "chalk";
|
|
14172
14376
|
var ReloadCommand = {
|
|
14173
14377
|
command: "reload",
|
|
14174
14378
|
describe: "重新扫描并更新 SkillTool",
|
|
@@ -14191,10 +14395,10 @@ var ReloadCommand = {
|
|
|
14191
14395
|
output.error("SkillComponent not available");
|
|
14192
14396
|
process.exit(1);
|
|
14193
14397
|
}
|
|
14194
|
-
output.log(
|
|
14398
|
+
output.log(chalk31.blue("Reloading skills..."));
|
|
14195
14399
|
await skillComponent.reload();
|
|
14196
14400
|
const skills = skillComponent.getSkillList();
|
|
14197
|
-
output.log(
|
|
14401
|
+
output.log(chalk31.green(`Successfully reloaded ${skills.length} skills`));
|
|
14198
14402
|
} catch (error) {
|
|
14199
14403
|
output.error(`Failed to reload skills: ${error}`);
|
|
14200
14404
|
process.exit(1);
|
|
@@ -14205,7 +14409,7 @@ var ReloadCommand = {
|
|
|
14205
14409
|
};
|
|
14206
14410
|
|
|
14207
14411
|
// src/commands/skills/show-config.ts
|
|
14208
|
-
import
|
|
14412
|
+
import chalk32 from "chalk";
|
|
14209
14413
|
var ShowConfigCommand = {
|
|
14210
14414
|
command: "show-config",
|
|
14211
14415
|
aliases: ["config"],
|
|
@@ -14230,38 +14434,38 @@ var ShowConfigCommand = {
|
|
|
14230
14434
|
process.exit(1);
|
|
14231
14435
|
}
|
|
14232
14436
|
const defaultConfig = skillComponent.getConfig?.();
|
|
14233
|
-
output.log(
|
|
14437
|
+
output.log(chalk32.bold.cyan(`# Skills Configuration
|
|
14234
14438
|
`));
|
|
14235
|
-
output.log(
|
|
14439
|
+
output.log(chalk32.bold(`## Scan Paths
|
|
14236
14440
|
`));
|
|
14237
14441
|
const paths = [
|
|
14238
14442
|
{ type: "user", desc: "用户路径", path: "~/.config/roy-agent/skills/" },
|
|
14239
14443
|
{ type: "project", desc: "项目路径", path: ".roy/skills/" }
|
|
14240
14444
|
];
|
|
14241
14445
|
for (const p of paths) {
|
|
14242
|
-
const typeColor = p.type === "project" ?
|
|
14243
|
-
output.log(` ${typeColor("[ " + p.type + " ]")} ${
|
|
14244
|
-
output.log(` ${
|
|
14446
|
+
const typeColor = p.type === "project" ? chalk32.green : chalk32.blue;
|
|
14447
|
+
output.log(` ${typeColor("[ " + p.type + " ]")} ${chalk32.gray(p.desc)}`);
|
|
14448
|
+
output.log(` ${chalk32.cyan(p.path)}
|
|
14245
14449
|
`);
|
|
14246
14450
|
}
|
|
14247
|
-
output.log(
|
|
14451
|
+
output.log(chalk32.bold(`## Scan Rules
|
|
14248
14452
|
`));
|
|
14249
|
-
output.log(` ${
|
|
14250
|
-
output.log(` ${
|
|
14251
|
-
output.log(` ${
|
|
14453
|
+
output.log(` ${chalk32.gray("Pattern:")} ${chalk32.cyan("**/SKILL.md")}`);
|
|
14454
|
+
output.log(` ${chalk32.gray("Recursive:")} ${chalk32.green("true")}`);
|
|
14455
|
+
output.log(` ${chalk32.gray("Ignore:")} ${chalk32.cyan("**/node_modules/**")}
|
|
14252
14456
|
`);
|
|
14253
|
-
output.log(
|
|
14457
|
+
output.log(chalk32.bold(`## Priority (High to Low)
|
|
14254
14458
|
`));
|
|
14255
|
-
output.log(` ${
|
|
14256
|
-
output.log(` ${
|
|
14257
|
-
output.log(` ${
|
|
14459
|
+
output.log(` ${chalk32.green("1. project")} - 项目路径(最高优先级)`);
|
|
14460
|
+
output.log(` ${chalk32.blue("2. user")} - 用户路径`);
|
|
14461
|
+
output.log(` ${chalk32.gray("3. built-in")} - 内置路径(预留)
|
|
14258
14462
|
`);
|
|
14259
|
-
output.log(
|
|
14463
|
+
output.log(chalk32.bold(`## Usage
|
|
14260
14464
|
`));
|
|
14261
|
-
output.log(` ${
|
|
14262
|
-
output.log(` ${
|
|
14263
|
-
output.log(` ${
|
|
14264
|
-
output.log(` ${
|
|
14465
|
+
output.log(` ${chalk32.cyan("roy-agent skills list")} ${chalk32.gray("- 列出所有技能")}`);
|
|
14466
|
+
output.log(` ${chalk32.cyan("roy-agent skills get <name>")} ${chalk32.gray("- 获取技能内容")}`);
|
|
14467
|
+
output.log(` ${chalk32.cyan("roy-agent skills search <term>")} ${chalk32.gray("- 搜索技能")}`);
|
|
14468
|
+
output.log(` ${chalk32.cyan("roy-agent skills reload")} ${chalk32.gray("- 重新扫描技能")}`);
|
|
14265
14469
|
} catch (error) {
|
|
14266
14470
|
output.error(`Failed to show config: ${error}`);
|
|
14267
14471
|
process.exit(1);
|
|
@@ -14282,7 +14486,7 @@ var SkillsCommand = {
|
|
|
14282
14486
|
};
|
|
14283
14487
|
|
|
14284
14488
|
// src/commands/agents/list.ts
|
|
14285
|
-
import
|
|
14489
|
+
import chalk33 from "chalk";
|
|
14286
14490
|
var ListCommand4 = {
|
|
14287
14491
|
command: "list",
|
|
14288
14492
|
aliases: ["ls"],
|
|
@@ -14368,27 +14572,27 @@ var ListCommand4 = {
|
|
|
14368
14572
|
output.log(hint);
|
|
14369
14573
|
} else {
|
|
14370
14574
|
const header = [
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14375
|
-
|
|
14376
|
-
|
|
14575
|
+
chalk33.bold("Name"),
|
|
14576
|
+
chalk33.bold("Type"),
|
|
14577
|
+
chalk33.bold("Source"),
|
|
14578
|
+
chalk33.bold("Model"),
|
|
14579
|
+
chalk33.bold("Workflow"),
|
|
14580
|
+
chalk33.bold("Description")
|
|
14377
14581
|
].join(" | ");
|
|
14378
14582
|
const typeColor = (type) => {
|
|
14379
14583
|
if (type === "primary")
|
|
14380
|
-
return
|
|
14584
|
+
return chalk33.yellow;
|
|
14381
14585
|
if (type === "workflow")
|
|
14382
|
-
return
|
|
14383
|
-
return
|
|
14586
|
+
return chalk33.magenta;
|
|
14587
|
+
return chalk33.blue;
|
|
14384
14588
|
};
|
|
14385
14589
|
const rows = pagedAgents.map((a) => {
|
|
14386
14590
|
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) ?
|
|
14591
|
+
const workflowDisplay = a.type === "workflow" && a.workflow ? chalk33.cyan(a.workflow.length > 30 ? a.workflow.slice(0, 27) + "..." : a.workflow) : chalk33.gray("-");
|
|
14592
|
+
const modelDisplay = a.model ? chalk33.yellow(a.model.length > 20 ? a.model.slice(0, 17) + "..." : a.model) : chalk33.gray("-");
|
|
14593
|
+
const sourceDisplay = builtInSubAgentNames.has(a.name) ? chalk33.green("built-in") : chalk33.gray("user");
|
|
14390
14594
|
return [
|
|
14391
|
-
|
|
14595
|
+
chalk33.cyan(a.name),
|
|
14392
14596
|
typeColor(a.type)(a.type),
|
|
14393
14597
|
sourceDisplay,
|
|
14394
14598
|
modelDisplay,
|
|
@@ -14397,9 +14601,9 @@ var ListCommand4 = {
|
|
|
14397
14601
|
].join(" | ");
|
|
14398
14602
|
});
|
|
14399
14603
|
if (rows.length === 0) {
|
|
14400
|
-
output.log(
|
|
14604
|
+
output.log(chalk33.yellow("No agents found."));
|
|
14401
14605
|
output.log("");
|
|
14402
|
-
output.log(
|
|
14606
|
+
output.log(chalk33.gray("Tip: Create agent configs in ~/.local/share/roy-agent/agents/"));
|
|
14403
14607
|
} else {
|
|
14404
14608
|
output.log([
|
|
14405
14609
|
`┌─ Agents ${"─".repeat(50)}┐`,
|
|
@@ -14430,7 +14634,7 @@ var ListCommand4 = {
|
|
|
14430
14634
|
};
|
|
14431
14635
|
|
|
14432
14636
|
// src/commands/agents/get.ts
|
|
14433
|
-
import
|
|
14637
|
+
import chalk34 from "chalk";
|
|
14434
14638
|
var GetCommand4 = {
|
|
14435
14639
|
command: "get <name>",
|
|
14436
14640
|
describe: "获取指定 agent 的详细信息",
|
|
@@ -14489,69 +14693,69 @@ var GetCommand4 = {
|
|
|
14489
14693
|
filterHistory: agent.filterHistory
|
|
14490
14694
|
});
|
|
14491
14695
|
} else {
|
|
14492
|
-
output.log(
|
|
14696
|
+
output.log(chalk34.bold.cyan(`# Agent: ${agent.name}`));
|
|
14493
14697
|
output.log("");
|
|
14494
|
-
output.log(
|
|
14495
|
-
output.log(` ${
|
|
14496
|
-
output.log(` ${
|
|
14698
|
+
output.log(chalk34.bold("Basic Info:"));
|
|
14699
|
+
output.log(` ${chalk34.cyan("name:")} ${agent.name}`);
|
|
14700
|
+
output.log(` ${chalk34.cyan("type:")} ${agent.type}`);
|
|
14497
14701
|
if (agent.description) {
|
|
14498
|
-
output.log(` ${
|
|
14702
|
+
output.log(` ${chalk34.cyan("description:")} ${agent.description}`);
|
|
14499
14703
|
}
|
|
14500
14704
|
output.log("");
|
|
14501
14705
|
if (agent.type === "workflow") {
|
|
14502
|
-
output.log(
|
|
14706
|
+
output.log(chalk34.bold("Workflow:"));
|
|
14503
14707
|
if (agent.workflow) {
|
|
14504
|
-
output.log(` ${
|
|
14505
|
-
output.log(` ${
|
|
14708
|
+
output.log(` ${chalk34.cyan("workflow:")} ${agent.workflow}`);
|
|
14709
|
+
output.log(` ${chalk34.gray("→")} ${chalk34.gray(`roy-agent workflow run ${agent.workflow} --input '{"query":"..."}'`)}`);
|
|
14506
14710
|
} else {
|
|
14507
|
-
output.log(` ${
|
|
14711
|
+
output.log(` ${chalk34.gray("(no workflow configured)")}`);
|
|
14508
14712
|
}
|
|
14509
14713
|
output.log("");
|
|
14510
14714
|
}
|
|
14511
|
-
output.log(
|
|
14715
|
+
output.log(chalk34.bold("System Prompt:"));
|
|
14512
14716
|
if (agent.systemPromptRef) {
|
|
14513
|
-
output.log(` ${
|
|
14717
|
+
output.log(` ${chalk34.green("[ref]")} ${chalk34.cyan("systemPromptRef:")} ${agent.systemPromptRef}`);
|
|
14514
14718
|
}
|
|
14515
14719
|
if (agent.systemPrompt && !agent.systemPromptRef) {
|
|
14516
14720
|
const promptPreview = agent.systemPrompt.length > 100 ? agent.systemPrompt.slice(0, 97) + "..." : agent.systemPrompt;
|
|
14517
|
-
output.log(` ${
|
|
14518
|
-
output.log(` ${
|
|
14721
|
+
output.log(` ${chalk34.gray("[inline]")}`);
|
|
14722
|
+
output.log(` ${chalk34.gray(promptPreview.split(`
|
|
14519
14723
|
`).join(`
|
|
14520
14724
|
`))}`);
|
|
14521
14725
|
}
|
|
14522
14726
|
if (resolvedSystemPrompt) {
|
|
14523
14727
|
const resolvedPreview = resolvedSystemPrompt.length > 200 ? resolvedSystemPrompt.slice(0, 197) + "..." : resolvedSystemPrompt;
|
|
14524
|
-
output.log(` ${
|
|
14525
|
-
output.log(` ${
|
|
14728
|
+
output.log(` ${chalk34.green("[resolved]")}`);
|
|
14729
|
+
output.log(` ${chalk34.gray(resolvedPreview.split(`
|
|
14526
14730
|
`).join(`
|
|
14527
14731
|
`))}`);
|
|
14528
14732
|
}
|
|
14529
14733
|
if (!agent.systemPromptRef && !agent.systemPrompt && !resolvedSystemPrompt) {
|
|
14530
|
-
output.log(` ${
|
|
14734
|
+
output.log(` ${chalk34.gray("(none)")}`);
|
|
14531
14735
|
}
|
|
14532
14736
|
output.log("");
|
|
14533
14737
|
const hasOptions = agent.model || agent.maxIterations || agent.toolTimeout;
|
|
14534
14738
|
if (hasOptions) {
|
|
14535
|
-
output.log(
|
|
14739
|
+
output.log(chalk34.bold("Options:"));
|
|
14536
14740
|
if (agent.model) {
|
|
14537
|
-
output.log(` ${
|
|
14741
|
+
output.log(` ${chalk34.cyan("model:")} ${agent.model}`);
|
|
14538
14742
|
}
|
|
14539
14743
|
if (agent.maxIterations) {
|
|
14540
|
-
output.log(` ${
|
|
14744
|
+
output.log(` ${chalk34.cyan("maxIterations:")} ${agent.maxIterations}`);
|
|
14541
14745
|
}
|
|
14542
14746
|
if (agent.toolTimeout) {
|
|
14543
|
-
output.log(` ${
|
|
14747
|
+
output.log(` ${chalk34.cyan("toolTimeout:")} ${agent.toolTimeout}ms`);
|
|
14544
14748
|
}
|
|
14545
14749
|
output.log("");
|
|
14546
14750
|
}
|
|
14547
14751
|
const hasTools = agent.allowedTools?.length || agent.deniedTools?.length;
|
|
14548
14752
|
if (hasTools) {
|
|
14549
|
-
output.log(
|
|
14753
|
+
output.log(chalk34.bold("Tool Permissions:"));
|
|
14550
14754
|
if (agent.allowedTools?.length) {
|
|
14551
|
-
output.log(` ${
|
|
14755
|
+
output.log(` ${chalk34.green("allowed:")} ${agent.allowedTools.join(", ")}`);
|
|
14552
14756
|
}
|
|
14553
14757
|
if (agent.deniedTools?.length) {
|
|
14554
|
-
output.log(` ${
|
|
14758
|
+
output.log(` ${chalk34.red("denied:")} ${agent.deniedTools.join(", ")}`);
|
|
14555
14759
|
}
|
|
14556
14760
|
output.log("");
|
|
14557
14761
|
}
|
|
@@ -14566,7 +14770,7 @@ var GetCommand4 = {
|
|
|
14566
14770
|
};
|
|
14567
14771
|
|
|
14568
14772
|
// src/commands/agents/add.ts
|
|
14569
|
-
import
|
|
14773
|
+
import chalk35 from "chalk";
|
|
14570
14774
|
function parseToolList(value) {
|
|
14571
14775
|
if (!value?.trim()) {
|
|
14572
14776
|
return;
|
|
@@ -14658,8 +14862,8 @@ var AddCommand = {
|
|
|
14658
14862
|
if (args.json) {
|
|
14659
14863
|
output.json({ agent, filePath });
|
|
14660
14864
|
} else {
|
|
14661
|
-
output.log(
|
|
14662
|
-
output.log(
|
|
14865
|
+
output.log(chalk35.green(`✓ Agent '${args.name}' created`));
|
|
14866
|
+
output.log(chalk35.gray(` ${filePath}`));
|
|
14663
14867
|
}
|
|
14664
14868
|
} catch (error) {
|
|
14665
14869
|
output.error(`Failed to add agent: ${error}`);
|
|
@@ -14671,7 +14875,7 @@ var AddCommand = {
|
|
|
14671
14875
|
};
|
|
14672
14876
|
|
|
14673
14877
|
// src/commands/agents/delete.ts
|
|
14674
|
-
import
|
|
14878
|
+
import chalk36 from "chalk";
|
|
14675
14879
|
var DeleteCommand3 = {
|
|
14676
14880
|
command: "delete <name>",
|
|
14677
14881
|
describe: "删除 agent 配置文件",
|
|
@@ -14713,7 +14917,7 @@ var DeleteCommand3 = {
|
|
|
14713
14917
|
}
|
|
14714
14918
|
const filePath = registry.getAgentFilePath(args.name);
|
|
14715
14919
|
if (!args.yes) {
|
|
14716
|
-
output.log(
|
|
14920
|
+
output.log(chalk36.yellow(`Delete agent '${args.name}'? This removes ${filePath} (use --yes to skip confirmation)`));
|
|
14717
14921
|
process.exit(1);
|
|
14718
14922
|
}
|
|
14719
14923
|
const deleted = await registry.deleteAgent(args.name);
|
|
@@ -14724,7 +14928,7 @@ var DeleteCommand3 = {
|
|
|
14724
14928
|
if (args.json) {
|
|
14725
14929
|
output.json({ deleted: true, name: args.name, filePath });
|
|
14726
14930
|
} else {
|
|
14727
|
-
output.log(
|
|
14931
|
+
output.log(chalk36.green(`✓ Agent '${args.name}' deleted`));
|
|
14728
14932
|
}
|
|
14729
14933
|
} catch (error) {
|
|
14730
14934
|
output.error(`Failed to delete agent: ${error}`);
|
|
@@ -14736,7 +14940,7 @@ var DeleteCommand3 = {
|
|
|
14736
14940
|
};
|
|
14737
14941
|
|
|
14738
14942
|
// src/commands/agents/config-dir.ts
|
|
14739
|
-
import
|
|
14943
|
+
import chalk37 from "chalk";
|
|
14740
14944
|
var ConfigDirCommand = {
|
|
14741
14945
|
command: "config-dir",
|
|
14742
14946
|
describe: "显示 agent 配置目录路径",
|
|
@@ -14767,8 +14971,8 @@ var ConfigDirCommand = {
|
|
|
14767
14971
|
if (args.json) {
|
|
14768
14972
|
output.json({ configDir, exists });
|
|
14769
14973
|
} else {
|
|
14770
|
-
output.log(`${
|
|
14771
|
-
output.log(`${
|
|
14974
|
+
output.log(`${chalk37.cyan("Agent Config Directory:")} ${configDir}`);
|
|
14975
|
+
output.log(`${chalk37.gray("Exists:")} ${exists ? "yes" : "no"}`);
|
|
14772
14976
|
}
|
|
14773
14977
|
} catch (error) {
|
|
14774
14978
|
output.error(`Failed to get config dir: ${error}`);
|
|
@@ -14791,7 +14995,7 @@ var AgentsCommand = {
|
|
|
14791
14995
|
};
|
|
14792
14996
|
|
|
14793
14997
|
// src/commands/prompt/list.ts
|
|
14794
|
-
import
|
|
14998
|
+
import chalk38 from "chalk";
|
|
14795
14999
|
var ListCommand5 = {
|
|
14796
15000
|
command: "list",
|
|
14797
15001
|
aliases: ["ls"],
|
|
@@ -14860,17 +15064,17 @@ var ListCommand5 = {
|
|
|
14860
15064
|
output.log(hint);
|
|
14861
15065
|
} else {
|
|
14862
15066
|
const header = [
|
|
14863
|
-
|
|
14864
|
-
|
|
15067
|
+
chalk38.bold("Name"),
|
|
15068
|
+
chalk38.bold("Source")
|
|
14865
15069
|
].join(" | ");
|
|
14866
15070
|
const rows = prompts.map((p) => {
|
|
14867
15071
|
return [
|
|
14868
|
-
|
|
14869
|
-
|
|
15072
|
+
chalk38.cyan(p.name),
|
|
15073
|
+
chalk38.gray(`[${p.source}]`)
|
|
14870
15074
|
].join(" | ");
|
|
14871
15075
|
});
|
|
14872
15076
|
if (rows.length === 0) {
|
|
14873
|
-
output.log(
|
|
15077
|
+
output.log(chalk38.yellow("No prompts found."));
|
|
14874
15078
|
} else {
|
|
14875
15079
|
output.log([
|
|
14876
15080
|
`┌─ Prompts ${"─".repeat(50)}┐`,
|
|
@@ -14901,7 +15105,7 @@ var ListCommand5 = {
|
|
|
14901
15105
|
};
|
|
14902
15106
|
|
|
14903
15107
|
// src/commands/prompt/get.ts
|
|
14904
|
-
import
|
|
15108
|
+
import chalk39 from "chalk";
|
|
14905
15109
|
var GetCommand5 = {
|
|
14906
15110
|
command: "get <name>",
|
|
14907
15111
|
describe: "获取指定 prompt 的内容",
|
|
@@ -14948,16 +15152,16 @@ var GetCommand5 = {
|
|
|
14948
15152
|
variables: vars
|
|
14949
15153
|
});
|
|
14950
15154
|
} else {
|
|
14951
|
-
output.log(
|
|
15155
|
+
output.log(chalk39.bold.cyan(`# Prompt: ${args.name}`));
|
|
14952
15156
|
output.log("");
|
|
14953
15157
|
if (Object.keys(vars).length > 0) {
|
|
14954
|
-
output.log(
|
|
15158
|
+
output.log(chalk39.gray("Variables:"));
|
|
14955
15159
|
for (const [key, value] of Object.entries(vars)) {
|
|
14956
|
-
output.log(` ${
|
|
15160
|
+
output.log(` ${chalk39.cyan(key + ":")} ${value}`);
|
|
14957
15161
|
}
|
|
14958
15162
|
output.log("");
|
|
14959
15163
|
}
|
|
14960
|
-
output.log(
|
|
15164
|
+
output.log(chalk39.bold("Content:"));
|
|
14961
15165
|
output.log("─".repeat(60));
|
|
14962
15166
|
output.log(prompt);
|
|
14963
15167
|
output.log("─".repeat(60));
|
|
@@ -14987,7 +15191,7 @@ function parseVars(vars) {
|
|
|
14987
15191
|
|
|
14988
15192
|
// src/commands/prompt/add.ts
|
|
14989
15193
|
import { readFile as readFile2 } from "fs/promises";
|
|
14990
|
-
import
|
|
15194
|
+
import chalk40 from "chalk";
|
|
14991
15195
|
var AddCommand2 = {
|
|
14992
15196
|
command: "add <name>",
|
|
14993
15197
|
describe: "添加 prompt 并持久化到 ~/.local/share/roy-agent/prompts/",
|
|
@@ -15038,8 +15242,8 @@ var AddCommand2 = {
|
|
|
15038
15242
|
length: content.trim().length
|
|
15039
15243
|
});
|
|
15040
15244
|
} else {
|
|
15041
|
-
output.log(
|
|
15042
|
-
output.log(
|
|
15245
|
+
output.log(chalk40.green(`✓ Prompt '${args.name}' saved`));
|
|
15246
|
+
output.log(chalk40.gray(` ${filePath}`));
|
|
15043
15247
|
}
|
|
15044
15248
|
} catch (error) {
|
|
15045
15249
|
output.error(`Failed to add prompt: ${error}`);
|
|
@@ -15051,7 +15255,7 @@ var AddCommand2 = {
|
|
|
15051
15255
|
};
|
|
15052
15256
|
|
|
15053
15257
|
// src/commands/prompt/config-dir.ts
|
|
15054
|
-
import
|
|
15258
|
+
import chalk41 from "chalk";
|
|
15055
15259
|
var ConfigDirCommand2 = {
|
|
15056
15260
|
command: "config-dir",
|
|
15057
15261
|
describe: "显示 prompt 持久化目录路径",
|
|
@@ -15081,8 +15285,8 @@ var ConfigDirCommand2 = {
|
|
|
15081
15285
|
if (args.json) {
|
|
15082
15286
|
output.json({ configDir, exists });
|
|
15083
15287
|
} else {
|
|
15084
|
-
output.log(`${
|
|
15085
|
-
output.log(`${
|
|
15288
|
+
output.log(`${chalk41.cyan("Prompt Config Directory:")} ${configDir}`);
|
|
15289
|
+
output.log(`${chalk41.gray("Exists:")} ${exists ? "yes" : "no"}`);
|
|
15086
15290
|
}
|
|
15087
15291
|
} catch (error) {
|
|
15088
15292
|
output.error(`Failed to get config dir: ${error}`);
|
|
@@ -15104,7 +15308,7 @@ var PromptCommand = {
|
|
|
15104
15308
|
};
|
|
15105
15309
|
|
|
15106
15310
|
// src/commands/commands-list.ts
|
|
15107
|
-
import
|
|
15311
|
+
import chalk42 from "chalk";
|
|
15108
15312
|
function truncateVisual(str, maxWidth) {
|
|
15109
15313
|
let result = "";
|
|
15110
15314
|
let width = 0;
|
|
@@ -15119,16 +15323,16 @@ function truncateVisual(str, maxWidth) {
|
|
|
15119
15323
|
}
|
|
15120
15324
|
function formatCommandsTable(commands) {
|
|
15121
15325
|
if (commands.length === 0) {
|
|
15122
|
-
return
|
|
15326
|
+
return chalk42.yellow("命令目录为空,使用 'roy-agent commands add' 添加命令");
|
|
15123
15327
|
}
|
|
15124
15328
|
const NAME_WIDTH = 20;
|
|
15125
15329
|
const SOURCE_WIDTH = 10;
|
|
15126
15330
|
const DESC_WIDTH = 50;
|
|
15127
15331
|
const GAP = " ";
|
|
15128
15332
|
const headerLine = [
|
|
15129
|
-
|
|
15130
|
-
|
|
15131
|
-
|
|
15333
|
+
chalk42.bold("NAME".padEnd(NAME_WIDTH)),
|
|
15334
|
+
chalk42.bold("SOURCE".padEnd(SOURCE_WIDTH)),
|
|
15335
|
+
chalk42.bold("DESCRIPTION")
|
|
15132
15336
|
].join(GAP);
|
|
15133
15337
|
const sepLine = "─".repeat(NAME_WIDTH + SOURCE_WIDTH + DESC_WIDTH + GAP.length * 2);
|
|
15134
15338
|
const formatRow = (cmd) => {
|
|
@@ -15236,7 +15440,7 @@ var CommandsListCommand = {
|
|
|
15236
15440
|
};
|
|
15237
15441
|
|
|
15238
15442
|
// src/commands/commands-add.ts
|
|
15239
|
-
import
|
|
15443
|
+
import chalk43 from "chalk";
|
|
15240
15444
|
var CommandsAddCommand = {
|
|
15241
15445
|
command: "add <name> <target>",
|
|
15242
15446
|
describe: "添加收藏命令(自动创建 symlink)",
|
|
@@ -15297,10 +15501,10 @@ var CommandsAddCommand = {
|
|
|
15297
15501
|
});
|
|
15298
15502
|
const dirs = await commandsComponent.getCommandDirs();
|
|
15299
15503
|
const targetDir = source === "user" ? dirs.user : dirs.project;
|
|
15300
|
-
output.log(
|
|
15301
|
-
output.log(
|
|
15302
|
-
output.log(
|
|
15303
|
-
output.log(
|
|
15504
|
+
output.log(chalk43.green(`✅ 已添加命令 '${args.name}'`));
|
|
15505
|
+
output.log(chalk43.gray(` 目标: ${args.target}`));
|
|
15506
|
+
output.log(chalk43.gray(` 位置: ${targetDir}/${args.name}`));
|
|
15507
|
+
output.log(chalk43.gray(` 级别: ${source === "user" ? "USER" : "PROJECT"}`));
|
|
15304
15508
|
} catch (error) {
|
|
15305
15509
|
output.error(`添加失败: ${error.message}`);
|
|
15306
15510
|
process.exit(1);
|
|
@@ -15311,7 +15515,7 @@ var CommandsAddCommand = {
|
|
|
15311
15515
|
};
|
|
15312
15516
|
|
|
15313
15517
|
// src/commands/commands-remove.ts
|
|
15314
|
-
import
|
|
15518
|
+
import chalk44 from "chalk";
|
|
15315
15519
|
var CommandsRemoveCommand = {
|
|
15316
15520
|
command: "remove <name>",
|
|
15317
15521
|
aliases: ["rm"],
|
|
@@ -15355,7 +15559,7 @@ var CommandsRemoveCommand = {
|
|
|
15355
15559
|
name: args.name,
|
|
15356
15560
|
source: "user"
|
|
15357
15561
|
});
|
|
15358
|
-
output.log(
|
|
15562
|
+
output.log(chalk44.green(`✅ 已从用户目录移除命令 '${args.name}'`));
|
|
15359
15563
|
} catch (error) {
|
|
15360
15564
|
if (!error.message?.includes("不存在")) {
|
|
15361
15565
|
throw error;
|
|
@@ -15368,7 +15572,7 @@ var CommandsRemoveCommand = {
|
|
|
15368
15572
|
name: args.name,
|
|
15369
15573
|
source: "project"
|
|
15370
15574
|
});
|
|
15371
|
-
output.log(
|
|
15575
|
+
output.log(chalk44.green(`✅ 已从项目目录移除命令 '${args.name}'`));
|
|
15372
15576
|
} catch (error) {
|
|
15373
15577
|
if (!error.message?.includes("不存在")) {
|
|
15374
15578
|
throw error;
|
|
@@ -15382,7 +15586,7 @@ var CommandsRemoveCommand = {
|
|
|
15382
15586
|
name: args.name,
|
|
15383
15587
|
source: "user"
|
|
15384
15588
|
});
|
|
15385
|
-
output.log(
|
|
15589
|
+
output.log(chalk44.green(`✅ 已从用户目录移除命令 '${args.name}'`));
|
|
15386
15590
|
removed = true;
|
|
15387
15591
|
} catch (error) {
|
|
15388
15592
|
if (!error.message?.includes("不存在")) {
|
|
@@ -15394,7 +15598,7 @@ var CommandsRemoveCommand = {
|
|
|
15394
15598
|
name: args.name,
|
|
15395
15599
|
source: "project"
|
|
15396
15600
|
});
|
|
15397
|
-
output.log(
|
|
15601
|
+
output.log(chalk44.green(`✅ 已从项目目录移除命令 '${args.name}'`));
|
|
15398
15602
|
removed = true;
|
|
15399
15603
|
} catch (error) {
|
|
15400
15604
|
if (!error.message?.includes("不存在")) {
|
|
@@ -15416,7 +15620,7 @@ var CommandsRemoveCommand = {
|
|
|
15416
15620
|
};
|
|
15417
15621
|
|
|
15418
15622
|
// src/commands/commands-info.ts
|
|
15419
|
-
import
|
|
15623
|
+
import chalk45 from "chalk";
|
|
15420
15624
|
import { exec as exec2 } from "child_process";
|
|
15421
15625
|
import { promisify } from "util";
|
|
15422
15626
|
var execAsync2 = promisify(exec2);
|
|
@@ -15451,12 +15655,12 @@ var CommandsInfoCommand = {
|
|
|
15451
15655
|
output.error(`命令 '${args.name}' 不存在`);
|
|
15452
15656
|
process.exit(1);
|
|
15453
15657
|
}
|
|
15454
|
-
output.log(
|
|
15455
|
-
output.log(
|
|
15456
|
-
output.log(
|
|
15457
|
-
output.log(
|
|
15658
|
+
output.log(chalk45.bold("Name:") + ` ${info.name}`);
|
|
15659
|
+
output.log(chalk45.bold("Path:") + ` ${info.path}`);
|
|
15660
|
+
output.log(chalk45.bold("Source:") + ` ${info.source.toUpperCase()}`);
|
|
15661
|
+
output.log(chalk45.bold("Description:") + ` ${info.shortDescription || "-"}`);
|
|
15458
15662
|
output.log();
|
|
15459
|
-
output.log(
|
|
15663
|
+
output.log(chalk45.gray("─".repeat(50)));
|
|
15460
15664
|
output.log();
|
|
15461
15665
|
try {
|
|
15462
15666
|
const { stdout } = await execAsync2(`${info.path} --help`, { timeout: 5000 });
|
|
@@ -15466,7 +15670,7 @@ var CommandsInfoCommand = {
|
|
|
15466
15670
|
const { stdout } = await execAsync2(`${info.path} -h`, { timeout: 5000 });
|
|
15467
15671
|
output.log(stdout);
|
|
15468
15672
|
} catch {
|
|
15469
|
-
output.log(
|
|
15673
|
+
output.log(chalk45.gray("(无法获取帮助信息)"));
|
|
15470
15674
|
}
|
|
15471
15675
|
}
|
|
15472
15676
|
} catch (error) {
|
|
@@ -15479,7 +15683,7 @@ var CommandsInfoCommand = {
|
|
|
15479
15683
|
};
|
|
15480
15684
|
|
|
15481
15685
|
// src/commands/commands-dirs.ts
|
|
15482
|
-
import
|
|
15686
|
+
import chalk46 from "chalk";
|
|
15483
15687
|
var CommandsDirsCommand = {
|
|
15484
15688
|
command: "dirs",
|
|
15485
15689
|
describe: "显示命令目录",
|
|
@@ -15511,10 +15715,10 @@ var CommandsDirsCommand = {
|
|
|
15511
15715
|
if (args.json) {
|
|
15512
15716
|
output.json(dirs);
|
|
15513
15717
|
} else {
|
|
15514
|
-
output.log(
|
|
15718
|
+
output.log(chalk46.bold("命令目录:"));
|
|
15515
15719
|
output.log();
|
|
15516
|
-
output.log(
|
|
15517
|
-
output.log(
|
|
15720
|
+
output.log(chalk46.cyan("USER:") + ` ${dirs.user}`);
|
|
15721
|
+
output.log(chalk46.cyan("PROJECT:") + ` ${dirs.project}`);
|
|
15518
15722
|
}
|
|
15519
15723
|
} catch (error) {
|
|
15520
15724
|
output.error(`错误: ${error.message}`);
|
|
@@ -15534,7 +15738,7 @@ var CommandsCommand = {
|
|
|
15534
15738
|
};
|
|
15535
15739
|
|
|
15536
15740
|
// src/commands/config/list.ts
|
|
15537
|
-
import
|
|
15741
|
+
import chalk47 from "chalk";
|
|
15538
15742
|
|
|
15539
15743
|
// src/commands/config/config-service.ts
|
|
15540
15744
|
import * as fsSync from "fs";
|
|
@@ -15838,7 +16042,7 @@ var ConfigListCommand = {
|
|
|
15838
16042
|
output.log("");
|
|
15839
16043
|
output.log("Supported components:");
|
|
15840
16044
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
15841
|
-
output.log(` ${
|
|
16045
|
+
output.log(` ${chalk47.cyan(comp.padEnd(15))} ${COMPONENT_DESCRIPTIONS[comp] || ""}`);
|
|
15842
16046
|
}
|
|
15843
16047
|
process.exit(1);
|
|
15844
16048
|
}
|
|
@@ -15856,27 +16060,27 @@ var ConfigListCommand = {
|
|
|
15856
16060
|
}
|
|
15857
16061
|
};
|
|
15858
16062
|
function showHelp(output) {
|
|
15859
|
-
output.log(
|
|
16063
|
+
output.log(chalk47.bold.cyan("# roy-agent config list"));
|
|
15860
16064
|
output.log("");
|
|
15861
16065
|
output.log("查看 roy-agent 组件配置信息");
|
|
15862
16066
|
output.log("");
|
|
15863
|
-
output.log(
|
|
15864
|
-
output.log(` ${
|
|
16067
|
+
output.log(chalk47.bold("Usage:"));
|
|
16068
|
+
output.log(` ${chalk47.cyan("roy-agent config list [component] [options]")}`);
|
|
15865
16069
|
output.log("");
|
|
15866
|
-
output.log(
|
|
16070
|
+
output.log(chalk47.bold("Components:"));
|
|
15867
16071
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
15868
|
-
output.log(` ${
|
|
16072
|
+
output.log(` ${chalk47.cyan(comp.padEnd(15))} ${chalk47.gray(COMPONENT_DESCRIPTIONS[comp] || "")}`);
|
|
15869
16073
|
}
|
|
15870
|
-
output.log(` ${
|
|
16074
|
+
output.log(` ${chalk47.cyan("all".padEnd(15))} 显示所有 components 概览`);
|
|
15871
16075
|
output.log("");
|
|
15872
|
-
output.log(
|
|
15873
|
-
output.log(` ${
|
|
15874
|
-
output.log(` ${
|
|
15875
|
-
output.log(` ${
|
|
16076
|
+
output.log(chalk47.bold("Options:"));
|
|
16077
|
+
output.log(` ${chalk47.cyan("-j, --json")} JSON 格式输出`);
|
|
16078
|
+
output.log(` ${chalk47.cyan("-k, --keys")} 只显示配置键`);
|
|
16079
|
+
output.log(` ${chalk47.cyan("-s, --sources")} 只显示配置源`);
|
|
15876
16080
|
output.log("");
|
|
15877
|
-
output.log(
|
|
16081
|
+
output.log(chalk47.bold("Examples:"));
|
|
15878
16082
|
for (const { command: command2, description } of USAGE_COMMANDS) {
|
|
15879
|
-
output.log(` ${
|
|
16083
|
+
output.log(` ${chalk47.cyan(command2.padEnd(40))} ${chalk47.gray(description)}`);
|
|
15880
16084
|
}
|
|
15881
16085
|
}
|
|
15882
16086
|
async function showAllComponents(output, configService) {
|
|
@@ -15885,13 +16089,13 @@ async function showAllComponents(output, configService) {
|
|
|
15885
16089
|
const config = configService.getComponentConfig(compName);
|
|
15886
16090
|
components.push({ name: compName, config });
|
|
15887
16091
|
}
|
|
15888
|
-
output.log(
|
|
16092
|
+
output.log(chalk47.bold.cyan("# All Components Overview"));
|
|
15889
16093
|
output.log("");
|
|
15890
|
-
output.log(` ${
|
|
15891
|
-
output.log(` ${
|
|
16094
|
+
output.log(` ${chalk47.cyan("Component".padEnd(15))} ${chalk47.cyan("Keys".padEnd(10))} ${chalk47.gray("Description")}`);
|
|
16095
|
+
output.log(` ${chalk47.gray("─".repeat(60))}`);
|
|
15892
16096
|
for (const comp of components) {
|
|
15893
16097
|
const keyCount = Object.keys(comp.config).length;
|
|
15894
|
-
output.log(` ${
|
|
16098
|
+
output.log(` ${chalk47.cyan(comp.name.padEnd(15))} ${keyCount.toString().padEnd(10)} ${chalk47.gray(COMPONENT_DESCRIPTIONS[comp.name] || "")}`);
|
|
15895
16099
|
}
|
|
15896
16100
|
}
|
|
15897
16101
|
async function showComponentConfig(componentName, output, configService, options) {
|
|
@@ -15913,22 +16117,22 @@ async function showComponentConfig(componentName, output, configService, options
|
|
|
15913
16117
|
});
|
|
15914
16118
|
return;
|
|
15915
16119
|
}
|
|
15916
|
-
output.log(
|
|
16120
|
+
output.log(chalk47.bold.cyan(`# ${componentName} Component Configuration`));
|
|
15917
16121
|
output.log("");
|
|
15918
16122
|
if (filePath) {
|
|
15919
|
-
output.log(
|
|
15920
|
-
output.log(` ${
|
|
16123
|
+
output.log(chalk47.bold("File:"));
|
|
16124
|
+
output.log(` ${chalk47.cyan(filePath)}`);
|
|
15921
16125
|
output.log("");
|
|
15922
16126
|
}
|
|
15923
16127
|
if (!options.sources) {
|
|
15924
|
-
output.log(
|
|
16128
|
+
output.log(chalk47.bold("Configuration:"));
|
|
15925
16129
|
if (Object.keys(config).length === 0) {
|
|
15926
|
-
output.log(` ${
|
|
16130
|
+
output.log(` ${chalk47.gray("(无配置)")}`);
|
|
15927
16131
|
} else {
|
|
15928
16132
|
const flatConfig = flattenConfig(config);
|
|
15929
16133
|
for (const [key, value] of flatConfig) {
|
|
15930
16134
|
const displayValue = formatValue(value);
|
|
15931
|
-
output.log(` ${
|
|
16135
|
+
output.log(` ${chalk47.cyan(key + ":")} ${displayValue}`);
|
|
15932
16136
|
}
|
|
15933
16137
|
}
|
|
15934
16138
|
output.log("");
|
|
@@ -15943,17 +16147,17 @@ async function showAgentComponentConfig(output, configService, options) {
|
|
|
15943
16147
|
});
|
|
15944
16148
|
return;
|
|
15945
16149
|
}
|
|
15946
|
-
output.log(
|
|
16150
|
+
output.log(chalk47.bold.cyan("# Agent Component Configuration"));
|
|
15947
16151
|
output.log("");
|
|
15948
16152
|
if (!options.sources) {
|
|
15949
|
-
output.log(
|
|
16153
|
+
output.log(chalk47.bold("Configuration:"));
|
|
15950
16154
|
if (Object.keys(config).length === 0) {
|
|
15951
|
-
output.log(` ${
|
|
16155
|
+
output.log(` ${chalk47.gray("(无配置,使用默认值)")}`);
|
|
15952
16156
|
} else {
|
|
15953
16157
|
const flatConfig = flattenConfig(config);
|
|
15954
16158
|
for (const [key, value] of flatConfig) {
|
|
15955
16159
|
const displayValue = formatValue(value);
|
|
15956
|
-
output.log(` ${
|
|
16160
|
+
output.log(` ${chalk47.cyan(key + ":")} ${displayValue}`);
|
|
15957
16161
|
}
|
|
15958
16162
|
}
|
|
15959
16163
|
output.log("");
|
|
@@ -15967,10 +16171,10 @@ async function showAgentComponentConfig(output, configService, options) {
|
|
|
15967
16171
|
const configDir = registry.getConfigDir();
|
|
15968
16172
|
const exists = registry.configDirExists();
|
|
15969
16173
|
const agentCount = registry.list().length;
|
|
15970
|
-
output.log(
|
|
15971
|
-
output.log(` ${
|
|
15972
|
-
output.log(` ${
|
|
15973
|
-
output.log(` ${
|
|
16174
|
+
output.log(chalk47.bold("Agent Config Directory:"));
|
|
16175
|
+
output.log(` ${chalk47.cyan("path:")} ${configDir}`);
|
|
16176
|
+
output.log(` ${chalk47.cyan("exists:")} ${exists ? chalk47.green("yes") : chalk47.red("no")}`);
|
|
16177
|
+
output.log(` ${chalk47.cyan("agents:")} ${agentCount} loaded`);
|
|
15974
16178
|
output.log("");
|
|
15975
16179
|
}
|
|
15976
16180
|
}
|
|
@@ -15986,41 +16190,41 @@ async function showPromptComponentConfig(output, configService, options, envServ
|
|
|
15986
16190
|
});
|
|
15987
16191
|
return;
|
|
15988
16192
|
}
|
|
15989
|
-
output.log(
|
|
16193
|
+
output.log(chalk47.bold.cyan("# Prompt Component Configuration"));
|
|
15990
16194
|
output.log("");
|
|
15991
16195
|
if (filePath) {
|
|
15992
|
-
output.log(
|
|
15993
|
-
output.log(` ${
|
|
16196
|
+
output.log(chalk47.bold("File:"));
|
|
16197
|
+
output.log(` ${chalk47.cyan(filePath)}`);
|
|
15994
16198
|
output.log("");
|
|
15995
16199
|
}
|
|
15996
16200
|
if (!options.sources) {
|
|
15997
|
-
output.log(
|
|
16201
|
+
output.log(chalk47.bold("Configuration:"));
|
|
15998
16202
|
if (Object.keys(config).length === 0) {
|
|
15999
|
-
output.log(` ${
|
|
16203
|
+
output.log(` ${chalk47.gray("(无配置,使用默认值)")}`);
|
|
16000
16204
|
} else {
|
|
16001
16205
|
const flatConfig = flattenConfig(config);
|
|
16002
16206
|
for (const [key, value] of flatConfig) {
|
|
16003
16207
|
const displayValue = formatValue(value);
|
|
16004
|
-
output.log(` ${
|
|
16208
|
+
output.log(` ${chalk47.cyan(key + ":")} ${displayValue}`);
|
|
16005
16209
|
}
|
|
16006
16210
|
}
|
|
16007
16211
|
output.log("");
|
|
16008
16212
|
}
|
|
16009
|
-
output.log(
|
|
16010
|
-
output.log(` ${
|
|
16213
|
+
output.log(chalk47.bold("Prompts:"));
|
|
16214
|
+
output.log(` ${chalk47.gray("- 内置: 5 个(default, coding, review, project-memory, global-memory)")}`);
|
|
16011
16215
|
const promptPaths = config?.promptPaths;
|
|
16012
16216
|
if (promptPaths && Array.isArray(promptPaths) && promptPaths.length > 0) {
|
|
16013
|
-
output.log(` ${
|
|
16217
|
+
output.log(` ${chalk47.gray("- 外部: " + promptPaths.length + " 个路径")}`);
|
|
16014
16218
|
for (const p of promptPaths) {
|
|
16015
|
-
output.log(` ${
|
|
16219
|
+
output.log(` ${chalk47.cyan(p.path)} ${chalk47.gray("(type: " + p.type + ")")}`);
|
|
16016
16220
|
}
|
|
16017
16221
|
} else {
|
|
16018
|
-
output.log(` ${
|
|
16222
|
+
output.log(` ${chalk47.gray("- 外部: 0 个(未配置 promptPaths)")}`);
|
|
16019
16223
|
}
|
|
16020
16224
|
output.log("");
|
|
16021
16225
|
const defaultName = config?.defaultName || "default";
|
|
16022
|
-
output.log(
|
|
16023
|
-
output.log(` ${
|
|
16226
|
+
output.log(chalk47.bold("Default Prompt:"));
|
|
16227
|
+
output.log(` ${chalk47.cyan("defaultName:")} ${defaultName}`);
|
|
16024
16228
|
output.log("");
|
|
16025
16229
|
const env = envService?.getEnvironment?.();
|
|
16026
16230
|
if (env) {
|
|
@@ -16035,10 +16239,10 @@ async function showPromptComponentConfig(output, configService, options, envServ
|
|
|
16035
16239
|
const stored = await store?.loadAll?.();
|
|
16036
16240
|
promptCount = Array.isArray(stored) ? stored.length : 0;
|
|
16037
16241
|
} catch {}
|
|
16038
|
-
output.log(
|
|
16039
|
-
output.log(` ${
|
|
16040
|
-
output.log(` ${
|
|
16041
|
-
output.log(` ${
|
|
16242
|
+
output.log(chalk47.bold("Prompt Storage Directory:"));
|
|
16243
|
+
output.log(` ${chalk47.cyan("path:")} ${configDir}`);
|
|
16244
|
+
output.log(` ${chalk47.cyan("exists:")} ${exists ? chalk47.green("yes") : chalk47.red("no")}`);
|
|
16245
|
+
output.log(` ${chalk47.cyan("prompts:")} ${promptCount} loaded`);
|
|
16042
16246
|
output.log("");
|
|
16043
16247
|
}
|
|
16044
16248
|
}
|
|
@@ -16064,19 +16268,19 @@ function flattenConfig(obj, prefix = "") {
|
|
|
16064
16268
|
}
|
|
16065
16269
|
function formatValue(value) {
|
|
16066
16270
|
if (value === undefined) {
|
|
16067
|
-
return
|
|
16271
|
+
return chalk47.gray("undefined");
|
|
16068
16272
|
}
|
|
16069
16273
|
if (value === null) {
|
|
16070
|
-
return
|
|
16274
|
+
return chalk47.gray("null");
|
|
16071
16275
|
}
|
|
16072
16276
|
if (typeof value === "object") {
|
|
16073
|
-
return
|
|
16277
|
+
return chalk47.gray(JSON.stringify(value));
|
|
16074
16278
|
}
|
|
16075
16279
|
return String(value);
|
|
16076
16280
|
}
|
|
16077
16281
|
|
|
16078
16282
|
// src/commands/config/export.ts
|
|
16079
|
-
import
|
|
16283
|
+
import chalk48 from "chalk";
|
|
16080
16284
|
var ConfigExportCommand = {
|
|
16081
16285
|
command: "export <component>",
|
|
16082
16286
|
describe: "导出组件配置到文件",
|
|
@@ -16121,7 +16325,7 @@ var ConfigExportCommand = {
|
|
|
16121
16325
|
output.log("");
|
|
16122
16326
|
output.log("Supported components:");
|
|
16123
16327
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
16124
|
-
output.log(` ${
|
|
16328
|
+
output.log(` ${chalk48.cyan(comp)}`);
|
|
16125
16329
|
}
|
|
16126
16330
|
process.exit(1);
|
|
16127
16331
|
}
|
|
@@ -16139,7 +16343,7 @@ var ConfigExportCommand = {
|
|
|
16139
16343
|
};
|
|
16140
16344
|
|
|
16141
16345
|
// src/commands/config/import.ts
|
|
16142
|
-
import
|
|
16346
|
+
import chalk49 from "chalk";
|
|
16143
16347
|
var ConfigImportCommand = {
|
|
16144
16348
|
command: "import <component>",
|
|
16145
16349
|
describe: "从文件导入配置到组件的 file source",
|
|
@@ -16189,7 +16393,7 @@ var ConfigImportCommand = {
|
|
|
16189
16393
|
output.log("");
|
|
16190
16394
|
output.log("Supported components:");
|
|
16191
16395
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
16192
|
-
output.log(` ${
|
|
16396
|
+
output.log(` ${chalk49.cyan(comp)}`);
|
|
16193
16397
|
}
|
|
16194
16398
|
process.exit(1);
|
|
16195
16399
|
}
|
|
@@ -16204,7 +16408,7 @@ var ConfigImportCommand = {
|
|
|
16204
16408
|
}
|
|
16205
16409
|
if (result.merged && result.changes.length > 0 && args.verbose) {
|
|
16206
16410
|
output.log("");
|
|
16207
|
-
output.log(
|
|
16411
|
+
output.log(chalk49.bold("变更详情:"));
|
|
16208
16412
|
for (const change of result.changes) {
|
|
16209
16413
|
output.log(` ${change.key}: ${JSON.stringify(change.oldValue)} → ${JSON.stringify(change.newValue)}`);
|
|
16210
16414
|
}
|
|
@@ -16228,7 +16432,7 @@ var ConfigCommand = {
|
|
|
16228
16432
|
};
|
|
16229
16433
|
|
|
16230
16434
|
// src/commands/mcp/list.ts
|
|
16231
|
-
import
|
|
16435
|
+
import chalk50 from "chalk";
|
|
16232
16436
|
var ListCommand6 = {
|
|
16233
16437
|
command: "list",
|
|
16234
16438
|
aliases: ["ls"],
|
|
@@ -16288,30 +16492,30 @@ var ListCommand6 = {
|
|
|
16288
16492
|
output.log(hint);
|
|
16289
16493
|
} else {
|
|
16290
16494
|
if (servers.length === 0) {
|
|
16291
|
-
output.log(
|
|
16495
|
+
output.log(chalk50.yellow("No MCP servers configured"));
|
|
16292
16496
|
return;
|
|
16293
16497
|
}
|
|
16294
16498
|
const statusColor = (status) => {
|
|
16295
16499
|
switch (status) {
|
|
16296
16500
|
case "connected":
|
|
16297
|
-
return
|
|
16501
|
+
return chalk50.green;
|
|
16298
16502
|
case "connecting":
|
|
16299
|
-
return
|
|
16503
|
+
return chalk50.yellow;
|
|
16300
16504
|
case "error":
|
|
16301
|
-
return
|
|
16505
|
+
return chalk50.red;
|
|
16302
16506
|
case "disconnected":
|
|
16303
|
-
return
|
|
16507
|
+
return chalk50.gray;
|
|
16304
16508
|
default:
|
|
16305
|
-
return
|
|
16509
|
+
return chalk50.white;
|
|
16306
16510
|
}
|
|
16307
16511
|
};
|
|
16308
16512
|
const header = [
|
|
16309
|
-
|
|
16310
|
-
|
|
16311
|
-
|
|
16513
|
+
chalk50.bold("Name"),
|
|
16514
|
+
chalk50.bold("Status"),
|
|
16515
|
+
chalk50.bold("Tools")
|
|
16312
16516
|
].join(" | ");
|
|
16313
16517
|
const rows = servers.map((s) => [
|
|
16314
|
-
|
|
16518
|
+
chalk50.cyan(s.name),
|
|
16315
16519
|
statusColor(s.status)(`[${s.status}]`),
|
|
16316
16520
|
s.toolsCount !== undefined ? String(s.toolsCount) : "-"
|
|
16317
16521
|
].join(" | "));
|
|
@@ -16342,7 +16546,7 @@ var ListCommand6 = {
|
|
|
16342
16546
|
};
|
|
16343
16547
|
|
|
16344
16548
|
// src/commands/mcp/tools.ts
|
|
16345
|
-
import
|
|
16549
|
+
import chalk51 from "chalk";
|
|
16346
16550
|
var ToolsCommand = {
|
|
16347
16551
|
command: "tools",
|
|
16348
16552
|
aliases: ["t"],
|
|
@@ -16395,7 +16599,7 @@ var ToolsCommand = {
|
|
|
16395
16599
|
tools.forEach((t) => output.log(t.name));
|
|
16396
16600
|
} else {
|
|
16397
16601
|
if (tools.length === 0) {
|
|
16398
|
-
output.log(
|
|
16602
|
+
output.log(chalk51.yellow("No MCP tools available"));
|
|
16399
16603
|
return;
|
|
16400
16604
|
}
|
|
16401
16605
|
const byServer = new Map;
|
|
@@ -16407,15 +16611,15 @@ var ToolsCommand = {
|
|
|
16407
16611
|
byServer.get(serverName).push(tool);
|
|
16408
16612
|
}
|
|
16409
16613
|
for (const [serverName, serverTools] of byServer) {
|
|
16410
|
-
output.log(
|
|
16614
|
+
output.log(chalk51.bold.cyan(`
|
|
16411
16615
|
[${serverName}] ${serverTools.length} tools`));
|
|
16412
16616
|
for (const tool of serverTools) {
|
|
16413
16617
|
const desc2 = tool.description.length > 80 ? tool.description.slice(0, 77) + "..." : tool.description;
|
|
16414
|
-
output.log(` ${
|
|
16415
|
-
output.log(` ${
|
|
16618
|
+
output.log(` ${chalk51.green("+")} ${chalk51.white(tool.name)}`);
|
|
16619
|
+
output.log(` ${chalk51.gray(desc2)}`);
|
|
16416
16620
|
}
|
|
16417
16621
|
}
|
|
16418
|
-
output.log(
|
|
16622
|
+
output.log(chalk51.gray(`
|
|
16419
16623
|
Total: ${tools.length} tools across ${byServer.size} servers`));
|
|
16420
16624
|
}
|
|
16421
16625
|
} catch (error) {
|
|
@@ -16428,7 +16632,7 @@ Total: ${tools.length} tools across ${byServer.size} servers`));
|
|
|
16428
16632
|
};
|
|
16429
16633
|
|
|
16430
16634
|
// src/commands/mcp/reload.ts
|
|
16431
|
-
import
|
|
16635
|
+
import chalk52 from "chalk";
|
|
16432
16636
|
var ReloadCommand2 = {
|
|
16433
16637
|
command: "reload",
|
|
16434
16638
|
aliases: ["r"],
|
|
@@ -16449,19 +16653,19 @@ var ReloadCommand2 = {
|
|
|
16449
16653
|
output.error("McpComponent not available");
|
|
16450
16654
|
process.exit(1);
|
|
16451
16655
|
}
|
|
16452
|
-
output.log(
|
|
16656
|
+
output.log(chalk52.cyan("Reloading MCP servers..."));
|
|
16453
16657
|
await mcpComponent.reload();
|
|
16454
16658
|
const servers = mcpComponent.listServers();
|
|
16455
16659
|
const connected = servers.filter((s) => s.status === "connected").length;
|
|
16456
16660
|
const errors = servers.filter((s) => s.status === "error").length;
|
|
16457
|
-
output.log(
|
|
16661
|
+
output.log(chalk52.green(`✓ Reloaded ${servers.length} servers`));
|
|
16458
16662
|
if (connected > 0) {
|
|
16459
|
-
output.log(
|
|
16663
|
+
output.log(chalk52.green(` • ${connected} connected`));
|
|
16460
16664
|
}
|
|
16461
16665
|
if (errors > 0) {
|
|
16462
16666
|
output.warn(` • ${errors} failed`);
|
|
16463
16667
|
for (const server of servers.filter((s) => s.status === "error")) {
|
|
16464
|
-
output.log(
|
|
16668
|
+
output.log(chalk52.gray(` - ${server.name}: ${server.error}`));
|
|
16465
16669
|
}
|
|
16466
16670
|
}
|
|
16467
16671
|
} catch (error) {
|
|
@@ -16482,7 +16686,7 @@ var McpCommand = {
|
|
|
16482
16686
|
};
|
|
16483
16687
|
|
|
16484
16688
|
// src/commands/tools/list.ts
|
|
16485
|
-
import
|
|
16689
|
+
import chalk53 from "chalk";
|
|
16486
16690
|
var ListCommand7 = {
|
|
16487
16691
|
command: "list",
|
|
16488
16692
|
aliases: ["ls"],
|
|
@@ -16541,16 +16745,16 @@ var ListCommand7 = {
|
|
|
16541
16745
|
output.log(hint);
|
|
16542
16746
|
} else {
|
|
16543
16747
|
const header = [
|
|
16544
|
-
|
|
16545
|
-
|
|
16546
|
-
|
|
16748
|
+
chalk53.bold("Name"),
|
|
16749
|
+
chalk53.bold("Description"),
|
|
16750
|
+
chalk53.bold("Category")
|
|
16547
16751
|
].join(" | ");
|
|
16548
16752
|
const rows = tools.map((t) => {
|
|
16549
16753
|
const desc2 = t.description.length > 40 ? t.description.slice(0, 37) + "..." : t.description;
|
|
16550
16754
|
return [
|
|
16551
|
-
|
|
16755
|
+
chalk53.cyan(t.name),
|
|
16552
16756
|
desc2,
|
|
16553
|
-
t.metadata?.category ?
|
|
16757
|
+
t.metadata?.category ? chalk53.gray(`[${t.metadata.category}]`) : "-"
|
|
16554
16758
|
].join(" | ");
|
|
16555
16759
|
});
|
|
16556
16760
|
output.log([
|
|
@@ -16580,7 +16784,7 @@ var ListCommand7 = {
|
|
|
16580
16784
|
};
|
|
16581
16785
|
|
|
16582
16786
|
// src/commands/tools/get.ts
|
|
16583
|
-
import
|
|
16787
|
+
import chalk54 from "chalk";
|
|
16584
16788
|
|
|
16585
16789
|
// src/commands/tools/shared/schema-helper.ts
|
|
16586
16790
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
@@ -16655,8 +16859,8 @@ var GetCommand6 = {
|
|
|
16655
16859
|
}))
|
|
16656
16860
|
});
|
|
16657
16861
|
} else {
|
|
16658
|
-
output.log(
|
|
16659
|
-
output.log(
|
|
16862
|
+
output.log(chalk54.bold.cyan(`Tool: ${tool.name}`));
|
|
16863
|
+
output.log(chalk54.gray("─".repeat(60)));
|
|
16660
16864
|
output.log(`Description: ${tool.description}`);
|
|
16661
16865
|
if (tool.metadata?.category) {
|
|
16662
16866
|
output.log(`Category: ${tool.metadata.category}`);
|
|
@@ -16665,9 +16869,9 @@ var GetCommand6 = {
|
|
|
16665
16869
|
output.log(`Tags: ${tool.metadata.tags.join(", ")}`);
|
|
16666
16870
|
}
|
|
16667
16871
|
output.log("");
|
|
16668
|
-
output.log(
|
|
16872
|
+
output.log(chalk54.bold("Parameters:"));
|
|
16669
16873
|
for (const param of params) {
|
|
16670
|
-
const required = param.required ?
|
|
16874
|
+
const required = param.required ? chalk54.red("(required)") : chalk54.gray("(optional)");
|
|
16671
16875
|
const defaultVal = param.default !== undefined ? ` [default: ${JSON.stringify(param.default)}]` : "";
|
|
16672
16876
|
output.log(` --${param.name} <${param.type}> ${required}`);
|
|
16673
16877
|
output.log(` ${param.description}${defaultVal}`);
|
|
@@ -16776,14 +16980,14 @@ var ToolsCommand2 = {
|
|
|
16776
16980
|
};
|
|
16777
16981
|
|
|
16778
16982
|
// src/commands/memory/record.ts
|
|
16779
|
-
import
|
|
16983
|
+
import chalk55 from "chalk";
|
|
16780
16984
|
import { createMemoryAgentTools, getBuiltInPrompt } from "@ai-setting/roy-agent-core";
|
|
16781
16985
|
import { bashTool, globTool, readFileTool } from "@ai-setting/roy-agent-core";
|
|
16782
16986
|
async function runExtractMode(output, memoryComponent, agentComponent, sessionComponent, env, options) {
|
|
16783
16987
|
const { scope, sessionId, require: userRequirement } = options;
|
|
16784
|
-
output.log(
|
|
16988
|
+
output.log(chalk55.blue(`
|
|
16785
16989
|
\uD83D\uDD0D Memory Extract Mode (${scope})`));
|
|
16786
|
-
output.log(
|
|
16990
|
+
output.log(chalk55.gray(`正在分析会话历史,生成记忆...
|
|
16787
16991
|
`));
|
|
16788
16992
|
try {
|
|
16789
16993
|
const currentMemory = await memoryComponent.recallMemory(scope) || "(无现有记忆)";
|
|
@@ -16829,13 +17033,13 @@ async function runExtractMode(output, memoryComponent, agentComponent, sessionCo
|
|
|
16829
17033
|
for (const tool of agentTools) {
|
|
16830
17034
|
try {
|
|
16831
17035
|
toolComponent.register(tool);
|
|
16832
|
-
output.log(
|
|
17036
|
+
output.log(chalk55.gray(`Tool registered: ${tool.name}`));
|
|
16833
17037
|
} catch (err) {
|
|
16834
|
-
output.log(
|
|
17038
|
+
output.log(chalk55.gray(`Tool already registered: ${tool.name}`));
|
|
16835
17039
|
}
|
|
16836
17040
|
}
|
|
16837
17041
|
}
|
|
16838
|
-
output.log(
|
|
17042
|
+
output.log(chalk55.gray(`Agent "${agentName}" registered with ${agentTools.length} tools`));
|
|
16839
17043
|
const query = `请分析会话历史,提炼${scope === "project" ? "项目" : "全局"}记忆并写入记忆文件。`;
|
|
16840
17044
|
let result;
|
|
16841
17045
|
try {
|
|
@@ -16849,12 +17053,12 @@ async function runExtractMode(output, memoryComponent, agentComponent, sessionCo
|
|
|
16849
17053
|
if (result && result.startsWith("执行失败")) {
|
|
16850
17054
|
output.error(`提取失败: ${result}`);
|
|
16851
17055
|
} else if (result) {
|
|
16852
|
-
output.log(
|
|
17056
|
+
output.log(chalk55.green(`
|
|
16853
17057
|
✅ 记忆提取完成`));
|
|
16854
|
-
output.log(
|
|
17058
|
+
output.log(chalk55.gray(`记忆已保存到 memory 文件。
|
|
16855
17059
|
`));
|
|
16856
17060
|
if (result.length > 0 && result !== "✅ 记忆提取完成") {
|
|
16857
|
-
output.log(
|
|
17061
|
+
output.log(chalk55.gray(`执行摘要: ${result.substring(0, 200)}${result.length > 200 ? "..." : ""}`));
|
|
16858
17062
|
}
|
|
16859
17063
|
}
|
|
16860
17064
|
agentComponent.unregisterAgent(agentName);
|
|
@@ -16972,11 +17176,11 @@ var RecordCommand = {
|
|
|
16972
17176
|
prepend: "已插入内容到记忆文件开头",
|
|
16973
17177
|
delete: "已删除记忆文件"
|
|
16974
17178
|
};
|
|
16975
|
-
output.log(
|
|
16976
|
-
output.log(
|
|
17179
|
+
output.log(chalk55.green(`✓ ${actionMessages[result.action]}`));
|
|
17180
|
+
output.log(chalk55.gray(`路径: ${result.path}`));
|
|
16977
17181
|
if (result.action !== "delete" && a.content) {
|
|
16978
17182
|
const preview = a.content.substring(0, 100);
|
|
16979
|
-
output.log(
|
|
17183
|
+
output.log(chalk55.gray(`内容预览: ${preview}${a.content.length > 100 ? "..." : ""}`));
|
|
16980
17184
|
}
|
|
16981
17185
|
} catch (error) {
|
|
16982
17186
|
output.error(`Failed to record memory: ${error}`);
|
|
@@ -16988,7 +17192,7 @@ var RecordCommand = {
|
|
|
16988
17192
|
};
|
|
16989
17193
|
|
|
16990
17194
|
// src/commands/memory/recall.ts
|
|
16991
|
-
import
|
|
17195
|
+
import chalk56 from "chalk";
|
|
16992
17196
|
var RecallCommand = {
|
|
16993
17197
|
command: "recall",
|
|
16994
17198
|
aliases: ["load"],
|
|
@@ -17024,7 +17228,7 @@ var RecallCommand = {
|
|
|
17024
17228
|
}
|
|
17025
17229
|
const content = await memoryComponent.recallMemory(a.scope);
|
|
17026
17230
|
if (!content) {
|
|
17027
|
-
output.log(
|
|
17231
|
+
output.log(chalk56.gray("(No memory files found)"));
|
|
17028
17232
|
return;
|
|
17029
17233
|
}
|
|
17030
17234
|
if (a.json) {
|
|
@@ -17050,7 +17254,7 @@ var MemoryCommand = {
|
|
|
17050
17254
|
handler: () => {}
|
|
17051
17255
|
};
|
|
17052
17256
|
// src/commands/eventsource/list.ts
|
|
17053
|
-
import
|
|
17257
|
+
import chalk57 from "chalk";
|
|
17054
17258
|
function truncateVisual2(str, maxWidth) {
|
|
17055
17259
|
let result = "";
|
|
17056
17260
|
let width = 0;
|
|
@@ -17065,7 +17269,7 @@ function truncateVisual2(str, maxWidth) {
|
|
|
17065
17269
|
}
|
|
17066
17270
|
function formatSourcesTable(sources) {
|
|
17067
17271
|
if (sources.length === 0) {
|
|
17068
|
-
return
|
|
17272
|
+
return chalk57.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加");
|
|
17069
17273
|
}
|
|
17070
17274
|
const ID_WIDTH = 10;
|
|
17071
17275
|
const NAME_WIDTH = 20;
|
|
@@ -17074,11 +17278,11 @@ function formatSourcesTable(sources) {
|
|
|
17074
17278
|
const ENABLED_WIDTH = 8;
|
|
17075
17279
|
const GAP = " ";
|
|
17076
17280
|
const headerLine = [
|
|
17077
|
-
|
|
17078
|
-
|
|
17079
|
-
|
|
17080
|
-
|
|
17081
|
-
|
|
17281
|
+
chalk57.bold("ID".padEnd(ID_WIDTH)),
|
|
17282
|
+
chalk57.bold("NAME".padEnd(NAME_WIDTH)),
|
|
17283
|
+
chalk57.bold("TYPE".padEnd(TYPE_WIDTH)),
|
|
17284
|
+
chalk57.bold("STATUS".padEnd(STATUS_WIDTH)),
|
|
17285
|
+
chalk57.bold("ENABLED".padEnd(ENABLED_WIDTH))
|
|
17082
17286
|
].join(GAP);
|
|
17083
17287
|
const sepLine = "─".repeat(ID_WIDTH + NAME_WIDTH + TYPE_WIDTH + STATUS_WIDTH + ENABLED_WIDTH + GAP.length * 4);
|
|
17084
17288
|
const formatRow = (src) => {
|
|
@@ -17136,7 +17340,7 @@ var EventSourceListCommand = {
|
|
|
17136
17340
|
sources: []
|
|
17137
17341
|
});
|
|
17138
17342
|
} else {
|
|
17139
|
-
output.log(
|
|
17343
|
+
output.log(chalk57.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加"));
|
|
17140
17344
|
}
|
|
17141
17345
|
return;
|
|
17142
17346
|
}
|
|
@@ -17171,21 +17375,21 @@ var EventSourceListCommand = {
|
|
|
17171
17375
|
const rows = sources.map((s) => {
|
|
17172
17376
|
const status = esComponent.getStatus(s.id) || "unknown";
|
|
17173
17377
|
const statusColorMap = {
|
|
17174
|
-
running:
|
|
17175
|
-
stopped:
|
|
17176
|
-
error:
|
|
17177
|
-
starting:
|
|
17178
|
-
created:
|
|
17179
|
-
stopping:
|
|
17180
|
-
unknown:
|
|
17378
|
+
running: chalk57.green,
|
|
17379
|
+
stopped: chalk57.gray,
|
|
17380
|
+
error: chalk57.red,
|
|
17381
|
+
starting: chalk57.yellow,
|
|
17382
|
+
created: chalk57.gray,
|
|
17383
|
+
stopping: chalk57.yellow,
|
|
17384
|
+
unknown: chalk57.gray
|
|
17181
17385
|
};
|
|
17182
|
-
const statusColor = statusColorMap[status] ||
|
|
17386
|
+
const statusColor = statusColorMap[status] || chalk57.gray;
|
|
17183
17387
|
return {
|
|
17184
17388
|
id: s.id.substring(0, 8),
|
|
17185
17389
|
name: s.name,
|
|
17186
17390
|
type: s.type,
|
|
17187
17391
|
status: statusColor(status),
|
|
17188
|
-
enabled: s.enabled ?
|
|
17392
|
+
enabled: s.enabled ? chalk57.green("✓") : chalk57.gray("✗")
|
|
17189
17393
|
};
|
|
17190
17394
|
});
|
|
17191
17395
|
output.log(formatSourcesTable(rows));
|
|
@@ -17207,11 +17411,11 @@ var EventSourceListCommand = {
|
|
|
17207
17411
|
};
|
|
17208
17412
|
|
|
17209
17413
|
// src/commands/eventsource/add.ts
|
|
17210
|
-
import
|
|
17414
|
+
import chalk59 from "chalk";
|
|
17211
17415
|
import { generateId } from "@ai-setting/roy-agent-core";
|
|
17212
17416
|
|
|
17213
17417
|
// src/commands/eventsource/server-url-option.ts
|
|
17214
|
-
import
|
|
17418
|
+
import chalk58 from "chalk";
|
|
17215
17419
|
function addServerUrlOption(yargs) {
|
|
17216
17420
|
return yargs.option("server-url", {
|
|
17217
17421
|
alias: "s",
|
|
@@ -17227,7 +17431,7 @@ function resolveServerUrl(serverUrl, fallback) {
|
|
|
17227
17431
|
return fallback;
|
|
17228
17432
|
const trimmed = serverUrl.replace(/\/+$/, "");
|
|
17229
17433
|
if (!/^(https?|wss?):\/\//.test(trimmed)) {
|
|
17230
|
-
console.error(
|
|
17434
|
+
console.error(chalk58.red(`
|
|
17231
17435
|
✗ Invalid --server-url: "${serverUrl}". Must start with http://, https://, ws://, or wss://
|
|
17232
17436
|
`));
|
|
17233
17437
|
process.exit(1);
|
|
@@ -17320,39 +17524,39 @@ var EventSourceAddCommand = {
|
|
|
17320
17524
|
options: a.prompt ? { prompt: a.prompt } : undefined
|
|
17321
17525
|
};
|
|
17322
17526
|
esComponent.register(config);
|
|
17323
|
-
output.success(
|
|
17527
|
+
output.success(chalk59.green(`事件源 '${a.name}' 添加成功!`));
|
|
17324
17528
|
output.log("");
|
|
17325
|
-
output.log(` ID: ${
|
|
17326
|
-
output.log(` Type: ${
|
|
17529
|
+
output.log(` ID: ${chalk59.gray(config.id)}`);
|
|
17530
|
+
output.log(` Type: ${chalk59.cyan(a.type)}`);
|
|
17327
17531
|
if (eventTypes?.length) {
|
|
17328
|
-
output.log(` Event Types: ${
|
|
17532
|
+
output.log(` Event Types: ${chalk59.gray(eventTypes.join(", "))}`);
|
|
17329
17533
|
}
|
|
17330
17534
|
if (a.command) {
|
|
17331
|
-
output.log(` Command: ${
|
|
17535
|
+
output.log(` Command: ${chalk59.gray(a.command)}`);
|
|
17332
17536
|
}
|
|
17333
17537
|
if (a.interval) {
|
|
17334
|
-
output.log(` Interval: ${
|
|
17538
|
+
output.log(` Interval: ${chalk59.gray(`${a.interval}ms`)}`);
|
|
17335
17539
|
}
|
|
17336
17540
|
if (a.profile) {
|
|
17337
|
-
output.log(` Profile: ${
|
|
17541
|
+
output.log(` Profile: ${chalk59.gray(a.profile)}`);
|
|
17338
17542
|
}
|
|
17339
17543
|
if (a.address) {
|
|
17340
|
-
output.log(` Address: ${
|
|
17544
|
+
output.log(` Address: ${chalk59.gray(a.address)}`);
|
|
17341
17545
|
}
|
|
17342
17546
|
if (a.imServerUrl) {
|
|
17343
|
-
output.log(` IM Server URL: ${
|
|
17547
|
+
output.log(` IM Server URL: ${chalk59.gray(a.imServerUrl)}`);
|
|
17344
17548
|
}
|
|
17345
17549
|
if (resolvedServerUrl) {
|
|
17346
|
-
output.log(` Server URL: ${
|
|
17550
|
+
output.log(` Server URL: ${chalk59.gray(resolvedServerUrl)}`);
|
|
17347
17551
|
}
|
|
17348
17552
|
if (a.tlsSkipVerify) {
|
|
17349
|
-
output.log(` TLS Skip Verify: ${
|
|
17553
|
+
output.log(` TLS Skip Verify: ${chalk59.yellow("⚠ true (自签名场景)")}`);
|
|
17350
17554
|
}
|
|
17351
17555
|
if (a.prompt) {
|
|
17352
|
-
output.log(` Prompt: ${
|
|
17556
|
+
output.log(` Prompt: ${chalk59.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
|
|
17353
17557
|
}
|
|
17354
17558
|
output.log("");
|
|
17355
|
-
output.log(
|
|
17559
|
+
output.log(chalk59.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
|
|
17356
17560
|
} finally {
|
|
17357
17561
|
await envService.dispose();
|
|
17358
17562
|
}
|
|
@@ -17360,7 +17564,7 @@ var EventSourceAddCommand = {
|
|
|
17360
17564
|
};
|
|
17361
17565
|
|
|
17362
17566
|
// src/commands/eventsource/update.ts
|
|
17363
|
-
import
|
|
17567
|
+
import chalk60 from "chalk";
|
|
17364
17568
|
function findSource(esComponent, id) {
|
|
17365
17569
|
const sources = esComponent.list();
|
|
17366
17570
|
const matched = sources.find((s) => s.id === id || s.id.startsWith(id));
|
|
@@ -17432,7 +17636,7 @@ var EventSourceUpdateCommand = {
|
|
|
17432
17636
|
const all = esComponent.list();
|
|
17433
17637
|
if (all.length > 0) {
|
|
17434
17638
|
output.info("");
|
|
17435
|
-
output.info(
|
|
17639
|
+
output.info(chalk60.gray("可用的事件源:"));
|
|
17436
17640
|
for (const s of all) {
|
|
17437
17641
|
output.info(` - ${s.id.substring(0, 8)}: ${s.name} (${s.type})`);
|
|
17438
17642
|
}
|
|
@@ -17474,19 +17678,19 @@ var EventSourceUpdateCommand = {
|
|
|
17474
17678
|
}
|
|
17475
17679
|
try {
|
|
17476
17680
|
const result = await esComponent.update(match.fullId, partial);
|
|
17477
|
-
output.success(
|
|
17681
|
+
output.success(chalk60.green(`✅ 事件源已更新: ${match.source.name}`));
|
|
17478
17682
|
output.log("");
|
|
17479
|
-
output.log(
|
|
17683
|
+
output.log(chalk60.bold("修改字段:"));
|
|
17480
17684
|
const before = match.source;
|
|
17481
17685
|
const after = result.updated;
|
|
17482
17686
|
for (const field of result.fields) {
|
|
17483
17687
|
const beforeVal = JSON.stringify(before[field] ?? before.options?.[field]);
|
|
17484
17688
|
const afterVal = JSON.stringify(after[field] ?? after.options?.[field]);
|
|
17485
|
-
output.log(` ${
|
|
17689
|
+
output.log(` ${chalk60.cyan(field)}: ${chalk60.gray(beforeVal)} ${chalk60.gray("→")} ${chalk60.green(afterVal)}`);
|
|
17486
17690
|
}
|
|
17487
17691
|
output.log("");
|
|
17488
17692
|
if (result.wasRunning) {
|
|
17489
|
-
output.info(
|
|
17693
|
+
output.info(chalk60.yellow(`⚠️ 事件源在更新前正在运行,已自动停止。请使用 'roy-agent eventsource start ${match.fullId.substring(0, 8)}' 手动启动以应用新配置。`));
|
|
17490
17694
|
}
|
|
17491
17695
|
} catch (error) {
|
|
17492
17696
|
output.error(`❌ 更新失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -17499,7 +17703,7 @@ var EventSourceUpdateCommand = {
|
|
|
17499
17703
|
};
|
|
17500
17704
|
|
|
17501
17705
|
// src/commands/eventsource/remove.ts
|
|
17502
|
-
import
|
|
17706
|
+
import chalk61 from "chalk";
|
|
17503
17707
|
var EventSourceRemoveCommand = {
|
|
17504
17708
|
command: "remove <id>",
|
|
17505
17709
|
aliases: ["rm"],
|
|
@@ -17538,7 +17742,7 @@ var EventSourceRemoveCommand = {
|
|
|
17538
17742
|
const status = esComponent.getStatus(matchedSource.id);
|
|
17539
17743
|
if (status === "running" && !args.force) {
|
|
17540
17744
|
output.error(`事件源正在运行中,请先停止: ${matchedSource.name} (${status})`);
|
|
17541
|
-
output.log(
|
|
17745
|
+
output.log(chalk61.gray(`使用 --force 强制移除或 'roy-agent eventsource stop ${matchedSource.id.substring(0, 8)}' 先停止`));
|
|
17542
17746
|
process.exit(1);
|
|
17543
17747
|
}
|
|
17544
17748
|
if (status === "running") {
|
|
@@ -17547,7 +17751,7 @@ var EventSourceRemoveCommand = {
|
|
|
17547
17751
|
}
|
|
17548
17752
|
const result = esComponent.unregister(matchedSource.id);
|
|
17549
17753
|
if (result) {
|
|
17550
|
-
output.success(
|
|
17754
|
+
output.success(chalk61.green(`事件源已移除: ${matchedSource.name}`));
|
|
17551
17755
|
} else {
|
|
17552
17756
|
output.error("移除失败");
|
|
17553
17757
|
process.exit(1);
|
|
@@ -17559,7 +17763,7 @@ var EventSourceRemoveCommand = {
|
|
|
17559
17763
|
};
|
|
17560
17764
|
|
|
17561
17765
|
// src/commands/eventsource/start.ts
|
|
17562
|
-
import
|
|
17766
|
+
import chalk62 from "chalk";
|
|
17563
17767
|
var EventSourceStartCommand = {
|
|
17564
17768
|
command: "start <id>",
|
|
17565
17769
|
describe: "启动指定的事件源",
|
|
@@ -17596,15 +17800,15 @@ var EventSourceStartCommand = {
|
|
|
17596
17800
|
}
|
|
17597
17801
|
const status = esComponent.getStatus(matchedSource.id);
|
|
17598
17802
|
if (status === "running") {
|
|
17599
|
-
output.log(
|
|
17803
|
+
output.log(chalk62.yellow(`事件源已在运行: ${matchedSource.name}`));
|
|
17600
17804
|
return;
|
|
17601
17805
|
}
|
|
17602
17806
|
output.info(`正在启动事件源 '${matchedSource.name}'...`);
|
|
17603
17807
|
try {
|
|
17604
17808
|
await esComponent.startSource(matchedSource.id);
|
|
17605
|
-
output.success(
|
|
17809
|
+
output.success(chalk62.green(`事件源已启动: ${matchedSource.name}`));
|
|
17606
17810
|
if (!args.background) {
|
|
17607
|
-
output.log(
|
|
17811
|
+
output.log(chalk62.gray("按 Ctrl+C 停止..."));
|
|
17608
17812
|
await new Promise((resolve) => {
|
|
17609
17813
|
const cleanup = () => {
|
|
17610
17814
|
process.removeListener("SIGINT", cleanup);
|
|
@@ -17626,7 +17830,7 @@ var EventSourceStartCommand = {
|
|
|
17626
17830
|
};
|
|
17627
17831
|
|
|
17628
17832
|
// src/commands/eventsource/stop.ts
|
|
17629
|
-
import
|
|
17833
|
+
import chalk63 from "chalk";
|
|
17630
17834
|
var EventSourceStopCommand = {
|
|
17631
17835
|
command: "stop <id>",
|
|
17632
17836
|
aliases: ["kill"],
|
|
@@ -17664,13 +17868,13 @@ var EventSourceStopCommand = {
|
|
|
17664
17868
|
}
|
|
17665
17869
|
const status = esComponent.getStatus(matchedSource.id);
|
|
17666
17870
|
if (status !== "running") {
|
|
17667
|
-
output.log(
|
|
17871
|
+
output.log(chalk63.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
|
|
17668
17872
|
return;
|
|
17669
17873
|
}
|
|
17670
17874
|
output.info(`正在停止事件源 '${matchedSource.name}'...`);
|
|
17671
17875
|
try {
|
|
17672
17876
|
await esComponent.stopSource(matchedSource.id);
|
|
17673
|
-
output.success(
|
|
17877
|
+
output.success(chalk63.green(`事件源已停止: ${matchedSource.name}`));
|
|
17674
17878
|
} catch (error) {
|
|
17675
17879
|
output.error(`停止失败: ${error}`);
|
|
17676
17880
|
process.exit(1);
|
|
@@ -17682,14 +17886,14 @@ var EventSourceStopCommand = {
|
|
|
17682
17886
|
};
|
|
17683
17887
|
|
|
17684
17888
|
// src/commands/eventsource/status.ts
|
|
17685
|
-
import
|
|
17889
|
+
import chalk64 from "chalk";
|
|
17686
17890
|
var STATUS_COLORS = {
|
|
17687
|
-
created:
|
|
17688
|
-
starting:
|
|
17689
|
-
running:
|
|
17690
|
-
stopping:
|
|
17691
|
-
stopped:
|
|
17692
|
-
error:
|
|
17891
|
+
created: chalk64.gray,
|
|
17892
|
+
starting: chalk64.yellow,
|
|
17893
|
+
running: chalk64.green,
|
|
17894
|
+
stopping: chalk64.yellow,
|
|
17895
|
+
stopped: chalk64.gray,
|
|
17896
|
+
error: chalk64.red
|
|
17693
17897
|
};
|
|
17694
17898
|
var STATUS_ICONS = {
|
|
17695
17899
|
created: "○",
|
|
@@ -17743,7 +17947,7 @@ var EventSourceStatusCommand = {
|
|
|
17743
17947
|
process.exit(1);
|
|
17744
17948
|
}
|
|
17745
17949
|
const status = esComponent.getStatus(matchedSource.id) || "unknown";
|
|
17746
|
-
const statusColor = STATUS_COLORS[status] ||
|
|
17950
|
+
const statusColor = STATUS_COLORS[status] || chalk64.gray;
|
|
17747
17951
|
if (args.json) {
|
|
17748
17952
|
output.json({
|
|
17749
17953
|
id: matchedSource.id,
|
|
@@ -17760,31 +17964,31 @@ var EventSourceStatusCommand = {
|
|
|
17760
17964
|
});
|
|
17761
17965
|
return;
|
|
17762
17966
|
}
|
|
17763
|
-
output.log(
|
|
17967
|
+
output.log(chalk64.bold("事件源详情"));
|
|
17764
17968
|
output.log("─".repeat(50));
|
|
17765
|
-
output.log(` ID: ${
|
|
17766
|
-
output.log(` Name: ${
|
|
17767
|
-
output.log(` Type: ${
|
|
17969
|
+
output.log(` ID: ${chalk64.gray(matchedSource.id)}`);
|
|
17970
|
+
output.log(` Name: ${chalk64.cyan(matchedSource.name)}`);
|
|
17971
|
+
output.log(` Type: ${chalk64.cyan(matchedSource.type)}`);
|
|
17768
17972
|
output.log(` Status: ${statusColor(`${STATUS_ICONS[status]} ${STATUS_LABELS[status]}`)}`);
|
|
17769
|
-
output.log(` Enabled: ${matchedSource.enabled ?
|
|
17973
|
+
output.log(` Enabled: ${matchedSource.enabled ? chalk64.green("是") : chalk64.gray("否")}`);
|
|
17770
17974
|
if (matchedSource.eventTypes?.length) {
|
|
17771
|
-
output.log(` Events: ${
|
|
17975
|
+
output.log(` Events: ${chalk64.gray(matchedSource.eventTypes.join(", "))}`);
|
|
17772
17976
|
}
|
|
17773
17977
|
if (matchedSource.command) {
|
|
17774
|
-
output.log(` Command: ${
|
|
17978
|
+
output.log(` Command: ${chalk64.gray(matchedSource.command)}`);
|
|
17775
17979
|
}
|
|
17776
17980
|
if (matchedSource.interval) {
|
|
17777
|
-
output.log(` Interval: ${
|
|
17981
|
+
output.log(` Interval: ${chalk64.gray(`${matchedSource.interval}ms`)}`);
|
|
17778
17982
|
}
|
|
17779
17983
|
if (matchedSource.url) {
|
|
17780
|
-
output.log(` URL: ${
|
|
17984
|
+
output.log(` URL: ${chalk64.gray(matchedSource.url)}`);
|
|
17781
17985
|
}
|
|
17782
17986
|
output.log("");
|
|
17783
17987
|
return;
|
|
17784
17988
|
}
|
|
17785
17989
|
const sources = esComponent.list();
|
|
17786
17990
|
if (sources.length === 0) {
|
|
17787
|
-
output.log(
|
|
17991
|
+
output.log(chalk64.yellow("没有配置的事件源"));
|
|
17788
17992
|
return;
|
|
17789
17993
|
}
|
|
17790
17994
|
if (args.json) {
|
|
@@ -17798,21 +18002,21 @@ var EventSourceStatusCommand = {
|
|
|
17798
18002
|
output.json({ sources: sourcesWithStatus, count: sources.length });
|
|
17799
18003
|
return;
|
|
17800
18004
|
}
|
|
17801
|
-
output.log(
|
|
18005
|
+
output.log(chalk64.bold("事件源状态概览"));
|
|
17802
18006
|
output.log("─".repeat(60));
|
|
17803
18007
|
for (const source of sources) {
|
|
17804
18008
|
const status = esComponent.getStatus(source.id) || "unknown";
|
|
17805
|
-
const statusColor = STATUS_COLORS[status] ||
|
|
18009
|
+
const statusColor = STATUS_COLORS[status] || chalk64.gray;
|
|
17806
18010
|
const icon = STATUS_ICONS[status] || "?";
|
|
17807
18011
|
const label = STATUS_LABELS[status] || status;
|
|
17808
18012
|
output.log("");
|
|
17809
|
-
output.log(` ${
|
|
18013
|
+
output.log(` ${chalk64.cyan(source.name)} ${chalk64.gray(`(${source.type})`)}`);
|
|
17810
18014
|
output.log(` └─ Status: ${statusColor(`${icon} ${label}`)}`);
|
|
17811
|
-
output.log(` ID: ${
|
|
18015
|
+
output.log(` ID: ${chalk64.gray(source.id.substring(0, 8))}...`);
|
|
17812
18016
|
}
|
|
17813
18017
|
output.log("");
|
|
17814
18018
|
const runningCount = sources.filter((s) => esComponent.getStatus(s.id) === "running").length;
|
|
17815
|
-
output.log(
|
|
18019
|
+
output.log(chalk64.green(`✅ ${runningCount}/${sources.length} 运行中`));
|
|
17816
18020
|
} finally {
|
|
17817
18021
|
await envService.dispose();
|
|
17818
18022
|
}
|
|
@@ -18125,7 +18329,7 @@ var DebugCommand = {
|
|
|
18125
18329
|
};
|
|
18126
18330
|
|
|
18127
18331
|
// src/commands/workflow/renderers.ts
|
|
18128
|
-
import
|
|
18332
|
+
import chalk65 from "chalk";
|
|
18129
18333
|
function truncateVisual3(str, maxWidth) {
|
|
18130
18334
|
if (!str)
|
|
18131
18335
|
return "-";
|
|
@@ -18160,18 +18364,18 @@ function formatDuration(ms) {
|
|
|
18160
18364
|
function statusColor(status) {
|
|
18161
18365
|
switch (status) {
|
|
18162
18366
|
case "completed":
|
|
18163
|
-
return
|
|
18367
|
+
return chalk65.green;
|
|
18164
18368
|
case "running":
|
|
18165
18369
|
case "idle":
|
|
18166
|
-
return
|
|
18370
|
+
return chalk65.blue;
|
|
18167
18371
|
case "paused":
|
|
18168
|
-
return
|
|
18372
|
+
return chalk65.yellow;
|
|
18169
18373
|
case "failed":
|
|
18170
|
-
return
|
|
18374
|
+
return chalk65.red;
|
|
18171
18375
|
case "stopped":
|
|
18172
|
-
return
|
|
18376
|
+
return chalk65.gray;
|
|
18173
18377
|
default:
|
|
18174
|
-
return
|
|
18378
|
+
return chalk65.white;
|
|
18175
18379
|
}
|
|
18176
18380
|
}
|
|
18177
18381
|
function renderWorkflowList(workflows, options) {
|
|
@@ -18190,7 +18394,7 @@ function renderWorkflowList(workflows, options) {
|
|
|
18190
18394
|
}, null, 2);
|
|
18191
18395
|
}
|
|
18192
18396
|
if (workflows.length === 0) {
|
|
18193
|
-
return
|
|
18397
|
+
return chalk65.yellow("No workflows found");
|
|
18194
18398
|
}
|
|
18195
18399
|
const NAME_WIDTH = 30;
|
|
18196
18400
|
const VERSION_WIDTH = 10;
|
|
@@ -18198,10 +18402,10 @@ function renderWorkflowList(workflows, options) {
|
|
|
18198
18402
|
const UPDATED_WIDTH = 20;
|
|
18199
18403
|
const GAP = " ";
|
|
18200
18404
|
const headerLine = [
|
|
18201
|
-
|
|
18202
|
-
|
|
18203
|
-
|
|
18204
|
-
|
|
18405
|
+
chalk65.bold("NAME".padEnd(NAME_WIDTH)),
|
|
18406
|
+
chalk65.bold("VER".padEnd(VERSION_WIDTH)),
|
|
18407
|
+
chalk65.bold("TAGS".padEnd(TAGS_WIDTH)),
|
|
18408
|
+
chalk65.bold("UPDATED")
|
|
18205
18409
|
].join(GAP);
|
|
18206
18410
|
const sepLine = "─".repeat(NAME_WIDTH + VERSION_WIDTH + TAGS_WIDTH + UPDATED_WIDTH + GAP.length * 3);
|
|
18207
18411
|
const rows = workflows.map((w) => {
|
|
@@ -18216,18 +18420,18 @@ function renderWorkflowList(workflows, options) {
|
|
|
18216
18420
|
}
|
|
18217
18421
|
function renderWorkflowDetail(workflow, options) {
|
|
18218
18422
|
const lines = [];
|
|
18219
|
-
lines.push(
|
|
18423
|
+
lines.push(chalk65.bold(`
|
|
18220
18424
|
\uD83D\uDCCB Workflow Details
|
|
18221
18425
|
`));
|
|
18222
|
-
lines.push(` ${
|
|
18223
|
-
lines.push(` ${
|
|
18224
|
-
lines.push(` ${
|
|
18225
|
-
lines.push(` ${
|
|
18226
|
-
lines.push(` ${
|
|
18227
|
-
lines.push(` ${
|
|
18228
|
-
lines.push(` ${
|
|
18426
|
+
lines.push(` ${chalk65.cyan("ID:")} ${workflow.id}`);
|
|
18427
|
+
lines.push(` ${chalk65.cyan("Name:")} ${workflow.name}`);
|
|
18428
|
+
lines.push(` ${chalk65.cyan("Version:")} ${workflow.version}`);
|
|
18429
|
+
lines.push(` ${chalk65.cyan("Description:")} ${workflow.description || "-"}`);
|
|
18430
|
+
lines.push(` ${chalk65.cyan("Tags:")} ${workflow.tags.join(", ") || "-"}`);
|
|
18431
|
+
lines.push(` ${chalk65.cyan("Created:")} ${formatDate(workflow.createdAt)}`);
|
|
18432
|
+
lines.push(` ${chalk65.cyan("Updated:")} ${formatDate(workflow.updatedAt)}`);
|
|
18229
18433
|
const nodeCount = workflow.definition.nodes.length;
|
|
18230
|
-
lines.push(
|
|
18434
|
+
lines.push(chalk65.bold(`
|
|
18231
18435
|
\uD83D\uDCCA Nodes Summary
|
|
18232
18436
|
`));
|
|
18233
18437
|
lines.push(` Total: ${nodeCount} nodes`);
|
|
@@ -18239,7 +18443,7 @@ function renderWorkflowDetail(workflow, options) {
|
|
|
18239
18443
|
lines.push(` - ${type}: ${count}`);
|
|
18240
18444
|
}
|
|
18241
18445
|
if (workflow.definition.config) {
|
|
18242
|
-
lines.push(
|
|
18446
|
+
lines.push(chalk65.bold(`
|
|
18243
18447
|
⚙️ Configuration
|
|
18244
18448
|
`));
|
|
18245
18449
|
if (workflow.definition.config.parallel_limit !== undefined) {
|
|
@@ -18253,7 +18457,7 @@ function renderWorkflowDetail(workflow, options) {
|
|
|
18253
18457
|
}
|
|
18254
18458
|
}
|
|
18255
18459
|
if (options?.includeRuns && options.includeRuns.length > 0) {
|
|
18256
|
-
lines.push(
|
|
18460
|
+
lines.push(chalk65.bold(`
|
|
18257
18461
|
\uD83D\uDCDC Recent Runs
|
|
18258
18462
|
`));
|
|
18259
18463
|
lines.push(renderRunsList(options.includeRuns.slice(0, 5)));
|
|
@@ -18277,7 +18481,7 @@ function renderRunsList(runs, options) {
|
|
|
18277
18481
|
}, null, 2);
|
|
18278
18482
|
}
|
|
18279
18483
|
if (runs.length === 0) {
|
|
18280
|
-
return
|
|
18484
|
+
return chalk65.yellow("No runs found");
|
|
18281
18485
|
}
|
|
18282
18486
|
const ID_WIDTH = 20;
|
|
18283
18487
|
const STATUS_WIDTH = 12;
|
|
@@ -18285,10 +18489,10 @@ function renderRunsList(runs, options) {
|
|
|
18285
18489
|
const UPDATED_WIDTH = 20;
|
|
18286
18490
|
const GAP = " ";
|
|
18287
18491
|
const headerLine = [
|
|
18288
|
-
|
|
18289
|
-
|
|
18290
|
-
|
|
18291
|
-
|
|
18492
|
+
chalk65.bold("RUN ID".padEnd(ID_WIDTH)),
|
|
18493
|
+
chalk65.bold("STATUS".padEnd(STATUS_WIDTH)),
|
|
18494
|
+
chalk65.bold("DURATION".padEnd(DURATION_WIDTH)),
|
|
18495
|
+
chalk65.bold("STARTED")
|
|
18292
18496
|
].join(GAP);
|
|
18293
18497
|
const sepLine = "─".repeat(ID_WIDTH + STATUS_WIDTH + DURATION_WIDTH + UPDATED_WIDTH + GAP.length * 3);
|
|
18294
18498
|
const rows = runs.map((r) => {
|
|
@@ -18303,34 +18507,34 @@ function renderRunsList(runs, options) {
|
|
|
18303
18507
|
}
|
|
18304
18508
|
function renderRunDetail(run) {
|
|
18305
18509
|
const lines = [];
|
|
18306
|
-
lines.push(
|
|
18510
|
+
lines.push(chalk65.bold(`
|
|
18307
18511
|
\uD83C\uDFC3 Run Details
|
|
18308
18512
|
`));
|
|
18309
|
-
lines.push(` ${
|
|
18310
|
-
lines.push(` ${
|
|
18311
|
-
lines.push(` ${
|
|
18312
|
-
lines.push(` ${
|
|
18513
|
+
lines.push(` ${chalk65.cyan("Run ID:")} ${run.id}`);
|
|
18514
|
+
lines.push(` ${chalk65.cyan("Workflow:")} ${run.workflowId}`);
|
|
18515
|
+
lines.push(` ${chalk65.cyan("Status:")} ${statusColor(run.status)(run.status)}`);
|
|
18516
|
+
lines.push(` ${chalk65.cyan("Started:")} ${formatDate(run.startedAt)}`);
|
|
18313
18517
|
if (run.pausedAt) {
|
|
18314
|
-
lines.push(` ${
|
|
18518
|
+
lines.push(` ${chalk65.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
|
|
18315
18519
|
}
|
|
18316
18520
|
if (run.resumedAt) {
|
|
18317
|
-
lines.push(` ${
|
|
18521
|
+
lines.push(` ${chalk65.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
|
|
18318
18522
|
}
|
|
18319
18523
|
if (run.stoppedAt) {
|
|
18320
|
-
lines.push(` ${
|
|
18524
|
+
lines.push(` ${chalk65.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
|
|
18321
18525
|
}
|
|
18322
18526
|
if (run.completedAt) {
|
|
18323
|
-
lines.push(` ${
|
|
18527
|
+
lines.push(` ${chalk65.cyan("Completed:")} ${formatDate(run.completedAt)}`);
|
|
18324
18528
|
}
|
|
18325
|
-
lines.push(` ${
|
|
18529
|
+
lines.push(` ${chalk65.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
|
|
18326
18530
|
if (run.error) {
|
|
18327
|
-
lines.push(
|
|
18531
|
+
lines.push(chalk65.bold(`
|
|
18328
18532
|
❌ Error
|
|
18329
18533
|
`));
|
|
18330
|
-
lines.push(` ${
|
|
18534
|
+
lines.push(` ${chalk65.red(run.error)}`);
|
|
18331
18535
|
}
|
|
18332
18536
|
if (run.output) {
|
|
18333
|
-
lines.push(
|
|
18537
|
+
lines.push(chalk65.bold(`
|
|
18334
18538
|
\uD83D\uDCE4 Output
|
|
18335
18539
|
`));
|
|
18336
18540
|
lines.push(" " + JSON.stringify(run.output, null, 2).split(`
|
|
@@ -18341,36 +18545,49 @@ function renderRunDetail(run) {
|
|
|
18341
18545
|
`);
|
|
18342
18546
|
}
|
|
18343
18547
|
function renderWorkflowAdded(workflow) {
|
|
18344
|
-
return
|
|
18548
|
+
return chalk65.green(`
|
|
18345
18549
|
✅ Workflow '${workflow.name}' added successfully
|
|
18346
18550
|
`) + ` ID: ${workflow.id}
|
|
18347
18551
|
` + ` Version: ${workflow.version}
|
|
18348
18552
|
`;
|
|
18349
18553
|
}
|
|
18350
18554
|
function renderWorkflowUpdated(workflow) {
|
|
18351
|
-
return
|
|
18555
|
+
return chalk65.green(`
|
|
18352
18556
|
✅ Workflow '${workflow.name}' updated successfully
|
|
18353
18557
|
`) + ` ID: ${workflow.id}
|
|
18354
18558
|
`;
|
|
18355
18559
|
}
|
|
18356
18560
|
function renderWorkflowDeleted(name) {
|
|
18357
|
-
return
|
|
18561
|
+
return chalk65.green(`
|
|
18358
18562
|
✅ Workflow '${name}' deleted successfully
|
|
18359
18563
|
`);
|
|
18360
18564
|
}
|
|
18361
18565
|
function renderRunResult(result) {
|
|
18362
18566
|
const lines = [];
|
|
18363
18567
|
if (result.status === "completed") {
|
|
18364
|
-
lines.push(
|
|
18568
|
+
lines.push(chalk65.green(`
|
|
18365
18569
|
✅ Workflow completed successfully`));
|
|
18366
18570
|
} else if (result.status === "failed") {
|
|
18367
|
-
lines.push(
|
|
18571
|
+
lines.push(chalk65.red(`
|
|
18368
18572
|
❌ Workflow failed`));
|
|
18369
18573
|
} else if (result.status === "stopped") {
|
|
18370
|
-
lines.push(
|
|
18574
|
+
lines.push(chalk65.yellow(`
|
|
18371
18575
|
⚠️ Workflow stopped`));
|
|
18576
|
+
} else if (result.status === "paused") {
|
|
18577
|
+
lines.push(chalk65.yellow(`
|
|
18578
|
+
⏸️ Workflow paused`));
|
|
18579
|
+
if (result.pendingNodeId) {
|
|
18580
|
+
lines.push(chalk65.gray(` Pending node: ${result.pendingNodeId}`));
|
|
18581
|
+
}
|
|
18582
|
+
if (result.query) {
|
|
18583
|
+
lines.push("");
|
|
18584
|
+
lines.push(chalk65.bold("\uD83D\uDCAC Agent asked: ") + chalk65.white(result.query));
|
|
18585
|
+
}
|
|
18586
|
+
if (result.agentSessionId) {
|
|
18587
|
+
lines.push(chalk65.gray(` Agent sub-session: ${result.agentSessionId}`));
|
|
18588
|
+
}
|
|
18372
18589
|
} else {
|
|
18373
|
-
lines.push(
|
|
18590
|
+
lines.push(chalk65.blue(`
|
|
18374
18591
|
\uD83D\uDD04 Workflow ${result.status}`));
|
|
18375
18592
|
}
|
|
18376
18593
|
lines.push(` Run ID: ${result.runId}`);
|
|
@@ -18378,11 +18595,11 @@ function renderRunResult(result) {
|
|
|
18378
18595
|
lines.push(` Duration: ${formatDuration(result.durationMs)}`);
|
|
18379
18596
|
}
|
|
18380
18597
|
if (result.error) {
|
|
18381
|
-
lines.push(
|
|
18598
|
+
lines.push(chalk65.red(`
|
|
18382
18599
|
Error: ${result.error}`));
|
|
18383
18600
|
}
|
|
18384
18601
|
if (result.output) {
|
|
18385
|
-
lines.push(
|
|
18602
|
+
lines.push(chalk65.bold(`
|
|
18386
18603
|
\uD83D\uDCE4 Output:`));
|
|
18387
18604
|
lines.push(JSON.stringify(result.output, null, 2));
|
|
18388
18605
|
}
|
|
@@ -18396,10 +18613,10 @@ function renderNodesList(nodes) {
|
|
|
18396
18613
|
const DEPS_WIDTH = 20;
|
|
18397
18614
|
const GAP = " ";
|
|
18398
18615
|
const headerLine = [
|
|
18399
|
-
|
|
18400
|
-
|
|
18401
|
-
|
|
18402
|
-
|
|
18616
|
+
chalk65.bold("NODE ID".padEnd(ID_WIDTH)),
|
|
18617
|
+
chalk65.bold("TYPE".padEnd(TYPE_WIDTH)),
|
|
18618
|
+
chalk65.bold("NAME".padEnd(NAME_WIDTH)),
|
|
18619
|
+
chalk65.bold("DEPENDS ON")
|
|
18403
18620
|
].join(GAP);
|
|
18404
18621
|
const sepLine = "─".repeat(ID_WIDTH + TYPE_WIDTH + NAME_WIDTH + DEPS_WIDTH + GAP.length * 3);
|
|
18405
18622
|
const rows = nodes.map((n) => {
|
|
@@ -18414,7 +18631,7 @@ function renderNodesList(nodes) {
|
|
|
18414
18631
|
}
|
|
18415
18632
|
|
|
18416
18633
|
// src/commands/workflow/commands/list.ts
|
|
18417
|
-
import
|
|
18634
|
+
import chalk66 from "chalk";
|
|
18418
18635
|
import { createWorkflowListTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
18419
18636
|
function buildListWorkflowsJson(workflows, total, args, availableTags) {
|
|
18420
18637
|
const output = {
|
|
@@ -18574,20 +18791,20 @@ var WorkflowListCommand = {
|
|
|
18574
18791
|
if (total > workflows.length) {
|
|
18575
18792
|
const start = finalOffset + 1;
|
|
18576
18793
|
const end = finalOffset + workflows.length;
|
|
18577
|
-
output.log(
|
|
18794
|
+
output.log(chalk66.green(`
|
|
18578
18795
|
✅ 显示 ${start}-${end} / 共 ${total} 个 Workflow`));
|
|
18579
18796
|
const totalPages = Math.ceil(total / pageSize);
|
|
18580
18797
|
const currentPage = Math.floor(finalOffset / pageSize) + 1;
|
|
18581
18798
|
if (totalPages > 1) {
|
|
18582
|
-
output.log(
|
|
18799
|
+
output.log(chalk66.cyan(`\uD83D\uDCC4 第 ${currentPage} / ${totalPages} 页`));
|
|
18583
18800
|
}
|
|
18584
18801
|
} else {
|
|
18585
|
-
output.log(
|
|
18802
|
+
output.log(chalk66.green(`
|
|
18586
18803
|
✅ 共 ${total} 个 Workflow`));
|
|
18587
18804
|
}
|
|
18588
18805
|
if (availableTags.length > 0) {
|
|
18589
18806
|
const tagsLine = availableTags.map((t) => `${t.name}(${t.count})`).join(", ");
|
|
18590
|
-
output.log(
|
|
18807
|
+
output.log(chalk66.cyan(`
|
|
18591
18808
|
\uD83C\uDFF7️ Available tags: ${tagsLine}`));
|
|
18592
18809
|
}
|
|
18593
18810
|
}
|
|
@@ -19191,7 +19408,7 @@ class WorkflowValidator {
|
|
|
19191
19408
|
|
|
19192
19409
|
// src/commands/workflow/commands/add.ts
|
|
19193
19410
|
import { validateWorkflowDefinition } from "@ai-setting/roy-agent-core/env/workflow/utils";
|
|
19194
|
-
import
|
|
19411
|
+
import chalk67 from "chalk";
|
|
19195
19412
|
import fs3 from "fs";
|
|
19196
19413
|
import path6 from "path";
|
|
19197
19414
|
async function parseWorkflowContent(content, filename) {
|
|
@@ -19333,7 +19550,7 @@ var WorkflowAddCommand = {
|
|
|
19333
19550
|
definition = await parseWorkflowContent(content, filePath);
|
|
19334
19551
|
workflowName = a.name || definition.name || path6.basename(filePath);
|
|
19335
19552
|
if (a.validate) {
|
|
19336
|
-
output.log(
|
|
19553
|
+
output.log(chalk67.blue("\uD83D\uDD0D Validating workflow..."));
|
|
19337
19554
|
const dagResult = validateWorkflowDefinition(definition);
|
|
19338
19555
|
if (!dagResult.valid) {
|
|
19339
19556
|
output.error(`
|
|
@@ -19357,11 +19574,11 @@ var WorkflowAddCommand = {
|
|
|
19357
19574
|
});
|
|
19358
19575
|
process.exit(1);
|
|
19359
19576
|
}
|
|
19360
|
-
output.log(
|
|
19577
|
+
output.log(chalk67.green(`✅ Workflow validation passed
|
|
19361
19578
|
`));
|
|
19362
19579
|
}
|
|
19363
19580
|
} else if (a.desc) {
|
|
19364
|
-
output.log(
|
|
19581
|
+
output.log(chalk67.blue(`\uD83E\uDD16 Generating workflow from description...
|
|
19365
19582
|
`));
|
|
19366
19583
|
const agentComponent = env.getComponent("agent");
|
|
19367
19584
|
if (!agentComponent) {
|
|
@@ -19383,20 +19600,20 @@ ${a.desc}
|
|
|
19383
19600
|
1. 先用 \`roy-agent workflow nodes\` 查看可用的节点类型
|
|
19384
19601
|
2. 生成的 YAML 必须通过 \`roy-agent workflow validate --yaml "<yaml>"\` 验证
|
|
19385
19602
|
3. 验证通过后才输出最终 YAML`;
|
|
19386
|
-
output.log(
|
|
19603
|
+
output.log(chalk67.gray("Running workflow-extract agent..."));
|
|
19387
19604
|
const result = await agentComponent.run("workflow-extract", prompt);
|
|
19388
19605
|
const agentOutput = result.finalText || "";
|
|
19389
19606
|
definition = parseYamlFromAgentOutput(agentOutput);
|
|
19390
19607
|
if (definition === null) {
|
|
19391
19608
|
output.error("Failed to parse workflow from agent output");
|
|
19392
|
-
output.log(
|
|
19609
|
+
output.log(chalk67.gray(`
|
|
19393
19610
|
Agent output:
|
|
19394
19611
|
` + agentOutput.slice(0, 500)));
|
|
19395
19612
|
process.exit(1);
|
|
19396
19613
|
}
|
|
19397
19614
|
workflowName = a.name || definition.name;
|
|
19398
19615
|
if (a.validate) {
|
|
19399
|
-
output.log(
|
|
19616
|
+
output.log(chalk67.blue(`
|
|
19400
19617
|
\uD83D\uDD0D Validating generated workflow...`));
|
|
19401
19618
|
const dagResult = validateWorkflowDefinition(definition);
|
|
19402
19619
|
if (!dagResult.valid) {
|
|
@@ -19405,7 +19622,7 @@ Agent output:
|
|
|
19405
19622
|
dagResult.errors.forEach((msg, i) => {
|
|
19406
19623
|
output.error(`[Error ${i + 1}/${dagResult.errors.length}] ${msg}`);
|
|
19407
19624
|
});
|
|
19408
|
-
output.log(
|
|
19625
|
+
output.log(chalk67.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
|
|
19409
19626
|
process.exit(1);
|
|
19410
19627
|
}
|
|
19411
19628
|
const validator = new WorkflowValidator;
|
|
@@ -19420,16 +19637,16 @@ Agent output:
|
|
|
19420
19637
|
output.error(` Fix: ${error.fix}
|
|
19421
19638
|
`);
|
|
19422
19639
|
});
|
|
19423
|
-
output.log(
|
|
19640
|
+
output.log(chalk67.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
|
|
19424
19641
|
process.exit(1);
|
|
19425
19642
|
}
|
|
19426
|
-
output.log(
|
|
19643
|
+
output.log(chalk67.green(`✅ Generated workflow validation passed
|
|
19427
19644
|
`));
|
|
19428
19645
|
}
|
|
19429
19646
|
const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
|
|
19430
|
-
output.log(
|
|
19647
|
+
output.log(chalk67.gray("--- Generated YAML ---"));
|
|
19431
19648
|
output.log(yaml.stringify(definition));
|
|
19432
|
-
output.log(
|
|
19649
|
+
output.log(chalk67.gray(`------------------------
|
|
19433
19650
|
`));
|
|
19434
19651
|
} else {
|
|
19435
19652
|
output.error("Please provide --file or --desc option");
|
|
@@ -19455,10 +19672,10 @@ Agent output:
|
|
|
19455
19672
|
force: a.force
|
|
19456
19673
|
});
|
|
19457
19674
|
output.log(renderWorkflowAdded(workflow));
|
|
19458
|
-
output.log(
|
|
19675
|
+
output.log(chalk67.bold(`
|
|
19459
19676
|
\uD83D\uDCCA Nodes Summary:`));
|
|
19460
19677
|
output.log(renderNodesList(definition.nodes));
|
|
19461
|
-
output.log(
|
|
19678
|
+
output.log(chalk67.green(`
|
|
19462
19679
|
✅ Workflow '${workflowName}' added successfully`));
|
|
19463
19680
|
} catch (error) {
|
|
19464
19681
|
if (error.message?.includes("already exists") && !a.force) {
|
|
@@ -19475,7 +19692,7 @@ Agent output:
|
|
|
19475
19692
|
};
|
|
19476
19693
|
|
|
19477
19694
|
// src/commands/workflow/commands/get.ts
|
|
19478
|
-
import
|
|
19695
|
+
import chalk68 from "chalk";
|
|
19479
19696
|
import { createWorkflowGetTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
19480
19697
|
var WorkflowGetCommand = {
|
|
19481
19698
|
command: "get <identifier>",
|
|
@@ -19613,15 +19830,15 @@ var WorkflowGetCommand = {
|
|
|
19613
19830
|
} else {
|
|
19614
19831
|
output.log(renderWorkflowDetail(workflow, { includeRuns: runs }));
|
|
19615
19832
|
if (args.includeNodes) {
|
|
19616
|
-
output.log(
|
|
19833
|
+
output.log(chalk68.bold(`
|
|
19617
19834
|
\uD83D\uDCCB All Nodes:`));
|
|
19618
19835
|
output.log(renderNodesList(data.nodes || []));
|
|
19619
19836
|
}
|
|
19620
19837
|
const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
|
|
19621
19838
|
const defYaml = yaml.stringify(data.definition || {}, { indent: 2 });
|
|
19622
|
-
output.log(
|
|
19839
|
+
output.log(chalk68.bold(`
|
|
19623
19840
|
\uD83D\uDCC4 Definition (YAML):`));
|
|
19624
|
-
output.log(
|
|
19841
|
+
output.log(chalk68.gray(defYaml));
|
|
19625
19842
|
}
|
|
19626
19843
|
}
|
|
19627
19844
|
} catch (error) {
|
|
@@ -19634,7 +19851,7 @@ var WorkflowGetCommand = {
|
|
|
19634
19851
|
};
|
|
19635
19852
|
|
|
19636
19853
|
// src/commands/workflow/commands/update.ts
|
|
19637
|
-
import
|
|
19854
|
+
import chalk69 from "chalk";
|
|
19638
19855
|
import fs4 from "fs";
|
|
19639
19856
|
import path7 from "path";
|
|
19640
19857
|
import { parseWorkflowFile } from "@ai-setting/roy-agent-core/env/workflow/types";
|
|
@@ -19707,7 +19924,7 @@ var WorkflowUpdateCommand = {
|
|
|
19707
19924
|
const tags = a.tags ? a.tags.split(",").map((t) => t.trim()) : undefined;
|
|
19708
19925
|
const workflow = await service.updateWorkflow(a.name, updates, { tags });
|
|
19709
19926
|
output.log(renderWorkflowUpdated(workflow));
|
|
19710
|
-
output.log(
|
|
19927
|
+
output.log(chalk69.green(`
|
|
19711
19928
|
✅ Workflow '${a.name}' updated successfully`));
|
|
19712
19929
|
} catch (error) {
|
|
19713
19930
|
output.error(`Failed to update workflow: ${error}`);
|
|
@@ -19719,7 +19936,7 @@ var WorkflowUpdateCommand = {
|
|
|
19719
19936
|
};
|
|
19720
19937
|
|
|
19721
19938
|
// src/commands/workflow/commands/remove.ts
|
|
19722
|
-
import
|
|
19939
|
+
import chalk70 from "chalk";
|
|
19723
19940
|
var WorkflowRemoveCommand = {
|
|
19724
19941
|
command: "remove <name>",
|
|
19725
19942
|
describe: "删除 Workflow",
|
|
@@ -19758,8 +19975,8 @@ var WorkflowRemoveCommand = {
|
|
|
19758
19975
|
process.exit(1);
|
|
19759
19976
|
}
|
|
19760
19977
|
if (!args.force) {
|
|
19761
|
-
output.log(
|
|
19762
|
-
output.log(
|
|
19978
|
+
output.log(chalk70.yellow(`Are you sure you want to delete workflow '${args.name}'?`));
|
|
19979
|
+
output.log(chalk70.gray("Use --force to skip confirmation"));
|
|
19763
19980
|
process.exit(1);
|
|
19764
19981
|
}
|
|
19765
19982
|
const deleted = await service.deleteWorkflow(args.name);
|
|
@@ -19779,7 +19996,7 @@ var WorkflowRemoveCommand = {
|
|
|
19779
19996
|
|
|
19780
19997
|
// src/commands/workflow/commands/run.ts
|
|
19781
19998
|
var import_yaml = __toESM(require_dist(), 1);
|
|
19782
|
-
import
|
|
19999
|
+
import chalk71 from "chalk";
|
|
19783
20000
|
import fs5 from "fs";
|
|
19784
20001
|
import path8 from "path";
|
|
19785
20002
|
import { createRunWorkflowTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
@@ -19847,6 +20064,20 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19847
20064
|
input = args.session ? args.input : undefined;
|
|
19848
20065
|
}
|
|
19849
20066
|
}
|
|
20067
|
+
let nodeConfig;
|
|
20068
|
+
if (args.nodeConfig) {
|
|
20069
|
+
try {
|
|
20070
|
+
const parsed = JSON.parse(args.nodeConfig);
|
|
20071
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
20072
|
+
output.error(`Invalid --node-config: expected a JSON object mapping nodeId → overrides, got: ${args.nodeConfig}`);
|
|
20073
|
+
process.exit(1);
|
|
20074
|
+
}
|
|
20075
|
+
nodeConfig = parsed;
|
|
20076
|
+
} catch (err) {
|
|
20077
|
+
output.error(`Invalid --node-config JSON: ${err instanceof Error ? err.message : String(err)}`);
|
|
20078
|
+
process.exit(1);
|
|
20079
|
+
}
|
|
20080
|
+
}
|
|
19850
20081
|
if (args.session && !args.session.startsWith("workflow_")) {
|
|
19851
20082
|
output.error(`Invalid session ID: must start with 'workflow_' (got: ${args.session})`);
|
|
19852
20083
|
process.exit(1);
|
|
@@ -19854,7 +20085,8 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19854
20085
|
const runOptions = {
|
|
19855
20086
|
debug: args.debug,
|
|
19856
20087
|
parallelLimit: args.parallelLimit,
|
|
19857
|
-
timeout: args.timeout
|
|
20088
|
+
timeout: args.timeout,
|
|
20089
|
+
...nodeConfig ? { nodeConfig } : {}
|
|
19858
20090
|
};
|
|
19859
20091
|
const rawEnvParentId = process.env["ROY_PARENT_SESSION_ID"];
|
|
19860
20092
|
if (typeof rawEnvParentId === "string" && rawEnvParentId.length > 0) {
|
|
@@ -19866,7 +20098,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19866
20098
|
}
|
|
19867
20099
|
if (args.session) {
|
|
19868
20100
|
const sessionId = args.session;
|
|
19869
|
-
output.log(
|
|
20101
|
+
output.log(chalk71.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
|
|
19870
20102
|
try {
|
|
19871
20103
|
const resumeInput = typeof input === "string" ? { userQuery: input } : input;
|
|
19872
20104
|
const result = await service.resumeSession(sessionId, {
|
|
@@ -19878,7 +20110,10 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19878
20110
|
status: result.status,
|
|
19879
20111
|
output: result.output,
|
|
19880
20112
|
error: result.error,
|
|
19881
|
-
durationMs: result.durationMs
|
|
20113
|
+
durationMs: result.durationMs,
|
|
20114
|
+
...result.pendingNodeId ? { pendingNodeId: result.pendingNodeId } : {},
|
|
20115
|
+
...result.query ? { query: result.query } : {},
|
|
20116
|
+
...result.agentSessionId ? { agentSessionId: result.agentSessionId } : {}
|
|
19882
20117
|
}));
|
|
19883
20118
|
} catch (err) {
|
|
19884
20119
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -19909,35 +20144,40 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19909
20144
|
definition = { ...definition, name: args.name };
|
|
19910
20145
|
}
|
|
19911
20146
|
const workflow = await service.createWorkflow(definition, { force: true });
|
|
19912
|
-
output.log(
|
|
19913
|
-
output.log(
|
|
20147
|
+
output.log(chalk71.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
|
|
20148
|
+
output.log(chalk71.green(`✅ Workflow registered: ${workflow.name} (${workflow.id})`));
|
|
19914
20149
|
if (args.registerOnly) {
|
|
19915
|
-
output.log(
|
|
20150
|
+
output.log(chalk71.gray("ℹ️ Use --register-only, skipping execution"));
|
|
19916
20151
|
if (workflowSpan) {
|
|
19917
20152
|
workflowSpan.end();
|
|
19918
20153
|
}
|
|
19919
20154
|
await envService.dispose();
|
|
19920
20155
|
process.exit(0);
|
|
19921
20156
|
}
|
|
19922
|
-
output.log(
|
|
19923
|
-
const
|
|
20157
|
+
output.log(chalk71.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
|
|
20158
|
+
const fileBranchInput = typeof input === "string" ? undefined : input;
|
|
20159
|
+
const result = await service.runWorkflow(definition, fileBranchInput, runOptions);
|
|
19924
20160
|
output.log(renderRunResult({
|
|
19925
20161
|
runId: result.runId,
|
|
19926
20162
|
status: result.status,
|
|
19927
20163
|
output: result.output,
|
|
19928
20164
|
error: result.error,
|
|
19929
|
-
durationMs: result.durationMs
|
|
20165
|
+
durationMs: result.durationMs,
|
|
20166
|
+
...result.pendingNodeId ? { pendingNodeId: result.pendingNodeId } : {},
|
|
20167
|
+
...result.query ? { query: result.query } : {},
|
|
20168
|
+
...result.agentSessionId ? { agentSessionId: result.agentSessionId } : {}
|
|
19930
20169
|
}));
|
|
19931
20170
|
if (result.status === "paused") {
|
|
19932
|
-
output.log(
|
|
19933
|
-
\uD83D\uDCA1
|
|
20171
|
+
output.log(chalk71.gray(`
|
|
20172
|
+
\uD83D\uDCA1 Resume with: roy-agent workflow run ${result.runId} --session ${result.runId} --input "<your answer>"`));
|
|
19934
20173
|
}
|
|
19935
20174
|
} else {
|
|
19936
20175
|
const tool = createRunWorkflowTool(service);
|
|
19937
20176
|
const toolResult = await tool.execute({
|
|
19938
20177
|
workflow_name: args.identifier,
|
|
19939
|
-
input: input || undefined,
|
|
19940
|
-
timeout: args.timeout
|
|
20178
|
+
input: typeof input === "string" ? undefined : input || undefined,
|
|
20179
|
+
timeout: args.timeout,
|
|
20180
|
+
...nodeConfig ? { node_config: nodeConfig } : {}
|
|
19941
20181
|
}, {});
|
|
19942
20182
|
if (!toolResult.success) {
|
|
19943
20183
|
const outAny = toolResult.output;
|
|
@@ -19945,7 +20185,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19945
20185
|
output.error(toolResult.error || `Failed to run workflow: ${args.identifier}`);
|
|
19946
20186
|
if (runId) {
|
|
19947
20187
|
output.error(`Run ID: ${runId}`);
|
|
19948
|
-
output.error(
|
|
20188
|
+
output.error(chalk71.gray(`
|
|
19949
20189
|
\uD83D\uDCA1 Use "roy-agent workflow status ${runId}" to check progress, or "roy-agent workflow run ${args.identifier} --session ${runId}" to resume`));
|
|
19950
20190
|
}
|
|
19951
20191
|
process.exit(1);
|
|
@@ -19956,11 +20196,14 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19956
20196
|
status: runData.status,
|
|
19957
20197
|
output: runData.output,
|
|
19958
20198
|
error: runData.error,
|
|
19959
|
-
durationMs: runData.duration_ms
|
|
20199
|
+
durationMs: runData.duration_ms,
|
|
20200
|
+
...runData.pending_node_id ? { pendingNodeId: runData.pending_node_id } : {},
|
|
20201
|
+
...runData.query ? { query: runData.query } : {},
|
|
20202
|
+
...runData.agent_session_id ? { agentSessionId: runData.agent_session_id } : {}
|
|
19960
20203
|
}));
|
|
19961
20204
|
if (runData.status === "paused") {
|
|
19962
|
-
output.log(
|
|
19963
|
-
\uD83D\uDCA1
|
|
20205
|
+
output.log(chalk71.gray(`
|
|
20206
|
+
\uD83D\uDCA1 Resume with: roy-agent workflow run ${args.identifier} --session ${runData.run_id} --input "<your answer>"`));
|
|
19964
20207
|
}
|
|
19965
20208
|
}
|
|
19966
20209
|
if (workflowSpan) {
|
|
@@ -20026,12 +20269,15 @@ var WorkflowRunCommand = {
|
|
|
20026
20269
|
alias: "s",
|
|
20027
20270
|
describe: "从已有 session 恢复运行(支持 workflow pause/interrupt 恢复;runId == sessionId,传 workflow run 的 runId 即可)",
|
|
20028
20271
|
type: "string"
|
|
20272
|
+
}).option("node-config", {
|
|
20273
|
+
describe: `Per-node runtime config overrides (Task #1974). JSON string: { "<nodeId>": { "timeout": 5000 } }. Shallow-merged into each node's effective config; input wins over nodeDef.config.`,
|
|
20274
|
+
type: "string"
|
|
20029
20275
|
}),
|
|
20030
20276
|
handler: runWorkflow
|
|
20031
20277
|
};
|
|
20032
20278
|
|
|
20033
20279
|
// src/commands/workflow/commands/stop.ts
|
|
20034
|
-
import
|
|
20280
|
+
import chalk72 from "chalk";
|
|
20035
20281
|
import { createWorkflowRunStopTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
20036
20282
|
import { wrapFunction as wrapFunction2 } from "@ai-setting/roy-agent-core";
|
|
20037
20283
|
var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
|
|
@@ -20056,7 +20302,7 @@ var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
|
|
|
20056
20302
|
output.error(result.error || `Failed to stop workflow: ${args.runId}`);
|
|
20057
20303
|
process.exit(1);
|
|
20058
20304
|
}
|
|
20059
|
-
output.log(
|
|
20305
|
+
output.log(chalk72.red(`
|
|
20060
20306
|
⏹️ Workflow stopped: ${args.runId}`));
|
|
20061
20307
|
} catch (error) {
|
|
20062
20308
|
output.error(`Failed to stop workflow: ${error}`);
|
|
@@ -20080,7 +20326,7 @@ var WorkflowStopCommand = {
|
|
|
20080
20326
|
};
|
|
20081
20327
|
|
|
20082
20328
|
// src/commands/workflow/commands/status.ts
|
|
20083
|
-
import
|
|
20329
|
+
import chalk73 from "chalk";
|
|
20084
20330
|
import { createWorkflowRunStatusTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
20085
20331
|
var WorkflowStatusCommand = {
|
|
20086
20332
|
command: "status <runId>",
|
|
@@ -20173,7 +20419,7 @@ var WorkflowStatusCommand = {
|
|
|
20173
20419
|
stopped: "⏹️"
|
|
20174
20420
|
};
|
|
20175
20421
|
const emoji = statusEmoji[status] || "❓";
|
|
20176
|
-
output.log(
|
|
20422
|
+
output.log(chalk73.bold(`
|
|
20177
20423
|
${emoji} Status: ${status.toUpperCase()}`));
|
|
20178
20424
|
}
|
|
20179
20425
|
} catch (error) {
|
|
@@ -20186,7 +20432,7 @@ ${emoji} Status: ${status.toUpperCase()}`));
|
|
|
20186
20432
|
};
|
|
20187
20433
|
|
|
20188
20434
|
// src/commands/workflow/commands/nodes.ts
|
|
20189
|
-
import
|
|
20435
|
+
import chalk74 from "chalk";
|
|
20190
20436
|
var BUILT_IN_NODES = [
|
|
20191
20437
|
{
|
|
20192
20438
|
name: "ToolNode",
|
|
@@ -20523,7 +20769,7 @@ nodes:
|
|
|
20523
20769
|
];
|
|
20524
20770
|
function renderNodeTypesTable(nodes) {
|
|
20525
20771
|
const lines = [];
|
|
20526
|
-
lines.push(
|
|
20772
|
+
lines.push(chalk74.bold(`
|
|
20527
20773
|
\uD83D\uDCE6 Built-in Node Types
|
|
20528
20774
|
`));
|
|
20529
20775
|
lines.push("┌────────────┬────────────────────┬─────────────────────────────────────────────────────────────┐");
|
|
@@ -20541,29 +20787,29 @@ function renderNodeTypesTable(nodes) {
|
|
|
20541
20787
|
}
|
|
20542
20788
|
function renderNodeDetail(node) {
|
|
20543
20789
|
const lines = [];
|
|
20544
|
-
lines.push(
|
|
20790
|
+
lines.push(chalk74.bold(`
|
|
20545
20791
|
[${node.type}] ${node.name}`));
|
|
20546
|
-
lines.push(
|
|
20792
|
+
lines.push(chalk74.dim("─".repeat(60)) + `
|
|
20547
20793
|
`);
|
|
20548
|
-
lines.push(
|
|
20794
|
+
lines.push(chalk74.bold("Description:"));
|
|
20549
20795
|
lines.push(` ${node.description}
|
|
20550
20796
|
`);
|
|
20551
|
-
lines.push(
|
|
20797
|
+
lines.push(chalk74.bold("Configuration:"));
|
|
20552
20798
|
lines.push(' type: "' + node.type + '"');
|
|
20553
20799
|
lines.push(" config:");
|
|
20554
20800
|
for (const input of node.inputs) {
|
|
20555
|
-
const required = input.required ?
|
|
20801
|
+
const required = input.required ? chalk74.red("*") : " ";
|
|
20556
20802
|
lines.push(` ${input.name} (${input.type})${required}`);
|
|
20557
20803
|
lines.push(` ${input.description}`);
|
|
20558
20804
|
}
|
|
20559
20805
|
lines.push(`
|
|
20560
|
-
${
|
|
20806
|
+
${chalk74.bold("Output:")} ${node.output}`);
|
|
20561
20807
|
if (node.example) {
|
|
20562
|
-
lines.push(
|
|
20808
|
+
lines.push(chalk74.bold(`
|
|
20563
20809
|
Example:`));
|
|
20564
|
-
lines.push(
|
|
20810
|
+
lines.push(chalk74.gray("```yaml"));
|
|
20565
20811
|
lines.push(node.example);
|
|
20566
|
-
lines.push(
|
|
20812
|
+
lines.push(chalk74.gray("```"));
|
|
20567
20813
|
}
|
|
20568
20814
|
return lines.join(`
|
|
20569
20815
|
`);
|
|
@@ -20579,16 +20825,16 @@ var WorkflowNodesCommand = {
|
|
|
20579
20825
|
const nodeType = args.type?.toLowerCase();
|
|
20580
20826
|
if (!nodeType) {
|
|
20581
20827
|
console.log(renderNodeTypesTable(BUILT_IN_NODES));
|
|
20582
|
-
console.log(
|
|
20583
|
-
Use `) +
|
|
20584
|
-
console.log(
|
|
20828
|
+
console.log(chalk74.gray(`
|
|
20829
|
+
Use `) + chalk74.cyan("roy-agent workflow nodes <type>") + chalk74.gray(" for detailed information"));
|
|
20830
|
+
console.log(chalk74.gray("Available types: ") + chalk74.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
|
|
20585
20831
|
return;
|
|
20586
20832
|
}
|
|
20587
20833
|
const node = BUILT_IN_NODES.find((n) => n.type === nodeType);
|
|
20588
20834
|
if (!node) {
|
|
20589
|
-
console.log(
|
|
20835
|
+
console.log(chalk74.red(`
|
|
20590
20836
|
❌ Unknown node type: ${nodeType}`));
|
|
20591
|
-
console.log(
|
|
20837
|
+
console.log(chalk74.gray("Available types: ") + chalk74.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
|
|
20592
20838
|
process.exit(1);
|
|
20593
20839
|
}
|
|
20594
20840
|
console.log(renderNodeDetail(node));
|
|
@@ -20596,7 +20842,7 @@ Use `) + chalk73.cyan("roy-agent workflow nodes <type>") + chalk73.gray(" for de
|
|
|
20596
20842
|
};
|
|
20597
20843
|
|
|
20598
20844
|
// src/commands/workflow/commands/validate.ts
|
|
20599
|
-
import
|
|
20845
|
+
import chalk75 from "chalk";
|
|
20600
20846
|
import { readFileSync } from "fs";
|
|
20601
20847
|
async function parseWorkflowInput(input, yamlStr) {
|
|
20602
20848
|
const parseYaml = async (content) => {
|
|
@@ -20629,25 +20875,25 @@ function renderResult(result, options) {
|
|
|
20629
20875
|
return;
|
|
20630
20876
|
}
|
|
20631
20877
|
if (result.valid) {
|
|
20632
|
-
console.log(
|
|
20878
|
+
console.log(chalk75.green(`
|
|
20633
20879
|
✅ Workflow validation PASSED
|
|
20634
20880
|
`));
|
|
20635
|
-
console.log(
|
|
20881
|
+
console.log(chalk75.bold(`Workflow: ${result.workflowName}`));
|
|
20636
20882
|
console.log(`Nodes: ${result.nodeCount}`);
|
|
20637
20883
|
console.log(`
|
|
20638
20884
|
Valid nodes:`);
|
|
20639
|
-
console.log(
|
|
20885
|
+
console.log(chalk75.green(" ✓ All nodes passed validation"));
|
|
20640
20886
|
} else {
|
|
20641
|
-
console.log(
|
|
20887
|
+
console.log(chalk75.red(`
|
|
20642
20888
|
❌ Workflow validation FAILED (${result.errors.length} errors found)
|
|
20643
20889
|
`));
|
|
20644
20890
|
result.errors.forEach((error, index) => {
|
|
20645
|
-
console.log(
|
|
20646
|
-
console.log(` ${
|
|
20647
|
-
console.log(` ${
|
|
20648
|
-
console.log(` ${
|
|
20649
|
-
console.log(` ${
|
|
20650
|
-
console.log(` ${
|
|
20891
|
+
console.log(chalk75.red(`[Error ${index + 1}/${result.errors.length}]${error.nodeId ? ` Node "${error.nodeId}"` : ""}`));
|
|
20892
|
+
console.log(` ${chalk75.bold("Type:")} ${error.type}`);
|
|
20893
|
+
console.log(` ${chalk75.bold("Description:")} ${error.description}`);
|
|
20894
|
+
console.log(` ${chalk75.bold("Expected:")} ${error.expected}`);
|
|
20895
|
+
console.log(` ${chalk75.bold("Actual:")} ${error.actual}`);
|
|
20896
|
+
console.log(` ${chalk75.green("Fix:")} ${error.fix}`);
|
|
20651
20897
|
console.log();
|
|
20652
20898
|
});
|
|
20653
20899
|
}
|
|
@@ -20672,7 +20918,7 @@ var WorkflowValidateCommand = {
|
|
|
20672
20918
|
try {
|
|
20673
20919
|
const workflow = await parseWorkflowInput(options.input, options.yaml);
|
|
20674
20920
|
if (!workflow) {
|
|
20675
|
-
console.error(
|
|
20921
|
+
console.error(chalk75.red("Failed to parse workflow input"));
|
|
20676
20922
|
process.exit(1);
|
|
20677
20923
|
}
|
|
20678
20924
|
const validator = new WorkflowValidator;
|
|
@@ -20680,7 +20926,7 @@ var WorkflowValidateCommand = {
|
|
|
20680
20926
|
renderResult(result, options);
|
|
20681
20927
|
process.exit(result.valid ? 0 : 1);
|
|
20682
20928
|
} catch (error) {
|
|
20683
|
-
console.error(
|
|
20929
|
+
console.error(chalk75.red(`
|
|
20684
20930
|
Error: ${error.message}`));
|
|
20685
20931
|
process.exit(1);
|
|
20686
20932
|
}
|
|
@@ -20688,7 +20934,7 @@ Error: ${error.message}`));
|
|
|
20688
20934
|
};
|
|
20689
20935
|
|
|
20690
20936
|
// src/commands/workflow/commands/search.ts
|
|
20691
|
-
import
|
|
20937
|
+
import chalk76 from "chalk";
|
|
20692
20938
|
import { wrapFunction as wrapFunction3 } from "@ai-setting/roy-agent-core";
|
|
20693
20939
|
var WorkflowSearchCommand = {
|
|
20694
20940
|
command: "search",
|
|
@@ -20845,22 +21091,22 @@ var _runWorkflowSearchImpl = async function(opts) {
|
|
|
20845
21091
|
metadata: {}
|
|
20846
21092
|
}));
|
|
20847
21093
|
if (renderWorkflows.length === 0) {
|
|
20848
|
-
output.log(
|
|
20849
|
-
output.log(
|
|
20850
|
-
output.log(
|
|
21094
|
+
output.log(chalk76.yellow("\uD83D\uDD0D No workflows matched the search criteria."));
|
|
21095
|
+
output.log(chalk76.gray(` keyword: ${keyword || "(none)"}`));
|
|
21096
|
+
output.log(chalk76.gray(` tags: ${tags && tags.length > 0 ? tags.join(", ") : "(none)"}`));
|
|
20851
21097
|
} else {
|
|
20852
|
-
output.log(
|
|
21098
|
+
output.log(chalk76.bold(`\uD83D\uDD0D Search results (${renderWorkflows.length}):`));
|
|
20853
21099
|
output.log(renderWorkflowList(renderWorkflows));
|
|
20854
|
-
output.log(
|
|
21100
|
+
output.log(chalk76.green(`
|
|
20855
21101
|
✅ Found ${renderWorkflows.length} workflow(s)`));
|
|
20856
21102
|
}
|
|
20857
21103
|
if (availableTags.length > 0) {
|
|
20858
21104
|
output.log("");
|
|
20859
|
-
output.log(
|
|
21105
|
+
output.log(chalk76.bold("\uD83D\uDCDA Available tags (sorted by usage_count):"));
|
|
20860
21106
|
for (const t of availableTags) {
|
|
20861
21107
|
const name = t.name ?? t.tag;
|
|
20862
21108
|
const count = t.count ?? t.usage_count;
|
|
20863
|
-
output.log(
|
|
21109
|
+
output.log(chalk76.gray(` - ${name} (${count})`));
|
|
20864
21110
|
}
|
|
20865
21111
|
}
|
|
20866
21112
|
};
|
|
@@ -20872,7 +21118,7 @@ var runWorkflowSearch = wrapFunction3(_runWorkflowSearchImpl, "workflow.cli.sear
|
|
|
20872
21118
|
|
|
20873
21119
|
// src/commands/workflow/commands/tag.ts
|
|
20874
21120
|
import { wrapFunction as wrapFunction4 } from "@ai-setting/roy-agent-core";
|
|
20875
|
-
import
|
|
21121
|
+
import chalk77 from "chalk";
|
|
20876
21122
|
var WorkflowTagListCommand = {
|
|
20877
21123
|
command: "list",
|
|
20878
21124
|
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 +21239,17 @@ var _runWorkflowTagListImpl = async function(opts) {
|
|
|
20993
21239
|
return;
|
|
20994
21240
|
}
|
|
20995
21241
|
if (result.tags.length === 0) {
|
|
20996
|
-
output.log(
|
|
20997
|
-
output.log(
|
|
21242
|
+
output.log(chalk77.yellow("\uD83C\uDFF7️ No tags in the workflow_tags table yet."));
|
|
21243
|
+
output.log(chalk77.gray(" Tags are created automatically when you run `workflow add --tags <name>`."));
|
|
20998
21244
|
return;
|
|
20999
21245
|
}
|
|
21000
|
-
output.log(
|
|
21001
|
-
output.log(
|
|
21246
|
+
output.log(chalk77.bold(`\uD83C\uDFF7️ Workflow tags (${result.total}):`));
|
|
21247
|
+
output.log(chalk77.gray(` ${padRight("NAME", 24)}${padRight("USAGE", 8)}${padRight("CREATED", 22)}`));
|
|
21002
21248
|
for (const t of result.tags) {
|
|
21003
21249
|
const line = ` ${padRight(t.name, 24)}${padRight(String(t.usage_count), 8)}${padRight(formatDate2(t.created_at), 22)}`;
|
|
21004
21250
|
output.log(line);
|
|
21005
21251
|
}
|
|
21006
|
-
output.log(
|
|
21252
|
+
output.log(chalk77.gray(`
|
|
21007
21253
|
\uD83D\uDCA1 Tip: when adding a new workflow, prefer tags from this list to ensure semantic consistency.`));
|
|
21008
21254
|
};
|
|
21009
21255
|
var _runWorkflowTagGetImpl = async function(opts) {
|
|
@@ -21030,7 +21276,7 @@ var _runWorkflowTagGetImpl = async function(opts) {
|
|
|
21030
21276
|
output.json({ error: "Tag not found", name: opts.name });
|
|
21031
21277
|
} else {
|
|
21032
21278
|
output.error(`Tag "${opts.name}" not found in the workflow_tags table.`);
|
|
21033
|
-
output.log(
|
|
21279
|
+
output.log(chalk77.gray(`Tip: run \`roy-agent workflow tag list\` to see available tags.`));
|
|
21034
21280
|
}
|
|
21035
21281
|
process.exitCode = 1;
|
|
21036
21282
|
return;
|
|
@@ -21039,10 +21285,10 @@ var _runWorkflowTagGetImpl = async function(opts) {
|
|
|
21039
21285
|
output.json(tag);
|
|
21040
21286
|
return;
|
|
21041
21287
|
}
|
|
21042
|
-
output.log(
|
|
21043
|
-
output.log(
|
|
21044
|
-
output.log(
|
|
21045
|
-
output.log(
|
|
21288
|
+
output.log(chalk77.bold(`\uD83C\uDFF7️ Tag: ${tag.name}`));
|
|
21289
|
+
output.log(chalk77.gray(` usage_count: ${tag.usage_count}`));
|
|
21290
|
+
output.log(chalk77.gray(` created_at: ${tag.created_at}`));
|
|
21291
|
+
output.log(chalk77.gray(` updated_at: ${tag.updated_at}`));
|
|
21046
21292
|
};
|
|
21047
21293
|
async function callListTags(service, options) {
|
|
21048
21294
|
if (typeof service.listTags !== "function") {
|
|
@@ -21393,7 +21639,11 @@ function readPackageInfo(packageName) {
|
|
|
21393
21639
|
join4(process.cwd(), "node_modules", packageName, "package.json"),
|
|
21394
21640
|
resolve(process.cwd(), "..", "node_modules", packageName, "package.json"),
|
|
21395
21641
|
join4(process.cwd(), ".roy", "plugins", packageName, "package.json"),
|
|
21396
|
-
join4(homedir3(), ".roy-agent", "node_modules", packageName, "package.json")
|
|
21642
|
+
join4(homedir3(), ".roy-agent", "node_modules", packageName, "package.json"),
|
|
21643
|
+
...(() => {
|
|
21644
|
+
const globalRoot = getNpmGlobalRoot();
|
|
21645
|
+
return globalRoot ? [join4(globalRoot, packageName, "package.json")] : [];
|
|
21646
|
+
})()
|
|
21397
21647
|
];
|
|
21398
21648
|
for (const pkgPath of searchPaths) {
|
|
21399
21649
|
try {
|
|
@@ -21413,6 +21663,13 @@ function readPackageInfo(packageName) {
|
|
|
21413
21663
|
console.warn(`⚠️ Could not find package.json for '${packageName}' (searched ${searchPaths.length} paths)`);
|
|
21414
21664
|
return null;
|
|
21415
21665
|
}
|
|
21666
|
+
function getNpmGlobalRoot() {
|
|
21667
|
+
const result = spawnSync("npm", ["root", "-g"], { encoding: "utf-8" });
|
|
21668
|
+
if (result.status === 0 && result.stdout) {
|
|
21669
|
+
return String(result.stdout).trim();
|
|
21670
|
+
}
|
|
21671
|
+
return null;
|
|
21672
|
+
}
|
|
21416
21673
|
function getPackageManagerCommand() {
|
|
21417
21674
|
if (existsSync3(join4(process.cwd(), "pnpm-lock.yaml"))) {
|
|
21418
21675
|
if (existsSync3(join4(process.cwd(), "pnpm-workspace.yaml"))) {
|