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