@ai-setting/roy-agent-cli 1.5.85 → 1.5.87

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.
@@ -7320,7 +7320,7 @@ var require_dist = __commonJS((exports) => {
7320
7320
  var require_package = __commonJS((exports, module) => {
7321
7321
  module.exports = {
7322
7322
  name: "@ai-setting/roy-agent-cli",
7323
- version: "1.5.85",
7323
+ version: "1.5.87",
7324
7324
  type: "module",
7325
7325
  description: "CLI for roy-agent - Non-interactive command execution",
7326
7326
  main: "./dist/index.js",
@@ -7456,7 +7456,7 @@ import { globalHookManager } from "@ai-setting/roy-agent-core";
7456
7456
  // src/services/output.service.ts
7457
7457
  import chalk from "chalk";
7458
7458
 
7459
- class OutputService {
7459
+ class OutputService2 {
7460
7460
  quiet = false;
7461
7461
  jsonOutput = false;
7462
7462
  noColor = false;
@@ -7546,7 +7546,7 @@ class EnvironmentService {
7546
7546
  workflowComponent;
7547
7547
  pluginComponent;
7548
7548
  constructor(output) {
7549
- this.output = output ?? new OutputService;
7549
+ this.output = output ?? new OutputService2;
7550
7550
  }
7551
7551
  getEnvironment() {
7552
7552
  return this.environment;
@@ -8420,7 +8420,7 @@ function createActCommand(externalEnvService) {
8420
8420
  async handler(args) {
8421
8421
  const quiet = args.quiet ?? true;
8422
8422
  CliQuietModeService.getInstance().setQuiet(quiet);
8423
- const output = new OutputService;
8423
+ const output = new OutputService2;
8424
8424
  output.configure({ quiet });
8425
8425
  if (!args.message) {
8426
8426
  output.error("请提供要执行的消息,使用方式:roy-agent act <消息>");
@@ -9000,16 +9000,13 @@ class EventMessageFormatter {
9000
9000
  }
9001
9001
  formatTaskProgress(payload) {
9002
9002
  const desc = payload.description || "未命名任务";
9003
- const progress = payload.progress !== undefined ? `${payload.progress}%` : "";
9004
9003
  const message = payload.progressMessage || "";
9005
9004
  const taskId = payload.associatedTaskId;
9006
9005
  let result = `${this.prefix} \uD83D\uDD04 后台任务「${desc}」`;
9007
9006
  if (taskId !== undefined) {
9008
9007
  result += `[Task #${taskId}] `;
9009
9008
  }
9010
- result += `进度更新`;
9011
- if (progress)
9012
- result += `: ${progress}`;
9009
+ result += `还在进行中,请耐心等待。需查询具体进度可调用 task_get / task_operation_list 等工具`;
9013
9010
  if (message)
9014
9011
  result += ` - ${message}`;
9015
9012
  return result;
@@ -9278,6 +9275,130 @@ class InputHandler {
9278
9275
  }
9279
9276
  }
9280
9277
 
9278
+ // src/commands/interactive-event-sources.ts
9279
+ import { TracedAs as TracedAs4 } from "@ai-setting/roy-agent-core";
9280
+ async function startSingleEventSource(eventSourceComponent, output, eventSourceId) {
9281
+ return EventSourceStarter.instance.runSingle(eventSourceComponent, output, eventSourceId);
9282
+ }
9283
+ async function startEventSources(eventSourceIds, eventSourceComponent, output) {
9284
+ return EventSourceStarter.instance.run(eventSourceIds, eventSourceComponent, output);
9285
+ }
9286
+
9287
+ class EventSourceStarter {
9288
+ static instance = new EventSourceStarter;
9289
+ async run(eventSourceIds, eventSourceComponent, output) {
9290
+ return startEventSourcesImpl(eventSourceIds, eventSourceComponent, output);
9291
+ }
9292
+ async runSingle(eventSourceComponent, output, eventSourceId) {
9293
+ return startSingleEventSourceImpl(eventSourceComponent, output, eventSourceId);
9294
+ }
9295
+ }
9296
+ __legacyDecorateClassTS([
9297
+ TracedAs4("interactive.startEventSources", { recordParams: false, log: false }),
9298
+ __legacyMetadataTS("design:type", Function),
9299
+ __legacyMetadataTS("design:paramtypes", [
9300
+ Array,
9301
+ typeof EventSourceComponentInterface === "undefined" ? Object : EventSourceComponentInterface,
9302
+ typeof OutputService === "undefined" ? Object : OutputService
9303
+ ]),
9304
+ __legacyMetadataTS("design:returntype", typeof Promise === "undefined" ? Object : Promise)
9305
+ ], EventSourceStarter.prototype, "run", null);
9306
+ __legacyDecorateClassTS([
9307
+ TracedAs4("interactive.startSingleEventSource", { recordParams: false, log: false }),
9308
+ __legacyMetadataTS("design:type", Function),
9309
+ __legacyMetadataTS("design:paramtypes", [
9310
+ typeof EventSourceComponentInterface === "undefined" ? Object : EventSourceComponentInterface,
9311
+ typeof OutputService === "undefined" ? Object : OutputService,
9312
+ String
9313
+ ]),
9314
+ __legacyMetadataTS("design:returntype", typeof Promise === "undefined" ? Object : Promise)
9315
+ ], EventSourceStarter.prototype, "runSingle", null);
9316
+ async function startEventSourcesImpl(eventSourceIds, eventSourceComponent, output) {
9317
+ const results = [];
9318
+ if (!eventSourceIds || eventSourceIds.length === 0) {
9319
+ return { results, total: 0, successCount: 0, failedCount: 0 };
9320
+ }
9321
+ for (const id of eventSourceIds) {
9322
+ if (!id)
9323
+ continue;
9324
+ const result = await startSingleEventSource(eventSourceComponent, output, id);
9325
+ results.push(result);
9326
+ }
9327
+ const successCount = results.filter((r) => r.success).length;
9328
+ const failedCount = results.length - successCount;
9329
+ if (results.length > 1) {
9330
+ if (failedCount > 0) {
9331
+ output.info(`
9332
+ ✅ 成功启动 ${successCount}/${results.length} 个事件源`);
9333
+ } else {
9334
+ output.success(`
9335
+ ✅ 成功启动 ${successCount}/${results.length} 个事件源`);
9336
+ }
9337
+ }
9338
+ return { results, total: results.length, successCount, failedCount };
9339
+ }
9340
+ async function startSingleEventSourceImpl(eventSourceComponent, output, eventSourceId) {
9341
+ const sources = eventSourceComponent.list();
9342
+ const matchedSource = sources.find((s) => s.id === eventSourceId || s.id.startsWith(eventSourceId));
9343
+ if (!matchedSource) {
9344
+ output.error(`❌ 事件源不存在: ${eventSourceId}`);
9345
+ output.info(`可用的事件源:`);
9346
+ for (const s of sources) {
9347
+ output.info(` - ${s.id.substring(0, 8)}: ${s.name} (${s.type})`);
9348
+ }
9349
+ return {
9350
+ id: eventSourceId,
9351
+ name: eventSourceId,
9352
+ success: false,
9353
+ status: "not_found",
9354
+ error: `EventSource not found: ${eventSourceId}`
9355
+ };
9356
+ }
9357
+ const actualId = matchedSource.id;
9358
+ const status = eventSourceComponent.getStatus(actualId);
9359
+ if (status === "running") {
9360
+ output.info(`\uD83D\uDCE1 事件源 ${matchedSource.name} 已在运行中`);
9361
+ return {
9362
+ id: actualId,
9363
+ name: matchedSource.name,
9364
+ success: true,
9365
+ status: "skipped"
9366
+ };
9367
+ }
9368
+ try {
9369
+ await eventSourceComponent.startSource(actualId);
9370
+ const verifyStatus = eventSourceComponent.getStatus(actualId);
9371
+ if (verifyStatus !== "running") {
9372
+ const errMsg = `启动后状态异常: ${verifyStatus}`;
9373
+ output.error(`❌ ${errMsg}`);
9374
+ return {
9375
+ id: actualId,
9376
+ name: matchedSource.name,
9377
+ success: false,
9378
+ status: "failed",
9379
+ error: errMsg
9380
+ };
9381
+ }
9382
+ output.success(`\uD83D\uDCE1 已启动事件源: ${matchedSource.name} (${verifyStatus})`);
9383
+ return {
9384
+ id: actualId,
9385
+ name: matchedSource.name,
9386
+ success: true,
9387
+ status: "started"
9388
+ };
9389
+ } catch (error) {
9390
+ const errMsg = error instanceof Error ? error.message : String(error);
9391
+ output.error(`❌ 启动事件源失败: ${matchedSource.name} - ${errMsg}`);
9392
+ return {
9393
+ id: actualId,
9394
+ name: matchedSource.name,
9395
+ success: false,
9396
+ status: "failed",
9397
+ error: errMsg
9398
+ };
9399
+ }
9400
+ }
9401
+
9281
9402
  // src/commands/shared/ask-user-handler.ts
9282
9403
  import * as readline from "readline";
9283
9404
  import chalk3 from "chalk";
@@ -9818,8 +9939,9 @@ function createInteractiveCommand(externalEnvService) {
9818
9939
  default: false
9819
9940
  }).option("event-source", {
9820
9941
  alias: "es",
9821
- describe: "启动时一并启动的事件源 ID",
9822
- type: "string"
9942
+ describe: "启动时一并启动的事件源 ID(可多次指定,支持 --es a --es b)",
9943
+ type: "array",
9944
+ string: true
9823
9945
  }).option("plugin", {
9824
9946
  alias: "p",
9825
9947
  describe: "启用 plugin (tslsp, pylsp, mdlsp, lsp, code-check, reminder, memory, task-tag)",
@@ -9835,7 +9957,7 @@ function createInteractiveCommand(externalEnvService) {
9835
9957
  }),
9836
9958
  async handler(args) {
9837
9959
  CliQuietModeService.getInstance().setQuiet(true);
9838
- const output = new OutputService;
9960
+ const output = new OutputService2;
9839
9961
  const shouldDisposeEnvService = !externalEnvService;
9840
9962
  const envService = externalEnvService ?? new EnvironmentService(output);
9841
9963
  const CODER_HARNESS_PLUGINS = new Set([
@@ -10082,47 +10204,19 @@ function createInteractiveCommand(externalEnvService) {
10082
10204
  }
10083
10205
  });
10084
10206
  const stopEventHandler = eventHandler.start();
10085
- const eventSourceId = args.eventSource;
10086
- if (eventSourceId) {
10207
+ const rawEventSourceIds = args.eventSource;
10208
+ const eventSourceIds = Array.isArray(rawEventSourceIds) ? rawEventSourceIds.filter((s) => !!s) : rawEventSourceIds ? [rawEventSourceIds] : [];
10209
+ if (eventSourceIds.length > 0) {
10087
10210
  const eventSourceComponent = env.getComponent("event-source");
10088
10211
  if (!eventSourceComponent || typeof eventSourceComponent.startSource !== "function") {
10089
10212
  output.error(`❌ 未找到事件源组件或 startSource 方法`);
10090
10213
  output.info(`请确保 EventSourceComponent 已正确注册`);
10091
10214
  process.exit(1);
10092
10215
  }
10093
- const sources = eventSourceComponent.list();
10094
- const matchedSource = sources.find((s) => s.id === eventSourceId || s.id.startsWith(eventSourceId));
10095
- if (!matchedSource) {
10096
- output.error(`❌ 事件源不存在: ${eventSourceId}`);
10097
- output.info(`可用的事件源:`);
10098
- for (const s of sources) {
10099
- output.info(` - ${s.id}: ${s.name} (${s.type})`);
10100
- }
10216
+ const summary = await startEventSources(eventSourceIds, eventSourceComponent, output);
10217
+ if (eventSourceIds.length === 1 && summary.failedCount > 0) {
10101
10218
  process.exit(1);
10102
10219
  }
10103
- const actualId = matchedSource.id;
10104
- const status = eventSourceComponent.getStatus(actualId);
10105
- if (status === "running") {
10106
- output.info(`\uD83D\uDCE1 事件源 ${matchedSource.name} 已在运行中`);
10107
- } else {
10108
- try {
10109
- await eventSourceComponent.startSource(actualId);
10110
- const verifyStatus = eventSourceComponent.getStatus(actualId);
10111
- if (verifyStatus !== "running") {
10112
- output.error(`❌ 事件源启动后状态异常: ${verifyStatus}`);
10113
- output.info(`请检查日志确认后台进程是否正常运行`);
10114
- process.exit(1);
10115
- }
10116
- output.success(`\uD83D\uDCE1 已启动事件源: ${matchedSource.name} (${verifyStatus})`);
10117
- } catch (error) {
10118
- output.error(`❌ 启动事件源失败: ${error}`);
10119
- output.info(`常见问题:`);
10120
- output.info(` - lark-cli 事件源:确保已安装并登录 lark-cli`);
10121
- output.info(` - websocket 事件源:确保目标服务器可达`);
10122
- output.info(` - timer 事件源:检查配置是否正确`);
10123
- process.exit(1);
10124
- }
10125
- }
10126
10220
  }
10127
10221
  let sigintHandler;
10128
10222
  sigintHandler = () => {
@@ -10185,7 +10279,7 @@ var ListCommand = {
10185
10279
  if (isQuiet) {
10186
10280
  CliQuietModeService.getInstance().setQuiet(true);
10187
10281
  }
10188
- const output = new OutputService;
10282
+ const output = new OutputService2;
10189
10283
  output.configure({ quiet: isQuiet });
10190
10284
  const envService = new EnvironmentService(output);
10191
10285
  try {
@@ -10314,7 +10408,7 @@ var GetCommand = {
10314
10408
  }).option("messages", { type: "boolean", default: false }).option("checkpoints", { alias: "c", type: "boolean", default: false }).option("json", { alias: "j", type: "boolean", default: false }),
10315
10409
  async handler(args) {
10316
10410
  const a = args;
10317
- const output = new OutputService;
10411
+ const output = new OutputService2;
10318
10412
  const envService = new EnvironmentService(output);
10319
10413
  try {
10320
10414
  await envService.create({ configPath: a.config });
@@ -10414,7 +10508,7 @@ var NewCommand = {
10414
10508
  describe: "创建新会话",
10415
10509
  builder: (yargs) => yargs.option("title", { alias: "t", type: "string" }).option("directory", { alias: "d", type: "string" }).option("active", { alias: "s", type: "boolean", default: false }).option("json", { type: "boolean", default: false }),
10416
10510
  async handler(args) {
10417
- const output = new OutputService;
10511
+ const output = new OutputService2;
10418
10512
  const envService = new EnvironmentService(output);
10419
10513
  try {
10420
10514
  await envService.create({ configPath: args.config });
@@ -10480,7 +10574,7 @@ var RenameCommand = {
10480
10574
  }),
10481
10575
  async handler(args) {
10482
10576
  const a = args;
10483
- const output = new OutputService;
10577
+ const output = new OutputService2;
10484
10578
  const envService = new EnvironmentService(output);
10485
10579
  try {
10486
10580
  await envService.create({ configPath: a.config });
@@ -10573,7 +10667,7 @@ var DeleteCommand = {
10573
10667
  }),
10574
10668
  async handler(args) {
10575
10669
  const a = args;
10576
- const output = new OutputService;
10670
+ const output = new OutputService2;
10577
10671
  const envService = new EnvironmentService(output);
10578
10672
  try {
10579
10673
  await envService.create({ configPath: a.config });
@@ -10720,7 +10814,7 @@ var MessagesCommand = {
10720
10814
  }).option("limit", { alias: "n", type: "number", demandOption: true, describe: "返回消息数量" }).option("offset", { alias: "o", type: "number", demandOption: true, describe: "起始偏移量" }).option("reverse", { alias: "r", type: "boolean", default: false }).option("json", { alias: "j", type: "boolean", default: false }),
10721
10815
  async handler(args) {
10722
10816
  const a = args;
10723
- const output = new OutputService;
10817
+ const output = new OutputService2;
10724
10818
  const envService = new EnvironmentService(output);
10725
10819
  try {
10726
10820
  await envService.create({ configPath: a.config });
@@ -10930,7 +11024,7 @@ var CompactCommand = {
10930
11024
  }).option("process-key-points", { type: "string", description: "过程要点(逗号分隔)" }).option("current-state", { type: "string", description: "当前状态" }).option("next-steps", { type: "string", description: "后续待跟进(逗号分隔)" }).option("dry-run", { alias: "d", type: "boolean", default: false, description: "预览压缩效果" }).option("json", { alias: "j", type: "boolean", default: false }),
10931
11025
  async handler(args) {
10932
11026
  const a = args;
10933
- const output = new OutputService;
11027
+ const output = new OutputService2;
10934
11028
  const envService = new EnvironmentService(output);
10935
11029
  try {
10936
11030
  await envService.create({ configPath: a.config });
@@ -11122,7 +11216,7 @@ var CheckpointsCommand = {
11122
11216
  }).option("detail", { alias: "d", type: "boolean", default: false }).option("json", { alias: "j", type: "boolean", default: false }),
11123
11217
  async handler(args) {
11124
11218
  const a = args;
11125
- const output = new OutputService;
11219
+ const output = new OutputService2;
11126
11220
  const envService = new EnvironmentService(output);
11127
11221
  try {
11128
11222
  await envService.create({ configPath: a.config });
@@ -11236,7 +11330,7 @@ var ActiveCommand = {
11236
11330
  describe: "查看/设置当前活跃会话",
11237
11331
  builder: (yargs) => yargs.option("clear", { type: "boolean", default: false }).option("json", { alias: "j", type: "boolean", default: false }),
11238
11332
  async handler(args) {
11239
- const output = new OutputService;
11333
+ const output = new OutputService2;
11240
11334
  const envService = new EnvironmentService(output);
11241
11335
  try {
11242
11336
  await envService.create({ configPath: args.config });
@@ -11315,7 +11409,7 @@ var AddMessageCommand = {
11315
11409
  }).option("json", { alias: "j", type: "boolean", default: false }),
11316
11410
  async handler(args) {
11317
11411
  const a = args;
11318
- const output = new OutputService;
11412
+ const output = new OutputService2;
11319
11413
  const envService = new EnvironmentService(output);
11320
11414
  try {
11321
11415
  await envService.create({ configPath: a.config });
@@ -11464,7 +11558,7 @@ var MockCommand = {
11464
11558
  }).option("json", { alias: "j", type: "boolean", default: false }),
11465
11559
  async handler(args) {
11466
11560
  const a = args;
11467
- const output = new OutputService;
11561
+ const output = new OutputService2;
11468
11562
  const envService = new EnvironmentService(output);
11469
11563
  try {
11470
11564
  await envService.create({ configPath: a.config });
@@ -11604,7 +11698,7 @@ var GrepCommand = {
11604
11698
  if (isQuiet) {
11605
11699
  CliQuietModeService.getInstance().setQuiet(true);
11606
11700
  }
11607
- const output = new OutputService;
11701
+ const output = new OutputService2;
11608
11702
  output.configure({ quiet: isQuiet });
11609
11703
  const envService = new EnvironmentService(output);
11610
11704
  try {
@@ -11780,7 +11874,7 @@ var ListCommand2 = {
11780
11874
  description: "是否包含已归档任务(status=archived 的任务默认被排除)"
11781
11875
  }).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }).option("quiet", { alias: "q", type: "boolean", hidden: true }),
11782
11876
  async handler(args) {
11783
- const output = new OutputService;
11877
+ const output = new OutputService2;
11784
11878
  const envService = new EnvironmentService(output);
11785
11879
  try {
11786
11880
  await envService.create({ configPath: args.config });
@@ -11890,7 +11984,7 @@ var GetCommand2 = {
11890
11984
  description: "包含操作记录"
11891
11985
  }).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }),
11892
11986
  async handler(args) {
11893
- const output = new OutputService;
11987
+ const output = new OutputService2;
11894
11988
  const envService = new EnvironmentService(output);
11895
11989
  try {
11896
11990
  await envService.create({ configPath: args.config });
@@ -12017,7 +12111,7 @@ var CreateCommand = {
12017
12111
  description: "任务上下文 (JSON 字符串)"
12018
12112
  }).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }),
12019
12113
  async handler(args) {
12020
- const output = new OutputService;
12114
+ const output = new OutputService2;
12021
12115
  const envService = new EnvironmentService(output);
12022
12116
  try {
12023
12117
  await envService.create({ configPath: args.config });
@@ -12079,7 +12173,7 @@ var UpdateCommand = {
12079
12173
  demandOption: true
12080
12174
  }).option("title", { alias: "t", type: "string", description: "标题" }).option("description", { alias: "d", type: "string", description: "描述" }).option("status", { alias: "s", type: "string", choices: ["todo", "active", "completed", "paused", "cancelled"], description: "状态" }).option("priority", { alias: "p", type: "string", choices: ["low", "medium", "high"], description: "优先级" }).option("type", { type: "string", choices: ["normal", "cycle", "longterm"], description: "任务类型 (normal/cycle/longterm)" }).option("progress", { type: "number", min: 0, max: 100, description: "进度 (0-100)" }).option("current_status", { alias: "c", type: "string", description: "当前状态描述" }).option("project-path", { type: "string", description: "项目路径" }).option("context", { type: "string", description: "任务上下文 (JSON 字符串)" }).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }),
12081
12175
  async handler(args) {
12082
- const output = new OutputService;
12176
+ const output = new OutputService2;
12083
12177
  const envService = new EnvironmentService(output);
12084
12178
  try {
12085
12179
  await envService.create({ configPath: args.config });
@@ -12165,7 +12259,7 @@ var DeleteCommand2 = {
12165
12259
  description: "强制删除,不确认"
12166
12260
  }),
12167
12261
  async handler(args) {
12168
- const output = new OutputService;
12262
+ const output = new OutputService2;
12169
12263
  const envService = new EnvironmentService(output);
12170
12264
  try {
12171
12265
  await envService.create({ configPath: args.config });
@@ -12226,7 +12320,7 @@ var CompleteCommand = {
12226
12320
  description: "Enable plugin (e.g., --plugin task-tag)"
12227
12321
  }),
12228
12322
  async handler(args) {
12229
- const output = new OutputService;
12323
+ const output = new OutputService2;
12230
12324
  const envService = new EnvironmentService(output);
12231
12325
  try {
12232
12326
  await envService.create({
@@ -12300,7 +12394,7 @@ var OperationsCommand = {
12300
12394
  }).option("limit", { alias: "n", type: "number", default: 20, description: "返回数量" }).option("offset", { type: "number", default: 0, description: "偏移量" }).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }),
12301
12395
  async handler(args) {
12302
12396
  const a = args;
12303
- const output = new OutputService;
12397
+ const output = new OutputService2;
12304
12398
  const envService = new EnvironmentService(output);
12305
12399
  try {
12306
12400
  await envService.create({ configPath: a.config });
@@ -12448,7 +12542,7 @@ var TreeCommand = {
12448
12542
  description: "以 JSON 格式输出树形结构"
12449
12543
  }),
12450
12544
  async handler(args) {
12451
- const output = new OutputService;
12545
+ const output = new OutputService2;
12452
12546
  const envService = new EnvironmentService(output);
12453
12547
  try {
12454
12548
  await envService.create({ configPath: args.config });
@@ -12551,7 +12645,7 @@ var SearchCommand = {
12551
12645
  description: "是否包含已归档任务"
12552
12646
  }).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }).option("quiet", { alias: "q", type: "boolean", hidden: true }),
12553
12647
  async handler(args) {
12554
- const output = new OutputService;
12648
+ const output = new OutputService2;
12555
12649
  const envService = new EnvironmentService(output);
12556
12650
  try {
12557
12651
  await envService.create({ configPath: args.config });
@@ -12903,7 +12997,7 @@ var ListCommand3 = {
12903
12997
  }),
12904
12998
  async handler(args) {
12905
12999
  const a = args;
12906
- const output = new OutputService;
13000
+ const output = new OutputService2;
12907
13001
  const envService = new EnvironmentService(output);
12908
13002
  try {
12909
13003
  await envService.create({ configPath: a.config });
@@ -12992,7 +13086,7 @@ var GetCommand3 = {
12992
13086
  description: "JSON 输出"
12993
13087
  }),
12994
13088
  async handler(args) {
12995
- const output = new OutputService;
13089
+ const output = new OutputService2;
12996
13090
  const envService = new EnvironmentService(output);
12997
13091
  try {
12998
13092
  await envService.create({ configPath: args.config });
@@ -13062,7 +13156,7 @@ var SearchCommand2 = {
13062
13156
  description: "简洁输出"
13063
13157
  }),
13064
13158
  async handler(args) {
13065
- const output = new OutputService;
13159
+ const output = new OutputService2;
13066
13160
  const envService = new EnvironmentService(output);
13067
13161
  try {
13068
13162
  await envService.create({ configPath: args.config });
@@ -13144,7 +13238,7 @@ var ReloadCommand = {
13144
13238
  description: "配置文件路径"
13145
13239
  }),
13146
13240
  async handler(args) {
13147
- const output = new OutputService;
13241
+ const output = new OutputService2;
13148
13242
  const envService = new EnvironmentService(output);
13149
13243
  try {
13150
13244
  await envService.create({ configPath: args.config });
@@ -13182,7 +13276,7 @@ var ShowConfigCommand = {
13182
13276
  description: "配置文件路径"
13183
13277
  }),
13184
13278
  async handler(args) {
13185
- const output = new OutputService;
13279
+ const output = new OutputService2;
13186
13280
  const envService = new EnvironmentService(output);
13187
13281
  try {
13188
13282
  await envService.create({ configPath: args.config });
@@ -13272,7 +13366,7 @@ var ListCommand4 = {
13272
13366
  description: "简洁输出"
13273
13367
  }),
13274
13368
  async handler(args) {
13275
- const output = new OutputService;
13369
+ const output = new OutputService2;
13276
13370
  const envService = new EnvironmentService(output);
13277
13371
  try {
13278
13372
  await envService.create({ configPath: args.config });
@@ -13381,7 +13475,7 @@ var GetCommand4 = {
13381
13475
  description: "JSON 输出"
13382
13476
  }),
13383
13477
  async handler(args) {
13384
- const output = new OutputService;
13478
+ const output = new OutputService2;
13385
13479
  const envService = new EnvironmentService(output);
13386
13480
  try {
13387
13481
  await envService.create({ configPath: args.config });
@@ -13551,7 +13645,7 @@ var AddCommand = {
13551
13645
  description: "JSON 输出"
13552
13646
  }),
13553
13647
  async handler(args) {
13554
- const output = new OutputService;
13648
+ const output = new OutputService2;
13555
13649
  const envService = new EnvironmentService(output);
13556
13650
  try {
13557
13651
  await envService.create({ configPath: args.config });
@@ -13627,7 +13721,7 @@ var DeleteCommand3 = {
13627
13721
  description: "JSON 输出"
13628
13722
  }),
13629
13723
  async handler(args) {
13630
- const output = new OutputService;
13724
+ const output = new OutputService2;
13631
13725
  const envService = new EnvironmentService(output);
13632
13726
  try {
13633
13727
  await envService.create({ configPath: args.config });
@@ -13683,7 +13777,7 @@ var ConfigDirCommand = {
13683
13777
  description: "JSON 输出"
13684
13778
  }),
13685
13779
  async handler(args) {
13686
- const output = new OutputService;
13780
+ const output = new OutputService2;
13687
13781
  const envService = new EnvironmentService(output);
13688
13782
  try {
13689
13783
  await envService.create({ configPath: args.config });
@@ -13750,7 +13844,7 @@ var ListCommand5 = {
13750
13844
  description: "简洁输出"
13751
13845
  }),
13752
13846
  async handler(args) {
13753
- const output = new OutputService;
13847
+ const output = new OutputService2;
13754
13848
  const envService = new EnvironmentService(output);
13755
13849
  try {
13756
13850
  await envService.create({ configPath: args.config });
@@ -13837,7 +13931,7 @@ var GetCommand5 = {
13837
13931
  description: "变量替换,格式:key=value"
13838
13932
  }),
13839
13933
  async handler(args) {
13840
- const output = new OutputService;
13934
+ const output = new OutputService2;
13841
13935
  const envService = new EnvironmentService(output);
13842
13936
  try {
13843
13937
  await envService.create({ configPath: args.config });
@@ -13926,7 +14020,7 @@ var AddCommand2 = {
13926
14020
  description: "JSON 输出"
13927
14021
  }),
13928
14022
  async handler(args) {
13929
- const output = new OutputService;
14023
+ const output = new OutputService2;
13930
14024
  const envService = new EnvironmentService(output);
13931
14025
  try {
13932
14026
  if (!args.file && !args.content) {
@@ -13978,7 +14072,7 @@ var ConfigDirCommand2 = {
13978
14072
  description: "JSON 输出"
13979
14073
  }),
13980
14074
  async handler(args) {
13981
- const output = new OutputService;
14075
+ const output = new OutputService2;
13982
14076
  const envService = new EnvironmentService(output);
13983
14077
  try {
13984
14078
  await envService.create({ configPath: args.config });
@@ -14073,7 +14167,7 @@ var CommandsListCommand = {
14073
14167
  type: "string"
14074
14168
  }),
14075
14169
  async handler(args) {
14076
- const output = new OutputService;
14170
+ const output = new OutputService2;
14077
14171
  const envService = new EnvironmentService(output);
14078
14172
  try {
14079
14173
  await envService.create({ configPath: args.config });
@@ -14156,7 +14250,7 @@ var CommandsAddCommand = {
14156
14250
  type: "string"
14157
14251
  }),
14158
14252
  async handler(args) {
14159
- const output = new OutputService;
14253
+ const output = new OutputService2;
14160
14254
  const envService = new EnvironmentService(output);
14161
14255
  try {
14162
14256
  await envService.create({ configPath: args.config });
@@ -14218,7 +14312,7 @@ var CommandsRemoveCommand = {
14218
14312
  type: "string"
14219
14313
  }),
14220
14314
  async handler(args) {
14221
- const output = new OutputService;
14315
+ const output = new OutputService2;
14222
14316
  const envService = new EnvironmentService(output);
14223
14317
  try {
14224
14318
  await envService.create({ configPath: args.config });
@@ -14315,7 +14409,7 @@ var CommandsInfoCommand = {
14315
14409
  type: "string"
14316
14410
  }),
14317
14411
  async handler(args) {
14318
- const output = new OutputService;
14412
+ const output = new OutputService2;
14319
14413
  const envService = new EnvironmentService(output);
14320
14414
  try {
14321
14415
  await envService.create({ configPath: args.config });
@@ -14376,7 +14470,7 @@ var CommandsDirsCommand = {
14376
14470
  type: "string"
14377
14471
  }),
14378
14472
  async handler(args) {
14379
- const output = new OutputService;
14473
+ const output = new OutputService2;
14380
14474
  const envService = new EnvironmentService(output);
14381
14475
  try {
14382
14476
  await envService.create({ configPath: args.config });
@@ -14691,7 +14785,7 @@ var ConfigListCommand = {
14691
14785
  alias: "c"
14692
14786
  }).example("roy-agent config list", "显示帮助信息").example("roy-agent config list tool", "查看 tool component 配置").example("roy-agent config list session", "查看 session component 配置").example("roy-agent config list all", "查看所有 components 概览").example("roy-agent config list tool --json", "JSON 格式输出").example("roy-agent config list tool --keys", "只显示配置键"),
14693
14787
  async handler(args) {
14694
- const output = new OutputService;
14788
+ const output = new OutputService2;
14695
14789
  const envService = new EnvironmentService(output);
14696
14790
  try {
14697
14791
  await envService.create({ configPath: args.config });
@@ -14983,7 +15077,7 @@ var ConfigExportCommand = {
14983
15077
  alias: "c"
14984
15078
  }).example("roy-agent config export agent --file agent-config.json", "导出 agent 配置").example("roy-agent config export session --file session-config.json", "导出 session 配置"),
14985
15079
  async handler(args) {
14986
- const output = new OutputService;
15080
+ const output = new OutputService2;
14987
15081
  const envService = new EnvironmentService(output);
14988
15082
  try {
14989
15083
  await envService.create({ configPath: args.config });
@@ -15051,7 +15145,7 @@ var ConfigImportCommand = {
15051
15145
  alias: "c"
15052
15146
  }).example("roy-agent config import session --file session-config.json", "导入 session 配置").example("roy-agent config import session --file session-config.json --dry-run", "预览变更").example("roy-agent config import session --file session-config.json --verbose", "显示详细信息"),
15053
15147
  async handler(args) {
15054
- const output = new OutputService;
15148
+ const output = new OutputService2;
15055
15149
  const envService = new EnvironmentService(output);
15056
15150
  try {
15057
15151
  await envService.create({ configPath: args.config });
@@ -15128,7 +15222,7 @@ var ListCommand6 = {
15128
15222
  description: "简洁输出"
15129
15223
  }),
15130
15224
  async handler(args) {
15131
- const output = new OutputService;
15225
+ const output = new OutputService2;
15132
15226
  const envService = new EnvironmentService(output);
15133
15227
  try {
15134
15228
  await envService.create({ configPath: args.config });
@@ -15226,7 +15320,7 @@ var ToolsCommand = {
15226
15320
  description: "简洁输出"
15227
15321
  }),
15228
15322
  async handler(args) {
15229
- const output = new OutputService;
15323
+ const output = new OutputService2;
15230
15324
  const envService = new EnvironmentService(output);
15231
15325
  try {
15232
15326
  await envService.create({ configPath: args.config });
@@ -15298,7 +15392,7 @@ var ReloadCommand2 = {
15298
15392
  describe: "重新加载 MCP 服务器",
15299
15393
  builder: (yargs) => yargs,
15300
15394
  async handler(args) {
15301
- const output = new OutputService;
15395
+ const output = new OutputService2;
15302
15396
  const envService = new EnvironmentService(output);
15303
15397
  try {
15304
15398
  await envService.create({ configPath: args.config });
@@ -15362,7 +15456,7 @@ var ListCommand7 = {
15362
15456
  description: "简洁输出(仅名称)"
15363
15457
  }),
15364
15458
  async handler(args) {
15365
- const output = new OutputService;
15459
+ const output = new OutputService2;
15366
15460
  const envService = new EnvironmentService(output);
15367
15461
  try {
15368
15462
  await envService.create({ configPath: args.config });
@@ -15462,7 +15556,7 @@ var GetCommand6 = {
15462
15556
  description: "JSON 输出"
15463
15557
  }),
15464
15558
  async handler(args) {
15465
- const output = new OutputService;
15559
+ const output = new OutputService2;
15466
15560
  const envService = new EnvironmentService(output);
15467
15561
  try {
15468
15562
  await envService.create({ configPath: args.config });
@@ -15537,7 +15631,7 @@ var ExecToolCommand = {
15537
15631
  }).strict(false);
15538
15632
  },
15539
15633
  async handler(args) {
15540
- const output = new OutputService;
15634
+ const output = new OutputService2;
15541
15635
  const envService = new EnvironmentService(output);
15542
15636
  const toolName = args.name;
15543
15637
  try {
@@ -15770,7 +15864,7 @@ var RecordCommand = {
15770
15864
  }),
15771
15865
  async handler(args) {
15772
15866
  const a = args;
15773
- const output = new OutputService;
15867
+ const output = new OutputService2;
15774
15868
  const envService = new EnvironmentService(output);
15775
15869
  try {
15776
15870
  await envService.create({ configPath: a.config });
@@ -15851,7 +15945,7 @@ var RecallCommand = {
15851
15945
  }),
15852
15946
  async handler(args) {
15853
15947
  const a = args;
15854
- const output = new OutputService;
15948
+ const output = new OutputService2;
15855
15949
  const envService = new EnvironmentService(output);
15856
15950
  try {
15857
15951
  await envService.create({ configPath: a.config });
@@ -15952,7 +16046,7 @@ var EventSourceListCommand = {
15952
16046
  default: false
15953
16047
  }),
15954
16048
  async handler(args) {
15955
- const output = new OutputService;
16049
+ const output = new OutputService2;
15956
16050
  output.configure({ quiet: args.quiet });
15957
16051
  const envService = new EnvironmentService(output);
15958
16052
  try {
@@ -16054,10 +16148,13 @@ var EventSourceAddCommand = {
16054
16148
  }).option("cron", {
16055
16149
  describe: "Cron 表达式",
16056
16150
  type: "string"
16151
+ }).option("prompt", {
16152
+ describe: "自定义 prompt 消息(timer 类型,替换默认 SelfReminder 内容)",
16153
+ type: "string"
16057
16154
  }),
16058
16155
  async handler(args) {
16059
16156
  const a = args;
16060
- const output = new OutputService;
16157
+ const output = new OutputService2;
16061
16158
  const envService = new EnvironmentService(output);
16062
16159
  try {
16063
16160
  await envService.create({ configPath: a.config });
@@ -16081,7 +16178,8 @@ var EventSourceAddCommand = {
16081
16178
  command: a.command,
16082
16179
  url: a.url,
16083
16180
  interval: a.interval,
16084
- cron: a.cron
16181
+ cron: a.cron,
16182
+ options: a.prompt ? { prompt: a.prompt } : undefined
16085
16183
  };
16086
16184
  esComponent.register(config);
16087
16185
  output.success(chalk55.green(`事件源 '${a.name}' 添加成功!`));
@@ -16097,6 +16195,9 @@ var EventSourceAddCommand = {
16097
16195
  if (a.interval) {
16098
16196
  output.log(` Interval: ${chalk55.gray(`${a.interval}ms`)}`);
16099
16197
  }
16198
+ if (a.prompt) {
16199
+ output.log(` Prompt: ${chalk55.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
16200
+ }
16100
16201
  output.log("");
16101
16202
  output.log(chalk55.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
16102
16203
  } finally {
@@ -16105,8 +16206,132 @@ var EventSourceAddCommand = {
16105
16206
  }
16106
16207
  };
16107
16208
 
16108
- // src/commands/eventsource/remove.ts
16209
+ // src/commands/eventsource/update.ts
16109
16210
  import chalk56 from "chalk";
16211
+ function findSource(esComponent, id) {
16212
+ const sources = esComponent.list();
16213
+ const matched = sources.find((s) => s.id === id || s.id.startsWith(id));
16214
+ if (!matched)
16215
+ return null;
16216
+ return { source: matched, fullId: matched.id };
16217
+ }
16218
+ var EventSourceUpdateCommand = {
16219
+ command: "update <id>",
16220
+ describe: "更新事件源配置(部分更新,type 不可改)",
16221
+ builder: (yargs) => yargs.positional("id", {
16222
+ describe: "事件源 ID(支持前缀匹配)",
16223
+ type: "string",
16224
+ demandOption: true
16225
+ }).option("name", {
16226
+ describe: "事件源名称",
16227
+ type: "string"
16228
+ }).option("interval", {
16229
+ alias: "i",
16230
+ describe: "定时器间隔(毫秒)",
16231
+ type: "number"
16232
+ }).option("event-types", {
16233
+ alias: "e",
16234
+ describe: "事件类型过滤(逗号分隔)",
16235
+ type: "string"
16236
+ }).option("command", {
16237
+ alias: "c",
16238
+ describe: "执行的命令(lark-cli 类型)",
16239
+ type: "string"
16240
+ }).option("url", {
16241
+ alias: "u",
16242
+ describe: "WebSocket URL",
16243
+ type: "string"
16244
+ }).option("cron", {
16245
+ describe: "Cron 表达式",
16246
+ type: "string"
16247
+ }).option("prompt", {
16248
+ describe: "自定义 prompt 消息(timer 类型)",
16249
+ type: "string"
16250
+ }).option("enabled", {
16251
+ describe: "是否启用",
16252
+ type: "boolean"
16253
+ }),
16254
+ async handler(args) {
16255
+ const a = args;
16256
+ const output = new OutputService2;
16257
+ const envService = new EnvironmentService(output);
16258
+ try {
16259
+ await envService.create({ configPath: a.config });
16260
+ const env = envService.getEnvironment();
16261
+ if (!env) {
16262
+ output.error("Failed to create environment");
16263
+ process.exit(1);
16264
+ }
16265
+ const esComponent = env.getComponent("event-source");
16266
+ if (!esComponent) {
16267
+ output.error("EventSourceComponent not available");
16268
+ process.exit(1);
16269
+ }
16270
+ const match = findSource(esComponent, a.id);
16271
+ if (!match) {
16272
+ output.error(`❌ 事件源不存在: ${a.id}`);
16273
+ const all = esComponent.list();
16274
+ if (all.length > 0) {
16275
+ output.info("");
16276
+ output.info(chalk56.gray("可用的事件源:"));
16277
+ for (const s of all) {
16278
+ output.info(` - ${s.id.substring(0, 8)}: ${s.name} (${s.type})`);
16279
+ }
16280
+ }
16281
+ process.exit(1);
16282
+ }
16283
+ const partial = {};
16284
+ if (a.name !== undefined)
16285
+ partial.name = a.name;
16286
+ if (a.interval !== undefined)
16287
+ partial.interval = a.interval;
16288
+ if (a.eventTypes !== undefined) {
16289
+ partial.eventTypes = a.eventTypes.split(",").map((s) => s.trim()).filter(Boolean);
16290
+ }
16291
+ if (a.command !== undefined)
16292
+ partial.command = a.command;
16293
+ if (a.url !== undefined)
16294
+ partial.url = a.url;
16295
+ if (a.cron !== undefined)
16296
+ partial.cron = a.cron;
16297
+ if (a.enabled !== undefined)
16298
+ partial.enabled = a.enabled;
16299
+ if (a.prompt !== undefined) {
16300
+ const existingOptions = match.source.options ?? {};
16301
+ partial.options = { ...existingOptions, prompt: a.prompt };
16302
+ }
16303
+ if (Object.keys(partial).length === 0) {
16304
+ output.error("❌ 请至少提供一个要更新的字段(如 --interval, --prompt 等)");
16305
+ process.exit(1);
16306
+ }
16307
+ try {
16308
+ const result = await esComponent.update(match.fullId, partial);
16309
+ output.success(chalk56.green(`✅ 事件源已更新: ${match.source.name}`));
16310
+ output.log("");
16311
+ output.log(chalk56.bold("修改字段:"));
16312
+ const before = match.source;
16313
+ const after = result.updated;
16314
+ for (const field of result.fields) {
16315
+ const beforeVal = JSON.stringify(before[field] ?? before.options?.[field]);
16316
+ const afterVal = JSON.stringify(after[field] ?? after.options?.[field]);
16317
+ output.log(` ${chalk56.cyan(field)}: ${chalk56.gray(beforeVal)} ${chalk56.gray("→")} ${chalk56.green(afterVal)}`);
16318
+ }
16319
+ output.log("");
16320
+ if (result.wasRunning) {
16321
+ output.info(chalk56.yellow(`⚠️ 事件源在更新前正在运行,已自动停止。请使用 'roy-agent eventsource start ${match.fullId.substring(0, 8)}' 手动启动以应用新配置。`));
16322
+ }
16323
+ } catch (error) {
16324
+ output.error(`❌ 更新失败: ${error instanceof Error ? error.message : String(error)}`);
16325
+ process.exit(1);
16326
+ }
16327
+ } finally {
16328
+ await envService.dispose();
16329
+ }
16330
+ }
16331
+ };
16332
+
16333
+ // src/commands/eventsource/remove.ts
16334
+ import chalk57 from "chalk";
16110
16335
  var EventSourceRemoveCommand = {
16111
16336
  command: "remove <id>",
16112
16337
  aliases: ["rm"],
@@ -16122,7 +16347,7 @@ var EventSourceRemoveCommand = {
16122
16347
  default: false
16123
16348
  }),
16124
16349
  async handler(args) {
16125
- const output = new OutputService;
16350
+ const output = new OutputService2;
16126
16351
  const envService = new EnvironmentService(output);
16127
16352
  try {
16128
16353
  await envService.create({ configPath: args.config });
@@ -16145,7 +16370,7 @@ var EventSourceRemoveCommand = {
16145
16370
  const status = esComponent.getStatus(matchedSource.id);
16146
16371
  if (status === "running" && !args.force) {
16147
16372
  output.error(`事件源正在运行中,请先停止: ${matchedSource.name} (${status})`);
16148
- output.log(chalk56.gray(`使用 --force 强制移除或 'roy-agent eventsource stop ${matchedSource.id.substring(0, 8)}' 先停止`));
16373
+ output.log(chalk57.gray(`使用 --force 强制移除或 'roy-agent eventsource stop ${matchedSource.id.substring(0, 8)}' 先停止`));
16149
16374
  process.exit(1);
16150
16375
  }
16151
16376
  if (status === "running") {
@@ -16154,7 +16379,7 @@ var EventSourceRemoveCommand = {
16154
16379
  }
16155
16380
  const result = esComponent.unregister(matchedSource.id);
16156
16381
  if (result) {
16157
- output.success(chalk56.green(`事件源已移除: ${matchedSource.name}`));
16382
+ output.success(chalk57.green(`事件源已移除: ${matchedSource.name}`));
16158
16383
  } else {
16159
16384
  output.error("移除失败");
16160
16385
  process.exit(1);
@@ -16166,7 +16391,7 @@ var EventSourceRemoveCommand = {
16166
16391
  };
16167
16392
 
16168
16393
  // src/commands/eventsource/start.ts
16169
- import chalk57 from "chalk";
16394
+ import chalk58 from "chalk";
16170
16395
  var EventSourceStartCommand = {
16171
16396
  command: "start <id>",
16172
16397
  describe: "启动指定的事件源",
@@ -16181,7 +16406,7 @@ var EventSourceStartCommand = {
16181
16406
  default: false
16182
16407
  }),
16183
16408
  async handler(args) {
16184
- const output = new OutputService;
16409
+ const output = new OutputService2;
16185
16410
  const envService = new EnvironmentService(output);
16186
16411
  try {
16187
16412
  await envService.create({ configPath: args.config });
@@ -16203,15 +16428,15 @@ var EventSourceStartCommand = {
16203
16428
  }
16204
16429
  const status = esComponent.getStatus(matchedSource.id);
16205
16430
  if (status === "running") {
16206
- output.log(chalk57.yellow(`事件源已在运行: ${matchedSource.name}`));
16431
+ output.log(chalk58.yellow(`事件源已在运行: ${matchedSource.name}`));
16207
16432
  return;
16208
16433
  }
16209
16434
  output.info(`正在启动事件源 '${matchedSource.name}'...`);
16210
16435
  try {
16211
16436
  await esComponent.startSource(matchedSource.id);
16212
- output.success(chalk57.green(`事件源已启动: ${matchedSource.name}`));
16437
+ output.success(chalk58.green(`事件源已启动: ${matchedSource.name}`));
16213
16438
  if (!args.background) {
16214
- output.log(chalk57.gray("按 Ctrl+C 停止..."));
16439
+ output.log(chalk58.gray("按 Ctrl+C 停止..."));
16215
16440
  await new Promise((resolve) => {
16216
16441
  const cleanup = () => {
16217
16442
  process.removeListener("SIGINT", cleanup);
@@ -16233,7 +16458,7 @@ var EventSourceStartCommand = {
16233
16458
  };
16234
16459
 
16235
16460
  // src/commands/eventsource/stop.ts
16236
- import chalk58 from "chalk";
16461
+ import chalk59 from "chalk";
16237
16462
  var EventSourceStopCommand = {
16238
16463
  command: "stop <id>",
16239
16464
  aliases: ["kill"],
@@ -16249,7 +16474,7 @@ var EventSourceStopCommand = {
16249
16474
  default: false
16250
16475
  }),
16251
16476
  async handler(args) {
16252
- const output = new OutputService;
16477
+ const output = new OutputService2;
16253
16478
  const envService = new EnvironmentService(output);
16254
16479
  try {
16255
16480
  await envService.create({ configPath: args.config });
@@ -16271,13 +16496,13 @@ var EventSourceStopCommand = {
16271
16496
  }
16272
16497
  const status = esComponent.getStatus(matchedSource.id);
16273
16498
  if (status !== "running") {
16274
- output.log(chalk58.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
16499
+ output.log(chalk59.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
16275
16500
  return;
16276
16501
  }
16277
16502
  output.info(`正在停止事件源 '${matchedSource.name}'...`);
16278
16503
  try {
16279
16504
  await esComponent.stopSource(matchedSource.id);
16280
- output.success(chalk58.green(`事件源已停止: ${matchedSource.name}`));
16505
+ output.success(chalk59.green(`事件源已停止: ${matchedSource.name}`));
16281
16506
  } catch (error) {
16282
16507
  output.error(`停止失败: ${error}`);
16283
16508
  process.exit(1);
@@ -16289,14 +16514,14 @@ var EventSourceStopCommand = {
16289
16514
  };
16290
16515
 
16291
16516
  // src/commands/eventsource/status.ts
16292
- import chalk59 from "chalk";
16517
+ import chalk60 from "chalk";
16293
16518
  var STATUS_COLORS = {
16294
- created: chalk59.gray,
16295
- starting: chalk59.yellow,
16296
- running: chalk59.green,
16297
- stopping: chalk59.yellow,
16298
- stopped: chalk59.gray,
16299
- error: chalk59.red
16519
+ created: chalk60.gray,
16520
+ starting: chalk60.yellow,
16521
+ running: chalk60.green,
16522
+ stopping: chalk60.yellow,
16523
+ stopped: chalk60.gray,
16524
+ error: chalk60.red
16300
16525
  };
16301
16526
  var STATUS_ICONS = {
16302
16527
  created: "○",
@@ -16328,7 +16553,7 @@ var EventSourceStatusCommand = {
16328
16553
  default: false
16329
16554
  }),
16330
16555
  async handler(args) {
16331
- const output = new OutputService;
16556
+ const output = new OutputService2;
16332
16557
  const envService = new EnvironmentService(output);
16333
16558
  try {
16334
16559
  await envService.create({ configPath: args.config });
@@ -16350,7 +16575,7 @@ var EventSourceStatusCommand = {
16350
16575
  process.exit(1);
16351
16576
  }
16352
16577
  const status = esComponent.getStatus(matchedSource.id) || "unknown";
16353
- const statusColor = STATUS_COLORS[status] || chalk59.gray;
16578
+ const statusColor = STATUS_COLORS[status] || chalk60.gray;
16354
16579
  if (args.json) {
16355
16580
  output.json({
16356
16581
  id: matchedSource.id,
@@ -16367,31 +16592,31 @@ var EventSourceStatusCommand = {
16367
16592
  });
16368
16593
  return;
16369
16594
  }
16370
- output.log(chalk59.bold("事件源详情"));
16595
+ output.log(chalk60.bold("事件源详情"));
16371
16596
  output.log("─".repeat(50));
16372
- output.log(` ID: ${chalk59.gray(matchedSource.id)}`);
16373
- output.log(` Name: ${chalk59.cyan(matchedSource.name)}`);
16374
- output.log(` Type: ${chalk59.cyan(matchedSource.type)}`);
16597
+ output.log(` ID: ${chalk60.gray(matchedSource.id)}`);
16598
+ output.log(` Name: ${chalk60.cyan(matchedSource.name)}`);
16599
+ output.log(` Type: ${chalk60.cyan(matchedSource.type)}`);
16375
16600
  output.log(` Status: ${statusColor(`${STATUS_ICONS[status]} ${STATUS_LABELS[status]}`)}`);
16376
- output.log(` Enabled: ${matchedSource.enabled ? chalk59.green("是") : chalk59.gray("否")}`);
16601
+ output.log(` Enabled: ${matchedSource.enabled ? chalk60.green("是") : chalk60.gray("否")}`);
16377
16602
  if (matchedSource.eventTypes?.length) {
16378
- output.log(` Events: ${chalk59.gray(matchedSource.eventTypes.join(", "))}`);
16603
+ output.log(` Events: ${chalk60.gray(matchedSource.eventTypes.join(", "))}`);
16379
16604
  }
16380
16605
  if (matchedSource.command) {
16381
- output.log(` Command: ${chalk59.gray(matchedSource.command)}`);
16606
+ output.log(` Command: ${chalk60.gray(matchedSource.command)}`);
16382
16607
  }
16383
16608
  if (matchedSource.interval) {
16384
- output.log(` Interval: ${chalk59.gray(`${matchedSource.interval}ms`)}`);
16609
+ output.log(` Interval: ${chalk60.gray(`${matchedSource.interval}ms`)}`);
16385
16610
  }
16386
16611
  if (matchedSource.url) {
16387
- output.log(` URL: ${chalk59.gray(matchedSource.url)}`);
16612
+ output.log(` URL: ${chalk60.gray(matchedSource.url)}`);
16388
16613
  }
16389
16614
  output.log("");
16390
16615
  return;
16391
16616
  }
16392
16617
  const sources = esComponent.list();
16393
16618
  if (sources.length === 0) {
16394
- output.log(chalk59.yellow("没有配置的事件源"));
16619
+ output.log(chalk60.yellow("没有配置的事件源"));
16395
16620
  return;
16396
16621
  }
16397
16622
  if (args.json) {
@@ -16405,21 +16630,21 @@ var EventSourceStatusCommand = {
16405
16630
  output.json({ sources: sourcesWithStatus, count: sources.length });
16406
16631
  return;
16407
16632
  }
16408
- output.log(chalk59.bold("事件源状态概览"));
16633
+ output.log(chalk60.bold("事件源状态概览"));
16409
16634
  output.log("─".repeat(60));
16410
16635
  for (const source of sources) {
16411
16636
  const status = esComponent.getStatus(source.id) || "unknown";
16412
- const statusColor = STATUS_COLORS[status] || chalk59.gray;
16637
+ const statusColor = STATUS_COLORS[status] || chalk60.gray;
16413
16638
  const icon = STATUS_ICONS[status] || "?";
16414
16639
  const label = STATUS_LABELS[status] || status;
16415
16640
  output.log("");
16416
- output.log(` ${chalk59.cyan(source.name)} ${chalk59.gray(`(${source.type})`)}`);
16641
+ output.log(` ${chalk60.cyan(source.name)} ${chalk60.gray(`(${source.type})`)}`);
16417
16642
  output.log(` └─ Status: ${statusColor(`${icon} ${label}`)}`);
16418
- output.log(` ID: ${chalk59.gray(source.id.substring(0, 8))}...`);
16643
+ output.log(` ID: ${chalk60.gray(source.id.substring(0, 8))}...`);
16419
16644
  }
16420
16645
  output.log("");
16421
16646
  const runningCount = sources.filter((s) => esComponent.getStatus(s.id) === "running").length;
16422
- output.log(chalk59.green(`✅ ${runningCount}/${sources.length} 运行中`));
16647
+ output.log(chalk60.green(`✅ ${runningCount}/${sources.length} 运行中`));
16423
16648
  } finally {
16424
16649
  await envService.dispose();
16425
16650
  }
@@ -16431,7 +16656,7 @@ var EventSourceCommand = {
16431
16656
  command: "eventsource",
16432
16657
  aliases: ["es", "event-source"],
16433
16658
  describe: "事件源管理 - 添加、启动、停止各种事件源(lark-cli、timer、websocket)",
16434
- builder: (yargs) => yargs.command(EventSourceListCommand).command(EventSourceAddCommand).command(EventSourceRemoveCommand).command(EventSourceStartCommand).command(EventSourceStopCommand).command(EventSourceStatusCommand).demandCommand().help(),
16659
+ builder: (yargs) => yargs.command(EventSourceListCommand).command(EventSourceAddCommand).command(EventSourceUpdateCommand).command(EventSourceRemoveCommand).command(EventSourceStartCommand).command(EventSourceStopCommand).command(EventSourceStatusCommand).demandCommand().help(),
16435
16660
  handler: () => {}
16436
16661
  };
16437
16662
 
@@ -16732,7 +16957,7 @@ var DebugCommand = {
16732
16957
  };
16733
16958
 
16734
16959
  // src/commands/workflow/renderers.ts
16735
- import chalk60 from "chalk";
16960
+ import chalk61 from "chalk";
16736
16961
  function truncateVisual3(str, maxWidth) {
16737
16962
  if (!str)
16738
16963
  return "-";
@@ -16767,18 +16992,18 @@ function formatDuration(ms) {
16767
16992
  function statusColor(status) {
16768
16993
  switch (status) {
16769
16994
  case "completed":
16770
- return chalk60.green;
16995
+ return chalk61.green;
16771
16996
  case "running":
16772
16997
  case "idle":
16773
- return chalk60.blue;
16998
+ return chalk61.blue;
16774
16999
  case "paused":
16775
- return chalk60.yellow;
17000
+ return chalk61.yellow;
16776
17001
  case "failed":
16777
- return chalk60.red;
17002
+ return chalk61.red;
16778
17003
  case "stopped":
16779
- return chalk60.gray;
17004
+ return chalk61.gray;
16780
17005
  default:
16781
- return chalk60.white;
17006
+ return chalk61.white;
16782
17007
  }
16783
17008
  }
16784
17009
  function renderWorkflowList(workflows, options) {
@@ -16797,7 +17022,7 @@ function renderWorkflowList(workflows, options) {
16797
17022
  }, null, 2);
16798
17023
  }
16799
17024
  if (workflows.length === 0) {
16800
- return chalk60.yellow("No workflows found");
17025
+ return chalk61.yellow("No workflows found");
16801
17026
  }
16802
17027
  const NAME_WIDTH = 30;
16803
17028
  const VERSION_WIDTH = 10;
@@ -16805,10 +17030,10 @@ function renderWorkflowList(workflows, options) {
16805
17030
  const UPDATED_WIDTH = 20;
16806
17031
  const GAP = " ";
16807
17032
  const headerLine = [
16808
- chalk60.bold("NAME".padEnd(NAME_WIDTH)),
16809
- chalk60.bold("VER".padEnd(VERSION_WIDTH)),
16810
- chalk60.bold("TAGS".padEnd(TAGS_WIDTH)),
16811
- chalk60.bold("UPDATED")
17033
+ chalk61.bold("NAME".padEnd(NAME_WIDTH)),
17034
+ chalk61.bold("VER".padEnd(VERSION_WIDTH)),
17035
+ chalk61.bold("TAGS".padEnd(TAGS_WIDTH)),
17036
+ chalk61.bold("UPDATED")
16812
17037
  ].join(GAP);
16813
17038
  const sepLine = "─".repeat(NAME_WIDTH + VERSION_WIDTH + TAGS_WIDTH + UPDATED_WIDTH + GAP.length * 3);
16814
17039
  const rows = workflows.map((w) => {
@@ -16823,18 +17048,18 @@ function renderWorkflowList(workflows, options) {
16823
17048
  }
16824
17049
  function renderWorkflowDetail(workflow, options) {
16825
17050
  const lines = [];
16826
- lines.push(chalk60.bold(`
17051
+ lines.push(chalk61.bold(`
16827
17052
  \uD83D\uDCCB Workflow Details
16828
17053
  `));
16829
- lines.push(` ${chalk60.cyan("ID:")} ${workflow.id}`);
16830
- lines.push(` ${chalk60.cyan("Name:")} ${workflow.name}`);
16831
- lines.push(` ${chalk60.cyan("Version:")} ${workflow.version}`);
16832
- lines.push(` ${chalk60.cyan("Description:")} ${workflow.description || "-"}`);
16833
- lines.push(` ${chalk60.cyan("Tags:")} ${workflow.tags.join(", ") || "-"}`);
16834
- lines.push(` ${chalk60.cyan("Created:")} ${formatDate(workflow.createdAt)}`);
16835
- lines.push(` ${chalk60.cyan("Updated:")} ${formatDate(workflow.updatedAt)}`);
17054
+ lines.push(` ${chalk61.cyan("ID:")} ${workflow.id}`);
17055
+ lines.push(` ${chalk61.cyan("Name:")} ${workflow.name}`);
17056
+ lines.push(` ${chalk61.cyan("Version:")} ${workflow.version}`);
17057
+ lines.push(` ${chalk61.cyan("Description:")} ${workflow.description || "-"}`);
17058
+ lines.push(` ${chalk61.cyan("Tags:")} ${workflow.tags.join(", ") || "-"}`);
17059
+ lines.push(` ${chalk61.cyan("Created:")} ${formatDate(workflow.createdAt)}`);
17060
+ lines.push(` ${chalk61.cyan("Updated:")} ${formatDate(workflow.updatedAt)}`);
16836
17061
  const nodeCount = workflow.definition.nodes.length;
16837
- lines.push(chalk60.bold(`
17062
+ lines.push(chalk61.bold(`
16838
17063
  \uD83D\uDCCA Nodes Summary
16839
17064
  `));
16840
17065
  lines.push(` Total: ${nodeCount} nodes`);
@@ -16846,7 +17071,7 @@ function renderWorkflowDetail(workflow, options) {
16846
17071
  lines.push(` - ${type}: ${count}`);
16847
17072
  }
16848
17073
  if (workflow.definition.config) {
16849
- lines.push(chalk60.bold(`
17074
+ lines.push(chalk61.bold(`
16850
17075
  ⚙️ Configuration
16851
17076
  `));
16852
17077
  if (workflow.definition.config.parallel_limit !== undefined) {
@@ -16860,7 +17085,7 @@ function renderWorkflowDetail(workflow, options) {
16860
17085
  }
16861
17086
  }
16862
17087
  if (options?.includeRuns && options.includeRuns.length > 0) {
16863
- lines.push(chalk60.bold(`
17088
+ lines.push(chalk61.bold(`
16864
17089
  \uD83D\uDCDC Recent Runs
16865
17090
  `));
16866
17091
  lines.push(renderRunsList(options.includeRuns.slice(0, 5)));
@@ -16884,7 +17109,7 @@ function renderRunsList(runs, options) {
16884
17109
  }, null, 2);
16885
17110
  }
16886
17111
  if (runs.length === 0) {
16887
- return chalk60.yellow("No runs found");
17112
+ return chalk61.yellow("No runs found");
16888
17113
  }
16889
17114
  const ID_WIDTH = 20;
16890
17115
  const STATUS_WIDTH = 12;
@@ -16892,10 +17117,10 @@ function renderRunsList(runs, options) {
16892
17117
  const UPDATED_WIDTH = 20;
16893
17118
  const GAP = " ";
16894
17119
  const headerLine = [
16895
- chalk60.bold("RUN ID".padEnd(ID_WIDTH)),
16896
- chalk60.bold("STATUS".padEnd(STATUS_WIDTH)),
16897
- chalk60.bold("DURATION".padEnd(DURATION_WIDTH)),
16898
- chalk60.bold("STARTED")
17120
+ chalk61.bold("RUN ID".padEnd(ID_WIDTH)),
17121
+ chalk61.bold("STATUS".padEnd(STATUS_WIDTH)),
17122
+ chalk61.bold("DURATION".padEnd(DURATION_WIDTH)),
17123
+ chalk61.bold("STARTED")
16899
17124
  ].join(GAP);
16900
17125
  const sepLine = "─".repeat(ID_WIDTH + STATUS_WIDTH + DURATION_WIDTH + UPDATED_WIDTH + GAP.length * 3);
16901
17126
  const rows = runs.map((r) => {
@@ -16910,34 +17135,34 @@ function renderRunsList(runs, options) {
16910
17135
  }
16911
17136
  function renderRunDetail(run) {
16912
17137
  const lines = [];
16913
- lines.push(chalk60.bold(`
17138
+ lines.push(chalk61.bold(`
16914
17139
  \uD83C\uDFC3 Run Details
16915
17140
  `));
16916
- lines.push(` ${chalk60.cyan("Run ID:")} ${run.id}`);
16917
- lines.push(` ${chalk60.cyan("Workflow:")} ${run.workflowId}`);
16918
- lines.push(` ${chalk60.cyan("Status:")} ${statusColor(run.status)(run.status)}`);
16919
- lines.push(` ${chalk60.cyan("Started:")} ${formatDate(run.startedAt)}`);
17141
+ lines.push(` ${chalk61.cyan("Run ID:")} ${run.id}`);
17142
+ lines.push(` ${chalk61.cyan("Workflow:")} ${run.workflowId}`);
17143
+ lines.push(` ${chalk61.cyan("Status:")} ${statusColor(run.status)(run.status)}`);
17144
+ lines.push(` ${chalk61.cyan("Started:")} ${formatDate(run.startedAt)}`);
16920
17145
  if (run.pausedAt) {
16921
- lines.push(` ${chalk60.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
17146
+ lines.push(` ${chalk61.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
16922
17147
  }
16923
17148
  if (run.resumedAt) {
16924
- lines.push(` ${chalk60.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
17149
+ lines.push(` ${chalk61.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
16925
17150
  }
16926
17151
  if (run.stoppedAt) {
16927
- lines.push(` ${chalk60.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
17152
+ lines.push(` ${chalk61.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
16928
17153
  }
16929
17154
  if (run.completedAt) {
16930
- lines.push(` ${chalk60.cyan("Completed:")} ${formatDate(run.completedAt)}`);
17155
+ lines.push(` ${chalk61.cyan("Completed:")} ${formatDate(run.completedAt)}`);
16931
17156
  }
16932
- lines.push(` ${chalk60.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
17157
+ lines.push(` ${chalk61.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
16933
17158
  if (run.error) {
16934
- lines.push(chalk60.bold(`
17159
+ lines.push(chalk61.bold(`
16935
17160
  ❌ Error
16936
17161
  `));
16937
- lines.push(` ${chalk60.red(run.error)}`);
17162
+ lines.push(` ${chalk61.red(run.error)}`);
16938
17163
  }
16939
17164
  if (run.output) {
16940
- lines.push(chalk60.bold(`
17165
+ lines.push(chalk61.bold(`
16941
17166
  \uD83D\uDCE4 Output
16942
17167
  `));
16943
17168
  lines.push(" " + JSON.stringify(run.output, null, 2).split(`
@@ -16948,36 +17173,36 @@ function renderRunDetail(run) {
16948
17173
  `);
16949
17174
  }
16950
17175
  function renderWorkflowAdded(workflow) {
16951
- return chalk60.green(`
17176
+ return chalk61.green(`
16952
17177
  ✅ Workflow '${workflow.name}' added successfully
16953
17178
  `) + ` ID: ${workflow.id}
16954
17179
  ` + ` Version: ${workflow.version}
16955
17180
  `;
16956
17181
  }
16957
17182
  function renderWorkflowUpdated(workflow) {
16958
- return chalk60.green(`
17183
+ return chalk61.green(`
16959
17184
  ✅ Workflow '${workflow.name}' updated successfully
16960
17185
  `) + ` ID: ${workflow.id}
16961
17186
  `;
16962
17187
  }
16963
17188
  function renderWorkflowDeleted(name) {
16964
- return chalk60.green(`
17189
+ return chalk61.green(`
16965
17190
  ✅ Workflow '${name}' deleted successfully
16966
17191
  `);
16967
17192
  }
16968
17193
  function renderRunResult(result) {
16969
17194
  const lines = [];
16970
17195
  if (result.status === "completed") {
16971
- lines.push(chalk60.green(`
17196
+ lines.push(chalk61.green(`
16972
17197
  ✅ Workflow completed successfully`));
16973
17198
  } else if (result.status === "failed") {
16974
- lines.push(chalk60.red(`
17199
+ lines.push(chalk61.red(`
16975
17200
  ❌ Workflow failed`));
16976
17201
  } else if (result.status === "stopped") {
16977
- lines.push(chalk60.yellow(`
17202
+ lines.push(chalk61.yellow(`
16978
17203
  ⚠️ Workflow stopped`));
16979
17204
  } else {
16980
- lines.push(chalk60.blue(`
17205
+ lines.push(chalk61.blue(`
16981
17206
  \uD83D\uDD04 Workflow ${result.status}`));
16982
17207
  }
16983
17208
  lines.push(` Run ID: ${result.runId}`);
@@ -16985,11 +17210,11 @@ function renderRunResult(result) {
16985
17210
  lines.push(` Duration: ${formatDuration(result.durationMs)}`);
16986
17211
  }
16987
17212
  if (result.error) {
16988
- lines.push(chalk60.red(`
17213
+ lines.push(chalk61.red(`
16989
17214
  Error: ${result.error}`));
16990
17215
  }
16991
17216
  if (result.output) {
16992
- lines.push(chalk60.bold(`
17217
+ lines.push(chalk61.bold(`
16993
17218
  \uD83D\uDCE4 Output:`));
16994
17219
  lines.push(JSON.stringify(result.output, null, 2));
16995
17220
  }
@@ -17003,10 +17228,10 @@ function renderNodesList(nodes) {
17003
17228
  const DEPS_WIDTH = 20;
17004
17229
  const GAP = " ";
17005
17230
  const headerLine = [
17006
- chalk60.bold("NODE ID".padEnd(ID_WIDTH)),
17007
- chalk60.bold("TYPE".padEnd(TYPE_WIDTH)),
17008
- chalk60.bold("NAME".padEnd(NAME_WIDTH)),
17009
- chalk60.bold("DEPENDS ON")
17231
+ chalk61.bold("NODE ID".padEnd(ID_WIDTH)),
17232
+ chalk61.bold("TYPE".padEnd(TYPE_WIDTH)),
17233
+ chalk61.bold("NAME".padEnd(NAME_WIDTH)),
17234
+ chalk61.bold("DEPENDS ON")
17010
17235
  ].join(GAP);
17011
17236
  const sepLine = "─".repeat(ID_WIDTH + TYPE_WIDTH + NAME_WIDTH + DEPS_WIDTH + GAP.length * 3);
17012
17237
  const rows = nodes.map((n) => {
@@ -17021,7 +17246,7 @@ function renderNodesList(nodes) {
17021
17246
  }
17022
17247
 
17023
17248
  // src/commands/workflow/commands/list.ts
17024
- import chalk61 from "chalk";
17249
+ import chalk62 from "chalk";
17025
17250
  import { createWorkflowListTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
17026
17251
  var WorkflowListCommand = {
17027
17252
  command: "list",
@@ -17084,7 +17309,7 @@ var WorkflowListCommand = {
17084
17309
  type: "string"
17085
17310
  }),
17086
17311
  async handler(args) {
17087
- const output = new OutputService;
17312
+ const output = new OutputService2;
17088
17313
  const envService = new EnvironmentService(output);
17089
17314
  try {
17090
17315
  await envService.create({ configPath: args.config });
@@ -17159,20 +17384,20 @@ var WorkflowListCommand = {
17159
17384
  if (total > workflows.length) {
17160
17385
  const start = finalOffset + 1;
17161
17386
  const end = finalOffset + workflows.length;
17162
- output.log(chalk61.green(`
17387
+ output.log(chalk62.green(`
17163
17388
  ✅ 显示 ${start}-${end} / 共 ${total} 个 Workflow`));
17164
17389
  const totalPages = Math.ceil(total / pageSize);
17165
17390
  const currentPage = Math.floor(finalOffset / pageSize) + 1;
17166
17391
  if (totalPages > 1) {
17167
- output.log(chalk61.cyan(`\uD83D\uDCC4 第 ${currentPage} / ${totalPages} 页`));
17392
+ output.log(chalk62.cyan(`\uD83D\uDCC4 第 ${currentPage} / ${totalPages} 页`));
17168
17393
  }
17169
17394
  } else {
17170
- output.log(chalk61.green(`
17395
+ output.log(chalk62.green(`
17171
17396
  ✅ 共 ${total} 个 Workflow`));
17172
17397
  }
17173
17398
  if (availableTags.length > 0) {
17174
17399
  const tagsLine = availableTags.map((t) => `${t.name}(${t.count})`).join(", ");
17175
- output.log(chalk61.cyan(`
17400
+ output.log(chalk62.cyan(`
17176
17401
  \uD83C\uDFF7️ Available tags: ${tagsLine}`));
17177
17402
  }
17178
17403
  }
@@ -17775,7 +18000,7 @@ class WorkflowValidator {
17775
18000
  }
17776
18001
 
17777
18002
  // src/commands/workflow/commands/add.ts
17778
- import chalk62 from "chalk";
18003
+ import chalk63 from "chalk";
17779
18004
  import fs3 from "fs";
17780
18005
  import path6 from "path";
17781
18006
  import { createWorkflowExtractorAgent } from "@ai-setting/roy-agent-core/env/task/plugins";
@@ -17868,7 +18093,7 @@ var WorkflowAddCommand = {
17868
18093
  不要用 bash tool + command 输出多行内容(shell 会执行失败)。`),
17869
18094
  async handler(args) {
17870
18095
  const a = args;
17871
- const output = new OutputService;
18096
+ const output = new OutputService2;
17872
18097
  const envService = new EnvironmentService(output);
17873
18098
  try {
17874
18099
  let parseTags = function(input) {
@@ -17918,7 +18143,7 @@ var WorkflowAddCommand = {
17918
18143
  definition = await parseWorkflowContent(content, filePath);
17919
18144
  workflowName = a.name || definition.name || path6.basename(filePath);
17920
18145
  if (a.validate) {
17921
- output.log(chalk62.blue("\uD83D\uDD0D Validating workflow..."));
18146
+ output.log(chalk63.blue("\uD83D\uDD0D Validating workflow..."));
17922
18147
  const validator = new WorkflowValidator;
17923
18148
  const result = validator.validate(definition);
17924
18149
  if (!result.valid) {
@@ -17933,11 +18158,11 @@ var WorkflowAddCommand = {
17933
18158
  });
17934
18159
  process.exit(1);
17935
18160
  }
17936
- output.log(chalk62.green(`✅ Workflow validation passed
18161
+ output.log(chalk63.green(`✅ Workflow validation passed
17937
18162
  `));
17938
18163
  }
17939
18164
  } else if (a.desc) {
17940
- output.log(chalk62.blue(`\uD83E\uDD16 Generating workflow from description...
18165
+ output.log(chalk63.blue(`\uD83E\uDD16 Generating workflow from description...
17941
18166
  `));
17942
18167
  const agentComponent = env.getComponent("agent");
17943
18168
  if (!agentComponent) {
@@ -17945,10 +18170,10 @@ var WorkflowAddCommand = {
17945
18170
  process.exit(1);
17946
18171
  }
17947
18172
  if (!agentComponent.getAgent("workflow-extractor")) {
17948
- output.log(chalk62.gray("Auto-registering workflow-extractor agent..."));
18173
+ output.log(chalk63.gray("Auto-registering workflow-extractor agent..."));
17949
18174
  const extractorConfig = createWorkflowExtractorAgent();
17950
18175
  agentComponent.registerAgent(extractorConfig.name, extractorConfig);
17951
- output.log(chalk62.green(`✅ workflow-extractor agent registered
18176
+ output.log(chalk63.green(`✅ workflow-extractor agent registered
17952
18177
  `));
17953
18178
  }
17954
18179
  const prompt = `## 任务
@@ -17962,20 +18187,20 @@ ${a.desc}
17962
18187
  1. 先用 \`roy-agent workflow nodes\` 查看可用的节点类型
17963
18188
  2. 生成的 YAML 必须通过 \`roy-agent workflow validate --yaml "<yaml>"\` 验证
17964
18189
  3. 验证通过后才输出最终 YAML`;
17965
- output.log(chalk62.gray("Running workflow-extractor agent..."));
18190
+ output.log(chalk63.gray("Running workflow-extractor agent..."));
17966
18191
  const result = await agentComponent.run("workflow-extractor", prompt);
17967
18192
  const agentOutput = result.finalText || "";
17968
18193
  definition = parseYamlFromAgentOutput(agentOutput);
17969
18194
  if (definition === null) {
17970
18195
  output.error("Failed to parse workflow from agent output");
17971
- output.log(chalk62.gray(`
18196
+ output.log(chalk63.gray(`
17972
18197
  Agent output:
17973
18198
  ` + agentOutput.slice(0, 500)));
17974
18199
  process.exit(1);
17975
18200
  }
17976
18201
  workflowName = a.name || definition.name;
17977
18202
  if (a.validate) {
17978
- output.log(chalk62.blue(`
18203
+ output.log(chalk63.blue(`
17979
18204
  \uD83D\uDD0D Validating generated workflow...`));
17980
18205
  const validator = new WorkflowValidator;
17981
18206
  const result2 = validator.validate(definition);
@@ -17989,16 +18214,16 @@ Agent output:
17989
18214
  output.error(` Fix: ${error.fix}
17990
18215
  `);
17991
18216
  });
17992
- output.log(chalk62.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
18217
+ output.log(chalk63.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
17993
18218
  process.exit(1);
17994
18219
  }
17995
- output.log(chalk62.green(`✅ Generated workflow validation passed
18220
+ output.log(chalk63.green(`✅ Generated workflow validation passed
17996
18221
  `));
17997
18222
  }
17998
18223
  const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
17999
- output.log(chalk62.gray("--- Generated YAML ---"));
18224
+ output.log(chalk63.gray("--- Generated YAML ---"));
18000
18225
  output.log(yaml.stringify(definition));
18001
- output.log(chalk62.gray(`------------------------
18226
+ output.log(chalk63.gray(`------------------------
18002
18227
  `));
18003
18228
  } else {
18004
18229
  output.error("Please provide --file or --desc option");
@@ -18024,10 +18249,10 @@ Agent output:
18024
18249
  force: a.force
18025
18250
  });
18026
18251
  output.log(renderWorkflowAdded(workflow));
18027
- output.log(chalk62.bold(`
18252
+ output.log(chalk63.bold(`
18028
18253
  \uD83D\uDCCA Nodes Summary:`));
18029
18254
  output.log(renderNodesList(definition.nodes));
18030
- output.log(chalk62.green(`
18255
+ output.log(chalk63.green(`
18031
18256
  ✅ Workflow '${workflowName}' added successfully`));
18032
18257
  } catch (error) {
18033
18258
  if (error.message?.includes("already exists") && !a.force) {
@@ -18044,7 +18269,7 @@ Agent output:
18044
18269
  };
18045
18270
 
18046
18271
  // src/commands/workflow/commands/get.ts
18047
- import chalk63 from "chalk";
18272
+ import chalk64 from "chalk";
18048
18273
  import { createWorkflowGetTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
18049
18274
  var WorkflowGetCommand = {
18050
18275
  command: "get <identifier>",
@@ -18080,7 +18305,7 @@ var WorkflowGetCommand = {
18080
18305
  type: "string"
18081
18306
  }),
18082
18307
  async handler(args) {
18083
- const output = new OutputService;
18308
+ const output = new OutputService2;
18084
18309
  const envService = new EnvironmentService(output);
18085
18310
  try {
18086
18311
  await envService.create({ configPath: args.config });
@@ -18182,15 +18407,15 @@ var WorkflowGetCommand = {
18182
18407
  } else {
18183
18408
  output.log(renderWorkflowDetail(workflow, { includeRuns: runs }));
18184
18409
  if (args.includeNodes) {
18185
- output.log(chalk63.bold(`
18410
+ output.log(chalk64.bold(`
18186
18411
  \uD83D\uDCCB All Nodes:`));
18187
18412
  output.log(renderNodesList(data.nodes || []));
18188
18413
  }
18189
18414
  const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
18190
18415
  const defYaml = yaml.stringify(data.definition || {}, { indent: 2 });
18191
- output.log(chalk63.bold(`
18416
+ output.log(chalk64.bold(`
18192
18417
  \uD83D\uDCC4 Definition (YAML):`));
18193
- output.log(chalk63.gray(defYaml));
18418
+ output.log(chalk64.gray(defYaml));
18194
18419
  }
18195
18420
  }
18196
18421
  } catch (error) {
@@ -18203,7 +18428,7 @@ var WorkflowGetCommand = {
18203
18428
  };
18204
18429
 
18205
18430
  // src/commands/workflow/commands/update.ts
18206
- import chalk64 from "chalk";
18431
+ import chalk65 from "chalk";
18207
18432
  import fs4 from "fs";
18208
18433
  import path7 from "path";
18209
18434
  import { parseWorkflowFile } from "@ai-setting/roy-agent-core/env/workflow/types";
@@ -18236,7 +18461,7 @@ var WorkflowUpdateCommand = {
18236
18461
  }),
18237
18462
  async handler(args) {
18238
18463
  const a = args;
18239
- const output = new OutputService;
18464
+ const output = new OutputService2;
18240
18465
  const envService = new EnvironmentService(output);
18241
18466
  try {
18242
18467
  await envService.create({ configPath: a.config });
@@ -18276,7 +18501,7 @@ var WorkflowUpdateCommand = {
18276
18501
  const tags = a.tags ? a.tags.split(",").map((t) => t.trim()) : undefined;
18277
18502
  const workflow = await service.updateWorkflow(a.name, updates, { tags });
18278
18503
  output.log(renderWorkflowUpdated(workflow));
18279
- output.log(chalk64.green(`
18504
+ output.log(chalk65.green(`
18280
18505
  ✅ Workflow '${a.name}' updated successfully`));
18281
18506
  } catch (error) {
18282
18507
  output.error(`Failed to update workflow: ${error}`);
@@ -18288,7 +18513,7 @@ var WorkflowUpdateCommand = {
18288
18513
  };
18289
18514
 
18290
18515
  // src/commands/workflow/commands/remove.ts
18291
- import chalk65 from "chalk";
18516
+ import chalk66 from "chalk";
18292
18517
  var WorkflowRemoveCommand = {
18293
18518
  command: "remove <name>",
18294
18519
  describe: "删除 Workflow",
@@ -18306,7 +18531,7 @@ var WorkflowRemoveCommand = {
18306
18531
  type: "string"
18307
18532
  }),
18308
18533
  async handler(args) {
18309
- const output = new OutputService;
18534
+ const output = new OutputService2;
18310
18535
  const envService = new EnvironmentService(output);
18311
18536
  try {
18312
18537
  await envService.create({ configPath: args.config });
@@ -18327,8 +18552,8 @@ var WorkflowRemoveCommand = {
18327
18552
  process.exit(1);
18328
18553
  }
18329
18554
  if (!args.force) {
18330
- output.log(chalk65.yellow(`Are you sure you want to delete workflow '${args.name}'?`));
18331
- output.log(chalk65.gray("Use --force to skip confirmation"));
18555
+ output.log(chalk66.yellow(`Are you sure you want to delete workflow '${args.name}'?`));
18556
+ output.log(chalk66.gray("Use --force to skip confirmation"));
18332
18557
  process.exit(1);
18333
18558
  }
18334
18559
  const deleted = await service.deleteWorkflow(args.name);
@@ -18348,13 +18573,13 @@ var WorkflowRemoveCommand = {
18348
18573
 
18349
18574
  // src/commands/workflow/commands/run.ts
18350
18575
  var import_yaml = __toESM(require_dist(), 1);
18351
- import chalk66 from "chalk";
18576
+ import chalk67 from "chalk";
18352
18577
  import fs5 from "fs";
18353
18578
  import path8 from "path";
18354
18579
  import { createRunWorkflowTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
18355
18580
  import { getTracerProvider as getTracerProvider4, propagation, wrapFunction } from "@ai-setting/roy-agent-core";
18356
18581
  var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
18357
- const output = new OutputService;
18582
+ const output = new OutputService2;
18358
18583
  const envService = new EnvironmentService(output);
18359
18584
  const traceparent = process.env.TRACEPARENT;
18360
18585
  let traceId;
@@ -18422,7 +18647,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
18422
18647
  };
18423
18648
  if (args.sessionId) {
18424
18649
  const sessionId = args.sessionId.startsWith("workflow_") ? args.sessionId : `workflow_${args.sessionId}`;
18425
- output.log(chalk66.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
18650
+ output.log(chalk67.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
18426
18651
  const sessionComponent = workflowComponent.sessionComponent;
18427
18652
  if (!sessionComponent) {
18428
18653
  output.error("SessionComponent not available");
@@ -18484,17 +18709,17 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
18484
18709
  definition = { ...definition, name: args.name };
18485
18710
  }
18486
18711
  const workflow = await service.createWorkflow(definition, { force: true });
18487
- output.log(chalk66.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
18488
- output.log(chalk66.green(`✅ Workflow registered: ${workflow.name} (${workflow.id})`));
18712
+ output.log(chalk67.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
18713
+ output.log(chalk67.green(`✅ Workflow registered: ${workflow.name} (${workflow.id})`));
18489
18714
  if (args.registerOnly) {
18490
- output.log(chalk66.gray("ℹ️ Use --register-only, skipping execution"));
18715
+ output.log(chalk67.gray("ℹ️ Use --register-only, skipping execution"));
18491
18716
  if (workflowSpan) {
18492
18717
  workflowSpan.end();
18493
18718
  }
18494
18719
  await envService.dispose();
18495
18720
  process.exit(0);
18496
18721
  }
18497
- output.log(chalk66.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
18722
+ output.log(chalk67.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
18498
18723
  const result = await service.runWorkflow(definition, input, runOptions);
18499
18724
  output.log(renderRunResult({
18500
18725
  runId: result.runId,
@@ -18504,7 +18729,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
18504
18729
  durationMs: result.durationMs
18505
18730
  }));
18506
18731
  if (result.status === "paused") {
18507
- output.log(chalk66.gray(`
18732
+ output.log(chalk67.gray(`
18508
18733
  \uD83D\uDCA1 Use "roy-agent workflow run ${result.runId} --session-id ${result.runId} --input '<response>'" to resume`));
18509
18734
  }
18510
18735
  } else {
@@ -18527,7 +18752,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
18527
18752
  durationMs: runData.duration_ms
18528
18753
  }));
18529
18754
  if (runData.status === "paused") {
18530
- output.log(chalk66.gray(`
18755
+ output.log(chalk67.gray(`
18531
18756
  \uD83D\uDCA1 Use "roy-agent workflow run ${runData.run_id} --session-id ${runData.run_id} --input '<response>'" to resume`));
18532
18757
  }
18533
18758
  }
@@ -18599,11 +18824,11 @@ var WorkflowRunCommand = {
18599
18824
  };
18600
18825
 
18601
18826
  // src/commands/workflow/commands/stop.ts
18602
- import chalk67 from "chalk";
18827
+ import chalk68 from "chalk";
18603
18828
  import { createWorkflowRunStopTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
18604
18829
  import { wrapFunction as wrapFunction2 } from "@ai-setting/roy-agent-core";
18605
18830
  var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
18606
- const output = new OutputService;
18831
+ const output = new OutputService2;
18607
18832
  const envService = new EnvironmentService(output);
18608
18833
  try {
18609
18834
  await envService.create({ configPath: args.config });
@@ -18624,7 +18849,7 @@ var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
18624
18849
  output.error(result.error || `Failed to stop workflow: ${args.runId}`);
18625
18850
  process.exit(1);
18626
18851
  }
18627
- output.log(chalk67.red(`
18852
+ output.log(chalk68.red(`
18628
18853
  ⏹️ Workflow stopped: ${args.runId}`));
18629
18854
  } catch (error) {
18630
18855
  output.error(`Failed to stop workflow: ${error}`);
@@ -18648,7 +18873,7 @@ var WorkflowStopCommand = {
18648
18873
  };
18649
18874
 
18650
18875
  // src/commands/workflow/commands/status.ts
18651
- import chalk68 from "chalk";
18876
+ import chalk69 from "chalk";
18652
18877
  import { createWorkflowRunStatusTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
18653
18878
  var WorkflowStatusCommand = {
18654
18879
  command: "status <runId>",
@@ -18672,7 +18897,7 @@ var WorkflowStatusCommand = {
18672
18897
  type: "string"
18673
18898
  }),
18674
18899
  async handler(args) {
18675
- const output = new OutputService;
18900
+ const output = new OutputService2;
18676
18901
  const envService = new EnvironmentService(output);
18677
18902
  try {
18678
18903
  await envService.create({ configPath: args.config });
@@ -18741,7 +18966,7 @@ var WorkflowStatusCommand = {
18741
18966
  stopped: "⏹️"
18742
18967
  };
18743
18968
  const emoji = statusEmoji[status] || "❓";
18744
- output.log(chalk68.bold(`
18969
+ output.log(chalk69.bold(`
18745
18970
  ${emoji} Status: ${status.toUpperCase()}`));
18746
18971
  }
18747
18972
  } catch (error) {
@@ -18754,7 +18979,7 @@ ${emoji} Status: ${status.toUpperCase()}`));
18754
18979
  };
18755
18980
 
18756
18981
  // src/commands/workflow/commands/nodes.ts
18757
- import chalk69 from "chalk";
18982
+ import chalk70 from "chalk";
18758
18983
  var BUILT_IN_NODES = [
18759
18984
  {
18760
18985
  name: "ToolNode",
@@ -19091,7 +19316,7 @@ nodes:
19091
19316
  ];
19092
19317
  function renderNodeTypesTable(nodes) {
19093
19318
  const lines = [];
19094
- lines.push(chalk69.bold(`
19319
+ lines.push(chalk70.bold(`
19095
19320
  \uD83D\uDCE6 Built-in Node Types
19096
19321
  `));
19097
19322
  lines.push("┌────────────┬────────────────────┬─────────────────────────────────────────────────────────────┐");
@@ -19109,29 +19334,29 @@ function renderNodeTypesTable(nodes) {
19109
19334
  }
19110
19335
  function renderNodeDetail(node) {
19111
19336
  const lines = [];
19112
- lines.push(chalk69.bold(`
19337
+ lines.push(chalk70.bold(`
19113
19338
  [${node.type}] ${node.name}`));
19114
- lines.push(chalk69.dim("─".repeat(60)) + `
19339
+ lines.push(chalk70.dim("─".repeat(60)) + `
19115
19340
  `);
19116
- lines.push(chalk69.bold("Description:"));
19341
+ lines.push(chalk70.bold("Description:"));
19117
19342
  lines.push(` ${node.description}
19118
19343
  `);
19119
- lines.push(chalk69.bold("Configuration:"));
19344
+ lines.push(chalk70.bold("Configuration:"));
19120
19345
  lines.push(' type: "' + node.type + '"');
19121
19346
  lines.push(" config:");
19122
19347
  for (const input of node.inputs) {
19123
- const required = input.required ? chalk69.red("*") : " ";
19348
+ const required = input.required ? chalk70.red("*") : " ";
19124
19349
  lines.push(` ${input.name} (${input.type})${required}`);
19125
19350
  lines.push(` ${input.description}`);
19126
19351
  }
19127
19352
  lines.push(`
19128
- ${chalk69.bold("Output:")} ${node.output}`);
19353
+ ${chalk70.bold("Output:")} ${node.output}`);
19129
19354
  if (node.example) {
19130
- lines.push(chalk69.bold(`
19355
+ lines.push(chalk70.bold(`
19131
19356
  Example:`));
19132
- lines.push(chalk69.gray("```yaml"));
19357
+ lines.push(chalk70.gray("```yaml"));
19133
19358
  lines.push(node.example);
19134
- lines.push(chalk69.gray("```"));
19359
+ lines.push(chalk70.gray("```"));
19135
19360
  }
19136
19361
  return lines.join(`
19137
19362
  `);
@@ -19147,16 +19372,16 @@ var WorkflowNodesCommand = {
19147
19372
  const nodeType = args.type?.toLowerCase();
19148
19373
  if (!nodeType) {
19149
19374
  console.log(renderNodeTypesTable(BUILT_IN_NODES));
19150
- console.log(chalk69.gray(`
19151
- Use `) + chalk69.cyan("roy-agent workflow nodes <type>") + chalk69.gray(" for detailed information"));
19152
- console.log(chalk69.gray("Available types: ") + chalk69.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
19375
+ console.log(chalk70.gray(`
19376
+ Use `) + chalk70.cyan("roy-agent workflow nodes <type>") + chalk70.gray(" for detailed information"));
19377
+ console.log(chalk70.gray("Available types: ") + chalk70.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
19153
19378
  return;
19154
19379
  }
19155
19380
  const node = BUILT_IN_NODES.find((n) => n.type === nodeType);
19156
19381
  if (!node) {
19157
- console.log(chalk69.red(`
19382
+ console.log(chalk70.red(`
19158
19383
  ❌ Unknown node type: ${nodeType}`));
19159
- console.log(chalk69.gray("Available types: ") + chalk69.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
19384
+ console.log(chalk70.gray("Available types: ") + chalk70.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
19160
19385
  process.exit(1);
19161
19386
  }
19162
19387
  console.log(renderNodeDetail(node));
@@ -19164,7 +19389,7 @@ Use `) + chalk69.cyan("roy-agent workflow nodes <type>") + chalk69.gray(" for de
19164
19389
  };
19165
19390
 
19166
19391
  // src/commands/workflow/commands/validate.ts
19167
- import chalk70 from "chalk";
19392
+ import chalk71 from "chalk";
19168
19393
  import { readFileSync } from "fs";
19169
19394
  async function parseWorkflowInput(input, yamlStr) {
19170
19395
  const parseYaml = async (content) => {
@@ -19197,25 +19422,25 @@ function renderResult(result, options) {
19197
19422
  return;
19198
19423
  }
19199
19424
  if (result.valid) {
19200
- console.log(chalk70.green(`
19425
+ console.log(chalk71.green(`
19201
19426
  ✅ Workflow validation PASSED
19202
19427
  `));
19203
- console.log(chalk70.bold(`Workflow: ${result.workflowName}`));
19428
+ console.log(chalk71.bold(`Workflow: ${result.workflowName}`));
19204
19429
  console.log(`Nodes: ${result.nodeCount}`);
19205
19430
  console.log(`
19206
19431
  Valid nodes:`);
19207
- console.log(chalk70.green(" ✓ All nodes passed validation"));
19432
+ console.log(chalk71.green(" ✓ All nodes passed validation"));
19208
19433
  } else {
19209
- console.log(chalk70.red(`
19434
+ console.log(chalk71.red(`
19210
19435
  ❌ Workflow validation FAILED (${result.errors.length} errors found)
19211
19436
  `));
19212
19437
  result.errors.forEach((error, index) => {
19213
- console.log(chalk70.red(`[Error ${index + 1}/${result.errors.length}]${error.nodeId ? ` Node "${error.nodeId}"` : ""}`));
19214
- console.log(` ${chalk70.bold("Type:")} ${error.type}`);
19215
- console.log(` ${chalk70.bold("Description:")} ${error.description}`);
19216
- console.log(` ${chalk70.bold("Expected:")} ${error.expected}`);
19217
- console.log(` ${chalk70.bold("Actual:")} ${error.actual}`);
19218
- console.log(` ${chalk70.green("Fix:")} ${error.fix}`);
19438
+ console.log(chalk71.red(`[Error ${index + 1}/${result.errors.length}]${error.nodeId ? ` Node "${error.nodeId}"` : ""}`));
19439
+ console.log(` ${chalk71.bold("Type:")} ${error.type}`);
19440
+ console.log(` ${chalk71.bold("Description:")} ${error.description}`);
19441
+ console.log(` ${chalk71.bold("Expected:")} ${error.expected}`);
19442
+ console.log(` ${chalk71.bold("Actual:")} ${error.actual}`);
19443
+ console.log(` ${chalk71.green("Fix:")} ${error.fix}`);
19219
19444
  console.log();
19220
19445
  });
19221
19446
  }
@@ -19240,7 +19465,7 @@ var WorkflowValidateCommand = {
19240
19465
  try {
19241
19466
  const workflow = await parseWorkflowInput(options.input, options.yaml);
19242
19467
  if (!workflow) {
19243
- console.error(chalk70.red("Failed to parse workflow input"));
19468
+ console.error(chalk71.red("Failed to parse workflow input"));
19244
19469
  process.exit(1);
19245
19470
  }
19246
19471
  const validator = new WorkflowValidator;
@@ -19248,7 +19473,7 @@ var WorkflowValidateCommand = {
19248
19473
  renderResult(result, options);
19249
19474
  process.exit(result.valid ? 0 : 1);
19250
19475
  } catch (error) {
19251
- console.error(chalk70.red(`
19476
+ console.error(chalk71.red(`
19252
19477
  Error: ${error.message}`));
19253
19478
  process.exit(1);
19254
19479
  }
@@ -19256,7 +19481,7 @@ Error: ${error.message}`));
19256
19481
  };
19257
19482
 
19258
19483
  // src/commands/workflow/commands/search.ts
19259
- import chalk71 from "chalk";
19484
+ import chalk72 from "chalk";
19260
19485
  import { wrapFunction as wrapFunction3 } from "@ai-setting/roy-agent-core";
19261
19486
  var WorkflowSearchCommand = {
19262
19487
  command: "search",
@@ -19316,7 +19541,7 @@ var WorkflowSearchCommand = {
19316
19541
  }),
19317
19542
  async handler(args) {
19318
19543
  const a = args;
19319
- const output = new OutputService;
19544
+ const output = new OutputService2;
19320
19545
  const envService = new EnvironmentService(output);
19321
19546
  try {
19322
19547
  await runWorkflowSearch({
@@ -19413,22 +19638,22 @@ var _runWorkflowSearchImpl = async function(opts) {
19413
19638
  metadata: {}
19414
19639
  }));
19415
19640
  if (renderWorkflows.length === 0) {
19416
- output.log(chalk71.yellow("\uD83D\uDD0D No workflows matched the search criteria."));
19417
- output.log(chalk71.gray(` keyword: ${keyword || "(none)"}`));
19418
- output.log(chalk71.gray(` tags: ${tags && tags.length > 0 ? tags.join(", ") : "(none)"}`));
19641
+ output.log(chalk72.yellow("\uD83D\uDD0D No workflows matched the search criteria."));
19642
+ output.log(chalk72.gray(` keyword: ${keyword || "(none)"}`));
19643
+ output.log(chalk72.gray(` tags: ${tags && tags.length > 0 ? tags.join(", ") : "(none)"}`));
19419
19644
  } else {
19420
- output.log(chalk71.bold(`\uD83D\uDD0D Search results (${renderWorkflows.length}):`));
19645
+ output.log(chalk72.bold(`\uD83D\uDD0D Search results (${renderWorkflows.length}):`));
19421
19646
  output.log(renderWorkflowList(renderWorkflows));
19422
- output.log(chalk71.green(`
19647
+ output.log(chalk72.green(`
19423
19648
  ✅ Found ${renderWorkflows.length} workflow(s)`));
19424
19649
  }
19425
19650
  if (availableTags.length > 0) {
19426
19651
  output.log("");
19427
- output.log(chalk71.bold("\uD83D\uDCDA Available tags (sorted by usage_count):"));
19652
+ output.log(chalk72.bold("\uD83D\uDCDA Available tags (sorted by usage_count):"));
19428
19653
  for (const t of availableTags) {
19429
19654
  const name = t.name ?? t.tag;
19430
19655
  const count = t.count ?? t.usage_count;
19431
- output.log(chalk71.gray(` - ${name} (${count})`));
19656
+ output.log(chalk72.gray(` - ${name} (${count})`));
19432
19657
  }
19433
19658
  }
19434
19659
  };
@@ -19440,7 +19665,7 @@ var runWorkflowSearch = wrapFunction3(_runWorkflowSearchImpl, "workflow.cli.sear
19440
19665
 
19441
19666
  // src/commands/workflow/commands/tag.ts
19442
19667
  import { wrapFunction as wrapFunction4 } from "@ai-setting/roy-agent-core";
19443
- import chalk72 from "chalk";
19668
+ import chalk73 from "chalk";
19444
19669
  var WorkflowTagListCommand = {
19445
19670
  command: "list",
19446
19671
  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.",
@@ -19467,7 +19692,7 @@ var WorkflowTagListCommand = {
19467
19692
  }),
19468
19693
  async handler(args) {
19469
19694
  const a = args;
19470
- const output = new OutputService;
19695
+ const output = new OutputService2;
19471
19696
  const envService = new EnvironmentService(output);
19472
19697
  try {
19473
19698
  await runWorkflowTagList({
@@ -19512,7 +19737,7 @@ var WorkflowTagGetCommand = {
19512
19737
  }),
19513
19738
  async handler(args) {
19514
19739
  const a = args;
19515
- const output = new OutputService;
19740
+ const output = new OutputService2;
19516
19741
  const envService = new EnvironmentService(output);
19517
19742
  try {
19518
19743
  await runWorkflowTagGet({
@@ -19561,17 +19786,17 @@ var _runWorkflowTagListImpl = async function(opts) {
19561
19786
  return;
19562
19787
  }
19563
19788
  if (result.tags.length === 0) {
19564
- output.log(chalk72.yellow("\uD83C\uDFF7️ No tags in the workflow_tags table yet."));
19565
- output.log(chalk72.gray(" Tags are created automatically when you run `workflow add --tags <name>`."));
19789
+ output.log(chalk73.yellow("\uD83C\uDFF7️ No tags in the workflow_tags table yet."));
19790
+ output.log(chalk73.gray(" Tags are created automatically when you run `workflow add --tags <name>`."));
19566
19791
  return;
19567
19792
  }
19568
- output.log(chalk72.bold(`\uD83C\uDFF7️ Workflow tags (${result.total}):`));
19569
- output.log(chalk72.gray(` ${padRight("NAME", 24)}${padRight("USAGE", 8)}${padRight("CREATED", 22)}`));
19793
+ output.log(chalk73.bold(`\uD83C\uDFF7️ Workflow tags (${result.total}):`));
19794
+ output.log(chalk73.gray(` ${padRight("NAME", 24)}${padRight("USAGE", 8)}${padRight("CREATED", 22)}`));
19570
19795
  for (const t of result.tags) {
19571
19796
  const line = ` ${padRight(t.name, 24)}${padRight(String(t.usage_count), 8)}${padRight(formatDate2(t.created_at), 22)}`;
19572
19797
  output.log(line);
19573
19798
  }
19574
- output.log(chalk72.gray(`
19799
+ output.log(chalk73.gray(`
19575
19800
  \uD83D\uDCA1 Tip: when adding a new workflow, prefer tags from this list to ensure semantic consistency.`));
19576
19801
  };
19577
19802
  var _runWorkflowTagGetImpl = async function(opts) {
@@ -19598,7 +19823,7 @@ var _runWorkflowTagGetImpl = async function(opts) {
19598
19823
  output.json({ error: "Tag not found", name: opts.name });
19599
19824
  } else {
19600
19825
  output.error(`Tag "${opts.name}" not found in the workflow_tags table.`);
19601
- output.log(chalk72.gray(`Tip: run \`roy-agent workflow tag list\` to see available tags.`));
19826
+ output.log(chalk73.gray(`Tip: run \`roy-agent workflow tag list\` to see available tags.`));
19602
19827
  }
19603
19828
  process.exitCode = 1;
19604
19829
  return;
@@ -19607,10 +19832,10 @@ var _runWorkflowTagGetImpl = async function(opts) {
19607
19832
  output.json(tag);
19608
19833
  return;
19609
19834
  }
19610
- output.log(chalk72.bold(`\uD83C\uDFF7️ Tag: ${tag.name}`));
19611
- output.log(chalk72.gray(` usage_count: ${tag.usage_count}`));
19612
- output.log(chalk72.gray(` created_at: ${tag.created_at}`));
19613
- output.log(chalk72.gray(` updated_at: ${tag.updated_at}`));
19835
+ output.log(chalk73.bold(`\uD83C\uDFF7️ Tag: ${tag.name}`));
19836
+ output.log(chalk73.gray(` usage_count: ${tag.usage_count}`));
19837
+ output.log(chalk73.gray(` created_at: ${tag.created_at}`));
19838
+ output.log(chalk73.gray(` updated_at: ${tag.updated_at}`));
19614
19839
  };
19615
19840
  async function callListTags(service, options) {
19616
19841
  if (typeof service.listTags !== "function") {