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