@ai-setting/roy-agent-cli 1.5.104 → 1.5.106
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 +254 -215
- package/dist/index.js +254 -215
- package/package.json +3 -3
- package/dist/roy-agent-linux-x64/bin/roy-agent +0 -0
package/dist/bin/roy-agent.js
CHANGED
|
@@ -7427,7 +7427,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7427
7427
|
var require_package = __commonJS((exports, module) => {
|
|
7428
7428
|
module.exports = {
|
|
7429
7429
|
name: "@ai-setting/roy-agent-cli",
|
|
7430
|
-
version: "1.5.
|
|
7430
|
+
version: "1.5.106",
|
|
7431
7431
|
type: "module",
|
|
7432
7432
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7433
7433
|
main: "./dist/index.js",
|
|
@@ -7455,9 +7455,9 @@ var require_package = __commonJS((exports, module) => {
|
|
|
7455
7455
|
typecheck: "npx tsc --noEmit --skipLibCheck"
|
|
7456
7456
|
},
|
|
7457
7457
|
dependencies: {
|
|
7458
|
-
"@ai-setting/roy-agent-coder-harness": "
|
|
7458
|
+
"@ai-setting/roy-agent-coder-harness": "workspace:*",
|
|
7459
7459
|
"@ai-setting/roy-agent-core": "^1.5.83",
|
|
7460
|
-
"@ai-setting/roy-agent-ontology-harness": "
|
|
7460
|
+
"@ai-setting/roy-agent-ontology-harness": "workspace:*",
|
|
7461
7461
|
chalk: "^5.6.2",
|
|
7462
7462
|
commander: "^14.0.3",
|
|
7463
7463
|
effect: "^3.21.2",
|
|
@@ -10190,7 +10190,6 @@ ${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
|
|
|
10190
10190
|
await this.executeInternal(message, { showPrompt: true });
|
|
10191
10191
|
}
|
|
10192
10192
|
currentAgentContext = undefined;
|
|
10193
|
-
eventSourceSystemPrompts = [];
|
|
10194
10193
|
isIdle() {
|
|
10195
10194
|
return !this.isExecuting;
|
|
10196
10195
|
}
|
|
@@ -10481,6 +10480,7 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10481
10480
|
const output = new OutputService2;
|
|
10482
10481
|
const shouldDisposeEnvService = !externalEnvService;
|
|
10483
10482
|
const envService = externalEnvService ?? new EnvironmentService(output);
|
|
10483
|
+
let eventSourceSystemPrompts = [];
|
|
10484
10484
|
const CODER_HARNESS_PLUGINS = new Set([
|
|
10485
10485
|
"lsp",
|
|
10486
10486
|
"code-check",
|
|
@@ -10635,7 +10635,7 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10635
10635
|
sessionTitle,
|
|
10636
10636
|
onExecute: async (message, traceId, agentContext) => {
|
|
10637
10637
|
resetStreamAbort();
|
|
10638
|
-
const preloadedPrompts =
|
|
10638
|
+
const preloadedPrompts = eventSourceSystemPrompts;
|
|
10639
10639
|
const eventSourceSystemPrompt = preloadedPrompts.length > 0 ? joinResolvedSystemPrompts(preloadedPrompts) : undefined;
|
|
10640
10640
|
const mergedContext = {
|
|
10641
10641
|
...currentAgentContext,
|
|
@@ -10722,9 +10722,9 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10722
10722
|
process.exit(1);
|
|
10723
10723
|
}
|
|
10724
10724
|
const summary = await startEventSources(eventSourceIds, eventSourceComponent, output);
|
|
10725
|
-
|
|
10726
|
-
if (
|
|
10727
|
-
output.info(`\uD83D\uDCE6 Preloaded ${
|
|
10725
|
+
eventSourceSystemPrompts = collectEventSourceSystemPrompts(eventSourceIds, eventSourceComponent);
|
|
10726
|
+
if (eventSourceSystemPrompts.length > 0) {
|
|
10727
|
+
output.info(`\uD83D\uDCE6 Preloaded ${eventSourceSystemPrompts.length} event-source systemPrompt(s)`);
|
|
10728
10728
|
}
|
|
10729
10729
|
if (eventSourceIds.length === 1 && summary.failedCount > 0) {
|
|
10730
10730
|
process.exit(1);
|
|
@@ -13889,6 +13889,11 @@ var ListCommand4 = {
|
|
|
13889
13889
|
process.exit(1);
|
|
13890
13890
|
}
|
|
13891
13891
|
let agents;
|
|
13892
|
+
const builtInSubAgentNames = new Set([
|
|
13893
|
+
"general",
|
|
13894
|
+
"explore",
|
|
13895
|
+
"roy"
|
|
13896
|
+
]);
|
|
13892
13897
|
if (args.type && args.type !== "all") {
|
|
13893
13898
|
agents = registry.listAgentsByType(args.type);
|
|
13894
13899
|
} else {
|
|
@@ -13900,6 +13905,7 @@ var ListCommand4 = {
|
|
|
13900
13905
|
agents: agents.map((a) => ({
|
|
13901
13906
|
name: a.name,
|
|
13902
13907
|
type: a.type,
|
|
13908
|
+
source: builtInSubAgentNames.has(a.name) ? "built-in" : "user",
|
|
13903
13909
|
description: a.description,
|
|
13904
13910
|
workflow: a.workflow,
|
|
13905
13911
|
model: a.model,
|
|
@@ -13913,6 +13919,7 @@ var ListCommand4 = {
|
|
|
13913
13919
|
const header = [
|
|
13914
13920
|
chalk31.bold("Name"),
|
|
13915
13921
|
chalk31.bold("Type"),
|
|
13922
|
+
chalk31.bold("Source"),
|
|
13916
13923
|
chalk31.bold("Model"),
|
|
13917
13924
|
chalk31.bold("Workflow"),
|
|
13918
13925
|
chalk31.bold("Description")
|
|
@@ -13928,9 +13935,11 @@ var ListCommand4 = {
|
|
|
13928
13935
|
const desc2 = (a.description || "").length > 40 ? (a.description || "").slice(0, 37) + "..." : a.description || "-";
|
|
13929
13936
|
const workflowDisplay = a.type === "workflow" && a.workflow ? chalk31.cyan(a.workflow.length > 30 ? a.workflow.slice(0, 27) + "..." : a.workflow) : chalk31.gray("-");
|
|
13930
13937
|
const modelDisplay = a.model ? chalk31.yellow(a.model.length > 20 ? a.model.slice(0, 17) + "..." : a.model) : chalk31.gray("-");
|
|
13938
|
+
const sourceDisplay = builtInSubAgentNames.has(a.name) ? chalk31.green("built-in") : chalk31.gray("user");
|
|
13931
13939
|
return [
|
|
13932
13940
|
chalk31.cyan(a.name),
|
|
13933
13941
|
typeColor(a.type)(a.type),
|
|
13942
|
+
sourceDisplay,
|
|
13934
13943
|
modelDisplay,
|
|
13935
13944
|
workflowDisplay,
|
|
13936
13945
|
desc2
|
|
@@ -16616,15 +16625,42 @@ var EventSourceListCommand = {
|
|
|
16616
16625
|
};
|
|
16617
16626
|
|
|
16618
16627
|
// src/commands/eventsource/add.ts
|
|
16619
|
-
import
|
|
16628
|
+
import chalk57 from "chalk";
|
|
16620
16629
|
import { generateId } from "@ai-setting/roy-agent-core";
|
|
16630
|
+
|
|
16631
|
+
// src/commands/eventsource/server-url-option.ts
|
|
16632
|
+
import chalk56 from "chalk";
|
|
16633
|
+
function addServerUrlOption(yargs) {
|
|
16634
|
+
return yargs.option("server-url", {
|
|
16635
|
+
alias: "s",
|
|
16636
|
+
type: "string",
|
|
16637
|
+
description: "Service base URL (e.g., http://localhost:8787, ws://localhost:4005/ws, " + "or https://bounty.example.com). When set, overrides BOUNTY_SERVER_URL env var " + "and default. Must start with http://, https://, ws://, or wss://. " + "Trailing slashes are auto-trimmed."
|
|
16638
|
+
}).option("im-server-url", {
|
|
16639
|
+
type: "string",
|
|
16640
|
+
description: "[Deprecated alias for --server-url] IM Server WebSocket URL " + "(bounty-im type). Prefer --server-url / -s for new code."
|
|
16641
|
+
});
|
|
16642
|
+
}
|
|
16643
|
+
function resolveServerUrl(serverUrl, fallback) {
|
|
16644
|
+
if (!serverUrl)
|
|
16645
|
+
return fallback;
|
|
16646
|
+
const trimmed = serverUrl.replace(/\/+$/, "");
|
|
16647
|
+
if (!/^(https?|wss?):\/\//.test(trimmed)) {
|
|
16648
|
+
console.error(chalk56.red(`
|
|
16649
|
+
✗ Invalid --server-url: "${serverUrl}". Must start with http://, https://, ws://, or wss://
|
|
16650
|
+
`));
|
|
16651
|
+
process.exit(1);
|
|
16652
|
+
}
|
|
16653
|
+
return trimmed;
|
|
16654
|
+
}
|
|
16655
|
+
|
|
16656
|
+
// src/commands/eventsource/add.ts
|
|
16621
16657
|
function uuid() {
|
|
16622
16658
|
return generateId();
|
|
16623
16659
|
}
|
|
16624
16660
|
var EventSourceAddCommand = {
|
|
16625
16661
|
command: "add <name> <type>",
|
|
16626
16662
|
describe: "添加新的事件源",
|
|
16627
|
-
builder: (yargs) => yargs.positional("name", {
|
|
16663
|
+
builder: (yargs) => addServerUrlOption(yargs.positional("name", {
|
|
16628
16664
|
describe: "事件源名称",
|
|
16629
16665
|
type: "string",
|
|
16630
16666
|
demandOption: true
|
|
@@ -16657,9 +16693,6 @@ var EventSourceAddCommand = {
|
|
|
16657
16693
|
}).option("address", {
|
|
16658
16694
|
describe: "Agent IM 地址(bounty-im 类型用,格式:agent-id@host)",
|
|
16659
16695
|
type: "string"
|
|
16660
|
-
}).option("im-server-url", {
|
|
16661
|
-
describe: "IM Server WebSocket URL(bounty-im 类型用,如 ws://localhost:4005/ws)",
|
|
16662
|
-
type: "string"
|
|
16663
16696
|
}).option("tls-skip-verify", {
|
|
16664
16697
|
describe: "跳过 TLS 证书校验(bounty-im 类型用,wss:// 自签名场景,生产环境不推荐)",
|
|
16665
16698
|
type: "boolean",
|
|
@@ -16667,7 +16700,7 @@ var EventSourceAddCommand = {
|
|
|
16667
16700
|
}).option("prompt", {
|
|
16668
16701
|
describe: "自定义 prompt 消息(timer 类型,替换默认 SelfReminder 内容)",
|
|
16669
16702
|
type: "string"
|
|
16670
|
-
}),
|
|
16703
|
+
})),
|
|
16671
16704
|
async handler(args) {
|
|
16672
16705
|
const a = args;
|
|
16673
16706
|
const output = new OutputService2;
|
|
@@ -16685,6 +16718,9 @@ var EventSourceAddCommand = {
|
|
|
16685
16718
|
process.exit(1);
|
|
16686
16719
|
}
|
|
16687
16720
|
const eventTypes = a.eventTypes?.split(",").map((s) => s.trim());
|
|
16721
|
+
const envUrl = process.env.BOUNTY_SERVER_URL;
|
|
16722
|
+
const fallback = envUrl || "http://localhost:8787";
|
|
16723
|
+
const resolvedServerUrl = resolveServerUrl(a.serverUrl || a.imServerUrl, fallback);
|
|
16688
16724
|
const config = {
|
|
16689
16725
|
id: uuid(),
|
|
16690
16726
|
name: a.name,
|
|
@@ -16697,41 +16733,44 @@ var EventSourceAddCommand = {
|
|
|
16697
16733
|
cron: a.cron,
|
|
16698
16734
|
profile: a.profile,
|
|
16699
16735
|
address: a.address,
|
|
16700
|
-
imServerUrl:
|
|
16736
|
+
imServerUrl: resolvedServerUrl,
|
|
16701
16737
|
tlsSkipVerify: a.tlsSkipVerify === true,
|
|
16702
16738
|
options: a.prompt ? { prompt: a.prompt } : undefined
|
|
16703
16739
|
};
|
|
16704
16740
|
esComponent.register(config);
|
|
16705
|
-
output.success(
|
|
16741
|
+
output.success(chalk57.green(`事件源 '${a.name}' 添加成功!`));
|
|
16706
16742
|
output.log("");
|
|
16707
|
-
output.log(` ID: ${
|
|
16708
|
-
output.log(` Type: ${
|
|
16743
|
+
output.log(` ID: ${chalk57.gray(config.id)}`);
|
|
16744
|
+
output.log(` Type: ${chalk57.cyan(a.type)}`);
|
|
16709
16745
|
if (eventTypes?.length) {
|
|
16710
|
-
output.log(` Event Types: ${
|
|
16746
|
+
output.log(` Event Types: ${chalk57.gray(eventTypes.join(", "))}`);
|
|
16711
16747
|
}
|
|
16712
16748
|
if (a.command) {
|
|
16713
|
-
output.log(` Command: ${
|
|
16749
|
+
output.log(` Command: ${chalk57.gray(a.command)}`);
|
|
16714
16750
|
}
|
|
16715
16751
|
if (a.interval) {
|
|
16716
|
-
output.log(` Interval: ${
|
|
16752
|
+
output.log(` Interval: ${chalk57.gray(`${a.interval}ms`)}`);
|
|
16717
16753
|
}
|
|
16718
16754
|
if (a.profile) {
|
|
16719
|
-
output.log(` Profile: ${
|
|
16755
|
+
output.log(` Profile: ${chalk57.gray(a.profile)}`);
|
|
16720
16756
|
}
|
|
16721
16757
|
if (a.address) {
|
|
16722
|
-
output.log(` Address: ${
|
|
16758
|
+
output.log(` Address: ${chalk57.gray(a.address)}`);
|
|
16723
16759
|
}
|
|
16724
16760
|
if (a.imServerUrl) {
|
|
16725
|
-
output.log(` IM Server URL: ${
|
|
16761
|
+
output.log(` IM Server URL: ${chalk57.gray(a.imServerUrl)}`);
|
|
16762
|
+
}
|
|
16763
|
+
if (resolvedServerUrl) {
|
|
16764
|
+
output.log(` Server URL: ${chalk57.gray(resolvedServerUrl)}`);
|
|
16726
16765
|
}
|
|
16727
16766
|
if (a.tlsSkipVerify) {
|
|
16728
|
-
output.log(` TLS Skip Verify: ${
|
|
16767
|
+
output.log(` TLS Skip Verify: ${chalk57.yellow("⚠ true (自签名场景)")}`);
|
|
16729
16768
|
}
|
|
16730
16769
|
if (a.prompt) {
|
|
16731
|
-
output.log(` Prompt: ${
|
|
16770
|
+
output.log(` Prompt: ${chalk57.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
|
|
16732
16771
|
}
|
|
16733
16772
|
output.log("");
|
|
16734
|
-
output.log(
|
|
16773
|
+
output.log(chalk57.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
|
|
16735
16774
|
} finally {
|
|
16736
16775
|
await envService.dispose();
|
|
16737
16776
|
}
|
|
@@ -16739,7 +16778,7 @@ var EventSourceAddCommand = {
|
|
|
16739
16778
|
};
|
|
16740
16779
|
|
|
16741
16780
|
// src/commands/eventsource/update.ts
|
|
16742
|
-
import
|
|
16781
|
+
import chalk58 from "chalk";
|
|
16743
16782
|
function findSource(esComponent, id) {
|
|
16744
16783
|
const sources = esComponent.list();
|
|
16745
16784
|
const matched = sources.find((s) => s.id === id || s.id.startsWith(id));
|
|
@@ -16750,7 +16789,7 @@ function findSource(esComponent, id) {
|
|
|
16750
16789
|
var EventSourceUpdateCommand = {
|
|
16751
16790
|
command: "update <id>",
|
|
16752
16791
|
describe: "更新事件源配置(部分更新,type 不可改)",
|
|
16753
|
-
builder: (yargs) => yargs.positional("id", {
|
|
16792
|
+
builder: (yargs) => addServerUrlOption(yargs.positional("id", {
|
|
16754
16793
|
describe: "事件源 ID(支持前缀匹配)",
|
|
16755
16794
|
type: "string",
|
|
16756
16795
|
demandOption: true
|
|
@@ -16785,13 +16824,10 @@ var EventSourceUpdateCommand = {
|
|
|
16785
16824
|
}).option("address", {
|
|
16786
16825
|
describe: "Agent IM 地址(bounty-im 类型用,格式:agent-id@host)",
|
|
16787
16826
|
type: "string"
|
|
16788
|
-
}).option("im-server-url", {
|
|
16789
|
-
describe: "IM Server WebSocket URL(bounty-im 类型用,如 ws://localhost:4005/ws)",
|
|
16790
|
-
type: "string"
|
|
16791
16827
|
}).option("tls-skip-verify", {
|
|
16792
16828
|
describe: "跳过 TLS 证书校验(bounty-im 类型用,wss:// 自签名场景,生产环境不推荐)",
|
|
16793
16829
|
type: "boolean"
|
|
16794
|
-
}),
|
|
16830
|
+
})),
|
|
16795
16831
|
async handler(args) {
|
|
16796
16832
|
const a = args;
|
|
16797
16833
|
const output = new OutputService2;
|
|
@@ -16814,7 +16850,7 @@ var EventSourceUpdateCommand = {
|
|
|
16814
16850
|
const all = esComponent.list();
|
|
16815
16851
|
if (all.length > 0) {
|
|
16816
16852
|
output.info("");
|
|
16817
|
-
output.info(
|
|
16853
|
+
output.info(chalk58.gray("可用的事件源:"));
|
|
16818
16854
|
for (const s of all) {
|
|
16819
16855
|
output.info(` - ${s.id.substring(0, 8)}: ${s.name} (${s.type})`);
|
|
16820
16856
|
}
|
|
@@ -16839,8 +16875,11 @@ var EventSourceUpdateCommand = {
|
|
|
16839
16875
|
partial.enabled = a.enabled;
|
|
16840
16876
|
if (a.address !== undefined)
|
|
16841
16877
|
partial.address = a.address;
|
|
16842
|
-
if (a.imServerUrl !== undefined)
|
|
16843
|
-
|
|
16878
|
+
if (a.serverUrl !== undefined || a.imServerUrl !== undefined) {
|
|
16879
|
+
const envUrl = process.env.BOUNTY_SERVER_URL;
|
|
16880
|
+
const fallback = envUrl || "http://localhost:8787";
|
|
16881
|
+
partial.imServerUrl = resolveServerUrl(a.serverUrl ?? a.imServerUrl, fallback);
|
|
16882
|
+
}
|
|
16844
16883
|
if (a.tlsSkipVerify !== undefined)
|
|
16845
16884
|
partial.tlsSkipVerify = a.tlsSkipVerify === true;
|
|
16846
16885
|
if (a.prompt !== undefined) {
|
|
@@ -16853,19 +16892,19 @@ var EventSourceUpdateCommand = {
|
|
|
16853
16892
|
}
|
|
16854
16893
|
try {
|
|
16855
16894
|
const result = await esComponent.update(match.fullId, partial);
|
|
16856
|
-
output.success(
|
|
16895
|
+
output.success(chalk58.green(`✅ 事件源已更新: ${match.source.name}`));
|
|
16857
16896
|
output.log("");
|
|
16858
|
-
output.log(
|
|
16897
|
+
output.log(chalk58.bold("修改字段:"));
|
|
16859
16898
|
const before = match.source;
|
|
16860
16899
|
const after = result.updated;
|
|
16861
16900
|
for (const field of result.fields) {
|
|
16862
16901
|
const beforeVal = JSON.stringify(before[field] ?? before.options?.[field]);
|
|
16863
16902
|
const afterVal = JSON.stringify(after[field] ?? after.options?.[field]);
|
|
16864
|
-
output.log(` ${
|
|
16903
|
+
output.log(` ${chalk58.cyan(field)}: ${chalk58.gray(beforeVal)} ${chalk58.gray("→")} ${chalk58.green(afterVal)}`);
|
|
16865
16904
|
}
|
|
16866
16905
|
output.log("");
|
|
16867
16906
|
if (result.wasRunning) {
|
|
16868
|
-
output.info(
|
|
16907
|
+
output.info(chalk58.yellow(`⚠️ 事件源在更新前正在运行,已自动停止。请使用 'roy-agent eventsource start ${match.fullId.substring(0, 8)}' 手动启动以应用新配置。`));
|
|
16869
16908
|
}
|
|
16870
16909
|
} catch (error) {
|
|
16871
16910
|
output.error(`❌ 更新失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -16878,7 +16917,7 @@ var EventSourceUpdateCommand = {
|
|
|
16878
16917
|
};
|
|
16879
16918
|
|
|
16880
16919
|
// src/commands/eventsource/remove.ts
|
|
16881
|
-
import
|
|
16920
|
+
import chalk59 from "chalk";
|
|
16882
16921
|
var EventSourceRemoveCommand = {
|
|
16883
16922
|
command: "remove <id>",
|
|
16884
16923
|
aliases: ["rm"],
|
|
@@ -16917,7 +16956,7 @@ var EventSourceRemoveCommand = {
|
|
|
16917
16956
|
const status = esComponent.getStatus(matchedSource.id);
|
|
16918
16957
|
if (status === "running" && !args.force) {
|
|
16919
16958
|
output.error(`事件源正在运行中,请先停止: ${matchedSource.name} (${status})`);
|
|
16920
|
-
output.log(
|
|
16959
|
+
output.log(chalk59.gray(`使用 --force 强制移除或 'roy-agent eventsource stop ${matchedSource.id.substring(0, 8)}' 先停止`));
|
|
16921
16960
|
process.exit(1);
|
|
16922
16961
|
}
|
|
16923
16962
|
if (status === "running") {
|
|
@@ -16926,7 +16965,7 @@ var EventSourceRemoveCommand = {
|
|
|
16926
16965
|
}
|
|
16927
16966
|
const result = esComponent.unregister(matchedSource.id);
|
|
16928
16967
|
if (result) {
|
|
16929
|
-
output.success(
|
|
16968
|
+
output.success(chalk59.green(`事件源已移除: ${matchedSource.name}`));
|
|
16930
16969
|
} else {
|
|
16931
16970
|
output.error("移除失败");
|
|
16932
16971
|
process.exit(1);
|
|
@@ -16938,7 +16977,7 @@ var EventSourceRemoveCommand = {
|
|
|
16938
16977
|
};
|
|
16939
16978
|
|
|
16940
16979
|
// src/commands/eventsource/start.ts
|
|
16941
|
-
import
|
|
16980
|
+
import chalk60 from "chalk";
|
|
16942
16981
|
var EventSourceStartCommand = {
|
|
16943
16982
|
command: "start <id>",
|
|
16944
16983
|
describe: "启动指定的事件源",
|
|
@@ -16975,15 +17014,15 @@ var EventSourceStartCommand = {
|
|
|
16975
17014
|
}
|
|
16976
17015
|
const status = esComponent.getStatus(matchedSource.id);
|
|
16977
17016
|
if (status === "running") {
|
|
16978
|
-
output.log(
|
|
17017
|
+
output.log(chalk60.yellow(`事件源已在运行: ${matchedSource.name}`));
|
|
16979
17018
|
return;
|
|
16980
17019
|
}
|
|
16981
17020
|
output.info(`正在启动事件源 '${matchedSource.name}'...`);
|
|
16982
17021
|
try {
|
|
16983
17022
|
await esComponent.startSource(matchedSource.id);
|
|
16984
|
-
output.success(
|
|
17023
|
+
output.success(chalk60.green(`事件源已启动: ${matchedSource.name}`));
|
|
16985
17024
|
if (!args.background) {
|
|
16986
|
-
output.log(
|
|
17025
|
+
output.log(chalk60.gray("按 Ctrl+C 停止..."));
|
|
16987
17026
|
await new Promise((resolve) => {
|
|
16988
17027
|
const cleanup = () => {
|
|
16989
17028
|
process.removeListener("SIGINT", cleanup);
|
|
@@ -17005,7 +17044,7 @@ var EventSourceStartCommand = {
|
|
|
17005
17044
|
};
|
|
17006
17045
|
|
|
17007
17046
|
// src/commands/eventsource/stop.ts
|
|
17008
|
-
import
|
|
17047
|
+
import chalk61 from "chalk";
|
|
17009
17048
|
var EventSourceStopCommand = {
|
|
17010
17049
|
command: "stop <id>",
|
|
17011
17050
|
aliases: ["kill"],
|
|
@@ -17043,13 +17082,13 @@ var EventSourceStopCommand = {
|
|
|
17043
17082
|
}
|
|
17044
17083
|
const status = esComponent.getStatus(matchedSource.id);
|
|
17045
17084
|
if (status !== "running") {
|
|
17046
|
-
output.log(
|
|
17085
|
+
output.log(chalk61.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
|
|
17047
17086
|
return;
|
|
17048
17087
|
}
|
|
17049
17088
|
output.info(`正在停止事件源 '${matchedSource.name}'...`);
|
|
17050
17089
|
try {
|
|
17051
17090
|
await esComponent.stopSource(matchedSource.id);
|
|
17052
|
-
output.success(
|
|
17091
|
+
output.success(chalk61.green(`事件源已停止: ${matchedSource.name}`));
|
|
17053
17092
|
} catch (error) {
|
|
17054
17093
|
output.error(`停止失败: ${error}`);
|
|
17055
17094
|
process.exit(1);
|
|
@@ -17061,14 +17100,14 @@ var EventSourceStopCommand = {
|
|
|
17061
17100
|
};
|
|
17062
17101
|
|
|
17063
17102
|
// src/commands/eventsource/status.ts
|
|
17064
|
-
import
|
|
17103
|
+
import chalk62 from "chalk";
|
|
17065
17104
|
var STATUS_COLORS = {
|
|
17066
|
-
created:
|
|
17067
|
-
starting:
|
|
17068
|
-
running:
|
|
17069
|
-
stopping:
|
|
17070
|
-
stopped:
|
|
17071
|
-
error:
|
|
17105
|
+
created: chalk62.gray,
|
|
17106
|
+
starting: chalk62.yellow,
|
|
17107
|
+
running: chalk62.green,
|
|
17108
|
+
stopping: chalk62.yellow,
|
|
17109
|
+
stopped: chalk62.gray,
|
|
17110
|
+
error: chalk62.red
|
|
17072
17111
|
};
|
|
17073
17112
|
var STATUS_ICONS = {
|
|
17074
17113
|
created: "○",
|
|
@@ -17122,7 +17161,7 @@ var EventSourceStatusCommand = {
|
|
|
17122
17161
|
process.exit(1);
|
|
17123
17162
|
}
|
|
17124
17163
|
const status = esComponent.getStatus(matchedSource.id) || "unknown";
|
|
17125
|
-
const statusColor = STATUS_COLORS[status] ||
|
|
17164
|
+
const statusColor = STATUS_COLORS[status] || chalk62.gray;
|
|
17126
17165
|
if (args.json) {
|
|
17127
17166
|
output.json({
|
|
17128
17167
|
id: matchedSource.id,
|
|
@@ -17139,31 +17178,31 @@ var EventSourceStatusCommand = {
|
|
|
17139
17178
|
});
|
|
17140
17179
|
return;
|
|
17141
17180
|
}
|
|
17142
|
-
output.log(
|
|
17181
|
+
output.log(chalk62.bold("事件源详情"));
|
|
17143
17182
|
output.log("─".repeat(50));
|
|
17144
|
-
output.log(` ID: ${
|
|
17145
|
-
output.log(` Name: ${
|
|
17146
|
-
output.log(` Type: ${
|
|
17183
|
+
output.log(` ID: ${chalk62.gray(matchedSource.id)}`);
|
|
17184
|
+
output.log(` Name: ${chalk62.cyan(matchedSource.name)}`);
|
|
17185
|
+
output.log(` Type: ${chalk62.cyan(matchedSource.type)}`);
|
|
17147
17186
|
output.log(` Status: ${statusColor(`${STATUS_ICONS[status]} ${STATUS_LABELS[status]}`)}`);
|
|
17148
|
-
output.log(` Enabled: ${matchedSource.enabled ?
|
|
17187
|
+
output.log(` Enabled: ${matchedSource.enabled ? chalk62.green("是") : chalk62.gray("否")}`);
|
|
17149
17188
|
if (matchedSource.eventTypes?.length) {
|
|
17150
|
-
output.log(` Events: ${
|
|
17189
|
+
output.log(` Events: ${chalk62.gray(matchedSource.eventTypes.join(", "))}`);
|
|
17151
17190
|
}
|
|
17152
17191
|
if (matchedSource.command) {
|
|
17153
|
-
output.log(` Command: ${
|
|
17192
|
+
output.log(` Command: ${chalk62.gray(matchedSource.command)}`);
|
|
17154
17193
|
}
|
|
17155
17194
|
if (matchedSource.interval) {
|
|
17156
|
-
output.log(` Interval: ${
|
|
17195
|
+
output.log(` Interval: ${chalk62.gray(`${matchedSource.interval}ms`)}`);
|
|
17157
17196
|
}
|
|
17158
17197
|
if (matchedSource.url) {
|
|
17159
|
-
output.log(` URL: ${
|
|
17198
|
+
output.log(` URL: ${chalk62.gray(matchedSource.url)}`);
|
|
17160
17199
|
}
|
|
17161
17200
|
output.log("");
|
|
17162
17201
|
return;
|
|
17163
17202
|
}
|
|
17164
17203
|
const sources = esComponent.list();
|
|
17165
17204
|
if (sources.length === 0) {
|
|
17166
|
-
output.log(
|
|
17205
|
+
output.log(chalk62.yellow("没有配置的事件源"));
|
|
17167
17206
|
return;
|
|
17168
17207
|
}
|
|
17169
17208
|
if (args.json) {
|
|
@@ -17177,21 +17216,21 @@ var EventSourceStatusCommand = {
|
|
|
17177
17216
|
output.json({ sources: sourcesWithStatus, count: sources.length });
|
|
17178
17217
|
return;
|
|
17179
17218
|
}
|
|
17180
|
-
output.log(
|
|
17219
|
+
output.log(chalk62.bold("事件源状态概览"));
|
|
17181
17220
|
output.log("─".repeat(60));
|
|
17182
17221
|
for (const source of sources) {
|
|
17183
17222
|
const status = esComponent.getStatus(source.id) || "unknown";
|
|
17184
|
-
const statusColor = STATUS_COLORS[status] ||
|
|
17223
|
+
const statusColor = STATUS_COLORS[status] || chalk62.gray;
|
|
17185
17224
|
const icon = STATUS_ICONS[status] || "?";
|
|
17186
17225
|
const label = STATUS_LABELS[status] || status;
|
|
17187
17226
|
output.log("");
|
|
17188
|
-
output.log(` ${
|
|
17227
|
+
output.log(` ${chalk62.cyan(source.name)} ${chalk62.gray(`(${source.type})`)}`);
|
|
17189
17228
|
output.log(` └─ Status: ${statusColor(`${icon} ${label}`)}`);
|
|
17190
|
-
output.log(` ID: ${
|
|
17229
|
+
output.log(` ID: ${chalk62.gray(source.id.substring(0, 8))}...`);
|
|
17191
17230
|
}
|
|
17192
17231
|
output.log("");
|
|
17193
17232
|
const runningCount = sources.filter((s) => esComponent.getStatus(s.id) === "running").length;
|
|
17194
|
-
output.log(
|
|
17233
|
+
output.log(chalk62.green(`✅ ${runningCount}/${sources.length} 运行中`));
|
|
17195
17234
|
} finally {
|
|
17196
17235
|
await envService.dispose();
|
|
17197
17236
|
}
|
|
@@ -17504,7 +17543,7 @@ var DebugCommand = {
|
|
|
17504
17543
|
};
|
|
17505
17544
|
|
|
17506
17545
|
// src/commands/workflow/renderers.ts
|
|
17507
|
-
import
|
|
17546
|
+
import chalk63 from "chalk";
|
|
17508
17547
|
function truncateVisual3(str, maxWidth) {
|
|
17509
17548
|
if (!str)
|
|
17510
17549
|
return "-";
|
|
@@ -17539,18 +17578,18 @@ function formatDuration(ms) {
|
|
|
17539
17578
|
function statusColor(status) {
|
|
17540
17579
|
switch (status) {
|
|
17541
17580
|
case "completed":
|
|
17542
|
-
return
|
|
17581
|
+
return chalk63.green;
|
|
17543
17582
|
case "running":
|
|
17544
17583
|
case "idle":
|
|
17545
|
-
return
|
|
17584
|
+
return chalk63.blue;
|
|
17546
17585
|
case "paused":
|
|
17547
|
-
return
|
|
17586
|
+
return chalk63.yellow;
|
|
17548
17587
|
case "failed":
|
|
17549
|
-
return
|
|
17588
|
+
return chalk63.red;
|
|
17550
17589
|
case "stopped":
|
|
17551
|
-
return
|
|
17590
|
+
return chalk63.gray;
|
|
17552
17591
|
default:
|
|
17553
|
-
return
|
|
17592
|
+
return chalk63.white;
|
|
17554
17593
|
}
|
|
17555
17594
|
}
|
|
17556
17595
|
function renderWorkflowList(workflows, options) {
|
|
@@ -17569,7 +17608,7 @@ function renderWorkflowList(workflows, options) {
|
|
|
17569
17608
|
}, null, 2);
|
|
17570
17609
|
}
|
|
17571
17610
|
if (workflows.length === 0) {
|
|
17572
|
-
return
|
|
17611
|
+
return chalk63.yellow("No workflows found");
|
|
17573
17612
|
}
|
|
17574
17613
|
const NAME_WIDTH = 30;
|
|
17575
17614
|
const VERSION_WIDTH = 10;
|
|
@@ -17577,10 +17616,10 @@ function renderWorkflowList(workflows, options) {
|
|
|
17577
17616
|
const UPDATED_WIDTH = 20;
|
|
17578
17617
|
const GAP = " ";
|
|
17579
17618
|
const headerLine = [
|
|
17580
|
-
|
|
17581
|
-
|
|
17582
|
-
|
|
17583
|
-
|
|
17619
|
+
chalk63.bold("NAME".padEnd(NAME_WIDTH)),
|
|
17620
|
+
chalk63.bold("VER".padEnd(VERSION_WIDTH)),
|
|
17621
|
+
chalk63.bold("TAGS".padEnd(TAGS_WIDTH)),
|
|
17622
|
+
chalk63.bold("UPDATED")
|
|
17584
17623
|
].join(GAP);
|
|
17585
17624
|
const sepLine = "─".repeat(NAME_WIDTH + VERSION_WIDTH + TAGS_WIDTH + UPDATED_WIDTH + GAP.length * 3);
|
|
17586
17625
|
const rows = workflows.map((w) => {
|
|
@@ -17595,18 +17634,18 @@ function renderWorkflowList(workflows, options) {
|
|
|
17595
17634
|
}
|
|
17596
17635
|
function renderWorkflowDetail(workflow, options) {
|
|
17597
17636
|
const lines = [];
|
|
17598
|
-
lines.push(
|
|
17637
|
+
lines.push(chalk63.bold(`
|
|
17599
17638
|
\uD83D\uDCCB Workflow Details
|
|
17600
17639
|
`));
|
|
17601
|
-
lines.push(` ${
|
|
17602
|
-
lines.push(` ${
|
|
17603
|
-
lines.push(` ${
|
|
17604
|
-
lines.push(` ${
|
|
17605
|
-
lines.push(` ${
|
|
17606
|
-
lines.push(` ${
|
|
17607
|
-
lines.push(` ${
|
|
17640
|
+
lines.push(` ${chalk63.cyan("ID:")} ${workflow.id}`);
|
|
17641
|
+
lines.push(` ${chalk63.cyan("Name:")} ${workflow.name}`);
|
|
17642
|
+
lines.push(` ${chalk63.cyan("Version:")} ${workflow.version}`);
|
|
17643
|
+
lines.push(` ${chalk63.cyan("Description:")} ${workflow.description || "-"}`);
|
|
17644
|
+
lines.push(` ${chalk63.cyan("Tags:")} ${workflow.tags.join(", ") || "-"}`);
|
|
17645
|
+
lines.push(` ${chalk63.cyan("Created:")} ${formatDate(workflow.createdAt)}`);
|
|
17646
|
+
lines.push(` ${chalk63.cyan("Updated:")} ${formatDate(workflow.updatedAt)}`);
|
|
17608
17647
|
const nodeCount = workflow.definition.nodes.length;
|
|
17609
|
-
lines.push(
|
|
17648
|
+
lines.push(chalk63.bold(`
|
|
17610
17649
|
\uD83D\uDCCA Nodes Summary
|
|
17611
17650
|
`));
|
|
17612
17651
|
lines.push(` Total: ${nodeCount} nodes`);
|
|
@@ -17618,7 +17657,7 @@ function renderWorkflowDetail(workflow, options) {
|
|
|
17618
17657
|
lines.push(` - ${type}: ${count}`);
|
|
17619
17658
|
}
|
|
17620
17659
|
if (workflow.definition.config) {
|
|
17621
|
-
lines.push(
|
|
17660
|
+
lines.push(chalk63.bold(`
|
|
17622
17661
|
⚙️ Configuration
|
|
17623
17662
|
`));
|
|
17624
17663
|
if (workflow.definition.config.parallel_limit !== undefined) {
|
|
@@ -17632,7 +17671,7 @@ function renderWorkflowDetail(workflow, options) {
|
|
|
17632
17671
|
}
|
|
17633
17672
|
}
|
|
17634
17673
|
if (options?.includeRuns && options.includeRuns.length > 0) {
|
|
17635
|
-
lines.push(
|
|
17674
|
+
lines.push(chalk63.bold(`
|
|
17636
17675
|
\uD83D\uDCDC Recent Runs
|
|
17637
17676
|
`));
|
|
17638
17677
|
lines.push(renderRunsList(options.includeRuns.slice(0, 5)));
|
|
@@ -17656,7 +17695,7 @@ function renderRunsList(runs, options) {
|
|
|
17656
17695
|
}, null, 2);
|
|
17657
17696
|
}
|
|
17658
17697
|
if (runs.length === 0) {
|
|
17659
|
-
return
|
|
17698
|
+
return chalk63.yellow("No runs found");
|
|
17660
17699
|
}
|
|
17661
17700
|
const ID_WIDTH = 20;
|
|
17662
17701
|
const STATUS_WIDTH = 12;
|
|
@@ -17664,10 +17703,10 @@ function renderRunsList(runs, options) {
|
|
|
17664
17703
|
const UPDATED_WIDTH = 20;
|
|
17665
17704
|
const GAP = " ";
|
|
17666
17705
|
const headerLine = [
|
|
17667
|
-
|
|
17668
|
-
|
|
17669
|
-
|
|
17670
|
-
|
|
17706
|
+
chalk63.bold("RUN ID".padEnd(ID_WIDTH)),
|
|
17707
|
+
chalk63.bold("STATUS".padEnd(STATUS_WIDTH)),
|
|
17708
|
+
chalk63.bold("DURATION".padEnd(DURATION_WIDTH)),
|
|
17709
|
+
chalk63.bold("STARTED")
|
|
17671
17710
|
].join(GAP);
|
|
17672
17711
|
const sepLine = "─".repeat(ID_WIDTH + STATUS_WIDTH + DURATION_WIDTH + UPDATED_WIDTH + GAP.length * 3);
|
|
17673
17712
|
const rows = runs.map((r) => {
|
|
@@ -17682,34 +17721,34 @@ function renderRunsList(runs, options) {
|
|
|
17682
17721
|
}
|
|
17683
17722
|
function renderRunDetail(run) {
|
|
17684
17723
|
const lines = [];
|
|
17685
|
-
lines.push(
|
|
17724
|
+
lines.push(chalk63.bold(`
|
|
17686
17725
|
\uD83C\uDFC3 Run Details
|
|
17687
17726
|
`));
|
|
17688
|
-
lines.push(` ${
|
|
17689
|
-
lines.push(` ${
|
|
17690
|
-
lines.push(` ${
|
|
17691
|
-
lines.push(` ${
|
|
17727
|
+
lines.push(` ${chalk63.cyan("Run ID:")} ${run.id}`);
|
|
17728
|
+
lines.push(` ${chalk63.cyan("Workflow:")} ${run.workflowId}`);
|
|
17729
|
+
lines.push(` ${chalk63.cyan("Status:")} ${statusColor(run.status)(run.status)}`);
|
|
17730
|
+
lines.push(` ${chalk63.cyan("Started:")} ${formatDate(run.startedAt)}`);
|
|
17692
17731
|
if (run.pausedAt) {
|
|
17693
|
-
lines.push(` ${
|
|
17732
|
+
lines.push(` ${chalk63.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
|
|
17694
17733
|
}
|
|
17695
17734
|
if (run.resumedAt) {
|
|
17696
|
-
lines.push(` ${
|
|
17735
|
+
lines.push(` ${chalk63.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
|
|
17697
17736
|
}
|
|
17698
17737
|
if (run.stoppedAt) {
|
|
17699
|
-
lines.push(` ${
|
|
17738
|
+
lines.push(` ${chalk63.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
|
|
17700
17739
|
}
|
|
17701
17740
|
if (run.completedAt) {
|
|
17702
|
-
lines.push(` ${
|
|
17741
|
+
lines.push(` ${chalk63.cyan("Completed:")} ${formatDate(run.completedAt)}`);
|
|
17703
17742
|
}
|
|
17704
|
-
lines.push(` ${
|
|
17743
|
+
lines.push(` ${chalk63.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
|
|
17705
17744
|
if (run.error) {
|
|
17706
|
-
lines.push(
|
|
17745
|
+
lines.push(chalk63.bold(`
|
|
17707
17746
|
❌ Error
|
|
17708
17747
|
`));
|
|
17709
|
-
lines.push(` ${
|
|
17748
|
+
lines.push(` ${chalk63.red(run.error)}`);
|
|
17710
17749
|
}
|
|
17711
17750
|
if (run.output) {
|
|
17712
|
-
lines.push(
|
|
17751
|
+
lines.push(chalk63.bold(`
|
|
17713
17752
|
\uD83D\uDCE4 Output
|
|
17714
17753
|
`));
|
|
17715
17754
|
lines.push(" " + JSON.stringify(run.output, null, 2).split(`
|
|
@@ -17720,36 +17759,36 @@ function renderRunDetail(run) {
|
|
|
17720
17759
|
`);
|
|
17721
17760
|
}
|
|
17722
17761
|
function renderWorkflowAdded(workflow) {
|
|
17723
|
-
return
|
|
17762
|
+
return chalk63.green(`
|
|
17724
17763
|
✅ Workflow '${workflow.name}' added successfully
|
|
17725
17764
|
`) + ` ID: ${workflow.id}
|
|
17726
17765
|
` + ` Version: ${workflow.version}
|
|
17727
17766
|
`;
|
|
17728
17767
|
}
|
|
17729
17768
|
function renderWorkflowUpdated(workflow) {
|
|
17730
|
-
return
|
|
17769
|
+
return chalk63.green(`
|
|
17731
17770
|
✅ Workflow '${workflow.name}' updated successfully
|
|
17732
17771
|
`) + ` ID: ${workflow.id}
|
|
17733
17772
|
`;
|
|
17734
17773
|
}
|
|
17735
17774
|
function renderWorkflowDeleted(name) {
|
|
17736
|
-
return
|
|
17775
|
+
return chalk63.green(`
|
|
17737
17776
|
✅ Workflow '${name}' deleted successfully
|
|
17738
17777
|
`);
|
|
17739
17778
|
}
|
|
17740
17779
|
function renderRunResult(result) {
|
|
17741
17780
|
const lines = [];
|
|
17742
17781
|
if (result.status === "completed") {
|
|
17743
|
-
lines.push(
|
|
17782
|
+
lines.push(chalk63.green(`
|
|
17744
17783
|
✅ Workflow completed successfully`));
|
|
17745
17784
|
} else if (result.status === "failed") {
|
|
17746
|
-
lines.push(
|
|
17785
|
+
lines.push(chalk63.red(`
|
|
17747
17786
|
❌ Workflow failed`));
|
|
17748
17787
|
} else if (result.status === "stopped") {
|
|
17749
|
-
lines.push(
|
|
17788
|
+
lines.push(chalk63.yellow(`
|
|
17750
17789
|
⚠️ Workflow stopped`));
|
|
17751
17790
|
} else {
|
|
17752
|
-
lines.push(
|
|
17791
|
+
lines.push(chalk63.blue(`
|
|
17753
17792
|
\uD83D\uDD04 Workflow ${result.status}`));
|
|
17754
17793
|
}
|
|
17755
17794
|
lines.push(` Run ID: ${result.runId}`);
|
|
@@ -17757,11 +17796,11 @@ function renderRunResult(result) {
|
|
|
17757
17796
|
lines.push(` Duration: ${formatDuration(result.durationMs)}`);
|
|
17758
17797
|
}
|
|
17759
17798
|
if (result.error) {
|
|
17760
|
-
lines.push(
|
|
17799
|
+
lines.push(chalk63.red(`
|
|
17761
17800
|
Error: ${result.error}`));
|
|
17762
17801
|
}
|
|
17763
17802
|
if (result.output) {
|
|
17764
|
-
lines.push(
|
|
17803
|
+
lines.push(chalk63.bold(`
|
|
17765
17804
|
\uD83D\uDCE4 Output:`));
|
|
17766
17805
|
lines.push(JSON.stringify(result.output, null, 2));
|
|
17767
17806
|
}
|
|
@@ -17775,10 +17814,10 @@ function renderNodesList(nodes) {
|
|
|
17775
17814
|
const DEPS_WIDTH = 20;
|
|
17776
17815
|
const GAP = " ";
|
|
17777
17816
|
const headerLine = [
|
|
17778
|
-
|
|
17779
|
-
|
|
17780
|
-
|
|
17781
|
-
|
|
17817
|
+
chalk63.bold("NODE ID".padEnd(ID_WIDTH)),
|
|
17818
|
+
chalk63.bold("TYPE".padEnd(TYPE_WIDTH)),
|
|
17819
|
+
chalk63.bold("NAME".padEnd(NAME_WIDTH)),
|
|
17820
|
+
chalk63.bold("DEPENDS ON")
|
|
17782
17821
|
].join(GAP);
|
|
17783
17822
|
const sepLine = "─".repeat(ID_WIDTH + TYPE_WIDTH + NAME_WIDTH + DEPS_WIDTH + GAP.length * 3);
|
|
17784
17823
|
const rows = nodes.map((n) => {
|
|
@@ -17793,7 +17832,7 @@ function renderNodesList(nodes) {
|
|
|
17793
17832
|
}
|
|
17794
17833
|
|
|
17795
17834
|
// src/commands/workflow/commands/list.ts
|
|
17796
|
-
import
|
|
17835
|
+
import chalk64 from "chalk";
|
|
17797
17836
|
import { createWorkflowListTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
17798
17837
|
function buildListWorkflowsJson(workflows, total, args, availableTags) {
|
|
17799
17838
|
const output = {
|
|
@@ -17941,20 +17980,20 @@ var WorkflowListCommand = {
|
|
|
17941
17980
|
if (total > workflows.length) {
|
|
17942
17981
|
const start = finalOffset + 1;
|
|
17943
17982
|
const end = finalOffset + workflows.length;
|
|
17944
|
-
output.log(
|
|
17983
|
+
output.log(chalk64.green(`
|
|
17945
17984
|
✅ 显示 ${start}-${end} / 共 ${total} 个 Workflow`));
|
|
17946
17985
|
const totalPages = Math.ceil(total / pageSize);
|
|
17947
17986
|
const currentPage = Math.floor(finalOffset / pageSize) + 1;
|
|
17948
17987
|
if (totalPages > 1) {
|
|
17949
|
-
output.log(
|
|
17988
|
+
output.log(chalk64.cyan(`\uD83D\uDCC4 第 ${currentPage} / ${totalPages} 页`));
|
|
17950
17989
|
}
|
|
17951
17990
|
} else {
|
|
17952
|
-
output.log(
|
|
17991
|
+
output.log(chalk64.green(`
|
|
17953
17992
|
✅ 共 ${total} 个 Workflow`));
|
|
17954
17993
|
}
|
|
17955
17994
|
if (availableTags.length > 0) {
|
|
17956
17995
|
const tagsLine = availableTags.map((t) => `${t.name}(${t.count})`).join(", ");
|
|
17957
|
-
output.log(
|
|
17996
|
+
output.log(chalk64.cyan(`
|
|
17958
17997
|
\uD83C\uDFF7️ Available tags: ${tagsLine}`));
|
|
17959
17998
|
}
|
|
17960
17999
|
}
|
|
@@ -18558,7 +18597,7 @@ class WorkflowValidator {
|
|
|
18558
18597
|
|
|
18559
18598
|
// src/commands/workflow/commands/add.ts
|
|
18560
18599
|
import { validateWorkflowDefinition } from "@ai-setting/roy-agent-core/env/workflow/utils";
|
|
18561
|
-
import
|
|
18600
|
+
import chalk65 from "chalk";
|
|
18562
18601
|
import fs3 from "fs";
|
|
18563
18602
|
import path6 from "path";
|
|
18564
18603
|
async function parseWorkflowContent(content, filename) {
|
|
@@ -18700,7 +18739,7 @@ var WorkflowAddCommand = {
|
|
|
18700
18739
|
definition = await parseWorkflowContent(content, filePath);
|
|
18701
18740
|
workflowName = a.name || definition.name || path6.basename(filePath);
|
|
18702
18741
|
if (a.validate) {
|
|
18703
|
-
output.log(
|
|
18742
|
+
output.log(chalk65.blue("\uD83D\uDD0D Validating workflow..."));
|
|
18704
18743
|
const dagResult = validateWorkflowDefinition(definition);
|
|
18705
18744
|
if (!dagResult.valid) {
|
|
18706
18745
|
output.error(`
|
|
@@ -18724,11 +18763,11 @@ var WorkflowAddCommand = {
|
|
|
18724
18763
|
});
|
|
18725
18764
|
process.exit(1);
|
|
18726
18765
|
}
|
|
18727
|
-
output.log(
|
|
18766
|
+
output.log(chalk65.green(`✅ Workflow validation passed
|
|
18728
18767
|
`));
|
|
18729
18768
|
}
|
|
18730
18769
|
} else if (a.desc) {
|
|
18731
|
-
output.log(
|
|
18770
|
+
output.log(chalk65.blue(`\uD83E\uDD16 Generating workflow from description...
|
|
18732
18771
|
`));
|
|
18733
18772
|
const agentComponent = env.getComponent("agent");
|
|
18734
18773
|
if (!agentComponent) {
|
|
@@ -18750,20 +18789,20 @@ ${a.desc}
|
|
|
18750
18789
|
1. 先用 \`roy-agent workflow nodes\` 查看可用的节点类型
|
|
18751
18790
|
2. 生成的 YAML 必须通过 \`roy-agent workflow validate --yaml "<yaml>"\` 验证
|
|
18752
18791
|
3. 验证通过后才输出最终 YAML`;
|
|
18753
|
-
output.log(
|
|
18792
|
+
output.log(chalk65.gray("Running workflow-extract agent..."));
|
|
18754
18793
|
const result = await agentComponent.run("workflow-extract", prompt);
|
|
18755
18794
|
const agentOutput = result.finalText || "";
|
|
18756
18795
|
definition = parseYamlFromAgentOutput(agentOutput);
|
|
18757
18796
|
if (definition === null) {
|
|
18758
18797
|
output.error("Failed to parse workflow from agent output");
|
|
18759
|
-
output.log(
|
|
18798
|
+
output.log(chalk65.gray(`
|
|
18760
18799
|
Agent output:
|
|
18761
18800
|
` + agentOutput.slice(0, 500)));
|
|
18762
18801
|
process.exit(1);
|
|
18763
18802
|
}
|
|
18764
18803
|
workflowName = a.name || definition.name;
|
|
18765
18804
|
if (a.validate) {
|
|
18766
|
-
output.log(
|
|
18805
|
+
output.log(chalk65.blue(`
|
|
18767
18806
|
\uD83D\uDD0D Validating generated workflow...`));
|
|
18768
18807
|
const dagResult = validateWorkflowDefinition(definition);
|
|
18769
18808
|
if (!dagResult.valid) {
|
|
@@ -18772,7 +18811,7 @@ Agent output:
|
|
|
18772
18811
|
dagResult.errors.forEach((msg, i) => {
|
|
18773
18812
|
output.error(`[Error ${i + 1}/${dagResult.errors.length}] ${msg}`);
|
|
18774
18813
|
});
|
|
18775
|
-
output.log(
|
|
18814
|
+
output.log(chalk65.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
|
|
18776
18815
|
process.exit(1);
|
|
18777
18816
|
}
|
|
18778
18817
|
const validator = new WorkflowValidator;
|
|
@@ -18787,16 +18826,16 @@ Agent output:
|
|
|
18787
18826
|
output.error(` Fix: ${error.fix}
|
|
18788
18827
|
`);
|
|
18789
18828
|
});
|
|
18790
|
-
output.log(
|
|
18829
|
+
output.log(chalk65.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
|
|
18791
18830
|
process.exit(1);
|
|
18792
18831
|
}
|
|
18793
|
-
output.log(
|
|
18832
|
+
output.log(chalk65.green(`✅ Generated workflow validation passed
|
|
18794
18833
|
`));
|
|
18795
18834
|
}
|
|
18796
18835
|
const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
|
|
18797
|
-
output.log(
|
|
18836
|
+
output.log(chalk65.gray("--- Generated YAML ---"));
|
|
18798
18837
|
output.log(yaml.stringify(definition));
|
|
18799
|
-
output.log(
|
|
18838
|
+
output.log(chalk65.gray(`------------------------
|
|
18800
18839
|
`));
|
|
18801
18840
|
} else {
|
|
18802
18841
|
output.error("Please provide --file or --desc option");
|
|
@@ -18822,10 +18861,10 @@ Agent output:
|
|
|
18822
18861
|
force: a.force
|
|
18823
18862
|
});
|
|
18824
18863
|
output.log(renderWorkflowAdded(workflow));
|
|
18825
|
-
output.log(
|
|
18864
|
+
output.log(chalk65.bold(`
|
|
18826
18865
|
\uD83D\uDCCA Nodes Summary:`));
|
|
18827
18866
|
output.log(renderNodesList(definition.nodes));
|
|
18828
|
-
output.log(
|
|
18867
|
+
output.log(chalk65.green(`
|
|
18829
18868
|
✅ Workflow '${workflowName}' added successfully`));
|
|
18830
18869
|
} catch (error) {
|
|
18831
18870
|
if (error.message?.includes("already exists") && !a.force) {
|
|
@@ -18842,7 +18881,7 @@ Agent output:
|
|
|
18842
18881
|
};
|
|
18843
18882
|
|
|
18844
18883
|
// src/commands/workflow/commands/get.ts
|
|
18845
|
-
import
|
|
18884
|
+
import chalk66 from "chalk";
|
|
18846
18885
|
import { createWorkflowGetTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
18847
18886
|
var WorkflowGetCommand = {
|
|
18848
18887
|
command: "get <identifier>",
|
|
@@ -18980,15 +19019,15 @@ var WorkflowGetCommand = {
|
|
|
18980
19019
|
} else {
|
|
18981
19020
|
output.log(renderWorkflowDetail(workflow, { includeRuns: runs }));
|
|
18982
19021
|
if (args.includeNodes) {
|
|
18983
|
-
output.log(
|
|
19022
|
+
output.log(chalk66.bold(`
|
|
18984
19023
|
\uD83D\uDCCB All Nodes:`));
|
|
18985
19024
|
output.log(renderNodesList(data.nodes || []));
|
|
18986
19025
|
}
|
|
18987
19026
|
const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
|
|
18988
19027
|
const defYaml = yaml.stringify(data.definition || {}, { indent: 2 });
|
|
18989
|
-
output.log(
|
|
19028
|
+
output.log(chalk66.bold(`
|
|
18990
19029
|
\uD83D\uDCC4 Definition (YAML):`));
|
|
18991
|
-
output.log(
|
|
19030
|
+
output.log(chalk66.gray(defYaml));
|
|
18992
19031
|
}
|
|
18993
19032
|
}
|
|
18994
19033
|
} catch (error) {
|
|
@@ -19001,7 +19040,7 @@ var WorkflowGetCommand = {
|
|
|
19001
19040
|
};
|
|
19002
19041
|
|
|
19003
19042
|
// src/commands/workflow/commands/update.ts
|
|
19004
|
-
import
|
|
19043
|
+
import chalk67 from "chalk";
|
|
19005
19044
|
import fs4 from "fs";
|
|
19006
19045
|
import path7 from "path";
|
|
19007
19046
|
import { parseWorkflowFile } from "@ai-setting/roy-agent-core/env/workflow/types";
|
|
@@ -19074,7 +19113,7 @@ var WorkflowUpdateCommand = {
|
|
|
19074
19113
|
const tags = a.tags ? a.tags.split(",").map((t) => t.trim()) : undefined;
|
|
19075
19114
|
const workflow = await service.updateWorkflow(a.name, updates, { tags });
|
|
19076
19115
|
output.log(renderWorkflowUpdated(workflow));
|
|
19077
|
-
output.log(
|
|
19116
|
+
output.log(chalk67.green(`
|
|
19078
19117
|
✅ Workflow '${a.name}' updated successfully`));
|
|
19079
19118
|
} catch (error) {
|
|
19080
19119
|
output.error(`Failed to update workflow: ${error}`);
|
|
@@ -19086,7 +19125,7 @@ var WorkflowUpdateCommand = {
|
|
|
19086
19125
|
};
|
|
19087
19126
|
|
|
19088
19127
|
// src/commands/workflow/commands/remove.ts
|
|
19089
|
-
import
|
|
19128
|
+
import chalk68 from "chalk";
|
|
19090
19129
|
var WorkflowRemoveCommand = {
|
|
19091
19130
|
command: "remove <name>",
|
|
19092
19131
|
describe: "删除 Workflow",
|
|
@@ -19125,8 +19164,8 @@ var WorkflowRemoveCommand = {
|
|
|
19125
19164
|
process.exit(1);
|
|
19126
19165
|
}
|
|
19127
19166
|
if (!args.force) {
|
|
19128
|
-
output.log(
|
|
19129
|
-
output.log(
|
|
19167
|
+
output.log(chalk68.yellow(`Are you sure you want to delete workflow '${args.name}'?`));
|
|
19168
|
+
output.log(chalk68.gray("Use --force to skip confirmation"));
|
|
19130
19169
|
process.exit(1);
|
|
19131
19170
|
}
|
|
19132
19171
|
const deleted = await service.deleteWorkflow(args.name);
|
|
@@ -19146,7 +19185,7 @@ var WorkflowRemoveCommand = {
|
|
|
19146
19185
|
|
|
19147
19186
|
// src/commands/workflow/commands/run.ts
|
|
19148
19187
|
var import_yaml = __toESM(require_dist(), 1);
|
|
19149
|
-
import
|
|
19188
|
+
import chalk69 from "chalk";
|
|
19150
19189
|
import fs5 from "fs";
|
|
19151
19190
|
import path8 from "path";
|
|
19152
19191
|
import { createRunWorkflowTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
@@ -19224,7 +19263,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19224
19263
|
};
|
|
19225
19264
|
if (args.session) {
|
|
19226
19265
|
const sessionId = args.session;
|
|
19227
|
-
output.log(
|
|
19266
|
+
output.log(chalk69.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
|
|
19228
19267
|
const sessionComponent = workflowComponent.sessionComponent;
|
|
19229
19268
|
if (!sessionComponent) {
|
|
19230
19269
|
output.error("SessionComponent not available");
|
|
@@ -19286,17 +19325,17 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19286
19325
|
definition = { ...definition, name: args.name };
|
|
19287
19326
|
}
|
|
19288
19327
|
const workflow = await service.createWorkflow(definition, { force: true });
|
|
19289
|
-
output.log(
|
|
19290
|
-
output.log(
|
|
19328
|
+
output.log(chalk69.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
|
|
19329
|
+
output.log(chalk69.green(`✅ Workflow registered: ${workflow.name} (${workflow.id})`));
|
|
19291
19330
|
if (args.registerOnly) {
|
|
19292
|
-
output.log(
|
|
19331
|
+
output.log(chalk69.gray("ℹ️ Use --register-only, skipping execution"));
|
|
19293
19332
|
if (workflowSpan) {
|
|
19294
19333
|
workflowSpan.end();
|
|
19295
19334
|
}
|
|
19296
19335
|
await envService.dispose();
|
|
19297
19336
|
process.exit(0);
|
|
19298
19337
|
}
|
|
19299
|
-
output.log(
|
|
19338
|
+
output.log(chalk69.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
|
|
19300
19339
|
const result = await service.runWorkflow(definition, input, runOptions);
|
|
19301
19340
|
output.log(renderRunResult({
|
|
19302
19341
|
runId: result.runId,
|
|
@@ -19306,7 +19345,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19306
19345
|
durationMs: result.durationMs
|
|
19307
19346
|
}));
|
|
19308
19347
|
if (result.status === "paused") {
|
|
19309
|
-
output.log(
|
|
19348
|
+
output.log(chalk69.gray(`
|
|
19310
19349
|
\uD83D\uDCA1 Use "roy-agent workflow run ${result.runId} --session ${result.runId} --input '<response>'" to resume`));
|
|
19311
19350
|
}
|
|
19312
19351
|
} else {
|
|
@@ -19329,7 +19368,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
|
|
|
19329
19368
|
durationMs: runData.duration_ms
|
|
19330
19369
|
}));
|
|
19331
19370
|
if (runData.status === "paused") {
|
|
19332
|
-
output.log(
|
|
19371
|
+
output.log(chalk69.gray(`
|
|
19333
19372
|
\uD83D\uDCA1 Use "roy-agent workflow run ${runData.run_id} --session ${runData.run_id} --input '<response>'" to resume`));
|
|
19334
19373
|
}
|
|
19335
19374
|
}
|
|
@@ -19401,7 +19440,7 @@ var WorkflowRunCommand = {
|
|
|
19401
19440
|
};
|
|
19402
19441
|
|
|
19403
19442
|
// src/commands/workflow/commands/stop.ts
|
|
19404
|
-
import
|
|
19443
|
+
import chalk70 from "chalk";
|
|
19405
19444
|
import { createWorkflowRunStopTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
19406
19445
|
import { wrapFunction as wrapFunction2 } from "@ai-setting/roy-agent-core";
|
|
19407
19446
|
var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
|
|
@@ -19426,7 +19465,7 @@ var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
|
|
|
19426
19465
|
output.error(result.error || `Failed to stop workflow: ${args.runId}`);
|
|
19427
19466
|
process.exit(1);
|
|
19428
19467
|
}
|
|
19429
|
-
output.log(
|
|
19468
|
+
output.log(chalk70.red(`
|
|
19430
19469
|
⏹️ Workflow stopped: ${args.runId}`));
|
|
19431
19470
|
} catch (error) {
|
|
19432
19471
|
output.error(`Failed to stop workflow: ${error}`);
|
|
@@ -19450,7 +19489,7 @@ var WorkflowStopCommand = {
|
|
|
19450
19489
|
};
|
|
19451
19490
|
|
|
19452
19491
|
// src/commands/workflow/commands/status.ts
|
|
19453
|
-
import
|
|
19492
|
+
import chalk71 from "chalk";
|
|
19454
19493
|
import { createWorkflowRunStatusTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
|
|
19455
19494
|
var WorkflowStatusCommand = {
|
|
19456
19495
|
command: "status <runId>",
|
|
@@ -19543,7 +19582,7 @@ var WorkflowStatusCommand = {
|
|
|
19543
19582
|
stopped: "⏹️"
|
|
19544
19583
|
};
|
|
19545
19584
|
const emoji = statusEmoji[status] || "❓";
|
|
19546
|
-
output.log(
|
|
19585
|
+
output.log(chalk71.bold(`
|
|
19547
19586
|
${emoji} Status: ${status.toUpperCase()}`));
|
|
19548
19587
|
}
|
|
19549
19588
|
} catch (error) {
|
|
@@ -19556,7 +19595,7 @@ ${emoji} Status: ${status.toUpperCase()}`));
|
|
|
19556
19595
|
};
|
|
19557
19596
|
|
|
19558
19597
|
// src/commands/workflow/commands/nodes.ts
|
|
19559
|
-
import
|
|
19598
|
+
import chalk72 from "chalk";
|
|
19560
19599
|
var BUILT_IN_NODES = [
|
|
19561
19600
|
{
|
|
19562
19601
|
name: "ToolNode",
|
|
@@ -19893,7 +19932,7 @@ nodes:
|
|
|
19893
19932
|
];
|
|
19894
19933
|
function renderNodeTypesTable(nodes) {
|
|
19895
19934
|
const lines = [];
|
|
19896
|
-
lines.push(
|
|
19935
|
+
lines.push(chalk72.bold(`
|
|
19897
19936
|
\uD83D\uDCE6 Built-in Node Types
|
|
19898
19937
|
`));
|
|
19899
19938
|
lines.push("┌────────────┬────────────────────┬─────────────────────────────────────────────────────────────┐");
|
|
@@ -19911,29 +19950,29 @@ function renderNodeTypesTable(nodes) {
|
|
|
19911
19950
|
}
|
|
19912
19951
|
function renderNodeDetail(node) {
|
|
19913
19952
|
const lines = [];
|
|
19914
|
-
lines.push(
|
|
19953
|
+
lines.push(chalk72.bold(`
|
|
19915
19954
|
[${node.type}] ${node.name}`));
|
|
19916
|
-
lines.push(
|
|
19955
|
+
lines.push(chalk72.dim("─".repeat(60)) + `
|
|
19917
19956
|
`);
|
|
19918
|
-
lines.push(
|
|
19957
|
+
lines.push(chalk72.bold("Description:"));
|
|
19919
19958
|
lines.push(` ${node.description}
|
|
19920
19959
|
`);
|
|
19921
|
-
lines.push(
|
|
19960
|
+
lines.push(chalk72.bold("Configuration:"));
|
|
19922
19961
|
lines.push(' type: "' + node.type + '"');
|
|
19923
19962
|
lines.push(" config:");
|
|
19924
19963
|
for (const input of node.inputs) {
|
|
19925
|
-
const required = input.required ?
|
|
19964
|
+
const required = input.required ? chalk72.red("*") : " ";
|
|
19926
19965
|
lines.push(` ${input.name} (${input.type})${required}`);
|
|
19927
19966
|
lines.push(` ${input.description}`);
|
|
19928
19967
|
}
|
|
19929
19968
|
lines.push(`
|
|
19930
|
-
${
|
|
19969
|
+
${chalk72.bold("Output:")} ${node.output}`);
|
|
19931
19970
|
if (node.example) {
|
|
19932
|
-
lines.push(
|
|
19971
|
+
lines.push(chalk72.bold(`
|
|
19933
19972
|
Example:`));
|
|
19934
|
-
lines.push(
|
|
19973
|
+
lines.push(chalk72.gray("```yaml"));
|
|
19935
19974
|
lines.push(node.example);
|
|
19936
|
-
lines.push(
|
|
19975
|
+
lines.push(chalk72.gray("```"));
|
|
19937
19976
|
}
|
|
19938
19977
|
return lines.join(`
|
|
19939
19978
|
`);
|
|
@@ -19949,16 +19988,16 @@ var WorkflowNodesCommand = {
|
|
|
19949
19988
|
const nodeType = args.type?.toLowerCase();
|
|
19950
19989
|
if (!nodeType) {
|
|
19951
19990
|
console.log(renderNodeTypesTable(BUILT_IN_NODES));
|
|
19952
|
-
console.log(
|
|
19953
|
-
Use `) +
|
|
19954
|
-
console.log(
|
|
19991
|
+
console.log(chalk72.gray(`
|
|
19992
|
+
Use `) + chalk72.cyan("roy-agent workflow nodes <type>") + chalk72.gray(" for detailed information"));
|
|
19993
|
+
console.log(chalk72.gray("Available types: ") + chalk72.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
|
|
19955
19994
|
return;
|
|
19956
19995
|
}
|
|
19957
19996
|
const node = BUILT_IN_NODES.find((n) => n.type === nodeType);
|
|
19958
19997
|
if (!node) {
|
|
19959
|
-
console.log(
|
|
19998
|
+
console.log(chalk72.red(`
|
|
19960
19999
|
❌ Unknown node type: ${nodeType}`));
|
|
19961
|
-
console.log(
|
|
20000
|
+
console.log(chalk72.gray("Available types: ") + chalk72.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
|
|
19962
20001
|
process.exit(1);
|
|
19963
20002
|
}
|
|
19964
20003
|
console.log(renderNodeDetail(node));
|
|
@@ -19966,7 +20005,7 @@ Use `) + chalk71.cyan("roy-agent workflow nodes <type>") + chalk71.gray(" for de
|
|
|
19966
20005
|
};
|
|
19967
20006
|
|
|
19968
20007
|
// src/commands/workflow/commands/validate.ts
|
|
19969
|
-
import
|
|
20008
|
+
import chalk73 from "chalk";
|
|
19970
20009
|
import { readFileSync } from "fs";
|
|
19971
20010
|
async function parseWorkflowInput(input, yamlStr) {
|
|
19972
20011
|
const parseYaml = async (content) => {
|
|
@@ -19999,25 +20038,25 @@ function renderResult(result, options) {
|
|
|
19999
20038
|
return;
|
|
20000
20039
|
}
|
|
20001
20040
|
if (result.valid) {
|
|
20002
|
-
console.log(
|
|
20041
|
+
console.log(chalk73.green(`
|
|
20003
20042
|
✅ Workflow validation PASSED
|
|
20004
20043
|
`));
|
|
20005
|
-
console.log(
|
|
20044
|
+
console.log(chalk73.bold(`Workflow: ${result.workflowName}`));
|
|
20006
20045
|
console.log(`Nodes: ${result.nodeCount}`);
|
|
20007
20046
|
console.log(`
|
|
20008
20047
|
Valid nodes:`);
|
|
20009
|
-
console.log(
|
|
20048
|
+
console.log(chalk73.green(" ✓ All nodes passed validation"));
|
|
20010
20049
|
} else {
|
|
20011
|
-
console.log(
|
|
20050
|
+
console.log(chalk73.red(`
|
|
20012
20051
|
❌ Workflow validation FAILED (${result.errors.length} errors found)
|
|
20013
20052
|
`));
|
|
20014
20053
|
result.errors.forEach((error, index) => {
|
|
20015
|
-
console.log(
|
|
20016
|
-
console.log(` ${
|
|
20017
|
-
console.log(` ${
|
|
20018
|
-
console.log(` ${
|
|
20019
|
-
console.log(` ${
|
|
20020
|
-
console.log(` ${
|
|
20054
|
+
console.log(chalk73.red(`[Error ${index + 1}/${result.errors.length}]${error.nodeId ? ` Node "${error.nodeId}"` : ""}`));
|
|
20055
|
+
console.log(` ${chalk73.bold("Type:")} ${error.type}`);
|
|
20056
|
+
console.log(` ${chalk73.bold("Description:")} ${error.description}`);
|
|
20057
|
+
console.log(` ${chalk73.bold("Expected:")} ${error.expected}`);
|
|
20058
|
+
console.log(` ${chalk73.bold("Actual:")} ${error.actual}`);
|
|
20059
|
+
console.log(` ${chalk73.green("Fix:")} ${error.fix}`);
|
|
20021
20060
|
console.log();
|
|
20022
20061
|
});
|
|
20023
20062
|
}
|
|
@@ -20042,7 +20081,7 @@ var WorkflowValidateCommand = {
|
|
|
20042
20081
|
try {
|
|
20043
20082
|
const workflow = await parseWorkflowInput(options.input, options.yaml);
|
|
20044
20083
|
if (!workflow) {
|
|
20045
|
-
console.error(
|
|
20084
|
+
console.error(chalk73.red("Failed to parse workflow input"));
|
|
20046
20085
|
process.exit(1);
|
|
20047
20086
|
}
|
|
20048
20087
|
const validator = new WorkflowValidator;
|
|
@@ -20050,7 +20089,7 @@ var WorkflowValidateCommand = {
|
|
|
20050
20089
|
renderResult(result, options);
|
|
20051
20090
|
process.exit(result.valid ? 0 : 1);
|
|
20052
20091
|
} catch (error) {
|
|
20053
|
-
console.error(
|
|
20092
|
+
console.error(chalk73.red(`
|
|
20054
20093
|
Error: ${error.message}`));
|
|
20055
20094
|
process.exit(1);
|
|
20056
20095
|
}
|
|
@@ -20058,7 +20097,7 @@ Error: ${error.message}`));
|
|
|
20058
20097
|
};
|
|
20059
20098
|
|
|
20060
20099
|
// src/commands/workflow/commands/search.ts
|
|
20061
|
-
import
|
|
20100
|
+
import chalk74 from "chalk";
|
|
20062
20101
|
import { wrapFunction as wrapFunction3 } from "@ai-setting/roy-agent-core";
|
|
20063
20102
|
var WorkflowSearchCommand = {
|
|
20064
20103
|
command: "search",
|
|
@@ -20215,22 +20254,22 @@ var _runWorkflowSearchImpl = async function(opts) {
|
|
|
20215
20254
|
metadata: {}
|
|
20216
20255
|
}));
|
|
20217
20256
|
if (renderWorkflows.length === 0) {
|
|
20218
|
-
output.log(
|
|
20219
|
-
output.log(
|
|
20220
|
-
output.log(
|
|
20257
|
+
output.log(chalk74.yellow("\uD83D\uDD0D No workflows matched the search criteria."));
|
|
20258
|
+
output.log(chalk74.gray(` keyword: ${keyword || "(none)"}`));
|
|
20259
|
+
output.log(chalk74.gray(` tags: ${tags && tags.length > 0 ? tags.join(", ") : "(none)"}`));
|
|
20221
20260
|
} else {
|
|
20222
|
-
output.log(
|
|
20261
|
+
output.log(chalk74.bold(`\uD83D\uDD0D Search results (${renderWorkflows.length}):`));
|
|
20223
20262
|
output.log(renderWorkflowList(renderWorkflows));
|
|
20224
|
-
output.log(
|
|
20263
|
+
output.log(chalk74.green(`
|
|
20225
20264
|
✅ Found ${renderWorkflows.length} workflow(s)`));
|
|
20226
20265
|
}
|
|
20227
20266
|
if (availableTags.length > 0) {
|
|
20228
20267
|
output.log("");
|
|
20229
|
-
output.log(
|
|
20268
|
+
output.log(chalk74.bold("\uD83D\uDCDA Available tags (sorted by usage_count):"));
|
|
20230
20269
|
for (const t of availableTags) {
|
|
20231
20270
|
const name = t.name ?? t.tag;
|
|
20232
20271
|
const count = t.count ?? t.usage_count;
|
|
20233
|
-
output.log(
|
|
20272
|
+
output.log(chalk74.gray(` - ${name} (${count})`));
|
|
20234
20273
|
}
|
|
20235
20274
|
}
|
|
20236
20275
|
};
|
|
@@ -20242,7 +20281,7 @@ var runWorkflowSearch = wrapFunction3(_runWorkflowSearchImpl, "workflow.cli.sear
|
|
|
20242
20281
|
|
|
20243
20282
|
// src/commands/workflow/commands/tag.ts
|
|
20244
20283
|
import { wrapFunction as wrapFunction4 } from "@ai-setting/roy-agent-core";
|
|
20245
|
-
import
|
|
20284
|
+
import chalk75 from "chalk";
|
|
20246
20285
|
var WorkflowTagListCommand = {
|
|
20247
20286
|
command: "list",
|
|
20248
20287
|
describe: "List all workflow tags from the workflow_tags table (sorted by usage_count DESC by default). Use this BEFORE `workflow add` to discover existing tags and reuse them for semantic consistency.",
|
|
@@ -20363,17 +20402,17 @@ var _runWorkflowTagListImpl = async function(opts) {
|
|
|
20363
20402
|
return;
|
|
20364
20403
|
}
|
|
20365
20404
|
if (result.tags.length === 0) {
|
|
20366
|
-
output.log(
|
|
20367
|
-
output.log(
|
|
20405
|
+
output.log(chalk75.yellow("\uD83C\uDFF7️ No tags in the workflow_tags table yet."));
|
|
20406
|
+
output.log(chalk75.gray(" Tags are created automatically when you run `workflow add --tags <name>`."));
|
|
20368
20407
|
return;
|
|
20369
20408
|
}
|
|
20370
|
-
output.log(
|
|
20371
|
-
output.log(
|
|
20409
|
+
output.log(chalk75.bold(`\uD83C\uDFF7️ Workflow tags (${result.total}):`));
|
|
20410
|
+
output.log(chalk75.gray(` ${padRight("NAME", 24)}${padRight("USAGE", 8)}${padRight("CREATED", 22)}`));
|
|
20372
20411
|
for (const t of result.tags) {
|
|
20373
20412
|
const line = ` ${padRight(t.name, 24)}${padRight(String(t.usage_count), 8)}${padRight(formatDate2(t.created_at), 22)}`;
|
|
20374
20413
|
output.log(line);
|
|
20375
20414
|
}
|
|
20376
|
-
output.log(
|
|
20415
|
+
output.log(chalk75.gray(`
|
|
20377
20416
|
\uD83D\uDCA1 Tip: when adding a new workflow, prefer tags from this list to ensure semantic consistency.`));
|
|
20378
20417
|
};
|
|
20379
20418
|
var _runWorkflowTagGetImpl = async function(opts) {
|
|
@@ -20400,7 +20439,7 @@ var _runWorkflowTagGetImpl = async function(opts) {
|
|
|
20400
20439
|
output.json({ error: "Tag not found", name: opts.name });
|
|
20401
20440
|
} else {
|
|
20402
20441
|
output.error(`Tag "${opts.name}" not found in the workflow_tags table.`);
|
|
20403
|
-
output.log(
|
|
20442
|
+
output.log(chalk75.gray(`Tip: run \`roy-agent workflow tag list\` to see available tags.`));
|
|
20404
20443
|
}
|
|
20405
20444
|
process.exitCode = 1;
|
|
20406
20445
|
return;
|
|
@@ -20409,10 +20448,10 @@ var _runWorkflowTagGetImpl = async function(opts) {
|
|
|
20409
20448
|
output.json(tag);
|
|
20410
20449
|
return;
|
|
20411
20450
|
}
|
|
20412
|
-
output.log(
|
|
20413
|
-
output.log(
|
|
20414
|
-
output.log(
|
|
20415
|
-
output.log(
|
|
20451
|
+
output.log(chalk75.bold(`\uD83C\uDFF7️ Tag: ${tag.name}`));
|
|
20452
|
+
output.log(chalk75.gray(` usage_count: ${tag.usage_count}`));
|
|
20453
|
+
output.log(chalk75.gray(` created_at: ${tag.created_at}`));
|
|
20454
|
+
output.log(chalk75.gray(` updated_at: ${tag.updated_at}`));
|
|
20416
20455
|
};
|
|
20417
20456
|
async function callListTags(service, options) {
|
|
20418
20457
|
if (typeof service.listTags !== "function") {
|