@ai-setting/roy-agent-cli 1.5.105 → 1.5.107

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.
@@ -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.105",
7430
+ version: "1.5.107",
7431
7431
  type: "module",
7432
7432
  description: "CLI for roy-agent - Non-interactive command execution",
7433
7433
  main: "./dist/index.js",
@@ -16625,15 +16625,42 @@ var EventSourceListCommand = {
16625
16625
  };
16626
16626
 
16627
16627
  // src/commands/eventsource/add.ts
16628
- import chalk56 from "chalk";
16628
+ import chalk57 from "chalk";
16629
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
16630
16657
  function uuid() {
16631
16658
  return generateId();
16632
16659
  }
16633
16660
  var EventSourceAddCommand = {
16634
16661
  command: "add <name> <type>",
16635
16662
  describe: "添加新的事件源",
16636
- builder: (yargs) => yargs.positional("name", {
16663
+ builder: (yargs) => addServerUrlOption(yargs.positional("name", {
16637
16664
  describe: "事件源名称",
16638
16665
  type: "string",
16639
16666
  demandOption: true
@@ -16666,9 +16693,6 @@ var EventSourceAddCommand = {
16666
16693
  }).option("address", {
16667
16694
  describe: "Agent IM 地址(bounty-im 类型用,格式:agent-id@host)",
16668
16695
  type: "string"
16669
- }).option("im-server-url", {
16670
- describe: "IM Server WebSocket URL(bounty-im 类型用,如 ws://localhost:4005/ws)",
16671
- type: "string"
16672
16696
  }).option("tls-skip-verify", {
16673
16697
  describe: "跳过 TLS 证书校验(bounty-im 类型用,wss:// 自签名场景,生产环境不推荐)",
16674
16698
  type: "boolean",
@@ -16676,7 +16700,7 @@ var EventSourceAddCommand = {
16676
16700
  }).option("prompt", {
16677
16701
  describe: "自定义 prompt 消息(timer 类型,替换默认 SelfReminder 内容)",
16678
16702
  type: "string"
16679
- }),
16703
+ })),
16680
16704
  async handler(args) {
16681
16705
  const a = args;
16682
16706
  const output = new OutputService2;
@@ -16694,6 +16718,9 @@ var EventSourceAddCommand = {
16694
16718
  process.exit(1);
16695
16719
  }
16696
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);
16697
16724
  const config = {
16698
16725
  id: uuid(),
16699
16726
  name: a.name,
@@ -16706,41 +16733,44 @@ var EventSourceAddCommand = {
16706
16733
  cron: a.cron,
16707
16734
  profile: a.profile,
16708
16735
  address: a.address,
16709
- imServerUrl: a.imServerUrl,
16736
+ imServerUrl: resolvedServerUrl,
16710
16737
  tlsSkipVerify: a.tlsSkipVerify === true,
16711
16738
  options: a.prompt ? { prompt: a.prompt } : undefined
16712
16739
  };
16713
16740
  esComponent.register(config);
16714
- output.success(chalk56.green(`事件源 '${a.name}' 添加成功!`));
16741
+ output.success(chalk57.green(`事件源 '${a.name}' 添加成功!`));
16715
16742
  output.log("");
16716
- output.log(` ID: ${chalk56.gray(config.id)}`);
16717
- output.log(` Type: ${chalk56.cyan(a.type)}`);
16743
+ output.log(` ID: ${chalk57.gray(config.id)}`);
16744
+ output.log(` Type: ${chalk57.cyan(a.type)}`);
16718
16745
  if (eventTypes?.length) {
16719
- output.log(` Event Types: ${chalk56.gray(eventTypes.join(", "))}`);
16746
+ output.log(` Event Types: ${chalk57.gray(eventTypes.join(", "))}`);
16720
16747
  }
16721
16748
  if (a.command) {
16722
- output.log(` Command: ${chalk56.gray(a.command)}`);
16749
+ output.log(` Command: ${chalk57.gray(a.command)}`);
16723
16750
  }
16724
16751
  if (a.interval) {
16725
- output.log(` Interval: ${chalk56.gray(`${a.interval}ms`)}`);
16752
+ output.log(` Interval: ${chalk57.gray(`${a.interval}ms`)}`);
16726
16753
  }
16727
16754
  if (a.profile) {
16728
- output.log(` Profile: ${chalk56.gray(a.profile)}`);
16755
+ output.log(` Profile: ${chalk57.gray(a.profile)}`);
16729
16756
  }
16730
16757
  if (a.address) {
16731
- output.log(` Address: ${chalk56.gray(a.address)}`);
16758
+ output.log(` Address: ${chalk57.gray(a.address)}`);
16732
16759
  }
16733
16760
  if (a.imServerUrl) {
16734
- output.log(` IM Server URL: ${chalk56.gray(a.imServerUrl)}`);
16761
+ output.log(` IM Server URL: ${chalk57.gray(a.imServerUrl)}`);
16762
+ }
16763
+ if (resolvedServerUrl) {
16764
+ output.log(` Server URL: ${chalk57.gray(resolvedServerUrl)}`);
16735
16765
  }
16736
16766
  if (a.tlsSkipVerify) {
16737
- output.log(` TLS Skip Verify: ${chalk56.yellow("⚠ true (自签名场景)")}`);
16767
+ output.log(` TLS Skip Verify: ${chalk57.yellow("⚠ true (自签名场景)")}`);
16738
16768
  }
16739
16769
  if (a.prompt) {
16740
- output.log(` Prompt: ${chalk56.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
16770
+ output.log(` Prompt: ${chalk57.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
16741
16771
  }
16742
16772
  output.log("");
16743
- output.log(chalk56.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
16773
+ output.log(chalk57.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
16744
16774
  } finally {
16745
16775
  await envService.dispose();
16746
16776
  }
@@ -16748,7 +16778,7 @@ var EventSourceAddCommand = {
16748
16778
  };
16749
16779
 
16750
16780
  // src/commands/eventsource/update.ts
16751
- import chalk57 from "chalk";
16781
+ import chalk58 from "chalk";
16752
16782
  function findSource(esComponent, id) {
16753
16783
  const sources = esComponent.list();
16754
16784
  const matched = sources.find((s) => s.id === id || s.id.startsWith(id));
@@ -16759,7 +16789,7 @@ function findSource(esComponent, id) {
16759
16789
  var EventSourceUpdateCommand = {
16760
16790
  command: "update <id>",
16761
16791
  describe: "更新事件源配置(部分更新,type 不可改)",
16762
- builder: (yargs) => yargs.positional("id", {
16792
+ builder: (yargs) => addServerUrlOption(yargs.positional("id", {
16763
16793
  describe: "事件源 ID(支持前缀匹配)",
16764
16794
  type: "string",
16765
16795
  demandOption: true
@@ -16794,13 +16824,10 @@ var EventSourceUpdateCommand = {
16794
16824
  }).option("address", {
16795
16825
  describe: "Agent IM 地址(bounty-im 类型用,格式:agent-id@host)",
16796
16826
  type: "string"
16797
- }).option("im-server-url", {
16798
- describe: "IM Server WebSocket URL(bounty-im 类型用,如 ws://localhost:4005/ws)",
16799
- type: "string"
16800
16827
  }).option("tls-skip-verify", {
16801
16828
  describe: "跳过 TLS 证书校验(bounty-im 类型用,wss:// 自签名场景,生产环境不推荐)",
16802
16829
  type: "boolean"
16803
- }),
16830
+ })),
16804
16831
  async handler(args) {
16805
16832
  const a = args;
16806
16833
  const output = new OutputService2;
@@ -16823,7 +16850,7 @@ var EventSourceUpdateCommand = {
16823
16850
  const all = esComponent.list();
16824
16851
  if (all.length > 0) {
16825
16852
  output.info("");
16826
- output.info(chalk57.gray("可用的事件源:"));
16853
+ output.info(chalk58.gray("可用的事件源:"));
16827
16854
  for (const s of all) {
16828
16855
  output.info(` - ${s.id.substring(0, 8)}: ${s.name} (${s.type})`);
16829
16856
  }
@@ -16848,8 +16875,11 @@ var EventSourceUpdateCommand = {
16848
16875
  partial.enabled = a.enabled;
16849
16876
  if (a.address !== undefined)
16850
16877
  partial.address = a.address;
16851
- if (a.imServerUrl !== undefined)
16852
- partial.imServerUrl = a.imServerUrl;
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
+ }
16853
16883
  if (a.tlsSkipVerify !== undefined)
16854
16884
  partial.tlsSkipVerify = a.tlsSkipVerify === true;
16855
16885
  if (a.prompt !== undefined) {
@@ -16862,19 +16892,19 @@ var EventSourceUpdateCommand = {
16862
16892
  }
16863
16893
  try {
16864
16894
  const result = await esComponent.update(match.fullId, partial);
16865
- output.success(chalk57.green(`✅ 事件源已更新: ${match.source.name}`));
16895
+ output.success(chalk58.green(`✅ 事件源已更新: ${match.source.name}`));
16866
16896
  output.log("");
16867
- output.log(chalk57.bold("修改字段:"));
16897
+ output.log(chalk58.bold("修改字段:"));
16868
16898
  const before = match.source;
16869
16899
  const after = result.updated;
16870
16900
  for (const field of result.fields) {
16871
16901
  const beforeVal = JSON.stringify(before[field] ?? before.options?.[field]);
16872
16902
  const afterVal = JSON.stringify(after[field] ?? after.options?.[field]);
16873
- output.log(` ${chalk57.cyan(field)}: ${chalk57.gray(beforeVal)} ${chalk57.gray("→")} ${chalk57.green(afterVal)}`);
16903
+ output.log(` ${chalk58.cyan(field)}: ${chalk58.gray(beforeVal)} ${chalk58.gray("→")} ${chalk58.green(afterVal)}`);
16874
16904
  }
16875
16905
  output.log("");
16876
16906
  if (result.wasRunning) {
16877
- output.info(chalk57.yellow(`⚠️ 事件源在更新前正在运行,已自动停止。请使用 'roy-agent eventsource start ${match.fullId.substring(0, 8)}' 手动启动以应用新配置。`));
16907
+ output.info(chalk58.yellow(`⚠️ 事件源在更新前正在运行,已自动停止。请使用 'roy-agent eventsource start ${match.fullId.substring(0, 8)}' 手动启动以应用新配置。`));
16878
16908
  }
16879
16909
  } catch (error) {
16880
16910
  output.error(`❌ 更新失败: ${error instanceof Error ? error.message : String(error)}`);
@@ -16887,7 +16917,7 @@ var EventSourceUpdateCommand = {
16887
16917
  };
16888
16918
 
16889
16919
  // src/commands/eventsource/remove.ts
16890
- import chalk58 from "chalk";
16920
+ import chalk59 from "chalk";
16891
16921
  var EventSourceRemoveCommand = {
16892
16922
  command: "remove <id>",
16893
16923
  aliases: ["rm"],
@@ -16926,7 +16956,7 @@ var EventSourceRemoveCommand = {
16926
16956
  const status = esComponent.getStatus(matchedSource.id);
16927
16957
  if (status === "running" && !args.force) {
16928
16958
  output.error(`事件源正在运行中,请先停止: ${matchedSource.name} (${status})`);
16929
- output.log(chalk58.gray(`使用 --force 强制移除或 'roy-agent eventsource stop ${matchedSource.id.substring(0, 8)}' 先停止`));
16959
+ output.log(chalk59.gray(`使用 --force 强制移除或 'roy-agent eventsource stop ${matchedSource.id.substring(0, 8)}' 先停止`));
16930
16960
  process.exit(1);
16931
16961
  }
16932
16962
  if (status === "running") {
@@ -16935,7 +16965,7 @@ var EventSourceRemoveCommand = {
16935
16965
  }
16936
16966
  const result = esComponent.unregister(matchedSource.id);
16937
16967
  if (result) {
16938
- output.success(chalk58.green(`事件源已移除: ${matchedSource.name}`));
16968
+ output.success(chalk59.green(`事件源已移除: ${matchedSource.name}`));
16939
16969
  } else {
16940
16970
  output.error("移除失败");
16941
16971
  process.exit(1);
@@ -16947,7 +16977,7 @@ var EventSourceRemoveCommand = {
16947
16977
  };
16948
16978
 
16949
16979
  // src/commands/eventsource/start.ts
16950
- import chalk59 from "chalk";
16980
+ import chalk60 from "chalk";
16951
16981
  var EventSourceStartCommand = {
16952
16982
  command: "start <id>",
16953
16983
  describe: "启动指定的事件源",
@@ -16984,15 +17014,15 @@ var EventSourceStartCommand = {
16984
17014
  }
16985
17015
  const status = esComponent.getStatus(matchedSource.id);
16986
17016
  if (status === "running") {
16987
- output.log(chalk59.yellow(`事件源已在运行: ${matchedSource.name}`));
17017
+ output.log(chalk60.yellow(`事件源已在运行: ${matchedSource.name}`));
16988
17018
  return;
16989
17019
  }
16990
17020
  output.info(`正在启动事件源 '${matchedSource.name}'...`);
16991
17021
  try {
16992
17022
  await esComponent.startSource(matchedSource.id);
16993
- output.success(chalk59.green(`事件源已启动: ${matchedSource.name}`));
17023
+ output.success(chalk60.green(`事件源已启动: ${matchedSource.name}`));
16994
17024
  if (!args.background) {
16995
- output.log(chalk59.gray("按 Ctrl+C 停止..."));
17025
+ output.log(chalk60.gray("按 Ctrl+C 停止..."));
16996
17026
  await new Promise((resolve) => {
16997
17027
  const cleanup = () => {
16998
17028
  process.removeListener("SIGINT", cleanup);
@@ -17014,7 +17044,7 @@ var EventSourceStartCommand = {
17014
17044
  };
17015
17045
 
17016
17046
  // src/commands/eventsource/stop.ts
17017
- import chalk60 from "chalk";
17047
+ import chalk61 from "chalk";
17018
17048
  var EventSourceStopCommand = {
17019
17049
  command: "stop <id>",
17020
17050
  aliases: ["kill"],
@@ -17052,13 +17082,13 @@ var EventSourceStopCommand = {
17052
17082
  }
17053
17083
  const status = esComponent.getStatus(matchedSource.id);
17054
17084
  if (status !== "running") {
17055
- output.log(chalk60.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
17085
+ output.log(chalk61.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
17056
17086
  return;
17057
17087
  }
17058
17088
  output.info(`正在停止事件源 '${matchedSource.name}'...`);
17059
17089
  try {
17060
17090
  await esComponent.stopSource(matchedSource.id);
17061
- output.success(chalk60.green(`事件源已停止: ${matchedSource.name}`));
17091
+ output.success(chalk61.green(`事件源已停止: ${matchedSource.name}`));
17062
17092
  } catch (error) {
17063
17093
  output.error(`停止失败: ${error}`);
17064
17094
  process.exit(1);
@@ -17070,14 +17100,14 @@ var EventSourceStopCommand = {
17070
17100
  };
17071
17101
 
17072
17102
  // src/commands/eventsource/status.ts
17073
- import chalk61 from "chalk";
17103
+ import chalk62 from "chalk";
17074
17104
  var STATUS_COLORS = {
17075
- created: chalk61.gray,
17076
- starting: chalk61.yellow,
17077
- running: chalk61.green,
17078
- stopping: chalk61.yellow,
17079
- stopped: chalk61.gray,
17080
- error: chalk61.red
17105
+ created: chalk62.gray,
17106
+ starting: chalk62.yellow,
17107
+ running: chalk62.green,
17108
+ stopping: chalk62.yellow,
17109
+ stopped: chalk62.gray,
17110
+ error: chalk62.red
17081
17111
  };
17082
17112
  var STATUS_ICONS = {
17083
17113
  created: "○",
@@ -17131,7 +17161,7 @@ var EventSourceStatusCommand = {
17131
17161
  process.exit(1);
17132
17162
  }
17133
17163
  const status = esComponent.getStatus(matchedSource.id) || "unknown";
17134
- const statusColor = STATUS_COLORS[status] || chalk61.gray;
17164
+ const statusColor = STATUS_COLORS[status] || chalk62.gray;
17135
17165
  if (args.json) {
17136
17166
  output.json({
17137
17167
  id: matchedSource.id,
@@ -17148,31 +17178,31 @@ var EventSourceStatusCommand = {
17148
17178
  });
17149
17179
  return;
17150
17180
  }
17151
- output.log(chalk61.bold("事件源详情"));
17181
+ output.log(chalk62.bold("事件源详情"));
17152
17182
  output.log("─".repeat(50));
17153
- output.log(` ID: ${chalk61.gray(matchedSource.id)}`);
17154
- output.log(` Name: ${chalk61.cyan(matchedSource.name)}`);
17155
- output.log(` Type: ${chalk61.cyan(matchedSource.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)}`);
17156
17186
  output.log(` Status: ${statusColor(`${STATUS_ICONS[status]} ${STATUS_LABELS[status]}`)}`);
17157
- output.log(` Enabled: ${matchedSource.enabled ? chalk61.green("是") : chalk61.gray("否")}`);
17187
+ output.log(` Enabled: ${matchedSource.enabled ? chalk62.green("是") : chalk62.gray("否")}`);
17158
17188
  if (matchedSource.eventTypes?.length) {
17159
- output.log(` Events: ${chalk61.gray(matchedSource.eventTypes.join(", "))}`);
17189
+ output.log(` Events: ${chalk62.gray(matchedSource.eventTypes.join(", "))}`);
17160
17190
  }
17161
17191
  if (matchedSource.command) {
17162
- output.log(` Command: ${chalk61.gray(matchedSource.command)}`);
17192
+ output.log(` Command: ${chalk62.gray(matchedSource.command)}`);
17163
17193
  }
17164
17194
  if (matchedSource.interval) {
17165
- output.log(` Interval: ${chalk61.gray(`${matchedSource.interval}ms`)}`);
17195
+ output.log(` Interval: ${chalk62.gray(`${matchedSource.interval}ms`)}`);
17166
17196
  }
17167
17197
  if (matchedSource.url) {
17168
- output.log(` URL: ${chalk61.gray(matchedSource.url)}`);
17198
+ output.log(` URL: ${chalk62.gray(matchedSource.url)}`);
17169
17199
  }
17170
17200
  output.log("");
17171
17201
  return;
17172
17202
  }
17173
17203
  const sources = esComponent.list();
17174
17204
  if (sources.length === 0) {
17175
- output.log(chalk61.yellow("没有配置的事件源"));
17205
+ output.log(chalk62.yellow("没有配置的事件源"));
17176
17206
  return;
17177
17207
  }
17178
17208
  if (args.json) {
@@ -17186,21 +17216,21 @@ var EventSourceStatusCommand = {
17186
17216
  output.json({ sources: sourcesWithStatus, count: sources.length });
17187
17217
  return;
17188
17218
  }
17189
- output.log(chalk61.bold("事件源状态概览"));
17219
+ output.log(chalk62.bold("事件源状态概览"));
17190
17220
  output.log("─".repeat(60));
17191
17221
  for (const source of sources) {
17192
17222
  const status = esComponent.getStatus(source.id) || "unknown";
17193
- const statusColor = STATUS_COLORS[status] || chalk61.gray;
17223
+ const statusColor = STATUS_COLORS[status] || chalk62.gray;
17194
17224
  const icon = STATUS_ICONS[status] || "?";
17195
17225
  const label = STATUS_LABELS[status] || status;
17196
17226
  output.log("");
17197
- output.log(` ${chalk61.cyan(source.name)} ${chalk61.gray(`(${source.type})`)}`);
17227
+ output.log(` ${chalk62.cyan(source.name)} ${chalk62.gray(`(${source.type})`)}`);
17198
17228
  output.log(` └─ Status: ${statusColor(`${icon} ${label}`)}`);
17199
- output.log(` ID: ${chalk61.gray(source.id.substring(0, 8))}...`);
17229
+ output.log(` ID: ${chalk62.gray(source.id.substring(0, 8))}...`);
17200
17230
  }
17201
17231
  output.log("");
17202
17232
  const runningCount = sources.filter((s) => esComponent.getStatus(s.id) === "running").length;
17203
- output.log(chalk61.green(`✅ ${runningCount}/${sources.length} 运行中`));
17233
+ output.log(chalk62.green(`✅ ${runningCount}/${sources.length} 运行中`));
17204
17234
  } finally {
17205
17235
  await envService.dispose();
17206
17236
  }
@@ -17513,7 +17543,7 @@ var DebugCommand = {
17513
17543
  };
17514
17544
 
17515
17545
  // src/commands/workflow/renderers.ts
17516
- import chalk62 from "chalk";
17546
+ import chalk63 from "chalk";
17517
17547
  function truncateVisual3(str, maxWidth) {
17518
17548
  if (!str)
17519
17549
  return "-";
@@ -17548,18 +17578,18 @@ function formatDuration(ms) {
17548
17578
  function statusColor(status) {
17549
17579
  switch (status) {
17550
17580
  case "completed":
17551
- return chalk62.green;
17581
+ return chalk63.green;
17552
17582
  case "running":
17553
17583
  case "idle":
17554
- return chalk62.blue;
17584
+ return chalk63.blue;
17555
17585
  case "paused":
17556
- return chalk62.yellow;
17586
+ return chalk63.yellow;
17557
17587
  case "failed":
17558
- return chalk62.red;
17588
+ return chalk63.red;
17559
17589
  case "stopped":
17560
- return chalk62.gray;
17590
+ return chalk63.gray;
17561
17591
  default:
17562
- return chalk62.white;
17592
+ return chalk63.white;
17563
17593
  }
17564
17594
  }
17565
17595
  function renderWorkflowList(workflows, options) {
@@ -17578,7 +17608,7 @@ function renderWorkflowList(workflows, options) {
17578
17608
  }, null, 2);
17579
17609
  }
17580
17610
  if (workflows.length === 0) {
17581
- return chalk62.yellow("No workflows found");
17611
+ return chalk63.yellow("No workflows found");
17582
17612
  }
17583
17613
  const NAME_WIDTH = 30;
17584
17614
  const VERSION_WIDTH = 10;
@@ -17586,10 +17616,10 @@ function renderWorkflowList(workflows, options) {
17586
17616
  const UPDATED_WIDTH = 20;
17587
17617
  const GAP = " ";
17588
17618
  const headerLine = [
17589
- chalk62.bold("NAME".padEnd(NAME_WIDTH)),
17590
- chalk62.bold("VER".padEnd(VERSION_WIDTH)),
17591
- chalk62.bold("TAGS".padEnd(TAGS_WIDTH)),
17592
- chalk62.bold("UPDATED")
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")
17593
17623
  ].join(GAP);
17594
17624
  const sepLine = "─".repeat(NAME_WIDTH + VERSION_WIDTH + TAGS_WIDTH + UPDATED_WIDTH + GAP.length * 3);
17595
17625
  const rows = workflows.map((w) => {
@@ -17604,18 +17634,18 @@ function renderWorkflowList(workflows, options) {
17604
17634
  }
17605
17635
  function renderWorkflowDetail(workflow, options) {
17606
17636
  const lines = [];
17607
- lines.push(chalk62.bold(`
17637
+ lines.push(chalk63.bold(`
17608
17638
  \uD83D\uDCCB Workflow Details
17609
17639
  `));
17610
- lines.push(` ${chalk62.cyan("ID:")} ${workflow.id}`);
17611
- lines.push(` ${chalk62.cyan("Name:")} ${workflow.name}`);
17612
- lines.push(` ${chalk62.cyan("Version:")} ${workflow.version}`);
17613
- lines.push(` ${chalk62.cyan("Description:")} ${workflow.description || "-"}`);
17614
- lines.push(` ${chalk62.cyan("Tags:")} ${workflow.tags.join(", ") || "-"}`);
17615
- lines.push(` ${chalk62.cyan("Created:")} ${formatDate(workflow.createdAt)}`);
17616
- lines.push(` ${chalk62.cyan("Updated:")} ${formatDate(workflow.updatedAt)}`);
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)}`);
17617
17647
  const nodeCount = workflow.definition.nodes.length;
17618
- lines.push(chalk62.bold(`
17648
+ lines.push(chalk63.bold(`
17619
17649
  \uD83D\uDCCA Nodes Summary
17620
17650
  `));
17621
17651
  lines.push(` Total: ${nodeCount} nodes`);
@@ -17627,7 +17657,7 @@ function renderWorkflowDetail(workflow, options) {
17627
17657
  lines.push(` - ${type}: ${count}`);
17628
17658
  }
17629
17659
  if (workflow.definition.config) {
17630
- lines.push(chalk62.bold(`
17660
+ lines.push(chalk63.bold(`
17631
17661
  ⚙️ Configuration
17632
17662
  `));
17633
17663
  if (workflow.definition.config.parallel_limit !== undefined) {
@@ -17641,7 +17671,7 @@ function renderWorkflowDetail(workflow, options) {
17641
17671
  }
17642
17672
  }
17643
17673
  if (options?.includeRuns && options.includeRuns.length > 0) {
17644
- lines.push(chalk62.bold(`
17674
+ lines.push(chalk63.bold(`
17645
17675
  \uD83D\uDCDC Recent Runs
17646
17676
  `));
17647
17677
  lines.push(renderRunsList(options.includeRuns.slice(0, 5)));
@@ -17665,7 +17695,7 @@ function renderRunsList(runs, options) {
17665
17695
  }, null, 2);
17666
17696
  }
17667
17697
  if (runs.length === 0) {
17668
- return chalk62.yellow("No runs found");
17698
+ return chalk63.yellow("No runs found");
17669
17699
  }
17670
17700
  const ID_WIDTH = 20;
17671
17701
  const STATUS_WIDTH = 12;
@@ -17673,10 +17703,10 @@ function renderRunsList(runs, options) {
17673
17703
  const UPDATED_WIDTH = 20;
17674
17704
  const GAP = " ";
17675
17705
  const headerLine = [
17676
- chalk62.bold("RUN ID".padEnd(ID_WIDTH)),
17677
- chalk62.bold("STATUS".padEnd(STATUS_WIDTH)),
17678
- chalk62.bold("DURATION".padEnd(DURATION_WIDTH)),
17679
- chalk62.bold("STARTED")
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")
17680
17710
  ].join(GAP);
17681
17711
  const sepLine = "─".repeat(ID_WIDTH + STATUS_WIDTH + DURATION_WIDTH + UPDATED_WIDTH + GAP.length * 3);
17682
17712
  const rows = runs.map((r) => {
@@ -17691,34 +17721,34 @@ function renderRunsList(runs, options) {
17691
17721
  }
17692
17722
  function renderRunDetail(run) {
17693
17723
  const lines = [];
17694
- lines.push(chalk62.bold(`
17724
+ lines.push(chalk63.bold(`
17695
17725
  \uD83C\uDFC3 Run Details
17696
17726
  `));
17697
- lines.push(` ${chalk62.cyan("Run ID:")} ${run.id}`);
17698
- lines.push(` ${chalk62.cyan("Workflow:")} ${run.workflowId}`);
17699
- lines.push(` ${chalk62.cyan("Status:")} ${statusColor(run.status)(run.status)}`);
17700
- lines.push(` ${chalk62.cyan("Started:")} ${formatDate(run.startedAt)}`);
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)}`);
17701
17731
  if (run.pausedAt) {
17702
- lines.push(` ${chalk62.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
17732
+ lines.push(` ${chalk63.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
17703
17733
  }
17704
17734
  if (run.resumedAt) {
17705
- lines.push(` ${chalk62.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
17735
+ lines.push(` ${chalk63.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
17706
17736
  }
17707
17737
  if (run.stoppedAt) {
17708
- lines.push(` ${chalk62.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
17738
+ lines.push(` ${chalk63.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
17709
17739
  }
17710
17740
  if (run.completedAt) {
17711
- lines.push(` ${chalk62.cyan("Completed:")} ${formatDate(run.completedAt)}`);
17741
+ lines.push(` ${chalk63.cyan("Completed:")} ${formatDate(run.completedAt)}`);
17712
17742
  }
17713
- lines.push(` ${chalk62.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
17743
+ lines.push(` ${chalk63.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
17714
17744
  if (run.error) {
17715
- lines.push(chalk62.bold(`
17745
+ lines.push(chalk63.bold(`
17716
17746
  ❌ Error
17717
17747
  `));
17718
- lines.push(` ${chalk62.red(run.error)}`);
17748
+ lines.push(` ${chalk63.red(run.error)}`);
17719
17749
  }
17720
17750
  if (run.output) {
17721
- lines.push(chalk62.bold(`
17751
+ lines.push(chalk63.bold(`
17722
17752
  \uD83D\uDCE4 Output
17723
17753
  `));
17724
17754
  lines.push(" " + JSON.stringify(run.output, null, 2).split(`
@@ -17729,36 +17759,36 @@ function renderRunDetail(run) {
17729
17759
  `);
17730
17760
  }
17731
17761
  function renderWorkflowAdded(workflow) {
17732
- return chalk62.green(`
17762
+ return chalk63.green(`
17733
17763
  ✅ Workflow '${workflow.name}' added successfully
17734
17764
  `) + ` ID: ${workflow.id}
17735
17765
  ` + ` Version: ${workflow.version}
17736
17766
  `;
17737
17767
  }
17738
17768
  function renderWorkflowUpdated(workflow) {
17739
- return chalk62.green(`
17769
+ return chalk63.green(`
17740
17770
  ✅ Workflow '${workflow.name}' updated successfully
17741
17771
  `) + ` ID: ${workflow.id}
17742
17772
  `;
17743
17773
  }
17744
17774
  function renderWorkflowDeleted(name) {
17745
- return chalk62.green(`
17775
+ return chalk63.green(`
17746
17776
  ✅ Workflow '${name}' deleted successfully
17747
17777
  `);
17748
17778
  }
17749
17779
  function renderRunResult(result) {
17750
17780
  const lines = [];
17751
17781
  if (result.status === "completed") {
17752
- lines.push(chalk62.green(`
17782
+ lines.push(chalk63.green(`
17753
17783
  ✅ Workflow completed successfully`));
17754
17784
  } else if (result.status === "failed") {
17755
- lines.push(chalk62.red(`
17785
+ lines.push(chalk63.red(`
17756
17786
  ❌ Workflow failed`));
17757
17787
  } else if (result.status === "stopped") {
17758
- lines.push(chalk62.yellow(`
17788
+ lines.push(chalk63.yellow(`
17759
17789
  ⚠️ Workflow stopped`));
17760
17790
  } else {
17761
- lines.push(chalk62.blue(`
17791
+ lines.push(chalk63.blue(`
17762
17792
  \uD83D\uDD04 Workflow ${result.status}`));
17763
17793
  }
17764
17794
  lines.push(` Run ID: ${result.runId}`);
@@ -17766,11 +17796,11 @@ function renderRunResult(result) {
17766
17796
  lines.push(` Duration: ${formatDuration(result.durationMs)}`);
17767
17797
  }
17768
17798
  if (result.error) {
17769
- lines.push(chalk62.red(`
17799
+ lines.push(chalk63.red(`
17770
17800
  Error: ${result.error}`));
17771
17801
  }
17772
17802
  if (result.output) {
17773
- lines.push(chalk62.bold(`
17803
+ lines.push(chalk63.bold(`
17774
17804
  \uD83D\uDCE4 Output:`));
17775
17805
  lines.push(JSON.stringify(result.output, null, 2));
17776
17806
  }
@@ -17784,10 +17814,10 @@ function renderNodesList(nodes) {
17784
17814
  const DEPS_WIDTH = 20;
17785
17815
  const GAP = " ";
17786
17816
  const headerLine = [
17787
- chalk62.bold("NODE ID".padEnd(ID_WIDTH)),
17788
- chalk62.bold("TYPE".padEnd(TYPE_WIDTH)),
17789
- chalk62.bold("NAME".padEnd(NAME_WIDTH)),
17790
- chalk62.bold("DEPENDS ON")
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")
17791
17821
  ].join(GAP);
17792
17822
  const sepLine = "─".repeat(ID_WIDTH + TYPE_WIDTH + NAME_WIDTH + DEPS_WIDTH + GAP.length * 3);
17793
17823
  const rows = nodes.map((n) => {
@@ -17802,7 +17832,7 @@ function renderNodesList(nodes) {
17802
17832
  }
17803
17833
 
17804
17834
  // src/commands/workflow/commands/list.ts
17805
- import chalk63 from "chalk";
17835
+ import chalk64 from "chalk";
17806
17836
  import { createWorkflowListTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
17807
17837
  function buildListWorkflowsJson(workflows, total, args, availableTags) {
17808
17838
  const output = {
@@ -17950,20 +17980,20 @@ var WorkflowListCommand = {
17950
17980
  if (total > workflows.length) {
17951
17981
  const start = finalOffset + 1;
17952
17982
  const end = finalOffset + workflows.length;
17953
- output.log(chalk63.green(`
17983
+ output.log(chalk64.green(`
17954
17984
  ✅ 显示 ${start}-${end} / 共 ${total} 个 Workflow`));
17955
17985
  const totalPages = Math.ceil(total / pageSize);
17956
17986
  const currentPage = Math.floor(finalOffset / pageSize) + 1;
17957
17987
  if (totalPages > 1) {
17958
- output.log(chalk63.cyan(`\uD83D\uDCC4 第 ${currentPage} / ${totalPages} 页`));
17988
+ output.log(chalk64.cyan(`\uD83D\uDCC4 第 ${currentPage} / ${totalPages} 页`));
17959
17989
  }
17960
17990
  } else {
17961
- output.log(chalk63.green(`
17991
+ output.log(chalk64.green(`
17962
17992
  ✅ 共 ${total} 个 Workflow`));
17963
17993
  }
17964
17994
  if (availableTags.length > 0) {
17965
17995
  const tagsLine = availableTags.map((t) => `${t.name}(${t.count})`).join(", ");
17966
- output.log(chalk63.cyan(`
17996
+ output.log(chalk64.cyan(`
17967
17997
  \uD83C\uDFF7️ Available tags: ${tagsLine}`));
17968
17998
  }
17969
17999
  }
@@ -18567,7 +18597,7 @@ class WorkflowValidator {
18567
18597
 
18568
18598
  // src/commands/workflow/commands/add.ts
18569
18599
  import { validateWorkflowDefinition } from "@ai-setting/roy-agent-core/env/workflow/utils";
18570
- import chalk64 from "chalk";
18600
+ import chalk65 from "chalk";
18571
18601
  import fs3 from "fs";
18572
18602
  import path6 from "path";
18573
18603
  async function parseWorkflowContent(content, filename) {
@@ -18709,7 +18739,7 @@ var WorkflowAddCommand = {
18709
18739
  definition = await parseWorkflowContent(content, filePath);
18710
18740
  workflowName = a.name || definition.name || path6.basename(filePath);
18711
18741
  if (a.validate) {
18712
- output.log(chalk64.blue("\uD83D\uDD0D Validating workflow..."));
18742
+ output.log(chalk65.blue("\uD83D\uDD0D Validating workflow..."));
18713
18743
  const dagResult = validateWorkflowDefinition(definition);
18714
18744
  if (!dagResult.valid) {
18715
18745
  output.error(`
@@ -18733,11 +18763,11 @@ var WorkflowAddCommand = {
18733
18763
  });
18734
18764
  process.exit(1);
18735
18765
  }
18736
- output.log(chalk64.green(`✅ Workflow validation passed
18766
+ output.log(chalk65.green(`✅ Workflow validation passed
18737
18767
  `));
18738
18768
  }
18739
18769
  } else if (a.desc) {
18740
- output.log(chalk64.blue(`\uD83E\uDD16 Generating workflow from description...
18770
+ output.log(chalk65.blue(`\uD83E\uDD16 Generating workflow from description...
18741
18771
  `));
18742
18772
  const agentComponent = env.getComponent("agent");
18743
18773
  if (!agentComponent) {
@@ -18759,20 +18789,20 @@ ${a.desc}
18759
18789
  1. 先用 \`roy-agent workflow nodes\` 查看可用的节点类型
18760
18790
  2. 生成的 YAML 必须通过 \`roy-agent workflow validate --yaml "<yaml>"\` 验证
18761
18791
  3. 验证通过后才输出最终 YAML`;
18762
- output.log(chalk64.gray("Running workflow-extract agent..."));
18792
+ output.log(chalk65.gray("Running workflow-extract agent..."));
18763
18793
  const result = await agentComponent.run("workflow-extract", prompt);
18764
18794
  const agentOutput = result.finalText || "";
18765
18795
  definition = parseYamlFromAgentOutput(agentOutput);
18766
18796
  if (definition === null) {
18767
18797
  output.error("Failed to parse workflow from agent output");
18768
- output.log(chalk64.gray(`
18798
+ output.log(chalk65.gray(`
18769
18799
  Agent output:
18770
18800
  ` + agentOutput.slice(0, 500)));
18771
18801
  process.exit(1);
18772
18802
  }
18773
18803
  workflowName = a.name || definition.name;
18774
18804
  if (a.validate) {
18775
- output.log(chalk64.blue(`
18805
+ output.log(chalk65.blue(`
18776
18806
  \uD83D\uDD0D Validating generated workflow...`));
18777
18807
  const dagResult = validateWorkflowDefinition(definition);
18778
18808
  if (!dagResult.valid) {
@@ -18781,7 +18811,7 @@ Agent output:
18781
18811
  dagResult.errors.forEach((msg, i) => {
18782
18812
  output.error(`[Error ${i + 1}/${dagResult.errors.length}] ${msg}`);
18783
18813
  });
18784
- output.log(chalk64.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
18814
+ output.log(chalk65.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
18785
18815
  process.exit(1);
18786
18816
  }
18787
18817
  const validator = new WorkflowValidator;
@@ -18796,16 +18826,16 @@ Agent output:
18796
18826
  output.error(` Fix: ${error.fix}
18797
18827
  `);
18798
18828
  });
18799
- output.log(chalk64.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
18829
+ output.log(chalk65.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
18800
18830
  process.exit(1);
18801
18831
  }
18802
- output.log(chalk64.green(`✅ Generated workflow validation passed
18832
+ output.log(chalk65.green(`✅ Generated workflow validation passed
18803
18833
  `));
18804
18834
  }
18805
18835
  const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
18806
- output.log(chalk64.gray("--- Generated YAML ---"));
18836
+ output.log(chalk65.gray("--- Generated YAML ---"));
18807
18837
  output.log(yaml.stringify(definition));
18808
- output.log(chalk64.gray(`------------------------
18838
+ output.log(chalk65.gray(`------------------------
18809
18839
  `));
18810
18840
  } else {
18811
18841
  output.error("Please provide --file or --desc option");
@@ -18831,10 +18861,10 @@ Agent output:
18831
18861
  force: a.force
18832
18862
  });
18833
18863
  output.log(renderWorkflowAdded(workflow));
18834
- output.log(chalk64.bold(`
18864
+ output.log(chalk65.bold(`
18835
18865
  \uD83D\uDCCA Nodes Summary:`));
18836
18866
  output.log(renderNodesList(definition.nodes));
18837
- output.log(chalk64.green(`
18867
+ output.log(chalk65.green(`
18838
18868
  ✅ Workflow '${workflowName}' added successfully`));
18839
18869
  } catch (error) {
18840
18870
  if (error.message?.includes("already exists") && !a.force) {
@@ -18851,7 +18881,7 @@ Agent output:
18851
18881
  };
18852
18882
 
18853
18883
  // src/commands/workflow/commands/get.ts
18854
- import chalk65 from "chalk";
18884
+ import chalk66 from "chalk";
18855
18885
  import { createWorkflowGetTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
18856
18886
  var WorkflowGetCommand = {
18857
18887
  command: "get <identifier>",
@@ -18989,15 +19019,15 @@ var WorkflowGetCommand = {
18989
19019
  } else {
18990
19020
  output.log(renderWorkflowDetail(workflow, { includeRuns: runs }));
18991
19021
  if (args.includeNodes) {
18992
- output.log(chalk65.bold(`
19022
+ output.log(chalk66.bold(`
18993
19023
  \uD83D\uDCCB All Nodes:`));
18994
19024
  output.log(renderNodesList(data.nodes || []));
18995
19025
  }
18996
19026
  const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
18997
19027
  const defYaml = yaml.stringify(data.definition || {}, { indent: 2 });
18998
- output.log(chalk65.bold(`
19028
+ output.log(chalk66.bold(`
18999
19029
  \uD83D\uDCC4 Definition (YAML):`));
19000
- output.log(chalk65.gray(defYaml));
19030
+ output.log(chalk66.gray(defYaml));
19001
19031
  }
19002
19032
  }
19003
19033
  } catch (error) {
@@ -19010,7 +19040,7 @@ var WorkflowGetCommand = {
19010
19040
  };
19011
19041
 
19012
19042
  // src/commands/workflow/commands/update.ts
19013
- import chalk66 from "chalk";
19043
+ import chalk67 from "chalk";
19014
19044
  import fs4 from "fs";
19015
19045
  import path7 from "path";
19016
19046
  import { parseWorkflowFile } from "@ai-setting/roy-agent-core/env/workflow/types";
@@ -19083,7 +19113,7 @@ var WorkflowUpdateCommand = {
19083
19113
  const tags = a.tags ? a.tags.split(",").map((t) => t.trim()) : undefined;
19084
19114
  const workflow = await service.updateWorkflow(a.name, updates, { tags });
19085
19115
  output.log(renderWorkflowUpdated(workflow));
19086
- output.log(chalk66.green(`
19116
+ output.log(chalk67.green(`
19087
19117
  ✅ Workflow '${a.name}' updated successfully`));
19088
19118
  } catch (error) {
19089
19119
  output.error(`Failed to update workflow: ${error}`);
@@ -19095,7 +19125,7 @@ var WorkflowUpdateCommand = {
19095
19125
  };
19096
19126
 
19097
19127
  // src/commands/workflow/commands/remove.ts
19098
- import chalk67 from "chalk";
19128
+ import chalk68 from "chalk";
19099
19129
  var WorkflowRemoveCommand = {
19100
19130
  command: "remove <name>",
19101
19131
  describe: "删除 Workflow",
@@ -19134,8 +19164,8 @@ var WorkflowRemoveCommand = {
19134
19164
  process.exit(1);
19135
19165
  }
19136
19166
  if (!args.force) {
19137
- output.log(chalk67.yellow(`Are you sure you want to delete workflow '${args.name}'?`));
19138
- output.log(chalk67.gray("Use --force to skip confirmation"));
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"));
19139
19169
  process.exit(1);
19140
19170
  }
19141
19171
  const deleted = await service.deleteWorkflow(args.name);
@@ -19155,7 +19185,7 @@ var WorkflowRemoveCommand = {
19155
19185
 
19156
19186
  // src/commands/workflow/commands/run.ts
19157
19187
  var import_yaml = __toESM(require_dist(), 1);
19158
- import chalk68 from "chalk";
19188
+ import chalk69 from "chalk";
19159
19189
  import fs5 from "fs";
19160
19190
  import path8 from "path";
19161
19191
  import { createRunWorkflowTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
@@ -19233,7 +19263,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
19233
19263
  };
19234
19264
  if (args.session) {
19235
19265
  const sessionId = args.session;
19236
- output.log(chalk68.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
19266
+ output.log(chalk69.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
19237
19267
  const sessionComponent = workflowComponent.sessionComponent;
19238
19268
  if (!sessionComponent) {
19239
19269
  output.error("SessionComponent not available");
@@ -19295,17 +19325,17 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
19295
19325
  definition = { ...definition, name: args.name };
19296
19326
  }
19297
19327
  const workflow = await service.createWorkflow(definition, { force: true });
19298
- output.log(chalk68.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
19299
- output.log(chalk68.green(`✅ Workflow registered: ${workflow.name} (${workflow.id})`));
19328
+ output.log(chalk69.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
19329
+ output.log(chalk69.green(`✅ Workflow registered: ${workflow.name} (${workflow.id})`));
19300
19330
  if (args.registerOnly) {
19301
- output.log(chalk68.gray("ℹ️ Use --register-only, skipping execution"));
19331
+ output.log(chalk69.gray("ℹ️ Use --register-only, skipping execution"));
19302
19332
  if (workflowSpan) {
19303
19333
  workflowSpan.end();
19304
19334
  }
19305
19335
  await envService.dispose();
19306
19336
  process.exit(0);
19307
19337
  }
19308
- output.log(chalk68.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
19338
+ output.log(chalk69.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
19309
19339
  const result = await service.runWorkflow(definition, input, runOptions);
19310
19340
  output.log(renderRunResult({
19311
19341
  runId: result.runId,
@@ -19315,7 +19345,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
19315
19345
  durationMs: result.durationMs
19316
19346
  }));
19317
19347
  if (result.status === "paused") {
19318
- output.log(chalk68.gray(`
19348
+ output.log(chalk69.gray(`
19319
19349
  \uD83D\uDCA1 Use "roy-agent workflow run ${result.runId} --session ${result.runId} --input '<response>'" to resume`));
19320
19350
  }
19321
19351
  } else {
@@ -19338,7 +19368,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
19338
19368
  durationMs: runData.duration_ms
19339
19369
  }));
19340
19370
  if (runData.status === "paused") {
19341
- output.log(chalk68.gray(`
19371
+ output.log(chalk69.gray(`
19342
19372
  \uD83D\uDCA1 Use "roy-agent workflow run ${runData.run_id} --session ${runData.run_id} --input '<response>'" to resume`));
19343
19373
  }
19344
19374
  }
@@ -19410,7 +19440,7 @@ var WorkflowRunCommand = {
19410
19440
  };
19411
19441
 
19412
19442
  // src/commands/workflow/commands/stop.ts
19413
- import chalk69 from "chalk";
19443
+ import chalk70 from "chalk";
19414
19444
  import { createWorkflowRunStopTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
19415
19445
  import { wrapFunction as wrapFunction2 } from "@ai-setting/roy-agent-core";
19416
19446
  var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
@@ -19435,7 +19465,7 @@ var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
19435
19465
  output.error(result.error || `Failed to stop workflow: ${args.runId}`);
19436
19466
  process.exit(1);
19437
19467
  }
19438
- output.log(chalk69.red(`
19468
+ output.log(chalk70.red(`
19439
19469
  ⏹️ Workflow stopped: ${args.runId}`));
19440
19470
  } catch (error) {
19441
19471
  output.error(`Failed to stop workflow: ${error}`);
@@ -19459,7 +19489,7 @@ var WorkflowStopCommand = {
19459
19489
  };
19460
19490
 
19461
19491
  // src/commands/workflow/commands/status.ts
19462
- import chalk70 from "chalk";
19492
+ import chalk71 from "chalk";
19463
19493
  import { createWorkflowRunStatusTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
19464
19494
  var WorkflowStatusCommand = {
19465
19495
  command: "status <runId>",
@@ -19552,7 +19582,7 @@ var WorkflowStatusCommand = {
19552
19582
  stopped: "⏹️"
19553
19583
  };
19554
19584
  const emoji = statusEmoji[status] || "❓";
19555
- output.log(chalk70.bold(`
19585
+ output.log(chalk71.bold(`
19556
19586
  ${emoji} Status: ${status.toUpperCase()}`));
19557
19587
  }
19558
19588
  } catch (error) {
@@ -19565,7 +19595,7 @@ ${emoji} Status: ${status.toUpperCase()}`));
19565
19595
  };
19566
19596
 
19567
19597
  // src/commands/workflow/commands/nodes.ts
19568
- import chalk71 from "chalk";
19598
+ import chalk72 from "chalk";
19569
19599
  var BUILT_IN_NODES = [
19570
19600
  {
19571
19601
  name: "ToolNode",
@@ -19902,7 +19932,7 @@ nodes:
19902
19932
  ];
19903
19933
  function renderNodeTypesTable(nodes) {
19904
19934
  const lines = [];
19905
- lines.push(chalk71.bold(`
19935
+ lines.push(chalk72.bold(`
19906
19936
  \uD83D\uDCE6 Built-in Node Types
19907
19937
  `));
19908
19938
  lines.push("┌────────────┬────────────────────┬─────────────────────────────────────────────────────────────┐");
@@ -19920,29 +19950,29 @@ function renderNodeTypesTable(nodes) {
19920
19950
  }
19921
19951
  function renderNodeDetail(node) {
19922
19952
  const lines = [];
19923
- lines.push(chalk71.bold(`
19953
+ lines.push(chalk72.bold(`
19924
19954
  [${node.type}] ${node.name}`));
19925
- lines.push(chalk71.dim("─".repeat(60)) + `
19955
+ lines.push(chalk72.dim("─".repeat(60)) + `
19926
19956
  `);
19927
- lines.push(chalk71.bold("Description:"));
19957
+ lines.push(chalk72.bold("Description:"));
19928
19958
  lines.push(` ${node.description}
19929
19959
  `);
19930
- lines.push(chalk71.bold("Configuration:"));
19960
+ lines.push(chalk72.bold("Configuration:"));
19931
19961
  lines.push(' type: "' + node.type + '"');
19932
19962
  lines.push(" config:");
19933
19963
  for (const input of node.inputs) {
19934
- const required = input.required ? chalk71.red("*") : " ";
19964
+ const required = input.required ? chalk72.red("*") : " ";
19935
19965
  lines.push(` ${input.name} (${input.type})${required}`);
19936
19966
  lines.push(` ${input.description}`);
19937
19967
  }
19938
19968
  lines.push(`
19939
- ${chalk71.bold("Output:")} ${node.output}`);
19969
+ ${chalk72.bold("Output:")} ${node.output}`);
19940
19970
  if (node.example) {
19941
- lines.push(chalk71.bold(`
19971
+ lines.push(chalk72.bold(`
19942
19972
  Example:`));
19943
- lines.push(chalk71.gray("```yaml"));
19973
+ lines.push(chalk72.gray("```yaml"));
19944
19974
  lines.push(node.example);
19945
- lines.push(chalk71.gray("```"));
19975
+ lines.push(chalk72.gray("```"));
19946
19976
  }
19947
19977
  return lines.join(`
19948
19978
  `);
@@ -19958,16 +19988,16 @@ var WorkflowNodesCommand = {
19958
19988
  const nodeType = args.type?.toLowerCase();
19959
19989
  if (!nodeType) {
19960
19990
  console.log(renderNodeTypesTable(BUILT_IN_NODES));
19961
- console.log(chalk71.gray(`
19962
- Use `) + chalk71.cyan("roy-agent workflow nodes <type>") + chalk71.gray(" for detailed information"));
19963
- console.log(chalk71.gray("Available types: ") + chalk71.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
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(", ")));
19964
19994
  return;
19965
19995
  }
19966
19996
  const node = BUILT_IN_NODES.find((n) => n.type === nodeType);
19967
19997
  if (!node) {
19968
- console.log(chalk71.red(`
19998
+ console.log(chalk72.red(`
19969
19999
  ❌ Unknown node type: ${nodeType}`));
19970
- console.log(chalk71.gray("Available types: ") + chalk71.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
20000
+ console.log(chalk72.gray("Available types: ") + chalk72.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
19971
20001
  process.exit(1);
19972
20002
  }
19973
20003
  console.log(renderNodeDetail(node));
@@ -19975,7 +20005,7 @@ Use `) + chalk71.cyan("roy-agent workflow nodes <type>") + chalk71.gray(" for de
19975
20005
  };
19976
20006
 
19977
20007
  // src/commands/workflow/commands/validate.ts
19978
- import chalk72 from "chalk";
20008
+ import chalk73 from "chalk";
19979
20009
  import { readFileSync } from "fs";
19980
20010
  async function parseWorkflowInput(input, yamlStr) {
19981
20011
  const parseYaml = async (content) => {
@@ -20008,25 +20038,25 @@ function renderResult(result, options) {
20008
20038
  return;
20009
20039
  }
20010
20040
  if (result.valid) {
20011
- console.log(chalk72.green(`
20041
+ console.log(chalk73.green(`
20012
20042
  ✅ Workflow validation PASSED
20013
20043
  `));
20014
- console.log(chalk72.bold(`Workflow: ${result.workflowName}`));
20044
+ console.log(chalk73.bold(`Workflow: ${result.workflowName}`));
20015
20045
  console.log(`Nodes: ${result.nodeCount}`);
20016
20046
  console.log(`
20017
20047
  Valid nodes:`);
20018
- console.log(chalk72.green(" ✓ All nodes passed validation"));
20048
+ console.log(chalk73.green(" ✓ All nodes passed validation"));
20019
20049
  } else {
20020
- console.log(chalk72.red(`
20050
+ console.log(chalk73.red(`
20021
20051
  ❌ Workflow validation FAILED (${result.errors.length} errors found)
20022
20052
  `));
20023
20053
  result.errors.forEach((error, index) => {
20024
- console.log(chalk72.red(`[Error ${index + 1}/${result.errors.length}]${error.nodeId ? ` Node "${error.nodeId}"` : ""}`));
20025
- console.log(` ${chalk72.bold("Type:")} ${error.type}`);
20026
- console.log(` ${chalk72.bold("Description:")} ${error.description}`);
20027
- console.log(` ${chalk72.bold("Expected:")} ${error.expected}`);
20028
- console.log(` ${chalk72.bold("Actual:")} ${error.actual}`);
20029
- console.log(` ${chalk72.green("Fix:")} ${error.fix}`);
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}`);
20030
20060
  console.log();
20031
20061
  });
20032
20062
  }
@@ -20051,7 +20081,7 @@ var WorkflowValidateCommand = {
20051
20081
  try {
20052
20082
  const workflow = await parseWorkflowInput(options.input, options.yaml);
20053
20083
  if (!workflow) {
20054
- console.error(chalk72.red("Failed to parse workflow input"));
20084
+ console.error(chalk73.red("Failed to parse workflow input"));
20055
20085
  process.exit(1);
20056
20086
  }
20057
20087
  const validator = new WorkflowValidator;
@@ -20059,7 +20089,7 @@ var WorkflowValidateCommand = {
20059
20089
  renderResult(result, options);
20060
20090
  process.exit(result.valid ? 0 : 1);
20061
20091
  } catch (error) {
20062
- console.error(chalk72.red(`
20092
+ console.error(chalk73.red(`
20063
20093
  Error: ${error.message}`));
20064
20094
  process.exit(1);
20065
20095
  }
@@ -20067,7 +20097,7 @@ Error: ${error.message}`));
20067
20097
  };
20068
20098
 
20069
20099
  // src/commands/workflow/commands/search.ts
20070
- import chalk73 from "chalk";
20100
+ import chalk74 from "chalk";
20071
20101
  import { wrapFunction as wrapFunction3 } from "@ai-setting/roy-agent-core";
20072
20102
  var WorkflowSearchCommand = {
20073
20103
  command: "search",
@@ -20224,22 +20254,22 @@ var _runWorkflowSearchImpl = async function(opts) {
20224
20254
  metadata: {}
20225
20255
  }));
20226
20256
  if (renderWorkflows.length === 0) {
20227
- output.log(chalk73.yellow("\uD83D\uDD0D No workflows matched the search criteria."));
20228
- output.log(chalk73.gray(` keyword: ${keyword || "(none)"}`));
20229
- output.log(chalk73.gray(` tags: ${tags && tags.length > 0 ? tags.join(", ") : "(none)"}`));
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)"}`));
20230
20260
  } else {
20231
- output.log(chalk73.bold(`\uD83D\uDD0D Search results (${renderWorkflows.length}):`));
20261
+ output.log(chalk74.bold(`\uD83D\uDD0D Search results (${renderWorkflows.length}):`));
20232
20262
  output.log(renderWorkflowList(renderWorkflows));
20233
- output.log(chalk73.green(`
20263
+ output.log(chalk74.green(`
20234
20264
  ✅ Found ${renderWorkflows.length} workflow(s)`));
20235
20265
  }
20236
20266
  if (availableTags.length > 0) {
20237
20267
  output.log("");
20238
- output.log(chalk73.bold("\uD83D\uDCDA Available tags (sorted by usage_count):"));
20268
+ output.log(chalk74.bold("\uD83D\uDCDA Available tags (sorted by usage_count):"));
20239
20269
  for (const t of availableTags) {
20240
20270
  const name = t.name ?? t.tag;
20241
20271
  const count = t.count ?? t.usage_count;
20242
- output.log(chalk73.gray(` - ${name} (${count})`));
20272
+ output.log(chalk74.gray(` - ${name} (${count})`));
20243
20273
  }
20244
20274
  }
20245
20275
  };
@@ -20251,7 +20281,7 @@ var runWorkflowSearch = wrapFunction3(_runWorkflowSearchImpl, "workflow.cli.sear
20251
20281
 
20252
20282
  // src/commands/workflow/commands/tag.ts
20253
20283
  import { wrapFunction as wrapFunction4 } from "@ai-setting/roy-agent-core";
20254
- import chalk74 from "chalk";
20284
+ import chalk75 from "chalk";
20255
20285
  var WorkflowTagListCommand = {
20256
20286
  command: "list",
20257
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.",
@@ -20372,17 +20402,17 @@ var _runWorkflowTagListImpl = async function(opts) {
20372
20402
  return;
20373
20403
  }
20374
20404
  if (result.tags.length === 0) {
20375
- output.log(chalk74.yellow("\uD83C\uDFF7️ No tags in the workflow_tags table yet."));
20376
- output.log(chalk74.gray(" Tags are created automatically when you run `workflow add --tags <name>`."));
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>`."));
20377
20407
  return;
20378
20408
  }
20379
- output.log(chalk74.bold(`\uD83C\uDFF7️ Workflow tags (${result.total}):`));
20380
- output.log(chalk74.gray(` ${padRight("NAME", 24)}${padRight("USAGE", 8)}${padRight("CREATED", 22)}`));
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)}`));
20381
20411
  for (const t of result.tags) {
20382
20412
  const line = ` ${padRight(t.name, 24)}${padRight(String(t.usage_count), 8)}${padRight(formatDate2(t.created_at), 22)}`;
20383
20413
  output.log(line);
20384
20414
  }
20385
- output.log(chalk74.gray(`
20415
+ output.log(chalk75.gray(`
20386
20416
  \uD83D\uDCA1 Tip: when adding a new workflow, prefer tags from this list to ensure semantic consistency.`));
20387
20417
  };
20388
20418
  var _runWorkflowTagGetImpl = async function(opts) {
@@ -20409,7 +20439,7 @@ var _runWorkflowTagGetImpl = async function(opts) {
20409
20439
  output.json({ error: "Tag not found", name: opts.name });
20410
20440
  } else {
20411
20441
  output.error(`Tag "${opts.name}" not found in the workflow_tags table.`);
20412
- output.log(chalk74.gray(`Tip: run \`roy-agent workflow tag list\` to see available tags.`));
20442
+ output.log(chalk75.gray(`Tip: run \`roy-agent workflow tag list\` to see available tags.`));
20413
20443
  }
20414
20444
  process.exitCode = 1;
20415
20445
  return;
@@ -20418,10 +20448,10 @@ var _runWorkflowTagGetImpl = async function(opts) {
20418
20448
  output.json(tag);
20419
20449
  return;
20420
20450
  }
20421
- output.log(chalk74.bold(`\uD83C\uDFF7️ Tag: ${tag.name}`));
20422
- output.log(chalk74.gray(` usage_count: ${tag.usage_count}`));
20423
- output.log(chalk74.gray(` created_at: ${tag.created_at}`));
20424
- output.log(chalk74.gray(` updated_at: ${tag.updated_at}`));
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}`));
20425
20455
  };
20426
20456
  async function callListTags(service, options) {
20427
20457
  if (typeof service.listTags !== "function") {