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