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