@ai-setting/roy-agent-cli 1.5.41 → 1.5.42
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 +1447 -534
- package/dist/index.js +1447 -534
- package/dist/roy-agent-linux-x64/bin/roy-agent +0 -0
- package/package.json +2 -2
package/dist/bin/roy-agent.js
CHANGED
|
@@ -246,7 +246,7 @@ var init_stream_output_service = __esm(() => {
|
|
|
246
246
|
};
|
|
247
247
|
});
|
|
248
248
|
|
|
249
|
-
// ../../node_modules/.
|
|
249
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/identity.js
|
|
250
250
|
var require_identity = __commonJS((exports) => {
|
|
251
251
|
var ALIAS = Symbol.for("yaml.alias");
|
|
252
252
|
var DOC = Symbol.for("yaml.document");
|
|
@@ -300,7 +300,7 @@ var require_identity = __commonJS((exports) => {
|
|
|
300
300
|
exports.isSeq = isSeq;
|
|
301
301
|
});
|
|
302
302
|
|
|
303
|
-
// ../../node_modules/.
|
|
303
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/visit.js
|
|
304
304
|
var require_visit = __commonJS((exports) => {
|
|
305
305
|
var identity = require_identity();
|
|
306
306
|
var BREAK = Symbol("break visit");
|
|
@@ -455,7 +455,7 @@ var require_visit = __commonJS((exports) => {
|
|
|
455
455
|
exports.visitAsync = visitAsync;
|
|
456
456
|
});
|
|
457
457
|
|
|
458
|
-
// ../../node_modules/.
|
|
458
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/doc/directives.js
|
|
459
459
|
var require_directives = __commonJS((exports) => {
|
|
460
460
|
var identity = require_identity();
|
|
461
461
|
var visit = require_visit();
|
|
@@ -607,7 +607,7 @@ var require_directives = __commonJS((exports) => {
|
|
|
607
607
|
exports.Directives = Directives;
|
|
608
608
|
});
|
|
609
609
|
|
|
610
|
-
// ../../node_modules/.
|
|
610
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/doc/anchors.js
|
|
611
611
|
var require_anchors = __commonJS((exports) => {
|
|
612
612
|
var identity = require_identity();
|
|
613
613
|
var visit = require_visit();
|
|
@@ -669,7 +669,7 @@ var require_anchors = __commonJS((exports) => {
|
|
|
669
669
|
exports.findNewAnchor = findNewAnchor;
|
|
670
670
|
});
|
|
671
671
|
|
|
672
|
-
// ../../node_modules/.
|
|
672
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/doc/applyReviver.js
|
|
673
673
|
var require_applyReviver = __commonJS((exports) => {
|
|
674
674
|
function applyReviver(reviver, obj, key, val) {
|
|
675
675
|
if (val && typeof val === "object") {
|
|
@@ -716,7 +716,7 @@ var require_applyReviver = __commonJS((exports) => {
|
|
|
716
716
|
exports.applyReviver = applyReviver;
|
|
717
717
|
});
|
|
718
718
|
|
|
719
|
-
// ../../node_modules/.
|
|
719
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/toJS.js
|
|
720
720
|
var require_toJS = __commonJS((exports) => {
|
|
721
721
|
var identity = require_identity();
|
|
722
722
|
function toJS(value, arg, ctx) {
|
|
@@ -743,7 +743,7 @@ var require_toJS = __commonJS((exports) => {
|
|
|
743
743
|
exports.toJS = toJS;
|
|
744
744
|
});
|
|
745
745
|
|
|
746
|
-
// ../../node_modules/.
|
|
746
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/Node.js
|
|
747
747
|
var require_Node = __commonJS((exports) => {
|
|
748
748
|
var applyReviver = require_applyReviver();
|
|
749
749
|
var identity = require_identity();
|
|
@@ -780,7 +780,7 @@ var require_Node = __commonJS((exports) => {
|
|
|
780
780
|
exports.NodeBase = NodeBase;
|
|
781
781
|
});
|
|
782
782
|
|
|
783
|
-
// ../../node_modules/.
|
|
783
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/Alias.js
|
|
784
784
|
var require_Alias = __commonJS((exports) => {
|
|
785
785
|
var anchors = require_anchors();
|
|
786
786
|
var visit = require_visit();
|
|
@@ -890,7 +890,7 @@ var require_Alias = __commonJS((exports) => {
|
|
|
890
890
|
exports.Alias = Alias;
|
|
891
891
|
});
|
|
892
892
|
|
|
893
|
-
// ../../node_modules/.
|
|
893
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/Scalar.js
|
|
894
894
|
var require_Scalar = __commonJS((exports) => {
|
|
895
895
|
var identity = require_identity();
|
|
896
896
|
var Node = require_Node();
|
|
@@ -918,7 +918,7 @@ var require_Scalar = __commonJS((exports) => {
|
|
|
918
918
|
exports.isScalarValue = isScalarValue;
|
|
919
919
|
});
|
|
920
920
|
|
|
921
|
-
// ../../node_modules/.
|
|
921
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/doc/createNode.js
|
|
922
922
|
var require_createNode = __commonJS((exports) => {
|
|
923
923
|
var Alias = require_Alias();
|
|
924
924
|
var identity = require_identity();
|
|
@@ -990,7 +990,7 @@ var require_createNode = __commonJS((exports) => {
|
|
|
990
990
|
exports.createNode = createNode;
|
|
991
991
|
});
|
|
992
992
|
|
|
993
|
-
// ../../node_modules/.
|
|
993
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/Collection.js
|
|
994
994
|
var require_Collection = __commonJS((exports) => {
|
|
995
995
|
var createNode = require_createNode();
|
|
996
996
|
var identity = require_identity();
|
|
@@ -1105,7 +1105,7 @@ var require_Collection = __commonJS((exports) => {
|
|
|
1105
1105
|
exports.isEmptyPath = isEmptyPath;
|
|
1106
1106
|
});
|
|
1107
1107
|
|
|
1108
|
-
// ../../node_modules/.
|
|
1108
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyComment.js
|
|
1109
1109
|
var require_stringifyComment = __commonJS((exports) => {
|
|
1110
1110
|
var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
|
|
1111
1111
|
function indentComment(comment, indent) {
|
|
@@ -1122,7 +1122,7 @@ var require_stringifyComment = __commonJS((exports) => {
|
|
|
1122
1122
|
exports.stringifyComment = stringifyComment;
|
|
1123
1123
|
});
|
|
1124
1124
|
|
|
1125
|
-
// ../../node_modules/.
|
|
1125
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/foldFlowLines.js
|
|
1126
1126
|
var require_foldFlowLines = __commonJS((exports) => {
|
|
1127
1127
|
var FOLD_FLOW = "flow";
|
|
1128
1128
|
var FOLD_BLOCK = "block";
|
|
@@ -1259,7 +1259,7 @@ ${indent}${text.slice(fold + 1, end2)}`;
|
|
|
1259
1259
|
exports.foldFlowLines = foldFlowLines;
|
|
1260
1260
|
});
|
|
1261
1261
|
|
|
1262
|
-
// ../../node_modules/.
|
|
1262
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyString.js
|
|
1263
1263
|
var require_stringifyString = __commonJS((exports) => {
|
|
1264
1264
|
var Scalar = require_Scalar();
|
|
1265
1265
|
var foldFlowLines = require_foldFlowLines();
|
|
@@ -1557,7 +1557,7 @@ ${indent}`);
|
|
|
1557
1557
|
exports.stringifyString = stringifyString;
|
|
1558
1558
|
});
|
|
1559
1559
|
|
|
1560
|
-
// ../../node_modules/.
|
|
1560
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringify.js
|
|
1561
1561
|
var require_stringify = __commonJS((exports) => {
|
|
1562
1562
|
var anchors = require_anchors();
|
|
1563
1563
|
var identity = require_identity();
|
|
@@ -1678,7 +1678,7 @@ ${ctx.indent}${str}`;
|
|
|
1678
1678
|
exports.stringify = stringify;
|
|
1679
1679
|
});
|
|
1680
1680
|
|
|
1681
|
-
// ../../node_modules/.
|
|
1681
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyPair.js
|
|
1682
1682
|
var require_stringifyPair = __commonJS((exports) => {
|
|
1683
1683
|
var identity = require_identity();
|
|
1684
1684
|
var Scalar = require_Scalar();
|
|
@@ -1814,7 +1814,7 @@ ${ctx.indent}`;
|
|
|
1814
1814
|
exports.stringifyPair = stringifyPair;
|
|
1815
1815
|
});
|
|
1816
1816
|
|
|
1817
|
-
// ../../node_modules/.
|
|
1817
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/log.js
|
|
1818
1818
|
var require_log = __commonJS((exports) => {
|
|
1819
1819
|
var node_process = __require("process");
|
|
1820
1820
|
function debug(logLevel, ...messages) {
|
|
@@ -1833,7 +1833,7 @@ var require_log = __commonJS((exports) => {
|
|
|
1833
1833
|
exports.warn = warn;
|
|
1834
1834
|
});
|
|
1835
1835
|
|
|
1836
|
-
// ../../node_modules/.
|
|
1836
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/merge.js
|
|
1837
1837
|
var require_merge = __commonJS((exports) => {
|
|
1838
1838
|
var identity = require_identity();
|
|
1839
1839
|
var Scalar = require_Scalar();
|
|
@@ -1890,7 +1890,7 @@ var require_merge = __commonJS((exports) => {
|
|
|
1890
1890
|
exports.merge = merge;
|
|
1891
1891
|
});
|
|
1892
1892
|
|
|
1893
|
-
// ../../node_modules/.
|
|
1893
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/addPairToJSMap.js
|
|
1894
1894
|
var require_addPairToJSMap = __commonJS((exports) => {
|
|
1895
1895
|
var log = require_log();
|
|
1896
1896
|
var merge = require_merge();
|
|
@@ -1951,7 +1951,7 @@ var require_addPairToJSMap = __commonJS((exports) => {
|
|
|
1951
1951
|
exports.addPairToJSMap = addPairToJSMap;
|
|
1952
1952
|
});
|
|
1953
1953
|
|
|
1954
|
-
// ../../node_modules/.
|
|
1954
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/Pair.js
|
|
1955
1955
|
var require_Pair = __commonJS((exports) => {
|
|
1956
1956
|
var createNode = require_createNode();
|
|
1957
1957
|
var stringifyPair = require_stringifyPair();
|
|
@@ -1989,7 +1989,7 @@ var require_Pair = __commonJS((exports) => {
|
|
|
1989
1989
|
exports.createPair = createPair;
|
|
1990
1990
|
});
|
|
1991
1991
|
|
|
1992
|
-
// ../../node_modules/.
|
|
1992
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
1993
1993
|
var require_stringifyCollection = __commonJS((exports) => {
|
|
1994
1994
|
var identity = require_identity();
|
|
1995
1995
|
var stringify = require_stringify();
|
|
@@ -2141,7 +2141,7 @@ ${indent}${end}`;
|
|
|
2141
2141
|
exports.stringifyCollection = stringifyCollection;
|
|
2142
2142
|
});
|
|
2143
2143
|
|
|
2144
|
-
// ../../node_modules/.
|
|
2144
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/YAMLMap.js
|
|
2145
2145
|
var require_YAMLMap = __commonJS((exports) => {
|
|
2146
2146
|
var stringifyCollection = require_stringifyCollection();
|
|
2147
2147
|
var addPairToJSMap = require_addPairToJSMap();
|
|
@@ -2268,7 +2268,7 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
2268
2268
|
exports.findPair = findPair;
|
|
2269
2269
|
});
|
|
2270
2270
|
|
|
2271
|
-
// ../../node_modules/.
|
|
2271
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/common/map.js
|
|
2272
2272
|
var require_map = __commonJS((exports) => {
|
|
2273
2273
|
var identity = require_identity();
|
|
2274
2274
|
var YAMLMap = require_YAMLMap();
|
|
@@ -2287,7 +2287,7 @@ var require_map = __commonJS((exports) => {
|
|
|
2287
2287
|
exports.map = map;
|
|
2288
2288
|
});
|
|
2289
2289
|
|
|
2290
|
-
// ../../node_modules/.
|
|
2290
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
2291
2291
|
var require_YAMLSeq = __commonJS((exports) => {
|
|
2292
2292
|
var createNode = require_createNode();
|
|
2293
2293
|
var stringifyCollection = require_stringifyCollection();
|
|
@@ -2380,7 +2380,7 @@ var require_YAMLSeq = __commonJS((exports) => {
|
|
|
2380
2380
|
exports.YAMLSeq = YAMLSeq;
|
|
2381
2381
|
});
|
|
2382
2382
|
|
|
2383
|
-
// ../../node_modules/.
|
|
2383
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/common/seq.js
|
|
2384
2384
|
var require_seq = __commonJS((exports) => {
|
|
2385
2385
|
var identity = require_identity();
|
|
2386
2386
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -2399,7 +2399,7 @@ var require_seq = __commonJS((exports) => {
|
|
|
2399
2399
|
exports.seq = seq;
|
|
2400
2400
|
});
|
|
2401
2401
|
|
|
2402
|
-
// ../../node_modules/.
|
|
2402
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/common/string.js
|
|
2403
2403
|
var require_string = __commonJS((exports) => {
|
|
2404
2404
|
var stringifyString = require_stringifyString();
|
|
2405
2405
|
var string = {
|
|
@@ -2415,7 +2415,7 @@ var require_string = __commonJS((exports) => {
|
|
|
2415
2415
|
exports.string = string;
|
|
2416
2416
|
});
|
|
2417
2417
|
|
|
2418
|
-
// ../../node_modules/.
|
|
2418
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/common/null.js
|
|
2419
2419
|
var require_null = __commonJS((exports) => {
|
|
2420
2420
|
var Scalar = require_Scalar();
|
|
2421
2421
|
var nullTag = {
|
|
@@ -2430,7 +2430,7 @@ var require_null = __commonJS((exports) => {
|
|
|
2430
2430
|
exports.nullTag = nullTag;
|
|
2431
2431
|
});
|
|
2432
2432
|
|
|
2433
|
-
// ../../node_modules/.
|
|
2433
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/core/bool.js
|
|
2434
2434
|
var require_bool = __commonJS((exports) => {
|
|
2435
2435
|
var Scalar = require_Scalar();
|
|
2436
2436
|
var boolTag = {
|
|
@@ -2451,7 +2451,7 @@ var require_bool = __commonJS((exports) => {
|
|
|
2451
2451
|
exports.boolTag = boolTag;
|
|
2452
2452
|
});
|
|
2453
2453
|
|
|
2454
|
-
// ../../node_modules/.
|
|
2454
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyNumber.js
|
|
2455
2455
|
var require_stringifyNumber = __commonJS((exports) => {
|
|
2456
2456
|
function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
2457
2457
|
if (typeof value === "bigint")
|
|
@@ -2475,7 +2475,7 @@ var require_stringifyNumber = __commonJS((exports) => {
|
|
|
2475
2475
|
exports.stringifyNumber = stringifyNumber;
|
|
2476
2476
|
});
|
|
2477
2477
|
|
|
2478
|
-
// ../../node_modules/.
|
|
2478
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/core/float.js
|
|
2479
2479
|
var require_float = __commonJS((exports) => {
|
|
2480
2480
|
var Scalar = require_Scalar();
|
|
2481
2481
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -2518,7 +2518,7 @@ var require_float = __commonJS((exports) => {
|
|
|
2518
2518
|
exports.floatNaN = floatNaN;
|
|
2519
2519
|
});
|
|
2520
2520
|
|
|
2521
|
-
// ../../node_modules/.
|
|
2521
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/core/int.js
|
|
2522
2522
|
var require_int = __commonJS((exports) => {
|
|
2523
2523
|
var stringifyNumber = require_stringifyNumber();
|
|
2524
2524
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -2560,7 +2560,7 @@ var require_int = __commonJS((exports) => {
|
|
|
2560
2560
|
exports.intOct = intOct;
|
|
2561
2561
|
});
|
|
2562
2562
|
|
|
2563
|
-
// ../../node_modules/.
|
|
2563
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/core/schema.js
|
|
2564
2564
|
var require_schema = __commonJS((exports) => {
|
|
2565
2565
|
var map = require_map();
|
|
2566
2566
|
var _null = require_null();
|
|
@@ -2585,7 +2585,7 @@ var require_schema = __commonJS((exports) => {
|
|
|
2585
2585
|
exports.schema = schema;
|
|
2586
2586
|
});
|
|
2587
2587
|
|
|
2588
|
-
// ../../node_modules/.
|
|
2588
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/json/schema.js
|
|
2589
2589
|
var require_schema2 = __commonJS((exports) => {
|
|
2590
2590
|
var Scalar = require_Scalar();
|
|
2591
2591
|
var map = require_map();
|
|
@@ -2649,7 +2649,7 @@ var require_schema2 = __commonJS((exports) => {
|
|
|
2649
2649
|
exports.schema = schema;
|
|
2650
2650
|
});
|
|
2651
2651
|
|
|
2652
|
-
// ../../node_modules/.
|
|
2652
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
2653
2653
|
var require_binary = __commonJS((exports) => {
|
|
2654
2654
|
var node_buffer = __require("buffer");
|
|
2655
2655
|
var Scalar = require_Scalar();
|
|
@@ -2704,7 +2704,7 @@ var require_binary = __commonJS((exports) => {
|
|
|
2704
2704
|
exports.binary = binary;
|
|
2705
2705
|
});
|
|
2706
2706
|
|
|
2707
|
-
// ../../node_modules/.
|
|
2707
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
|
|
2708
2708
|
var require_pairs = __commonJS((exports) => {
|
|
2709
2709
|
var identity = require_identity();
|
|
2710
2710
|
var Pair = require_Pair();
|
|
@@ -2779,7 +2779,7 @@ ${cn.comment}` : item.comment;
|
|
|
2779
2779
|
exports.resolvePairs = resolvePairs;
|
|
2780
2780
|
});
|
|
2781
2781
|
|
|
2782
|
-
// ../../node_modules/.
|
|
2782
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/omap.js
|
|
2783
2783
|
var require_omap = __commonJS((exports) => {
|
|
2784
2784
|
var identity = require_identity();
|
|
2785
2785
|
var toJS = require_toJS();
|
|
@@ -2851,7 +2851,7 @@ var require_omap = __commonJS((exports) => {
|
|
|
2851
2851
|
exports.omap = omap;
|
|
2852
2852
|
});
|
|
2853
2853
|
|
|
2854
|
-
// ../../node_modules/.
|
|
2854
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
2855
2855
|
var require_bool2 = __commonJS((exports) => {
|
|
2856
2856
|
var Scalar = require_Scalar();
|
|
2857
2857
|
function boolStringify({ value, source }, ctx) {
|
|
@@ -2880,7 +2880,7 @@ var require_bool2 = __commonJS((exports) => {
|
|
|
2880
2880
|
exports.trueTag = trueTag;
|
|
2881
2881
|
});
|
|
2882
2882
|
|
|
2883
|
-
// ../../node_modules/.
|
|
2883
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/float.js
|
|
2884
2884
|
var require_float2 = __commonJS((exports) => {
|
|
2885
2885
|
var Scalar = require_Scalar();
|
|
2886
2886
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -2926,7 +2926,7 @@ var require_float2 = __commonJS((exports) => {
|
|
|
2926
2926
|
exports.floatNaN = floatNaN;
|
|
2927
2927
|
});
|
|
2928
2928
|
|
|
2929
|
-
// ../../node_modules/.
|
|
2929
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/int.js
|
|
2930
2930
|
var require_int2 = __commonJS((exports) => {
|
|
2931
2931
|
var stringifyNumber = require_stringifyNumber();
|
|
2932
2932
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -3002,7 +3002,7 @@ var require_int2 = __commonJS((exports) => {
|
|
|
3002
3002
|
exports.intOct = intOct;
|
|
3003
3003
|
});
|
|
3004
3004
|
|
|
3005
|
-
// ../../node_modules/.
|
|
3005
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/set.js
|
|
3006
3006
|
var require_set = __commonJS((exports) => {
|
|
3007
3007
|
var identity = require_identity();
|
|
3008
3008
|
var Pair = require_Pair();
|
|
@@ -3085,7 +3085,7 @@ var require_set = __commonJS((exports) => {
|
|
|
3085
3085
|
exports.set = set;
|
|
3086
3086
|
});
|
|
3087
3087
|
|
|
3088
|
-
// ../../node_modules/.
|
|
3088
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
|
|
3089
3089
|
var require_timestamp = __commonJS((exports) => {
|
|
3090
3090
|
var stringifyNumber = require_stringifyNumber();
|
|
3091
3091
|
function parseSexagesimal(str, asBigInt) {
|
|
@@ -3167,7 +3167,7 @@ var require_timestamp = __commonJS((exports) => {
|
|
|
3167
3167
|
exports.timestamp = timestamp;
|
|
3168
3168
|
});
|
|
3169
3169
|
|
|
3170
|
-
// ../../node_modules/.
|
|
3170
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
3171
3171
|
var require_schema3 = __commonJS((exports) => {
|
|
3172
3172
|
var map = require_map();
|
|
3173
3173
|
var _null = require_null();
|
|
@@ -3208,7 +3208,7 @@ var require_schema3 = __commonJS((exports) => {
|
|
|
3208
3208
|
exports.schema = schema;
|
|
3209
3209
|
});
|
|
3210
3210
|
|
|
3211
|
-
// ../../node_modules/.
|
|
3211
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/tags.js
|
|
3212
3212
|
var require_tags = __commonJS((exports) => {
|
|
3213
3213
|
var map = require_map();
|
|
3214
3214
|
var _null = require_null();
|
|
@@ -3299,7 +3299,7 @@ var require_tags = __commonJS((exports) => {
|
|
|
3299
3299
|
exports.getTags = getTags;
|
|
3300
3300
|
});
|
|
3301
3301
|
|
|
3302
|
-
// ../../node_modules/.
|
|
3302
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/Schema.js
|
|
3303
3303
|
var require_Schema = __commonJS((exports) => {
|
|
3304
3304
|
var identity = require_identity();
|
|
3305
3305
|
var map = require_map();
|
|
@@ -3329,7 +3329,7 @@ var require_Schema = __commonJS((exports) => {
|
|
|
3329
3329
|
exports.Schema = Schema;
|
|
3330
3330
|
});
|
|
3331
3331
|
|
|
3332
|
-
// ../../node_modules/.
|
|
3332
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
3333
3333
|
var require_stringifyDocument = __commonJS((exports) => {
|
|
3334
3334
|
var identity = require_identity();
|
|
3335
3335
|
var stringify = require_stringify();
|
|
@@ -3409,7 +3409,7 @@ var require_stringifyDocument = __commonJS((exports) => {
|
|
|
3409
3409
|
exports.stringifyDocument = stringifyDocument;
|
|
3410
3410
|
});
|
|
3411
3411
|
|
|
3412
|
-
// ../../node_modules/.
|
|
3412
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/doc/Document.js
|
|
3413
3413
|
var require_Document = __commonJS((exports) => {
|
|
3414
3414
|
var Alias = require_Alias();
|
|
3415
3415
|
var Collection = require_Collection();
|
|
@@ -3644,7 +3644,7 @@ var require_Document = __commonJS((exports) => {
|
|
|
3644
3644
|
exports.Document = Document;
|
|
3645
3645
|
});
|
|
3646
3646
|
|
|
3647
|
-
// ../../node_modules/.
|
|
3647
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/errors.js
|
|
3648
3648
|
var require_errors = __commonJS((exports) => {
|
|
3649
3649
|
class YAMLError extends Error {
|
|
3650
3650
|
constructor(name, pos, code, message) {
|
|
@@ -3709,7 +3709,7 @@ ${pointer}
|
|
|
3709
3709
|
exports.prettifyError = prettifyError;
|
|
3710
3710
|
});
|
|
3711
3711
|
|
|
3712
|
-
// ../../node_modules/.
|
|
3712
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-props.js
|
|
3713
3713
|
var require_resolve_props = __commonJS((exports) => {
|
|
3714
3714
|
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
|
|
3715
3715
|
let spaceBefore = false;
|
|
@@ -3839,7 +3839,7 @@ var require_resolve_props = __commonJS((exports) => {
|
|
|
3839
3839
|
exports.resolveProps = resolveProps;
|
|
3840
3840
|
});
|
|
3841
3841
|
|
|
3842
|
-
// ../../node_modules/.
|
|
3842
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/util-contains-newline.js
|
|
3843
3843
|
var require_util_contains_newline = __commonJS((exports) => {
|
|
3844
3844
|
function containsNewline(key) {
|
|
3845
3845
|
if (!key)
|
|
@@ -3879,7 +3879,7 @@ var require_util_contains_newline = __commonJS((exports) => {
|
|
|
3879
3879
|
exports.containsNewline = containsNewline;
|
|
3880
3880
|
});
|
|
3881
3881
|
|
|
3882
|
-
// ../../node_modules/.
|
|
3882
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/util-flow-indent-check.js
|
|
3883
3883
|
var require_util_flow_indent_check = __commonJS((exports) => {
|
|
3884
3884
|
var utilContainsNewline = require_util_contains_newline();
|
|
3885
3885
|
function flowIndentCheck(indent, fc, onError) {
|
|
@@ -3894,7 +3894,7 @@ var require_util_flow_indent_check = __commonJS((exports) => {
|
|
|
3894
3894
|
exports.flowIndentCheck = flowIndentCheck;
|
|
3895
3895
|
});
|
|
3896
3896
|
|
|
3897
|
-
// ../../node_modules/.
|
|
3897
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/util-map-includes.js
|
|
3898
3898
|
var require_util_map_includes = __commonJS((exports) => {
|
|
3899
3899
|
var identity = require_identity();
|
|
3900
3900
|
function mapIncludes(ctx, items, search) {
|
|
@@ -3907,7 +3907,7 @@ var require_util_map_includes = __commonJS((exports) => {
|
|
|
3907
3907
|
exports.mapIncludes = mapIncludes;
|
|
3908
3908
|
});
|
|
3909
3909
|
|
|
3910
|
-
// ../../node_modules/.
|
|
3910
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-block-map.js
|
|
3911
3911
|
var require_resolve_block_map = __commonJS((exports) => {
|
|
3912
3912
|
var Pair = require_Pair();
|
|
3913
3913
|
var YAMLMap = require_YAMLMap();
|
|
@@ -4014,7 +4014,7 @@ var require_resolve_block_map = __commonJS((exports) => {
|
|
|
4014
4014
|
exports.resolveBlockMap = resolveBlockMap;
|
|
4015
4015
|
});
|
|
4016
4016
|
|
|
4017
|
-
// ../../node_modules/.
|
|
4017
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-block-seq.js
|
|
4018
4018
|
var require_resolve_block_seq = __commonJS((exports) => {
|
|
4019
4019
|
var YAMLSeq = require_YAMLSeq();
|
|
4020
4020
|
var resolveProps = require_resolve_props();
|
|
@@ -4062,7 +4062,7 @@ var require_resolve_block_seq = __commonJS((exports) => {
|
|
|
4062
4062
|
exports.resolveBlockSeq = resolveBlockSeq;
|
|
4063
4063
|
});
|
|
4064
4064
|
|
|
4065
|
-
// ../../node_modules/.
|
|
4065
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-end.js
|
|
4066
4066
|
var require_resolve_end = __commonJS((exports) => {
|
|
4067
4067
|
function resolveEnd(end, offset, reqSpace, onError) {
|
|
4068
4068
|
let comment = "";
|
|
@@ -4102,7 +4102,7 @@ var require_resolve_end = __commonJS((exports) => {
|
|
|
4102
4102
|
exports.resolveEnd = resolveEnd;
|
|
4103
4103
|
});
|
|
4104
4104
|
|
|
4105
|
-
// ../../node_modules/.
|
|
4105
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-flow-collection.js
|
|
4106
4106
|
var require_resolve_flow_collection = __commonJS((exports) => {
|
|
4107
4107
|
var identity = require_identity();
|
|
4108
4108
|
var Pair = require_Pair();
|
|
@@ -4293,7 +4293,7 @@ var require_resolve_flow_collection = __commonJS((exports) => {
|
|
|
4293
4293
|
exports.resolveFlowCollection = resolveFlowCollection;
|
|
4294
4294
|
});
|
|
4295
4295
|
|
|
4296
|
-
// ../../node_modules/.
|
|
4296
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/compose-collection.js
|
|
4297
4297
|
var require_compose_collection = __commonJS((exports) => {
|
|
4298
4298
|
var identity = require_identity();
|
|
4299
4299
|
var Scalar = require_Scalar();
|
|
@@ -4355,7 +4355,7 @@ var require_compose_collection = __commonJS((exports) => {
|
|
|
4355
4355
|
exports.composeCollection = composeCollection;
|
|
4356
4356
|
});
|
|
4357
4357
|
|
|
4358
|
-
// ../../node_modules/.
|
|
4358
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-block-scalar.js
|
|
4359
4359
|
var require_resolve_block_scalar = __commonJS((exports) => {
|
|
4360
4360
|
var Scalar = require_Scalar();
|
|
4361
4361
|
function resolveBlockScalar(ctx, scalar, onError) {
|
|
@@ -4548,7 +4548,7 @@ var require_resolve_block_scalar = __commonJS((exports) => {
|
|
|
4548
4548
|
exports.resolveBlockScalar = resolveBlockScalar;
|
|
4549
4549
|
});
|
|
4550
4550
|
|
|
4551
|
-
// ../../node_modules/.
|
|
4551
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-flow-scalar.js
|
|
4552
4552
|
var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
4553
4553
|
var Scalar = require_Scalar();
|
|
4554
4554
|
var resolveEnd = require_resolve_end();
|
|
@@ -4765,7 +4765,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
4765
4765
|
exports.resolveFlowScalar = resolveFlowScalar;
|
|
4766
4766
|
});
|
|
4767
4767
|
|
|
4768
|
-
// ../../node_modules/.
|
|
4768
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/compose-scalar.js
|
|
4769
4769
|
var require_compose_scalar = __commonJS((exports) => {
|
|
4770
4770
|
var identity = require_identity();
|
|
4771
4771
|
var Scalar = require_Scalar();
|
|
@@ -4843,7 +4843,7 @@ var require_compose_scalar = __commonJS((exports) => {
|
|
|
4843
4843
|
exports.composeScalar = composeScalar;
|
|
4844
4844
|
});
|
|
4845
4845
|
|
|
4846
|
-
// ../../node_modules/.
|
|
4846
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/util-empty-scalar-position.js
|
|
4847
4847
|
var require_util_empty_scalar_position = __commonJS((exports) => {
|
|
4848
4848
|
function emptyScalarPosition(offset, before, pos) {
|
|
4849
4849
|
if (before) {
|
|
@@ -4870,7 +4870,7 @@ var require_util_empty_scalar_position = __commonJS((exports) => {
|
|
|
4870
4870
|
exports.emptyScalarPosition = emptyScalarPosition;
|
|
4871
4871
|
});
|
|
4872
4872
|
|
|
4873
|
-
// ../../node_modules/.
|
|
4873
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/compose-node.js
|
|
4874
4874
|
var require_compose_node = __commonJS((exports) => {
|
|
4875
4875
|
var Alias = require_Alias();
|
|
4876
4876
|
var identity = require_identity();
|
|
@@ -4973,7 +4973,7 @@ var require_compose_node = __commonJS((exports) => {
|
|
|
4973
4973
|
exports.composeNode = composeNode;
|
|
4974
4974
|
});
|
|
4975
4975
|
|
|
4976
|
-
// ../../node_modules/.
|
|
4976
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/compose-doc.js
|
|
4977
4977
|
var require_compose_doc = __commonJS((exports) => {
|
|
4978
4978
|
var Document = require_Document();
|
|
4979
4979
|
var composeNode = require_compose_node();
|
|
@@ -5013,7 +5013,7 @@ var require_compose_doc = __commonJS((exports) => {
|
|
|
5013
5013
|
exports.composeDoc = composeDoc;
|
|
5014
5014
|
});
|
|
5015
5015
|
|
|
5016
|
-
// ../../node_modules/.
|
|
5016
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/compose/composer.js
|
|
5017
5017
|
var require_composer = __commonJS((exports) => {
|
|
5018
5018
|
var node_process = __require("process");
|
|
5019
5019
|
var directives = require_directives();
|
|
@@ -5099,8 +5099,10 @@ ${cb}` : comment;
|
|
|
5099
5099
|
}
|
|
5100
5100
|
}
|
|
5101
5101
|
if (afterDoc) {
|
|
5102
|
-
|
|
5103
|
-
|
|
5102
|
+
for (let i = 0;i < this.errors.length; ++i)
|
|
5103
|
+
doc.errors.push(this.errors[i]);
|
|
5104
|
+
for (let i = 0;i < this.warnings.length; ++i)
|
|
5105
|
+
doc.warnings.push(this.warnings[i]);
|
|
5104
5106
|
} else {
|
|
5105
5107
|
doc.errors = this.errors;
|
|
5106
5108
|
doc.warnings = this.warnings;
|
|
@@ -5202,7 +5204,7 @@ ${end.comment}` : end.comment;
|
|
|
5202
5204
|
exports.Composer = Composer;
|
|
5203
5205
|
});
|
|
5204
5206
|
|
|
5205
|
-
// ../../node_modules/.
|
|
5207
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/cst-scalar.js
|
|
5206
5208
|
var require_cst_scalar = __commonJS((exports) => {
|
|
5207
5209
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
5208
5210
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
@@ -5392,7 +5394,7 @@ var require_cst_scalar = __commonJS((exports) => {
|
|
|
5392
5394
|
exports.setScalarValue = setScalarValue;
|
|
5393
5395
|
});
|
|
5394
5396
|
|
|
5395
|
-
// ../../node_modules/.
|
|
5397
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/cst-stringify.js
|
|
5396
5398
|
var require_cst_stringify = __commonJS((exports) => {
|
|
5397
5399
|
var stringify = (cst) => ("type" in cst) ? stringifyToken(cst) : stringifyItem(cst);
|
|
5398
5400
|
function stringifyToken(token) {
|
|
@@ -5450,7 +5452,7 @@ var require_cst_stringify = __commonJS((exports) => {
|
|
|
5450
5452
|
exports.stringify = stringify;
|
|
5451
5453
|
});
|
|
5452
5454
|
|
|
5453
|
-
// ../../node_modules/.
|
|
5455
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/cst-visit.js
|
|
5454
5456
|
var require_cst_visit = __commonJS((exports) => {
|
|
5455
5457
|
var BREAK = Symbol("break visit");
|
|
5456
5458
|
var SKIP = Symbol("skip children");
|
|
@@ -5509,7 +5511,7 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
5509
5511
|
exports.visit = visit;
|
|
5510
5512
|
});
|
|
5511
5513
|
|
|
5512
|
-
// ../../node_modules/.
|
|
5514
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/cst.js
|
|
5513
5515
|
var require_cst = __commonJS((exports) => {
|
|
5514
5516
|
var cstScalar = require_cst_scalar();
|
|
5515
5517
|
var cstStringify = require_cst_stringify();
|
|
@@ -5610,7 +5612,7 @@ var require_cst = __commonJS((exports) => {
|
|
|
5610
5612
|
exports.tokenType = tokenType;
|
|
5611
5613
|
});
|
|
5612
5614
|
|
|
5613
|
-
// ../../node_modules/.
|
|
5615
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/lexer.js
|
|
5614
5616
|
var require_lexer = __commonJS((exports) => {
|
|
5615
5617
|
var cst = require_cst();
|
|
5616
5618
|
function isEmpty(ch) {
|
|
@@ -5812,7 +5814,7 @@ var require_lexer = __commonJS((exports) => {
|
|
|
5812
5814
|
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
|
|
5813
5815
|
this.indentNext = this.indentValue + 1;
|
|
5814
5816
|
this.indentValue += n;
|
|
5815
|
-
return
|
|
5817
|
+
return "block-start";
|
|
5816
5818
|
}
|
|
5817
5819
|
return "doc";
|
|
5818
5820
|
}
|
|
@@ -6119,26 +6121,37 @@ var require_lexer = __commonJS((exports) => {
|
|
|
6119
6121
|
return 0;
|
|
6120
6122
|
}
|
|
6121
6123
|
*pushIndicators() {
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6124
|
+
let n = 0;
|
|
6125
|
+
loop:
|
|
6126
|
+
while (true) {
|
|
6127
|
+
switch (this.charAt(0)) {
|
|
6128
|
+
case "!":
|
|
6129
|
+
n += yield* this.pushTag();
|
|
6130
|
+
n += yield* this.pushSpaces(true);
|
|
6131
|
+
continue loop;
|
|
6132
|
+
case "&":
|
|
6133
|
+
n += yield* this.pushUntil(isNotAnchorChar);
|
|
6134
|
+
n += yield* this.pushSpaces(true);
|
|
6135
|
+
continue loop;
|
|
6136
|
+
case "-":
|
|
6137
|
+
case "?":
|
|
6138
|
+
case ":": {
|
|
6139
|
+
const inFlow = this.flowLevel > 0;
|
|
6140
|
+
const ch1 = this.charAt(1);
|
|
6141
|
+
if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
|
|
6142
|
+
if (!inFlow)
|
|
6143
|
+
this.indentNext = this.indentValue + 1;
|
|
6144
|
+
else if (this.flowKey)
|
|
6145
|
+
this.flowKey = false;
|
|
6146
|
+
n += yield* this.pushCount(1);
|
|
6147
|
+
n += yield* this.pushSpaces(true);
|
|
6148
|
+
continue loop;
|
|
6149
|
+
}
|
|
6150
|
+
}
|
|
6138
6151
|
}
|
|
6152
|
+
break loop;
|
|
6139
6153
|
}
|
|
6140
|
-
|
|
6141
|
-
return 0;
|
|
6154
|
+
return n;
|
|
6142
6155
|
}
|
|
6143
6156
|
*pushTag() {
|
|
6144
6157
|
if (this.charAt(1) === "<") {
|
|
@@ -6196,7 +6209,7 @@ var require_lexer = __commonJS((exports) => {
|
|
|
6196
6209
|
exports.Lexer = Lexer;
|
|
6197
6210
|
});
|
|
6198
6211
|
|
|
6199
|
-
// ../../node_modules/.
|
|
6212
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/line-counter.js
|
|
6200
6213
|
var require_line_counter = __commonJS((exports) => {
|
|
6201
6214
|
class LineCounter {
|
|
6202
6215
|
constructor() {
|
|
@@ -6224,7 +6237,7 @@ var require_line_counter = __commonJS((exports) => {
|
|
|
6224
6237
|
exports.LineCounter = LineCounter;
|
|
6225
6238
|
});
|
|
6226
6239
|
|
|
6227
|
-
// ../../node_modules/.
|
|
6240
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/parser.js
|
|
6228
6241
|
var require_parser = __commonJS((exports) => {
|
|
6229
6242
|
var node_process = __require("process");
|
|
6230
6243
|
var cst = require_cst();
|
|
@@ -6292,6 +6305,13 @@ var require_parser = __commonJS((exports) => {
|
|
|
6292
6305
|
while (prev[++i]?.type === "space") {}
|
|
6293
6306
|
return prev.splice(i, prev.length);
|
|
6294
6307
|
}
|
|
6308
|
+
function arrayPushArray(target, source) {
|
|
6309
|
+
if (source.length < 1e5)
|
|
6310
|
+
Array.prototype.push.apply(target, source);
|
|
6311
|
+
else
|
|
6312
|
+
for (let i = 0;i < source.length; ++i)
|
|
6313
|
+
target.push(source[i]);
|
|
6314
|
+
}
|
|
6295
6315
|
function fixFlowSeqItems(fc) {
|
|
6296
6316
|
if (fc.start.type === "flow-seq-start") {
|
|
6297
6317
|
for (const it of fc.items) {
|
|
@@ -6301,11 +6321,11 @@ var require_parser = __commonJS((exports) => {
|
|
|
6301
6321
|
delete it.key;
|
|
6302
6322
|
if (isFlowToken(it.value)) {
|
|
6303
6323
|
if (it.value.end)
|
|
6304
|
-
|
|
6324
|
+
arrayPushArray(it.value.end, it.sep);
|
|
6305
6325
|
else
|
|
6306
6326
|
it.value.end = it.sep;
|
|
6307
6327
|
} else
|
|
6308
|
-
|
|
6328
|
+
arrayPushArray(it.start, it.sep);
|
|
6309
6329
|
delete it.sep;
|
|
6310
6330
|
}
|
|
6311
6331
|
}
|
|
@@ -6645,7 +6665,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
6645
6665
|
const prev = map.items[map.items.length - 2];
|
|
6646
6666
|
const end = prev?.value?.end;
|
|
6647
6667
|
if (Array.isArray(end)) {
|
|
6648
|
-
|
|
6668
|
+
arrayPushArray(end, it.start);
|
|
6649
6669
|
end.push(this.sourceToken);
|
|
6650
6670
|
map.items.pop();
|
|
6651
6671
|
return;
|
|
@@ -6833,7 +6853,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
6833
6853
|
const prev = seq.items[seq.items.length - 2];
|
|
6834
6854
|
const end = prev?.value?.end;
|
|
6835
6855
|
if (Array.isArray(end)) {
|
|
6836
|
-
|
|
6856
|
+
arrayPushArray(end, it.start);
|
|
6837
6857
|
end.push(this.sourceToken);
|
|
6838
6858
|
seq.items.pop();
|
|
6839
6859
|
return;
|
|
@@ -7073,7 +7093,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
7073
7093
|
exports.Parser = Parser;
|
|
7074
7094
|
});
|
|
7075
7095
|
|
|
7076
|
-
// ../../node_modules/.
|
|
7096
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/public-api.js
|
|
7077
7097
|
var require_public_api = __commonJS((exports) => {
|
|
7078
7098
|
var composer = require_composer();
|
|
7079
7099
|
var Document = require_Document();
|
|
@@ -7167,7 +7187,7 @@ var require_public_api = __commonJS((exports) => {
|
|
|
7167
7187
|
exports.stringify = stringify;
|
|
7168
7188
|
});
|
|
7169
7189
|
|
|
7170
|
-
// ../../node_modules/.
|
|
7190
|
+
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/index.js
|
|
7171
7191
|
var require_dist = __commonJS((exports) => {
|
|
7172
7192
|
var composer = require_composer();
|
|
7173
7193
|
var Document = require_Document();
|
|
@@ -7220,7 +7240,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7220
7240
|
var require_package = __commonJS((exports, module) => {
|
|
7221
7241
|
module.exports = {
|
|
7222
7242
|
name: "@ai-setting/roy-agent-cli",
|
|
7223
|
-
version: "1.5.
|
|
7243
|
+
version: "1.5.42",
|
|
7224
7244
|
type: "module",
|
|
7225
7245
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7226
7246
|
main: "./dist/index.js",
|
|
@@ -7247,7 +7267,7 @@ var require_package = __commonJS((exports, module) => {
|
|
|
7247
7267
|
},
|
|
7248
7268
|
dependencies: {
|
|
7249
7269
|
"@ai-setting/roy-agent-coder-harness": "^1.5.41",
|
|
7250
|
-
"@ai-setting/roy-agent-core": "^1.5.
|
|
7270
|
+
"@ai-setting/roy-agent-core": "^1.5.42",
|
|
7251
7271
|
"@ai-setting/roy-agent-ontology-harness": "^1.5.41",
|
|
7252
7272
|
chalk: "^5.6.2",
|
|
7253
7273
|
commander: "^14.0.3",
|
|
@@ -7339,7 +7359,9 @@ import {
|
|
|
7339
7359
|
CommandsComponent,
|
|
7340
7360
|
MemoryComponent,
|
|
7341
7361
|
EventSourceComponent,
|
|
7342
|
-
PluginComponent
|
|
7362
|
+
PluginComponent,
|
|
7363
|
+
resetTracerProvider,
|
|
7364
|
+
closeDatabase
|
|
7343
7365
|
} from "@ai-setting/roy-agent-core";
|
|
7344
7366
|
import { WorkflowComponent } from "@ai-setting/roy-agent-core";
|
|
7345
7367
|
import { MemoryPlugin } from "@ai-setting/roy-agent-core";
|
|
@@ -7469,29 +7491,37 @@ class EnvironmentService {
|
|
|
7469
7491
|
return this.memoryPlugin || null;
|
|
7470
7492
|
}
|
|
7471
7493
|
async dispose() {
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7494
|
+
if (this.environment) {
|
|
7495
|
+
try {
|
|
7496
|
+
await this.environment.stop();
|
|
7497
|
+
} catch {}
|
|
7498
|
+
} else {
|
|
7499
|
+
for (const component of [
|
|
7500
|
+
this.pluginComponent,
|
|
7501
|
+
this.eventSourceComponent,
|
|
7502
|
+
this.memoryComponent,
|
|
7503
|
+
this.commandsComponent,
|
|
7504
|
+
this.mcpComponent,
|
|
7505
|
+
this.skillComponent,
|
|
7506
|
+
this.taskComponent,
|
|
7507
|
+
this.promptComponent,
|
|
7508
|
+
this.logTraceComponent,
|
|
7509
|
+
this.agentComponent,
|
|
7510
|
+
this.toolComponent,
|
|
7511
|
+
this.sessionComponent,
|
|
7512
|
+
this.llmComponent,
|
|
7513
|
+
this.workflowComponent
|
|
7514
|
+
]) {
|
|
7515
|
+
if (component && typeof component.stop === "function") {
|
|
7516
|
+
try {
|
|
7517
|
+
await component.stop();
|
|
7518
|
+
} catch {}
|
|
7519
|
+
}
|
|
7493
7520
|
}
|
|
7494
7521
|
}
|
|
7522
|
+
this.configComponent?.shutdown?.();
|
|
7523
|
+
resetTracerProvider();
|
|
7524
|
+
closeDatabase();
|
|
7495
7525
|
this.environment = null;
|
|
7496
7526
|
this.sessionComponent = undefined;
|
|
7497
7527
|
this.llmComponent = undefined;
|
|
@@ -7500,6 +7530,15 @@ class EnvironmentService {
|
|
|
7500
7530
|
this.skillComponent = undefined;
|
|
7501
7531
|
this.logTraceComponent = undefined;
|
|
7502
7532
|
this.configComponent = undefined;
|
|
7533
|
+
this.promptComponent = undefined;
|
|
7534
|
+
this.taskComponent = undefined;
|
|
7535
|
+
this.mcpComponent = undefined;
|
|
7536
|
+
this.commandsComponent = undefined;
|
|
7537
|
+
this.memoryComponent = undefined;
|
|
7538
|
+
this.memoryPlugin = undefined;
|
|
7539
|
+
this.eventSourceComponent = undefined;
|
|
7540
|
+
this.workflowComponent = undefined;
|
|
7541
|
+
this.pluginComponent = undefined;
|
|
7503
7542
|
}
|
|
7504
7543
|
async create(options) {
|
|
7505
7544
|
const workDir = options?.workDir ?? process.cwd();
|
|
@@ -7610,6 +7649,7 @@ class EnvironmentService {
|
|
|
7610
7649
|
env,
|
|
7611
7650
|
options: { configComponent }
|
|
7612
7651
|
});
|
|
7652
|
+
await agentComponent.syncRegistryAgentsFromConfig();
|
|
7613
7653
|
this.taskComponent = new TaskComponent;
|
|
7614
7654
|
const taskComponent = this.taskComponent;
|
|
7615
7655
|
await taskComponent.init({
|
|
@@ -8470,6 +8510,9 @@ function createActCommand(externalEnvService) {
|
|
|
8470
8510
|
}
|
|
8471
8511
|
if (shouldDisposeEnvService) {
|
|
8472
8512
|
await envService.dispose();
|
|
8513
|
+
if (process.env.ROY_AGENT_NO_EXIT !== "1") {
|
|
8514
|
+
process.exit(0);
|
|
8515
|
+
}
|
|
8473
8516
|
}
|
|
8474
8517
|
}
|
|
8475
8518
|
}
|
|
@@ -12352,58 +12395,28 @@ var SkillsCommand = {
|
|
|
12352
12395
|
}
|
|
12353
12396
|
};
|
|
12354
12397
|
|
|
12355
|
-
// src/commands/
|
|
12398
|
+
// src/commands/agents/list.ts
|
|
12356
12399
|
import chalk28 from "chalk";
|
|
12357
|
-
|
|
12358
|
-
|
|
12359
|
-
|
|
12360
|
-
|
|
12361
|
-
|
|
12362
|
-
|
|
12363
|
-
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
|
|
12367
|
-
return result;
|
|
12368
|
-
}
|
|
12369
|
-
function formatCommandsTable(commands) {
|
|
12370
|
-
if (commands.length === 0) {
|
|
12371
|
-
return chalk28.yellow("命令目录为空,使用 'roy-agent commands add' 添加命令");
|
|
12372
|
-
}
|
|
12373
|
-
const NAME_WIDTH = 20;
|
|
12374
|
-
const SOURCE_WIDTH = 10;
|
|
12375
|
-
const DESC_WIDTH = 50;
|
|
12376
|
-
const GAP = " ";
|
|
12377
|
-
const headerLine = [
|
|
12378
|
-
chalk28.bold("NAME".padEnd(NAME_WIDTH)),
|
|
12379
|
-
chalk28.bold("SOURCE".padEnd(SOURCE_WIDTH)),
|
|
12380
|
-
chalk28.bold("DESCRIPTION")
|
|
12381
|
-
].join(GAP);
|
|
12382
|
-
const sepLine = "─".repeat(NAME_WIDTH + SOURCE_WIDTH + DESC_WIDTH + GAP.length * 2);
|
|
12383
|
-
const formatRow = (cmd) => {
|
|
12384
|
-
const name = truncateVisual(cmd.name, NAME_WIDTH).padEnd(NAME_WIDTH);
|
|
12385
|
-
const source = cmd.source.padEnd(SOURCE_WIDTH);
|
|
12386
|
-
const desc = truncateVisual(cmd.description || "-", DESC_WIDTH);
|
|
12387
|
-
return `${name}${GAP}${source}${GAP}${desc}`;
|
|
12388
|
-
};
|
|
12389
|
-
const rows = commands.map(formatRow);
|
|
12390
|
-
return [headerLine, sepLine, ...rows].join(`
|
|
12391
|
-
`);
|
|
12392
|
-
}
|
|
12393
|
-
var CommandsListCommand = {
|
|
12394
|
-
command: "list [pattern]",
|
|
12395
|
-
describe: "列出收藏的命令(支持 glob 过滤)",
|
|
12396
|
-
builder: (yargs) => yargs.positional("pattern", {
|
|
12397
|
-
describe: "glob 过滤模式",
|
|
12398
|
-
type: "string"
|
|
12400
|
+
var ListCommand4 = {
|
|
12401
|
+
command: "list",
|
|
12402
|
+
aliases: ["ls"],
|
|
12403
|
+
describe: "列出所有可用 agents",
|
|
12404
|
+
builder: (yargs) => yargs.option("type", {
|
|
12405
|
+
alias: "t",
|
|
12406
|
+
type: "string",
|
|
12407
|
+
choices: ["primary", "sub", "all"],
|
|
12408
|
+
default: "all",
|
|
12409
|
+
description: "按类型筛选"
|
|
12399
12410
|
}).option("json", {
|
|
12400
12411
|
alias: "j",
|
|
12401
|
-
describe: "JSON 格式输出",
|
|
12402
12412
|
type: "boolean",
|
|
12403
|
-
default: false
|
|
12404
|
-
|
|
12405
|
-
|
|
12406
|
-
|
|
12413
|
+
default: false,
|
|
12414
|
+
description: "JSON 输出"
|
|
12415
|
+
}).option("quiet", {
|
|
12416
|
+
alias: "q",
|
|
12417
|
+
type: "boolean",
|
|
12418
|
+
default: false,
|
|
12419
|
+
description: "简洁输出"
|
|
12407
12420
|
}),
|
|
12408
12421
|
async handler(args) {
|
|
12409
12422
|
const output = new OutputService;
|
|
@@ -12415,35 +12428,76 @@ var CommandsListCommand = {
|
|
|
12415
12428
|
output.error("Failed to create environment");
|
|
12416
12429
|
process.exit(1);
|
|
12417
12430
|
}
|
|
12418
|
-
const
|
|
12419
|
-
if (!
|
|
12420
|
-
output.error("
|
|
12431
|
+
const agentComponent = env.getComponent("agent");
|
|
12432
|
+
if (!agentComponent) {
|
|
12433
|
+
output.error("AgentComponent not available");
|
|
12421
12434
|
process.exit(1);
|
|
12422
12435
|
}
|
|
12423
|
-
const
|
|
12436
|
+
const registry = agentComponent.getRegistry?.();
|
|
12437
|
+
if (!registry) {
|
|
12438
|
+
output.error("Agent registry not available");
|
|
12439
|
+
process.exit(1);
|
|
12440
|
+
}
|
|
12441
|
+
let agents;
|
|
12442
|
+
if (args.type && args.type !== "all") {
|
|
12443
|
+
agents = registry.listAgentsByType(args.type);
|
|
12444
|
+
} else {
|
|
12445
|
+
agents = registry.list();
|
|
12446
|
+
}
|
|
12424
12447
|
if (args.json) {
|
|
12425
12448
|
output.json({
|
|
12426
|
-
|
|
12427
|
-
name:
|
|
12428
|
-
|
|
12429
|
-
|
|
12430
|
-
|
|
12449
|
+
agents: agents.map((a) => ({
|
|
12450
|
+
name: a.name,
|
|
12451
|
+
type: a.type,
|
|
12452
|
+
description: a.description,
|
|
12453
|
+
systemPromptRef: a.systemPromptRef,
|
|
12454
|
+
hasInlinePrompt: !!a.systemPrompt
|
|
12431
12455
|
})),
|
|
12432
|
-
|
|
12456
|
+
count: agents.length
|
|
12433
12457
|
});
|
|
12458
|
+
} else if (args.quiet) {
|
|
12459
|
+
agents.forEach((a) => output.log(a.name));
|
|
12434
12460
|
} else {
|
|
12435
|
-
const
|
|
12436
|
-
|
|
12437
|
-
|
|
12438
|
-
|
|
12439
|
-
|
|
12440
|
-
|
|
12441
|
-
|
|
12442
|
-
|
|
12443
|
-
|
|
12461
|
+
const header = [
|
|
12462
|
+
chalk28.bold("Name"),
|
|
12463
|
+
chalk28.bold("Type"),
|
|
12464
|
+
chalk28.bold("Description"),
|
|
12465
|
+
chalk28.bold("Source")
|
|
12466
|
+
].join(" | ");
|
|
12467
|
+
const typeColor = (type) => {
|
|
12468
|
+
return type === "primary" ? chalk28.yellow : chalk28.blue;
|
|
12469
|
+
};
|
|
12470
|
+
const sourceColor = (agent) => {
|
|
12471
|
+
return agent.systemPromptRef ? chalk28.green("[ref]") : chalk28.gray("[inline]");
|
|
12472
|
+
};
|
|
12473
|
+
const rows = agents.map((a) => {
|
|
12474
|
+
const desc = (a.description || "").length > 40 ? (a.description || "").slice(0, 37) + "..." : a.description || "-";
|
|
12475
|
+
return [
|
|
12476
|
+
chalk28.cyan(a.name),
|
|
12477
|
+
typeColor(a.type)(a.type),
|
|
12478
|
+
desc,
|
|
12479
|
+
sourceColor(a)
|
|
12480
|
+
].join(" | ");
|
|
12481
|
+
});
|
|
12482
|
+
if (rows.length === 0) {
|
|
12483
|
+
output.log(chalk28.yellow("No agents found."));
|
|
12484
|
+
output.log("");
|
|
12485
|
+
output.log(chalk28.gray("Tip: Create agent configs in ~/.local/share/roy-agent/agents/"));
|
|
12486
|
+
} else {
|
|
12487
|
+
output.log([
|
|
12488
|
+
`┌─ Agents ${"─".repeat(50)}┐`,
|
|
12489
|
+
`│${header}│`,
|
|
12490
|
+
"├" + "─".repeat(header.length + 2) + "┤",
|
|
12491
|
+
...rows.map((r) => `│${r}│`),
|
|
12492
|
+
"└" + "─".repeat(header.length + 2) + "┘",
|
|
12493
|
+
"",
|
|
12494
|
+
chalk28.gray(`Total: ${agents.length} agents`)
|
|
12495
|
+
].join(`
|
|
12496
|
+
`));
|
|
12497
|
+
}
|
|
12444
12498
|
}
|
|
12445
12499
|
} catch (error) {
|
|
12446
|
-
output.error(`Failed to list
|
|
12500
|
+
output.error(`Failed to list agents: ${error}`);
|
|
12447
12501
|
process.exit(1);
|
|
12448
12502
|
} finally {
|
|
12449
12503
|
await envService.dispose();
|
|
@@ -12451,42 +12505,175 @@ var CommandsListCommand = {
|
|
|
12451
12505
|
}
|
|
12452
12506
|
};
|
|
12453
12507
|
|
|
12454
|
-
// src/commands/
|
|
12508
|
+
// src/commands/agents/get.ts
|
|
12455
12509
|
import chalk29 from "chalk";
|
|
12456
|
-
var
|
|
12457
|
-
command: "
|
|
12458
|
-
describe: "
|
|
12510
|
+
var GetCommand4 = {
|
|
12511
|
+
command: "get <name>",
|
|
12512
|
+
describe: "获取指定 agent 的详细信息",
|
|
12459
12513
|
builder: (yargs) => yargs.positional("name", {
|
|
12460
|
-
describe: "命令名称",
|
|
12461
|
-
type: "string",
|
|
12462
|
-
demandOption: true
|
|
12463
|
-
}).positional("target", {
|
|
12464
|
-
describe: "目标命令路径或名称",
|
|
12465
12514
|
type: "string",
|
|
12515
|
+
describe: "Agent 名称",
|
|
12466
12516
|
demandOption: true
|
|
12467
|
-
}).option("
|
|
12468
|
-
alias: "
|
|
12469
|
-
describe: "添加到用户级别目录(默认)",
|
|
12470
|
-
type: "boolean",
|
|
12471
|
-
default: true
|
|
12472
|
-
}).option("local", {
|
|
12473
|
-
alias: "l",
|
|
12474
|
-
describe: "添加到项目级别目录",
|
|
12517
|
+
}).option("json", {
|
|
12518
|
+
alias: "j",
|
|
12475
12519
|
type: "boolean",
|
|
12476
|
-
default: false
|
|
12477
|
-
|
|
12478
|
-
|
|
12479
|
-
|
|
12520
|
+
default: false,
|
|
12521
|
+
description: "JSON 输出"
|
|
12522
|
+
}),
|
|
12523
|
+
async handler(args) {
|
|
12524
|
+
const output = new OutputService;
|
|
12525
|
+
const envService = new EnvironmentService(output);
|
|
12526
|
+
try {
|
|
12527
|
+
await envService.create({ configPath: args.config });
|
|
12528
|
+
const env = envService.getEnvironment();
|
|
12529
|
+
if (!env) {
|
|
12530
|
+
output.error("Failed to create environment");
|
|
12531
|
+
process.exit(1);
|
|
12532
|
+
}
|
|
12533
|
+
const agentComponent = env.getComponent("agent");
|
|
12534
|
+
if (!agentComponent) {
|
|
12535
|
+
output.error("AgentComponent not available");
|
|
12536
|
+
process.exit(1);
|
|
12537
|
+
}
|
|
12538
|
+
const registry = agentComponent.getRegistry?.();
|
|
12539
|
+
if (!registry) {
|
|
12540
|
+
output.error("Agent registry not available");
|
|
12541
|
+
process.exit(1);
|
|
12542
|
+
}
|
|
12543
|
+
const agent = registry.get(args.name);
|
|
12544
|
+
if (!agent) {
|
|
12545
|
+
output.error(`Agent not found: ${args.name}`);
|
|
12546
|
+
process.exit(1);
|
|
12547
|
+
}
|
|
12548
|
+
const resolvedSystemPrompt = await registry.getSystemPrompt(args.name);
|
|
12549
|
+
if (args.json) {
|
|
12550
|
+
output.json({
|
|
12551
|
+
name: agent.name,
|
|
12552
|
+
type: agent.type,
|
|
12553
|
+
description: agent.description,
|
|
12554
|
+
systemPromptRef: agent.systemPromptRef,
|
|
12555
|
+
systemPrompt: agent.systemPrompt,
|
|
12556
|
+
resolvedSystemPrompt,
|
|
12557
|
+
model: agent.model,
|
|
12558
|
+
maxIterations: agent.maxIterations,
|
|
12559
|
+
allowedTools: agent.allowedTools,
|
|
12560
|
+
deniedTools: agent.deniedTools,
|
|
12561
|
+
toolTimeout: agent.toolTimeout,
|
|
12562
|
+
toolRetries: agent.toolRetries,
|
|
12563
|
+
doomLoopThreshold: agent.doomLoopThreshold,
|
|
12564
|
+
filterHistory: agent.filterHistory
|
|
12565
|
+
});
|
|
12566
|
+
} else {
|
|
12567
|
+
output.log(chalk29.bold.cyan(`# Agent: ${agent.name}`));
|
|
12568
|
+
output.log("");
|
|
12569
|
+
output.log(chalk29.bold("Basic Info:"));
|
|
12570
|
+
output.log(` ${chalk29.cyan("name:")} ${agent.name}`);
|
|
12571
|
+
output.log(` ${chalk29.cyan("type:")} ${agent.type}`);
|
|
12572
|
+
if (agent.description) {
|
|
12573
|
+
output.log(` ${chalk29.cyan("description:")} ${agent.description}`);
|
|
12574
|
+
}
|
|
12575
|
+
output.log("");
|
|
12576
|
+
output.log(chalk29.bold("System Prompt:"));
|
|
12577
|
+
if (agent.systemPromptRef) {
|
|
12578
|
+
output.log(` ${chalk29.green("[ref]")} ${chalk29.cyan("systemPromptRef:")} ${agent.systemPromptRef}`);
|
|
12579
|
+
}
|
|
12580
|
+
if (agent.systemPrompt && !agent.systemPromptRef) {
|
|
12581
|
+
const promptPreview = agent.systemPrompt.length > 100 ? agent.systemPrompt.slice(0, 97) + "..." : agent.systemPrompt;
|
|
12582
|
+
output.log(` ${chalk29.gray("[inline]")}`);
|
|
12583
|
+
output.log(` ${chalk29.gray(promptPreview.split(`
|
|
12584
|
+
`).join(`
|
|
12585
|
+
`))}`);
|
|
12586
|
+
}
|
|
12587
|
+
if (resolvedSystemPrompt) {
|
|
12588
|
+
const resolvedPreview = resolvedSystemPrompt.length > 200 ? resolvedSystemPrompt.slice(0, 197) + "..." : resolvedSystemPrompt;
|
|
12589
|
+
output.log(` ${chalk29.green("[resolved]")}`);
|
|
12590
|
+
output.log(` ${chalk29.gray(resolvedPreview.split(`
|
|
12591
|
+
`).join(`
|
|
12592
|
+
`))}`);
|
|
12593
|
+
}
|
|
12594
|
+
if (!agent.systemPromptRef && !agent.systemPrompt && !resolvedSystemPrompt) {
|
|
12595
|
+
output.log(` ${chalk29.gray("(none)")}`);
|
|
12596
|
+
}
|
|
12597
|
+
output.log("");
|
|
12598
|
+
const hasOptions = agent.model || agent.maxIterations || agent.toolTimeout;
|
|
12599
|
+
if (hasOptions) {
|
|
12600
|
+
output.log(chalk29.bold("Options:"));
|
|
12601
|
+
if (agent.model) {
|
|
12602
|
+
output.log(` ${chalk29.cyan("model:")} ${agent.model}`);
|
|
12603
|
+
}
|
|
12604
|
+
if (agent.maxIterations) {
|
|
12605
|
+
output.log(` ${chalk29.cyan("maxIterations:")} ${agent.maxIterations}`);
|
|
12606
|
+
}
|
|
12607
|
+
if (agent.toolTimeout) {
|
|
12608
|
+
output.log(` ${chalk29.cyan("toolTimeout:")} ${agent.toolTimeout}ms`);
|
|
12609
|
+
}
|
|
12610
|
+
output.log("");
|
|
12611
|
+
}
|
|
12612
|
+
const hasTools = agent.allowedTools?.length || agent.deniedTools?.length;
|
|
12613
|
+
if (hasTools) {
|
|
12614
|
+
output.log(chalk29.bold("Tool Permissions:"));
|
|
12615
|
+
if (agent.allowedTools?.length) {
|
|
12616
|
+
output.log(` ${chalk29.green("allowed:")} ${agent.allowedTools.join(", ")}`);
|
|
12617
|
+
}
|
|
12618
|
+
if (agent.deniedTools?.length) {
|
|
12619
|
+
output.log(` ${chalk29.red("denied:")} ${agent.deniedTools.join(", ")}`);
|
|
12620
|
+
}
|
|
12621
|
+
output.log("");
|
|
12622
|
+
}
|
|
12623
|
+
}
|
|
12624
|
+
} catch (error) {
|
|
12625
|
+
output.error(`Failed to get agent: ${error}`);
|
|
12626
|
+
process.exit(1);
|
|
12627
|
+
} finally {
|
|
12628
|
+
await envService.dispose();
|
|
12629
|
+
}
|
|
12630
|
+
}
|
|
12631
|
+
};
|
|
12632
|
+
|
|
12633
|
+
// src/commands/agents/add.ts
|
|
12634
|
+
import chalk30 from "chalk";
|
|
12635
|
+
function parseToolList(value) {
|
|
12636
|
+
if (!value?.trim()) {
|
|
12637
|
+
return;
|
|
12638
|
+
}
|
|
12639
|
+
return value.split(",").map((tool) => tool.trim()).filter(Boolean);
|
|
12640
|
+
}
|
|
12641
|
+
var AddCommand = {
|
|
12642
|
+
command: "add <name>",
|
|
12643
|
+
describe: "添加 agent 配置(写入 YAML 文件)",
|
|
12644
|
+
builder: (yargs) => yargs.positional("name", {
|
|
12480
12645
|
type: "string",
|
|
12646
|
+
describe: "Agent 名称",
|
|
12481
12647
|
demandOption: true
|
|
12482
|
-
}).option("
|
|
12648
|
+
}).option("type", {
|
|
12483
12649
|
alias: "t",
|
|
12484
|
-
describe: "探索提示(告诉用户如何使用 --help 探索)",
|
|
12485
12650
|
type: "string",
|
|
12486
|
-
|
|
12487
|
-
|
|
12488
|
-
|
|
12489
|
-
|
|
12651
|
+
choices: ["primary", "sub"],
|
|
12652
|
+
default: "sub",
|
|
12653
|
+
description: "Agent 类型"
|
|
12654
|
+
}).option("description", {
|
|
12655
|
+
type: "string",
|
|
12656
|
+
description: "Agent 描述"
|
|
12657
|
+
}).option("system-prompt-ref", {
|
|
12658
|
+
type: "string",
|
|
12659
|
+
description: "引用 PromptComponent 中的 prompt 名称"
|
|
12660
|
+
}).option("system-prompt", {
|
|
12661
|
+
type: "string",
|
|
12662
|
+
description: "内联 system prompt"
|
|
12663
|
+
}).option("model", {
|
|
12664
|
+
type: "string",
|
|
12665
|
+
description: "使用的模型"
|
|
12666
|
+
}).option("allowed-tools", {
|
|
12667
|
+
type: "string",
|
|
12668
|
+
description: "允许的工具(逗号分隔)"
|
|
12669
|
+
}).option("denied-tools", {
|
|
12670
|
+
type: "string",
|
|
12671
|
+
description: "拒绝的工具(逗号分隔)"
|
|
12672
|
+
}).option("json", {
|
|
12673
|
+
alias: "j",
|
|
12674
|
+
type: "boolean",
|
|
12675
|
+
default: false,
|
|
12676
|
+
description: "JSON 输出"
|
|
12490
12677
|
}),
|
|
12491
12678
|
async handler(args) {
|
|
12492
12679
|
const output = new OutputService;
|
|
@@ -12498,27 +12685,40 @@ var CommandsAddCommand = {
|
|
|
12498
12685
|
output.error("Failed to create environment");
|
|
12499
12686
|
process.exit(1);
|
|
12500
12687
|
}
|
|
12501
|
-
const
|
|
12502
|
-
|
|
12503
|
-
|
|
12688
|
+
const agentComponent = env.getComponent("agent");
|
|
12689
|
+
const registry = agentComponent?.getRegistry?.();
|
|
12690
|
+
if (!registry) {
|
|
12691
|
+
output.error("Agent registry not available");
|
|
12504
12692
|
process.exit(1);
|
|
12505
12693
|
}
|
|
12506
|
-
|
|
12507
|
-
|
|
12694
|
+
if (registry.hasAgent(args.name)) {
|
|
12695
|
+
output.error(`Agent already exists: ${args.name}`);
|
|
12696
|
+
process.exit(1);
|
|
12697
|
+
}
|
|
12698
|
+
const agent = {
|
|
12508
12699
|
name: args.name,
|
|
12509
|
-
|
|
12510
|
-
source,
|
|
12700
|
+
type: args.type,
|
|
12511
12701
|
description: args.description,
|
|
12512
|
-
|
|
12513
|
-
|
|
12514
|
-
|
|
12515
|
-
|
|
12516
|
-
|
|
12517
|
-
|
|
12518
|
-
|
|
12519
|
-
|
|
12702
|
+
systemPromptRef: args.systemPromptRef,
|
|
12703
|
+
systemPrompt: args.systemPrompt,
|
|
12704
|
+
model: args.model,
|
|
12705
|
+
allowedTools: parseToolList(args.allowedTools),
|
|
12706
|
+
deniedTools: parseToolList(args.deniedTools)
|
|
12707
|
+
};
|
|
12708
|
+
const saved = await registry.saveAgent(agent);
|
|
12709
|
+
if (!saved) {
|
|
12710
|
+
output.error(`Failed to save agent: ${args.name}`);
|
|
12711
|
+
process.exit(1);
|
|
12712
|
+
}
|
|
12713
|
+
const filePath = registry.getAgentFilePath(args.name);
|
|
12714
|
+
if (args.json) {
|
|
12715
|
+
output.json({ agent, filePath });
|
|
12716
|
+
} else {
|
|
12717
|
+
output.log(chalk30.green(`✓ Agent '${args.name}' created`));
|
|
12718
|
+
output.log(chalk30.gray(` ${filePath}`));
|
|
12719
|
+
}
|
|
12520
12720
|
} catch (error) {
|
|
12521
|
-
output.error(
|
|
12721
|
+
output.error(`Failed to add agent: ${error}`);
|
|
12522
12722
|
process.exit(1);
|
|
12523
12723
|
} finally {
|
|
12524
12724
|
await envService.dispose();
|
|
@@ -12526,29 +12726,616 @@ var CommandsAddCommand = {
|
|
|
12526
12726
|
}
|
|
12527
12727
|
};
|
|
12528
12728
|
|
|
12529
|
-
// src/commands/
|
|
12530
|
-
import
|
|
12531
|
-
var
|
|
12532
|
-
command: "
|
|
12533
|
-
|
|
12534
|
-
describe: "移除收藏命令",
|
|
12729
|
+
// src/commands/agents/delete.ts
|
|
12730
|
+
import chalk31 from "chalk";
|
|
12731
|
+
var DeleteCommand3 = {
|
|
12732
|
+
command: "delete <name>",
|
|
12733
|
+
describe: "删除 agent 配置文件",
|
|
12535
12734
|
builder: (yargs) => yargs.positional("name", {
|
|
12536
|
-
describe: "命令名称",
|
|
12537
12735
|
type: "string",
|
|
12736
|
+
describe: "Agent 名称",
|
|
12538
12737
|
demandOption: true
|
|
12539
|
-
}).option("
|
|
12540
|
-
alias: "
|
|
12541
|
-
describe: "从用户级别目录移除",
|
|
12738
|
+
}).option("yes", {
|
|
12739
|
+
alias: "y",
|
|
12542
12740
|
type: "boolean",
|
|
12543
|
-
default: false
|
|
12544
|
-
|
|
12545
|
-
|
|
12546
|
-
|
|
12741
|
+
default: false,
|
|
12742
|
+
description: "跳过确认"
|
|
12743
|
+
}).option("json", {
|
|
12744
|
+
alias: "j",
|
|
12547
12745
|
type: "boolean",
|
|
12548
|
-
default: false
|
|
12549
|
-
|
|
12550
|
-
|
|
12551
|
-
|
|
12746
|
+
default: false,
|
|
12747
|
+
description: "JSON 输出"
|
|
12748
|
+
}),
|
|
12749
|
+
async handler(args) {
|
|
12750
|
+
const output = new OutputService;
|
|
12751
|
+
const envService = new EnvironmentService(output);
|
|
12752
|
+
try {
|
|
12753
|
+
await envService.create({ configPath: args.config });
|
|
12754
|
+
const env = envService.getEnvironment();
|
|
12755
|
+
if (!env) {
|
|
12756
|
+
output.error("Failed to create environment");
|
|
12757
|
+
process.exit(1);
|
|
12758
|
+
}
|
|
12759
|
+
const agentComponent = env.getComponent("agent");
|
|
12760
|
+
const registry = agentComponent?.getRegistry?.();
|
|
12761
|
+
if (!registry) {
|
|
12762
|
+
output.error("Agent registry not available");
|
|
12763
|
+
process.exit(1);
|
|
12764
|
+
}
|
|
12765
|
+
const agent = registry.get(args.name);
|
|
12766
|
+
if (!agent) {
|
|
12767
|
+
output.error(`Agent not found: ${args.name}`);
|
|
12768
|
+
process.exit(1);
|
|
12769
|
+
}
|
|
12770
|
+
const filePath = registry.getAgentFilePath(args.name);
|
|
12771
|
+
if (!args.yes) {
|
|
12772
|
+
output.log(chalk31.yellow(`Delete agent '${args.name}'? This removes ${filePath} (use --yes to skip confirmation)`));
|
|
12773
|
+
process.exit(1);
|
|
12774
|
+
}
|
|
12775
|
+
const deleted = await registry.deleteAgent(args.name);
|
|
12776
|
+
if (!deleted) {
|
|
12777
|
+
output.error(`Failed to delete agent: ${args.name}`);
|
|
12778
|
+
process.exit(1);
|
|
12779
|
+
}
|
|
12780
|
+
if (args.json) {
|
|
12781
|
+
output.json({ deleted: true, name: args.name, filePath });
|
|
12782
|
+
} else {
|
|
12783
|
+
output.log(chalk31.green(`✓ Agent '${args.name}' deleted`));
|
|
12784
|
+
}
|
|
12785
|
+
} catch (error) {
|
|
12786
|
+
output.error(`Failed to delete agent: ${error}`);
|
|
12787
|
+
process.exit(1);
|
|
12788
|
+
} finally {
|
|
12789
|
+
await envService.dispose();
|
|
12790
|
+
}
|
|
12791
|
+
}
|
|
12792
|
+
};
|
|
12793
|
+
|
|
12794
|
+
// src/commands/agents/config-dir.ts
|
|
12795
|
+
import chalk32 from "chalk";
|
|
12796
|
+
var ConfigDirCommand = {
|
|
12797
|
+
command: "config-dir",
|
|
12798
|
+
describe: "显示 agent 配置目录路径",
|
|
12799
|
+
builder: (yargs) => yargs.option("json", {
|
|
12800
|
+
alias: "j",
|
|
12801
|
+
type: "boolean",
|
|
12802
|
+
default: false,
|
|
12803
|
+
description: "JSON 输出"
|
|
12804
|
+
}),
|
|
12805
|
+
async handler(args) {
|
|
12806
|
+
const output = new OutputService;
|
|
12807
|
+
const envService = new EnvironmentService(output);
|
|
12808
|
+
try {
|
|
12809
|
+
await envService.create({ configPath: args.config });
|
|
12810
|
+
const env = envService.getEnvironment();
|
|
12811
|
+
if (!env) {
|
|
12812
|
+
output.error("Failed to create environment");
|
|
12813
|
+
process.exit(1);
|
|
12814
|
+
}
|
|
12815
|
+
const agentComponent = env.getComponent("agent");
|
|
12816
|
+
const registry = agentComponent?.getRegistry?.();
|
|
12817
|
+
if (!registry) {
|
|
12818
|
+
output.error("Agent registry not available");
|
|
12819
|
+
process.exit(1);
|
|
12820
|
+
}
|
|
12821
|
+
const configDir = registry.getConfigDir();
|
|
12822
|
+
const exists = registry.configDirExists();
|
|
12823
|
+
if (args.json) {
|
|
12824
|
+
output.json({ configDir, exists });
|
|
12825
|
+
} else {
|
|
12826
|
+
output.log(`${chalk32.cyan("Agent Config Directory:")} ${configDir}`);
|
|
12827
|
+
output.log(`${chalk32.gray("Exists:")} ${exists ? "yes" : "no"}`);
|
|
12828
|
+
}
|
|
12829
|
+
} catch (error) {
|
|
12830
|
+
output.error(`Failed to get config dir: ${error}`);
|
|
12831
|
+
process.exit(1);
|
|
12832
|
+
} finally {
|
|
12833
|
+
await envService.dispose();
|
|
12834
|
+
}
|
|
12835
|
+
}
|
|
12836
|
+
};
|
|
12837
|
+
|
|
12838
|
+
// src/commands/agents/index.ts
|
|
12839
|
+
var AgentsCommand = {
|
|
12840
|
+
command: "agents",
|
|
12841
|
+
aliases: ["agent"],
|
|
12842
|
+
describe: "Agent 管理 - 列出、获取、添加、删除 agent 配置",
|
|
12843
|
+
builder: (yargs) => yargs.command(ListCommand4).command(GetCommand4).command(AddCommand).command(DeleteCommand3).command(ConfigDirCommand).demandCommand().help(),
|
|
12844
|
+
handler: () => {
|
|
12845
|
+
console.log("Use 'roy-agent agents --help' for usage information");
|
|
12846
|
+
}
|
|
12847
|
+
};
|
|
12848
|
+
|
|
12849
|
+
// src/commands/prompt/list.ts
|
|
12850
|
+
import chalk33 from "chalk";
|
|
12851
|
+
var ListCommand5 = {
|
|
12852
|
+
command: "list",
|
|
12853
|
+
aliases: ["ls"],
|
|
12854
|
+
describe: "列出所有可用 prompts",
|
|
12855
|
+
builder: (yargs) => yargs.option("source", {
|
|
12856
|
+
alias: "s",
|
|
12857
|
+
type: "string",
|
|
12858
|
+
choices: ["built-in", "directory", "file", "inline", "all"],
|
|
12859
|
+
default: "all",
|
|
12860
|
+
description: "按来源筛选"
|
|
12861
|
+
}).option("json", {
|
|
12862
|
+
alias: "j",
|
|
12863
|
+
type: "boolean",
|
|
12864
|
+
default: false,
|
|
12865
|
+
description: "JSON 输出"
|
|
12866
|
+
}).option("quiet", {
|
|
12867
|
+
alias: "q",
|
|
12868
|
+
type: "boolean",
|
|
12869
|
+
default: false,
|
|
12870
|
+
description: "简洁输出"
|
|
12871
|
+
}),
|
|
12872
|
+
async handler(args) {
|
|
12873
|
+
const output = new OutputService;
|
|
12874
|
+
const envService = new EnvironmentService(output);
|
|
12875
|
+
try {
|
|
12876
|
+
await envService.create({ configPath: args.config });
|
|
12877
|
+
const env = envService.getEnvironment();
|
|
12878
|
+
if (!env) {
|
|
12879
|
+
output.error("Failed to create environment");
|
|
12880
|
+
process.exit(1);
|
|
12881
|
+
}
|
|
12882
|
+
const promptComponent = env.getComponent("prompt");
|
|
12883
|
+
if (!promptComponent) {
|
|
12884
|
+
output.error("PromptComponent not available");
|
|
12885
|
+
process.exit(1);
|
|
12886
|
+
}
|
|
12887
|
+
let prompts = promptComponent.listEntries().map((entry) => ({
|
|
12888
|
+
name: entry.name,
|
|
12889
|
+
source: entry.source
|
|
12890
|
+
}));
|
|
12891
|
+
if (args.source && args.source !== "all") {
|
|
12892
|
+
prompts = prompts.filter((p) => p.source === args.source);
|
|
12893
|
+
}
|
|
12894
|
+
if (args.json) {
|
|
12895
|
+
output.json({
|
|
12896
|
+
prompts: prompts.map((p) => ({
|
|
12897
|
+
name: p.name,
|
|
12898
|
+
source: p.source
|
|
12899
|
+
})),
|
|
12900
|
+
count: prompts.length
|
|
12901
|
+
});
|
|
12902
|
+
} else if (args.quiet) {
|
|
12903
|
+
prompts.forEach((p) => output.log(p.name));
|
|
12904
|
+
} else {
|
|
12905
|
+
const header = [
|
|
12906
|
+
chalk33.bold("Name"),
|
|
12907
|
+
chalk33.bold("Source")
|
|
12908
|
+
].join(" | ");
|
|
12909
|
+
const rows = prompts.map((p) => {
|
|
12910
|
+
return [
|
|
12911
|
+
chalk33.cyan(p.name),
|
|
12912
|
+
chalk33.gray(`[${p.source}]`)
|
|
12913
|
+
].join(" | ");
|
|
12914
|
+
});
|
|
12915
|
+
if (rows.length === 0) {
|
|
12916
|
+
output.log(chalk33.yellow("No prompts found."));
|
|
12917
|
+
} else {
|
|
12918
|
+
output.log([
|
|
12919
|
+
`┌─ Prompts ${"─".repeat(50)}┐`,
|
|
12920
|
+
`│${header}│`,
|
|
12921
|
+
"├" + "─".repeat(header.length + 2) + "┤",
|
|
12922
|
+
...rows.map((r) => `│${r}│`),
|
|
12923
|
+
"└" + "─".repeat(header.length + 2) + "┘",
|
|
12924
|
+
"",
|
|
12925
|
+
chalk33.gray(`Total: ${prompts.length} prompts`)
|
|
12926
|
+
].join(`
|
|
12927
|
+
`));
|
|
12928
|
+
}
|
|
12929
|
+
}
|
|
12930
|
+
} catch (error) {
|
|
12931
|
+
output.error(`Failed to list prompts: ${error}`);
|
|
12932
|
+
process.exit(1);
|
|
12933
|
+
} finally {
|
|
12934
|
+
await envService.dispose();
|
|
12935
|
+
}
|
|
12936
|
+
}
|
|
12937
|
+
};
|
|
12938
|
+
|
|
12939
|
+
// src/commands/prompt/get.ts
|
|
12940
|
+
import chalk34 from "chalk";
|
|
12941
|
+
var GetCommand5 = {
|
|
12942
|
+
command: "get <name>",
|
|
12943
|
+
describe: "获取指定 prompt 的内容",
|
|
12944
|
+
builder: (yargs) => yargs.positional("name", {
|
|
12945
|
+
type: "string",
|
|
12946
|
+
describe: "Prompt 名称",
|
|
12947
|
+
demandOption: true
|
|
12948
|
+
}).option("json", {
|
|
12949
|
+
alias: "j",
|
|
12950
|
+
type: "boolean",
|
|
12951
|
+
default: false,
|
|
12952
|
+
description: "JSON 输出"
|
|
12953
|
+
}).option("var", {
|
|
12954
|
+
alias: "v",
|
|
12955
|
+
type: "string",
|
|
12956
|
+
array: true,
|
|
12957
|
+
description: "变量替换,格式:key=value"
|
|
12958
|
+
}),
|
|
12959
|
+
async handler(args) {
|
|
12960
|
+
const output = new OutputService;
|
|
12961
|
+
const envService = new EnvironmentService(output);
|
|
12962
|
+
try {
|
|
12963
|
+
await envService.create({ configPath: args.config });
|
|
12964
|
+
const env = envService.getEnvironment();
|
|
12965
|
+
if (!env) {
|
|
12966
|
+
output.error("Failed to create environment");
|
|
12967
|
+
process.exit(1);
|
|
12968
|
+
}
|
|
12969
|
+
const promptComponent = env.getComponent("prompt");
|
|
12970
|
+
if (!promptComponent) {
|
|
12971
|
+
output.error("PromptComponent not available");
|
|
12972
|
+
process.exit(1);
|
|
12973
|
+
}
|
|
12974
|
+
const vars = parseVars(args.var);
|
|
12975
|
+
const prompt = await promptComponent.getPrompt(args.name, vars);
|
|
12976
|
+
if (!prompt) {
|
|
12977
|
+
output.error(`Prompt not found: ${args.name}`);
|
|
12978
|
+
process.exit(1);
|
|
12979
|
+
}
|
|
12980
|
+
if (args.json) {
|
|
12981
|
+
output.json({
|
|
12982
|
+
name: args.name,
|
|
12983
|
+
content: prompt,
|
|
12984
|
+
variables: vars
|
|
12985
|
+
});
|
|
12986
|
+
} else {
|
|
12987
|
+
output.log(chalk34.bold.cyan(`# Prompt: ${args.name}`));
|
|
12988
|
+
output.log("");
|
|
12989
|
+
if (Object.keys(vars).length > 0) {
|
|
12990
|
+
output.log(chalk34.gray("Variables:"));
|
|
12991
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
12992
|
+
output.log(` ${chalk34.cyan(key + ":")} ${value}`);
|
|
12993
|
+
}
|
|
12994
|
+
output.log("");
|
|
12995
|
+
}
|
|
12996
|
+
output.log(chalk34.bold("Content:"));
|
|
12997
|
+
output.log("─".repeat(60));
|
|
12998
|
+
output.log(prompt);
|
|
12999
|
+
output.log("─".repeat(60));
|
|
13000
|
+
}
|
|
13001
|
+
} catch (error) {
|
|
13002
|
+
output.error(`Failed to get prompt: ${error}`);
|
|
13003
|
+
process.exit(1);
|
|
13004
|
+
} finally {
|
|
13005
|
+
await envService.dispose();
|
|
13006
|
+
}
|
|
13007
|
+
}
|
|
13008
|
+
};
|
|
13009
|
+
function parseVars(vars) {
|
|
13010
|
+
const result = {};
|
|
13011
|
+
if (!vars)
|
|
13012
|
+
return result;
|
|
13013
|
+
for (const v of vars) {
|
|
13014
|
+
const idx = v.indexOf("=");
|
|
13015
|
+
if (idx > 0) {
|
|
13016
|
+
const key = v.substring(0, idx);
|
|
13017
|
+
const value = v.substring(idx + 1);
|
|
13018
|
+
result[key] = value;
|
|
13019
|
+
}
|
|
13020
|
+
}
|
|
13021
|
+
return result;
|
|
13022
|
+
}
|
|
13023
|
+
|
|
13024
|
+
// src/commands/prompt/add.ts
|
|
13025
|
+
import { readFile } from "fs/promises";
|
|
13026
|
+
import chalk35 from "chalk";
|
|
13027
|
+
var AddCommand2 = {
|
|
13028
|
+
command: "add <name>",
|
|
13029
|
+
describe: "添加 prompt 并持久化到 ~/.local/share/roy-agent/prompts/",
|
|
13030
|
+
builder: (yargs) => yargs.positional("name", {
|
|
13031
|
+
type: "string",
|
|
13032
|
+
describe: "Prompt 名称",
|
|
13033
|
+
demandOption: true
|
|
13034
|
+
}).option("file", {
|
|
13035
|
+
alias: "f",
|
|
13036
|
+
type: "string",
|
|
13037
|
+
description: "从文件读取 prompt 内容"
|
|
13038
|
+
}).option("content", {
|
|
13039
|
+
alias: "c",
|
|
13040
|
+
type: "string",
|
|
13041
|
+
description: "直接指定 prompt 内容"
|
|
13042
|
+
}).option("json", {
|
|
13043
|
+
alias: "j",
|
|
13044
|
+
type: "boolean",
|
|
13045
|
+
default: false,
|
|
13046
|
+
description: "JSON 输出"
|
|
13047
|
+
}),
|
|
13048
|
+
async handler(args) {
|
|
13049
|
+
const output = new OutputService;
|
|
13050
|
+
const envService = new EnvironmentService(output);
|
|
13051
|
+
try {
|
|
13052
|
+
if (!args.file && !args.content) {
|
|
13053
|
+
output.error("Either --file or --content is required");
|
|
13054
|
+
process.exit(1);
|
|
13055
|
+
}
|
|
13056
|
+
await envService.create({ configPath: args.config });
|
|
13057
|
+
const env = envService.getEnvironment();
|
|
13058
|
+
if (!env) {
|
|
13059
|
+
output.error("Failed to create environment");
|
|
13060
|
+
process.exit(1);
|
|
13061
|
+
}
|
|
13062
|
+
const promptComponent = env.getComponent("prompt");
|
|
13063
|
+
if (!promptComponent) {
|
|
13064
|
+
output.error("PromptComponent not available");
|
|
13065
|
+
process.exit(1);
|
|
13066
|
+
}
|
|
13067
|
+
const content = args.file ? await readFile(args.file, "utf-8") : args.content;
|
|
13068
|
+
const filePath = await promptComponent.savePrompt(args.name, content);
|
|
13069
|
+
if (args.json) {
|
|
13070
|
+
output.json({
|
|
13071
|
+
name: args.name,
|
|
13072
|
+
source: "file",
|
|
13073
|
+
filePath,
|
|
13074
|
+
length: content.trim().length
|
|
13075
|
+
});
|
|
13076
|
+
} else {
|
|
13077
|
+
output.log(chalk35.green(`✓ Prompt '${args.name}' saved`));
|
|
13078
|
+
output.log(chalk35.gray(` ${filePath}`));
|
|
13079
|
+
}
|
|
13080
|
+
} catch (error) {
|
|
13081
|
+
output.error(`Failed to add prompt: ${error}`);
|
|
13082
|
+
process.exit(1);
|
|
13083
|
+
} finally {
|
|
13084
|
+
await envService.dispose();
|
|
13085
|
+
}
|
|
13086
|
+
}
|
|
13087
|
+
};
|
|
13088
|
+
|
|
13089
|
+
// src/commands/prompt/config-dir.ts
|
|
13090
|
+
import chalk36 from "chalk";
|
|
13091
|
+
var ConfigDirCommand2 = {
|
|
13092
|
+
command: "config-dir",
|
|
13093
|
+
describe: "显示 prompt 持久化目录路径",
|
|
13094
|
+
builder: (yargs) => yargs.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
|
+
await envService.create({ configPath: args.config });
|
|
13105
|
+
const env = envService.getEnvironment();
|
|
13106
|
+
if (!env) {
|
|
13107
|
+
output.error("Failed to create environment");
|
|
13108
|
+
process.exit(1);
|
|
13109
|
+
}
|
|
13110
|
+
const promptComponent = env.getComponent("prompt");
|
|
13111
|
+
if (!promptComponent) {
|
|
13112
|
+
output.error("PromptComponent not available");
|
|
13113
|
+
process.exit(1);
|
|
13114
|
+
}
|
|
13115
|
+
const configDir = promptComponent.getPromptConfigDir();
|
|
13116
|
+
const exists = promptComponent.getPromptStore().configDirExists();
|
|
13117
|
+
if (args.json) {
|
|
13118
|
+
output.json({ configDir, exists });
|
|
13119
|
+
} else {
|
|
13120
|
+
output.log(`${chalk36.cyan("Prompt Config Directory:")} ${configDir}`);
|
|
13121
|
+
output.log(`${chalk36.gray("Exists:")} ${exists ? "yes" : "no"}`);
|
|
13122
|
+
}
|
|
13123
|
+
} catch (error) {
|
|
13124
|
+
output.error(`Failed to get config dir: ${error}`);
|
|
13125
|
+
process.exit(1);
|
|
13126
|
+
} finally {
|
|
13127
|
+
await envService.dispose();
|
|
13128
|
+
}
|
|
13129
|
+
}
|
|
13130
|
+
};
|
|
13131
|
+
|
|
13132
|
+
// src/commands/prompt/index.ts
|
|
13133
|
+
var PromptCommand = {
|
|
13134
|
+
command: "prompt",
|
|
13135
|
+
describe: "Prompt 管理 - 列出、获取、添加 prompt",
|
|
13136
|
+
builder: (yargs) => yargs.command(ListCommand5).command(GetCommand5).command(AddCommand2).command(ConfigDirCommand2).demandCommand().help(),
|
|
13137
|
+
handler: () => {
|
|
13138
|
+
console.log("Use 'roy-agent prompt --help' for usage information");
|
|
13139
|
+
}
|
|
13140
|
+
};
|
|
13141
|
+
|
|
13142
|
+
// src/commands/commands-list.ts
|
|
13143
|
+
import chalk37 from "chalk";
|
|
13144
|
+
function truncateVisual(str, maxWidth) {
|
|
13145
|
+
let result = "";
|
|
13146
|
+
let width = 0;
|
|
13147
|
+
for (const char of str) {
|
|
13148
|
+
const charWidth = char.charCodeAt(0) > 255 ? 2 : 1;
|
|
13149
|
+
if (width + charWidth > maxWidth)
|
|
13150
|
+
break;
|
|
13151
|
+
result += char;
|
|
13152
|
+
width += charWidth;
|
|
13153
|
+
}
|
|
13154
|
+
return result;
|
|
13155
|
+
}
|
|
13156
|
+
function formatCommandsTable(commands) {
|
|
13157
|
+
if (commands.length === 0) {
|
|
13158
|
+
return chalk37.yellow("命令目录为空,使用 'roy-agent commands add' 添加命令");
|
|
13159
|
+
}
|
|
13160
|
+
const NAME_WIDTH = 20;
|
|
13161
|
+
const SOURCE_WIDTH = 10;
|
|
13162
|
+
const DESC_WIDTH = 50;
|
|
13163
|
+
const GAP = " ";
|
|
13164
|
+
const headerLine = [
|
|
13165
|
+
chalk37.bold("NAME".padEnd(NAME_WIDTH)),
|
|
13166
|
+
chalk37.bold("SOURCE".padEnd(SOURCE_WIDTH)),
|
|
13167
|
+
chalk37.bold("DESCRIPTION")
|
|
13168
|
+
].join(GAP);
|
|
13169
|
+
const sepLine = "─".repeat(NAME_WIDTH + SOURCE_WIDTH + DESC_WIDTH + GAP.length * 2);
|
|
13170
|
+
const formatRow = (cmd) => {
|
|
13171
|
+
const name = truncateVisual(cmd.name, NAME_WIDTH).padEnd(NAME_WIDTH);
|
|
13172
|
+
const source = cmd.source.padEnd(SOURCE_WIDTH);
|
|
13173
|
+
const desc = truncateVisual(cmd.description || "-", DESC_WIDTH);
|
|
13174
|
+
return `${name}${GAP}${source}${GAP}${desc}`;
|
|
13175
|
+
};
|
|
13176
|
+
const rows = commands.map(formatRow);
|
|
13177
|
+
return [headerLine, sepLine, ...rows].join(`
|
|
13178
|
+
`);
|
|
13179
|
+
}
|
|
13180
|
+
var CommandsListCommand = {
|
|
13181
|
+
command: "list [pattern]",
|
|
13182
|
+
describe: "列出收藏的命令(支持 glob 过滤)",
|
|
13183
|
+
builder: (yargs) => yargs.positional("pattern", {
|
|
13184
|
+
describe: "glob 过滤模式",
|
|
13185
|
+
type: "string"
|
|
13186
|
+
}).option("json", {
|
|
13187
|
+
alias: "j",
|
|
13188
|
+
describe: "JSON 格式输出",
|
|
13189
|
+
type: "boolean",
|
|
13190
|
+
default: false
|
|
13191
|
+
}).option("config", {
|
|
13192
|
+
describe: "配置文件路径",
|
|
13193
|
+
type: "string"
|
|
13194
|
+
}),
|
|
13195
|
+
async handler(args) {
|
|
13196
|
+
const output = new OutputService;
|
|
13197
|
+
const envService = new EnvironmentService(output);
|
|
13198
|
+
try {
|
|
13199
|
+
await envService.create({ configPath: args.config });
|
|
13200
|
+
const env = envService.getEnvironment();
|
|
13201
|
+
if (!env) {
|
|
13202
|
+
output.error("Failed to create environment");
|
|
13203
|
+
process.exit(1);
|
|
13204
|
+
}
|
|
13205
|
+
const commandsComponent = env.getComponent("commands");
|
|
13206
|
+
if (!commandsComponent) {
|
|
13207
|
+
output.error("CommandsComponent not available");
|
|
13208
|
+
process.exit(1);
|
|
13209
|
+
}
|
|
13210
|
+
const result = await commandsComponent.discover({ pattern: args.pattern });
|
|
13211
|
+
if (args.json) {
|
|
13212
|
+
output.json({
|
|
13213
|
+
commands: result.commands.map((cmd) => ({
|
|
13214
|
+
name: cmd.name,
|
|
13215
|
+
path: cmd.path,
|
|
13216
|
+
source: cmd.source,
|
|
13217
|
+
description: cmd.shortDescription
|
|
13218
|
+
})),
|
|
13219
|
+
stats: result.stats
|
|
13220
|
+
});
|
|
13221
|
+
} else {
|
|
13222
|
+
const rows = result.commands.map((cmd) => ({
|
|
13223
|
+
name: cmd.name,
|
|
13224
|
+
path: cmd.path,
|
|
13225
|
+
source: cmd.source === "user" ? "USER" : "PROJECT",
|
|
13226
|
+
description: cmd.shortDescription || "-"
|
|
13227
|
+
}));
|
|
13228
|
+
output.log(formatCommandsTable(rows));
|
|
13229
|
+
output.info("");
|
|
13230
|
+
output.log(chalk37.green(`✅ 共 ${result.commands.length} 个命令`) + chalk37.gray(` (user: ${result.stats.userCount}, project: ${result.stats.projectCount})`));
|
|
13231
|
+
}
|
|
13232
|
+
} catch (error) {
|
|
13233
|
+
output.error(`Failed to list commands: ${error}`);
|
|
13234
|
+
process.exit(1);
|
|
13235
|
+
} finally {
|
|
13236
|
+
await envService.dispose();
|
|
13237
|
+
}
|
|
13238
|
+
}
|
|
13239
|
+
};
|
|
13240
|
+
|
|
13241
|
+
// src/commands/commands-add.ts
|
|
13242
|
+
import chalk38 from "chalk";
|
|
13243
|
+
var CommandsAddCommand = {
|
|
13244
|
+
command: "add <name> <target>",
|
|
13245
|
+
describe: "添加收藏命令(自动创建 symlink)",
|
|
13246
|
+
builder: (yargs) => yargs.positional("name", {
|
|
13247
|
+
describe: "命令名称",
|
|
13248
|
+
type: "string",
|
|
13249
|
+
demandOption: true
|
|
13250
|
+
}).positional("target", {
|
|
13251
|
+
describe: "目标命令路径或名称",
|
|
13252
|
+
type: "string",
|
|
13253
|
+
demandOption: true
|
|
13254
|
+
}).option("global", {
|
|
13255
|
+
alias: "g",
|
|
13256
|
+
describe: "添加到用户级别目录(默认)",
|
|
13257
|
+
type: "boolean",
|
|
13258
|
+
default: true
|
|
13259
|
+
}).option("local", {
|
|
13260
|
+
alias: "l",
|
|
13261
|
+
describe: "添加到项目级别目录",
|
|
13262
|
+
type: "boolean",
|
|
13263
|
+
default: false
|
|
13264
|
+
}).option("description", {
|
|
13265
|
+
alias: "d",
|
|
13266
|
+
describe: "命令功能描述(用于 AI Prompt 注入)",
|
|
13267
|
+
type: "string",
|
|
13268
|
+
demandOption: true
|
|
13269
|
+
}).option("tips", {
|
|
13270
|
+
alias: "t",
|
|
13271
|
+
describe: "探索提示(告诉用户如何使用 --help 探索)",
|
|
13272
|
+
type: "string",
|
|
13273
|
+
demandOption: true
|
|
13274
|
+
}).option("config", {
|
|
13275
|
+
describe: "配置文件路径",
|
|
13276
|
+
type: "string"
|
|
13277
|
+
}),
|
|
13278
|
+
async handler(args) {
|
|
13279
|
+
const output = new OutputService;
|
|
13280
|
+
const envService = new EnvironmentService(output);
|
|
13281
|
+
try {
|
|
13282
|
+
await envService.create({ configPath: args.config });
|
|
13283
|
+
const env = envService.getEnvironment();
|
|
13284
|
+
if (!env) {
|
|
13285
|
+
output.error("Failed to create environment");
|
|
13286
|
+
process.exit(1);
|
|
13287
|
+
}
|
|
13288
|
+
const commandsComponent = env.getComponent("commands");
|
|
13289
|
+
if (!commandsComponent) {
|
|
13290
|
+
output.error("CommandsComponent not available");
|
|
13291
|
+
process.exit(1);
|
|
13292
|
+
}
|
|
13293
|
+
const source = args.local ? "project" : "user";
|
|
13294
|
+
await commandsComponent.add({
|
|
13295
|
+
name: args.name,
|
|
13296
|
+
target: args.target,
|
|
13297
|
+
source,
|
|
13298
|
+
description: args.description,
|
|
13299
|
+
tips: args.tips
|
|
13300
|
+
});
|
|
13301
|
+
const dirs = await commandsComponent.getCommandDirs();
|
|
13302
|
+
const targetDir = source === "user" ? dirs.user : dirs.project;
|
|
13303
|
+
output.log(chalk38.green(`✅ 已添加命令 '${args.name}'`));
|
|
13304
|
+
output.log(chalk38.gray(` 目标: ${args.target}`));
|
|
13305
|
+
output.log(chalk38.gray(` 位置: ${targetDir}/${args.name}`));
|
|
13306
|
+
output.log(chalk38.gray(` 级别: ${source === "user" ? "USER" : "PROJECT"}`));
|
|
13307
|
+
} catch (error) {
|
|
13308
|
+
output.error(`添加失败: ${error.message}`);
|
|
13309
|
+
process.exit(1);
|
|
13310
|
+
} finally {
|
|
13311
|
+
await envService.dispose();
|
|
13312
|
+
}
|
|
13313
|
+
}
|
|
13314
|
+
};
|
|
13315
|
+
|
|
13316
|
+
// src/commands/commands-remove.ts
|
|
13317
|
+
import chalk39 from "chalk";
|
|
13318
|
+
var CommandsRemoveCommand = {
|
|
13319
|
+
command: "remove <name>",
|
|
13320
|
+
aliases: ["rm"],
|
|
13321
|
+
describe: "移除收藏命令",
|
|
13322
|
+
builder: (yargs) => yargs.positional("name", {
|
|
13323
|
+
describe: "命令名称",
|
|
13324
|
+
type: "string",
|
|
13325
|
+
demandOption: true
|
|
13326
|
+
}).option("global", {
|
|
13327
|
+
alias: "g",
|
|
13328
|
+
describe: "从用户级别目录移除",
|
|
13329
|
+
type: "boolean",
|
|
13330
|
+
default: false
|
|
13331
|
+
}).option("local", {
|
|
13332
|
+
alias: "l",
|
|
13333
|
+
describe: "从项目级别目录移除",
|
|
13334
|
+
type: "boolean",
|
|
13335
|
+
default: false
|
|
13336
|
+
}).option("config", {
|
|
13337
|
+
describe: "配置文件路径",
|
|
13338
|
+
type: "string"
|
|
12552
13339
|
}),
|
|
12553
13340
|
async handler(args) {
|
|
12554
13341
|
const output = new OutputService;
|
|
@@ -12571,7 +13358,7 @@ var CommandsRemoveCommand = {
|
|
|
12571
13358
|
name: args.name,
|
|
12572
13359
|
source: "user"
|
|
12573
13360
|
});
|
|
12574
|
-
output.log(
|
|
13361
|
+
output.log(chalk39.green(`✅ 已从用户目录移除命令 '${args.name}'`));
|
|
12575
13362
|
} catch (error) {
|
|
12576
13363
|
if (!error.message?.includes("不存在")) {
|
|
12577
13364
|
throw error;
|
|
@@ -12584,7 +13371,7 @@ var CommandsRemoveCommand = {
|
|
|
12584
13371
|
name: args.name,
|
|
12585
13372
|
source: "project"
|
|
12586
13373
|
});
|
|
12587
|
-
output.log(
|
|
13374
|
+
output.log(chalk39.green(`✅ 已从项目目录移除命令 '${args.name}'`));
|
|
12588
13375
|
} catch (error) {
|
|
12589
13376
|
if (!error.message?.includes("不存在")) {
|
|
12590
13377
|
throw error;
|
|
@@ -12598,7 +13385,7 @@ var CommandsRemoveCommand = {
|
|
|
12598
13385
|
name: args.name,
|
|
12599
13386
|
source: "user"
|
|
12600
13387
|
});
|
|
12601
|
-
output.log(
|
|
13388
|
+
output.log(chalk39.green(`✅ 已从用户目录移除命令 '${args.name}'`));
|
|
12602
13389
|
removed = true;
|
|
12603
13390
|
} catch (error) {
|
|
12604
13391
|
if (!error.message?.includes("不存在")) {
|
|
@@ -12610,7 +13397,7 @@ var CommandsRemoveCommand = {
|
|
|
12610
13397
|
name: args.name,
|
|
12611
13398
|
source: "project"
|
|
12612
13399
|
});
|
|
12613
|
-
output.log(
|
|
13400
|
+
output.log(chalk39.green(`✅ 已从项目目录移除命令 '${args.name}'`));
|
|
12614
13401
|
removed = true;
|
|
12615
13402
|
} catch (error) {
|
|
12616
13403
|
if (!error.message?.includes("不存在")) {
|
|
@@ -12632,7 +13419,7 @@ var CommandsRemoveCommand = {
|
|
|
12632
13419
|
};
|
|
12633
13420
|
|
|
12634
13421
|
// src/commands/commands-info.ts
|
|
12635
|
-
import
|
|
13422
|
+
import chalk40 from "chalk";
|
|
12636
13423
|
import { exec } from "child_process";
|
|
12637
13424
|
import { promisify } from "util";
|
|
12638
13425
|
var execAsync = promisify(exec);
|
|
@@ -12667,12 +13454,12 @@ var CommandsInfoCommand = {
|
|
|
12667
13454
|
output.error(`命令 '${args.name}' 不存在`);
|
|
12668
13455
|
process.exit(1);
|
|
12669
13456
|
}
|
|
12670
|
-
output.log(
|
|
12671
|
-
output.log(
|
|
12672
|
-
output.log(
|
|
12673
|
-
output.log(
|
|
13457
|
+
output.log(chalk40.bold("Name:") + ` ${info.name}`);
|
|
13458
|
+
output.log(chalk40.bold("Path:") + ` ${info.path}`);
|
|
13459
|
+
output.log(chalk40.bold("Source:") + ` ${info.source.toUpperCase()}`);
|
|
13460
|
+
output.log(chalk40.bold("Description:") + ` ${info.shortDescription || "-"}`);
|
|
12674
13461
|
output.log();
|
|
12675
|
-
output.log(
|
|
13462
|
+
output.log(chalk40.gray("─".repeat(50)));
|
|
12676
13463
|
output.log();
|
|
12677
13464
|
try {
|
|
12678
13465
|
const { stdout } = await execAsync(`${info.path} --help`, { timeout: 5000 });
|
|
@@ -12682,7 +13469,7 @@ var CommandsInfoCommand = {
|
|
|
12682
13469
|
const { stdout } = await execAsync(`${info.path} -h`, { timeout: 5000 });
|
|
12683
13470
|
output.log(stdout);
|
|
12684
13471
|
} catch {
|
|
12685
|
-
output.log(
|
|
13472
|
+
output.log(chalk40.gray("(无法获取帮助信息)"));
|
|
12686
13473
|
}
|
|
12687
13474
|
}
|
|
12688
13475
|
} catch (error) {
|
|
@@ -12695,7 +13482,7 @@ var CommandsInfoCommand = {
|
|
|
12695
13482
|
};
|
|
12696
13483
|
|
|
12697
13484
|
// src/commands/commands-dirs.ts
|
|
12698
|
-
import
|
|
13485
|
+
import chalk41 from "chalk";
|
|
12699
13486
|
var CommandsDirsCommand = {
|
|
12700
13487
|
command: "dirs",
|
|
12701
13488
|
describe: "显示命令目录",
|
|
@@ -12727,10 +13514,10 @@ var CommandsDirsCommand = {
|
|
|
12727
13514
|
if (args.json) {
|
|
12728
13515
|
output.json(dirs);
|
|
12729
13516
|
} else {
|
|
12730
|
-
output.log(
|
|
13517
|
+
output.log(chalk41.bold("命令目录:"));
|
|
12731
13518
|
output.log();
|
|
12732
|
-
output.log(
|
|
12733
|
-
output.log(
|
|
13519
|
+
output.log(chalk41.cyan("USER:") + ` ${dirs.user}`);
|
|
13520
|
+
output.log(chalk41.cyan("PROJECT:") + ` ${dirs.project}`);
|
|
12734
13521
|
}
|
|
12735
13522
|
} catch (error) {
|
|
12736
13523
|
output.error(`错误: ${error.message}`);
|
|
@@ -12750,7 +13537,7 @@ var CommandsCommand = {
|
|
|
12750
13537
|
};
|
|
12751
13538
|
|
|
12752
13539
|
// src/commands/config/list.ts
|
|
12753
|
-
import
|
|
13540
|
+
import chalk42 from "chalk";
|
|
12754
13541
|
|
|
12755
13542
|
// src/commands/config/config-service.ts
|
|
12756
13543
|
import * as fsSync from "fs";
|
|
@@ -12779,6 +13566,7 @@ function deepMerge(target, source) {
|
|
|
12779
13566
|
class ConfigService {
|
|
12780
13567
|
configComponent;
|
|
12781
13568
|
output;
|
|
13569
|
+
envService;
|
|
12782
13570
|
constructor(configComponent, output) {
|
|
12783
13571
|
this.configComponent = configComponent;
|
|
12784
13572
|
this.output = output;
|
|
@@ -12961,11 +13749,16 @@ var SUPPORTED_COMPONENTS = [
|
|
|
12961
13749
|
"mcp",
|
|
12962
13750
|
"agent",
|
|
12963
13751
|
"log-trace",
|
|
12964
|
-
"lsp"
|
|
13752
|
+
"lsp",
|
|
13753
|
+
"prompt"
|
|
12965
13754
|
];
|
|
12966
13755
|
var COMPONENT_ALIASES = {
|
|
12967
13756
|
session: "session",
|
|
12968
|
-
sessions: "session"
|
|
13757
|
+
sessions: "session",
|
|
13758
|
+
agents: "agent",
|
|
13759
|
+
agent: "agent",
|
|
13760
|
+
prompts: "prompt",
|
|
13761
|
+
prompt: "prompt"
|
|
12969
13762
|
};
|
|
12970
13763
|
function resolveComponentName(name) {
|
|
12971
13764
|
return COMPONENT_ALIASES[name] ?? name;
|
|
@@ -12981,7 +13774,8 @@ var COMPONENT_DESCRIPTIONS = {
|
|
|
12981
13774
|
mcp: "MCP Component - MCP 服务器管理",
|
|
12982
13775
|
agent: "Agent Component - Agent 配置和循环控制",
|
|
12983
13776
|
"log-trace": "LogTrace Component - 日志和追踪管理",
|
|
12984
|
-
lsp: "LSP Component - 语言服务器协议管理"
|
|
13777
|
+
lsp: "LSP Component - 语言服务器协议管理",
|
|
13778
|
+
prompt: "Prompt Component - Prompt 模板管理"
|
|
12985
13779
|
};
|
|
12986
13780
|
|
|
12987
13781
|
// src/commands/config/list.ts
|
|
@@ -13032,6 +13826,7 @@ var ConfigListCommand = {
|
|
|
13032
13826
|
process.exit(1);
|
|
13033
13827
|
}
|
|
13034
13828
|
const configService = new ConfigService(configComponent, output);
|
|
13829
|
+
configService.envService = envService;
|
|
13035
13830
|
if (!args.component) {
|
|
13036
13831
|
showHelp(output);
|
|
13037
13832
|
return;
|
|
@@ -13046,7 +13841,7 @@ var ConfigListCommand = {
|
|
|
13046
13841
|
output.log("");
|
|
13047
13842
|
output.log("Supported components:");
|
|
13048
13843
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
13049
|
-
output.log(` ${
|
|
13844
|
+
output.log(` ${chalk42.cyan(comp.padEnd(15))} ${COMPONENT_DESCRIPTIONS[comp] || ""}`);
|
|
13050
13845
|
}
|
|
13051
13846
|
process.exit(1);
|
|
13052
13847
|
}
|
|
@@ -13064,27 +13859,27 @@ var ConfigListCommand = {
|
|
|
13064
13859
|
}
|
|
13065
13860
|
};
|
|
13066
13861
|
function showHelp(output) {
|
|
13067
|
-
output.log(
|
|
13862
|
+
output.log(chalk42.bold.cyan("# roy-agent config list"));
|
|
13068
13863
|
output.log("");
|
|
13069
13864
|
output.log("查看 roy-agent 组件配置信息");
|
|
13070
13865
|
output.log("");
|
|
13071
|
-
output.log(
|
|
13072
|
-
output.log(` ${
|
|
13866
|
+
output.log(chalk42.bold("Usage:"));
|
|
13867
|
+
output.log(` ${chalk42.cyan("roy-agent config list [component] [options]")}`);
|
|
13073
13868
|
output.log("");
|
|
13074
|
-
output.log(
|
|
13869
|
+
output.log(chalk42.bold("Components:"));
|
|
13075
13870
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
13076
|
-
output.log(` ${
|
|
13871
|
+
output.log(` ${chalk42.cyan(comp.padEnd(15))} ${chalk42.gray(COMPONENT_DESCRIPTIONS[comp] || "")}`);
|
|
13077
13872
|
}
|
|
13078
|
-
output.log(` ${
|
|
13873
|
+
output.log(` ${chalk42.cyan("all".padEnd(15))} 显示所有 components 概览`);
|
|
13079
13874
|
output.log("");
|
|
13080
|
-
output.log(
|
|
13081
|
-
output.log(` ${
|
|
13082
|
-
output.log(` ${
|
|
13083
|
-
output.log(` ${
|
|
13875
|
+
output.log(chalk42.bold("Options:"));
|
|
13876
|
+
output.log(` ${chalk42.cyan("-j, --json")} JSON 格式输出`);
|
|
13877
|
+
output.log(` ${chalk42.cyan("-k, --keys")} 只显示配置键`);
|
|
13878
|
+
output.log(` ${chalk42.cyan("-s, --sources")} 只显示配置源`);
|
|
13084
13879
|
output.log("");
|
|
13085
|
-
output.log(
|
|
13880
|
+
output.log(chalk42.bold("Examples:"));
|
|
13086
13881
|
for (const { command, description } of USAGE_COMMANDS) {
|
|
13087
|
-
output.log(` ${
|
|
13882
|
+
output.log(` ${chalk42.cyan(command.padEnd(40))} ${chalk42.gray(description)}`);
|
|
13088
13883
|
}
|
|
13089
13884
|
}
|
|
13090
13885
|
async function showAllComponents(output, configService) {
|
|
@@ -13093,16 +13888,24 @@ async function showAllComponents(output, configService) {
|
|
|
13093
13888
|
const config = configService.getComponentConfig(compName);
|
|
13094
13889
|
components.push({ name: compName, config });
|
|
13095
13890
|
}
|
|
13096
|
-
output.log(
|
|
13891
|
+
output.log(chalk42.bold.cyan("# All Components Overview"));
|
|
13097
13892
|
output.log("");
|
|
13098
|
-
output.log(` ${
|
|
13099
|
-
output.log(` ${
|
|
13893
|
+
output.log(` ${chalk42.cyan("Component".padEnd(15))} ${chalk42.cyan("Keys".padEnd(10))} ${chalk42.gray("Description")}`);
|
|
13894
|
+
output.log(` ${chalk42.gray("─".repeat(60))}`);
|
|
13100
13895
|
for (const comp of components) {
|
|
13101
13896
|
const keyCount = Object.keys(comp.config).length;
|
|
13102
|
-
output.log(` ${
|
|
13897
|
+
output.log(` ${chalk42.cyan(comp.name.padEnd(15))} ${keyCount.toString().padEnd(10)} ${chalk42.gray(COMPONENT_DESCRIPTIONS[comp.name] || "")}`);
|
|
13103
13898
|
}
|
|
13104
13899
|
}
|
|
13105
13900
|
async function showComponentConfig(componentName, output, configService, options) {
|
|
13901
|
+
if (componentName === "agent") {
|
|
13902
|
+
await showAgentComponentConfig(output, configService, options);
|
|
13903
|
+
return;
|
|
13904
|
+
}
|
|
13905
|
+
if (componentName === "prompt") {
|
|
13906
|
+
await showPromptComponentConfig(output, configService, options, configService.envService);
|
|
13907
|
+
return;
|
|
13908
|
+
}
|
|
13106
13909
|
const config = configService.getComponentConfig(componentName);
|
|
13107
13910
|
const filePath = configService.getComponentFilePath(componentName);
|
|
13108
13911
|
if (options.json) {
|
|
@@ -13113,26 +13916,136 @@ async function showComponentConfig(componentName, output, configService, options
|
|
|
13113
13916
|
});
|
|
13114
13917
|
return;
|
|
13115
13918
|
}
|
|
13116
|
-
output.log(
|
|
13919
|
+
output.log(chalk42.bold.cyan(`# ${componentName} Component Configuration`));
|
|
13920
|
+
output.log("");
|
|
13921
|
+
if (filePath) {
|
|
13922
|
+
output.log(chalk42.bold("File:"));
|
|
13923
|
+
output.log(` ${chalk42.cyan(filePath)}`);
|
|
13924
|
+
output.log("");
|
|
13925
|
+
}
|
|
13926
|
+
if (!options.sources) {
|
|
13927
|
+
output.log(chalk42.bold("Configuration:"));
|
|
13928
|
+
if (Object.keys(config).length === 0) {
|
|
13929
|
+
output.log(` ${chalk42.gray("(无配置)")}`);
|
|
13930
|
+
} else {
|
|
13931
|
+
const flatConfig = flattenConfig(config);
|
|
13932
|
+
for (const [key, value] of flatConfig) {
|
|
13933
|
+
const displayValue = formatValue(value);
|
|
13934
|
+
output.log(` ${chalk42.cyan(key + ":")} ${displayValue}`);
|
|
13935
|
+
}
|
|
13936
|
+
}
|
|
13937
|
+
output.log("");
|
|
13938
|
+
}
|
|
13939
|
+
}
|
|
13940
|
+
async function showAgentComponentConfig(output, configService, options) {
|
|
13941
|
+
const config = configService.getComponentConfig("agent");
|
|
13942
|
+
if (options.json) {
|
|
13943
|
+
output.json({
|
|
13944
|
+
name: "agent",
|
|
13945
|
+
config
|
|
13946
|
+
});
|
|
13947
|
+
return;
|
|
13948
|
+
}
|
|
13949
|
+
output.log(chalk42.bold.cyan("# Agent Component Configuration"));
|
|
13950
|
+
output.log("");
|
|
13951
|
+
if (!options.sources) {
|
|
13952
|
+
output.log(chalk42.bold("Configuration:"));
|
|
13953
|
+
if (Object.keys(config).length === 0) {
|
|
13954
|
+
output.log(` ${chalk42.gray("(无配置,使用默认值)")}`);
|
|
13955
|
+
} else {
|
|
13956
|
+
const flatConfig = flattenConfig(config);
|
|
13957
|
+
for (const [key, value] of flatConfig) {
|
|
13958
|
+
const displayValue = formatValue(value);
|
|
13959
|
+
output.log(` ${chalk42.cyan(key + ":")} ${displayValue}`);
|
|
13960
|
+
}
|
|
13961
|
+
}
|
|
13962
|
+
output.log("");
|
|
13963
|
+
}
|
|
13964
|
+
const envService = configService.envService;
|
|
13965
|
+
const env = envService?.getEnvironment?.();
|
|
13966
|
+
if (env) {
|
|
13967
|
+
const agentComponent = env.getComponent?.("agent");
|
|
13968
|
+
const registry = agentComponent?.getRegistry?.();
|
|
13969
|
+
if (registry) {
|
|
13970
|
+
const configDir = registry.getConfigDir();
|
|
13971
|
+
const exists = registry.configDirExists();
|
|
13972
|
+
const agentCount = registry.list().length;
|
|
13973
|
+
output.log(chalk42.bold("Agent Config Directory:"));
|
|
13974
|
+
output.log(` ${chalk42.cyan("path:")} ${configDir}`);
|
|
13975
|
+
output.log(` ${chalk42.cyan("exists:")} ${exists ? chalk42.green("yes") : chalk42.red("no")}`);
|
|
13976
|
+
output.log(` ${chalk42.cyan("agents:")} ${agentCount} loaded`);
|
|
13977
|
+
output.log("");
|
|
13978
|
+
}
|
|
13979
|
+
}
|
|
13980
|
+
}
|
|
13981
|
+
async function showPromptComponentConfig(output, configService, options, envService) {
|
|
13982
|
+
const config = configService.getComponentConfig("prompt");
|
|
13983
|
+
const filePath = configService.getComponentFilePath("prompt");
|
|
13984
|
+
if (options.json) {
|
|
13985
|
+
output.json({
|
|
13986
|
+
name: "prompt",
|
|
13987
|
+
filePath,
|
|
13988
|
+
config
|
|
13989
|
+
});
|
|
13990
|
+
return;
|
|
13991
|
+
}
|
|
13992
|
+
output.log(chalk42.bold.cyan("# Prompt Component Configuration"));
|
|
13117
13993
|
output.log("");
|
|
13118
13994
|
if (filePath) {
|
|
13119
|
-
output.log(
|
|
13120
|
-
output.log(` ${
|
|
13995
|
+
output.log(chalk42.bold("File:"));
|
|
13996
|
+
output.log(` ${chalk42.cyan(filePath)}`);
|
|
13121
13997
|
output.log("");
|
|
13122
13998
|
}
|
|
13123
13999
|
if (!options.sources) {
|
|
13124
|
-
output.log(
|
|
14000
|
+
output.log(chalk42.bold("Configuration:"));
|
|
13125
14001
|
if (Object.keys(config).length === 0) {
|
|
13126
|
-
output.log(` ${
|
|
14002
|
+
output.log(` ${chalk42.gray("(无配置,使用默认值)")}`);
|
|
13127
14003
|
} else {
|
|
13128
14004
|
const flatConfig = flattenConfig(config);
|
|
13129
14005
|
for (const [key, value] of flatConfig) {
|
|
13130
14006
|
const displayValue = formatValue(value);
|
|
13131
|
-
output.log(` ${
|
|
14007
|
+
output.log(` ${chalk42.cyan(key + ":")} ${displayValue}`);
|
|
13132
14008
|
}
|
|
13133
14009
|
}
|
|
13134
14010
|
output.log("");
|
|
13135
14011
|
}
|
|
14012
|
+
output.log(chalk42.bold("Prompts:"));
|
|
14013
|
+
output.log(` ${chalk42.gray("- 内置: 5 个(default, coding, review, project-memory, global-memory)")}`);
|
|
14014
|
+
const promptPaths = config?.promptPaths;
|
|
14015
|
+
if (promptPaths && Array.isArray(promptPaths) && promptPaths.length > 0) {
|
|
14016
|
+
output.log(` ${chalk42.gray("- 外部: " + promptPaths.length + " 个路径")}`);
|
|
14017
|
+
for (const p of promptPaths) {
|
|
14018
|
+
output.log(` ${chalk42.cyan(p.path)} ${chalk42.gray("(type: " + p.type + ")")}`);
|
|
14019
|
+
}
|
|
14020
|
+
} else {
|
|
14021
|
+
output.log(` ${chalk42.gray("- 外部: 0 个(未配置 promptPaths)")}`);
|
|
14022
|
+
}
|
|
14023
|
+
output.log("");
|
|
14024
|
+
const defaultName = config?.defaultName || "default";
|
|
14025
|
+
output.log(chalk42.bold("Default Prompt:"));
|
|
14026
|
+
output.log(` ${chalk42.cyan("defaultName:")} ${defaultName}`);
|
|
14027
|
+
output.log("");
|
|
14028
|
+
const env = envService?.getEnvironment?.();
|
|
14029
|
+
if (env) {
|
|
14030
|
+
const promptComponent = env.getComponent?.("prompt");
|
|
14031
|
+
if (promptComponent) {
|
|
14032
|
+
const configDir = promptComponent.getPromptConfigDir?.();
|
|
14033
|
+
const exists = promptComponent.getPromptStore?.()?.configDirExists?.();
|
|
14034
|
+
if (configDir) {
|
|
14035
|
+
let promptCount = 0;
|
|
14036
|
+
try {
|
|
14037
|
+
const store = promptComponent.getPromptStore?.();
|
|
14038
|
+
const stored = await store?.loadAll?.();
|
|
14039
|
+
promptCount = Array.isArray(stored) ? stored.length : 0;
|
|
14040
|
+
} catch {}
|
|
14041
|
+
output.log(chalk42.bold("Prompt Storage Directory:"));
|
|
14042
|
+
output.log(` ${chalk42.cyan("path:")} ${configDir}`);
|
|
14043
|
+
output.log(` ${chalk42.cyan("exists:")} ${exists ? chalk42.green("yes") : chalk42.red("no")}`);
|
|
14044
|
+
output.log(` ${chalk42.cyan("prompts:")} ${promptCount} loaded`);
|
|
14045
|
+
output.log("");
|
|
14046
|
+
}
|
|
14047
|
+
}
|
|
14048
|
+
}
|
|
13136
14049
|
}
|
|
13137
14050
|
function flattenConfig(obj, prefix = "") {
|
|
13138
14051
|
const result = [];
|
|
@@ -13154,19 +14067,19 @@ function flattenConfig(obj, prefix = "") {
|
|
|
13154
14067
|
}
|
|
13155
14068
|
function formatValue(value) {
|
|
13156
14069
|
if (value === undefined) {
|
|
13157
|
-
return
|
|
14070
|
+
return chalk42.gray("undefined");
|
|
13158
14071
|
}
|
|
13159
14072
|
if (value === null) {
|
|
13160
|
-
return
|
|
14073
|
+
return chalk42.gray("null");
|
|
13161
14074
|
}
|
|
13162
14075
|
if (typeof value === "object") {
|
|
13163
|
-
return
|
|
14076
|
+
return chalk42.gray(JSON.stringify(value));
|
|
13164
14077
|
}
|
|
13165
14078
|
return String(value);
|
|
13166
14079
|
}
|
|
13167
14080
|
|
|
13168
14081
|
// src/commands/config/export.ts
|
|
13169
|
-
import
|
|
14082
|
+
import chalk43 from "chalk";
|
|
13170
14083
|
var ConfigExportCommand = {
|
|
13171
14084
|
command: "export <component>",
|
|
13172
14085
|
describe: "导出组件配置到文件",
|
|
@@ -13211,7 +14124,7 @@ var ConfigExportCommand = {
|
|
|
13211
14124
|
output.log("");
|
|
13212
14125
|
output.log("Supported components:");
|
|
13213
14126
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
13214
|
-
output.log(` ${
|
|
14127
|
+
output.log(` ${chalk43.cyan(comp)}`);
|
|
13215
14128
|
}
|
|
13216
14129
|
process.exit(1);
|
|
13217
14130
|
}
|
|
@@ -13229,7 +14142,7 @@ var ConfigExportCommand = {
|
|
|
13229
14142
|
};
|
|
13230
14143
|
|
|
13231
14144
|
// src/commands/config/import.ts
|
|
13232
|
-
import
|
|
14145
|
+
import chalk44 from "chalk";
|
|
13233
14146
|
var ConfigImportCommand = {
|
|
13234
14147
|
command: "import <component>",
|
|
13235
14148
|
describe: "从文件导入配置到组件的 file source",
|
|
@@ -13279,7 +14192,7 @@ var ConfigImportCommand = {
|
|
|
13279
14192
|
output.log("");
|
|
13280
14193
|
output.log("Supported components:");
|
|
13281
14194
|
for (const comp of SUPPORTED_COMPONENTS) {
|
|
13282
|
-
output.log(` ${
|
|
14195
|
+
output.log(` ${chalk44.cyan(comp)}`);
|
|
13283
14196
|
}
|
|
13284
14197
|
process.exit(1);
|
|
13285
14198
|
}
|
|
@@ -13294,7 +14207,7 @@ var ConfigImportCommand = {
|
|
|
13294
14207
|
}
|
|
13295
14208
|
if (result.merged && result.changes.length > 0 && args.verbose) {
|
|
13296
14209
|
output.log("");
|
|
13297
|
-
output.log(
|
|
14210
|
+
output.log(chalk44.bold("变更详情:"));
|
|
13298
14211
|
for (const change of result.changes) {
|
|
13299
14212
|
output.log(` ${change.key}: ${JSON.stringify(change.oldValue)} → ${JSON.stringify(change.newValue)}`);
|
|
13300
14213
|
}
|
|
@@ -13318,8 +14231,8 @@ var ConfigCommand = {
|
|
|
13318
14231
|
};
|
|
13319
14232
|
|
|
13320
14233
|
// src/commands/mcp/list.ts
|
|
13321
|
-
import
|
|
13322
|
-
var
|
|
14234
|
+
import chalk45 from "chalk";
|
|
14235
|
+
var ListCommand6 = {
|
|
13323
14236
|
command: "list",
|
|
13324
14237
|
aliases: ["ls"],
|
|
13325
14238
|
describe: "列出所有 MCP 服务器及其状态",
|
|
@@ -13364,30 +14277,30 @@ var ListCommand4 = {
|
|
|
13364
14277
|
servers.forEach((s) => output.log(s.name));
|
|
13365
14278
|
} else {
|
|
13366
14279
|
if (servers.length === 0) {
|
|
13367
|
-
output.log(
|
|
14280
|
+
output.log(chalk45.yellow("No MCP servers configured"));
|
|
13368
14281
|
return;
|
|
13369
14282
|
}
|
|
13370
14283
|
const statusColor = (status) => {
|
|
13371
14284
|
switch (status) {
|
|
13372
14285
|
case "connected":
|
|
13373
|
-
return
|
|
14286
|
+
return chalk45.green;
|
|
13374
14287
|
case "connecting":
|
|
13375
|
-
return
|
|
14288
|
+
return chalk45.yellow;
|
|
13376
14289
|
case "error":
|
|
13377
|
-
return
|
|
14290
|
+
return chalk45.red;
|
|
13378
14291
|
case "disconnected":
|
|
13379
|
-
return
|
|
14292
|
+
return chalk45.gray;
|
|
13380
14293
|
default:
|
|
13381
|
-
return
|
|
14294
|
+
return chalk45.white;
|
|
13382
14295
|
}
|
|
13383
14296
|
};
|
|
13384
14297
|
const header = [
|
|
13385
|
-
|
|
13386
|
-
|
|
13387
|
-
|
|
14298
|
+
chalk45.bold("Name"),
|
|
14299
|
+
chalk45.bold("Status"),
|
|
14300
|
+
chalk45.bold("Tools")
|
|
13388
14301
|
].join(" | ");
|
|
13389
14302
|
const rows = servers.map((s) => [
|
|
13390
|
-
|
|
14303
|
+
chalk45.cyan(s.name),
|
|
13391
14304
|
statusColor(s.status)(`[${s.status}]`),
|
|
13392
14305
|
s.toolsCount !== undefined ? String(s.toolsCount) : "-"
|
|
13393
14306
|
].join(" | "));
|
|
@@ -13398,7 +14311,7 @@ var ListCommand4 = {
|
|
|
13398
14311
|
...rows.map((r) => `│${r}│`),
|
|
13399
14312
|
"└" + "─".repeat(header.length + 2) + "┘",
|
|
13400
14313
|
"",
|
|
13401
|
-
|
|
14314
|
+
chalk45.gray(`Total: ${servers.length} servers`)
|
|
13402
14315
|
].join(`
|
|
13403
14316
|
`));
|
|
13404
14317
|
}
|
|
@@ -13412,7 +14325,7 @@ var ListCommand4 = {
|
|
|
13412
14325
|
};
|
|
13413
14326
|
|
|
13414
14327
|
// src/commands/mcp/tools.ts
|
|
13415
|
-
import
|
|
14328
|
+
import chalk46 from "chalk";
|
|
13416
14329
|
var ToolsCommand = {
|
|
13417
14330
|
command: "tools",
|
|
13418
14331
|
aliases: ["t"],
|
|
@@ -13465,7 +14378,7 @@ var ToolsCommand = {
|
|
|
13465
14378
|
tools.forEach((t) => output.log(t.name));
|
|
13466
14379
|
} else {
|
|
13467
14380
|
if (tools.length === 0) {
|
|
13468
|
-
output.log(
|
|
14381
|
+
output.log(chalk46.yellow("No MCP tools available"));
|
|
13469
14382
|
return;
|
|
13470
14383
|
}
|
|
13471
14384
|
const byServer = new Map;
|
|
@@ -13477,15 +14390,15 @@ var ToolsCommand = {
|
|
|
13477
14390
|
byServer.get(serverName).push(tool);
|
|
13478
14391
|
}
|
|
13479
14392
|
for (const [serverName, serverTools] of byServer) {
|
|
13480
|
-
output.log(
|
|
14393
|
+
output.log(chalk46.bold.cyan(`
|
|
13481
14394
|
[${serverName}] ${serverTools.length} tools`));
|
|
13482
14395
|
for (const tool of serverTools) {
|
|
13483
14396
|
const desc = tool.description.length > 80 ? tool.description.slice(0, 77) + "..." : tool.description;
|
|
13484
|
-
output.log(` ${
|
|
13485
|
-
output.log(` ${
|
|
14397
|
+
output.log(` ${chalk46.green("+")} ${chalk46.white(tool.name)}`);
|
|
14398
|
+
output.log(` ${chalk46.gray(desc)}`);
|
|
13486
14399
|
}
|
|
13487
14400
|
}
|
|
13488
|
-
output.log(
|
|
14401
|
+
output.log(chalk46.gray(`
|
|
13489
14402
|
Total: ${tools.length} tools across ${byServer.size} servers`));
|
|
13490
14403
|
}
|
|
13491
14404
|
} catch (error) {
|
|
@@ -13498,7 +14411,7 @@ Total: ${tools.length} tools across ${byServer.size} servers`));
|
|
|
13498
14411
|
};
|
|
13499
14412
|
|
|
13500
14413
|
// src/commands/mcp/reload.ts
|
|
13501
|
-
import
|
|
14414
|
+
import chalk47 from "chalk";
|
|
13502
14415
|
var ReloadCommand2 = {
|
|
13503
14416
|
command: "reload",
|
|
13504
14417
|
aliases: ["r"],
|
|
@@ -13519,19 +14432,19 @@ var ReloadCommand2 = {
|
|
|
13519
14432
|
output.error("McpComponent not available");
|
|
13520
14433
|
process.exit(1);
|
|
13521
14434
|
}
|
|
13522
|
-
output.log(
|
|
14435
|
+
output.log(chalk47.cyan("Reloading MCP servers..."));
|
|
13523
14436
|
await mcpComponent.reload();
|
|
13524
14437
|
const servers = mcpComponent.listServers();
|
|
13525
14438
|
const connected = servers.filter((s) => s.status === "connected").length;
|
|
13526
14439
|
const errors = servers.filter((s) => s.status === "error").length;
|
|
13527
|
-
output.log(
|
|
14440
|
+
output.log(chalk47.green(`✓ Reloaded ${servers.length} servers`));
|
|
13528
14441
|
if (connected > 0) {
|
|
13529
|
-
output.log(
|
|
14442
|
+
output.log(chalk47.green(` • ${connected} connected`));
|
|
13530
14443
|
}
|
|
13531
14444
|
if (errors > 0) {
|
|
13532
14445
|
output.warn(` • ${errors} failed`);
|
|
13533
14446
|
for (const server of servers.filter((s) => s.status === "error")) {
|
|
13534
|
-
output.log(
|
|
14447
|
+
output.log(chalk47.gray(` - ${server.name}: ${server.error}`));
|
|
13535
14448
|
}
|
|
13536
14449
|
}
|
|
13537
14450
|
} catch (error) {
|
|
@@ -13547,13 +14460,13 @@ var ReloadCommand2 = {
|
|
|
13547
14460
|
var McpCommand = {
|
|
13548
14461
|
command: "mcp",
|
|
13549
14462
|
describe: "MCP 服务器管理",
|
|
13550
|
-
builder: (yargs) => yargs.command(
|
|
14463
|
+
builder: (yargs) => yargs.command(ListCommand6).command(ToolsCommand).command(ReloadCommand2).demandCommand(1, "请指定一个子命令").help(),
|
|
13551
14464
|
handler: () => {}
|
|
13552
14465
|
};
|
|
13553
14466
|
|
|
13554
14467
|
// src/commands/tools/list.ts
|
|
13555
|
-
import
|
|
13556
|
-
var
|
|
14468
|
+
import chalk48 from "chalk";
|
|
14469
|
+
var ListCommand7 = {
|
|
13557
14470
|
command: "list",
|
|
13558
14471
|
aliases: ["ls"],
|
|
13559
14472
|
describe: "列出所有可用工具",
|
|
@@ -13597,16 +14510,16 @@ var ListCommand5 = {
|
|
|
13597
14510
|
tools.forEach((t) => output.log(t.name));
|
|
13598
14511
|
} else {
|
|
13599
14512
|
const header = [
|
|
13600
|
-
|
|
13601
|
-
|
|
13602
|
-
|
|
14513
|
+
chalk48.bold("Name"),
|
|
14514
|
+
chalk48.bold("Description"),
|
|
14515
|
+
chalk48.bold("Category")
|
|
13603
14516
|
].join(" | ");
|
|
13604
14517
|
const rows = tools.map((t) => {
|
|
13605
14518
|
const desc = t.description.length > 40 ? t.description.slice(0, 37) + "..." : t.description;
|
|
13606
14519
|
return [
|
|
13607
|
-
|
|
14520
|
+
chalk48.cyan(t.name),
|
|
13608
14521
|
desc,
|
|
13609
|
-
t.metadata?.category ?
|
|
14522
|
+
t.metadata?.category ? chalk48.gray(`[${t.metadata.category}]`) : "-"
|
|
13610
14523
|
].join(" | ");
|
|
13611
14524
|
});
|
|
13612
14525
|
output.log([
|
|
@@ -13616,7 +14529,7 @@ var ListCommand5 = {
|
|
|
13616
14529
|
...rows.map((r) => `│${r}│`),
|
|
13617
14530
|
"└" + "─".repeat(header.length + 2) + "┘",
|
|
13618
14531
|
"",
|
|
13619
|
-
|
|
14532
|
+
chalk48.gray(`Total: ${tools.length} tools`)
|
|
13620
14533
|
].join(`
|
|
13621
14534
|
`));
|
|
13622
14535
|
}
|
|
@@ -13630,7 +14543,7 @@ var ListCommand5 = {
|
|
|
13630
14543
|
};
|
|
13631
14544
|
|
|
13632
14545
|
// src/commands/tools/get.ts
|
|
13633
|
-
import
|
|
14546
|
+
import chalk49 from "chalk";
|
|
13634
14547
|
|
|
13635
14548
|
// src/commands/tools/shared/schema-helper.ts
|
|
13636
14549
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
@@ -13655,7 +14568,7 @@ function validateRequiredParams(params, args) {
|
|
|
13655
14568
|
}
|
|
13656
14569
|
|
|
13657
14570
|
// src/commands/tools/get.ts
|
|
13658
|
-
var
|
|
14571
|
+
var GetCommand6 = {
|
|
13659
14572
|
command: "get <name>",
|
|
13660
14573
|
describe: "获取指定工具的详细信息",
|
|
13661
14574
|
builder: (yargs) => yargs.positional("name", {
|
|
@@ -13705,8 +14618,8 @@ var GetCommand4 = {
|
|
|
13705
14618
|
}))
|
|
13706
14619
|
});
|
|
13707
14620
|
} else {
|
|
13708
|
-
output.log(
|
|
13709
|
-
output.log(
|
|
14621
|
+
output.log(chalk49.bold.cyan(`Tool: ${tool.name}`));
|
|
14622
|
+
output.log(chalk49.gray("─".repeat(60)));
|
|
13710
14623
|
output.log(`Description: ${tool.description}`);
|
|
13711
14624
|
if (tool.metadata?.category) {
|
|
13712
14625
|
output.log(`Category: ${tool.metadata.category}`);
|
|
@@ -13715,9 +14628,9 @@ var GetCommand4 = {
|
|
|
13715
14628
|
output.log(`Tags: ${tool.metadata.tags.join(", ")}`);
|
|
13716
14629
|
}
|
|
13717
14630
|
output.log("");
|
|
13718
|
-
output.log(
|
|
14631
|
+
output.log(chalk49.bold("Parameters:"));
|
|
13719
14632
|
for (const param of params) {
|
|
13720
|
-
const required = param.required ?
|
|
14633
|
+
const required = param.required ? chalk49.red("(required)") : chalk49.gray("(optional)");
|
|
13721
14634
|
const defaultVal = param.default !== undefined ? ` [default: ${JSON.stringify(param.default)}]` : "";
|
|
13722
14635
|
output.log(` --${param.name} <${param.type}> ${required}`);
|
|
13723
14636
|
output.log(` ${param.description}${defaultVal}`);
|
|
@@ -13819,21 +14732,21 @@ var ExecToolCommand = {
|
|
|
13819
14732
|
var ToolsCommand2 = {
|
|
13820
14733
|
command: "tools",
|
|
13821
14734
|
describe: "工具管理 - 列出、获取、执行内置工具",
|
|
13822
|
-
builder: (yargs) => yargs.command(
|
|
14735
|
+
builder: (yargs) => yargs.command(ListCommand7).command(GetCommand6).command(ExecToolCommand).demandCommand().help(),
|
|
13823
14736
|
handler: () => {
|
|
13824
14737
|
console.log("Use 'roy-agent tools --help' for usage information");
|
|
13825
14738
|
}
|
|
13826
14739
|
};
|
|
13827
14740
|
|
|
13828
14741
|
// src/commands/memory/record.ts
|
|
13829
|
-
import
|
|
14742
|
+
import chalk50 from "chalk";
|
|
13830
14743
|
import { createMemoryAgentTools, getBuiltInPrompt } from "@ai-setting/roy-agent-core";
|
|
13831
14744
|
import { bashTool, globTool, readFileTool } from "@ai-setting/roy-agent-core";
|
|
13832
14745
|
async function runExtractMode(output, memoryComponent, agentComponent, sessionComponent, env, options) {
|
|
13833
14746
|
const { scope, sessionId, require: userRequirement } = options;
|
|
13834
|
-
output.log(
|
|
14747
|
+
output.log(chalk50.blue(`
|
|
13835
14748
|
\uD83D\uDD0D Memory Extract Mode (${scope})`));
|
|
13836
|
-
output.log(
|
|
14749
|
+
output.log(chalk50.gray(`正在分析会话历史,生成记忆...
|
|
13837
14750
|
`));
|
|
13838
14751
|
try {
|
|
13839
14752
|
const currentMemory = await memoryComponent.recallMemory(scope) || "(无现有记忆)";
|
|
@@ -13879,13 +14792,13 @@ async function runExtractMode(output, memoryComponent, agentComponent, sessionCo
|
|
|
13879
14792
|
for (const tool of agentTools) {
|
|
13880
14793
|
try {
|
|
13881
14794
|
toolComponent.register(tool);
|
|
13882
|
-
output.log(
|
|
14795
|
+
output.log(chalk50.gray(`Tool registered: ${tool.name}`));
|
|
13883
14796
|
} catch (err) {
|
|
13884
|
-
output.log(
|
|
14797
|
+
output.log(chalk50.gray(`Tool already registered: ${tool.name}`));
|
|
13885
14798
|
}
|
|
13886
14799
|
}
|
|
13887
14800
|
}
|
|
13888
|
-
output.log(
|
|
14801
|
+
output.log(chalk50.gray(`Agent "${agentName}" registered with ${agentTools.length} tools`));
|
|
13889
14802
|
const query = `请分析会话历史,提炼${scope === "project" ? "项目" : "全局"}记忆并写入记忆文件。`;
|
|
13890
14803
|
let result;
|
|
13891
14804
|
try {
|
|
@@ -13899,12 +14812,12 @@ async function runExtractMode(output, memoryComponent, agentComponent, sessionCo
|
|
|
13899
14812
|
if (result && result.startsWith("执行失败")) {
|
|
13900
14813
|
output.error(`提取失败: ${result}`);
|
|
13901
14814
|
} else if (result) {
|
|
13902
|
-
output.log(
|
|
14815
|
+
output.log(chalk50.green(`
|
|
13903
14816
|
✅ 记忆提取完成`));
|
|
13904
|
-
output.log(
|
|
14817
|
+
output.log(chalk50.gray(`记忆已保存到 memory 文件。
|
|
13905
14818
|
`));
|
|
13906
14819
|
if (result.length > 0 && result !== "✅ 记忆提取完成") {
|
|
13907
|
-
output.log(
|
|
14820
|
+
output.log(chalk50.gray(`执行摘要: ${result.substring(0, 200)}${result.length > 200 ? "..." : ""}`));
|
|
13908
14821
|
}
|
|
13909
14822
|
}
|
|
13910
14823
|
agentComponent.unregisterAgent(agentName);
|
|
@@ -14022,11 +14935,11 @@ var RecordCommand = {
|
|
|
14022
14935
|
prepend: "已插入内容到记忆文件开头",
|
|
14023
14936
|
delete: "已删除记忆文件"
|
|
14024
14937
|
};
|
|
14025
|
-
output.log(
|
|
14026
|
-
output.log(
|
|
14938
|
+
output.log(chalk50.green(`✓ ${actionMessages[result.action]}`));
|
|
14939
|
+
output.log(chalk50.gray(`路径: ${result.path}`));
|
|
14027
14940
|
if (result.action !== "delete" && a.content) {
|
|
14028
14941
|
const preview = a.content.substring(0, 100);
|
|
14029
|
-
output.log(
|
|
14942
|
+
output.log(chalk50.gray(`内容预览: ${preview}${a.content.length > 100 ? "..." : ""}`));
|
|
14030
14943
|
}
|
|
14031
14944
|
} catch (error) {
|
|
14032
14945
|
output.error(`Failed to record memory: ${error}`);
|
|
@@ -14038,7 +14951,7 @@ var RecordCommand = {
|
|
|
14038
14951
|
};
|
|
14039
14952
|
|
|
14040
14953
|
// src/commands/memory/recall.ts
|
|
14041
|
-
import
|
|
14954
|
+
import chalk51 from "chalk";
|
|
14042
14955
|
var RecallCommand = {
|
|
14043
14956
|
command: "recall",
|
|
14044
14957
|
aliases: ["load"],
|
|
@@ -14074,7 +14987,7 @@ var RecallCommand = {
|
|
|
14074
14987
|
}
|
|
14075
14988
|
const content = await memoryComponent.recallMemory(a.scope);
|
|
14076
14989
|
if (!content) {
|
|
14077
|
-
output.log(
|
|
14990
|
+
output.log(chalk51.gray("(No memory files found)"));
|
|
14078
14991
|
return;
|
|
14079
14992
|
}
|
|
14080
14993
|
if (a.json) {
|
|
@@ -14100,7 +15013,7 @@ var MemoryCommand = {
|
|
|
14100
15013
|
handler: () => {}
|
|
14101
15014
|
};
|
|
14102
15015
|
// src/commands/eventsource/list.ts
|
|
14103
|
-
import
|
|
15016
|
+
import chalk52 from "chalk";
|
|
14104
15017
|
function truncateVisual2(str, maxWidth) {
|
|
14105
15018
|
let result = "";
|
|
14106
15019
|
let width = 0;
|
|
@@ -14115,7 +15028,7 @@ function truncateVisual2(str, maxWidth) {
|
|
|
14115
15028
|
}
|
|
14116
15029
|
function formatSourcesTable(sources) {
|
|
14117
15030
|
if (sources.length === 0) {
|
|
14118
|
-
return
|
|
15031
|
+
return chalk52.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加");
|
|
14119
15032
|
}
|
|
14120
15033
|
const ID_WIDTH = 10;
|
|
14121
15034
|
const NAME_WIDTH = 20;
|
|
@@ -14124,11 +15037,11 @@ function formatSourcesTable(sources) {
|
|
|
14124
15037
|
const ENABLED_WIDTH = 8;
|
|
14125
15038
|
const GAP = " ";
|
|
14126
15039
|
const headerLine = [
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
15040
|
+
chalk52.bold("ID".padEnd(ID_WIDTH)),
|
|
15041
|
+
chalk52.bold("NAME".padEnd(NAME_WIDTH)),
|
|
15042
|
+
chalk52.bold("TYPE".padEnd(TYPE_WIDTH)),
|
|
15043
|
+
chalk52.bold("STATUS".padEnd(STATUS_WIDTH)),
|
|
15044
|
+
chalk52.bold("ENABLED".padEnd(ENABLED_WIDTH))
|
|
14132
15045
|
].join(GAP);
|
|
14133
15046
|
const sepLine = "─".repeat(ID_WIDTH + NAME_WIDTH + TYPE_WIDTH + STATUS_WIDTH + ENABLED_WIDTH + GAP.length * 4);
|
|
14134
15047
|
const formatRow = (src) => {
|
|
@@ -14181,7 +15094,7 @@ var EventSourceListCommand = {
|
|
|
14181
15094
|
if (args.json) {
|
|
14182
15095
|
output.json({ sources: [], count: 0 });
|
|
14183
15096
|
} else {
|
|
14184
|
-
output.log(
|
|
15097
|
+
output.log(chalk52.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加"));
|
|
14185
15098
|
}
|
|
14186
15099
|
return;
|
|
14187
15100
|
}
|
|
@@ -14196,26 +15109,26 @@ var EventSourceListCommand = {
|
|
|
14196
15109
|
const rows = sources.map((s) => {
|
|
14197
15110
|
const status = esComponent.getStatus(s.id) || "unknown";
|
|
14198
15111
|
const statusColorMap = {
|
|
14199
|
-
running:
|
|
14200
|
-
stopped:
|
|
14201
|
-
error:
|
|
14202
|
-
starting:
|
|
14203
|
-
created:
|
|
14204
|
-
stopping:
|
|
14205
|
-
unknown:
|
|
15112
|
+
running: chalk52.green,
|
|
15113
|
+
stopped: chalk52.gray,
|
|
15114
|
+
error: chalk52.red,
|
|
15115
|
+
starting: chalk52.yellow,
|
|
15116
|
+
created: chalk52.gray,
|
|
15117
|
+
stopping: chalk52.yellow,
|
|
15118
|
+
unknown: chalk52.gray
|
|
14206
15119
|
};
|
|
14207
|
-
const statusColor = statusColorMap[status] ||
|
|
15120
|
+
const statusColor = statusColorMap[status] || chalk52.gray;
|
|
14208
15121
|
return {
|
|
14209
15122
|
id: s.id.substring(0, 8),
|
|
14210
15123
|
name: s.name,
|
|
14211
15124
|
type: s.type,
|
|
14212
15125
|
status: statusColor(status),
|
|
14213
|
-
enabled: s.enabled ?
|
|
15126
|
+
enabled: s.enabled ? chalk52.green("✓") : chalk52.gray("✗")
|
|
14214
15127
|
};
|
|
14215
15128
|
});
|
|
14216
15129
|
output.log(formatSourcesTable(rows));
|
|
14217
15130
|
output.info("");
|
|
14218
|
-
output.log(
|
|
15131
|
+
output.log(chalk52.green(`✅ 共 ${sources.length} 个事件源`));
|
|
14219
15132
|
} catch (error) {
|
|
14220
15133
|
output.error(`Failed to list event sources: ${error}`);
|
|
14221
15134
|
process.exit(1);
|
|
@@ -14226,7 +15139,7 @@ var EventSourceListCommand = {
|
|
|
14226
15139
|
};
|
|
14227
15140
|
|
|
14228
15141
|
// src/commands/eventsource/add.ts
|
|
14229
|
-
import
|
|
15142
|
+
import chalk53 from "chalk";
|
|
14230
15143
|
import { generateId } from "@ai-setting/roy-agent-core";
|
|
14231
15144
|
function uuid() {
|
|
14232
15145
|
return generateId();
|
|
@@ -14291,21 +15204,21 @@ var EventSourceAddCommand = {
|
|
|
14291
15204
|
cron: a.cron
|
|
14292
15205
|
};
|
|
14293
15206
|
esComponent.register(config);
|
|
14294
|
-
output.success(
|
|
15207
|
+
output.success(chalk53.green(`事件源 '${a.name}' 添加成功!`));
|
|
14295
15208
|
output.log("");
|
|
14296
|
-
output.log(` ID: ${
|
|
14297
|
-
output.log(` Type: ${
|
|
15209
|
+
output.log(` ID: ${chalk53.gray(config.id)}`);
|
|
15210
|
+
output.log(` Type: ${chalk53.cyan(a.type)}`);
|
|
14298
15211
|
if (eventTypes?.length) {
|
|
14299
|
-
output.log(` Event Types: ${
|
|
15212
|
+
output.log(` Event Types: ${chalk53.gray(eventTypes.join(", "))}`);
|
|
14300
15213
|
}
|
|
14301
15214
|
if (a.command) {
|
|
14302
|
-
output.log(` Command: ${
|
|
15215
|
+
output.log(` Command: ${chalk53.gray(a.command)}`);
|
|
14303
15216
|
}
|
|
14304
15217
|
if (a.interval) {
|
|
14305
|
-
output.log(` Interval: ${
|
|
15218
|
+
output.log(` Interval: ${chalk53.gray(`${a.interval}ms`)}`);
|
|
14306
15219
|
}
|
|
14307
15220
|
output.log("");
|
|
14308
|
-
output.log(
|
|
15221
|
+
output.log(chalk53.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
|
|
14309
15222
|
} finally {
|
|
14310
15223
|
await envService.dispose();
|
|
14311
15224
|
}
|
|
@@ -14313,7 +15226,7 @@ var EventSourceAddCommand = {
|
|
|
14313
15226
|
};
|
|
14314
15227
|
|
|
14315
15228
|
// src/commands/eventsource/remove.ts
|
|
14316
|
-
import
|
|
15229
|
+
import chalk54 from "chalk";
|
|
14317
15230
|
var EventSourceRemoveCommand = {
|
|
14318
15231
|
command: "remove <id>",
|
|
14319
15232
|
aliases: ["rm"],
|
|
@@ -14352,7 +15265,7 @@ var EventSourceRemoveCommand = {
|
|
|
14352
15265
|
const status = esComponent.getStatus(matchedSource.id);
|
|
14353
15266
|
if (status === "running" && !args.force) {
|
|
14354
15267
|
output.error(`事件源正在运行中,请先停止: ${matchedSource.name} (${status})`);
|
|
14355
|
-
output.log(
|
|
15268
|
+
output.log(chalk54.gray(`使用 --force 强制移除或 'roy-agent eventsource stop ${matchedSource.id.substring(0, 8)}' 先停止`));
|
|
14356
15269
|
process.exit(1);
|
|
14357
15270
|
}
|
|
14358
15271
|
if (status === "running") {
|
|
@@ -14361,7 +15274,7 @@ var EventSourceRemoveCommand = {
|
|
|
14361
15274
|
}
|
|
14362
15275
|
const result = esComponent.unregister(matchedSource.id);
|
|
14363
15276
|
if (result) {
|
|
14364
|
-
output.success(
|
|
15277
|
+
output.success(chalk54.green(`事件源已移除: ${matchedSource.name}`));
|
|
14365
15278
|
} else {
|
|
14366
15279
|
output.error("移除失败");
|
|
14367
15280
|
process.exit(1);
|
|
@@ -14373,7 +15286,7 @@ var EventSourceRemoveCommand = {
|
|
|
14373
15286
|
};
|
|
14374
15287
|
|
|
14375
15288
|
// src/commands/eventsource/start.ts
|
|
14376
|
-
import
|
|
15289
|
+
import chalk55 from "chalk";
|
|
14377
15290
|
var EventSourceStartCommand = {
|
|
14378
15291
|
command: "start <id>",
|
|
14379
15292
|
describe: "启动指定的事件源",
|
|
@@ -14410,15 +15323,15 @@ var EventSourceStartCommand = {
|
|
|
14410
15323
|
}
|
|
14411
15324
|
const status = esComponent.getStatus(matchedSource.id);
|
|
14412
15325
|
if (status === "running") {
|
|
14413
|
-
output.log(
|
|
15326
|
+
output.log(chalk55.yellow(`事件源已在运行: ${matchedSource.name}`));
|
|
14414
15327
|
return;
|
|
14415
15328
|
}
|
|
14416
15329
|
output.info(`正在启动事件源 '${matchedSource.name}'...`);
|
|
14417
15330
|
try {
|
|
14418
15331
|
await esComponent.startSource(matchedSource.id);
|
|
14419
|
-
output.success(
|
|
15332
|
+
output.success(chalk55.green(`事件源已启动: ${matchedSource.name}`));
|
|
14420
15333
|
if (!args.background) {
|
|
14421
|
-
output.log(
|
|
15334
|
+
output.log(chalk55.gray("按 Ctrl+C 停止..."));
|
|
14422
15335
|
await new Promise((resolve) => {
|
|
14423
15336
|
const cleanup = () => {
|
|
14424
15337
|
process.removeListener("SIGINT", cleanup);
|
|
@@ -14440,7 +15353,7 @@ var EventSourceStartCommand = {
|
|
|
14440
15353
|
};
|
|
14441
15354
|
|
|
14442
15355
|
// src/commands/eventsource/stop.ts
|
|
14443
|
-
import
|
|
15356
|
+
import chalk56 from "chalk";
|
|
14444
15357
|
var EventSourceStopCommand = {
|
|
14445
15358
|
command: "stop <id>",
|
|
14446
15359
|
aliases: ["kill"],
|
|
@@ -14478,13 +15391,13 @@ var EventSourceStopCommand = {
|
|
|
14478
15391
|
}
|
|
14479
15392
|
const status = esComponent.getStatus(matchedSource.id);
|
|
14480
15393
|
if (status !== "running") {
|
|
14481
|
-
output.log(
|
|
15394
|
+
output.log(chalk56.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
|
|
14482
15395
|
return;
|
|
14483
15396
|
}
|
|
14484
15397
|
output.info(`正在停止事件源 '${matchedSource.name}'...`);
|
|
14485
15398
|
try {
|
|
14486
15399
|
await esComponent.stopSource(matchedSource.id);
|
|
14487
|
-
output.success(
|
|
15400
|
+
output.success(chalk56.green(`事件源已停止: ${matchedSource.name}`));
|
|
14488
15401
|
} catch (error) {
|
|
14489
15402
|
output.error(`停止失败: ${error}`);
|
|
14490
15403
|
process.exit(1);
|
|
@@ -14496,14 +15409,14 @@ var EventSourceStopCommand = {
|
|
|
14496
15409
|
};
|
|
14497
15410
|
|
|
14498
15411
|
// src/commands/eventsource/status.ts
|
|
14499
|
-
import
|
|
15412
|
+
import chalk57 from "chalk";
|
|
14500
15413
|
var STATUS_COLORS = {
|
|
14501
|
-
created:
|
|
14502
|
-
starting:
|
|
14503
|
-
running:
|
|
14504
|
-
stopping:
|
|
14505
|
-
stopped:
|
|
14506
|
-
error:
|
|
15414
|
+
created: chalk57.gray,
|
|
15415
|
+
starting: chalk57.yellow,
|
|
15416
|
+
running: chalk57.green,
|
|
15417
|
+
stopping: chalk57.yellow,
|
|
15418
|
+
stopped: chalk57.gray,
|
|
15419
|
+
error: chalk57.red
|
|
14507
15420
|
};
|
|
14508
15421
|
var STATUS_ICONS = {
|
|
14509
15422
|
created: "○",
|
|
@@ -14557,7 +15470,7 @@ var EventSourceStatusCommand = {
|
|
|
14557
15470
|
process.exit(1);
|
|
14558
15471
|
}
|
|
14559
15472
|
const status = esComponent.getStatus(matchedSource.id) || "unknown";
|
|
14560
|
-
const statusColor = STATUS_COLORS[status] ||
|
|
15473
|
+
const statusColor = STATUS_COLORS[status] || chalk57.gray;
|
|
14561
15474
|
if (args.json) {
|
|
14562
15475
|
output.json({
|
|
14563
15476
|
id: matchedSource.id,
|
|
@@ -14574,31 +15487,31 @@ var EventSourceStatusCommand = {
|
|
|
14574
15487
|
});
|
|
14575
15488
|
return;
|
|
14576
15489
|
}
|
|
14577
|
-
output.log(
|
|
15490
|
+
output.log(chalk57.bold("事件源详情"));
|
|
14578
15491
|
output.log("─".repeat(50));
|
|
14579
|
-
output.log(` ID: ${
|
|
14580
|
-
output.log(` Name: ${
|
|
14581
|
-
output.log(` Type: ${
|
|
15492
|
+
output.log(` ID: ${chalk57.gray(matchedSource.id)}`);
|
|
15493
|
+
output.log(` Name: ${chalk57.cyan(matchedSource.name)}`);
|
|
15494
|
+
output.log(` Type: ${chalk57.cyan(matchedSource.type)}`);
|
|
14582
15495
|
output.log(` Status: ${statusColor(`${STATUS_ICONS[status]} ${STATUS_LABELS[status]}`)}`);
|
|
14583
|
-
output.log(` Enabled: ${matchedSource.enabled ?
|
|
15496
|
+
output.log(` Enabled: ${matchedSource.enabled ? chalk57.green("是") : chalk57.gray("否")}`);
|
|
14584
15497
|
if (matchedSource.eventTypes?.length) {
|
|
14585
|
-
output.log(` Events: ${
|
|
15498
|
+
output.log(` Events: ${chalk57.gray(matchedSource.eventTypes.join(", "))}`);
|
|
14586
15499
|
}
|
|
14587
15500
|
if (matchedSource.command) {
|
|
14588
|
-
output.log(` Command: ${
|
|
15501
|
+
output.log(` Command: ${chalk57.gray(matchedSource.command)}`);
|
|
14589
15502
|
}
|
|
14590
15503
|
if (matchedSource.interval) {
|
|
14591
|
-
output.log(` Interval: ${
|
|
15504
|
+
output.log(` Interval: ${chalk57.gray(`${matchedSource.interval}ms`)}`);
|
|
14592
15505
|
}
|
|
14593
15506
|
if (matchedSource.url) {
|
|
14594
|
-
output.log(` URL: ${
|
|
15507
|
+
output.log(` URL: ${chalk57.gray(matchedSource.url)}`);
|
|
14595
15508
|
}
|
|
14596
15509
|
output.log("");
|
|
14597
15510
|
return;
|
|
14598
15511
|
}
|
|
14599
15512
|
const sources = esComponent.list();
|
|
14600
15513
|
if (sources.length === 0) {
|
|
14601
|
-
output.log(
|
|
15514
|
+
output.log(chalk57.yellow("没有配置的事件源"));
|
|
14602
15515
|
return;
|
|
14603
15516
|
}
|
|
14604
15517
|
if (args.json) {
|
|
@@ -14612,21 +15525,21 @@ var EventSourceStatusCommand = {
|
|
|
14612
15525
|
output.json({ sources: sourcesWithStatus, count: sources.length });
|
|
14613
15526
|
return;
|
|
14614
15527
|
}
|
|
14615
|
-
output.log(
|
|
15528
|
+
output.log(chalk57.bold("事件源状态概览"));
|
|
14616
15529
|
output.log("─".repeat(60));
|
|
14617
15530
|
for (const source of sources) {
|
|
14618
15531
|
const status = esComponent.getStatus(source.id) || "unknown";
|
|
14619
|
-
const statusColor = STATUS_COLORS[status] ||
|
|
15532
|
+
const statusColor = STATUS_COLORS[status] || chalk57.gray;
|
|
14620
15533
|
const icon = STATUS_ICONS[status] || "?";
|
|
14621
15534
|
const label = STATUS_LABELS[status] || status;
|
|
14622
15535
|
output.log("");
|
|
14623
|
-
output.log(` ${
|
|
15536
|
+
output.log(` ${chalk57.cyan(source.name)} ${chalk57.gray(`(${source.type})`)}`);
|
|
14624
15537
|
output.log(` └─ Status: ${statusColor(`${icon} ${label}`)}`);
|
|
14625
|
-
output.log(` ID: ${
|
|
15538
|
+
output.log(` ID: ${chalk57.gray(source.id.substring(0, 8))}...`);
|
|
14626
15539
|
}
|
|
14627
15540
|
output.log("");
|
|
14628
15541
|
const runningCount = sources.filter((s) => esComponent.getStatus(s.id) === "running").length;
|
|
14629
|
-
output.log(
|
|
15542
|
+
output.log(chalk57.green(`✅ ${runningCount}/${sources.length} 运行中`));
|
|
14630
15543
|
} finally {
|
|
14631
15544
|
await envService.dispose();
|
|
14632
15545
|
}
|
|
@@ -14939,7 +15852,7 @@ var DebugCommand = {
|
|
|
14939
15852
|
};
|
|
14940
15853
|
|
|
14941
15854
|
// src/commands/workflow/renderers.ts
|
|
14942
|
-
import
|
|
15855
|
+
import chalk58 from "chalk";
|
|
14943
15856
|
function truncateVisual3(str, maxWidth) {
|
|
14944
15857
|
if (!str)
|
|
14945
15858
|
return "-";
|
|
@@ -14974,18 +15887,18 @@ function formatDuration(ms) {
|
|
|
14974
15887
|
function statusColor(status) {
|
|
14975
15888
|
switch (status) {
|
|
14976
15889
|
case "completed":
|
|
14977
|
-
return
|
|
15890
|
+
return chalk58.green;
|
|
14978
15891
|
case "running":
|
|
14979
15892
|
case "idle":
|
|
14980
|
-
return
|
|
15893
|
+
return chalk58.blue;
|
|
14981
15894
|
case "paused":
|
|
14982
|
-
return
|
|
15895
|
+
return chalk58.yellow;
|
|
14983
15896
|
case "failed":
|
|
14984
|
-
return
|
|
15897
|
+
return chalk58.red;
|
|
14985
15898
|
case "stopped":
|
|
14986
|
-
return
|
|
15899
|
+
return chalk58.gray;
|
|
14987
15900
|
default:
|
|
14988
|
-
return
|
|
15901
|
+
return chalk58.white;
|
|
14989
15902
|
}
|
|
14990
15903
|
}
|
|
14991
15904
|
function renderWorkflowList(workflows, options) {
|
|
@@ -15004,7 +15917,7 @@ function renderWorkflowList(workflows, options) {
|
|
|
15004
15917
|
}, null, 2);
|
|
15005
15918
|
}
|
|
15006
15919
|
if (workflows.length === 0) {
|
|
15007
|
-
return
|
|
15920
|
+
return chalk58.yellow("No workflows found");
|
|
15008
15921
|
}
|
|
15009
15922
|
const NAME_WIDTH = 30;
|
|
15010
15923
|
const VERSION_WIDTH = 10;
|
|
@@ -15012,10 +15925,10 @@ function renderWorkflowList(workflows, options) {
|
|
|
15012
15925
|
const UPDATED_WIDTH = 20;
|
|
15013
15926
|
const GAP = " ";
|
|
15014
15927
|
const headerLine = [
|
|
15015
|
-
|
|
15016
|
-
|
|
15017
|
-
|
|
15018
|
-
|
|
15928
|
+
chalk58.bold("NAME".padEnd(NAME_WIDTH)),
|
|
15929
|
+
chalk58.bold("VER".padEnd(VERSION_WIDTH)),
|
|
15930
|
+
chalk58.bold("TAGS".padEnd(TAGS_WIDTH)),
|
|
15931
|
+
chalk58.bold("UPDATED")
|
|
15019
15932
|
].join(GAP);
|
|
15020
15933
|
const sepLine = "─".repeat(NAME_WIDTH + VERSION_WIDTH + TAGS_WIDTH + UPDATED_WIDTH + GAP.length * 3);
|
|
15021
15934
|
const rows = workflows.map((w) => {
|
|
@@ -15030,18 +15943,18 @@ function renderWorkflowList(workflows, options) {
|
|
|
15030
15943
|
}
|
|
15031
15944
|
function renderWorkflowDetail(workflow, options) {
|
|
15032
15945
|
const lines = [];
|
|
15033
|
-
lines.push(
|
|
15946
|
+
lines.push(chalk58.bold(`
|
|
15034
15947
|
\uD83D\uDCCB Workflow Details
|
|
15035
15948
|
`));
|
|
15036
|
-
lines.push(` ${
|
|
15037
|
-
lines.push(` ${
|
|
15038
|
-
lines.push(` ${
|
|
15039
|
-
lines.push(` ${
|
|
15040
|
-
lines.push(` ${
|
|
15041
|
-
lines.push(` ${
|
|
15042
|
-
lines.push(` ${
|
|
15949
|
+
lines.push(` ${chalk58.cyan("ID:")} ${workflow.id}`);
|
|
15950
|
+
lines.push(` ${chalk58.cyan("Name:")} ${workflow.name}`);
|
|
15951
|
+
lines.push(` ${chalk58.cyan("Version:")} ${workflow.version}`);
|
|
15952
|
+
lines.push(` ${chalk58.cyan("Description:")} ${workflow.description || "-"}`);
|
|
15953
|
+
lines.push(` ${chalk58.cyan("Tags:")} ${workflow.tags.join(", ") || "-"}`);
|
|
15954
|
+
lines.push(` ${chalk58.cyan("Created:")} ${formatDate(workflow.createdAt)}`);
|
|
15955
|
+
lines.push(` ${chalk58.cyan("Updated:")} ${formatDate(workflow.updatedAt)}`);
|
|
15043
15956
|
const nodeCount = workflow.definition.nodes.length;
|
|
15044
|
-
lines.push(
|
|
15957
|
+
lines.push(chalk58.bold(`
|
|
15045
15958
|
\uD83D\uDCCA Nodes Summary
|
|
15046
15959
|
`));
|
|
15047
15960
|
lines.push(` Total: ${nodeCount} nodes`);
|
|
@@ -15053,7 +15966,7 @@ function renderWorkflowDetail(workflow, options) {
|
|
|
15053
15966
|
lines.push(` - ${type}: ${count}`);
|
|
15054
15967
|
}
|
|
15055
15968
|
if (workflow.definition.config) {
|
|
15056
|
-
lines.push(
|
|
15969
|
+
lines.push(chalk58.bold(`
|
|
15057
15970
|
⚙️ Configuration
|
|
15058
15971
|
`));
|
|
15059
15972
|
if (workflow.definition.config.parallel_limit !== undefined) {
|
|
@@ -15067,7 +15980,7 @@ function renderWorkflowDetail(workflow, options) {
|
|
|
15067
15980
|
}
|
|
15068
15981
|
}
|
|
15069
15982
|
if (options?.includeRuns && options.includeRuns.length > 0) {
|
|
15070
|
-
lines.push(
|
|
15983
|
+
lines.push(chalk58.bold(`
|
|
15071
15984
|
\uD83D\uDCDC Recent Runs
|
|
15072
15985
|
`));
|
|
15073
15986
|
lines.push(renderRunsList(options.includeRuns.slice(0, 5)));
|
|
@@ -15091,7 +16004,7 @@ function renderRunsList(runs, options) {
|
|
|
15091
16004
|
}, null, 2);
|
|
15092
16005
|
}
|
|
15093
16006
|
if (runs.length === 0) {
|
|
15094
|
-
return
|
|
16007
|
+
return chalk58.yellow("No runs found");
|
|
15095
16008
|
}
|
|
15096
16009
|
const ID_WIDTH = 20;
|
|
15097
16010
|
const STATUS_WIDTH = 12;
|
|
@@ -15099,10 +16012,10 @@ function renderRunsList(runs, options) {
|
|
|
15099
16012
|
const UPDATED_WIDTH = 20;
|
|
15100
16013
|
const GAP = " ";
|
|
15101
16014
|
const headerLine = [
|
|
15102
|
-
|
|
15103
|
-
|
|
15104
|
-
|
|
15105
|
-
|
|
16015
|
+
chalk58.bold("RUN ID".padEnd(ID_WIDTH)),
|
|
16016
|
+
chalk58.bold("STATUS".padEnd(STATUS_WIDTH)),
|
|
16017
|
+
chalk58.bold("DURATION".padEnd(DURATION_WIDTH)),
|
|
16018
|
+
chalk58.bold("STARTED")
|
|
15106
16019
|
].join(GAP);
|
|
15107
16020
|
const sepLine = "─".repeat(ID_WIDTH + STATUS_WIDTH + DURATION_WIDTH + UPDATED_WIDTH + GAP.length * 3);
|
|
15108
16021
|
const rows = runs.map((r) => {
|
|
@@ -15117,34 +16030,34 @@ function renderRunsList(runs, options) {
|
|
|
15117
16030
|
}
|
|
15118
16031
|
function renderRunDetail(run) {
|
|
15119
16032
|
const lines = [];
|
|
15120
|
-
lines.push(
|
|
16033
|
+
lines.push(chalk58.bold(`
|
|
15121
16034
|
\uD83C\uDFC3 Run Details
|
|
15122
16035
|
`));
|
|
15123
|
-
lines.push(` ${
|
|
15124
|
-
lines.push(` ${
|
|
15125
|
-
lines.push(` ${
|
|
15126
|
-
lines.push(` ${
|
|
16036
|
+
lines.push(` ${chalk58.cyan("Run ID:")} ${run.id}`);
|
|
16037
|
+
lines.push(` ${chalk58.cyan("Workflow:")} ${run.workflowId}`);
|
|
16038
|
+
lines.push(` ${chalk58.cyan("Status:")} ${statusColor(run.status)(run.status)}`);
|
|
16039
|
+
lines.push(` ${chalk58.cyan("Started:")} ${formatDate(run.startedAt)}`);
|
|
15127
16040
|
if (run.pausedAt) {
|
|
15128
|
-
lines.push(` ${
|
|
16041
|
+
lines.push(` ${chalk58.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
|
|
15129
16042
|
}
|
|
15130
16043
|
if (run.resumedAt) {
|
|
15131
|
-
lines.push(` ${
|
|
16044
|
+
lines.push(` ${chalk58.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
|
|
15132
16045
|
}
|
|
15133
16046
|
if (run.stoppedAt) {
|
|
15134
|
-
lines.push(` ${
|
|
16047
|
+
lines.push(` ${chalk58.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
|
|
15135
16048
|
}
|
|
15136
16049
|
if (run.completedAt) {
|
|
15137
|
-
lines.push(` ${
|
|
16050
|
+
lines.push(` ${chalk58.cyan("Completed:")} ${formatDate(run.completedAt)}`);
|
|
15138
16051
|
}
|
|
15139
|
-
lines.push(` ${
|
|
16052
|
+
lines.push(` ${chalk58.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
|
|
15140
16053
|
if (run.error) {
|
|
15141
|
-
lines.push(
|
|
16054
|
+
lines.push(chalk58.bold(`
|
|
15142
16055
|
❌ Error
|
|
15143
16056
|
`));
|
|
15144
|
-
lines.push(` ${
|
|
16057
|
+
lines.push(` ${chalk58.red(run.error)}`);
|
|
15145
16058
|
}
|
|
15146
16059
|
if (run.output) {
|
|
15147
|
-
lines.push(
|
|
16060
|
+
lines.push(chalk58.bold(`
|
|
15148
16061
|
\uD83D\uDCE4 Output
|
|
15149
16062
|
`));
|
|
15150
16063
|
lines.push(" " + JSON.stringify(run.output, null, 2).split(`
|
|
@@ -15155,36 +16068,36 @@ function renderRunDetail(run) {
|
|
|
15155
16068
|
`);
|
|
15156
16069
|
}
|
|
15157
16070
|
function renderWorkflowAdded(workflow) {
|
|
15158
|
-
return
|
|
16071
|
+
return chalk58.green(`
|
|
15159
16072
|
✅ Workflow '${workflow.name}' added successfully
|
|
15160
16073
|
`) + ` ID: ${workflow.id}
|
|
15161
16074
|
` + ` Version: ${workflow.version}
|
|
15162
16075
|
`;
|
|
15163
16076
|
}
|
|
15164
16077
|
function renderWorkflowUpdated(workflow) {
|
|
15165
|
-
return
|
|
16078
|
+
return chalk58.green(`
|
|
15166
16079
|
✅ Workflow '${workflow.name}' updated successfully
|
|
15167
16080
|
`) + ` ID: ${workflow.id}
|
|
15168
16081
|
`;
|
|
15169
16082
|
}
|
|
15170
16083
|
function renderWorkflowDeleted(name) {
|
|
15171
|
-
return
|
|
16084
|
+
return chalk58.green(`
|
|
15172
16085
|
✅ Workflow '${name}' deleted successfully
|
|
15173
16086
|
`);
|
|
15174
16087
|
}
|
|
15175
16088
|
function renderRunResult(result) {
|
|
15176
16089
|
const lines = [];
|
|
15177
16090
|
if (result.status === "completed") {
|
|
15178
|
-
lines.push(
|
|
16091
|
+
lines.push(chalk58.green(`
|
|
15179
16092
|
✅ Workflow completed successfully`));
|
|
15180
16093
|
} else if (result.status === "failed") {
|
|
15181
|
-
lines.push(
|
|
16094
|
+
lines.push(chalk58.red(`
|
|
15182
16095
|
❌ Workflow failed`));
|
|
15183
16096
|
} else if (result.status === "stopped") {
|
|
15184
|
-
lines.push(
|
|
16097
|
+
lines.push(chalk58.yellow(`
|
|
15185
16098
|
⚠️ Workflow stopped`));
|
|
15186
16099
|
} else {
|
|
15187
|
-
lines.push(
|
|
16100
|
+
lines.push(chalk58.blue(`
|
|
15188
16101
|
\uD83D\uDD04 Workflow ${result.status}`));
|
|
15189
16102
|
}
|
|
15190
16103
|
lines.push(` Run ID: ${result.runId}`);
|
|
@@ -15192,11 +16105,11 @@ function renderRunResult(result) {
|
|
|
15192
16105
|
lines.push(` Duration: ${formatDuration(result.durationMs)}`);
|
|
15193
16106
|
}
|
|
15194
16107
|
if (result.error) {
|
|
15195
|
-
lines.push(
|
|
16108
|
+
lines.push(chalk58.red(`
|
|
15196
16109
|
Error: ${result.error}`));
|
|
15197
16110
|
}
|
|
15198
16111
|
if (result.output) {
|
|
15199
|
-
lines.push(
|
|
16112
|
+
lines.push(chalk58.bold(`
|
|
15200
16113
|
\uD83D\uDCE4 Output:`));
|
|
15201
16114
|
lines.push(JSON.stringify(result.output, null, 2));
|
|
15202
16115
|
}
|
|
@@ -15210,10 +16123,10 @@ function renderNodesList(nodes) {
|
|
|
15210
16123
|
const DEPS_WIDTH = 20;
|
|
15211
16124
|
const GAP = " ";
|
|
15212
16125
|
const headerLine = [
|
|
15213
|
-
|
|
15214
|
-
|
|
15215
|
-
|
|
15216
|
-
|
|
16126
|
+
chalk58.bold("NODE ID".padEnd(ID_WIDTH)),
|
|
16127
|
+
chalk58.bold("TYPE".padEnd(TYPE_WIDTH)),
|
|
16128
|
+
chalk58.bold("NAME".padEnd(NAME_WIDTH)),
|
|
16129
|
+
chalk58.bold("DEPENDS ON")
|
|
15217
16130
|
].join(GAP);
|
|
15218
16131
|
const sepLine = "─".repeat(ID_WIDTH + TYPE_WIDTH + NAME_WIDTH + DEPS_WIDTH + GAP.length * 3);
|
|
15219
16132
|
const rows = nodes.map((n) => {
|
|
@@ -15228,7 +16141,7 @@ function renderNodesList(nodes) {
|
|
|
15228
16141
|
}
|
|
15229
16142
|
|
|
15230
16143
|
// src/commands/workflow/commands/list.ts
|
|
15231
|
-
import
|
|
16144
|
+
import chalk59 from "chalk";
|
|
15232
16145
|
var WorkflowListCommand = {
|
|
15233
16146
|
command: "list",
|
|
15234
16147
|
describe: "列出所有已注册的 Workflow",
|
|
@@ -15311,7 +16224,7 @@ var WorkflowListCommand = {
|
|
|
15311
16224
|
});
|
|
15312
16225
|
} else {
|
|
15313
16226
|
output.log(renderWorkflowList(workflows));
|
|
15314
|
-
output.log(
|
|
16227
|
+
output.log(chalk59.green(`
|
|
15315
16228
|
✅ 共 ${workflows.length} 个 Workflow`));
|
|
15316
16229
|
}
|
|
15317
16230
|
} catch (error) {
|
|
@@ -15913,7 +16826,7 @@ class WorkflowValidator {
|
|
|
15913
16826
|
}
|
|
15914
16827
|
|
|
15915
16828
|
// src/commands/workflow/commands/add.ts
|
|
15916
|
-
import
|
|
16829
|
+
import chalk60 from "chalk";
|
|
15917
16830
|
import fs3 from "fs";
|
|
15918
16831
|
import path6 from "path";
|
|
15919
16832
|
import { createWorkflowExtractorAgent } from "@ai-setting/roy-agent-core/env/task/plugins";
|
|
@@ -16027,7 +16940,7 @@ var WorkflowAddCommand = {
|
|
|
16027
16940
|
definition = await parseWorkflowContent(content, filePath);
|
|
16028
16941
|
workflowName = a.name || definition.name || path6.basename(filePath);
|
|
16029
16942
|
if (a.validate) {
|
|
16030
|
-
output.log(
|
|
16943
|
+
output.log(chalk60.blue("\uD83D\uDD0D Validating workflow..."));
|
|
16031
16944
|
const validator = new WorkflowValidator;
|
|
16032
16945
|
const result = validator.validate(definition);
|
|
16033
16946
|
if (!result.valid) {
|
|
@@ -16042,11 +16955,11 @@ var WorkflowAddCommand = {
|
|
|
16042
16955
|
});
|
|
16043
16956
|
process.exit(1);
|
|
16044
16957
|
}
|
|
16045
|
-
output.log(
|
|
16958
|
+
output.log(chalk60.green(`✅ Workflow validation passed
|
|
16046
16959
|
`));
|
|
16047
16960
|
}
|
|
16048
16961
|
} else if (a.desc) {
|
|
16049
|
-
output.log(
|
|
16962
|
+
output.log(chalk60.blue(`\uD83E\uDD16 Generating workflow from description...
|
|
16050
16963
|
`));
|
|
16051
16964
|
const agentComponent = env.getComponent("agent");
|
|
16052
16965
|
if (!agentComponent) {
|
|
@@ -16054,10 +16967,10 @@ var WorkflowAddCommand = {
|
|
|
16054
16967
|
process.exit(1);
|
|
16055
16968
|
}
|
|
16056
16969
|
if (!agentComponent.getAgent("workflow-extractor")) {
|
|
16057
|
-
output.log(
|
|
16970
|
+
output.log(chalk60.gray("Auto-registering workflow-extractor agent..."));
|
|
16058
16971
|
const extractorConfig = createWorkflowExtractorAgent();
|
|
16059
16972
|
agentComponent.registerAgent(extractorConfig.name, extractorConfig);
|
|
16060
|
-
output.log(
|
|
16973
|
+
output.log(chalk60.green(`✅ workflow-extractor agent registered
|
|
16061
16974
|
`));
|
|
16062
16975
|
}
|
|
16063
16976
|
const prompt = `## 任务
|
|
@@ -16071,20 +16984,20 @@ ${a.desc}
|
|
|
16071
16984
|
1. 先用 \`roy-agent workflow nodes\` 查看可用的节点类型
|
|
16072
16985
|
2. 生成的 YAML 必须通过 \`roy-agent workflow validate --yaml "<yaml>"\` 验证
|
|
16073
16986
|
3. 验证通过后才输出最终 YAML`;
|
|
16074
|
-
output.log(
|
|
16987
|
+
output.log(chalk60.gray("Running workflow-extractor agent..."));
|
|
16075
16988
|
const result = await agentComponent.run("workflow-extractor", prompt);
|
|
16076
16989
|
const agentOutput = result.finalText || "";
|
|
16077
16990
|
definition = parseYamlFromAgentOutput(agentOutput);
|
|
16078
16991
|
if (definition === null) {
|
|
16079
16992
|
output.error("Failed to parse workflow from agent output");
|
|
16080
|
-
output.log(
|
|
16993
|
+
output.log(chalk60.gray(`
|
|
16081
16994
|
Agent output:
|
|
16082
16995
|
` + agentOutput.slice(0, 500)));
|
|
16083
16996
|
process.exit(1);
|
|
16084
16997
|
}
|
|
16085
16998
|
workflowName = a.name || definition.name;
|
|
16086
16999
|
if (a.validate) {
|
|
16087
|
-
output.log(
|
|
17000
|
+
output.log(chalk60.blue(`
|
|
16088
17001
|
\uD83D\uDD0D Validating generated workflow...`));
|
|
16089
17002
|
const validator = new WorkflowValidator;
|
|
16090
17003
|
const result2 = validator.validate(definition);
|
|
@@ -16098,16 +17011,16 @@ Agent output:
|
|
|
16098
17011
|
output.error(` Fix: ${error.fix}
|
|
16099
17012
|
`);
|
|
16100
17013
|
});
|
|
16101
|
-
output.log(
|
|
17014
|
+
output.log(chalk60.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
|
|
16102
17015
|
process.exit(1);
|
|
16103
17016
|
}
|
|
16104
|
-
output.log(
|
|
17017
|
+
output.log(chalk60.green(`✅ Generated workflow validation passed
|
|
16105
17018
|
`));
|
|
16106
17019
|
}
|
|
16107
17020
|
const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
|
|
16108
|
-
output.log(
|
|
17021
|
+
output.log(chalk60.gray("--- Generated YAML ---"));
|
|
16109
17022
|
output.log(yaml.stringify(definition));
|
|
16110
|
-
output.log(
|
|
17023
|
+
output.log(chalk60.gray(`------------------------
|
|
16111
17024
|
`));
|
|
16112
17025
|
} else {
|
|
16113
17026
|
output.error("Please provide --file or --desc option");
|
|
@@ -16121,10 +17034,10 @@ Agent output:
|
|
|
16121
17034
|
force: a.force
|
|
16122
17035
|
});
|
|
16123
17036
|
output.log(renderWorkflowAdded(workflow));
|
|
16124
|
-
output.log(
|
|
17037
|
+
output.log(chalk60.bold(`
|
|
16125
17038
|
\uD83D\uDCCA Nodes Summary:`));
|
|
16126
17039
|
output.log(renderNodesList(definition.nodes));
|
|
16127
|
-
output.log(
|
|
17040
|
+
output.log(chalk60.green(`
|
|
16128
17041
|
✅ Workflow '${workflowName}' added successfully`));
|
|
16129
17042
|
} catch (error) {
|
|
16130
17043
|
if (error.message?.includes("already exists") && !a.force) {
|
|
@@ -16141,7 +17054,7 @@ Agent output:
|
|
|
16141
17054
|
};
|
|
16142
17055
|
|
|
16143
17056
|
// src/commands/workflow/commands/get.ts
|
|
16144
|
-
import
|
|
17057
|
+
import chalk61 from "chalk";
|
|
16145
17058
|
var WorkflowGetCommand = {
|
|
16146
17059
|
command: "get <identifier>",
|
|
16147
17060
|
describe: "获取 Workflow 或 Run 详情",
|
|
@@ -16265,7 +17178,7 @@ var WorkflowGetCommand = {
|
|
|
16265
17178
|
} else {
|
|
16266
17179
|
output.log(renderWorkflowDetail(workflow, { includeRuns: runs }));
|
|
16267
17180
|
if (args.includeNodes) {
|
|
16268
|
-
output.log(
|
|
17181
|
+
output.log(chalk61.bold(`
|
|
16269
17182
|
\uD83D\uDCCB All Nodes:`));
|
|
16270
17183
|
output.log(renderNodesList(workflow.definition.nodes));
|
|
16271
17184
|
}
|
|
@@ -16281,7 +17194,7 @@ var WorkflowGetCommand = {
|
|
|
16281
17194
|
};
|
|
16282
17195
|
|
|
16283
17196
|
// src/commands/workflow/commands/update.ts
|
|
16284
|
-
import
|
|
17197
|
+
import chalk62 from "chalk";
|
|
16285
17198
|
import fs4 from "fs";
|
|
16286
17199
|
import path7 from "path";
|
|
16287
17200
|
var WorkflowUpdateCommand = {
|
|
@@ -16353,7 +17266,7 @@ var WorkflowUpdateCommand = {
|
|
|
16353
17266
|
const tags = a.tags ? a.tags.split(",").map((t) => t.trim()) : undefined;
|
|
16354
17267
|
const workflow = await service.updateWorkflow(a.name, updates, { tags });
|
|
16355
17268
|
output.log(renderWorkflowUpdated(workflow));
|
|
16356
|
-
output.log(
|
|
17269
|
+
output.log(chalk62.green(`
|
|
16357
17270
|
✅ Workflow '${a.name}' updated successfully`));
|
|
16358
17271
|
} catch (error) {
|
|
16359
17272
|
output.error(`Failed to update workflow: ${error}`);
|
|
@@ -16365,7 +17278,7 @@ var WorkflowUpdateCommand = {
|
|
|
16365
17278
|
};
|
|
16366
17279
|
|
|
16367
17280
|
// src/commands/workflow/commands/remove.ts
|
|
16368
|
-
import
|
|
17281
|
+
import chalk63 from "chalk";
|
|
16369
17282
|
var WorkflowRemoveCommand = {
|
|
16370
17283
|
command: "remove <name>",
|
|
16371
17284
|
describe: "删除 Workflow",
|
|
@@ -16404,8 +17317,8 @@ var WorkflowRemoveCommand = {
|
|
|
16404
17317
|
process.exit(1);
|
|
16405
17318
|
}
|
|
16406
17319
|
if (!args.force) {
|
|
16407
|
-
output.log(
|
|
16408
|
-
output.log(
|
|
17320
|
+
output.log(chalk63.yellow(`Are you sure you want to delete workflow '${args.name}'?`));
|
|
17321
|
+
output.log(chalk63.gray("Use --force to skip confirmation"));
|
|
16409
17322
|
process.exit(1);
|
|
16410
17323
|
}
|
|
16411
17324
|
const deleted = await service.deleteWorkflow(args.name);
|
|
@@ -16425,7 +17338,7 @@ var WorkflowRemoveCommand = {
|
|
|
16425
17338
|
|
|
16426
17339
|
// src/commands/workflow/commands/run.ts
|
|
16427
17340
|
var import_yaml = __toESM(require_dist(), 1);
|
|
16428
|
-
import
|
|
17341
|
+
import chalk64 from "chalk";
|
|
16429
17342
|
import fs5 from "fs";
|
|
16430
17343
|
import path8 from "path";
|
|
16431
17344
|
import { getTracerProvider as getTracerProvider4, propagation, wrapFunction } from "@ai-setting/roy-agent-core";
|
|
@@ -16498,7 +17411,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
16498
17411
|
};
|
|
16499
17412
|
if (args.sessionId) {
|
|
16500
17413
|
const sessionId = args.sessionId.startsWith("workflow_") ? args.sessionId : `workflow_${args.sessionId}`;
|
|
16501
|
-
output.log(
|
|
17414
|
+
output.log(chalk64.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
|
|
16502
17415
|
const sessionComponent = workflowComponent.sessionComponent;
|
|
16503
17416
|
if (!sessionComponent) {
|
|
16504
17417
|
output.error("SessionComponent not available");
|
|
@@ -16560,17 +17473,17 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
16560
17473
|
definition = { ...definition, name: args.name };
|
|
16561
17474
|
}
|
|
16562
17475
|
const workflow = await service.createWorkflow(definition, { force: true });
|
|
16563
|
-
output.log(
|
|
16564
|
-
output.log(
|
|
17476
|
+
output.log(chalk64.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
|
|
17477
|
+
output.log(chalk64.green(`✅ Workflow registered: ${workflow.name} (${workflow.id})`));
|
|
16565
17478
|
if (args.registerOnly) {
|
|
16566
|
-
output.log(
|
|
17479
|
+
output.log(chalk64.gray("ℹ️ Use --register-only, skipping execution"));
|
|
16567
17480
|
if (workflowSpan) {
|
|
16568
17481
|
workflowSpan.end();
|
|
16569
17482
|
}
|
|
16570
17483
|
await envService.dispose();
|
|
16571
17484
|
process.exit(0);
|
|
16572
17485
|
}
|
|
16573
|
-
output.log(
|
|
17486
|
+
output.log(chalk64.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
|
|
16574
17487
|
const result = await service.runWorkflow(definition, input, runOptions);
|
|
16575
17488
|
output.log(renderRunResult({
|
|
16576
17489
|
runId: result.runId,
|
|
@@ -16580,11 +17493,11 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
16580
17493
|
durationMs: result.durationMs
|
|
16581
17494
|
}));
|
|
16582
17495
|
if (result.status === "paused") {
|
|
16583
|
-
output.log(
|
|
17496
|
+
output.log(chalk64.gray(`
|
|
16584
17497
|
\uD83D\uDCA1 Use "roy-agent workflow run ${result.runId} --session-id ${result.runId} --input '<response>'" to resume`));
|
|
16585
17498
|
}
|
|
16586
17499
|
} else {
|
|
16587
|
-
output.log(
|
|
17500
|
+
output.log(chalk64.blue(`\uD83D\uDE80 Running workflow: ${args.identifier}`));
|
|
16588
17501
|
const result = await service.runWorkflow(args.identifier, input, runOptions);
|
|
16589
17502
|
output.log(renderRunResult({
|
|
16590
17503
|
runId: result.runId,
|
|
@@ -16594,7 +17507,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
16594
17507
|
durationMs: result.durationMs
|
|
16595
17508
|
}));
|
|
16596
17509
|
if (result.status === "paused") {
|
|
16597
|
-
output.log(
|
|
17510
|
+
output.log(chalk64.gray(`
|
|
16598
17511
|
\uD83D\uDCA1 Use "roy-agent workflow run ${result.runId} --session-id ${result.runId} --input '<response>'" to resume`));
|
|
16599
17512
|
}
|
|
16600
17513
|
}
|
|
@@ -16666,7 +17579,7 @@ var WorkflowRunCommand = {
|
|
|
16666
17579
|
};
|
|
16667
17580
|
|
|
16668
17581
|
// src/commands/workflow/commands/stop.ts
|
|
16669
|
-
import
|
|
17582
|
+
import chalk65 from "chalk";
|
|
16670
17583
|
import { wrapFunction as wrapFunction2 } from "@ai-setting/roy-agent-core";
|
|
16671
17584
|
var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
|
|
16672
17585
|
const output = new OutputService;
|
|
@@ -16695,7 +17608,7 @@ var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
|
|
|
16695
17608
|
process.exit(1);
|
|
16696
17609
|
}
|
|
16697
17610
|
await service.stopRun(args.runId);
|
|
16698
|
-
output.log(
|
|
17611
|
+
output.log(chalk65.red(`
|
|
16699
17612
|
⏹️ Workflow stopped: ${args.runId}`));
|
|
16700
17613
|
} catch (error) {
|
|
16701
17614
|
output.error(`Failed to stop workflow: ${error}`);
|
|
@@ -16719,7 +17632,7 @@ var WorkflowStopCommand = {
|
|
|
16719
17632
|
};
|
|
16720
17633
|
|
|
16721
17634
|
// src/commands/workflow/commands/status.ts
|
|
16722
|
-
import
|
|
17635
|
+
import chalk66 from "chalk";
|
|
16723
17636
|
var WorkflowStatusCommand = {
|
|
16724
17637
|
command: "status <runId>",
|
|
16725
17638
|
describe: "查看 Workflow 运行状态",
|
|
@@ -16810,7 +17723,7 @@ var WorkflowStatusCommand = {
|
|
|
16810
17723
|
stopped: "⏹️"
|
|
16811
17724
|
};
|
|
16812
17725
|
const emoji = statusEmoji[status] || "❓";
|
|
16813
|
-
output.log(
|
|
17726
|
+
output.log(chalk66.bold(`
|
|
16814
17727
|
${emoji} Status: ${status.toUpperCase()}`));
|
|
16815
17728
|
}
|
|
16816
17729
|
} catch (error) {
|
|
@@ -16823,7 +17736,7 @@ ${emoji} Status: ${status.toUpperCase()}`));
|
|
|
16823
17736
|
};
|
|
16824
17737
|
|
|
16825
17738
|
// src/commands/workflow/commands/nodes.ts
|
|
16826
|
-
import
|
|
17739
|
+
import chalk67 from "chalk";
|
|
16827
17740
|
var BUILT_IN_NODES = [
|
|
16828
17741
|
{
|
|
16829
17742
|
name: "ToolNode",
|
|
@@ -17160,7 +18073,7 @@ nodes:
|
|
|
17160
18073
|
];
|
|
17161
18074
|
function renderNodeTypesTable(nodes) {
|
|
17162
18075
|
const lines = [];
|
|
17163
|
-
lines.push(
|
|
18076
|
+
lines.push(chalk67.bold(`
|
|
17164
18077
|
\uD83D\uDCE6 Built-in Node Types
|
|
17165
18078
|
`));
|
|
17166
18079
|
lines.push("┌────────────┬────────────────────┬─────────────────────────────────────────────────────────────┐");
|
|
@@ -17178,29 +18091,29 @@ function renderNodeTypesTable(nodes) {
|
|
|
17178
18091
|
}
|
|
17179
18092
|
function renderNodeDetail(node) {
|
|
17180
18093
|
const lines = [];
|
|
17181
|
-
lines.push(
|
|
18094
|
+
lines.push(chalk67.bold(`
|
|
17182
18095
|
[${node.type}] ${node.name}`));
|
|
17183
|
-
lines.push(
|
|
18096
|
+
lines.push(chalk67.dim("─".repeat(60)) + `
|
|
17184
18097
|
`);
|
|
17185
|
-
lines.push(
|
|
18098
|
+
lines.push(chalk67.bold("Description:"));
|
|
17186
18099
|
lines.push(` ${node.description}
|
|
17187
18100
|
`);
|
|
17188
|
-
lines.push(
|
|
18101
|
+
lines.push(chalk67.bold("Configuration:"));
|
|
17189
18102
|
lines.push(' type: "' + node.type + '"');
|
|
17190
18103
|
lines.push(" config:");
|
|
17191
18104
|
for (const input of node.inputs) {
|
|
17192
|
-
const required = input.required ?
|
|
18105
|
+
const required = input.required ? chalk67.red("*") : " ";
|
|
17193
18106
|
lines.push(` ${input.name} (${input.type})${required}`);
|
|
17194
18107
|
lines.push(` ${input.description}`);
|
|
17195
18108
|
}
|
|
17196
18109
|
lines.push(`
|
|
17197
|
-
${
|
|
18110
|
+
${chalk67.bold("Output:")} ${node.output}`);
|
|
17198
18111
|
if (node.example) {
|
|
17199
|
-
lines.push(
|
|
18112
|
+
lines.push(chalk67.bold(`
|
|
17200
18113
|
Example:`));
|
|
17201
|
-
lines.push(
|
|
18114
|
+
lines.push(chalk67.gray("```yaml"));
|
|
17202
18115
|
lines.push(node.example);
|
|
17203
|
-
lines.push(
|
|
18116
|
+
lines.push(chalk67.gray("```"));
|
|
17204
18117
|
}
|
|
17205
18118
|
return lines.join(`
|
|
17206
18119
|
`);
|
|
@@ -17216,16 +18129,16 @@ var WorkflowNodesCommand = {
|
|
|
17216
18129
|
const nodeType = args.type?.toLowerCase();
|
|
17217
18130
|
if (!nodeType) {
|
|
17218
18131
|
console.log(renderNodeTypesTable(BUILT_IN_NODES));
|
|
17219
|
-
console.log(
|
|
17220
|
-
Use `) +
|
|
17221
|
-
console.log(
|
|
18132
|
+
console.log(chalk67.gray(`
|
|
18133
|
+
Use `) + chalk67.cyan("roy-agent workflow nodes <type>") + chalk67.gray(" for detailed information"));
|
|
18134
|
+
console.log(chalk67.gray("Available types: ") + chalk67.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
|
|
17222
18135
|
return;
|
|
17223
18136
|
}
|
|
17224
18137
|
const node = BUILT_IN_NODES.find((n) => n.type === nodeType);
|
|
17225
18138
|
if (!node) {
|
|
17226
|
-
console.log(
|
|
18139
|
+
console.log(chalk67.red(`
|
|
17227
18140
|
❌ Unknown node type: ${nodeType}`));
|
|
17228
|
-
console.log(
|
|
18141
|
+
console.log(chalk67.gray("Available types: ") + chalk67.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
|
|
17229
18142
|
process.exit(1);
|
|
17230
18143
|
}
|
|
17231
18144
|
console.log(renderNodeDetail(node));
|
|
@@ -17233,7 +18146,7 @@ Use `) + chalk58.cyan("roy-agent workflow nodes <type>") + chalk58.gray(" for de
|
|
|
17233
18146
|
};
|
|
17234
18147
|
|
|
17235
18148
|
// src/commands/workflow/commands/validate.ts
|
|
17236
|
-
import
|
|
18149
|
+
import chalk68 from "chalk";
|
|
17237
18150
|
import { readFileSync } from "fs";
|
|
17238
18151
|
async function parseWorkflowInput(input, yamlStr) {
|
|
17239
18152
|
const parseYaml = async (content) => {
|
|
@@ -17266,25 +18179,25 @@ function renderResult(result, options) {
|
|
|
17266
18179
|
return;
|
|
17267
18180
|
}
|
|
17268
18181
|
if (result.valid) {
|
|
17269
|
-
console.log(
|
|
18182
|
+
console.log(chalk68.green(`
|
|
17270
18183
|
✅ Workflow validation PASSED
|
|
17271
18184
|
`));
|
|
17272
|
-
console.log(
|
|
18185
|
+
console.log(chalk68.bold(`Workflow: ${result.workflowName}`));
|
|
17273
18186
|
console.log(`Nodes: ${result.nodeCount}`);
|
|
17274
18187
|
console.log(`
|
|
17275
18188
|
Valid nodes:`);
|
|
17276
|
-
console.log(
|
|
18189
|
+
console.log(chalk68.green(" ✓ All nodes passed validation"));
|
|
17277
18190
|
} else {
|
|
17278
|
-
console.log(
|
|
18191
|
+
console.log(chalk68.red(`
|
|
17279
18192
|
❌ Workflow validation FAILED (${result.errors.length} errors found)
|
|
17280
18193
|
`));
|
|
17281
18194
|
result.errors.forEach((error, index) => {
|
|
17282
|
-
console.log(
|
|
17283
|
-
console.log(` ${
|
|
17284
|
-
console.log(` ${
|
|
17285
|
-
console.log(` ${
|
|
17286
|
-
console.log(` ${
|
|
17287
|
-
console.log(` ${
|
|
18195
|
+
console.log(chalk68.red(`[Error ${index + 1}/${result.errors.length}]${error.nodeId ? ` Node "${error.nodeId}"` : ""}`));
|
|
18196
|
+
console.log(` ${chalk68.bold("Type:")} ${error.type}`);
|
|
18197
|
+
console.log(` ${chalk68.bold("Description:")} ${error.description}`);
|
|
18198
|
+
console.log(` ${chalk68.bold("Expected:")} ${error.expected}`);
|
|
18199
|
+
console.log(` ${chalk68.bold("Actual:")} ${error.actual}`);
|
|
18200
|
+
console.log(` ${chalk68.green("Fix:")} ${error.fix}`);
|
|
17288
18201
|
console.log();
|
|
17289
18202
|
});
|
|
17290
18203
|
}
|
|
@@ -17309,7 +18222,7 @@ var WorkflowValidateCommand = {
|
|
|
17309
18222
|
try {
|
|
17310
18223
|
const workflow = await parseWorkflowInput(options.input, options.yaml);
|
|
17311
18224
|
if (!workflow) {
|
|
17312
|
-
console.error(
|
|
18225
|
+
console.error(chalk68.red("Failed to parse workflow input"));
|
|
17313
18226
|
process.exit(1);
|
|
17314
18227
|
}
|
|
17315
18228
|
const validator = new WorkflowValidator;
|
|
@@ -17317,7 +18230,7 @@ var WorkflowValidateCommand = {
|
|
|
17317
18230
|
renderResult(result, options);
|
|
17318
18231
|
process.exit(result.valid ? 0 : 1);
|
|
17319
18232
|
} catch (error) {
|
|
17320
|
-
console.error(
|
|
18233
|
+
console.error(chalk68.red(`
|
|
17321
18234
|
Error: ${error.message}`));
|
|
17322
18235
|
process.exit(1);
|
|
17323
18236
|
}
|
|
@@ -17623,7 +18536,7 @@ async function runCli() {
|
|
|
17623
18536
|
array: true,
|
|
17624
18537
|
description: "Enable plugin (e.g., --plugin tslsp, --plugin lsp, --plugin task-tag)",
|
|
17625
18538
|
global: true
|
|
17626
|
-
}).middleware(quietModeMiddleware, true).command(ActCommand).command(InteractiveCommand).command(SessionsCommand).command(TasksCommand).command(SkillsCommand).command(CommandsCommand).command(ConfigCommand).command(McpCommand).command(ToolsCommand2).command(MemoryCommand).command(EventSourceCommand).command(DebugCommand).command(WorkflowCommand).command(LspCommand).demandCommand().help().alias("help", "h").epilog(PLUGIN_HELP).parse();
|
|
18539
|
+
}).middleware(quietModeMiddleware, true).command(ActCommand).command(InteractiveCommand).command(SessionsCommand).command(TasksCommand).command(SkillsCommand).command(AgentsCommand).command(PromptCommand).command(CommandsCommand).command(ConfigCommand).command(McpCommand).command(ToolsCommand2).command(MemoryCommand).command(EventSourceCommand).command(DebugCommand).command(WorkflowCommand).command(LspCommand).demandCommand().help().alias("help", "h").epilog(PLUGIN_HELP).parse();
|
|
17627
18540
|
}
|
|
17628
18541
|
|
|
17629
18542
|
// src/bin/roy-agent.ts
|