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