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