@ai-setting/roy-agent-cli 1.5.41 → 1.5.43
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 +1518 -552
- package/dist/index.js +1518 -552
- package/dist/roy-agent-linux-x64/bin/roy-agent +0 -0
- package/package.json +2 -2
package/dist/bin/roy-agent.js
CHANGED
|
@@ -246,7 +246,7 @@ var init_stream_output_service = __esm(() => {
|
|
|
246
246
|
};
|
|
247
247
|
});
|
|
248
248
|
|
|
249
|
-
// ../../node_modules/.
|
|
249
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/identity.js
|
|
250
250
|
var require_identity = __commonJS((exports) => {
|
|
251
251
|
var ALIAS = Symbol.for("yaml.alias");
|
|
252
252
|
var DOC = Symbol.for("yaml.document");
|
|
@@ -300,7 +300,7 @@ var require_identity = __commonJS((exports) => {
|
|
|
300
300
|
exports.isSeq = isSeq;
|
|
301
301
|
});
|
|
302
302
|
|
|
303
|
-
// ../../node_modules/.
|
|
303
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/visit.js
|
|
304
304
|
var require_visit = __commonJS((exports) => {
|
|
305
305
|
var identity = require_identity();
|
|
306
306
|
var BREAK = Symbol("break visit");
|
|
@@ -455,7 +455,7 @@ var require_visit = __commonJS((exports) => {
|
|
|
455
455
|
exports.visitAsync = visitAsync;
|
|
456
456
|
});
|
|
457
457
|
|
|
458
|
-
// ../../node_modules/.
|
|
458
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/doc/directives.js
|
|
459
459
|
var require_directives = __commonJS((exports) => {
|
|
460
460
|
var identity = require_identity();
|
|
461
461
|
var visit = require_visit();
|
|
@@ -607,7 +607,7 @@ var require_directives = __commonJS((exports) => {
|
|
|
607
607
|
exports.Directives = Directives;
|
|
608
608
|
});
|
|
609
609
|
|
|
610
|
-
// ../../node_modules/.
|
|
610
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/doc/anchors.js
|
|
611
611
|
var require_anchors = __commonJS((exports) => {
|
|
612
612
|
var identity = require_identity();
|
|
613
613
|
var visit = require_visit();
|
|
@@ -669,7 +669,7 @@ var require_anchors = __commonJS((exports) => {
|
|
|
669
669
|
exports.findNewAnchor = findNewAnchor;
|
|
670
670
|
});
|
|
671
671
|
|
|
672
|
-
// ../../node_modules/.
|
|
672
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/doc/applyReviver.js
|
|
673
673
|
var require_applyReviver = __commonJS((exports) => {
|
|
674
674
|
function applyReviver(reviver, obj, key, val) {
|
|
675
675
|
if (val && typeof val === "object") {
|
|
@@ -716,7 +716,7 @@ var require_applyReviver = __commonJS((exports) => {
|
|
|
716
716
|
exports.applyReviver = applyReviver;
|
|
717
717
|
});
|
|
718
718
|
|
|
719
|
-
// ../../node_modules/.
|
|
719
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/toJS.js
|
|
720
720
|
var require_toJS = __commonJS((exports) => {
|
|
721
721
|
var identity = require_identity();
|
|
722
722
|
function toJS(value, arg, ctx) {
|
|
@@ -743,7 +743,7 @@ var require_toJS = __commonJS((exports) => {
|
|
|
743
743
|
exports.toJS = toJS;
|
|
744
744
|
});
|
|
745
745
|
|
|
746
|
-
// ../../node_modules/.
|
|
746
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/Node.js
|
|
747
747
|
var require_Node = __commonJS((exports) => {
|
|
748
748
|
var applyReviver = require_applyReviver();
|
|
749
749
|
var identity = require_identity();
|
|
@@ -780,7 +780,7 @@ var require_Node = __commonJS((exports) => {
|
|
|
780
780
|
exports.NodeBase = NodeBase;
|
|
781
781
|
});
|
|
782
782
|
|
|
783
|
-
// ../../node_modules/.
|
|
783
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/Alias.js
|
|
784
784
|
var require_Alias = __commonJS((exports) => {
|
|
785
785
|
var anchors = require_anchors();
|
|
786
786
|
var visit = require_visit();
|
|
@@ -890,7 +890,7 @@ var require_Alias = __commonJS((exports) => {
|
|
|
890
890
|
exports.Alias = Alias;
|
|
891
891
|
});
|
|
892
892
|
|
|
893
|
-
// ../../node_modules/.
|
|
893
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/Scalar.js
|
|
894
894
|
var require_Scalar = __commonJS((exports) => {
|
|
895
895
|
var identity = require_identity();
|
|
896
896
|
var Node = require_Node();
|
|
@@ -918,7 +918,7 @@ var require_Scalar = __commonJS((exports) => {
|
|
|
918
918
|
exports.isScalarValue = isScalarValue;
|
|
919
919
|
});
|
|
920
920
|
|
|
921
|
-
// ../../node_modules/.
|
|
921
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/doc/createNode.js
|
|
922
922
|
var require_createNode = __commonJS((exports) => {
|
|
923
923
|
var Alias = require_Alias();
|
|
924
924
|
var identity = require_identity();
|
|
@@ -990,7 +990,7 @@ var require_createNode = __commonJS((exports) => {
|
|
|
990
990
|
exports.createNode = createNode;
|
|
991
991
|
});
|
|
992
992
|
|
|
993
|
-
// ../../node_modules/.
|
|
993
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/Collection.js
|
|
994
994
|
var require_Collection = __commonJS((exports) => {
|
|
995
995
|
var createNode = require_createNode();
|
|
996
996
|
var identity = require_identity();
|
|
@@ -1105,7 +1105,7 @@ var require_Collection = __commonJS((exports) => {
|
|
|
1105
1105
|
exports.isEmptyPath = isEmptyPath;
|
|
1106
1106
|
});
|
|
1107
1107
|
|
|
1108
|
-
// ../../node_modules/.
|
|
1108
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyComment.js
|
|
1109
1109
|
var require_stringifyComment = __commonJS((exports) => {
|
|
1110
1110
|
var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
|
|
1111
1111
|
function indentComment(comment, indent) {
|
|
@@ -1122,7 +1122,7 @@ var require_stringifyComment = __commonJS((exports) => {
|
|
|
1122
1122
|
exports.stringifyComment = stringifyComment;
|
|
1123
1123
|
});
|
|
1124
1124
|
|
|
1125
|
-
// ../../node_modules/.
|
|
1125
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/foldFlowLines.js
|
|
1126
1126
|
var require_foldFlowLines = __commonJS((exports) => {
|
|
1127
1127
|
var FOLD_FLOW = "flow";
|
|
1128
1128
|
var FOLD_BLOCK = "block";
|
|
@@ -1259,7 +1259,7 @@ ${indent}${text.slice(fold + 1, end2)}`;
|
|
|
1259
1259
|
exports.foldFlowLines = foldFlowLines;
|
|
1260
1260
|
});
|
|
1261
1261
|
|
|
1262
|
-
// ../../node_modules/.
|
|
1262
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyString.js
|
|
1263
1263
|
var require_stringifyString = __commonJS((exports) => {
|
|
1264
1264
|
var Scalar = require_Scalar();
|
|
1265
1265
|
var foldFlowLines = require_foldFlowLines();
|
|
@@ -1557,7 +1557,7 @@ ${indent}`);
|
|
|
1557
1557
|
exports.stringifyString = stringifyString;
|
|
1558
1558
|
});
|
|
1559
1559
|
|
|
1560
|
-
// ../../node_modules/.
|
|
1560
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringify.js
|
|
1561
1561
|
var require_stringify = __commonJS((exports) => {
|
|
1562
1562
|
var anchors = require_anchors();
|
|
1563
1563
|
var identity = require_identity();
|
|
@@ -1678,7 +1678,7 @@ ${ctx.indent}${str}`;
|
|
|
1678
1678
|
exports.stringify = stringify;
|
|
1679
1679
|
});
|
|
1680
1680
|
|
|
1681
|
-
// ../../node_modules/.
|
|
1681
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyPair.js
|
|
1682
1682
|
var require_stringifyPair = __commonJS((exports) => {
|
|
1683
1683
|
var identity = require_identity();
|
|
1684
1684
|
var Scalar = require_Scalar();
|
|
@@ -1814,7 +1814,7 @@ ${ctx.indent}`;
|
|
|
1814
1814
|
exports.stringifyPair = stringifyPair;
|
|
1815
1815
|
});
|
|
1816
1816
|
|
|
1817
|
-
// ../../node_modules/.
|
|
1817
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/log.js
|
|
1818
1818
|
var require_log = __commonJS((exports) => {
|
|
1819
1819
|
var node_process = __require("process");
|
|
1820
1820
|
function debug(logLevel, ...messages) {
|
|
@@ -1833,7 +1833,7 @@ var require_log = __commonJS((exports) => {
|
|
|
1833
1833
|
exports.warn = warn;
|
|
1834
1834
|
});
|
|
1835
1835
|
|
|
1836
|
-
// ../../node_modules/.
|
|
1836
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/merge.js
|
|
1837
1837
|
var require_merge = __commonJS((exports) => {
|
|
1838
1838
|
var identity = require_identity();
|
|
1839
1839
|
var Scalar = require_Scalar();
|
|
@@ -1890,7 +1890,7 @@ var require_merge = __commonJS((exports) => {
|
|
|
1890
1890
|
exports.merge = merge;
|
|
1891
1891
|
});
|
|
1892
1892
|
|
|
1893
|
-
// ../../node_modules/.
|
|
1893
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/addPairToJSMap.js
|
|
1894
1894
|
var require_addPairToJSMap = __commonJS((exports) => {
|
|
1895
1895
|
var log = require_log();
|
|
1896
1896
|
var merge = require_merge();
|
|
@@ -1951,7 +1951,7 @@ var require_addPairToJSMap = __commonJS((exports) => {
|
|
|
1951
1951
|
exports.addPairToJSMap = addPairToJSMap;
|
|
1952
1952
|
});
|
|
1953
1953
|
|
|
1954
|
-
// ../../node_modules/.
|
|
1954
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/Pair.js
|
|
1955
1955
|
var require_Pair = __commonJS((exports) => {
|
|
1956
1956
|
var createNode = require_createNode();
|
|
1957
1957
|
var stringifyPair = require_stringifyPair();
|
|
@@ -1989,7 +1989,7 @@ var require_Pair = __commonJS((exports) => {
|
|
|
1989
1989
|
exports.createPair = createPair;
|
|
1990
1990
|
});
|
|
1991
1991
|
|
|
1992
|
-
// ../../node_modules/.
|
|
1992
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
1993
1993
|
var require_stringifyCollection = __commonJS((exports) => {
|
|
1994
1994
|
var identity = require_identity();
|
|
1995
1995
|
var stringify = require_stringify();
|
|
@@ -2141,7 +2141,7 @@ ${indent}${end}`;
|
|
|
2141
2141
|
exports.stringifyCollection = stringifyCollection;
|
|
2142
2142
|
});
|
|
2143
2143
|
|
|
2144
|
-
// ../../node_modules/.
|
|
2144
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/YAMLMap.js
|
|
2145
2145
|
var require_YAMLMap = __commonJS((exports) => {
|
|
2146
2146
|
var stringifyCollection = require_stringifyCollection();
|
|
2147
2147
|
var addPairToJSMap = require_addPairToJSMap();
|
|
@@ -2268,7 +2268,7 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
2268
2268
|
exports.findPair = findPair;
|
|
2269
2269
|
});
|
|
2270
2270
|
|
|
2271
|
-
// ../../node_modules/.
|
|
2271
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/common/map.js
|
|
2272
2272
|
var require_map = __commonJS((exports) => {
|
|
2273
2273
|
var identity = require_identity();
|
|
2274
2274
|
var YAMLMap = require_YAMLMap();
|
|
@@ -2287,7 +2287,7 @@ var require_map = __commonJS((exports) => {
|
|
|
2287
2287
|
exports.map = map;
|
|
2288
2288
|
});
|
|
2289
2289
|
|
|
2290
|
-
// ../../node_modules/.
|
|
2290
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
2291
2291
|
var require_YAMLSeq = __commonJS((exports) => {
|
|
2292
2292
|
var createNode = require_createNode();
|
|
2293
2293
|
var stringifyCollection = require_stringifyCollection();
|
|
@@ -2380,7 +2380,7 @@ var require_YAMLSeq = __commonJS((exports) => {
|
|
|
2380
2380
|
exports.YAMLSeq = YAMLSeq;
|
|
2381
2381
|
});
|
|
2382
2382
|
|
|
2383
|
-
// ../../node_modules/.
|
|
2383
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/common/seq.js
|
|
2384
2384
|
var require_seq = __commonJS((exports) => {
|
|
2385
2385
|
var identity = require_identity();
|
|
2386
2386
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -2399,7 +2399,7 @@ var require_seq = __commonJS((exports) => {
|
|
|
2399
2399
|
exports.seq = seq;
|
|
2400
2400
|
});
|
|
2401
2401
|
|
|
2402
|
-
// ../../node_modules/.
|
|
2402
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/common/string.js
|
|
2403
2403
|
var require_string = __commonJS((exports) => {
|
|
2404
2404
|
var stringifyString = require_stringifyString();
|
|
2405
2405
|
var string = {
|
|
@@ -2415,7 +2415,7 @@ var require_string = __commonJS((exports) => {
|
|
|
2415
2415
|
exports.string = string;
|
|
2416
2416
|
});
|
|
2417
2417
|
|
|
2418
|
-
// ../../node_modules/.
|
|
2418
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/common/null.js
|
|
2419
2419
|
var require_null = __commonJS((exports) => {
|
|
2420
2420
|
var Scalar = require_Scalar();
|
|
2421
2421
|
var nullTag = {
|
|
@@ -2430,7 +2430,7 @@ var require_null = __commonJS((exports) => {
|
|
|
2430
2430
|
exports.nullTag = nullTag;
|
|
2431
2431
|
});
|
|
2432
2432
|
|
|
2433
|
-
// ../../node_modules/.
|
|
2433
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/core/bool.js
|
|
2434
2434
|
var require_bool = __commonJS((exports) => {
|
|
2435
2435
|
var Scalar = require_Scalar();
|
|
2436
2436
|
var boolTag = {
|
|
@@ -2451,7 +2451,7 @@ var require_bool = __commonJS((exports) => {
|
|
|
2451
2451
|
exports.boolTag = boolTag;
|
|
2452
2452
|
});
|
|
2453
2453
|
|
|
2454
|
-
// ../../node_modules/.
|
|
2454
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyNumber.js
|
|
2455
2455
|
var require_stringifyNumber = __commonJS((exports) => {
|
|
2456
2456
|
function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
2457
2457
|
if (typeof value === "bigint")
|
|
@@ -2475,7 +2475,7 @@ var require_stringifyNumber = __commonJS((exports) => {
|
|
|
2475
2475
|
exports.stringifyNumber = stringifyNumber;
|
|
2476
2476
|
});
|
|
2477
2477
|
|
|
2478
|
-
// ../../node_modules/.
|
|
2478
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/core/float.js
|
|
2479
2479
|
var require_float = __commonJS((exports) => {
|
|
2480
2480
|
var Scalar = require_Scalar();
|
|
2481
2481
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -2518,7 +2518,7 @@ var require_float = __commonJS((exports) => {
|
|
|
2518
2518
|
exports.floatNaN = floatNaN;
|
|
2519
2519
|
});
|
|
2520
2520
|
|
|
2521
|
-
// ../../node_modules/.
|
|
2521
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/core/int.js
|
|
2522
2522
|
var require_int = __commonJS((exports) => {
|
|
2523
2523
|
var stringifyNumber = require_stringifyNumber();
|
|
2524
2524
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -2560,7 +2560,7 @@ var require_int = __commonJS((exports) => {
|
|
|
2560
2560
|
exports.intOct = intOct;
|
|
2561
2561
|
});
|
|
2562
2562
|
|
|
2563
|
-
// ../../node_modules/.
|
|
2563
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/core/schema.js
|
|
2564
2564
|
var require_schema = __commonJS((exports) => {
|
|
2565
2565
|
var map = require_map();
|
|
2566
2566
|
var _null = require_null();
|
|
@@ -2585,7 +2585,7 @@ var require_schema = __commonJS((exports) => {
|
|
|
2585
2585
|
exports.schema = schema;
|
|
2586
2586
|
});
|
|
2587
2587
|
|
|
2588
|
-
// ../../node_modules/.
|
|
2588
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/json/schema.js
|
|
2589
2589
|
var require_schema2 = __commonJS((exports) => {
|
|
2590
2590
|
var Scalar = require_Scalar();
|
|
2591
2591
|
var map = require_map();
|
|
@@ -2649,7 +2649,7 @@ var require_schema2 = __commonJS((exports) => {
|
|
|
2649
2649
|
exports.schema = schema;
|
|
2650
2650
|
});
|
|
2651
2651
|
|
|
2652
|
-
// ../../node_modules/.
|
|
2652
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
2653
2653
|
var require_binary = __commonJS((exports) => {
|
|
2654
2654
|
var node_buffer = __require("buffer");
|
|
2655
2655
|
var Scalar = require_Scalar();
|
|
@@ -2704,7 +2704,7 @@ var require_binary = __commonJS((exports) => {
|
|
|
2704
2704
|
exports.binary = binary;
|
|
2705
2705
|
});
|
|
2706
2706
|
|
|
2707
|
-
// ../../node_modules/.
|
|
2707
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
|
|
2708
2708
|
var require_pairs = __commonJS((exports) => {
|
|
2709
2709
|
var identity = require_identity();
|
|
2710
2710
|
var Pair = require_Pair();
|
|
@@ -2779,7 +2779,7 @@ ${cn.comment}` : item.comment;
|
|
|
2779
2779
|
exports.resolvePairs = resolvePairs;
|
|
2780
2780
|
});
|
|
2781
2781
|
|
|
2782
|
-
// ../../node_modules/.
|
|
2782
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/omap.js
|
|
2783
2783
|
var require_omap = __commonJS((exports) => {
|
|
2784
2784
|
var identity = require_identity();
|
|
2785
2785
|
var toJS = require_toJS();
|
|
@@ -2851,7 +2851,7 @@ var require_omap = __commonJS((exports) => {
|
|
|
2851
2851
|
exports.omap = omap;
|
|
2852
2852
|
});
|
|
2853
2853
|
|
|
2854
|
-
// ../../node_modules/.
|
|
2854
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
2855
2855
|
var require_bool2 = __commonJS((exports) => {
|
|
2856
2856
|
var Scalar = require_Scalar();
|
|
2857
2857
|
function boolStringify({ value, source }, ctx) {
|
|
@@ -2880,7 +2880,7 @@ var require_bool2 = __commonJS((exports) => {
|
|
|
2880
2880
|
exports.trueTag = trueTag;
|
|
2881
2881
|
});
|
|
2882
2882
|
|
|
2883
|
-
// ../../node_modules/.
|
|
2883
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/float.js
|
|
2884
2884
|
var require_float2 = __commonJS((exports) => {
|
|
2885
2885
|
var Scalar = require_Scalar();
|
|
2886
2886
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -2926,7 +2926,7 @@ var require_float2 = __commonJS((exports) => {
|
|
|
2926
2926
|
exports.floatNaN = floatNaN;
|
|
2927
2927
|
});
|
|
2928
2928
|
|
|
2929
|
-
// ../../node_modules/.
|
|
2929
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/int.js
|
|
2930
2930
|
var require_int2 = __commonJS((exports) => {
|
|
2931
2931
|
var stringifyNumber = require_stringifyNumber();
|
|
2932
2932
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -3002,7 +3002,7 @@ var require_int2 = __commonJS((exports) => {
|
|
|
3002
3002
|
exports.intOct = intOct;
|
|
3003
3003
|
});
|
|
3004
3004
|
|
|
3005
|
-
// ../../node_modules/.
|
|
3005
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/set.js
|
|
3006
3006
|
var require_set = __commonJS((exports) => {
|
|
3007
3007
|
var identity = require_identity();
|
|
3008
3008
|
var Pair = require_Pair();
|
|
@@ -3085,7 +3085,7 @@ var require_set = __commonJS((exports) => {
|
|
|
3085
3085
|
exports.set = set;
|
|
3086
3086
|
});
|
|
3087
3087
|
|
|
3088
|
-
// ../../node_modules/.
|
|
3088
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
|
|
3089
3089
|
var require_timestamp = __commonJS((exports) => {
|
|
3090
3090
|
var stringifyNumber = require_stringifyNumber();
|
|
3091
3091
|
function parseSexagesimal(str, asBigInt) {
|
|
@@ -3167,7 +3167,7 @@ var require_timestamp = __commonJS((exports) => {
|
|
|
3167
3167
|
exports.timestamp = timestamp;
|
|
3168
3168
|
});
|
|
3169
3169
|
|
|
3170
|
-
// ../../node_modules/.
|
|
3170
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
3171
3171
|
var require_schema3 = __commonJS((exports) => {
|
|
3172
3172
|
var map = require_map();
|
|
3173
3173
|
var _null = require_null();
|
|
@@ -3208,7 +3208,7 @@ var require_schema3 = __commonJS((exports) => {
|
|
|
3208
3208
|
exports.schema = schema;
|
|
3209
3209
|
});
|
|
3210
3210
|
|
|
3211
|
-
// ../../node_modules/.
|
|
3211
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/tags.js
|
|
3212
3212
|
var require_tags = __commonJS((exports) => {
|
|
3213
3213
|
var map = require_map();
|
|
3214
3214
|
var _null = require_null();
|
|
@@ -3299,7 +3299,7 @@ var require_tags = __commonJS((exports) => {
|
|
|
3299
3299
|
exports.getTags = getTags;
|
|
3300
3300
|
});
|
|
3301
3301
|
|
|
3302
|
-
// ../../node_modules/.
|
|
3302
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/Schema.js
|
|
3303
3303
|
var require_Schema = __commonJS((exports) => {
|
|
3304
3304
|
var identity = require_identity();
|
|
3305
3305
|
var map = require_map();
|
|
@@ -3329,7 +3329,7 @@ var require_Schema = __commonJS((exports) => {
|
|
|
3329
3329
|
exports.Schema = Schema;
|
|
3330
3330
|
});
|
|
3331
3331
|
|
|
3332
|
-
// ../../node_modules/.
|
|
3332
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
3333
3333
|
var require_stringifyDocument = __commonJS((exports) => {
|
|
3334
3334
|
var identity = require_identity();
|
|
3335
3335
|
var stringify = require_stringify();
|
|
@@ -3409,7 +3409,7 @@ var require_stringifyDocument = __commonJS((exports) => {
|
|
|
3409
3409
|
exports.stringifyDocument = stringifyDocument;
|
|
3410
3410
|
});
|
|
3411
3411
|
|
|
3412
|
-
// ../../node_modules/.
|
|
3412
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/doc/Document.js
|
|
3413
3413
|
var require_Document = __commonJS((exports) => {
|
|
3414
3414
|
var Alias = require_Alias();
|
|
3415
3415
|
var Collection = require_Collection();
|
|
@@ -3644,7 +3644,7 @@ var require_Document = __commonJS((exports) => {
|
|
|
3644
3644
|
exports.Document = Document;
|
|
3645
3645
|
});
|
|
3646
3646
|
|
|
3647
|
-
// ../../node_modules/.
|
|
3647
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/errors.js
|
|
3648
3648
|
var require_errors = __commonJS((exports) => {
|
|
3649
3649
|
class YAMLError extends Error {
|
|
3650
3650
|
constructor(name, pos, code, message) {
|
|
@@ -3709,7 +3709,7 @@ ${pointer}
|
|
|
3709
3709
|
exports.prettifyError = prettifyError;
|
|
3710
3710
|
});
|
|
3711
3711
|
|
|
3712
|
-
// ../../node_modules/.
|
|
3712
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-props.js
|
|
3713
3713
|
var require_resolve_props = __commonJS((exports) => {
|
|
3714
3714
|
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
|
|
3715
3715
|
let spaceBefore = false;
|
|
@@ -3839,7 +3839,7 @@ var require_resolve_props = __commonJS((exports) => {
|
|
|
3839
3839
|
exports.resolveProps = resolveProps;
|
|
3840
3840
|
});
|
|
3841
3841
|
|
|
3842
|
-
// ../../node_modules/.
|
|
3842
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/util-contains-newline.js
|
|
3843
3843
|
var require_util_contains_newline = __commonJS((exports) => {
|
|
3844
3844
|
function containsNewline(key) {
|
|
3845
3845
|
if (!key)
|
|
@@ -3879,7 +3879,7 @@ var require_util_contains_newline = __commonJS((exports) => {
|
|
|
3879
3879
|
exports.containsNewline = containsNewline;
|
|
3880
3880
|
});
|
|
3881
3881
|
|
|
3882
|
-
// ../../node_modules/.
|
|
3882
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/util-flow-indent-check.js
|
|
3883
3883
|
var require_util_flow_indent_check = __commonJS((exports) => {
|
|
3884
3884
|
var utilContainsNewline = require_util_contains_newline();
|
|
3885
3885
|
function flowIndentCheck(indent, fc, onError) {
|
|
@@ -3894,7 +3894,7 @@ var require_util_flow_indent_check = __commonJS((exports) => {
|
|
|
3894
3894
|
exports.flowIndentCheck = flowIndentCheck;
|
|
3895
3895
|
});
|
|
3896
3896
|
|
|
3897
|
-
// ../../node_modules/.
|
|
3897
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/util-map-includes.js
|
|
3898
3898
|
var require_util_map_includes = __commonJS((exports) => {
|
|
3899
3899
|
var identity = require_identity();
|
|
3900
3900
|
function mapIncludes(ctx, items, search) {
|
|
@@ -3907,7 +3907,7 @@ var require_util_map_includes = __commonJS((exports) => {
|
|
|
3907
3907
|
exports.mapIncludes = mapIncludes;
|
|
3908
3908
|
});
|
|
3909
3909
|
|
|
3910
|
-
// ../../node_modules/.
|
|
3910
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-block-map.js
|
|
3911
3911
|
var require_resolve_block_map = __commonJS((exports) => {
|
|
3912
3912
|
var Pair = require_Pair();
|
|
3913
3913
|
var YAMLMap = require_YAMLMap();
|
|
@@ -4014,7 +4014,7 @@ var require_resolve_block_map = __commonJS((exports) => {
|
|
|
4014
4014
|
exports.resolveBlockMap = resolveBlockMap;
|
|
4015
4015
|
});
|
|
4016
4016
|
|
|
4017
|
-
// ../../node_modules/.
|
|
4017
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-block-seq.js
|
|
4018
4018
|
var require_resolve_block_seq = __commonJS((exports) => {
|
|
4019
4019
|
var YAMLSeq = require_YAMLSeq();
|
|
4020
4020
|
var resolveProps = require_resolve_props();
|
|
@@ -4062,7 +4062,7 @@ var require_resolve_block_seq = __commonJS((exports) => {
|
|
|
4062
4062
|
exports.resolveBlockSeq = resolveBlockSeq;
|
|
4063
4063
|
});
|
|
4064
4064
|
|
|
4065
|
-
// ../../node_modules/.
|
|
4065
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-end.js
|
|
4066
4066
|
var require_resolve_end = __commonJS((exports) => {
|
|
4067
4067
|
function resolveEnd(end, offset, reqSpace, onError) {
|
|
4068
4068
|
let comment = "";
|
|
@@ -4102,7 +4102,7 @@ var require_resolve_end = __commonJS((exports) => {
|
|
|
4102
4102
|
exports.resolveEnd = resolveEnd;
|
|
4103
4103
|
});
|
|
4104
4104
|
|
|
4105
|
-
// ../../node_modules/.
|
|
4105
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-flow-collection.js
|
|
4106
4106
|
var require_resolve_flow_collection = __commonJS((exports) => {
|
|
4107
4107
|
var identity = require_identity();
|
|
4108
4108
|
var Pair = require_Pair();
|
|
@@ -4293,7 +4293,7 @@ var require_resolve_flow_collection = __commonJS((exports) => {
|
|
|
4293
4293
|
exports.resolveFlowCollection = resolveFlowCollection;
|
|
4294
4294
|
});
|
|
4295
4295
|
|
|
4296
|
-
// ../../node_modules/.
|
|
4296
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/compose-collection.js
|
|
4297
4297
|
var require_compose_collection = __commonJS((exports) => {
|
|
4298
4298
|
var identity = require_identity();
|
|
4299
4299
|
var Scalar = require_Scalar();
|
|
@@ -4355,7 +4355,7 @@ var require_compose_collection = __commonJS((exports) => {
|
|
|
4355
4355
|
exports.composeCollection = composeCollection;
|
|
4356
4356
|
});
|
|
4357
4357
|
|
|
4358
|
-
// ../../node_modules/.
|
|
4358
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-block-scalar.js
|
|
4359
4359
|
var require_resolve_block_scalar = __commonJS((exports) => {
|
|
4360
4360
|
var Scalar = require_Scalar();
|
|
4361
4361
|
function resolveBlockScalar(ctx, scalar, onError) {
|
|
@@ -4548,7 +4548,7 @@ var require_resolve_block_scalar = __commonJS((exports) => {
|
|
|
4548
4548
|
exports.resolveBlockScalar = resolveBlockScalar;
|
|
4549
4549
|
});
|
|
4550
4550
|
|
|
4551
|
-
// ../../node_modules/.
|
|
4551
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-flow-scalar.js
|
|
4552
4552
|
var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
4553
4553
|
var Scalar = require_Scalar();
|
|
4554
4554
|
var resolveEnd = require_resolve_end();
|
|
@@ -4765,7 +4765,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
4765
4765
|
exports.resolveFlowScalar = resolveFlowScalar;
|
|
4766
4766
|
});
|
|
4767
4767
|
|
|
4768
|
-
// ../../node_modules/.
|
|
4768
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/compose-scalar.js
|
|
4769
4769
|
var require_compose_scalar = __commonJS((exports) => {
|
|
4770
4770
|
var identity = require_identity();
|
|
4771
4771
|
var Scalar = require_Scalar();
|
|
@@ -4843,7 +4843,7 @@ var require_compose_scalar = __commonJS((exports) => {
|
|
|
4843
4843
|
exports.composeScalar = composeScalar;
|
|
4844
4844
|
});
|
|
4845
4845
|
|
|
4846
|
-
// ../../node_modules/.
|
|
4846
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/util-empty-scalar-position.js
|
|
4847
4847
|
var require_util_empty_scalar_position = __commonJS((exports) => {
|
|
4848
4848
|
function emptyScalarPosition(offset, before, pos) {
|
|
4849
4849
|
if (before) {
|
|
@@ -4870,7 +4870,7 @@ var require_util_empty_scalar_position = __commonJS((exports) => {
|
|
|
4870
4870
|
exports.emptyScalarPosition = emptyScalarPosition;
|
|
4871
4871
|
});
|
|
4872
4872
|
|
|
4873
|
-
// ../../node_modules/.
|
|
4873
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/compose-node.js
|
|
4874
4874
|
var require_compose_node = __commonJS((exports) => {
|
|
4875
4875
|
var Alias = require_Alias();
|
|
4876
4876
|
var identity = require_identity();
|
|
@@ -4973,7 +4973,7 @@ var require_compose_node = __commonJS((exports) => {
|
|
|
4973
4973
|
exports.composeNode = composeNode;
|
|
4974
4974
|
});
|
|
4975
4975
|
|
|
4976
|
-
// ../../node_modules/.
|
|
4976
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/compose-doc.js
|
|
4977
4977
|
var require_compose_doc = __commonJS((exports) => {
|
|
4978
4978
|
var Document = require_Document();
|
|
4979
4979
|
var composeNode = require_compose_node();
|
|
@@ -5013,7 +5013,7 @@ var require_compose_doc = __commonJS((exports) => {
|
|
|
5013
5013
|
exports.composeDoc = composeDoc;
|
|
5014
5014
|
});
|
|
5015
5015
|
|
|
5016
|
-
// ../../node_modules/.
|
|
5016
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/composer.js
|
|
5017
5017
|
var require_composer = __commonJS((exports) => {
|
|
5018
5018
|
var node_process = __require("process");
|
|
5019
5019
|
var directives = require_directives();
|
|
@@ -5099,8 +5099,10 @@ ${cb}` : comment;
|
|
|
5099
5099
|
}
|
|
5100
5100
|
}
|
|
5101
5101
|
if (afterDoc) {
|
|
5102
|
-
|
|
5103
|
-
|
|
5102
|
+
for (let i = 0;i < this.errors.length; ++i)
|
|
5103
|
+
doc.errors.push(this.errors[i]);
|
|
5104
|
+
for (let i = 0;i < this.warnings.length; ++i)
|
|
5105
|
+
doc.warnings.push(this.warnings[i]);
|
|
5104
5106
|
} else {
|
|
5105
5107
|
doc.errors = this.errors;
|
|
5106
5108
|
doc.warnings = this.warnings;
|
|
@@ -5202,7 +5204,7 @@ ${end.comment}` : end.comment;
|
|
|
5202
5204
|
exports.Composer = Composer;
|
|
5203
5205
|
});
|
|
5204
5206
|
|
|
5205
|
-
// ../../node_modules/.
|
|
5207
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/cst-scalar.js
|
|
5206
5208
|
var require_cst_scalar = __commonJS((exports) => {
|
|
5207
5209
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
5208
5210
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
@@ -5392,7 +5394,7 @@ var require_cst_scalar = __commonJS((exports) => {
|
|
|
5392
5394
|
exports.setScalarValue = setScalarValue;
|
|
5393
5395
|
});
|
|
5394
5396
|
|
|
5395
|
-
// ../../node_modules/.
|
|
5397
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/cst-stringify.js
|
|
5396
5398
|
var require_cst_stringify = __commonJS((exports) => {
|
|
5397
5399
|
var stringify = (cst) => ("type" in cst) ? stringifyToken(cst) : stringifyItem(cst);
|
|
5398
5400
|
function stringifyToken(token) {
|
|
@@ -5450,7 +5452,7 @@ var require_cst_stringify = __commonJS((exports) => {
|
|
|
5450
5452
|
exports.stringify = stringify;
|
|
5451
5453
|
});
|
|
5452
5454
|
|
|
5453
|
-
// ../../node_modules/.
|
|
5455
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/cst-visit.js
|
|
5454
5456
|
var require_cst_visit = __commonJS((exports) => {
|
|
5455
5457
|
var BREAK = Symbol("break visit");
|
|
5456
5458
|
var SKIP = Symbol("skip children");
|
|
@@ -5509,7 +5511,7 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
5509
5511
|
exports.visit = visit;
|
|
5510
5512
|
});
|
|
5511
5513
|
|
|
5512
|
-
// ../../node_modules/.
|
|
5514
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/cst.js
|
|
5513
5515
|
var require_cst = __commonJS((exports) => {
|
|
5514
5516
|
var cstScalar = require_cst_scalar();
|
|
5515
5517
|
var cstStringify = require_cst_stringify();
|
|
@@ -5610,7 +5612,7 @@ var require_cst = __commonJS((exports) => {
|
|
|
5610
5612
|
exports.tokenType = tokenType;
|
|
5611
5613
|
});
|
|
5612
5614
|
|
|
5613
|
-
// ../../node_modules/.
|
|
5615
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/lexer.js
|
|
5614
5616
|
var require_lexer = __commonJS((exports) => {
|
|
5615
5617
|
var cst = require_cst();
|
|
5616
5618
|
function isEmpty(ch) {
|
|
@@ -5812,7 +5814,7 @@ var require_lexer = __commonJS((exports) => {
|
|
|
5812
5814
|
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
|
|
5813
5815
|
this.indentNext = this.indentValue + 1;
|
|
5814
5816
|
this.indentValue += n;
|
|
5815
|
-
return
|
|
5817
|
+
return "block-start";
|
|
5816
5818
|
}
|
|
5817
5819
|
return "doc";
|
|
5818
5820
|
}
|
|
@@ -6119,26 +6121,37 @@ var require_lexer = __commonJS((exports) => {
|
|
|
6119
6121
|
return 0;
|
|
6120
6122
|
}
|
|
6121
6123
|
*pushIndicators() {
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6124
|
+
let n = 0;
|
|
6125
|
+
loop:
|
|
6126
|
+
while (true) {
|
|
6127
|
+
switch (this.charAt(0)) {
|
|
6128
|
+
case "!":
|
|
6129
|
+
n += yield* this.pushTag();
|
|
6130
|
+
n += yield* this.pushSpaces(true);
|
|
6131
|
+
continue loop;
|
|
6132
|
+
case "&":
|
|
6133
|
+
n += yield* this.pushUntil(isNotAnchorChar);
|
|
6134
|
+
n += yield* this.pushSpaces(true);
|
|
6135
|
+
continue loop;
|
|
6136
|
+
case "-":
|
|
6137
|
+
case "?":
|
|
6138
|
+
case ":": {
|
|
6139
|
+
const inFlow = this.flowLevel > 0;
|
|
6140
|
+
const ch1 = this.charAt(1);
|
|
6141
|
+
if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
|
|
6142
|
+
if (!inFlow)
|
|
6143
|
+
this.indentNext = this.indentValue + 1;
|
|
6144
|
+
else if (this.flowKey)
|
|
6145
|
+
this.flowKey = false;
|
|
6146
|
+
n += yield* this.pushCount(1);
|
|
6147
|
+
n += yield* this.pushSpaces(true);
|
|
6148
|
+
continue loop;
|
|
6149
|
+
}
|
|
6150
|
+
}
|
|
6138
6151
|
}
|
|
6152
|
+
break loop;
|
|
6139
6153
|
}
|
|
6140
|
-
|
|
6141
|
-
return 0;
|
|
6154
|
+
return n;
|
|
6142
6155
|
}
|
|
6143
6156
|
*pushTag() {
|
|
6144
6157
|
if (this.charAt(1) === "<") {
|
|
@@ -6196,7 +6209,7 @@ var require_lexer = __commonJS((exports) => {
|
|
|
6196
6209
|
exports.Lexer = Lexer;
|
|
6197
6210
|
});
|
|
6198
6211
|
|
|
6199
|
-
// ../../node_modules/.
|
|
6212
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/line-counter.js
|
|
6200
6213
|
var require_line_counter = __commonJS((exports) => {
|
|
6201
6214
|
class LineCounter {
|
|
6202
6215
|
constructor() {
|
|
@@ -6224,7 +6237,7 @@ var require_line_counter = __commonJS((exports) => {
|
|
|
6224
6237
|
exports.LineCounter = LineCounter;
|
|
6225
6238
|
});
|
|
6226
6239
|
|
|
6227
|
-
// ../../node_modules/.
|
|
6240
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/parser.js
|
|
6228
6241
|
var require_parser = __commonJS((exports) => {
|
|
6229
6242
|
var node_process = __require("process");
|
|
6230
6243
|
var cst = require_cst();
|
|
@@ -6292,6 +6305,13 @@ var require_parser = __commonJS((exports) => {
|
|
|
6292
6305
|
while (prev[++i]?.type === "space") {}
|
|
6293
6306
|
return prev.splice(i, prev.length);
|
|
6294
6307
|
}
|
|
6308
|
+
function arrayPushArray(target, source) {
|
|
6309
|
+
if (source.length < 1e5)
|
|
6310
|
+
Array.prototype.push.apply(target, source);
|
|
6311
|
+
else
|
|
6312
|
+
for (let i = 0;i < source.length; ++i)
|
|
6313
|
+
target.push(source[i]);
|
|
6314
|
+
}
|
|
6295
6315
|
function fixFlowSeqItems(fc) {
|
|
6296
6316
|
if (fc.start.type === "flow-seq-start") {
|
|
6297
6317
|
for (const it of fc.items) {
|
|
@@ -6301,11 +6321,11 @@ var require_parser = __commonJS((exports) => {
|
|
|
6301
6321
|
delete it.key;
|
|
6302
6322
|
if (isFlowToken(it.value)) {
|
|
6303
6323
|
if (it.value.end)
|
|
6304
|
-
|
|
6324
|
+
arrayPushArray(it.value.end, it.sep);
|
|
6305
6325
|
else
|
|
6306
6326
|
it.value.end = it.sep;
|
|
6307
6327
|
} else
|
|
6308
|
-
|
|
6328
|
+
arrayPushArray(it.start, it.sep);
|
|
6309
6329
|
delete it.sep;
|
|
6310
6330
|
}
|
|
6311
6331
|
}
|
|
@@ -6645,7 +6665,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
6645
6665
|
const prev = map.items[map.items.length - 2];
|
|
6646
6666
|
const end = prev?.value?.end;
|
|
6647
6667
|
if (Array.isArray(end)) {
|
|
6648
|
-
|
|
6668
|
+
arrayPushArray(end, it.start);
|
|
6649
6669
|
end.push(this.sourceToken);
|
|
6650
6670
|
map.items.pop();
|
|
6651
6671
|
return;
|
|
@@ -6833,7 +6853,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
6833
6853
|
const prev = seq.items[seq.items.length - 2];
|
|
6834
6854
|
const end = prev?.value?.end;
|
|
6835
6855
|
if (Array.isArray(end)) {
|
|
6836
|
-
|
|
6856
|
+
arrayPushArray(end, it.start);
|
|
6837
6857
|
end.push(this.sourceToken);
|
|
6838
6858
|
seq.items.pop();
|
|
6839
6859
|
return;
|
|
@@ -7073,7 +7093,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
7073
7093
|
exports.Parser = Parser;
|
|
7074
7094
|
});
|
|
7075
7095
|
|
|
7076
|
-
// ../../node_modules/.
|
|
7096
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/public-api.js
|
|
7077
7097
|
var require_public_api = __commonJS((exports) => {
|
|
7078
7098
|
var composer = require_composer();
|
|
7079
7099
|
var Document = require_Document();
|
|
@@ -7167,7 +7187,7 @@ var require_public_api = __commonJS((exports) => {
|
|
|
7167
7187
|
exports.stringify = stringify;
|
|
7168
7188
|
});
|
|
7169
7189
|
|
|
7170
|
-
// ../../node_modules/.
|
|
7190
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/index.js
|
|
7171
7191
|
var require_dist = __commonJS((exports) => {
|
|
7172
7192
|
var composer = require_composer();
|
|
7173
7193
|
var Document = require_Document();
|
|
@@ -7220,7 +7240,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7220
7240
|
var require_package = __commonJS((exports, module) => {
|
|
7221
7241
|
module.exports = {
|
|
7222
7242
|
name: "@ai-setting/roy-agent-cli",
|
|
7223
|
-
version: "1.5.
|
|
7243
|
+
version: "1.5.43",
|
|
7224
7244
|
type: "module",
|
|
7225
7245
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7226
7246
|
main: "./dist/index.js",
|
|
@@ -7247,7 +7267,7 @@ var require_package = __commonJS((exports, module) => {
|
|
|
7247
7267
|
},
|
|
7248
7268
|
dependencies: {
|
|
7249
7269
|
"@ai-setting/roy-agent-coder-harness": "^1.5.41",
|
|
7250
|
-
"@ai-setting/roy-agent-core": "^1.5.
|
|
7270
|
+
"@ai-setting/roy-agent-core": "^1.5.43",
|
|
7251
7271
|
"@ai-setting/roy-agent-ontology-harness": "^1.5.41",
|
|
7252
7272
|
chalk: "^5.6.2",
|
|
7253
7273
|
commander: "^14.0.3",
|
|
@@ -7339,7 +7359,9 @@ import {
|
|
|
7339
7359
|
CommandsComponent,
|
|
7340
7360
|
MemoryComponent,
|
|
7341
7361
|
EventSourceComponent,
|
|
7342
|
-
PluginComponent
|
|
7362
|
+
PluginComponent,
|
|
7363
|
+
resetTracerProvider,
|
|
7364
|
+
closeDatabase
|
|
7343
7365
|
} from "@ai-setting/roy-agent-core";
|
|
7344
7366
|
import { WorkflowComponent } from "@ai-setting/roy-agent-core";
|
|
7345
7367
|
import { MemoryPlugin } from "@ai-setting/roy-agent-core";
|
|
@@ -7469,29 +7491,37 @@ class EnvironmentService {
|
|
|
7469
7491
|
return this.memoryPlugin || null;
|
|
7470
7492
|
}
|
|
7471
7493
|
async dispose() {
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7494
|
+
if (this.environment) {
|
|
7495
|
+
try {
|
|
7496
|
+
await this.environment.stop();
|
|
7497
|
+
} catch {}
|
|
7498
|
+
} else {
|
|
7499
|
+
for (const component of [
|
|
7500
|
+
this.pluginComponent,
|
|
7501
|
+
this.eventSourceComponent,
|
|
7502
|
+
this.memoryComponent,
|
|
7503
|
+
this.commandsComponent,
|
|
7504
|
+
this.mcpComponent,
|
|
7505
|
+
this.skillComponent,
|
|
7506
|
+
this.taskComponent,
|
|
7507
|
+
this.promptComponent,
|
|
7508
|
+
this.logTraceComponent,
|
|
7509
|
+
this.agentComponent,
|
|
7510
|
+
this.toolComponent,
|
|
7511
|
+
this.sessionComponent,
|
|
7512
|
+
this.llmComponent,
|
|
7513
|
+
this.workflowComponent
|
|
7514
|
+
]) {
|
|
7515
|
+
if (component && typeof component.stop === "function") {
|
|
7516
|
+
try {
|
|
7517
|
+
await component.stop();
|
|
7518
|
+
} catch {}
|
|
7519
|
+
}
|
|
7493
7520
|
}
|
|
7494
7521
|
}
|
|
7522
|
+
this.configComponent?.shutdown?.();
|
|
7523
|
+
resetTracerProvider();
|
|
7524
|
+
closeDatabase();
|
|
7495
7525
|
this.environment = null;
|
|
7496
7526
|
this.sessionComponent = undefined;
|
|
7497
7527
|
this.llmComponent = undefined;
|
|
@@ -7500,6 +7530,15 @@ class EnvironmentService {
|
|
|
7500
7530
|
this.skillComponent = undefined;
|
|
7501
7531
|
this.logTraceComponent = undefined;
|
|
7502
7532
|
this.configComponent = undefined;
|
|
7533
|
+
this.promptComponent = undefined;
|
|
7534
|
+
this.taskComponent = undefined;
|
|
7535
|
+
this.mcpComponent = undefined;
|
|
7536
|
+
this.commandsComponent = undefined;
|
|
7537
|
+
this.memoryComponent = undefined;
|
|
7538
|
+
this.memoryPlugin = undefined;
|
|
7539
|
+
this.eventSourceComponent = undefined;
|
|
7540
|
+
this.workflowComponent = undefined;
|
|
7541
|
+
this.pluginComponent = undefined;
|
|
7503
7542
|
}
|
|
7504
7543
|
async create(options) {
|
|
7505
7544
|
const workDir = options?.workDir ?? process.cwd();
|
|
@@ -7693,6 +7732,7 @@ class EnvironmentService {
|
|
|
7693
7732
|
env.registerComponent(agentComponent);
|
|
7694
7733
|
env.registerComponent(logTraceComponent);
|
|
7695
7734
|
env.registerComponent(promptComponent);
|
|
7735
|
+
await agentComponent.syncRegistryAgentsFromConfig();
|
|
7696
7736
|
env.registerComponent(taskComponent);
|
|
7697
7737
|
env.registerComponent(skillComponent);
|
|
7698
7738
|
env.registerComponent(mcpComponent);
|
|
@@ -8164,6 +8204,26 @@ class TaskEventHandler {
|
|
|
8164
8204
|
}
|
|
8165
8205
|
}
|
|
8166
8206
|
|
|
8207
|
+
// src/commands/act-agent-validation.ts
|
|
8208
|
+
function validateActAgent(agentComponent, agentName) {
|
|
8209
|
+
if (!agentName || agentName === "default") {
|
|
8210
|
+
return { valid: true };
|
|
8211
|
+
}
|
|
8212
|
+
if (!agentComponent?.getAgent(agentName)) {
|
|
8213
|
+
return {
|
|
8214
|
+
valid: false,
|
|
8215
|
+
message: `Agent "${agentName}" 不存在`
|
|
8216
|
+
};
|
|
8217
|
+
}
|
|
8218
|
+
return { valid: true };
|
|
8219
|
+
}
|
|
8220
|
+
function buildActAgentContext(agentName) {
|
|
8221
|
+
if (!agentName || agentName === "default") {
|
|
8222
|
+
return;
|
|
8223
|
+
}
|
|
8224
|
+
return { agentType: agentName };
|
|
8225
|
+
}
|
|
8226
|
+
|
|
8167
8227
|
// src/commands/act.ts
|
|
8168
8228
|
function createActCommand(externalEnvService) {
|
|
8169
8229
|
return {
|
|
@@ -8210,6 +8270,10 @@ function createActCommand(externalEnvService) {
|
|
|
8210
8270
|
describe: "启用 coder plugin (tslsp, pylsp, mdlsp, lsp, code-check, reminder)",
|
|
8211
8271
|
type: "array",
|
|
8212
8272
|
string: true
|
|
8273
|
+
}).option("agent", {
|
|
8274
|
+
alias: "a",
|
|
8275
|
+
describe: "指定要使用的 agent(如 explore, markdown-ontology-extractor)",
|
|
8276
|
+
type: "string"
|
|
8213
8277
|
}),
|
|
8214
8278
|
async handler(args) {
|
|
8215
8279
|
const quiet = args.quiet ?? true;
|
|
@@ -8266,6 +8330,18 @@ function createActCommand(externalEnvService) {
|
|
|
8266
8330
|
output.error("SessionComponent not available");
|
|
8267
8331
|
process.exit(1);
|
|
8268
8332
|
}
|
|
8333
|
+
if (args.agent && args.agent !== "default") {
|
|
8334
|
+
const agentComponent = env.getComponent("agent");
|
|
8335
|
+
const validation = validateActAgent(agentComponent, args.agent);
|
|
8336
|
+
if (!validation.valid) {
|
|
8337
|
+
output.error(validation.message);
|
|
8338
|
+
output.info("提示: roy-agent agents list");
|
|
8339
|
+
process.exit(1);
|
|
8340
|
+
}
|
|
8341
|
+
if (!quiet) {
|
|
8342
|
+
output.info(`Agent: ${args.agent}`);
|
|
8343
|
+
}
|
|
8344
|
+
}
|
|
8269
8345
|
const taskEventHandlerForCleanup = new TaskEventHandler({
|
|
8270
8346
|
env,
|
|
8271
8347
|
enabled: true
|
|
@@ -8417,7 +8493,8 @@ function createActCommand(externalEnvService) {
|
|
|
8417
8493
|
const rootSpan = tracer.startSpan("act.execute", {
|
|
8418
8494
|
attributes: {
|
|
8419
8495
|
message: args.message.substring(0, 200),
|
|
8420
|
-
sessionId
|
|
8496
|
+
sessionId,
|
|
8497
|
+
...buildActAgentContext(args.agent) ?? {}
|
|
8421
8498
|
}
|
|
8422
8499
|
});
|
|
8423
8500
|
const traceId = rootSpan.spanContext.traceId;
|
|
@@ -8428,6 +8505,7 @@ function createActCommand(externalEnvService) {
|
|
|
8428
8505
|
const contextHandler = new ContextHandlerService(env, sessionComponent, { maxRetries: 1, autoCompact: true });
|
|
8429
8506
|
const context = {
|
|
8430
8507
|
sessionId,
|
|
8508
|
+
...buildActAgentContext(args.agent),
|
|
8431
8509
|
metadata: {
|
|
8432
8510
|
originalQuery: args.message,
|
|
8433
8511
|
traceId
|
|
@@ -8470,6 +8548,9 @@ function createActCommand(externalEnvService) {
|
|
|
8470
8548
|
}
|
|
8471
8549
|
if (shouldDisposeEnvService) {
|
|
8472
8550
|
await envService.dispose();
|
|
8551
|
+
if (process.env.ROY_AGENT_NO_EXIT !== "1") {
|
|
8552
|
+
process.exit(0);
|
|
8553
|
+
}
|
|
8473
8554
|
}
|
|
8474
8555
|
}
|
|
8475
8556
|
}
|
|
@@ -9520,6 +9601,10 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
9520
9601
|
describe: "启用 plugin (tslsp, pylsp, mdlsp, lsp, code-check, reminder, memory, task-tag)",
|
|
9521
9602
|
type: "array",
|
|
9522
9603
|
string: true
|
|
9604
|
+
}).option("agent", {
|
|
9605
|
+
alias: "a",
|
|
9606
|
+
describe: "指定使用的 agent (如 explore, general)",
|
|
9607
|
+
type: "string"
|
|
9523
9608
|
}),
|
|
9524
9609
|
async handler(args) {
|
|
9525
9610
|
CliQuietModeService.getInstance().setQuiet(true);
|
|
@@ -9583,6 +9668,18 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
9583
9668
|
output,
|
|
9584
9669
|
quiet: true
|
|
9585
9670
|
});
|
|
9671
|
+
let currentAgentContext = undefined;
|
|
9672
|
+
if (args.agent && args.agent !== "default") {
|
|
9673
|
+
const agentComponent = env.getComponent("agent");
|
|
9674
|
+
const validation = validateActAgent(agentComponent, args.agent);
|
|
9675
|
+
if (!validation.valid) {
|
|
9676
|
+
output.error(validation.message);
|
|
9677
|
+
output.info("提示: roy-agent agents list");
|
|
9678
|
+
process.exit(1);
|
|
9679
|
+
}
|
|
9680
|
+
currentAgentContext = buildActAgentContext(args.agent);
|
|
9681
|
+
output.info(`Agent: ${args.agent}`);
|
|
9682
|
+
}
|
|
9586
9683
|
queryExecutor.initStreamOutput(llmComponent);
|
|
9587
9684
|
let pluginAdapterDispose = null;
|
|
9588
9685
|
let lspManagerDispose = null;
|
|
@@ -9666,7 +9763,6 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
9666
9763
|
output.error(`❌ 加载 coder-harness 插件失败: ${error}`);
|
|
9667
9764
|
}
|
|
9668
9765
|
}
|
|
9669
|
-
let currentAgentContext = undefined;
|
|
9670
9766
|
const repl = new REPL({
|
|
9671
9767
|
sessionId,
|
|
9672
9768
|
sessionTitle,
|
|
@@ -12352,58 +12448,28 @@ var SkillsCommand = {
|
|
|
12352
12448
|
}
|
|
12353
12449
|
};
|
|
12354
12450
|
|
|
12355
|
-
// src/commands/
|
|
12451
|
+
// src/commands/agents/list.ts
|
|
12356
12452
|
import chalk28 from "chalk";
|
|
12357
|
-
|
|
12358
|
-
|
|
12359
|
-
|
|
12360
|
-
|
|
12361
|
-
|
|
12362
|
-
|
|
12363
|
-
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
|
|
12367
|
-
return result;
|
|
12368
|
-
}
|
|
12369
|
-
function formatCommandsTable(commands) {
|
|
12370
|
-
if (commands.length === 0) {
|
|
12371
|
-
return chalk28.yellow("命令目录为空,使用 'roy-agent commands add' 添加命令");
|
|
12372
|
-
}
|
|
12373
|
-
const NAME_WIDTH = 20;
|
|
12374
|
-
const SOURCE_WIDTH = 10;
|
|
12375
|
-
const DESC_WIDTH = 50;
|
|
12376
|
-
const GAP = " ";
|
|
12377
|
-
const headerLine = [
|
|
12378
|
-
chalk28.bold("NAME".padEnd(NAME_WIDTH)),
|
|
12379
|
-
chalk28.bold("SOURCE".padEnd(SOURCE_WIDTH)),
|
|
12380
|
-
chalk28.bold("DESCRIPTION")
|
|
12381
|
-
].join(GAP);
|
|
12382
|
-
const sepLine = "─".repeat(NAME_WIDTH + SOURCE_WIDTH + DESC_WIDTH + GAP.length * 2);
|
|
12383
|
-
const formatRow = (cmd) => {
|
|
12384
|
-
const name = truncateVisual(cmd.name, NAME_WIDTH).padEnd(NAME_WIDTH);
|
|
12385
|
-
const source = cmd.source.padEnd(SOURCE_WIDTH);
|
|
12386
|
-
const desc = truncateVisual(cmd.description || "-", DESC_WIDTH);
|
|
12387
|
-
return `${name}${GAP}${source}${GAP}${desc}`;
|
|
12388
|
-
};
|
|
12389
|
-
const rows = commands.map(formatRow);
|
|
12390
|
-
return [headerLine, sepLine, ...rows].join(`
|
|
12391
|
-
`);
|
|
12392
|
-
}
|
|
12393
|
-
var CommandsListCommand = {
|
|
12394
|
-
command: "list [pattern]",
|
|
12395
|
-
describe: "列出收藏的命令(支持 glob 过滤)",
|
|
12396
|
-
builder: (yargs) => yargs.positional("pattern", {
|
|
12397
|
-
describe: "glob 过滤模式",
|
|
12398
|
-
type: "string"
|
|
12453
|
+
var ListCommand4 = {
|
|
12454
|
+
command: "list",
|
|
12455
|
+
aliases: ["ls"],
|
|
12456
|
+
describe: "列出所有可用 agents",
|
|
12457
|
+
builder: (yargs) => yargs.option("type", {
|
|
12458
|
+
alias: "t",
|
|
12459
|
+
type: "string",
|
|
12460
|
+
choices: ["primary", "sub", "all"],
|
|
12461
|
+
default: "all",
|
|
12462
|
+
description: "按类型筛选"
|
|
12399
12463
|
}).option("json", {
|
|
12400
12464
|
alias: "j",
|
|
12401
|
-
describe: "JSON 格式输出",
|
|
12402
12465
|
type: "boolean",
|
|
12403
|
-
default: false
|
|
12404
|
-
|
|
12405
|
-
|
|
12406
|
-
|
|
12466
|
+
default: false,
|
|
12467
|
+
description: "JSON 输出"
|
|
12468
|
+
}).option("quiet", {
|
|
12469
|
+
alias: "q",
|
|
12470
|
+
type: "boolean",
|
|
12471
|
+
default: false,
|
|
12472
|
+
description: "简洁输出"
|
|
12407
12473
|
}),
|
|
12408
12474
|
async handler(args) {
|
|
12409
12475
|
const output = new OutputService;
|
|
@@ -12415,35 +12481,76 @@ var CommandsListCommand = {
|
|
|
12415
12481
|
output.error("Failed to create environment");
|
|
12416
12482
|
process.exit(1);
|
|
12417
12483
|
}
|
|
12418
|
-
const
|
|
12419
|
-
if (!
|
|
12420
|
-
output.error("
|
|
12484
|
+
const agentComponent = env.getComponent("agent");
|
|
12485
|
+
if (!agentComponent) {
|
|
12486
|
+
output.error("AgentComponent not available");
|
|
12421
12487
|
process.exit(1);
|
|
12422
12488
|
}
|
|
12423
|
-
const
|
|
12489
|
+
const registry = agentComponent.getRegistry?.();
|
|
12490
|
+
if (!registry) {
|
|
12491
|
+
output.error("Agent registry not available");
|
|
12492
|
+
process.exit(1);
|
|
12493
|
+
}
|
|
12494
|
+
let agents;
|
|
12495
|
+
if (args.type && args.type !== "all") {
|
|
12496
|
+
agents = registry.listAgentsByType(args.type);
|
|
12497
|
+
} else {
|
|
12498
|
+
agents = registry.list();
|
|
12499
|
+
}
|
|
12424
12500
|
if (args.json) {
|
|
12425
12501
|
output.json({
|
|
12426
|
-
|
|
12427
|
-
name:
|
|
12428
|
-
|
|
12429
|
-
|
|
12430
|
-
|
|
12502
|
+
agents: agents.map((a) => ({
|
|
12503
|
+
name: a.name,
|
|
12504
|
+
type: a.type,
|
|
12505
|
+
description: a.description,
|
|
12506
|
+
systemPromptRef: a.systemPromptRef,
|
|
12507
|
+
hasInlinePrompt: !!a.systemPrompt
|
|
12431
12508
|
})),
|
|
12432
|
-
|
|
12509
|
+
count: agents.length
|
|
12433
12510
|
});
|
|
12511
|
+
} else if (args.quiet) {
|
|
12512
|
+
agents.forEach((a) => output.log(a.name));
|
|
12434
12513
|
} else {
|
|
12435
|
-
const
|
|
12436
|
-
|
|
12437
|
-
|
|
12438
|
-
|
|
12439
|
-
|
|
12440
|
-
|
|
12441
|
-
|
|
12442
|
-
|
|
12443
|
-
|
|
12514
|
+
const header = [
|
|
12515
|
+
chalk28.bold("Name"),
|
|
12516
|
+
chalk28.bold("Type"),
|
|
12517
|
+
chalk28.bold("Description"),
|
|
12518
|
+
chalk28.bold("Source")
|
|
12519
|
+
].join(" | ");
|
|
12520
|
+
const typeColor = (type) => {
|
|
12521
|
+
return type === "primary" ? chalk28.yellow : chalk28.blue;
|
|
12522
|
+
};
|
|
12523
|
+
const sourceColor = (agent) => {
|
|
12524
|
+
return agent.systemPromptRef ? chalk28.green("[ref]") : chalk28.gray("[inline]");
|
|
12525
|
+
};
|
|
12526
|
+
const rows = agents.map((a) => {
|
|
12527
|
+
const desc = (a.description || "").length > 40 ? (a.description || "").slice(0, 37) + "..." : a.description || "-";
|
|
12528
|
+
return [
|
|
12529
|
+
chalk28.cyan(a.name),
|
|
12530
|
+
typeColor(a.type)(a.type),
|
|
12531
|
+
desc,
|
|
12532
|
+
sourceColor(a)
|
|
12533
|
+
].join(" | ");
|
|
12534
|
+
});
|
|
12535
|
+
if (rows.length === 0) {
|
|
12536
|
+
output.log(chalk28.yellow("No agents found."));
|
|
12537
|
+
output.log("");
|
|
12538
|
+
output.log(chalk28.gray("Tip: Create agent configs in ~/.local/share/roy-agent/agents/"));
|
|
12539
|
+
} else {
|
|
12540
|
+
output.log([
|
|
12541
|
+
`┌─ Agents ${"─".repeat(50)}┐`,
|
|
12542
|
+
`│${header}│`,
|
|
12543
|
+
"├" + "─".repeat(header.length + 2) + "┤",
|
|
12544
|
+
...rows.map((r) => `│${r}│`),
|
|
12545
|
+
"└" + "─".repeat(header.length + 2) + "┘",
|
|
12546
|
+
"",
|
|
12547
|
+
chalk28.gray(`Total: ${agents.length} agents`)
|
|
12548
|
+
].join(`
|
|
12549
|
+
`));
|
|
12550
|
+
}
|
|
12444
12551
|
}
|
|
12445
12552
|
} catch (error) {
|
|
12446
|
-
output.error(`Failed to list
|
|
12553
|
+
output.error(`Failed to list agents: ${error}`);
|
|
12447
12554
|
process.exit(1);
|
|
12448
12555
|
} finally {
|
|
12449
12556
|
await envService.dispose();
|
|
@@ -12451,42 +12558,20 @@ var CommandsListCommand = {
|
|
|
12451
12558
|
}
|
|
12452
12559
|
};
|
|
12453
12560
|
|
|
12454
|
-
// src/commands/
|
|
12561
|
+
// src/commands/agents/get.ts
|
|
12455
12562
|
import chalk29 from "chalk";
|
|
12456
|
-
var
|
|
12457
|
-
command: "
|
|
12458
|
-
describe: "
|
|
12563
|
+
var GetCommand4 = {
|
|
12564
|
+
command: "get <name>",
|
|
12565
|
+
describe: "获取指定 agent 的详细信息",
|
|
12459
12566
|
builder: (yargs) => yargs.positional("name", {
|
|
12460
|
-
describe: "命令名称",
|
|
12461
|
-
type: "string",
|
|
12462
|
-
demandOption: true
|
|
12463
|
-
}).positional("target", {
|
|
12464
|
-
describe: "目标命令路径或名称",
|
|
12465
12567
|
type: "string",
|
|
12568
|
+
describe: "Agent 名称",
|
|
12466
12569
|
demandOption: true
|
|
12467
|
-
}).option("
|
|
12468
|
-
alias: "
|
|
12469
|
-
describe: "添加到用户级别目录(默认)",
|
|
12470
|
-
type: "boolean",
|
|
12471
|
-
default: true
|
|
12472
|
-
}).option("local", {
|
|
12473
|
-
alias: "l",
|
|
12474
|
-
describe: "添加到项目级别目录",
|
|
12570
|
+
}).option("json", {
|
|
12571
|
+
alias: "j",
|
|
12475
12572
|
type: "boolean",
|
|
12476
|
-
default: false
|
|
12477
|
-
|
|
12478
|
-
alias: "d",
|
|
12479
|
-
describe: "命令功能描述(用于 AI Prompt 注入)",
|
|
12480
|
-
type: "string",
|
|
12481
|
-
demandOption: true
|
|
12482
|
-
}).option("tips", {
|
|
12483
|
-
alias: "t",
|
|
12484
|
-
describe: "探索提示(告诉用户如何使用 --help 探索)",
|
|
12485
|
-
type: "string",
|
|
12486
|
-
demandOption: true
|
|
12487
|
-
}).option("config", {
|
|
12488
|
-
describe: "配置文件路径",
|
|
12489
|
-
type: "string"
|
|
12573
|
+
default: false,
|
|
12574
|
+
description: "JSON 输出"
|
|
12490
12575
|
}),
|
|
12491
12576
|
async handler(args) {
|
|
12492
12577
|
const output = new OutputService;
|
|
@@ -12498,27 +12583,99 @@ var CommandsAddCommand = {
|
|
|
12498
12583
|
output.error("Failed to create environment");
|
|
12499
12584
|
process.exit(1);
|
|
12500
12585
|
}
|
|
12501
|
-
const
|
|
12502
|
-
if (!
|
|
12503
|
-
output.error("
|
|
12586
|
+
const agentComponent = env.getComponent("agent");
|
|
12587
|
+
if (!agentComponent) {
|
|
12588
|
+
output.error("AgentComponent not available");
|
|
12504
12589
|
process.exit(1);
|
|
12505
12590
|
}
|
|
12506
|
-
const
|
|
12507
|
-
|
|
12508
|
-
|
|
12509
|
-
|
|
12510
|
-
|
|
12511
|
-
|
|
12512
|
-
|
|
12513
|
-
|
|
12514
|
-
|
|
12515
|
-
|
|
12516
|
-
|
|
12517
|
-
|
|
12518
|
-
|
|
12519
|
-
|
|
12591
|
+
const registry = agentComponent.getRegistry?.();
|
|
12592
|
+
if (!registry) {
|
|
12593
|
+
output.error("Agent registry not available");
|
|
12594
|
+
process.exit(1);
|
|
12595
|
+
}
|
|
12596
|
+
const agent = registry.get(args.name);
|
|
12597
|
+
if (!agent) {
|
|
12598
|
+
output.error(`Agent not found: ${args.name}`);
|
|
12599
|
+
process.exit(1);
|
|
12600
|
+
}
|
|
12601
|
+
const resolvedSystemPrompt = await registry.getSystemPrompt(args.name);
|
|
12602
|
+
if (args.json) {
|
|
12603
|
+
output.json({
|
|
12604
|
+
name: agent.name,
|
|
12605
|
+
type: agent.type,
|
|
12606
|
+
description: agent.description,
|
|
12607
|
+
systemPromptRef: agent.systemPromptRef,
|
|
12608
|
+
systemPrompt: agent.systemPrompt,
|
|
12609
|
+
resolvedSystemPrompt,
|
|
12610
|
+
model: agent.model,
|
|
12611
|
+
maxIterations: agent.maxIterations,
|
|
12612
|
+
allowedTools: agent.allowedTools,
|
|
12613
|
+
deniedTools: agent.deniedTools,
|
|
12614
|
+
toolTimeout: agent.toolTimeout,
|
|
12615
|
+
toolRetries: agent.toolRetries,
|
|
12616
|
+
doomLoopThreshold: agent.doomLoopThreshold,
|
|
12617
|
+
filterHistory: agent.filterHistory
|
|
12618
|
+
});
|
|
12619
|
+
} else {
|
|
12620
|
+
output.log(chalk29.bold.cyan(`# Agent: ${agent.name}`));
|
|
12621
|
+
output.log("");
|
|
12622
|
+
output.log(chalk29.bold("Basic Info:"));
|
|
12623
|
+
output.log(` ${chalk29.cyan("name:")} ${agent.name}`);
|
|
12624
|
+
output.log(` ${chalk29.cyan("type:")} ${agent.type}`);
|
|
12625
|
+
if (agent.description) {
|
|
12626
|
+
output.log(` ${chalk29.cyan("description:")} ${agent.description}`);
|
|
12627
|
+
}
|
|
12628
|
+
output.log("");
|
|
12629
|
+
output.log(chalk29.bold("System Prompt:"));
|
|
12630
|
+
if (agent.systemPromptRef) {
|
|
12631
|
+
output.log(` ${chalk29.green("[ref]")} ${chalk29.cyan("systemPromptRef:")} ${agent.systemPromptRef}`);
|
|
12632
|
+
}
|
|
12633
|
+
if (agent.systemPrompt && !agent.systemPromptRef) {
|
|
12634
|
+
const promptPreview = agent.systemPrompt.length > 100 ? agent.systemPrompt.slice(0, 97) + "..." : agent.systemPrompt;
|
|
12635
|
+
output.log(` ${chalk29.gray("[inline]")}`);
|
|
12636
|
+
output.log(` ${chalk29.gray(promptPreview.split(`
|
|
12637
|
+
`).join(`
|
|
12638
|
+
`))}`);
|
|
12639
|
+
}
|
|
12640
|
+
if (resolvedSystemPrompt) {
|
|
12641
|
+
const resolvedPreview = resolvedSystemPrompt.length > 200 ? resolvedSystemPrompt.slice(0, 197) + "..." : resolvedSystemPrompt;
|
|
12642
|
+
output.log(` ${chalk29.green("[resolved]")}`);
|
|
12643
|
+
output.log(` ${chalk29.gray(resolvedPreview.split(`
|
|
12644
|
+
`).join(`
|
|
12645
|
+
`))}`);
|
|
12646
|
+
}
|
|
12647
|
+
if (!agent.systemPromptRef && !agent.systemPrompt && !resolvedSystemPrompt) {
|
|
12648
|
+
output.log(` ${chalk29.gray("(none)")}`);
|
|
12649
|
+
}
|
|
12650
|
+
output.log("");
|
|
12651
|
+
const hasOptions = agent.model || agent.maxIterations || agent.toolTimeout;
|
|
12652
|
+
if (hasOptions) {
|
|
12653
|
+
output.log(chalk29.bold("Options:"));
|
|
12654
|
+
if (agent.model) {
|
|
12655
|
+
output.log(` ${chalk29.cyan("model:")} ${agent.model}`);
|
|
12656
|
+
}
|
|
12657
|
+
if (agent.maxIterations) {
|
|
12658
|
+
output.log(` ${chalk29.cyan("maxIterations:")} ${agent.maxIterations}`);
|
|
12659
|
+
}
|
|
12660
|
+
if (agent.toolTimeout) {
|
|
12661
|
+
output.log(` ${chalk29.cyan("toolTimeout:")} ${agent.toolTimeout}ms`);
|
|
12662
|
+
}
|
|
12663
|
+
output.log("");
|
|
12664
|
+
}
|
|
12665
|
+
const hasTools = agent.allowedTools?.length || agent.deniedTools?.length;
|
|
12666
|
+
if (hasTools) {
|
|
12667
|
+
output.log(chalk29.bold("Tool Permissions:"));
|
|
12668
|
+
if (agent.allowedTools?.length) {
|
|
12669
|
+
output.log(` ${chalk29.green("allowed:")} ${agent.allowedTools.join(", ")}`);
|
|
12670
|
+
}
|
|
12671
|
+
if (agent.deniedTools?.length) {
|
|
12672
|
+
output.log(` ${chalk29.red("denied:")} ${agent.deniedTools.join(", ")}`);
|
|
12673
|
+
}
|
|
12674
|
+
output.log("");
|
|
12675
|
+
}
|
|
12676
|
+
}
|
|
12520
12677
|
} catch (error) {
|
|
12521
|
-
output.error(
|
|
12678
|
+
output.error(`Failed to get agent: ${error}`);
|
|
12522
12679
|
process.exit(1);
|
|
12523
12680
|
} finally {
|
|
12524
12681
|
await envService.dispose();
|
|
@@ -12526,29 +12683,50 @@ var CommandsAddCommand = {
|
|
|
12526
12683
|
}
|
|
12527
12684
|
};
|
|
12528
12685
|
|
|
12529
|
-
// src/commands/
|
|
12686
|
+
// src/commands/agents/add.ts
|
|
12530
12687
|
import chalk30 from "chalk";
|
|
12531
|
-
|
|
12532
|
-
|
|
12533
|
-
|
|
12534
|
-
|
|
12688
|
+
function parseToolList(value) {
|
|
12689
|
+
if (!value?.trim()) {
|
|
12690
|
+
return;
|
|
12691
|
+
}
|
|
12692
|
+
return value.split(",").map((tool) => tool.trim()).filter(Boolean);
|
|
12693
|
+
}
|
|
12694
|
+
var AddCommand = {
|
|
12695
|
+
command: "add <name>",
|
|
12696
|
+
describe: "添加 agent 配置(写入 YAML 文件)",
|
|
12535
12697
|
builder: (yargs) => yargs.positional("name", {
|
|
12536
|
-
describe: "命令名称",
|
|
12537
12698
|
type: "string",
|
|
12699
|
+
describe: "Agent 名称",
|
|
12538
12700
|
demandOption: true
|
|
12539
|
-
}).option("
|
|
12540
|
-
alias: "
|
|
12541
|
-
|
|
12542
|
-
|
|
12543
|
-
default:
|
|
12544
|
-
|
|
12545
|
-
|
|
12546
|
-
|
|
12701
|
+
}).option("type", {
|
|
12702
|
+
alias: "t",
|
|
12703
|
+
type: "string",
|
|
12704
|
+
choices: ["primary", "sub"],
|
|
12705
|
+
default: "sub",
|
|
12706
|
+
description: "Agent 类型"
|
|
12707
|
+
}).option("description", {
|
|
12708
|
+
type: "string",
|
|
12709
|
+
description: "Agent 描述"
|
|
12710
|
+
}).option("system-prompt-ref", {
|
|
12711
|
+
type: "string",
|
|
12712
|
+
description: "引用 PromptComponent 中的 prompt 名称"
|
|
12713
|
+
}).option("system-prompt", {
|
|
12714
|
+
type: "string",
|
|
12715
|
+
description: "内联 system prompt"
|
|
12716
|
+
}).option("model", {
|
|
12717
|
+
type: "string",
|
|
12718
|
+
description: "使用的模型"
|
|
12719
|
+
}).option("allowed-tools", {
|
|
12720
|
+
type: "string",
|
|
12721
|
+
description: "允许的工具(逗号分隔)"
|
|
12722
|
+
}).option("denied-tools", {
|
|
12723
|
+
type: "string",
|
|
12724
|
+
description: "拒绝的工具(逗号分隔)"
|
|
12725
|
+
}).option("json", {
|
|
12726
|
+
alias: "j",
|
|
12547
12727
|
type: "boolean",
|
|
12548
|
-
default: false
|
|
12549
|
-
|
|
12550
|
-
describe: "配置文件路径",
|
|
12551
|
-
type: "string"
|
|
12728
|
+
default: false,
|
|
12729
|
+
description: "JSON 输出"
|
|
12552
12730
|
}),
|
|
12553
12731
|
async handler(args) {
|
|
12554
12732
|
const output = new OutputService;
|
|
@@ -12560,19 +12738,681 @@ var CommandsRemoveCommand = {
|
|
|
12560
12738
|
output.error("Failed to create environment");
|
|
12561
12739
|
process.exit(1);
|
|
12562
12740
|
}
|
|
12563
|
-
const
|
|
12564
|
-
|
|
12565
|
-
|
|
12741
|
+
const agentComponent = env.getComponent("agent");
|
|
12742
|
+
const registry = agentComponent?.getRegistry?.();
|
|
12743
|
+
if (!registry) {
|
|
12744
|
+
output.error("Agent registry not available");
|
|
12566
12745
|
process.exit(1);
|
|
12567
12746
|
}
|
|
12568
|
-
if (args.
|
|
12569
|
-
|
|
12570
|
-
|
|
12571
|
-
|
|
12572
|
-
|
|
12573
|
-
|
|
12574
|
-
|
|
12575
|
-
|
|
12747
|
+
if (registry.hasAgent(args.name)) {
|
|
12748
|
+
output.error(`Agent already exists: ${args.name}`);
|
|
12749
|
+
process.exit(1);
|
|
12750
|
+
}
|
|
12751
|
+
const agent = {
|
|
12752
|
+
name: args.name,
|
|
12753
|
+
type: args.type,
|
|
12754
|
+
description: args.description,
|
|
12755
|
+
systemPromptRef: args.systemPromptRef,
|
|
12756
|
+
systemPrompt: args.systemPrompt,
|
|
12757
|
+
model: args.model,
|
|
12758
|
+
allowedTools: parseToolList(args.allowedTools),
|
|
12759
|
+
deniedTools: parseToolList(args.deniedTools)
|
|
12760
|
+
};
|
|
12761
|
+
const saved = await registry.saveAgent(agent);
|
|
12762
|
+
if (!saved) {
|
|
12763
|
+
output.error(`Failed to save agent: ${args.name}`);
|
|
12764
|
+
process.exit(1);
|
|
12765
|
+
}
|
|
12766
|
+
const filePath = registry.getAgentFilePath(args.name);
|
|
12767
|
+
if (args.json) {
|
|
12768
|
+
output.json({ agent, filePath });
|
|
12769
|
+
} else {
|
|
12770
|
+
output.log(chalk30.green(`✓ Agent '${args.name}' created`));
|
|
12771
|
+
output.log(chalk30.gray(` ${filePath}`));
|
|
12772
|
+
}
|
|
12773
|
+
} catch (error) {
|
|
12774
|
+
output.error(`Failed to add agent: ${error}`);
|
|
12775
|
+
process.exit(1);
|
|
12776
|
+
} finally {
|
|
12777
|
+
await envService.dispose();
|
|
12778
|
+
}
|
|
12779
|
+
}
|
|
12780
|
+
};
|
|
12781
|
+
|
|
12782
|
+
// src/commands/agents/delete.ts
|
|
12783
|
+
import chalk31 from "chalk";
|
|
12784
|
+
var DeleteCommand3 = {
|
|
12785
|
+
command: "delete <name>",
|
|
12786
|
+
describe: "删除 agent 配置文件",
|
|
12787
|
+
builder: (yargs) => yargs.positional("name", {
|
|
12788
|
+
type: "string",
|
|
12789
|
+
describe: "Agent 名称",
|
|
12790
|
+
demandOption: true
|
|
12791
|
+
}).option("yes", {
|
|
12792
|
+
alias: "y",
|
|
12793
|
+
type: "boolean",
|
|
12794
|
+
default: false,
|
|
12795
|
+
description: "跳过确认"
|
|
12796
|
+
}).option("json", {
|
|
12797
|
+
alias: "j",
|
|
12798
|
+
type: "boolean",
|
|
12799
|
+
default: false,
|
|
12800
|
+
description: "JSON 输出"
|
|
12801
|
+
}),
|
|
12802
|
+
async handler(args) {
|
|
12803
|
+
const output = new OutputService;
|
|
12804
|
+
const envService = new EnvironmentService(output);
|
|
12805
|
+
try {
|
|
12806
|
+
await envService.create({ configPath: args.config });
|
|
12807
|
+
const env = envService.getEnvironment();
|
|
12808
|
+
if (!env) {
|
|
12809
|
+
output.error("Failed to create environment");
|
|
12810
|
+
process.exit(1);
|
|
12811
|
+
}
|
|
12812
|
+
const agentComponent = env.getComponent("agent");
|
|
12813
|
+
const registry = agentComponent?.getRegistry?.();
|
|
12814
|
+
if (!registry) {
|
|
12815
|
+
output.error("Agent registry not available");
|
|
12816
|
+
process.exit(1);
|
|
12817
|
+
}
|
|
12818
|
+
const agent = registry.get(args.name);
|
|
12819
|
+
if (!agent) {
|
|
12820
|
+
output.error(`Agent not found: ${args.name}`);
|
|
12821
|
+
process.exit(1);
|
|
12822
|
+
}
|
|
12823
|
+
const filePath = registry.getAgentFilePath(args.name);
|
|
12824
|
+
if (!args.yes) {
|
|
12825
|
+
output.log(chalk31.yellow(`Delete agent '${args.name}'? This removes ${filePath} (use --yes to skip confirmation)`));
|
|
12826
|
+
process.exit(1);
|
|
12827
|
+
}
|
|
12828
|
+
const deleted = await registry.deleteAgent(args.name);
|
|
12829
|
+
if (!deleted) {
|
|
12830
|
+
output.error(`Failed to delete agent: ${args.name}`);
|
|
12831
|
+
process.exit(1);
|
|
12832
|
+
}
|
|
12833
|
+
if (args.json) {
|
|
12834
|
+
output.json({ deleted: true, name: args.name, filePath });
|
|
12835
|
+
} else {
|
|
12836
|
+
output.log(chalk31.green(`✓ Agent '${args.name}' deleted`));
|
|
12837
|
+
}
|
|
12838
|
+
} catch (error) {
|
|
12839
|
+
output.error(`Failed to delete agent: ${error}`);
|
|
12840
|
+
process.exit(1);
|
|
12841
|
+
} finally {
|
|
12842
|
+
await envService.dispose();
|
|
12843
|
+
}
|
|
12844
|
+
}
|
|
12845
|
+
};
|
|
12846
|
+
|
|
12847
|
+
// src/commands/agents/config-dir.ts
|
|
12848
|
+
import chalk32 from "chalk";
|
|
12849
|
+
var ConfigDirCommand = {
|
|
12850
|
+
command: "config-dir",
|
|
12851
|
+
describe: "显示 agent 配置目录路径",
|
|
12852
|
+
builder: (yargs) => yargs.option("json", {
|
|
12853
|
+
alias: "j",
|
|
12854
|
+
type: "boolean",
|
|
12855
|
+
default: false,
|
|
12856
|
+
description: "JSON 输出"
|
|
12857
|
+
}),
|
|
12858
|
+
async handler(args) {
|
|
12859
|
+
const output = new OutputService;
|
|
12860
|
+
const envService = new EnvironmentService(output);
|
|
12861
|
+
try {
|
|
12862
|
+
await envService.create({ configPath: args.config });
|
|
12863
|
+
const env = envService.getEnvironment();
|
|
12864
|
+
if (!env) {
|
|
12865
|
+
output.error("Failed to create environment");
|
|
12866
|
+
process.exit(1);
|
|
12867
|
+
}
|
|
12868
|
+
const agentComponent = env.getComponent("agent");
|
|
12869
|
+
const registry = agentComponent?.getRegistry?.();
|
|
12870
|
+
if (!registry) {
|
|
12871
|
+
output.error("Agent registry not available");
|
|
12872
|
+
process.exit(1);
|
|
12873
|
+
}
|
|
12874
|
+
const configDir = registry.getConfigDir();
|
|
12875
|
+
const exists = registry.configDirExists();
|
|
12876
|
+
if (args.json) {
|
|
12877
|
+
output.json({ configDir, exists });
|
|
12878
|
+
} else {
|
|
12879
|
+
output.log(`${chalk32.cyan("Agent Config Directory:")} ${configDir}`);
|
|
12880
|
+
output.log(`${chalk32.gray("Exists:")} ${exists ? "yes" : "no"}`);
|
|
12881
|
+
}
|
|
12882
|
+
} catch (error) {
|
|
12883
|
+
output.error(`Failed to get config dir: ${error}`);
|
|
12884
|
+
process.exit(1);
|
|
12885
|
+
} finally {
|
|
12886
|
+
await envService.dispose();
|
|
12887
|
+
}
|
|
12888
|
+
}
|
|
12889
|
+
};
|
|
12890
|
+
|
|
12891
|
+
// src/commands/agents/index.ts
|
|
12892
|
+
var AgentsCommand = {
|
|
12893
|
+
command: "agents",
|
|
12894
|
+
aliases: ["agent"],
|
|
12895
|
+
describe: "Agent 管理 - 列出、获取、添加、删除 agent 配置",
|
|
12896
|
+
builder: (yargs) => yargs.command(ListCommand4).command(GetCommand4).command(AddCommand).command(DeleteCommand3).command(ConfigDirCommand).demandCommand().help(),
|
|
12897
|
+
handler: () => {
|
|
12898
|
+
console.log("Use 'roy-agent agents --help' for usage information");
|
|
12899
|
+
}
|
|
12900
|
+
};
|
|
12901
|
+
|
|
12902
|
+
// src/commands/prompt/list.ts
|
|
12903
|
+
import chalk33 from "chalk";
|
|
12904
|
+
var ListCommand5 = {
|
|
12905
|
+
command: "list",
|
|
12906
|
+
aliases: ["ls"],
|
|
12907
|
+
describe: "列出所有可用 prompts",
|
|
12908
|
+
builder: (yargs) => yargs.option("source", {
|
|
12909
|
+
alias: "s",
|
|
12910
|
+
type: "string",
|
|
12911
|
+
choices: ["built-in", "directory", "file", "inline", "all"],
|
|
12912
|
+
default: "all",
|
|
12913
|
+
description: "按来源筛选"
|
|
12914
|
+
}).option("json", {
|
|
12915
|
+
alias: "j",
|
|
12916
|
+
type: "boolean",
|
|
12917
|
+
default: false,
|
|
12918
|
+
description: "JSON 输出"
|
|
12919
|
+
}).option("quiet", {
|
|
12920
|
+
alias: "q",
|
|
12921
|
+
type: "boolean",
|
|
12922
|
+
default: false,
|
|
12923
|
+
description: "简洁输出"
|
|
12924
|
+
}),
|
|
12925
|
+
async handler(args) {
|
|
12926
|
+
const output = new OutputService;
|
|
12927
|
+
const envService = new EnvironmentService(output);
|
|
12928
|
+
try {
|
|
12929
|
+
await envService.create({ configPath: args.config });
|
|
12930
|
+
const env = envService.getEnvironment();
|
|
12931
|
+
if (!env) {
|
|
12932
|
+
output.error("Failed to create environment");
|
|
12933
|
+
process.exit(1);
|
|
12934
|
+
}
|
|
12935
|
+
const promptComponent = env.getComponent("prompt");
|
|
12936
|
+
if (!promptComponent) {
|
|
12937
|
+
output.error("PromptComponent not available");
|
|
12938
|
+
process.exit(1);
|
|
12939
|
+
}
|
|
12940
|
+
let prompts = promptComponent.listEntries().map((entry) => ({
|
|
12941
|
+
name: entry.name,
|
|
12942
|
+
source: entry.source
|
|
12943
|
+
}));
|
|
12944
|
+
if (args.source && args.source !== "all") {
|
|
12945
|
+
prompts = prompts.filter((p) => p.source === args.source);
|
|
12946
|
+
}
|
|
12947
|
+
if (args.json) {
|
|
12948
|
+
output.json({
|
|
12949
|
+
prompts: prompts.map((p) => ({
|
|
12950
|
+
name: p.name,
|
|
12951
|
+
source: p.source
|
|
12952
|
+
})),
|
|
12953
|
+
count: prompts.length
|
|
12954
|
+
});
|
|
12955
|
+
} else if (args.quiet) {
|
|
12956
|
+
prompts.forEach((p) => output.log(p.name));
|
|
12957
|
+
} else {
|
|
12958
|
+
const header = [
|
|
12959
|
+
chalk33.bold("Name"),
|
|
12960
|
+
chalk33.bold("Source")
|
|
12961
|
+
].join(" | ");
|
|
12962
|
+
const rows = prompts.map((p) => {
|
|
12963
|
+
return [
|
|
12964
|
+
chalk33.cyan(p.name),
|
|
12965
|
+
chalk33.gray(`[${p.source}]`)
|
|
12966
|
+
].join(" | ");
|
|
12967
|
+
});
|
|
12968
|
+
if (rows.length === 0) {
|
|
12969
|
+
output.log(chalk33.yellow("No prompts found."));
|
|
12970
|
+
} else {
|
|
12971
|
+
output.log([
|
|
12972
|
+
`┌─ Prompts ${"─".repeat(50)}┐`,
|
|
12973
|
+
`│${header}│`,
|
|
12974
|
+
"├" + "─".repeat(header.length + 2) + "┤",
|
|
12975
|
+
...rows.map((r) => `│${r}│`),
|
|
12976
|
+
"└" + "─".repeat(header.length + 2) + "┘",
|
|
12977
|
+
"",
|
|
12978
|
+
chalk33.gray(`Total: ${prompts.length} prompts`)
|
|
12979
|
+
].join(`
|
|
12980
|
+
`));
|
|
12981
|
+
}
|
|
12982
|
+
}
|
|
12983
|
+
} catch (error) {
|
|
12984
|
+
output.error(`Failed to list prompts: ${error}`);
|
|
12985
|
+
process.exit(1);
|
|
12986
|
+
} finally {
|
|
12987
|
+
await envService.dispose();
|
|
12988
|
+
}
|
|
12989
|
+
}
|
|
12990
|
+
};
|
|
12991
|
+
|
|
12992
|
+
// src/commands/prompt/get.ts
|
|
12993
|
+
import chalk34 from "chalk";
|
|
12994
|
+
var GetCommand5 = {
|
|
12995
|
+
command: "get <name>",
|
|
12996
|
+
describe: "获取指定 prompt 的内容",
|
|
12997
|
+
builder: (yargs) => yargs.positional("name", {
|
|
12998
|
+
type: "string",
|
|
12999
|
+
describe: "Prompt 名称",
|
|
13000
|
+
demandOption: true
|
|
13001
|
+
}).option("json", {
|
|
13002
|
+
alias: "j",
|
|
13003
|
+
type: "boolean",
|
|
13004
|
+
default: false,
|
|
13005
|
+
description: "JSON 输出"
|
|
13006
|
+
}).option("var", {
|
|
13007
|
+
alias: "v",
|
|
13008
|
+
type: "string",
|
|
13009
|
+
array: true,
|
|
13010
|
+
description: "变量替换,格式:key=value"
|
|
13011
|
+
}),
|
|
13012
|
+
async handler(args) {
|
|
13013
|
+
const output = new OutputService;
|
|
13014
|
+
const envService = new EnvironmentService(output);
|
|
13015
|
+
try {
|
|
13016
|
+
await envService.create({ configPath: args.config });
|
|
13017
|
+
const env = envService.getEnvironment();
|
|
13018
|
+
if (!env) {
|
|
13019
|
+
output.error("Failed to create environment");
|
|
13020
|
+
process.exit(1);
|
|
13021
|
+
}
|
|
13022
|
+
const promptComponent = env.getComponent("prompt");
|
|
13023
|
+
if (!promptComponent) {
|
|
13024
|
+
output.error("PromptComponent not available");
|
|
13025
|
+
process.exit(1);
|
|
13026
|
+
}
|
|
13027
|
+
const vars = parseVars(args.var);
|
|
13028
|
+
const prompt = await promptComponent.getPrompt(args.name, vars);
|
|
13029
|
+
if (!prompt) {
|
|
13030
|
+
output.error(`Prompt not found: ${args.name}`);
|
|
13031
|
+
process.exit(1);
|
|
13032
|
+
}
|
|
13033
|
+
if (args.json) {
|
|
13034
|
+
output.json({
|
|
13035
|
+
name: args.name,
|
|
13036
|
+
content: prompt,
|
|
13037
|
+
variables: vars
|
|
13038
|
+
});
|
|
13039
|
+
} else {
|
|
13040
|
+
output.log(chalk34.bold.cyan(`# Prompt: ${args.name}`));
|
|
13041
|
+
output.log("");
|
|
13042
|
+
if (Object.keys(vars).length > 0) {
|
|
13043
|
+
output.log(chalk34.gray("Variables:"));
|
|
13044
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
13045
|
+
output.log(` ${chalk34.cyan(key + ":")} ${value}`);
|
|
13046
|
+
}
|
|
13047
|
+
output.log("");
|
|
13048
|
+
}
|
|
13049
|
+
output.log(chalk34.bold("Content:"));
|
|
13050
|
+
output.log("─".repeat(60));
|
|
13051
|
+
output.log(prompt);
|
|
13052
|
+
output.log("─".repeat(60));
|
|
13053
|
+
}
|
|
13054
|
+
} catch (error) {
|
|
13055
|
+
output.error(`Failed to get prompt: ${error}`);
|
|
13056
|
+
process.exit(1);
|
|
13057
|
+
} finally {
|
|
13058
|
+
await envService.dispose();
|
|
13059
|
+
}
|
|
13060
|
+
}
|
|
13061
|
+
};
|
|
13062
|
+
function parseVars(vars) {
|
|
13063
|
+
const result = {};
|
|
13064
|
+
if (!vars)
|
|
13065
|
+
return result;
|
|
13066
|
+
for (const v of vars) {
|
|
13067
|
+
const idx = v.indexOf("=");
|
|
13068
|
+
if (idx > 0) {
|
|
13069
|
+
const key = v.substring(0, idx);
|
|
13070
|
+
const value = v.substring(idx + 1);
|
|
13071
|
+
result[key] = value;
|
|
13072
|
+
}
|
|
13073
|
+
}
|
|
13074
|
+
return result;
|
|
13075
|
+
}
|
|
13076
|
+
|
|
13077
|
+
// src/commands/prompt/add.ts
|
|
13078
|
+
import { readFile } from "fs/promises";
|
|
13079
|
+
import chalk35 from "chalk";
|
|
13080
|
+
var AddCommand2 = {
|
|
13081
|
+
command: "add <name>",
|
|
13082
|
+
describe: "添加 prompt 并持久化到 ~/.local/share/roy-agent/prompts/",
|
|
13083
|
+
builder: (yargs) => yargs.positional("name", {
|
|
13084
|
+
type: "string",
|
|
13085
|
+
describe: "Prompt 名称",
|
|
13086
|
+
demandOption: true
|
|
13087
|
+
}).option("file", {
|
|
13088
|
+
alias: "f",
|
|
13089
|
+
type: "string",
|
|
13090
|
+
description: "从文件读取 prompt 内容"
|
|
13091
|
+
}).option("content", {
|
|
13092
|
+
alias: "c",
|
|
13093
|
+
type: "string",
|
|
13094
|
+
description: "直接指定 prompt 内容"
|
|
13095
|
+
}).option("json", {
|
|
13096
|
+
alias: "j",
|
|
13097
|
+
type: "boolean",
|
|
13098
|
+
default: false,
|
|
13099
|
+
description: "JSON 输出"
|
|
13100
|
+
}),
|
|
13101
|
+
async handler(args) {
|
|
13102
|
+
const output = new OutputService;
|
|
13103
|
+
const envService = new EnvironmentService(output);
|
|
13104
|
+
try {
|
|
13105
|
+
if (!args.file && !args.content) {
|
|
13106
|
+
output.error("Either --file or --content is required");
|
|
13107
|
+
process.exit(1);
|
|
13108
|
+
}
|
|
13109
|
+
await envService.create({ configPath: args.config });
|
|
13110
|
+
const env = envService.getEnvironment();
|
|
13111
|
+
if (!env) {
|
|
13112
|
+
output.error("Failed to create environment");
|
|
13113
|
+
process.exit(1);
|
|
13114
|
+
}
|
|
13115
|
+
const promptComponent = env.getComponent("prompt");
|
|
13116
|
+
if (!promptComponent) {
|
|
13117
|
+
output.error("PromptComponent not available");
|
|
13118
|
+
process.exit(1);
|
|
13119
|
+
}
|
|
13120
|
+
const content = args.file ? await readFile(args.file, "utf-8") : args.content;
|
|
13121
|
+
const filePath = await promptComponent.savePrompt(args.name, content);
|
|
13122
|
+
if (args.json) {
|
|
13123
|
+
output.json({
|
|
13124
|
+
name: args.name,
|
|
13125
|
+
source: "file",
|
|
13126
|
+
filePath,
|
|
13127
|
+
length: content.trim().length
|
|
13128
|
+
});
|
|
13129
|
+
} else {
|
|
13130
|
+
output.log(chalk35.green(`✓ Prompt '${args.name}' saved`));
|
|
13131
|
+
output.log(chalk35.gray(` ${filePath}`));
|
|
13132
|
+
}
|
|
13133
|
+
} catch (error) {
|
|
13134
|
+
output.error(`Failed to add prompt: ${error}`);
|
|
13135
|
+
process.exit(1);
|
|
13136
|
+
} finally {
|
|
13137
|
+
await envService.dispose();
|
|
13138
|
+
}
|
|
13139
|
+
}
|
|
13140
|
+
};
|
|
13141
|
+
|
|
13142
|
+
// src/commands/prompt/config-dir.ts
|
|
13143
|
+
import chalk36 from "chalk";
|
|
13144
|
+
var ConfigDirCommand2 = {
|
|
13145
|
+
command: "config-dir",
|
|
13146
|
+
describe: "显示 prompt 持久化目录路径",
|
|
13147
|
+
builder: (yargs) => yargs.option("json", {
|
|
13148
|
+
alias: "j",
|
|
13149
|
+
type: "boolean",
|
|
13150
|
+
default: false,
|
|
13151
|
+
description: "JSON 输出"
|
|
13152
|
+
}),
|
|
13153
|
+
async handler(args) {
|
|
13154
|
+
const output = new OutputService;
|
|
13155
|
+
const envService = new EnvironmentService(output);
|
|
13156
|
+
try {
|
|
13157
|
+
await envService.create({ configPath: args.config });
|
|
13158
|
+
const env = envService.getEnvironment();
|
|
13159
|
+
if (!env) {
|
|
13160
|
+
output.error("Failed to create environment");
|
|
13161
|
+
process.exit(1);
|
|
13162
|
+
}
|
|
13163
|
+
const promptComponent = env.getComponent("prompt");
|
|
13164
|
+
if (!promptComponent) {
|
|
13165
|
+
output.error("PromptComponent not available");
|
|
13166
|
+
process.exit(1);
|
|
13167
|
+
}
|
|
13168
|
+
const configDir = promptComponent.getPromptConfigDir();
|
|
13169
|
+
const exists = promptComponent.getPromptStore().configDirExists();
|
|
13170
|
+
if (args.json) {
|
|
13171
|
+
output.json({ configDir, exists });
|
|
13172
|
+
} else {
|
|
13173
|
+
output.log(`${chalk36.cyan("Prompt Config Directory:")} ${configDir}`);
|
|
13174
|
+
output.log(`${chalk36.gray("Exists:")} ${exists ? "yes" : "no"}`);
|
|
13175
|
+
}
|
|
13176
|
+
} catch (error) {
|
|
13177
|
+
output.error(`Failed to get config dir: ${error}`);
|
|
13178
|
+
process.exit(1);
|
|
13179
|
+
} finally {
|
|
13180
|
+
await envService.dispose();
|
|
13181
|
+
}
|
|
13182
|
+
}
|
|
13183
|
+
};
|
|
13184
|
+
|
|
13185
|
+
// src/commands/prompt/index.ts
|
|
13186
|
+
var PromptCommand = {
|
|
13187
|
+
command: "prompt",
|
|
13188
|
+
describe: "Prompt 管理 - 列出、获取、添加 prompt",
|
|
13189
|
+
builder: (yargs) => yargs.command(ListCommand5).command(GetCommand5).command(AddCommand2).command(ConfigDirCommand2).demandCommand().help(),
|
|
13190
|
+
handler: () => {
|
|
13191
|
+
console.log("Use 'roy-agent prompt --help' for usage information");
|
|
13192
|
+
}
|
|
13193
|
+
};
|
|
13194
|
+
|
|
13195
|
+
// src/commands/commands-list.ts
|
|
13196
|
+
import chalk37 from "chalk";
|
|
13197
|
+
function truncateVisual(str, maxWidth) {
|
|
13198
|
+
let result = "";
|
|
13199
|
+
let width = 0;
|
|
13200
|
+
for (const char of str) {
|
|
13201
|
+
const charWidth = char.charCodeAt(0) > 255 ? 2 : 1;
|
|
13202
|
+
if (width + charWidth > maxWidth)
|
|
13203
|
+
break;
|
|
13204
|
+
result += char;
|
|
13205
|
+
width += charWidth;
|
|
13206
|
+
}
|
|
13207
|
+
return result;
|
|
13208
|
+
}
|
|
13209
|
+
function formatCommandsTable(commands) {
|
|
13210
|
+
if (commands.length === 0) {
|
|
13211
|
+
return chalk37.yellow("命令目录为空,使用 'roy-agent commands add' 添加命令");
|
|
13212
|
+
}
|
|
13213
|
+
const NAME_WIDTH = 20;
|
|
13214
|
+
const SOURCE_WIDTH = 10;
|
|
13215
|
+
const DESC_WIDTH = 50;
|
|
13216
|
+
const GAP = " ";
|
|
13217
|
+
const headerLine = [
|
|
13218
|
+
chalk37.bold("NAME".padEnd(NAME_WIDTH)),
|
|
13219
|
+
chalk37.bold("SOURCE".padEnd(SOURCE_WIDTH)),
|
|
13220
|
+
chalk37.bold("DESCRIPTION")
|
|
13221
|
+
].join(GAP);
|
|
13222
|
+
const sepLine = "─".repeat(NAME_WIDTH + SOURCE_WIDTH + DESC_WIDTH + GAP.length * 2);
|
|
13223
|
+
const formatRow = (cmd) => {
|
|
13224
|
+
const name = truncateVisual(cmd.name, NAME_WIDTH).padEnd(NAME_WIDTH);
|
|
13225
|
+
const source = cmd.source.padEnd(SOURCE_WIDTH);
|
|
13226
|
+
const desc = truncateVisual(cmd.description || "-", DESC_WIDTH);
|
|
13227
|
+
return `${name}${GAP}${source}${GAP}${desc}`;
|
|
13228
|
+
};
|
|
13229
|
+
const rows = commands.map(formatRow);
|
|
13230
|
+
return [headerLine, sepLine, ...rows].join(`
|
|
13231
|
+
`);
|
|
13232
|
+
}
|
|
13233
|
+
var CommandsListCommand = {
|
|
13234
|
+
command: "list [pattern]",
|
|
13235
|
+
describe: "列出收藏的命令(支持 glob 过滤)",
|
|
13236
|
+
builder: (yargs) => yargs.positional("pattern", {
|
|
13237
|
+
describe: "glob 过滤模式",
|
|
13238
|
+
type: "string"
|
|
13239
|
+
}).option("json", {
|
|
13240
|
+
alias: "j",
|
|
13241
|
+
describe: "JSON 格式输出",
|
|
13242
|
+
type: "boolean",
|
|
13243
|
+
default: false
|
|
13244
|
+
}).option("config", {
|
|
13245
|
+
describe: "配置文件路径",
|
|
13246
|
+
type: "string"
|
|
13247
|
+
}),
|
|
13248
|
+
async handler(args) {
|
|
13249
|
+
const output = new OutputService;
|
|
13250
|
+
const envService = new EnvironmentService(output);
|
|
13251
|
+
try {
|
|
13252
|
+
await envService.create({ configPath: args.config });
|
|
13253
|
+
const env = envService.getEnvironment();
|
|
13254
|
+
if (!env) {
|
|
13255
|
+
output.error("Failed to create environment");
|
|
13256
|
+
process.exit(1);
|
|
13257
|
+
}
|
|
13258
|
+
const commandsComponent = env.getComponent("commands");
|
|
13259
|
+
if (!commandsComponent) {
|
|
13260
|
+
output.error("CommandsComponent not available");
|
|
13261
|
+
process.exit(1);
|
|
13262
|
+
}
|
|
13263
|
+
const result = await commandsComponent.discover({ pattern: args.pattern });
|
|
13264
|
+
if (args.json) {
|
|
13265
|
+
output.json({
|
|
13266
|
+
commands: result.commands.map((cmd) => ({
|
|
13267
|
+
name: cmd.name,
|
|
13268
|
+
path: cmd.path,
|
|
13269
|
+
source: cmd.source,
|
|
13270
|
+
description: cmd.shortDescription
|
|
13271
|
+
})),
|
|
13272
|
+
stats: result.stats
|
|
13273
|
+
});
|
|
13274
|
+
} else {
|
|
13275
|
+
const rows = result.commands.map((cmd) => ({
|
|
13276
|
+
name: cmd.name,
|
|
13277
|
+
path: cmd.path,
|
|
13278
|
+
source: cmd.source === "user" ? "USER" : "PROJECT",
|
|
13279
|
+
description: cmd.shortDescription || "-"
|
|
13280
|
+
}));
|
|
13281
|
+
output.log(formatCommandsTable(rows));
|
|
13282
|
+
output.info("");
|
|
13283
|
+
output.log(chalk37.green(`✅ 共 ${result.commands.length} 个命令`) + chalk37.gray(` (user: ${result.stats.userCount}, project: ${result.stats.projectCount})`));
|
|
13284
|
+
}
|
|
13285
|
+
} catch (error) {
|
|
13286
|
+
output.error(`Failed to list commands: ${error}`);
|
|
13287
|
+
process.exit(1);
|
|
13288
|
+
} finally {
|
|
13289
|
+
await envService.dispose();
|
|
13290
|
+
}
|
|
13291
|
+
}
|
|
13292
|
+
};
|
|
13293
|
+
|
|
13294
|
+
// src/commands/commands-add.ts
|
|
13295
|
+
import chalk38 from "chalk";
|
|
13296
|
+
var CommandsAddCommand = {
|
|
13297
|
+
command: "add <name> <target>",
|
|
13298
|
+
describe: "添加收藏命令(自动创建 symlink)",
|
|
13299
|
+
builder: (yargs) => yargs.positional("name", {
|
|
13300
|
+
describe: "命令名称",
|
|
13301
|
+
type: "string",
|
|
13302
|
+
demandOption: true
|
|
13303
|
+
}).positional("target", {
|
|
13304
|
+
describe: "目标命令路径或名称",
|
|
13305
|
+
type: "string",
|
|
13306
|
+
demandOption: true
|
|
13307
|
+
}).option("global", {
|
|
13308
|
+
alias: "g",
|
|
13309
|
+
describe: "添加到用户级别目录(默认)",
|
|
13310
|
+
type: "boolean",
|
|
13311
|
+
default: true
|
|
13312
|
+
}).option("local", {
|
|
13313
|
+
alias: "l",
|
|
13314
|
+
describe: "添加到项目级别目录",
|
|
13315
|
+
type: "boolean",
|
|
13316
|
+
default: false
|
|
13317
|
+
}).option("description", {
|
|
13318
|
+
alias: "d",
|
|
13319
|
+
describe: "命令功能描述(用于 AI Prompt 注入)",
|
|
13320
|
+
type: "string",
|
|
13321
|
+
demandOption: true
|
|
13322
|
+
}).option("tips", {
|
|
13323
|
+
alias: "t",
|
|
13324
|
+
describe: "探索提示(告诉用户如何使用 --help 探索)",
|
|
13325
|
+
type: "string",
|
|
13326
|
+
demandOption: true
|
|
13327
|
+
}).option("config", {
|
|
13328
|
+
describe: "配置文件路径",
|
|
13329
|
+
type: "string"
|
|
13330
|
+
}),
|
|
13331
|
+
async handler(args) {
|
|
13332
|
+
const output = new OutputService;
|
|
13333
|
+
const envService = new EnvironmentService(output);
|
|
13334
|
+
try {
|
|
13335
|
+
await envService.create({ configPath: args.config });
|
|
13336
|
+
const env = envService.getEnvironment();
|
|
13337
|
+
if (!env) {
|
|
13338
|
+
output.error("Failed to create environment");
|
|
13339
|
+
process.exit(1);
|
|
13340
|
+
}
|
|
13341
|
+
const commandsComponent = env.getComponent("commands");
|
|
13342
|
+
if (!commandsComponent) {
|
|
13343
|
+
output.error("CommandsComponent not available");
|
|
13344
|
+
process.exit(1);
|
|
13345
|
+
}
|
|
13346
|
+
const source = args.local ? "project" : "user";
|
|
13347
|
+
await commandsComponent.add({
|
|
13348
|
+
name: args.name,
|
|
13349
|
+
target: args.target,
|
|
13350
|
+
source,
|
|
13351
|
+
description: args.description,
|
|
13352
|
+
tips: args.tips
|
|
13353
|
+
});
|
|
13354
|
+
const dirs = await commandsComponent.getCommandDirs();
|
|
13355
|
+
const targetDir = source === "user" ? dirs.user : dirs.project;
|
|
13356
|
+
output.log(chalk38.green(`✅ 已添加命令 '${args.name}'`));
|
|
13357
|
+
output.log(chalk38.gray(` 目标: ${args.target}`));
|
|
13358
|
+
output.log(chalk38.gray(` 位置: ${targetDir}/${args.name}`));
|
|
13359
|
+
output.log(chalk38.gray(` 级别: ${source === "user" ? "USER" : "PROJECT"}`));
|
|
13360
|
+
} catch (error) {
|
|
13361
|
+
output.error(`添加失败: ${error.message}`);
|
|
13362
|
+
process.exit(1);
|
|
13363
|
+
} finally {
|
|
13364
|
+
await envService.dispose();
|
|
13365
|
+
}
|
|
13366
|
+
}
|
|
13367
|
+
};
|
|
13368
|
+
|
|
13369
|
+
// src/commands/commands-remove.ts
|
|
13370
|
+
import chalk39 from "chalk";
|
|
13371
|
+
var CommandsRemoveCommand = {
|
|
13372
|
+
command: "remove <name>",
|
|
13373
|
+
aliases: ["rm"],
|
|
13374
|
+
describe: "移除收藏命令",
|
|
13375
|
+
builder: (yargs) => yargs.positional("name", {
|
|
13376
|
+
describe: "命令名称",
|
|
13377
|
+
type: "string",
|
|
13378
|
+
demandOption: true
|
|
13379
|
+
}).option("global", {
|
|
13380
|
+
alias: "g",
|
|
13381
|
+
describe: "从用户级别目录移除",
|
|
13382
|
+
type: "boolean",
|
|
13383
|
+
default: false
|
|
13384
|
+
}).option("local", {
|
|
13385
|
+
alias: "l",
|
|
13386
|
+
describe: "从项目级别目录移除",
|
|
13387
|
+
type: "boolean",
|
|
13388
|
+
default: false
|
|
13389
|
+
}).option("config", {
|
|
13390
|
+
describe: "配置文件路径",
|
|
13391
|
+
type: "string"
|
|
13392
|
+
}),
|
|
13393
|
+
async handler(args) {
|
|
13394
|
+
const output = new OutputService;
|
|
13395
|
+
const envService = new EnvironmentService(output);
|
|
13396
|
+
try {
|
|
13397
|
+
await envService.create({ configPath: args.config });
|
|
13398
|
+
const env = envService.getEnvironment();
|
|
13399
|
+
if (!env) {
|
|
13400
|
+
output.error("Failed to create environment");
|
|
13401
|
+
process.exit(1);
|
|
13402
|
+
}
|
|
13403
|
+
const commandsComponent = env.getComponent("commands");
|
|
13404
|
+
if (!commandsComponent) {
|
|
13405
|
+
output.error("CommandsComponent not available");
|
|
13406
|
+
process.exit(1);
|
|
13407
|
+
}
|
|
13408
|
+
if (args.global) {
|
|
13409
|
+
try {
|
|
13410
|
+
await commandsComponent.remove({
|
|
13411
|
+
name: args.name,
|
|
13412
|
+
source: "user"
|
|
13413
|
+
});
|
|
13414
|
+
output.log(chalk39.green(`✅ 已从用户目录移除命令 '${args.name}'`));
|
|
13415
|
+
} catch (error) {
|
|
12576
13416
|
if (!error.message?.includes("不存在")) {
|
|
12577
13417
|
throw error;
|
|
12578
13418
|
}
|
|
@@ -12584,7 +13424,7 @@ var CommandsRemoveCommand = {
|
|
|
12584
13424
|
name: args.name,
|
|
12585
13425
|
source: "project"
|
|
12586
13426
|
});
|
|
12587
|
-
output.log(
|
|
13427
|
+
output.log(chalk39.green(`✅ 已从项目目录移除命令 '${args.name}'`));
|
|
12588
13428
|
} catch (error) {
|
|
12589
13429
|
if (!error.message?.includes("不存在")) {
|
|
12590
13430
|
throw error;
|
|
@@ -12598,7 +13438,7 @@ var CommandsRemoveCommand = {
|
|
|
12598
13438
|
name: args.name,
|
|
12599
13439
|
source: "user"
|
|
12600
13440
|
});
|
|
12601
|
-
output.log(
|
|
13441
|
+
output.log(chalk39.green(`✅ 已从用户目录移除命令 '${args.name}'`));
|
|
12602
13442
|
removed = true;
|
|
12603
13443
|
} catch (error) {
|
|
12604
13444
|
if (!error.message?.includes("不存在")) {
|
|
@@ -12610,7 +13450,7 @@ var CommandsRemoveCommand = {
|
|
|
12610
13450
|
name: args.name,
|
|
12611
13451
|
source: "project"
|
|
12612
13452
|
});
|
|
12613
|
-
output.log(
|
|
13453
|
+
output.log(chalk39.green(`✅ 已从项目目录移除命令 '${args.name}'`));
|
|
12614
13454
|
removed = true;
|
|
12615
13455
|
} catch (error) {
|
|
12616
13456
|
if (!error.message?.includes("不存在")) {
|
|
@@ -12632,7 +13472,7 @@ var CommandsRemoveCommand = {
|
|
|
12632
13472
|
};
|
|
12633
13473
|
|
|
12634
13474
|
// src/commands/commands-info.ts
|
|
12635
|
-
import
|
|
13475
|
+
import chalk40 from "chalk";
|
|
12636
13476
|
import { exec } from "child_process";
|
|
12637
13477
|
import { promisify } from "util";
|
|
12638
13478
|
var execAsync = promisify(exec);
|
|
@@ -12667,12 +13507,12 @@ var CommandsInfoCommand = {
|
|
|
12667
13507
|
output.error(`命令 '${args.name}' 不存在`);
|
|
12668
13508
|
process.exit(1);
|
|
12669
13509
|
}
|
|
12670
|
-
output.log(
|
|
12671
|
-
output.log(
|
|
12672
|
-
output.log(
|
|
12673
|
-
output.log(
|
|
13510
|
+
output.log(chalk40.bold("Name:") + ` ${info.name}`);
|
|
13511
|
+
output.log(chalk40.bold("Path:") + ` ${info.path}`);
|
|
13512
|
+
output.log(chalk40.bold("Source:") + ` ${info.source.toUpperCase()}`);
|
|
13513
|
+
output.log(chalk40.bold("Description:") + ` ${info.shortDescription || "-"}`);
|
|
12674
13514
|
output.log();
|
|
12675
|
-
output.log(
|
|
13515
|
+
output.log(chalk40.gray("─".repeat(50)));
|
|
12676
13516
|
output.log();
|
|
12677
13517
|
try {
|
|
12678
13518
|
const { stdout } = await execAsync(`${info.path} --help`, { timeout: 5000 });
|
|
@@ -12682,7 +13522,7 @@ var CommandsInfoCommand = {
|
|
|
12682
13522
|
const { stdout } = await execAsync(`${info.path} -h`, { timeout: 5000 });
|
|
12683
13523
|
output.log(stdout);
|
|
12684
13524
|
} catch {
|
|
12685
|
-
output.log(
|
|
13525
|
+
output.log(chalk40.gray("(无法获取帮助信息)"));
|
|
12686
13526
|
}
|
|
12687
13527
|
}
|
|
12688
13528
|
} catch (error) {
|
|
@@ -12695,7 +13535,7 @@ var CommandsInfoCommand = {
|
|
|
12695
13535
|
};
|
|
12696
13536
|
|
|
12697
13537
|
// src/commands/commands-dirs.ts
|
|
12698
|
-
import
|
|
13538
|
+
import chalk41 from "chalk";
|
|
12699
13539
|
var CommandsDirsCommand = {
|
|
12700
13540
|
command: "dirs",
|
|
12701
13541
|
describe: "显示命令目录",
|
|
@@ -12727,10 +13567,10 @@ var CommandsDirsCommand = {
|
|
|
12727
13567
|
if (args.json) {
|
|
12728
13568
|
output.json(dirs);
|
|
12729
13569
|
} else {
|
|
12730
|
-
output.log(
|
|
13570
|
+
output.log(chalk41.bold("命令目录:"));
|
|
12731
13571
|
output.log();
|
|
12732
|
-
output.log(
|
|
12733
|
-
output.log(
|
|
13572
|
+
output.log(chalk41.cyan("USER:") + ` ${dirs.user}`);
|
|
13573
|
+
output.log(chalk41.cyan("PROJECT:") + ` ${dirs.project}`);
|
|
12734
13574
|
}
|
|
12735
13575
|
} catch (error) {
|
|
12736
13576
|
output.error(`错误: ${error.message}`);
|
|
@@ -12750,7 +13590,7 @@ var CommandsCommand = {
|
|
|
12750
13590
|
};
|
|
12751
13591
|
|
|
12752
13592
|
// src/commands/config/list.ts
|
|
12753
|
-
import
|
|
13593
|
+
import chalk42 from "chalk";
|
|
12754
13594
|
|
|
12755
13595
|
// src/commands/config/config-service.ts
|
|
12756
13596
|
import * as fsSync from "fs";
|
|
@@ -12779,6 +13619,7 @@ function deepMerge(target, source) {
|
|
|
12779
13619
|
class ConfigService {
|
|
12780
13620
|
configComponent;
|
|
12781
13621
|
output;
|
|
13622
|
+
envService;
|
|
12782
13623
|
constructor(configComponent, output) {
|
|
12783
13624
|
this.configComponent = configComponent;
|
|
12784
13625
|
this.output = output;
|
|
@@ -12961,11 +13802,16 @@ var SUPPORTED_COMPONENTS = [
|
|
|
12961
13802
|
"mcp",
|
|
12962
13803
|
"agent",
|
|
12963
13804
|
"log-trace",
|
|
12964
|
-
"lsp"
|
|
13805
|
+
"lsp",
|
|
13806
|
+
"prompt"
|
|
12965
13807
|
];
|
|
12966
13808
|
var COMPONENT_ALIASES = {
|
|
12967
13809
|
session: "session",
|
|
12968
|
-
sessions: "session"
|
|
13810
|
+
sessions: "session",
|
|
13811
|
+
agents: "agent",
|
|
13812
|
+
agent: "agent",
|
|
13813
|
+
prompts: "prompt",
|
|
13814
|
+
prompt: "prompt"
|
|
12969
13815
|
};
|
|
12970
13816
|
function resolveComponentName(name) {
|
|
12971
13817
|
return COMPONENT_ALIASES[name] ?? name;
|
|
@@ -12981,7 +13827,8 @@ var COMPONENT_DESCRIPTIONS = {
|
|
|
12981
13827
|
mcp: "MCP Component - MCP 服务器管理",
|
|
12982
13828
|
agent: "Agent Component - Agent 配置和循环控制",
|
|
12983
13829
|
"log-trace": "LogTrace Component - 日志和追踪管理",
|
|
12984
|
-
lsp: "LSP Component - 语言服务器协议管理"
|
|
13830
|
+
lsp: "LSP Component - 语言服务器协议管理",
|
|
13831
|
+
prompt: "Prompt Component - Prompt 模板管理"
|
|
12985
13832
|
};
|
|
12986
13833
|
|
|
12987
13834
|
// src/commands/config/list.ts
|
|
@@ -13032,6 +13879,7 @@ var ConfigListCommand = {
|
|
|
13032
13879
|
process.exit(1);
|
|
13033
13880
|
}
|
|
13034
13881
|
const configService = new ConfigService(configComponent, output);
|
|
13882
|
+
configService.envService = envService;
|
|
13035
13883
|
if (!args.component) {
|
|
13036
13884
|
showHelp(output);
|
|
13037
13885
|
return;
|
|
@@ -13046,7 +13894,7 @@ var ConfigListCommand = {
|
|
|
13046
13894
|
output.log("");
|
|
13047
13895
|
output.log("Supported components:");
|
|
13048
13896
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
13049
|
-
output.log(` ${
|
|
13897
|
+
output.log(` ${chalk42.cyan(comp.padEnd(15))} ${COMPONENT_DESCRIPTIONS[comp] || ""}`);
|
|
13050
13898
|
}
|
|
13051
13899
|
process.exit(1);
|
|
13052
13900
|
}
|
|
@@ -13064,27 +13912,27 @@ var ConfigListCommand = {
|
|
|
13064
13912
|
}
|
|
13065
13913
|
};
|
|
13066
13914
|
function showHelp(output) {
|
|
13067
|
-
output.log(
|
|
13915
|
+
output.log(chalk42.bold.cyan("# roy-agent config list"));
|
|
13068
13916
|
output.log("");
|
|
13069
13917
|
output.log("查看 roy-agent 组件配置信息");
|
|
13070
13918
|
output.log("");
|
|
13071
|
-
output.log(
|
|
13072
|
-
output.log(` ${
|
|
13919
|
+
output.log(chalk42.bold("Usage:"));
|
|
13920
|
+
output.log(` ${chalk42.cyan("roy-agent config list [component] [options]")}`);
|
|
13073
13921
|
output.log("");
|
|
13074
|
-
output.log(
|
|
13922
|
+
output.log(chalk42.bold("Components:"));
|
|
13075
13923
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
13076
|
-
output.log(` ${
|
|
13924
|
+
output.log(` ${chalk42.cyan(comp.padEnd(15))} ${chalk42.gray(COMPONENT_DESCRIPTIONS[comp] || "")}`);
|
|
13077
13925
|
}
|
|
13078
|
-
output.log(` ${
|
|
13926
|
+
output.log(` ${chalk42.cyan("all".padEnd(15))} 显示所有 components 概览`);
|
|
13079
13927
|
output.log("");
|
|
13080
|
-
output.log(
|
|
13081
|
-
output.log(` ${
|
|
13082
|
-
output.log(` ${
|
|
13083
|
-
output.log(` ${
|
|
13928
|
+
output.log(chalk42.bold("Options:"));
|
|
13929
|
+
output.log(` ${chalk42.cyan("-j, --json")} JSON 格式输出`);
|
|
13930
|
+
output.log(` ${chalk42.cyan("-k, --keys")} 只显示配置键`);
|
|
13931
|
+
output.log(` ${chalk42.cyan("-s, --sources")} 只显示配置源`);
|
|
13084
13932
|
output.log("");
|
|
13085
|
-
output.log(
|
|
13933
|
+
output.log(chalk42.bold("Examples:"));
|
|
13086
13934
|
for (const { command, description } of USAGE_COMMANDS) {
|
|
13087
|
-
output.log(` ${
|
|
13935
|
+
output.log(` ${chalk42.cyan(command.padEnd(40))} ${chalk42.gray(description)}`);
|
|
13088
13936
|
}
|
|
13089
13937
|
}
|
|
13090
13938
|
async function showAllComponents(output, configService) {
|
|
@@ -13093,16 +13941,24 @@ async function showAllComponents(output, configService) {
|
|
|
13093
13941
|
const config = configService.getComponentConfig(compName);
|
|
13094
13942
|
components.push({ name: compName, config });
|
|
13095
13943
|
}
|
|
13096
|
-
output.log(
|
|
13944
|
+
output.log(chalk42.bold.cyan("# All Components Overview"));
|
|
13097
13945
|
output.log("");
|
|
13098
|
-
output.log(` ${
|
|
13099
|
-
output.log(` ${
|
|
13946
|
+
output.log(` ${chalk42.cyan("Component".padEnd(15))} ${chalk42.cyan("Keys".padEnd(10))} ${chalk42.gray("Description")}`);
|
|
13947
|
+
output.log(` ${chalk42.gray("─".repeat(60))}`);
|
|
13100
13948
|
for (const comp of components) {
|
|
13101
13949
|
const keyCount = Object.keys(comp.config).length;
|
|
13102
|
-
output.log(` ${
|
|
13950
|
+
output.log(` ${chalk42.cyan(comp.name.padEnd(15))} ${keyCount.toString().padEnd(10)} ${chalk42.gray(COMPONENT_DESCRIPTIONS[comp.name] || "")}`);
|
|
13103
13951
|
}
|
|
13104
13952
|
}
|
|
13105
13953
|
async function showComponentConfig(componentName, output, configService, options) {
|
|
13954
|
+
if (componentName === "agent") {
|
|
13955
|
+
await showAgentComponentConfig(output, configService, options);
|
|
13956
|
+
return;
|
|
13957
|
+
}
|
|
13958
|
+
if (componentName === "prompt") {
|
|
13959
|
+
await showPromptComponentConfig(output, configService, options, configService.envService);
|
|
13960
|
+
return;
|
|
13961
|
+
}
|
|
13106
13962
|
const config = configService.getComponentConfig(componentName);
|
|
13107
13963
|
const filePath = configService.getComponentFilePath(componentName);
|
|
13108
13964
|
if (options.json) {
|
|
@@ -13113,26 +13969,136 @@ async function showComponentConfig(componentName, output, configService, options
|
|
|
13113
13969
|
});
|
|
13114
13970
|
return;
|
|
13115
13971
|
}
|
|
13116
|
-
output.log(
|
|
13972
|
+
output.log(chalk42.bold.cyan(`# ${componentName} Component Configuration`));
|
|
13973
|
+
output.log("");
|
|
13974
|
+
if (filePath) {
|
|
13975
|
+
output.log(chalk42.bold("File:"));
|
|
13976
|
+
output.log(` ${chalk42.cyan(filePath)}`);
|
|
13977
|
+
output.log("");
|
|
13978
|
+
}
|
|
13979
|
+
if (!options.sources) {
|
|
13980
|
+
output.log(chalk42.bold("Configuration:"));
|
|
13981
|
+
if (Object.keys(config).length === 0) {
|
|
13982
|
+
output.log(` ${chalk42.gray("(无配置)")}`);
|
|
13983
|
+
} else {
|
|
13984
|
+
const flatConfig = flattenConfig(config);
|
|
13985
|
+
for (const [key, value] of flatConfig) {
|
|
13986
|
+
const displayValue = formatValue(value);
|
|
13987
|
+
output.log(` ${chalk42.cyan(key + ":")} ${displayValue}`);
|
|
13988
|
+
}
|
|
13989
|
+
}
|
|
13990
|
+
output.log("");
|
|
13991
|
+
}
|
|
13992
|
+
}
|
|
13993
|
+
async function showAgentComponentConfig(output, configService, options) {
|
|
13994
|
+
const config = configService.getComponentConfig("agent");
|
|
13995
|
+
if (options.json) {
|
|
13996
|
+
output.json({
|
|
13997
|
+
name: "agent",
|
|
13998
|
+
config
|
|
13999
|
+
});
|
|
14000
|
+
return;
|
|
14001
|
+
}
|
|
14002
|
+
output.log(chalk42.bold.cyan("# Agent Component Configuration"));
|
|
14003
|
+
output.log("");
|
|
14004
|
+
if (!options.sources) {
|
|
14005
|
+
output.log(chalk42.bold("Configuration:"));
|
|
14006
|
+
if (Object.keys(config).length === 0) {
|
|
14007
|
+
output.log(` ${chalk42.gray("(无配置,使用默认值)")}`);
|
|
14008
|
+
} else {
|
|
14009
|
+
const flatConfig = flattenConfig(config);
|
|
14010
|
+
for (const [key, value] of flatConfig) {
|
|
14011
|
+
const displayValue = formatValue(value);
|
|
14012
|
+
output.log(` ${chalk42.cyan(key + ":")} ${displayValue}`);
|
|
14013
|
+
}
|
|
14014
|
+
}
|
|
14015
|
+
output.log("");
|
|
14016
|
+
}
|
|
14017
|
+
const envService = configService.envService;
|
|
14018
|
+
const env = envService?.getEnvironment?.();
|
|
14019
|
+
if (env) {
|
|
14020
|
+
const agentComponent = env.getComponent?.("agent");
|
|
14021
|
+
const registry = agentComponent?.getRegistry?.();
|
|
14022
|
+
if (registry) {
|
|
14023
|
+
const configDir = registry.getConfigDir();
|
|
14024
|
+
const exists = registry.configDirExists();
|
|
14025
|
+
const agentCount = registry.list().length;
|
|
14026
|
+
output.log(chalk42.bold("Agent Config Directory:"));
|
|
14027
|
+
output.log(` ${chalk42.cyan("path:")} ${configDir}`);
|
|
14028
|
+
output.log(` ${chalk42.cyan("exists:")} ${exists ? chalk42.green("yes") : chalk42.red("no")}`);
|
|
14029
|
+
output.log(` ${chalk42.cyan("agents:")} ${agentCount} loaded`);
|
|
14030
|
+
output.log("");
|
|
14031
|
+
}
|
|
14032
|
+
}
|
|
14033
|
+
}
|
|
14034
|
+
async function showPromptComponentConfig(output, configService, options, envService) {
|
|
14035
|
+
const config = configService.getComponentConfig("prompt");
|
|
14036
|
+
const filePath = configService.getComponentFilePath("prompt");
|
|
14037
|
+
if (options.json) {
|
|
14038
|
+
output.json({
|
|
14039
|
+
name: "prompt",
|
|
14040
|
+
filePath,
|
|
14041
|
+
config
|
|
14042
|
+
});
|
|
14043
|
+
return;
|
|
14044
|
+
}
|
|
14045
|
+
output.log(chalk42.bold.cyan("# Prompt Component Configuration"));
|
|
13117
14046
|
output.log("");
|
|
13118
14047
|
if (filePath) {
|
|
13119
|
-
output.log(
|
|
13120
|
-
output.log(` ${
|
|
14048
|
+
output.log(chalk42.bold("File:"));
|
|
14049
|
+
output.log(` ${chalk42.cyan(filePath)}`);
|
|
13121
14050
|
output.log("");
|
|
13122
14051
|
}
|
|
13123
14052
|
if (!options.sources) {
|
|
13124
|
-
output.log(
|
|
14053
|
+
output.log(chalk42.bold("Configuration:"));
|
|
13125
14054
|
if (Object.keys(config).length === 0) {
|
|
13126
|
-
output.log(` ${
|
|
14055
|
+
output.log(` ${chalk42.gray("(无配置,使用默认值)")}`);
|
|
13127
14056
|
} else {
|
|
13128
14057
|
const flatConfig = flattenConfig(config);
|
|
13129
14058
|
for (const [key, value] of flatConfig) {
|
|
13130
14059
|
const displayValue = formatValue(value);
|
|
13131
|
-
output.log(` ${
|
|
14060
|
+
output.log(` ${chalk42.cyan(key + ":")} ${displayValue}`);
|
|
13132
14061
|
}
|
|
13133
14062
|
}
|
|
13134
14063
|
output.log("");
|
|
13135
14064
|
}
|
|
14065
|
+
output.log(chalk42.bold("Prompts:"));
|
|
14066
|
+
output.log(` ${chalk42.gray("- 内置: 5 个(default, coding, review, project-memory, global-memory)")}`);
|
|
14067
|
+
const promptPaths = config?.promptPaths;
|
|
14068
|
+
if (promptPaths && Array.isArray(promptPaths) && promptPaths.length > 0) {
|
|
14069
|
+
output.log(` ${chalk42.gray("- 外部: " + promptPaths.length + " 个路径")}`);
|
|
14070
|
+
for (const p of promptPaths) {
|
|
14071
|
+
output.log(` ${chalk42.cyan(p.path)} ${chalk42.gray("(type: " + p.type + ")")}`);
|
|
14072
|
+
}
|
|
14073
|
+
} else {
|
|
14074
|
+
output.log(` ${chalk42.gray("- 外部: 0 个(未配置 promptPaths)")}`);
|
|
14075
|
+
}
|
|
14076
|
+
output.log("");
|
|
14077
|
+
const defaultName = config?.defaultName || "default";
|
|
14078
|
+
output.log(chalk42.bold("Default Prompt:"));
|
|
14079
|
+
output.log(` ${chalk42.cyan("defaultName:")} ${defaultName}`);
|
|
14080
|
+
output.log("");
|
|
14081
|
+
const env = envService?.getEnvironment?.();
|
|
14082
|
+
if (env) {
|
|
14083
|
+
const promptComponent = env.getComponent?.("prompt");
|
|
14084
|
+
if (promptComponent) {
|
|
14085
|
+
const configDir = promptComponent.getPromptConfigDir?.();
|
|
14086
|
+
const exists = promptComponent.getPromptStore?.()?.configDirExists?.();
|
|
14087
|
+
if (configDir) {
|
|
14088
|
+
let promptCount = 0;
|
|
14089
|
+
try {
|
|
14090
|
+
const store = promptComponent.getPromptStore?.();
|
|
14091
|
+
const stored = await store?.loadAll?.();
|
|
14092
|
+
promptCount = Array.isArray(stored) ? stored.length : 0;
|
|
14093
|
+
} catch {}
|
|
14094
|
+
output.log(chalk42.bold("Prompt Storage Directory:"));
|
|
14095
|
+
output.log(` ${chalk42.cyan("path:")} ${configDir}`);
|
|
14096
|
+
output.log(` ${chalk42.cyan("exists:")} ${exists ? chalk42.green("yes") : chalk42.red("no")}`);
|
|
14097
|
+
output.log(` ${chalk42.cyan("prompts:")} ${promptCount} loaded`);
|
|
14098
|
+
output.log("");
|
|
14099
|
+
}
|
|
14100
|
+
}
|
|
14101
|
+
}
|
|
13136
14102
|
}
|
|
13137
14103
|
function flattenConfig(obj, prefix = "") {
|
|
13138
14104
|
const result = [];
|
|
@@ -13154,19 +14120,19 @@ function flattenConfig(obj, prefix = "") {
|
|
|
13154
14120
|
}
|
|
13155
14121
|
function formatValue(value) {
|
|
13156
14122
|
if (value === undefined) {
|
|
13157
|
-
return
|
|
14123
|
+
return chalk42.gray("undefined");
|
|
13158
14124
|
}
|
|
13159
14125
|
if (value === null) {
|
|
13160
|
-
return
|
|
14126
|
+
return chalk42.gray("null");
|
|
13161
14127
|
}
|
|
13162
14128
|
if (typeof value === "object") {
|
|
13163
|
-
return
|
|
14129
|
+
return chalk42.gray(JSON.stringify(value));
|
|
13164
14130
|
}
|
|
13165
14131
|
return String(value);
|
|
13166
14132
|
}
|
|
13167
14133
|
|
|
13168
14134
|
// src/commands/config/export.ts
|
|
13169
|
-
import
|
|
14135
|
+
import chalk43 from "chalk";
|
|
13170
14136
|
var ConfigExportCommand = {
|
|
13171
14137
|
command: "export <component>",
|
|
13172
14138
|
describe: "导出组件配置到文件",
|
|
@@ -13211,7 +14177,7 @@ var ConfigExportCommand = {
|
|
|
13211
14177
|
output.log("");
|
|
13212
14178
|
output.log("Supported components:");
|
|
13213
14179
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
13214
|
-
output.log(` ${
|
|
14180
|
+
output.log(` ${chalk43.cyan(comp)}`);
|
|
13215
14181
|
}
|
|
13216
14182
|
process.exit(1);
|
|
13217
14183
|
}
|
|
@@ -13229,7 +14195,7 @@ var ConfigExportCommand = {
|
|
|
13229
14195
|
};
|
|
13230
14196
|
|
|
13231
14197
|
// src/commands/config/import.ts
|
|
13232
|
-
import
|
|
14198
|
+
import chalk44 from "chalk";
|
|
13233
14199
|
var ConfigImportCommand = {
|
|
13234
14200
|
command: "import <component>",
|
|
13235
14201
|
describe: "从文件导入配置到组件的 file source",
|
|
@@ -13279,7 +14245,7 @@ var ConfigImportCommand = {
|
|
|
13279
14245
|
output.log("");
|
|
13280
14246
|
output.log("Supported components:");
|
|
13281
14247
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
13282
|
-
output.log(` ${
|
|
14248
|
+
output.log(` ${chalk44.cyan(comp)}`);
|
|
13283
14249
|
}
|
|
13284
14250
|
process.exit(1);
|
|
13285
14251
|
}
|
|
@@ -13294,7 +14260,7 @@ var ConfigImportCommand = {
|
|
|
13294
14260
|
}
|
|
13295
14261
|
if (result.merged && result.changes.length > 0 && args.verbose) {
|
|
13296
14262
|
output.log("");
|
|
13297
|
-
output.log(
|
|
14263
|
+
output.log(chalk44.bold("变更详情:"));
|
|
13298
14264
|
for (const change of result.changes) {
|
|
13299
14265
|
output.log(` ${change.key}: ${JSON.stringify(change.oldValue)} → ${JSON.stringify(change.newValue)}`);
|
|
13300
14266
|
}
|
|
@@ -13318,8 +14284,8 @@ var ConfigCommand = {
|
|
|
13318
14284
|
};
|
|
13319
14285
|
|
|
13320
14286
|
// src/commands/mcp/list.ts
|
|
13321
|
-
import
|
|
13322
|
-
var
|
|
14287
|
+
import chalk45 from "chalk";
|
|
14288
|
+
var ListCommand6 = {
|
|
13323
14289
|
command: "list",
|
|
13324
14290
|
aliases: ["ls"],
|
|
13325
14291
|
describe: "列出所有 MCP 服务器及其状态",
|
|
@@ -13364,30 +14330,30 @@ var ListCommand4 = {
|
|
|
13364
14330
|
servers.forEach((s) => output.log(s.name));
|
|
13365
14331
|
} else {
|
|
13366
14332
|
if (servers.length === 0) {
|
|
13367
|
-
output.log(
|
|
14333
|
+
output.log(chalk45.yellow("No MCP servers configured"));
|
|
13368
14334
|
return;
|
|
13369
14335
|
}
|
|
13370
14336
|
const statusColor = (status) => {
|
|
13371
14337
|
switch (status) {
|
|
13372
14338
|
case "connected":
|
|
13373
|
-
return
|
|
14339
|
+
return chalk45.green;
|
|
13374
14340
|
case "connecting":
|
|
13375
|
-
return
|
|
14341
|
+
return chalk45.yellow;
|
|
13376
14342
|
case "error":
|
|
13377
|
-
return
|
|
14343
|
+
return chalk45.red;
|
|
13378
14344
|
case "disconnected":
|
|
13379
|
-
return
|
|
14345
|
+
return chalk45.gray;
|
|
13380
14346
|
default:
|
|
13381
|
-
return
|
|
14347
|
+
return chalk45.white;
|
|
13382
14348
|
}
|
|
13383
14349
|
};
|
|
13384
14350
|
const header = [
|
|
13385
|
-
|
|
13386
|
-
|
|
13387
|
-
|
|
14351
|
+
chalk45.bold("Name"),
|
|
14352
|
+
chalk45.bold("Status"),
|
|
14353
|
+
chalk45.bold("Tools")
|
|
13388
14354
|
].join(" | ");
|
|
13389
14355
|
const rows = servers.map((s) => [
|
|
13390
|
-
|
|
14356
|
+
chalk45.cyan(s.name),
|
|
13391
14357
|
statusColor(s.status)(`[${s.status}]`),
|
|
13392
14358
|
s.toolsCount !== undefined ? String(s.toolsCount) : "-"
|
|
13393
14359
|
].join(" | "));
|
|
@@ -13398,7 +14364,7 @@ var ListCommand4 = {
|
|
|
13398
14364
|
...rows.map((r) => `│${r}│`),
|
|
13399
14365
|
"└" + "─".repeat(header.length + 2) + "┘",
|
|
13400
14366
|
"",
|
|
13401
|
-
|
|
14367
|
+
chalk45.gray(`Total: ${servers.length} servers`)
|
|
13402
14368
|
].join(`
|
|
13403
14369
|
`));
|
|
13404
14370
|
}
|
|
@@ -13412,7 +14378,7 @@ var ListCommand4 = {
|
|
|
13412
14378
|
};
|
|
13413
14379
|
|
|
13414
14380
|
// src/commands/mcp/tools.ts
|
|
13415
|
-
import
|
|
14381
|
+
import chalk46 from "chalk";
|
|
13416
14382
|
var ToolsCommand = {
|
|
13417
14383
|
command: "tools",
|
|
13418
14384
|
aliases: ["t"],
|
|
@@ -13465,7 +14431,7 @@ var ToolsCommand = {
|
|
|
13465
14431
|
tools.forEach((t) => output.log(t.name));
|
|
13466
14432
|
} else {
|
|
13467
14433
|
if (tools.length === 0) {
|
|
13468
|
-
output.log(
|
|
14434
|
+
output.log(chalk46.yellow("No MCP tools available"));
|
|
13469
14435
|
return;
|
|
13470
14436
|
}
|
|
13471
14437
|
const byServer = new Map;
|
|
@@ -13477,15 +14443,15 @@ var ToolsCommand = {
|
|
|
13477
14443
|
byServer.get(serverName).push(tool);
|
|
13478
14444
|
}
|
|
13479
14445
|
for (const [serverName, serverTools] of byServer) {
|
|
13480
|
-
output.log(
|
|
14446
|
+
output.log(chalk46.bold.cyan(`
|
|
13481
14447
|
[${serverName}] ${serverTools.length} tools`));
|
|
13482
14448
|
for (const tool of serverTools) {
|
|
13483
14449
|
const desc = tool.description.length > 80 ? tool.description.slice(0, 77) + "..." : tool.description;
|
|
13484
|
-
output.log(` ${
|
|
13485
|
-
output.log(` ${
|
|
14450
|
+
output.log(` ${chalk46.green("+")} ${chalk46.white(tool.name)}`);
|
|
14451
|
+
output.log(` ${chalk46.gray(desc)}`);
|
|
13486
14452
|
}
|
|
13487
14453
|
}
|
|
13488
|
-
output.log(
|
|
14454
|
+
output.log(chalk46.gray(`
|
|
13489
14455
|
Total: ${tools.length} tools across ${byServer.size} servers`));
|
|
13490
14456
|
}
|
|
13491
14457
|
} catch (error) {
|
|
@@ -13498,7 +14464,7 @@ Total: ${tools.length} tools across ${byServer.size} servers`));
|
|
|
13498
14464
|
};
|
|
13499
14465
|
|
|
13500
14466
|
// src/commands/mcp/reload.ts
|
|
13501
|
-
import
|
|
14467
|
+
import chalk47 from "chalk";
|
|
13502
14468
|
var ReloadCommand2 = {
|
|
13503
14469
|
command: "reload",
|
|
13504
14470
|
aliases: ["r"],
|
|
@@ -13519,19 +14485,19 @@ var ReloadCommand2 = {
|
|
|
13519
14485
|
output.error("McpComponent not available");
|
|
13520
14486
|
process.exit(1);
|
|
13521
14487
|
}
|
|
13522
|
-
output.log(
|
|
14488
|
+
output.log(chalk47.cyan("Reloading MCP servers..."));
|
|
13523
14489
|
await mcpComponent.reload();
|
|
13524
14490
|
const servers = mcpComponent.listServers();
|
|
13525
14491
|
const connected = servers.filter((s) => s.status === "connected").length;
|
|
13526
14492
|
const errors = servers.filter((s) => s.status === "error").length;
|
|
13527
|
-
output.log(
|
|
14493
|
+
output.log(chalk47.green(`✓ Reloaded ${servers.length} servers`));
|
|
13528
14494
|
if (connected > 0) {
|
|
13529
|
-
output.log(
|
|
14495
|
+
output.log(chalk47.green(` • ${connected} connected`));
|
|
13530
14496
|
}
|
|
13531
14497
|
if (errors > 0) {
|
|
13532
14498
|
output.warn(` • ${errors} failed`);
|
|
13533
14499
|
for (const server of servers.filter((s) => s.status === "error")) {
|
|
13534
|
-
output.log(
|
|
14500
|
+
output.log(chalk47.gray(` - ${server.name}: ${server.error}`));
|
|
13535
14501
|
}
|
|
13536
14502
|
}
|
|
13537
14503
|
} catch (error) {
|
|
@@ -13547,13 +14513,13 @@ var ReloadCommand2 = {
|
|
|
13547
14513
|
var McpCommand = {
|
|
13548
14514
|
command: "mcp",
|
|
13549
14515
|
describe: "MCP 服务器管理",
|
|
13550
|
-
builder: (yargs) => yargs.command(
|
|
14516
|
+
builder: (yargs) => yargs.command(ListCommand6).command(ToolsCommand).command(ReloadCommand2).demandCommand(1, "请指定一个子命令").help(),
|
|
13551
14517
|
handler: () => {}
|
|
13552
14518
|
};
|
|
13553
14519
|
|
|
13554
14520
|
// src/commands/tools/list.ts
|
|
13555
|
-
import
|
|
13556
|
-
var
|
|
14521
|
+
import chalk48 from "chalk";
|
|
14522
|
+
var ListCommand7 = {
|
|
13557
14523
|
command: "list",
|
|
13558
14524
|
aliases: ["ls"],
|
|
13559
14525
|
describe: "列出所有可用工具",
|
|
@@ -13597,16 +14563,16 @@ var ListCommand5 = {
|
|
|
13597
14563
|
tools.forEach((t) => output.log(t.name));
|
|
13598
14564
|
} else {
|
|
13599
14565
|
const header = [
|
|
13600
|
-
|
|
13601
|
-
|
|
13602
|
-
|
|
14566
|
+
chalk48.bold("Name"),
|
|
14567
|
+
chalk48.bold("Description"),
|
|
14568
|
+
chalk48.bold("Category")
|
|
13603
14569
|
].join(" | ");
|
|
13604
14570
|
const rows = tools.map((t) => {
|
|
13605
14571
|
const desc = t.description.length > 40 ? t.description.slice(0, 37) + "..." : t.description;
|
|
13606
14572
|
return [
|
|
13607
|
-
|
|
14573
|
+
chalk48.cyan(t.name),
|
|
13608
14574
|
desc,
|
|
13609
|
-
t.metadata?.category ?
|
|
14575
|
+
t.metadata?.category ? chalk48.gray(`[${t.metadata.category}]`) : "-"
|
|
13610
14576
|
].join(" | ");
|
|
13611
14577
|
});
|
|
13612
14578
|
output.log([
|
|
@@ -13616,7 +14582,7 @@ var ListCommand5 = {
|
|
|
13616
14582
|
...rows.map((r) => `│${r}│`),
|
|
13617
14583
|
"└" + "─".repeat(header.length + 2) + "┘",
|
|
13618
14584
|
"",
|
|
13619
|
-
|
|
14585
|
+
chalk48.gray(`Total: ${tools.length} tools`)
|
|
13620
14586
|
].join(`
|
|
13621
14587
|
`));
|
|
13622
14588
|
}
|
|
@@ -13630,7 +14596,7 @@ var ListCommand5 = {
|
|
|
13630
14596
|
};
|
|
13631
14597
|
|
|
13632
14598
|
// src/commands/tools/get.ts
|
|
13633
|
-
import
|
|
14599
|
+
import chalk49 from "chalk";
|
|
13634
14600
|
|
|
13635
14601
|
// src/commands/tools/shared/schema-helper.ts
|
|
13636
14602
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
@@ -13655,7 +14621,7 @@ function validateRequiredParams(params, args) {
|
|
|
13655
14621
|
}
|
|
13656
14622
|
|
|
13657
14623
|
// src/commands/tools/get.ts
|
|
13658
|
-
var
|
|
14624
|
+
var GetCommand6 = {
|
|
13659
14625
|
command: "get <name>",
|
|
13660
14626
|
describe: "获取指定工具的详细信息",
|
|
13661
14627
|
builder: (yargs) => yargs.positional("name", {
|
|
@@ -13705,8 +14671,8 @@ var GetCommand4 = {
|
|
|
13705
14671
|
}))
|
|
13706
14672
|
});
|
|
13707
14673
|
} else {
|
|
13708
|
-
output.log(
|
|
13709
|
-
output.log(
|
|
14674
|
+
output.log(chalk49.bold.cyan(`Tool: ${tool.name}`));
|
|
14675
|
+
output.log(chalk49.gray("─".repeat(60)));
|
|
13710
14676
|
output.log(`Description: ${tool.description}`);
|
|
13711
14677
|
if (tool.metadata?.category) {
|
|
13712
14678
|
output.log(`Category: ${tool.metadata.category}`);
|
|
@@ -13715,9 +14681,9 @@ var GetCommand4 = {
|
|
|
13715
14681
|
output.log(`Tags: ${tool.metadata.tags.join(", ")}`);
|
|
13716
14682
|
}
|
|
13717
14683
|
output.log("");
|
|
13718
|
-
output.log(
|
|
14684
|
+
output.log(chalk49.bold("Parameters:"));
|
|
13719
14685
|
for (const param of params) {
|
|
13720
|
-
const required = param.required ?
|
|
14686
|
+
const required = param.required ? chalk49.red("(required)") : chalk49.gray("(optional)");
|
|
13721
14687
|
const defaultVal = param.default !== undefined ? ` [default: ${JSON.stringify(param.default)}]` : "";
|
|
13722
14688
|
output.log(` --${param.name} <${param.type}> ${required}`);
|
|
13723
14689
|
output.log(` ${param.description}${defaultVal}`);
|
|
@@ -13819,21 +14785,21 @@ var ExecToolCommand = {
|
|
|
13819
14785
|
var ToolsCommand2 = {
|
|
13820
14786
|
command: "tools",
|
|
13821
14787
|
describe: "工具管理 - 列出、获取、执行内置工具",
|
|
13822
|
-
builder: (yargs) => yargs.command(
|
|
14788
|
+
builder: (yargs) => yargs.command(ListCommand7).command(GetCommand6).command(ExecToolCommand).demandCommand().help(),
|
|
13823
14789
|
handler: () => {
|
|
13824
14790
|
console.log("Use 'roy-agent tools --help' for usage information");
|
|
13825
14791
|
}
|
|
13826
14792
|
};
|
|
13827
14793
|
|
|
13828
14794
|
// src/commands/memory/record.ts
|
|
13829
|
-
import
|
|
14795
|
+
import chalk50 from "chalk";
|
|
13830
14796
|
import { createMemoryAgentTools, getBuiltInPrompt } from "@ai-setting/roy-agent-core";
|
|
13831
14797
|
import { bashTool, globTool, readFileTool } from "@ai-setting/roy-agent-core";
|
|
13832
14798
|
async function runExtractMode(output, memoryComponent, agentComponent, sessionComponent, env, options) {
|
|
13833
14799
|
const { scope, sessionId, require: userRequirement } = options;
|
|
13834
|
-
output.log(
|
|
14800
|
+
output.log(chalk50.blue(`
|
|
13835
14801
|
\uD83D\uDD0D Memory Extract Mode (${scope})`));
|
|
13836
|
-
output.log(
|
|
14802
|
+
output.log(chalk50.gray(`正在分析会话历史,生成记忆...
|
|
13837
14803
|
`));
|
|
13838
14804
|
try {
|
|
13839
14805
|
const currentMemory = await memoryComponent.recallMemory(scope) || "(无现有记忆)";
|
|
@@ -13879,13 +14845,13 @@ async function runExtractMode(output, memoryComponent, agentComponent, sessionCo
|
|
|
13879
14845
|
for (const tool of agentTools) {
|
|
13880
14846
|
try {
|
|
13881
14847
|
toolComponent.register(tool);
|
|
13882
|
-
output.log(
|
|
14848
|
+
output.log(chalk50.gray(`Tool registered: ${tool.name}`));
|
|
13883
14849
|
} catch (err) {
|
|
13884
|
-
output.log(
|
|
14850
|
+
output.log(chalk50.gray(`Tool already registered: ${tool.name}`));
|
|
13885
14851
|
}
|
|
13886
14852
|
}
|
|
13887
14853
|
}
|
|
13888
|
-
output.log(
|
|
14854
|
+
output.log(chalk50.gray(`Agent "${agentName}" registered with ${agentTools.length} tools`));
|
|
13889
14855
|
const query = `请分析会话历史,提炼${scope === "project" ? "项目" : "全局"}记忆并写入记忆文件。`;
|
|
13890
14856
|
let result;
|
|
13891
14857
|
try {
|
|
@@ -13899,12 +14865,12 @@ async function runExtractMode(output, memoryComponent, agentComponent, sessionCo
|
|
|
13899
14865
|
if (result && result.startsWith("执行失败")) {
|
|
13900
14866
|
output.error(`提取失败: ${result}`);
|
|
13901
14867
|
} else if (result) {
|
|
13902
|
-
output.log(
|
|
14868
|
+
output.log(chalk50.green(`
|
|
13903
14869
|
✅ 记忆提取完成`));
|
|
13904
|
-
output.log(
|
|
14870
|
+
output.log(chalk50.gray(`记忆已保存到 memory 文件。
|
|
13905
14871
|
`));
|
|
13906
14872
|
if (result.length > 0 && result !== "✅ 记忆提取完成") {
|
|
13907
|
-
output.log(
|
|
14873
|
+
output.log(chalk50.gray(`执行摘要: ${result.substring(0, 200)}${result.length > 200 ? "..." : ""}`));
|
|
13908
14874
|
}
|
|
13909
14875
|
}
|
|
13910
14876
|
agentComponent.unregisterAgent(agentName);
|
|
@@ -14022,11 +14988,11 @@ var RecordCommand = {
|
|
|
14022
14988
|
prepend: "已插入内容到记忆文件开头",
|
|
14023
14989
|
delete: "已删除记忆文件"
|
|
14024
14990
|
};
|
|
14025
|
-
output.log(
|
|
14026
|
-
output.log(
|
|
14991
|
+
output.log(chalk50.green(`✓ ${actionMessages[result.action]}`));
|
|
14992
|
+
output.log(chalk50.gray(`路径: ${result.path}`));
|
|
14027
14993
|
if (result.action !== "delete" && a.content) {
|
|
14028
14994
|
const preview = a.content.substring(0, 100);
|
|
14029
|
-
output.log(
|
|
14995
|
+
output.log(chalk50.gray(`内容预览: ${preview}${a.content.length > 100 ? "..." : ""}`));
|
|
14030
14996
|
}
|
|
14031
14997
|
} catch (error) {
|
|
14032
14998
|
output.error(`Failed to record memory: ${error}`);
|
|
@@ -14038,7 +15004,7 @@ var RecordCommand = {
|
|
|
14038
15004
|
};
|
|
14039
15005
|
|
|
14040
15006
|
// src/commands/memory/recall.ts
|
|
14041
|
-
import
|
|
15007
|
+
import chalk51 from "chalk";
|
|
14042
15008
|
var RecallCommand = {
|
|
14043
15009
|
command: "recall",
|
|
14044
15010
|
aliases: ["load"],
|
|
@@ -14074,7 +15040,7 @@ var RecallCommand = {
|
|
|
14074
15040
|
}
|
|
14075
15041
|
const content = await memoryComponent.recallMemory(a.scope);
|
|
14076
15042
|
if (!content) {
|
|
14077
|
-
output.log(
|
|
15043
|
+
output.log(chalk51.gray("(No memory files found)"));
|
|
14078
15044
|
return;
|
|
14079
15045
|
}
|
|
14080
15046
|
if (a.json) {
|
|
@@ -14100,7 +15066,7 @@ var MemoryCommand = {
|
|
|
14100
15066
|
handler: () => {}
|
|
14101
15067
|
};
|
|
14102
15068
|
// src/commands/eventsource/list.ts
|
|
14103
|
-
import
|
|
15069
|
+
import chalk52 from "chalk";
|
|
14104
15070
|
function truncateVisual2(str, maxWidth) {
|
|
14105
15071
|
let result = "";
|
|
14106
15072
|
let width = 0;
|
|
@@ -14115,7 +15081,7 @@ function truncateVisual2(str, maxWidth) {
|
|
|
14115
15081
|
}
|
|
14116
15082
|
function formatSourcesTable(sources) {
|
|
14117
15083
|
if (sources.length === 0) {
|
|
14118
|
-
return
|
|
15084
|
+
return chalk52.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加");
|
|
14119
15085
|
}
|
|
14120
15086
|
const ID_WIDTH = 10;
|
|
14121
15087
|
const NAME_WIDTH = 20;
|
|
@@ -14124,11 +15090,11 @@ function formatSourcesTable(sources) {
|
|
|
14124
15090
|
const ENABLED_WIDTH = 8;
|
|
14125
15091
|
const GAP = " ";
|
|
14126
15092
|
const headerLine = [
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
15093
|
+
chalk52.bold("ID".padEnd(ID_WIDTH)),
|
|
15094
|
+
chalk52.bold("NAME".padEnd(NAME_WIDTH)),
|
|
15095
|
+
chalk52.bold("TYPE".padEnd(TYPE_WIDTH)),
|
|
15096
|
+
chalk52.bold("STATUS".padEnd(STATUS_WIDTH)),
|
|
15097
|
+
chalk52.bold("ENABLED".padEnd(ENABLED_WIDTH))
|
|
14132
15098
|
].join(GAP);
|
|
14133
15099
|
const sepLine = "─".repeat(ID_WIDTH + NAME_WIDTH + TYPE_WIDTH + STATUS_WIDTH + ENABLED_WIDTH + GAP.length * 4);
|
|
14134
15100
|
const formatRow = (src) => {
|
|
@@ -14181,7 +15147,7 @@ var EventSourceListCommand = {
|
|
|
14181
15147
|
if (args.json) {
|
|
14182
15148
|
output.json({ sources: [], count: 0 });
|
|
14183
15149
|
} else {
|
|
14184
|
-
output.log(
|
|
15150
|
+
output.log(chalk52.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加"));
|
|
14185
15151
|
}
|
|
14186
15152
|
return;
|
|
14187
15153
|
}
|
|
@@ -14196,26 +15162,26 @@ var EventSourceListCommand = {
|
|
|
14196
15162
|
const rows = sources.map((s) => {
|
|
14197
15163
|
const status = esComponent.getStatus(s.id) || "unknown";
|
|
14198
15164
|
const statusColorMap = {
|
|
14199
|
-
running:
|
|
14200
|
-
stopped:
|
|
14201
|
-
error:
|
|
14202
|
-
starting:
|
|
14203
|
-
created:
|
|
14204
|
-
stopping:
|
|
14205
|
-
unknown:
|
|
15165
|
+
running: chalk52.green,
|
|
15166
|
+
stopped: chalk52.gray,
|
|
15167
|
+
error: chalk52.red,
|
|
15168
|
+
starting: chalk52.yellow,
|
|
15169
|
+
created: chalk52.gray,
|
|
15170
|
+
stopping: chalk52.yellow,
|
|
15171
|
+
unknown: chalk52.gray
|
|
14206
15172
|
};
|
|
14207
|
-
const statusColor = statusColorMap[status] ||
|
|
15173
|
+
const statusColor = statusColorMap[status] || chalk52.gray;
|
|
14208
15174
|
return {
|
|
14209
15175
|
id: s.id.substring(0, 8),
|
|
14210
15176
|
name: s.name,
|
|
14211
15177
|
type: s.type,
|
|
14212
15178
|
status: statusColor(status),
|
|
14213
|
-
enabled: s.enabled ?
|
|
15179
|
+
enabled: s.enabled ? chalk52.green("✓") : chalk52.gray("✗")
|
|
14214
15180
|
};
|
|
14215
15181
|
});
|
|
14216
15182
|
output.log(formatSourcesTable(rows));
|
|
14217
15183
|
output.info("");
|
|
14218
|
-
output.log(
|
|
15184
|
+
output.log(chalk52.green(`✅ 共 ${sources.length} 个事件源`));
|
|
14219
15185
|
} catch (error) {
|
|
14220
15186
|
output.error(`Failed to list event sources: ${error}`);
|
|
14221
15187
|
process.exit(1);
|
|
@@ -14226,7 +15192,7 @@ var EventSourceListCommand = {
|
|
|
14226
15192
|
};
|
|
14227
15193
|
|
|
14228
15194
|
// src/commands/eventsource/add.ts
|
|
14229
|
-
import
|
|
15195
|
+
import chalk53 from "chalk";
|
|
14230
15196
|
import { generateId } from "@ai-setting/roy-agent-core";
|
|
14231
15197
|
function uuid() {
|
|
14232
15198
|
return generateId();
|
|
@@ -14291,21 +15257,21 @@ var EventSourceAddCommand = {
|
|
|
14291
15257
|
cron: a.cron
|
|
14292
15258
|
};
|
|
14293
15259
|
esComponent.register(config);
|
|
14294
|
-
output.success(
|
|
15260
|
+
output.success(chalk53.green(`事件源 '${a.name}' 添加成功!`));
|
|
14295
15261
|
output.log("");
|
|
14296
|
-
output.log(` ID: ${
|
|
14297
|
-
output.log(` Type: ${
|
|
15262
|
+
output.log(` ID: ${chalk53.gray(config.id)}`);
|
|
15263
|
+
output.log(` Type: ${chalk53.cyan(a.type)}`);
|
|
14298
15264
|
if (eventTypes?.length) {
|
|
14299
|
-
output.log(` Event Types: ${
|
|
15265
|
+
output.log(` Event Types: ${chalk53.gray(eventTypes.join(", "))}`);
|
|
14300
15266
|
}
|
|
14301
15267
|
if (a.command) {
|
|
14302
|
-
output.log(` Command: ${
|
|
15268
|
+
output.log(` Command: ${chalk53.gray(a.command)}`);
|
|
14303
15269
|
}
|
|
14304
15270
|
if (a.interval) {
|
|
14305
|
-
output.log(` Interval: ${
|
|
15271
|
+
output.log(` Interval: ${chalk53.gray(`${a.interval}ms`)}`);
|
|
14306
15272
|
}
|
|
14307
15273
|
output.log("");
|
|
14308
|
-
output.log(
|
|
15274
|
+
output.log(chalk53.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
|
|
14309
15275
|
} finally {
|
|
14310
15276
|
await envService.dispose();
|
|
14311
15277
|
}
|
|
@@ -14313,7 +15279,7 @@ var EventSourceAddCommand = {
|
|
|
14313
15279
|
};
|
|
14314
15280
|
|
|
14315
15281
|
// src/commands/eventsource/remove.ts
|
|
14316
|
-
import
|
|
15282
|
+
import chalk54 from "chalk";
|
|
14317
15283
|
var EventSourceRemoveCommand = {
|
|
14318
15284
|
command: "remove <id>",
|
|
14319
15285
|
aliases: ["rm"],
|
|
@@ -14352,7 +15318,7 @@ var EventSourceRemoveCommand = {
|
|
|
14352
15318
|
const status = esComponent.getStatus(matchedSource.id);
|
|
14353
15319
|
if (status === "running" && !args.force) {
|
|
14354
15320
|
output.error(`事件源正在运行中,请先停止: ${matchedSource.name} (${status})`);
|
|
14355
|
-
output.log(
|
|
15321
|
+
output.log(chalk54.gray(`使用 --force 强制移除或 'roy-agent eventsource stop ${matchedSource.id.substring(0, 8)}' 先停止`));
|
|
14356
15322
|
process.exit(1);
|
|
14357
15323
|
}
|
|
14358
15324
|
if (status === "running") {
|
|
@@ -14361,7 +15327,7 @@ var EventSourceRemoveCommand = {
|
|
|
14361
15327
|
}
|
|
14362
15328
|
const result = esComponent.unregister(matchedSource.id);
|
|
14363
15329
|
if (result) {
|
|
14364
|
-
output.success(
|
|
15330
|
+
output.success(chalk54.green(`事件源已移除: ${matchedSource.name}`));
|
|
14365
15331
|
} else {
|
|
14366
15332
|
output.error("移除失败");
|
|
14367
15333
|
process.exit(1);
|
|
@@ -14373,7 +15339,7 @@ var EventSourceRemoveCommand = {
|
|
|
14373
15339
|
};
|
|
14374
15340
|
|
|
14375
15341
|
// src/commands/eventsource/start.ts
|
|
14376
|
-
import
|
|
15342
|
+
import chalk55 from "chalk";
|
|
14377
15343
|
var EventSourceStartCommand = {
|
|
14378
15344
|
command: "start <id>",
|
|
14379
15345
|
describe: "启动指定的事件源",
|
|
@@ -14410,15 +15376,15 @@ var EventSourceStartCommand = {
|
|
|
14410
15376
|
}
|
|
14411
15377
|
const status = esComponent.getStatus(matchedSource.id);
|
|
14412
15378
|
if (status === "running") {
|
|
14413
|
-
output.log(
|
|
15379
|
+
output.log(chalk55.yellow(`事件源已在运行: ${matchedSource.name}`));
|
|
14414
15380
|
return;
|
|
14415
15381
|
}
|
|
14416
15382
|
output.info(`正在启动事件源 '${matchedSource.name}'...`);
|
|
14417
15383
|
try {
|
|
14418
15384
|
await esComponent.startSource(matchedSource.id);
|
|
14419
|
-
output.success(
|
|
15385
|
+
output.success(chalk55.green(`事件源已启动: ${matchedSource.name}`));
|
|
14420
15386
|
if (!args.background) {
|
|
14421
|
-
output.log(
|
|
15387
|
+
output.log(chalk55.gray("按 Ctrl+C 停止..."));
|
|
14422
15388
|
await new Promise((resolve) => {
|
|
14423
15389
|
const cleanup = () => {
|
|
14424
15390
|
process.removeListener("SIGINT", cleanup);
|
|
@@ -14440,7 +15406,7 @@ var EventSourceStartCommand = {
|
|
|
14440
15406
|
};
|
|
14441
15407
|
|
|
14442
15408
|
// src/commands/eventsource/stop.ts
|
|
14443
|
-
import
|
|
15409
|
+
import chalk56 from "chalk";
|
|
14444
15410
|
var EventSourceStopCommand = {
|
|
14445
15411
|
command: "stop <id>",
|
|
14446
15412
|
aliases: ["kill"],
|
|
@@ -14478,13 +15444,13 @@ var EventSourceStopCommand = {
|
|
|
14478
15444
|
}
|
|
14479
15445
|
const status = esComponent.getStatus(matchedSource.id);
|
|
14480
15446
|
if (status !== "running") {
|
|
14481
|
-
output.log(
|
|
15447
|
+
output.log(chalk56.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
|
|
14482
15448
|
return;
|
|
14483
15449
|
}
|
|
14484
15450
|
output.info(`正在停止事件源 '${matchedSource.name}'...`);
|
|
14485
15451
|
try {
|
|
14486
15452
|
await esComponent.stopSource(matchedSource.id);
|
|
14487
|
-
output.success(
|
|
15453
|
+
output.success(chalk56.green(`事件源已停止: ${matchedSource.name}`));
|
|
14488
15454
|
} catch (error) {
|
|
14489
15455
|
output.error(`停止失败: ${error}`);
|
|
14490
15456
|
process.exit(1);
|
|
@@ -14496,14 +15462,14 @@ var EventSourceStopCommand = {
|
|
|
14496
15462
|
};
|
|
14497
15463
|
|
|
14498
15464
|
// src/commands/eventsource/status.ts
|
|
14499
|
-
import
|
|
15465
|
+
import chalk57 from "chalk";
|
|
14500
15466
|
var STATUS_COLORS = {
|
|
14501
|
-
created:
|
|
14502
|
-
starting:
|
|
14503
|
-
running:
|
|
14504
|
-
stopping:
|
|
14505
|
-
stopped:
|
|
14506
|
-
error:
|
|
15467
|
+
created: chalk57.gray,
|
|
15468
|
+
starting: chalk57.yellow,
|
|
15469
|
+
running: chalk57.green,
|
|
15470
|
+
stopping: chalk57.yellow,
|
|
15471
|
+
stopped: chalk57.gray,
|
|
15472
|
+
error: chalk57.red
|
|
14507
15473
|
};
|
|
14508
15474
|
var STATUS_ICONS = {
|
|
14509
15475
|
created: "○",
|
|
@@ -14557,7 +15523,7 @@ var EventSourceStatusCommand = {
|
|
|
14557
15523
|
process.exit(1);
|
|
14558
15524
|
}
|
|
14559
15525
|
const status = esComponent.getStatus(matchedSource.id) || "unknown";
|
|
14560
|
-
const statusColor = STATUS_COLORS[status] ||
|
|
15526
|
+
const statusColor = STATUS_COLORS[status] || chalk57.gray;
|
|
14561
15527
|
if (args.json) {
|
|
14562
15528
|
output.json({
|
|
14563
15529
|
id: matchedSource.id,
|
|
@@ -14574,31 +15540,31 @@ var EventSourceStatusCommand = {
|
|
|
14574
15540
|
});
|
|
14575
15541
|
return;
|
|
14576
15542
|
}
|
|
14577
|
-
output.log(
|
|
15543
|
+
output.log(chalk57.bold("事件源详情"));
|
|
14578
15544
|
output.log("─".repeat(50));
|
|
14579
|
-
output.log(` ID: ${
|
|
14580
|
-
output.log(` Name: ${
|
|
14581
|
-
output.log(` Type: ${
|
|
15545
|
+
output.log(` ID: ${chalk57.gray(matchedSource.id)}`);
|
|
15546
|
+
output.log(` Name: ${chalk57.cyan(matchedSource.name)}`);
|
|
15547
|
+
output.log(` Type: ${chalk57.cyan(matchedSource.type)}`);
|
|
14582
15548
|
output.log(` Status: ${statusColor(`${STATUS_ICONS[status]} ${STATUS_LABELS[status]}`)}`);
|
|
14583
|
-
output.log(` Enabled: ${matchedSource.enabled ?
|
|
15549
|
+
output.log(` Enabled: ${matchedSource.enabled ? chalk57.green("是") : chalk57.gray("否")}`);
|
|
14584
15550
|
if (matchedSource.eventTypes?.length) {
|
|
14585
|
-
output.log(` Events: ${
|
|
15551
|
+
output.log(` Events: ${chalk57.gray(matchedSource.eventTypes.join(", "))}`);
|
|
14586
15552
|
}
|
|
14587
15553
|
if (matchedSource.command) {
|
|
14588
|
-
output.log(` Command: ${
|
|
15554
|
+
output.log(` Command: ${chalk57.gray(matchedSource.command)}`);
|
|
14589
15555
|
}
|
|
14590
15556
|
if (matchedSource.interval) {
|
|
14591
|
-
output.log(` Interval: ${
|
|
15557
|
+
output.log(` Interval: ${chalk57.gray(`${matchedSource.interval}ms`)}`);
|
|
14592
15558
|
}
|
|
14593
15559
|
if (matchedSource.url) {
|
|
14594
|
-
output.log(` URL: ${
|
|
15560
|
+
output.log(` URL: ${chalk57.gray(matchedSource.url)}`);
|
|
14595
15561
|
}
|
|
14596
15562
|
output.log("");
|
|
14597
15563
|
return;
|
|
14598
15564
|
}
|
|
14599
15565
|
const sources = esComponent.list();
|
|
14600
15566
|
if (sources.length === 0) {
|
|
14601
|
-
output.log(
|
|
15567
|
+
output.log(chalk57.yellow("没有配置的事件源"));
|
|
14602
15568
|
return;
|
|
14603
15569
|
}
|
|
14604
15570
|
if (args.json) {
|
|
@@ -14612,21 +15578,21 @@ var EventSourceStatusCommand = {
|
|
|
14612
15578
|
output.json({ sources: sourcesWithStatus, count: sources.length });
|
|
14613
15579
|
return;
|
|
14614
15580
|
}
|
|
14615
|
-
output.log(
|
|
15581
|
+
output.log(chalk57.bold("事件源状态概览"));
|
|
14616
15582
|
output.log("─".repeat(60));
|
|
14617
15583
|
for (const source of sources) {
|
|
14618
15584
|
const status = esComponent.getStatus(source.id) || "unknown";
|
|
14619
|
-
const statusColor = STATUS_COLORS[status] ||
|
|
15585
|
+
const statusColor = STATUS_COLORS[status] || chalk57.gray;
|
|
14620
15586
|
const icon = STATUS_ICONS[status] || "?";
|
|
14621
15587
|
const label = STATUS_LABELS[status] || status;
|
|
14622
15588
|
output.log("");
|
|
14623
|
-
output.log(` ${
|
|
15589
|
+
output.log(` ${chalk57.cyan(source.name)} ${chalk57.gray(`(${source.type})`)}`);
|
|
14624
15590
|
output.log(` └─ Status: ${statusColor(`${icon} ${label}`)}`);
|
|
14625
|
-
output.log(` ID: ${
|
|
15591
|
+
output.log(` ID: ${chalk57.gray(source.id.substring(0, 8))}...`);
|
|
14626
15592
|
}
|
|
14627
15593
|
output.log("");
|
|
14628
15594
|
const runningCount = sources.filter((s) => esComponent.getStatus(s.id) === "running").length;
|
|
14629
|
-
output.log(
|
|
15595
|
+
output.log(chalk57.green(`✅ ${runningCount}/${sources.length} 运行中`));
|
|
14630
15596
|
} finally {
|
|
14631
15597
|
await envService.dispose();
|
|
14632
15598
|
}
|
|
@@ -14939,7 +15905,7 @@ var DebugCommand = {
|
|
|
14939
15905
|
};
|
|
14940
15906
|
|
|
14941
15907
|
// src/commands/workflow/renderers.ts
|
|
14942
|
-
import
|
|
15908
|
+
import chalk58 from "chalk";
|
|
14943
15909
|
function truncateVisual3(str, maxWidth) {
|
|
14944
15910
|
if (!str)
|
|
14945
15911
|
return "-";
|
|
@@ -14974,18 +15940,18 @@ function formatDuration(ms) {
|
|
|
14974
15940
|
function statusColor(status) {
|
|
14975
15941
|
switch (status) {
|
|
14976
15942
|
case "completed":
|
|
14977
|
-
return
|
|
15943
|
+
return chalk58.green;
|
|
14978
15944
|
case "running":
|
|
14979
15945
|
case "idle":
|
|
14980
|
-
return
|
|
15946
|
+
return chalk58.blue;
|
|
14981
15947
|
case "paused":
|
|
14982
|
-
return
|
|
15948
|
+
return chalk58.yellow;
|
|
14983
15949
|
case "failed":
|
|
14984
|
-
return
|
|
15950
|
+
return chalk58.red;
|
|
14985
15951
|
case "stopped":
|
|
14986
|
-
return
|
|
15952
|
+
return chalk58.gray;
|
|
14987
15953
|
default:
|
|
14988
|
-
return
|
|
15954
|
+
return chalk58.white;
|
|
14989
15955
|
}
|
|
14990
15956
|
}
|
|
14991
15957
|
function renderWorkflowList(workflows, options) {
|
|
@@ -15004,7 +15970,7 @@ function renderWorkflowList(workflows, options) {
|
|
|
15004
15970
|
}, null, 2);
|
|
15005
15971
|
}
|
|
15006
15972
|
if (workflows.length === 0) {
|
|
15007
|
-
return
|
|
15973
|
+
return chalk58.yellow("No workflows found");
|
|
15008
15974
|
}
|
|
15009
15975
|
const NAME_WIDTH = 30;
|
|
15010
15976
|
const VERSION_WIDTH = 10;
|
|
@@ -15012,10 +15978,10 @@ function renderWorkflowList(workflows, options) {
|
|
|
15012
15978
|
const UPDATED_WIDTH = 20;
|
|
15013
15979
|
const GAP = " ";
|
|
15014
15980
|
const headerLine = [
|
|
15015
|
-
|
|
15016
|
-
|
|
15017
|
-
|
|
15018
|
-
|
|
15981
|
+
chalk58.bold("NAME".padEnd(NAME_WIDTH)),
|
|
15982
|
+
chalk58.bold("VER".padEnd(VERSION_WIDTH)),
|
|
15983
|
+
chalk58.bold("TAGS".padEnd(TAGS_WIDTH)),
|
|
15984
|
+
chalk58.bold("UPDATED")
|
|
15019
15985
|
].join(GAP);
|
|
15020
15986
|
const sepLine = "─".repeat(NAME_WIDTH + VERSION_WIDTH + TAGS_WIDTH + UPDATED_WIDTH + GAP.length * 3);
|
|
15021
15987
|
const rows = workflows.map((w) => {
|
|
@@ -15030,18 +15996,18 @@ function renderWorkflowList(workflows, options) {
|
|
|
15030
15996
|
}
|
|
15031
15997
|
function renderWorkflowDetail(workflow, options) {
|
|
15032
15998
|
const lines = [];
|
|
15033
|
-
lines.push(
|
|
15999
|
+
lines.push(chalk58.bold(`
|
|
15034
16000
|
\uD83D\uDCCB Workflow Details
|
|
15035
16001
|
`));
|
|
15036
|
-
lines.push(` ${
|
|
15037
|
-
lines.push(` ${
|
|
15038
|
-
lines.push(` ${
|
|
15039
|
-
lines.push(` ${
|
|
15040
|
-
lines.push(` ${
|
|
15041
|
-
lines.push(` ${
|
|
15042
|
-
lines.push(` ${
|
|
16002
|
+
lines.push(` ${chalk58.cyan("ID:")} ${workflow.id}`);
|
|
16003
|
+
lines.push(` ${chalk58.cyan("Name:")} ${workflow.name}`);
|
|
16004
|
+
lines.push(` ${chalk58.cyan("Version:")} ${workflow.version}`);
|
|
16005
|
+
lines.push(` ${chalk58.cyan("Description:")} ${workflow.description || "-"}`);
|
|
16006
|
+
lines.push(` ${chalk58.cyan("Tags:")} ${workflow.tags.join(", ") || "-"}`);
|
|
16007
|
+
lines.push(` ${chalk58.cyan("Created:")} ${formatDate(workflow.createdAt)}`);
|
|
16008
|
+
lines.push(` ${chalk58.cyan("Updated:")} ${formatDate(workflow.updatedAt)}`);
|
|
15043
16009
|
const nodeCount = workflow.definition.nodes.length;
|
|
15044
|
-
lines.push(
|
|
16010
|
+
lines.push(chalk58.bold(`
|
|
15045
16011
|
\uD83D\uDCCA Nodes Summary
|
|
15046
16012
|
`));
|
|
15047
16013
|
lines.push(` Total: ${nodeCount} nodes`);
|
|
@@ -15053,7 +16019,7 @@ function renderWorkflowDetail(workflow, options) {
|
|
|
15053
16019
|
lines.push(` - ${type}: ${count}`);
|
|
15054
16020
|
}
|
|
15055
16021
|
if (workflow.definition.config) {
|
|
15056
|
-
lines.push(
|
|
16022
|
+
lines.push(chalk58.bold(`
|
|
15057
16023
|
⚙️ Configuration
|
|
15058
16024
|
`));
|
|
15059
16025
|
if (workflow.definition.config.parallel_limit !== undefined) {
|
|
@@ -15067,7 +16033,7 @@ function renderWorkflowDetail(workflow, options) {
|
|
|
15067
16033
|
}
|
|
15068
16034
|
}
|
|
15069
16035
|
if (options?.includeRuns && options.includeRuns.length > 0) {
|
|
15070
|
-
lines.push(
|
|
16036
|
+
lines.push(chalk58.bold(`
|
|
15071
16037
|
\uD83D\uDCDC Recent Runs
|
|
15072
16038
|
`));
|
|
15073
16039
|
lines.push(renderRunsList(options.includeRuns.slice(0, 5)));
|
|
@@ -15091,7 +16057,7 @@ function renderRunsList(runs, options) {
|
|
|
15091
16057
|
}, null, 2);
|
|
15092
16058
|
}
|
|
15093
16059
|
if (runs.length === 0) {
|
|
15094
|
-
return
|
|
16060
|
+
return chalk58.yellow("No runs found");
|
|
15095
16061
|
}
|
|
15096
16062
|
const ID_WIDTH = 20;
|
|
15097
16063
|
const STATUS_WIDTH = 12;
|
|
@@ -15099,10 +16065,10 @@ function renderRunsList(runs, options) {
|
|
|
15099
16065
|
const UPDATED_WIDTH = 20;
|
|
15100
16066
|
const GAP = " ";
|
|
15101
16067
|
const headerLine = [
|
|
15102
|
-
|
|
15103
|
-
|
|
15104
|
-
|
|
15105
|
-
|
|
16068
|
+
chalk58.bold("RUN ID".padEnd(ID_WIDTH)),
|
|
16069
|
+
chalk58.bold("STATUS".padEnd(STATUS_WIDTH)),
|
|
16070
|
+
chalk58.bold("DURATION".padEnd(DURATION_WIDTH)),
|
|
16071
|
+
chalk58.bold("STARTED")
|
|
15106
16072
|
].join(GAP);
|
|
15107
16073
|
const sepLine = "─".repeat(ID_WIDTH + STATUS_WIDTH + DURATION_WIDTH + UPDATED_WIDTH + GAP.length * 3);
|
|
15108
16074
|
const rows = runs.map((r) => {
|
|
@@ -15117,34 +16083,34 @@ function renderRunsList(runs, options) {
|
|
|
15117
16083
|
}
|
|
15118
16084
|
function renderRunDetail(run) {
|
|
15119
16085
|
const lines = [];
|
|
15120
|
-
lines.push(
|
|
16086
|
+
lines.push(chalk58.bold(`
|
|
15121
16087
|
\uD83C\uDFC3 Run Details
|
|
15122
16088
|
`));
|
|
15123
|
-
lines.push(` ${
|
|
15124
|
-
lines.push(` ${
|
|
15125
|
-
lines.push(` ${
|
|
15126
|
-
lines.push(` ${
|
|
16089
|
+
lines.push(` ${chalk58.cyan("Run ID:")} ${run.id}`);
|
|
16090
|
+
lines.push(` ${chalk58.cyan("Workflow:")} ${run.workflowId}`);
|
|
16091
|
+
lines.push(` ${chalk58.cyan("Status:")} ${statusColor(run.status)(run.status)}`);
|
|
16092
|
+
lines.push(` ${chalk58.cyan("Started:")} ${formatDate(run.startedAt)}`);
|
|
15127
16093
|
if (run.pausedAt) {
|
|
15128
|
-
lines.push(` ${
|
|
16094
|
+
lines.push(` ${chalk58.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
|
|
15129
16095
|
}
|
|
15130
16096
|
if (run.resumedAt) {
|
|
15131
|
-
lines.push(` ${
|
|
16097
|
+
lines.push(` ${chalk58.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
|
|
15132
16098
|
}
|
|
15133
16099
|
if (run.stoppedAt) {
|
|
15134
|
-
lines.push(` ${
|
|
16100
|
+
lines.push(` ${chalk58.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
|
|
15135
16101
|
}
|
|
15136
16102
|
if (run.completedAt) {
|
|
15137
|
-
lines.push(` ${
|
|
16103
|
+
lines.push(` ${chalk58.cyan("Completed:")} ${formatDate(run.completedAt)}`);
|
|
15138
16104
|
}
|
|
15139
|
-
lines.push(` ${
|
|
16105
|
+
lines.push(` ${chalk58.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
|
|
15140
16106
|
if (run.error) {
|
|
15141
|
-
lines.push(
|
|
16107
|
+
lines.push(chalk58.bold(`
|
|
15142
16108
|
❌ Error
|
|
15143
16109
|
`));
|
|
15144
|
-
lines.push(` ${
|
|
16110
|
+
lines.push(` ${chalk58.red(run.error)}`);
|
|
15145
16111
|
}
|
|
15146
16112
|
if (run.output) {
|
|
15147
|
-
lines.push(
|
|
16113
|
+
lines.push(chalk58.bold(`
|
|
15148
16114
|
\uD83D\uDCE4 Output
|
|
15149
16115
|
`));
|
|
15150
16116
|
lines.push(" " + JSON.stringify(run.output, null, 2).split(`
|
|
@@ -15155,36 +16121,36 @@ function renderRunDetail(run) {
|
|
|
15155
16121
|
`);
|
|
15156
16122
|
}
|
|
15157
16123
|
function renderWorkflowAdded(workflow) {
|
|
15158
|
-
return
|
|
16124
|
+
return chalk58.green(`
|
|
15159
16125
|
✅ Workflow '${workflow.name}' added successfully
|
|
15160
16126
|
`) + ` ID: ${workflow.id}
|
|
15161
16127
|
` + ` Version: ${workflow.version}
|
|
15162
16128
|
`;
|
|
15163
16129
|
}
|
|
15164
16130
|
function renderWorkflowUpdated(workflow) {
|
|
15165
|
-
return
|
|
16131
|
+
return chalk58.green(`
|
|
15166
16132
|
✅ Workflow '${workflow.name}' updated successfully
|
|
15167
16133
|
`) + ` ID: ${workflow.id}
|
|
15168
16134
|
`;
|
|
15169
16135
|
}
|
|
15170
16136
|
function renderWorkflowDeleted(name) {
|
|
15171
|
-
return
|
|
16137
|
+
return chalk58.green(`
|
|
15172
16138
|
✅ Workflow '${name}' deleted successfully
|
|
15173
16139
|
`);
|
|
15174
16140
|
}
|
|
15175
16141
|
function renderRunResult(result) {
|
|
15176
16142
|
const lines = [];
|
|
15177
16143
|
if (result.status === "completed") {
|
|
15178
|
-
lines.push(
|
|
16144
|
+
lines.push(chalk58.green(`
|
|
15179
16145
|
✅ Workflow completed successfully`));
|
|
15180
16146
|
} else if (result.status === "failed") {
|
|
15181
|
-
lines.push(
|
|
16147
|
+
lines.push(chalk58.red(`
|
|
15182
16148
|
❌ Workflow failed`));
|
|
15183
16149
|
} else if (result.status === "stopped") {
|
|
15184
|
-
lines.push(
|
|
16150
|
+
lines.push(chalk58.yellow(`
|
|
15185
16151
|
⚠️ Workflow stopped`));
|
|
15186
16152
|
} else {
|
|
15187
|
-
lines.push(
|
|
16153
|
+
lines.push(chalk58.blue(`
|
|
15188
16154
|
\uD83D\uDD04 Workflow ${result.status}`));
|
|
15189
16155
|
}
|
|
15190
16156
|
lines.push(` Run ID: ${result.runId}`);
|
|
@@ -15192,11 +16158,11 @@ function renderRunResult(result) {
|
|
|
15192
16158
|
lines.push(` Duration: ${formatDuration(result.durationMs)}`);
|
|
15193
16159
|
}
|
|
15194
16160
|
if (result.error) {
|
|
15195
|
-
lines.push(
|
|
16161
|
+
lines.push(chalk58.red(`
|
|
15196
16162
|
Error: ${result.error}`));
|
|
15197
16163
|
}
|
|
15198
16164
|
if (result.output) {
|
|
15199
|
-
lines.push(
|
|
16165
|
+
lines.push(chalk58.bold(`
|
|
15200
16166
|
\uD83D\uDCE4 Output:`));
|
|
15201
16167
|
lines.push(JSON.stringify(result.output, null, 2));
|
|
15202
16168
|
}
|
|
@@ -15210,10 +16176,10 @@ function renderNodesList(nodes) {
|
|
|
15210
16176
|
const DEPS_WIDTH = 20;
|
|
15211
16177
|
const GAP = " ";
|
|
15212
16178
|
const headerLine = [
|
|
15213
|
-
|
|
15214
|
-
|
|
15215
|
-
|
|
15216
|
-
|
|
16179
|
+
chalk58.bold("NODE ID".padEnd(ID_WIDTH)),
|
|
16180
|
+
chalk58.bold("TYPE".padEnd(TYPE_WIDTH)),
|
|
16181
|
+
chalk58.bold("NAME".padEnd(NAME_WIDTH)),
|
|
16182
|
+
chalk58.bold("DEPENDS ON")
|
|
15217
16183
|
].join(GAP);
|
|
15218
16184
|
const sepLine = "─".repeat(ID_WIDTH + TYPE_WIDTH + NAME_WIDTH + DEPS_WIDTH + GAP.length * 3);
|
|
15219
16185
|
const rows = nodes.map((n) => {
|
|
@@ -15228,7 +16194,7 @@ function renderNodesList(nodes) {
|
|
|
15228
16194
|
}
|
|
15229
16195
|
|
|
15230
16196
|
// src/commands/workflow/commands/list.ts
|
|
15231
|
-
import
|
|
16197
|
+
import chalk59 from "chalk";
|
|
15232
16198
|
var WorkflowListCommand = {
|
|
15233
16199
|
command: "list",
|
|
15234
16200
|
describe: "列出所有已注册的 Workflow",
|
|
@@ -15311,7 +16277,7 @@ var WorkflowListCommand = {
|
|
|
15311
16277
|
});
|
|
15312
16278
|
} else {
|
|
15313
16279
|
output.log(renderWorkflowList(workflows));
|
|
15314
|
-
output.log(
|
|
16280
|
+
output.log(chalk59.green(`
|
|
15315
16281
|
✅ 共 ${workflows.length} 个 Workflow`));
|
|
15316
16282
|
}
|
|
15317
16283
|
} catch (error) {
|
|
@@ -15913,7 +16879,7 @@ class WorkflowValidator {
|
|
|
15913
16879
|
}
|
|
15914
16880
|
|
|
15915
16881
|
// src/commands/workflow/commands/add.ts
|
|
15916
|
-
import
|
|
16882
|
+
import chalk60 from "chalk";
|
|
15917
16883
|
import fs3 from "fs";
|
|
15918
16884
|
import path6 from "path";
|
|
15919
16885
|
import { createWorkflowExtractorAgent } from "@ai-setting/roy-agent-core/env/task/plugins";
|
|
@@ -16027,7 +16993,7 @@ var WorkflowAddCommand = {
|
|
|
16027
16993
|
definition = await parseWorkflowContent(content, filePath);
|
|
16028
16994
|
workflowName = a.name || definition.name || path6.basename(filePath);
|
|
16029
16995
|
if (a.validate) {
|
|
16030
|
-
output.log(
|
|
16996
|
+
output.log(chalk60.blue("\uD83D\uDD0D Validating workflow..."));
|
|
16031
16997
|
const validator = new WorkflowValidator;
|
|
16032
16998
|
const result = validator.validate(definition);
|
|
16033
16999
|
if (!result.valid) {
|
|
@@ -16042,11 +17008,11 @@ var WorkflowAddCommand = {
|
|
|
16042
17008
|
});
|
|
16043
17009
|
process.exit(1);
|
|
16044
17010
|
}
|
|
16045
|
-
output.log(
|
|
17011
|
+
output.log(chalk60.green(`✅ Workflow validation passed
|
|
16046
17012
|
`));
|
|
16047
17013
|
}
|
|
16048
17014
|
} else if (a.desc) {
|
|
16049
|
-
output.log(
|
|
17015
|
+
output.log(chalk60.blue(`\uD83E\uDD16 Generating workflow from description...
|
|
16050
17016
|
`));
|
|
16051
17017
|
const agentComponent = env.getComponent("agent");
|
|
16052
17018
|
if (!agentComponent) {
|
|
@@ -16054,10 +17020,10 @@ var WorkflowAddCommand = {
|
|
|
16054
17020
|
process.exit(1);
|
|
16055
17021
|
}
|
|
16056
17022
|
if (!agentComponent.getAgent("workflow-extractor")) {
|
|
16057
|
-
output.log(
|
|
17023
|
+
output.log(chalk60.gray("Auto-registering workflow-extractor agent..."));
|
|
16058
17024
|
const extractorConfig = createWorkflowExtractorAgent();
|
|
16059
17025
|
agentComponent.registerAgent(extractorConfig.name, extractorConfig);
|
|
16060
|
-
output.log(
|
|
17026
|
+
output.log(chalk60.green(`✅ workflow-extractor agent registered
|
|
16061
17027
|
`));
|
|
16062
17028
|
}
|
|
16063
17029
|
const prompt = `## 任务
|
|
@@ -16071,20 +17037,20 @@ ${a.desc}
|
|
|
16071
17037
|
1. 先用 \`roy-agent workflow nodes\` 查看可用的节点类型
|
|
16072
17038
|
2. 生成的 YAML 必须通过 \`roy-agent workflow validate --yaml "<yaml>"\` 验证
|
|
16073
17039
|
3. 验证通过后才输出最终 YAML`;
|
|
16074
|
-
output.log(
|
|
17040
|
+
output.log(chalk60.gray("Running workflow-extractor agent..."));
|
|
16075
17041
|
const result = await agentComponent.run("workflow-extractor", prompt);
|
|
16076
17042
|
const agentOutput = result.finalText || "";
|
|
16077
17043
|
definition = parseYamlFromAgentOutput(agentOutput);
|
|
16078
17044
|
if (definition === null) {
|
|
16079
17045
|
output.error("Failed to parse workflow from agent output");
|
|
16080
|
-
output.log(
|
|
17046
|
+
output.log(chalk60.gray(`
|
|
16081
17047
|
Agent output:
|
|
16082
17048
|
` + agentOutput.slice(0, 500)));
|
|
16083
17049
|
process.exit(1);
|
|
16084
17050
|
}
|
|
16085
17051
|
workflowName = a.name || definition.name;
|
|
16086
17052
|
if (a.validate) {
|
|
16087
|
-
output.log(
|
|
17053
|
+
output.log(chalk60.blue(`
|
|
16088
17054
|
\uD83D\uDD0D Validating generated workflow...`));
|
|
16089
17055
|
const validator = new WorkflowValidator;
|
|
16090
17056
|
const result2 = validator.validate(definition);
|
|
@@ -16098,16 +17064,16 @@ Agent output:
|
|
|
16098
17064
|
output.error(` Fix: ${error.fix}
|
|
16099
17065
|
`);
|
|
16100
17066
|
});
|
|
16101
|
-
output.log(
|
|
17067
|
+
output.log(chalk60.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
|
|
16102
17068
|
process.exit(1);
|
|
16103
17069
|
}
|
|
16104
|
-
output.log(
|
|
17070
|
+
output.log(chalk60.green(`✅ Generated workflow validation passed
|
|
16105
17071
|
`));
|
|
16106
17072
|
}
|
|
16107
17073
|
const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
|
|
16108
|
-
output.log(
|
|
17074
|
+
output.log(chalk60.gray("--- Generated YAML ---"));
|
|
16109
17075
|
output.log(yaml.stringify(definition));
|
|
16110
|
-
output.log(
|
|
17076
|
+
output.log(chalk60.gray(`------------------------
|
|
16111
17077
|
`));
|
|
16112
17078
|
} else {
|
|
16113
17079
|
output.error("Please provide --file or --desc option");
|
|
@@ -16121,10 +17087,10 @@ Agent output:
|
|
|
16121
17087
|
force: a.force
|
|
16122
17088
|
});
|
|
16123
17089
|
output.log(renderWorkflowAdded(workflow));
|
|
16124
|
-
output.log(
|
|
17090
|
+
output.log(chalk60.bold(`
|
|
16125
17091
|
\uD83D\uDCCA Nodes Summary:`));
|
|
16126
17092
|
output.log(renderNodesList(definition.nodes));
|
|
16127
|
-
output.log(
|
|
17093
|
+
output.log(chalk60.green(`
|
|
16128
17094
|
✅ Workflow '${workflowName}' added successfully`));
|
|
16129
17095
|
} catch (error) {
|
|
16130
17096
|
if (error.message?.includes("already exists") && !a.force) {
|
|
@@ -16141,7 +17107,7 @@ Agent output:
|
|
|
16141
17107
|
};
|
|
16142
17108
|
|
|
16143
17109
|
// src/commands/workflow/commands/get.ts
|
|
16144
|
-
import
|
|
17110
|
+
import chalk61 from "chalk";
|
|
16145
17111
|
var WorkflowGetCommand = {
|
|
16146
17112
|
command: "get <identifier>",
|
|
16147
17113
|
describe: "获取 Workflow 或 Run 详情",
|
|
@@ -16265,7 +17231,7 @@ var WorkflowGetCommand = {
|
|
|
16265
17231
|
} else {
|
|
16266
17232
|
output.log(renderWorkflowDetail(workflow, { includeRuns: runs }));
|
|
16267
17233
|
if (args.includeNodes) {
|
|
16268
|
-
output.log(
|
|
17234
|
+
output.log(chalk61.bold(`
|
|
16269
17235
|
\uD83D\uDCCB All Nodes:`));
|
|
16270
17236
|
output.log(renderNodesList(workflow.definition.nodes));
|
|
16271
17237
|
}
|
|
@@ -16281,7 +17247,7 @@ var WorkflowGetCommand = {
|
|
|
16281
17247
|
};
|
|
16282
17248
|
|
|
16283
17249
|
// src/commands/workflow/commands/update.ts
|
|
16284
|
-
import
|
|
17250
|
+
import chalk62 from "chalk";
|
|
16285
17251
|
import fs4 from "fs";
|
|
16286
17252
|
import path7 from "path";
|
|
16287
17253
|
var WorkflowUpdateCommand = {
|
|
@@ -16353,7 +17319,7 @@ var WorkflowUpdateCommand = {
|
|
|
16353
17319
|
const tags = a.tags ? a.tags.split(",").map((t) => t.trim()) : undefined;
|
|
16354
17320
|
const workflow = await service.updateWorkflow(a.name, updates, { tags });
|
|
16355
17321
|
output.log(renderWorkflowUpdated(workflow));
|
|
16356
|
-
output.log(
|
|
17322
|
+
output.log(chalk62.green(`
|
|
16357
17323
|
✅ Workflow '${a.name}' updated successfully`));
|
|
16358
17324
|
} catch (error) {
|
|
16359
17325
|
output.error(`Failed to update workflow: ${error}`);
|
|
@@ -16365,7 +17331,7 @@ var WorkflowUpdateCommand = {
|
|
|
16365
17331
|
};
|
|
16366
17332
|
|
|
16367
17333
|
// src/commands/workflow/commands/remove.ts
|
|
16368
|
-
import
|
|
17334
|
+
import chalk63 from "chalk";
|
|
16369
17335
|
var WorkflowRemoveCommand = {
|
|
16370
17336
|
command: "remove <name>",
|
|
16371
17337
|
describe: "删除 Workflow",
|
|
@@ -16404,8 +17370,8 @@ var WorkflowRemoveCommand = {
|
|
|
16404
17370
|
process.exit(1);
|
|
16405
17371
|
}
|
|
16406
17372
|
if (!args.force) {
|
|
16407
|
-
output.log(
|
|
16408
|
-
output.log(
|
|
17373
|
+
output.log(chalk63.yellow(`Are you sure you want to delete workflow '${args.name}'?`));
|
|
17374
|
+
output.log(chalk63.gray("Use --force to skip confirmation"));
|
|
16409
17375
|
process.exit(1);
|
|
16410
17376
|
}
|
|
16411
17377
|
const deleted = await service.deleteWorkflow(args.name);
|
|
@@ -16425,7 +17391,7 @@ var WorkflowRemoveCommand = {
|
|
|
16425
17391
|
|
|
16426
17392
|
// src/commands/workflow/commands/run.ts
|
|
16427
17393
|
var import_yaml = __toESM(require_dist(), 1);
|
|
16428
|
-
import
|
|
17394
|
+
import chalk64 from "chalk";
|
|
16429
17395
|
import fs5 from "fs";
|
|
16430
17396
|
import path8 from "path";
|
|
16431
17397
|
import { getTracerProvider as getTracerProvider4, propagation, wrapFunction } from "@ai-setting/roy-agent-core";
|
|
@@ -16498,7 +17464,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
16498
17464
|
};
|
|
16499
17465
|
if (args.sessionId) {
|
|
16500
17466
|
const sessionId = args.sessionId.startsWith("workflow_") ? args.sessionId : `workflow_${args.sessionId}`;
|
|
16501
|
-
output.log(
|
|
17467
|
+
output.log(chalk64.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
|
|
16502
17468
|
const sessionComponent = workflowComponent.sessionComponent;
|
|
16503
17469
|
if (!sessionComponent) {
|
|
16504
17470
|
output.error("SessionComponent not available");
|
|
@@ -16560,17 +17526,17 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
16560
17526
|
definition = { ...definition, name: args.name };
|
|
16561
17527
|
}
|
|
16562
17528
|
const workflow = await service.createWorkflow(definition, { force: true });
|
|
16563
|
-
output.log(
|
|
16564
|
-
output.log(
|
|
17529
|
+
output.log(chalk64.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
|
|
17530
|
+
output.log(chalk64.green(`✅ Workflow registered: ${workflow.name} (${workflow.id})`));
|
|
16565
17531
|
if (args.registerOnly) {
|
|
16566
|
-
output.log(
|
|
17532
|
+
output.log(chalk64.gray("ℹ️ Use --register-only, skipping execution"));
|
|
16567
17533
|
if (workflowSpan) {
|
|
16568
17534
|
workflowSpan.end();
|
|
16569
17535
|
}
|
|
16570
17536
|
await envService.dispose();
|
|
16571
17537
|
process.exit(0);
|
|
16572
17538
|
}
|
|
16573
|
-
output.log(
|
|
17539
|
+
output.log(chalk64.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
|
|
16574
17540
|
const result = await service.runWorkflow(definition, input, runOptions);
|
|
16575
17541
|
output.log(renderRunResult({
|
|
16576
17542
|
runId: result.runId,
|
|
@@ -16580,11 +17546,11 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
16580
17546
|
durationMs: result.durationMs
|
|
16581
17547
|
}));
|
|
16582
17548
|
if (result.status === "paused") {
|
|
16583
|
-
output.log(
|
|
17549
|
+
output.log(chalk64.gray(`
|
|
16584
17550
|
\uD83D\uDCA1 Use "roy-agent workflow run ${result.runId} --session-id ${result.runId} --input '<response>'" to resume`));
|
|
16585
17551
|
}
|
|
16586
17552
|
} else {
|
|
16587
|
-
output.log(
|
|
17553
|
+
output.log(chalk64.blue(`\uD83D\uDE80 Running workflow: ${args.identifier}`));
|
|
16588
17554
|
const result = await service.runWorkflow(args.identifier, input, runOptions);
|
|
16589
17555
|
output.log(renderRunResult({
|
|
16590
17556
|
runId: result.runId,
|
|
@@ -16594,7 +17560,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
16594
17560
|
durationMs: result.durationMs
|
|
16595
17561
|
}));
|
|
16596
17562
|
if (result.status === "paused") {
|
|
16597
|
-
output.log(
|
|
17563
|
+
output.log(chalk64.gray(`
|
|
16598
17564
|
\uD83D\uDCA1 Use "roy-agent workflow run ${result.runId} --session-id ${result.runId} --input '<response>'" to resume`));
|
|
16599
17565
|
}
|
|
16600
17566
|
}
|
|
@@ -16666,7 +17632,7 @@ var WorkflowRunCommand = {
|
|
|
16666
17632
|
};
|
|
16667
17633
|
|
|
16668
17634
|
// src/commands/workflow/commands/stop.ts
|
|
16669
|
-
import
|
|
17635
|
+
import chalk65 from "chalk";
|
|
16670
17636
|
import { wrapFunction as wrapFunction2 } from "@ai-setting/roy-agent-core";
|
|
16671
17637
|
var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
|
|
16672
17638
|
const output = new OutputService;
|
|
@@ -16695,7 +17661,7 @@ var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
|
|
|
16695
17661
|
process.exit(1);
|
|
16696
17662
|
}
|
|
16697
17663
|
await service.stopRun(args.runId);
|
|
16698
|
-
output.log(
|
|
17664
|
+
output.log(chalk65.red(`
|
|
16699
17665
|
⏹️ Workflow stopped: ${args.runId}`));
|
|
16700
17666
|
} catch (error) {
|
|
16701
17667
|
output.error(`Failed to stop workflow: ${error}`);
|
|
@@ -16719,7 +17685,7 @@ var WorkflowStopCommand = {
|
|
|
16719
17685
|
};
|
|
16720
17686
|
|
|
16721
17687
|
// src/commands/workflow/commands/status.ts
|
|
16722
|
-
import
|
|
17688
|
+
import chalk66 from "chalk";
|
|
16723
17689
|
var WorkflowStatusCommand = {
|
|
16724
17690
|
command: "status <runId>",
|
|
16725
17691
|
describe: "查看 Workflow 运行状态",
|
|
@@ -16810,7 +17776,7 @@ var WorkflowStatusCommand = {
|
|
|
16810
17776
|
stopped: "⏹️"
|
|
16811
17777
|
};
|
|
16812
17778
|
const emoji = statusEmoji[status] || "❓";
|
|
16813
|
-
output.log(
|
|
17779
|
+
output.log(chalk66.bold(`
|
|
16814
17780
|
${emoji} Status: ${status.toUpperCase()}`));
|
|
16815
17781
|
}
|
|
16816
17782
|
} catch (error) {
|
|
@@ -16823,7 +17789,7 @@ ${emoji} Status: ${status.toUpperCase()}`));
|
|
|
16823
17789
|
};
|
|
16824
17790
|
|
|
16825
17791
|
// src/commands/workflow/commands/nodes.ts
|
|
16826
|
-
import
|
|
17792
|
+
import chalk67 from "chalk";
|
|
16827
17793
|
var BUILT_IN_NODES = [
|
|
16828
17794
|
{
|
|
16829
17795
|
name: "ToolNode",
|
|
@@ -17160,7 +18126,7 @@ nodes:
|
|
|
17160
18126
|
];
|
|
17161
18127
|
function renderNodeTypesTable(nodes) {
|
|
17162
18128
|
const lines = [];
|
|
17163
|
-
lines.push(
|
|
18129
|
+
lines.push(chalk67.bold(`
|
|
17164
18130
|
\uD83D\uDCE6 Built-in Node Types
|
|
17165
18131
|
`));
|
|
17166
18132
|
lines.push("┌────────────┬────────────────────┬─────────────────────────────────────────────────────────────┐");
|
|
@@ -17178,29 +18144,29 @@ function renderNodeTypesTable(nodes) {
|
|
|
17178
18144
|
}
|
|
17179
18145
|
function renderNodeDetail(node) {
|
|
17180
18146
|
const lines = [];
|
|
17181
|
-
lines.push(
|
|
18147
|
+
lines.push(chalk67.bold(`
|
|
17182
18148
|
[${node.type}] ${node.name}`));
|
|
17183
|
-
lines.push(
|
|
18149
|
+
lines.push(chalk67.dim("─".repeat(60)) + `
|
|
17184
18150
|
`);
|
|
17185
|
-
lines.push(
|
|
18151
|
+
lines.push(chalk67.bold("Description:"));
|
|
17186
18152
|
lines.push(` ${node.description}
|
|
17187
18153
|
`);
|
|
17188
|
-
lines.push(
|
|
18154
|
+
lines.push(chalk67.bold("Configuration:"));
|
|
17189
18155
|
lines.push(' type: "' + node.type + '"');
|
|
17190
18156
|
lines.push(" config:");
|
|
17191
18157
|
for (const input of node.inputs) {
|
|
17192
|
-
const required = input.required ?
|
|
18158
|
+
const required = input.required ? chalk67.red("*") : " ";
|
|
17193
18159
|
lines.push(` ${input.name} (${input.type})${required}`);
|
|
17194
18160
|
lines.push(` ${input.description}`);
|
|
17195
18161
|
}
|
|
17196
18162
|
lines.push(`
|
|
17197
|
-
${
|
|
18163
|
+
${chalk67.bold("Output:")} ${node.output}`);
|
|
17198
18164
|
if (node.example) {
|
|
17199
|
-
lines.push(
|
|
18165
|
+
lines.push(chalk67.bold(`
|
|
17200
18166
|
Example:`));
|
|
17201
|
-
lines.push(
|
|
18167
|
+
lines.push(chalk67.gray("```yaml"));
|
|
17202
18168
|
lines.push(node.example);
|
|
17203
|
-
lines.push(
|
|
18169
|
+
lines.push(chalk67.gray("```"));
|
|
17204
18170
|
}
|
|
17205
18171
|
return lines.join(`
|
|
17206
18172
|
`);
|
|
@@ -17216,16 +18182,16 @@ var WorkflowNodesCommand = {
|
|
|
17216
18182
|
const nodeType = args.type?.toLowerCase();
|
|
17217
18183
|
if (!nodeType) {
|
|
17218
18184
|
console.log(renderNodeTypesTable(BUILT_IN_NODES));
|
|
17219
|
-
console.log(
|
|
17220
|
-
Use `) +
|
|
17221
|
-
console.log(
|
|
18185
|
+
console.log(chalk67.gray(`
|
|
18186
|
+
Use `) + chalk67.cyan("roy-agent workflow nodes <type>") + chalk67.gray(" for detailed information"));
|
|
18187
|
+
console.log(chalk67.gray("Available types: ") + chalk67.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
|
|
17222
18188
|
return;
|
|
17223
18189
|
}
|
|
17224
18190
|
const node = BUILT_IN_NODES.find((n) => n.type === nodeType);
|
|
17225
18191
|
if (!node) {
|
|
17226
|
-
console.log(
|
|
18192
|
+
console.log(chalk67.red(`
|
|
17227
18193
|
❌ Unknown node type: ${nodeType}`));
|
|
17228
|
-
console.log(
|
|
18194
|
+
console.log(chalk67.gray("Available types: ") + chalk67.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
|
|
17229
18195
|
process.exit(1);
|
|
17230
18196
|
}
|
|
17231
18197
|
console.log(renderNodeDetail(node));
|
|
@@ -17233,7 +18199,7 @@ Use `) + chalk58.cyan("roy-agent workflow nodes <type>") + chalk58.gray(" for de
|
|
|
17233
18199
|
};
|
|
17234
18200
|
|
|
17235
18201
|
// src/commands/workflow/commands/validate.ts
|
|
17236
|
-
import
|
|
18202
|
+
import chalk68 from "chalk";
|
|
17237
18203
|
import { readFileSync } from "fs";
|
|
17238
18204
|
async function parseWorkflowInput(input, yamlStr) {
|
|
17239
18205
|
const parseYaml = async (content) => {
|
|
@@ -17266,25 +18232,25 @@ function renderResult(result, options) {
|
|
|
17266
18232
|
return;
|
|
17267
18233
|
}
|
|
17268
18234
|
if (result.valid) {
|
|
17269
|
-
console.log(
|
|
18235
|
+
console.log(chalk68.green(`
|
|
17270
18236
|
✅ Workflow validation PASSED
|
|
17271
18237
|
`));
|
|
17272
|
-
console.log(
|
|
18238
|
+
console.log(chalk68.bold(`Workflow: ${result.workflowName}`));
|
|
17273
18239
|
console.log(`Nodes: ${result.nodeCount}`);
|
|
17274
18240
|
console.log(`
|
|
17275
18241
|
Valid nodes:`);
|
|
17276
|
-
console.log(
|
|
18242
|
+
console.log(chalk68.green(" ✓ All nodes passed validation"));
|
|
17277
18243
|
} else {
|
|
17278
|
-
console.log(
|
|
18244
|
+
console.log(chalk68.red(`
|
|
17279
18245
|
❌ Workflow validation FAILED (${result.errors.length} errors found)
|
|
17280
18246
|
`));
|
|
17281
18247
|
result.errors.forEach((error, index) => {
|
|
17282
|
-
console.log(
|
|
17283
|
-
console.log(` ${
|
|
17284
|
-
console.log(` ${
|
|
17285
|
-
console.log(` ${
|
|
17286
|
-
console.log(` ${
|
|
17287
|
-
console.log(` ${
|
|
18248
|
+
console.log(chalk68.red(`[Error ${index + 1}/${result.errors.length}]${error.nodeId ? ` Node "${error.nodeId}"` : ""}`));
|
|
18249
|
+
console.log(` ${chalk68.bold("Type:")} ${error.type}`);
|
|
18250
|
+
console.log(` ${chalk68.bold("Description:")} ${error.description}`);
|
|
18251
|
+
console.log(` ${chalk68.bold("Expected:")} ${error.expected}`);
|
|
18252
|
+
console.log(` ${chalk68.bold("Actual:")} ${error.actual}`);
|
|
18253
|
+
console.log(` ${chalk68.green("Fix:")} ${error.fix}`);
|
|
17288
18254
|
console.log();
|
|
17289
18255
|
});
|
|
17290
18256
|
}
|
|
@@ -17309,7 +18275,7 @@ var WorkflowValidateCommand = {
|
|
|
17309
18275
|
try {
|
|
17310
18276
|
const workflow = await parseWorkflowInput(options.input, options.yaml);
|
|
17311
18277
|
if (!workflow) {
|
|
17312
|
-
console.error(
|
|
18278
|
+
console.error(chalk68.red("Failed to parse workflow input"));
|
|
17313
18279
|
process.exit(1);
|
|
17314
18280
|
}
|
|
17315
18281
|
const validator = new WorkflowValidator;
|
|
@@ -17317,7 +18283,7 @@ var WorkflowValidateCommand = {
|
|
|
17317
18283
|
renderResult(result, options);
|
|
17318
18284
|
process.exit(result.valid ? 0 : 1);
|
|
17319
18285
|
} catch (error) {
|
|
17320
|
-
console.error(
|
|
18286
|
+
console.error(chalk68.red(`
|
|
17321
18287
|
Error: ${error.message}`));
|
|
17322
18288
|
process.exit(1);
|
|
17323
18289
|
}
|
|
@@ -17623,7 +18589,7 @@ async function runCli() {
|
|
|
17623
18589
|
array: true,
|
|
17624
18590
|
description: "Enable plugin (e.g., --plugin tslsp, --plugin lsp, --plugin task-tag)",
|
|
17625
18591
|
global: true
|
|
17626
|
-
}).middleware(quietModeMiddleware, true).command(ActCommand).command(InteractiveCommand).command(SessionsCommand).command(TasksCommand).command(SkillsCommand).command(CommandsCommand).command(ConfigCommand).command(McpCommand).command(ToolsCommand2).command(MemoryCommand).command(EventSourceCommand).command(DebugCommand).command(WorkflowCommand).command(LspCommand).demandCommand().help().alias("help", "h").epilog(PLUGIN_HELP).parse();
|
|
18592
|
+
}).middleware(quietModeMiddleware, true).command(ActCommand).command(InteractiveCommand).command(SessionsCommand).command(TasksCommand).command(SkillsCommand).command(AgentsCommand).command(PromptCommand).command(CommandsCommand).command(ConfigCommand).command(McpCommand).command(ToolsCommand2).command(MemoryCommand).command(EventSourceCommand).command(DebugCommand).command(WorkflowCommand).command(LspCommand).demandCommand().help().alias("help", "h").epilog(PLUGIN_HELP).parse();
|
|
17627
18593
|
}
|
|
17628
18594
|
|
|
17629
18595
|
// src/bin/roy-agent.ts
|