@ai-setting/roy-agent-cli 1.5.86 → 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.86",
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 <消息>");
@@ -9275,6 +9275,130 @@ class InputHandler {
9275
9275
  }
9276
9276
  }
9277
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
+
9278
9402
  // src/commands/shared/ask-user-handler.ts
9279
9403
  import * as readline from "readline";
9280
9404
  import chalk3 from "chalk";
@@ -9815,8 +9939,9 @@ function createInteractiveCommand(externalEnvService) {
9815
9939
  default: false
9816
9940
  }).option("event-source", {
9817
9941
  alias: "es",
9818
- describe: "启动时一并启动的事件源 ID",
9819
- type: "string"
9942
+ describe: "启动时一并启动的事件源 ID(可多次指定,支持 --es a --es b)",
9943
+ type: "array",
9944
+ string: true
9820
9945
  }).option("plugin", {
9821
9946
  alias: "p",
9822
9947
  describe: "启用 plugin (tslsp, pylsp, mdlsp, lsp, code-check, reminder, memory, task-tag)",
@@ -9832,7 +9957,7 @@ function createInteractiveCommand(externalEnvService) {
9832
9957
  }),
9833
9958
  async handler(args) {
9834
9959
  CliQuietModeService.getInstance().setQuiet(true);
9835
- const output = new OutputService;
9960
+ const output = new OutputService2;
9836
9961
  const shouldDisposeEnvService = !externalEnvService;
9837
9962
  const envService = externalEnvService ?? new EnvironmentService(output);
9838
9963
  const CODER_HARNESS_PLUGINS = new Set([
@@ -10079,47 +10204,19 @@ function createInteractiveCommand(externalEnvService) {
10079
10204
  }
10080
10205
  });
10081
10206
  const stopEventHandler = eventHandler.start();
10082
- const eventSourceId = args.eventSource;
10083
- if (eventSourceId) {
10207
+ const rawEventSourceIds = args.eventSource;
10208
+ const eventSourceIds = Array.isArray(rawEventSourceIds) ? rawEventSourceIds.filter((s) => !!s) : rawEventSourceIds ? [rawEventSourceIds] : [];
10209
+ if (eventSourceIds.length > 0) {
10084
10210
  const eventSourceComponent = env.getComponent("event-source");
10085
10211
  if (!eventSourceComponent || typeof eventSourceComponent.startSource !== "function") {
10086
10212
  output.error(`❌ 未找到事件源组件或 startSource 方法`);
10087
10213
  output.info(`请确保 EventSourceComponent 已正确注册`);
10088
10214
  process.exit(1);
10089
10215
  }
10090
- const sources = eventSourceComponent.list();
10091
- const matchedSource = sources.find((s) => s.id === eventSourceId || s.id.startsWith(eventSourceId));
10092
- if (!matchedSource) {
10093
- output.error(`❌ 事件源不存在: ${eventSourceId}`);
10094
- output.info(`可用的事件源:`);
10095
- for (const s of sources) {
10096
- output.info(` - ${s.id}: ${s.name} (${s.type})`);
10097
- }
10216
+ const summary = await startEventSources(eventSourceIds, eventSourceComponent, output);
10217
+ if (eventSourceIds.length === 1 && summary.failedCount > 0) {
10098
10218
  process.exit(1);
10099
10219
  }
10100
- const actualId = matchedSource.id;
10101
- const status = eventSourceComponent.getStatus(actualId);
10102
- if (status === "running") {
10103
- output.info(`\uD83D\uDCE1 事件源 ${matchedSource.name} 已在运行中`);
10104
- } else {
10105
- try {
10106
- await eventSourceComponent.startSource(actualId);
10107
- const verifyStatus = eventSourceComponent.getStatus(actualId);
10108
- if (verifyStatus !== "running") {
10109
- output.error(`❌ 事件源启动后状态异常: ${verifyStatus}`);
10110
- output.info(`请检查日志确认后台进程是否正常运行`);
10111
- process.exit(1);
10112
- }
10113
- output.success(`\uD83D\uDCE1 已启动事件源: ${matchedSource.name} (${verifyStatus})`);
10114
- } catch (error) {
10115
- output.error(`❌ 启动事件源失败: ${error}`);
10116
- output.info(`常见问题:`);
10117
- output.info(` - lark-cli 事件源:确保已安装并登录 lark-cli`);
10118
- output.info(` - websocket 事件源:确保目标服务器可达`);
10119
- output.info(` - timer 事件源:检查配置是否正确`);
10120
- process.exit(1);
10121
- }
10122
- }
10123
10220
  }
10124
10221
  let sigintHandler;
10125
10222
  sigintHandler = () => {
@@ -10182,7 +10279,7 @@ var ListCommand = {
10182
10279
  if (isQuiet) {
10183
10280
  CliQuietModeService.getInstance().setQuiet(true);
10184
10281
  }
10185
- const output = new OutputService;
10282
+ const output = new OutputService2;
10186
10283
  output.configure({ quiet: isQuiet });
10187
10284
  const envService = new EnvironmentService(output);
10188
10285
  try {
@@ -10311,7 +10408,7 @@ var GetCommand = {
10311
10408
  }).option("messages", { type: "boolean", default: false }).option("checkpoints", { alias: "c", type: "boolean", default: false }).option("json", { alias: "j", type: "boolean", default: false }),
10312
10409
  async handler(args) {
10313
10410
  const a = args;
10314
- const output = new OutputService;
10411
+ const output = new OutputService2;
10315
10412
  const envService = new EnvironmentService(output);
10316
10413
  try {
10317
10414
  await envService.create({ configPath: a.config });
@@ -10411,7 +10508,7 @@ var NewCommand = {
10411
10508
  describe: "创建新会话",
10412
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 }),
10413
10510
  async handler(args) {
10414
- const output = new OutputService;
10511
+ const output = new OutputService2;
10415
10512
  const envService = new EnvironmentService(output);
10416
10513
  try {
10417
10514
  await envService.create({ configPath: args.config });
@@ -10477,7 +10574,7 @@ var RenameCommand = {
10477
10574
  }),
10478
10575
  async handler(args) {
10479
10576
  const a = args;
10480
- const output = new OutputService;
10577
+ const output = new OutputService2;
10481
10578
  const envService = new EnvironmentService(output);
10482
10579
  try {
10483
10580
  await envService.create({ configPath: a.config });
@@ -10570,7 +10667,7 @@ var DeleteCommand = {
10570
10667
  }),
10571
10668
  async handler(args) {
10572
10669
  const a = args;
10573
- const output = new OutputService;
10670
+ const output = new OutputService2;
10574
10671
  const envService = new EnvironmentService(output);
10575
10672
  try {
10576
10673
  await envService.create({ configPath: a.config });
@@ -10717,7 +10814,7 @@ var MessagesCommand = {
10717
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 }),
10718
10815
  async handler(args) {
10719
10816
  const a = args;
10720
- const output = new OutputService;
10817
+ const output = new OutputService2;
10721
10818
  const envService = new EnvironmentService(output);
10722
10819
  try {
10723
10820
  await envService.create({ configPath: a.config });
@@ -10927,7 +11024,7 @@ var CompactCommand = {
10927
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 }),
10928
11025
  async handler(args) {
10929
11026
  const a = args;
10930
- const output = new OutputService;
11027
+ const output = new OutputService2;
10931
11028
  const envService = new EnvironmentService(output);
10932
11029
  try {
10933
11030
  await envService.create({ configPath: a.config });
@@ -11119,7 +11216,7 @@ var CheckpointsCommand = {
11119
11216
  }).option("detail", { alias: "d", type: "boolean", default: false }).option("json", { alias: "j", type: "boolean", default: false }),
11120
11217
  async handler(args) {
11121
11218
  const a = args;
11122
- const output = new OutputService;
11219
+ const output = new OutputService2;
11123
11220
  const envService = new EnvironmentService(output);
11124
11221
  try {
11125
11222
  await envService.create({ configPath: a.config });
@@ -11233,7 +11330,7 @@ var ActiveCommand = {
11233
11330
  describe: "查看/设置当前活跃会话",
11234
11331
  builder: (yargs) => yargs.option("clear", { type: "boolean", default: false }).option("json", { alias: "j", type: "boolean", default: false }),
11235
11332
  async handler(args) {
11236
- const output = new OutputService;
11333
+ const output = new OutputService2;
11237
11334
  const envService = new EnvironmentService(output);
11238
11335
  try {
11239
11336
  await envService.create({ configPath: args.config });
@@ -11312,7 +11409,7 @@ var AddMessageCommand = {
11312
11409
  }).option("json", { alias: "j", type: "boolean", default: false }),
11313
11410
  async handler(args) {
11314
11411
  const a = args;
11315
- const output = new OutputService;
11412
+ const output = new OutputService2;
11316
11413
  const envService = new EnvironmentService(output);
11317
11414
  try {
11318
11415
  await envService.create({ configPath: a.config });
@@ -11461,7 +11558,7 @@ var MockCommand = {
11461
11558
  }).option("json", { alias: "j", type: "boolean", default: false }),
11462
11559
  async handler(args) {
11463
11560
  const a = args;
11464
- const output = new OutputService;
11561
+ const output = new OutputService2;
11465
11562
  const envService = new EnvironmentService(output);
11466
11563
  try {
11467
11564
  await envService.create({ configPath: a.config });
@@ -11601,7 +11698,7 @@ var GrepCommand = {
11601
11698
  if (isQuiet) {
11602
11699
  CliQuietModeService.getInstance().setQuiet(true);
11603
11700
  }
11604
- const output = new OutputService;
11701
+ const output = new OutputService2;
11605
11702
  output.configure({ quiet: isQuiet });
11606
11703
  const envService = new EnvironmentService(output);
11607
11704
  try {
@@ -11777,7 +11874,7 @@ var ListCommand2 = {
11777
11874
  description: "是否包含已归档任务(status=archived 的任务默认被排除)"
11778
11875
  }).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }).option("quiet", { alias: "q", type: "boolean", hidden: true }),
11779
11876
  async handler(args) {
11780
- const output = new OutputService;
11877
+ const output = new OutputService2;
11781
11878
  const envService = new EnvironmentService(output);
11782
11879
  try {
11783
11880
  await envService.create({ configPath: args.config });
@@ -11887,7 +11984,7 @@ var GetCommand2 = {
11887
11984
  description: "包含操作记录"
11888
11985
  }).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }),
11889
11986
  async handler(args) {
11890
- const output = new OutputService;
11987
+ const output = new OutputService2;
11891
11988
  const envService = new EnvironmentService(output);
11892
11989
  try {
11893
11990
  await envService.create({ configPath: args.config });
@@ -12014,7 +12111,7 @@ var CreateCommand = {
12014
12111
  description: "任务上下文 (JSON 字符串)"
12015
12112
  }).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }),
12016
12113
  async handler(args) {
12017
- const output = new OutputService;
12114
+ const output = new OutputService2;
12018
12115
  const envService = new EnvironmentService(output);
12019
12116
  try {
12020
12117
  await envService.create({ configPath: args.config });
@@ -12076,7 +12173,7 @@ var UpdateCommand = {
12076
12173
  demandOption: true
12077
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 输出" }),
12078
12175
  async handler(args) {
12079
- const output = new OutputService;
12176
+ const output = new OutputService2;
12080
12177
  const envService = new EnvironmentService(output);
12081
12178
  try {
12082
12179
  await envService.create({ configPath: args.config });
@@ -12162,7 +12259,7 @@ var DeleteCommand2 = {
12162
12259
  description: "强制删除,不确认"
12163
12260
  }),
12164
12261
  async handler(args) {
12165
- const output = new OutputService;
12262
+ const output = new OutputService2;
12166
12263
  const envService = new EnvironmentService(output);
12167
12264
  try {
12168
12265
  await envService.create({ configPath: args.config });
@@ -12223,7 +12320,7 @@ var CompleteCommand = {
12223
12320
  description: "Enable plugin (e.g., --plugin task-tag)"
12224
12321
  }),
12225
12322
  async handler(args) {
12226
- const output = new OutputService;
12323
+ const output = new OutputService2;
12227
12324
  const envService = new EnvironmentService(output);
12228
12325
  try {
12229
12326
  await envService.create({
@@ -12297,7 +12394,7 @@ var OperationsCommand = {
12297
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 输出" }),
12298
12395
  async handler(args) {
12299
12396
  const a = args;
12300
- const output = new OutputService;
12397
+ const output = new OutputService2;
12301
12398
  const envService = new EnvironmentService(output);
12302
12399
  try {
12303
12400
  await envService.create({ configPath: a.config });
@@ -12445,7 +12542,7 @@ var TreeCommand = {
12445
12542
  description: "以 JSON 格式输出树形结构"
12446
12543
  }),
12447
12544
  async handler(args) {
12448
- const output = new OutputService;
12545
+ const output = new OutputService2;
12449
12546
  const envService = new EnvironmentService(output);
12450
12547
  try {
12451
12548
  await envService.create({ configPath: args.config });
@@ -12548,7 +12645,7 @@ var SearchCommand = {
12548
12645
  description: "是否包含已归档任务"
12549
12646
  }).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }).option("quiet", { alias: "q", type: "boolean", hidden: true }),
12550
12647
  async handler(args) {
12551
- const output = new OutputService;
12648
+ const output = new OutputService2;
12552
12649
  const envService = new EnvironmentService(output);
12553
12650
  try {
12554
12651
  await envService.create({ configPath: args.config });
@@ -12900,7 +12997,7 @@ var ListCommand3 = {
12900
12997
  }),
12901
12998
  async handler(args) {
12902
12999
  const a = args;
12903
- const output = new OutputService;
13000
+ const output = new OutputService2;
12904
13001
  const envService = new EnvironmentService(output);
12905
13002
  try {
12906
13003
  await envService.create({ configPath: a.config });
@@ -12989,7 +13086,7 @@ var GetCommand3 = {
12989
13086
  description: "JSON 输出"
12990
13087
  }),
12991
13088
  async handler(args) {
12992
- const output = new OutputService;
13089
+ const output = new OutputService2;
12993
13090
  const envService = new EnvironmentService(output);
12994
13091
  try {
12995
13092
  await envService.create({ configPath: args.config });
@@ -13059,7 +13156,7 @@ var SearchCommand2 = {
13059
13156
  description: "简洁输出"
13060
13157
  }),
13061
13158
  async handler(args) {
13062
- const output = new OutputService;
13159
+ const output = new OutputService2;
13063
13160
  const envService = new EnvironmentService(output);
13064
13161
  try {
13065
13162
  await envService.create({ configPath: args.config });
@@ -13141,7 +13238,7 @@ var ReloadCommand = {
13141
13238
  description: "配置文件路径"
13142
13239
  }),
13143
13240
  async handler(args) {
13144
- const output = new OutputService;
13241
+ const output = new OutputService2;
13145
13242
  const envService = new EnvironmentService(output);
13146
13243
  try {
13147
13244
  await envService.create({ configPath: args.config });
@@ -13179,7 +13276,7 @@ var ShowConfigCommand = {
13179
13276
  description: "配置文件路径"
13180
13277
  }),
13181
13278
  async handler(args) {
13182
- const output = new OutputService;
13279
+ const output = new OutputService2;
13183
13280
  const envService = new EnvironmentService(output);
13184
13281
  try {
13185
13282
  await envService.create({ configPath: args.config });
@@ -13269,7 +13366,7 @@ var ListCommand4 = {
13269
13366
  description: "简洁输出"
13270
13367
  }),
13271
13368
  async handler(args) {
13272
- const output = new OutputService;
13369
+ const output = new OutputService2;
13273
13370
  const envService = new EnvironmentService(output);
13274
13371
  try {
13275
13372
  await envService.create({ configPath: args.config });
@@ -13378,7 +13475,7 @@ var GetCommand4 = {
13378
13475
  description: "JSON 输出"
13379
13476
  }),
13380
13477
  async handler(args) {
13381
- const output = new OutputService;
13478
+ const output = new OutputService2;
13382
13479
  const envService = new EnvironmentService(output);
13383
13480
  try {
13384
13481
  await envService.create({ configPath: args.config });
@@ -13548,7 +13645,7 @@ var AddCommand = {
13548
13645
  description: "JSON 输出"
13549
13646
  }),
13550
13647
  async handler(args) {
13551
- const output = new OutputService;
13648
+ const output = new OutputService2;
13552
13649
  const envService = new EnvironmentService(output);
13553
13650
  try {
13554
13651
  await envService.create({ configPath: args.config });
@@ -13624,7 +13721,7 @@ var DeleteCommand3 = {
13624
13721
  description: "JSON 输出"
13625
13722
  }),
13626
13723
  async handler(args) {
13627
- const output = new OutputService;
13724
+ const output = new OutputService2;
13628
13725
  const envService = new EnvironmentService(output);
13629
13726
  try {
13630
13727
  await envService.create({ configPath: args.config });
@@ -13680,7 +13777,7 @@ var ConfigDirCommand = {
13680
13777
  description: "JSON 输出"
13681
13778
  }),
13682
13779
  async handler(args) {
13683
- const output = new OutputService;
13780
+ const output = new OutputService2;
13684
13781
  const envService = new EnvironmentService(output);
13685
13782
  try {
13686
13783
  await envService.create({ configPath: args.config });
@@ -13747,7 +13844,7 @@ var ListCommand5 = {
13747
13844
  description: "简洁输出"
13748
13845
  }),
13749
13846
  async handler(args) {
13750
- const output = new OutputService;
13847
+ const output = new OutputService2;
13751
13848
  const envService = new EnvironmentService(output);
13752
13849
  try {
13753
13850
  await envService.create({ configPath: args.config });
@@ -13834,7 +13931,7 @@ var GetCommand5 = {
13834
13931
  description: "变量替换,格式:key=value"
13835
13932
  }),
13836
13933
  async handler(args) {
13837
- const output = new OutputService;
13934
+ const output = new OutputService2;
13838
13935
  const envService = new EnvironmentService(output);
13839
13936
  try {
13840
13937
  await envService.create({ configPath: args.config });
@@ -13923,7 +14020,7 @@ var AddCommand2 = {
13923
14020
  description: "JSON 输出"
13924
14021
  }),
13925
14022
  async handler(args) {
13926
- const output = new OutputService;
14023
+ const output = new OutputService2;
13927
14024
  const envService = new EnvironmentService(output);
13928
14025
  try {
13929
14026
  if (!args.file && !args.content) {
@@ -13975,7 +14072,7 @@ var ConfigDirCommand2 = {
13975
14072
  description: "JSON 输出"
13976
14073
  }),
13977
14074
  async handler(args) {
13978
- const output = new OutputService;
14075
+ const output = new OutputService2;
13979
14076
  const envService = new EnvironmentService(output);
13980
14077
  try {
13981
14078
  await envService.create({ configPath: args.config });
@@ -14070,7 +14167,7 @@ var CommandsListCommand = {
14070
14167
  type: "string"
14071
14168
  }),
14072
14169
  async handler(args) {
14073
- const output = new OutputService;
14170
+ const output = new OutputService2;
14074
14171
  const envService = new EnvironmentService(output);
14075
14172
  try {
14076
14173
  await envService.create({ configPath: args.config });
@@ -14153,7 +14250,7 @@ var CommandsAddCommand = {
14153
14250
  type: "string"
14154
14251
  }),
14155
14252
  async handler(args) {
14156
- const output = new OutputService;
14253
+ const output = new OutputService2;
14157
14254
  const envService = new EnvironmentService(output);
14158
14255
  try {
14159
14256
  await envService.create({ configPath: args.config });
@@ -14215,7 +14312,7 @@ var CommandsRemoveCommand = {
14215
14312
  type: "string"
14216
14313
  }),
14217
14314
  async handler(args) {
14218
- const output = new OutputService;
14315
+ const output = new OutputService2;
14219
14316
  const envService = new EnvironmentService(output);
14220
14317
  try {
14221
14318
  await envService.create({ configPath: args.config });
@@ -14312,7 +14409,7 @@ var CommandsInfoCommand = {
14312
14409
  type: "string"
14313
14410
  }),
14314
14411
  async handler(args) {
14315
- const output = new OutputService;
14412
+ const output = new OutputService2;
14316
14413
  const envService = new EnvironmentService(output);
14317
14414
  try {
14318
14415
  await envService.create({ configPath: args.config });
@@ -14373,7 +14470,7 @@ var CommandsDirsCommand = {
14373
14470
  type: "string"
14374
14471
  }),
14375
14472
  async handler(args) {
14376
- const output = new OutputService;
14473
+ const output = new OutputService2;
14377
14474
  const envService = new EnvironmentService(output);
14378
14475
  try {
14379
14476
  await envService.create({ configPath: args.config });
@@ -14688,7 +14785,7 @@ var ConfigListCommand = {
14688
14785
  alias: "c"
14689
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", "只显示配置键"),
14690
14787
  async handler(args) {
14691
- const output = new OutputService;
14788
+ const output = new OutputService2;
14692
14789
  const envService = new EnvironmentService(output);
14693
14790
  try {
14694
14791
  await envService.create({ configPath: args.config });
@@ -14980,7 +15077,7 @@ var ConfigExportCommand = {
14980
15077
  alias: "c"
14981
15078
  }).example("roy-agent config export agent --file agent-config.json", "导出 agent 配置").example("roy-agent config export session --file session-config.json", "导出 session 配置"),
14982
15079
  async handler(args) {
14983
- const output = new OutputService;
15080
+ const output = new OutputService2;
14984
15081
  const envService = new EnvironmentService(output);
14985
15082
  try {
14986
15083
  await envService.create({ configPath: args.config });
@@ -15048,7 +15145,7 @@ var ConfigImportCommand = {
15048
15145
  alias: "c"
15049
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", "显示详细信息"),
15050
15147
  async handler(args) {
15051
- const output = new OutputService;
15148
+ const output = new OutputService2;
15052
15149
  const envService = new EnvironmentService(output);
15053
15150
  try {
15054
15151
  await envService.create({ configPath: args.config });
@@ -15125,7 +15222,7 @@ var ListCommand6 = {
15125
15222
  description: "简洁输出"
15126
15223
  }),
15127
15224
  async handler(args) {
15128
- const output = new OutputService;
15225
+ const output = new OutputService2;
15129
15226
  const envService = new EnvironmentService(output);
15130
15227
  try {
15131
15228
  await envService.create({ configPath: args.config });
@@ -15223,7 +15320,7 @@ var ToolsCommand = {
15223
15320
  description: "简洁输出"
15224
15321
  }),
15225
15322
  async handler(args) {
15226
- const output = new OutputService;
15323
+ const output = new OutputService2;
15227
15324
  const envService = new EnvironmentService(output);
15228
15325
  try {
15229
15326
  await envService.create({ configPath: args.config });
@@ -15295,7 +15392,7 @@ var ReloadCommand2 = {
15295
15392
  describe: "重新加载 MCP 服务器",
15296
15393
  builder: (yargs) => yargs,
15297
15394
  async handler(args) {
15298
- const output = new OutputService;
15395
+ const output = new OutputService2;
15299
15396
  const envService = new EnvironmentService(output);
15300
15397
  try {
15301
15398
  await envService.create({ configPath: args.config });
@@ -15359,7 +15456,7 @@ var ListCommand7 = {
15359
15456
  description: "简洁输出(仅名称)"
15360
15457
  }),
15361
15458
  async handler(args) {
15362
- const output = new OutputService;
15459
+ const output = new OutputService2;
15363
15460
  const envService = new EnvironmentService(output);
15364
15461
  try {
15365
15462
  await envService.create({ configPath: args.config });
@@ -15459,7 +15556,7 @@ var GetCommand6 = {
15459
15556
  description: "JSON 输出"
15460
15557
  }),
15461
15558
  async handler(args) {
15462
- const output = new OutputService;
15559
+ const output = new OutputService2;
15463
15560
  const envService = new EnvironmentService(output);
15464
15561
  try {
15465
15562
  await envService.create({ configPath: args.config });
@@ -15534,7 +15631,7 @@ var ExecToolCommand = {
15534
15631
  }).strict(false);
15535
15632
  },
15536
15633
  async handler(args) {
15537
- const output = new OutputService;
15634
+ const output = new OutputService2;
15538
15635
  const envService = new EnvironmentService(output);
15539
15636
  const toolName = args.name;
15540
15637
  try {
@@ -15767,7 +15864,7 @@ var RecordCommand = {
15767
15864
  }),
15768
15865
  async handler(args) {
15769
15866
  const a = args;
15770
- const output = new OutputService;
15867
+ const output = new OutputService2;
15771
15868
  const envService = new EnvironmentService(output);
15772
15869
  try {
15773
15870
  await envService.create({ configPath: a.config });
@@ -15848,7 +15945,7 @@ var RecallCommand = {
15848
15945
  }),
15849
15946
  async handler(args) {
15850
15947
  const a = args;
15851
- const output = new OutputService;
15948
+ const output = new OutputService2;
15852
15949
  const envService = new EnvironmentService(output);
15853
15950
  try {
15854
15951
  await envService.create({ configPath: a.config });
@@ -15949,7 +16046,7 @@ var EventSourceListCommand = {
15949
16046
  default: false
15950
16047
  }),
15951
16048
  async handler(args) {
15952
- const output = new OutputService;
16049
+ const output = new OutputService2;
15953
16050
  output.configure({ quiet: args.quiet });
15954
16051
  const envService = new EnvironmentService(output);
15955
16052
  try {
@@ -16051,10 +16148,13 @@ var EventSourceAddCommand = {
16051
16148
  }).option("cron", {
16052
16149
  describe: "Cron 表达式",
16053
16150
  type: "string"
16151
+ }).option("prompt", {
16152
+ describe: "自定义 prompt 消息(timer 类型,替换默认 SelfReminder 内容)",
16153
+ type: "string"
16054
16154
  }),
16055
16155
  async handler(args) {
16056
16156
  const a = args;
16057
- const output = new OutputService;
16157
+ const output = new OutputService2;
16058
16158
  const envService = new EnvironmentService(output);
16059
16159
  try {
16060
16160
  await envService.create({ configPath: a.config });
@@ -16078,7 +16178,8 @@ var EventSourceAddCommand = {
16078
16178
  command: a.command,
16079
16179
  url: a.url,
16080
16180
  interval: a.interval,
16081
- cron: a.cron
16181
+ cron: a.cron,
16182
+ options: a.prompt ? { prompt: a.prompt } : undefined
16082
16183
  };
16083
16184
  esComponent.register(config);
16084
16185
  output.success(chalk55.green(`事件源 '${a.name}' 添加成功!`));
@@ -16094,6 +16195,9 @@ var EventSourceAddCommand = {
16094
16195
  if (a.interval) {
16095
16196
  output.log(` Interval: ${chalk55.gray(`${a.interval}ms`)}`);
16096
16197
  }
16198
+ if (a.prompt) {
16199
+ output.log(` Prompt: ${chalk55.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
16200
+ }
16097
16201
  output.log("");
16098
16202
  output.log(chalk55.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
16099
16203
  } finally {
@@ -16102,8 +16206,132 @@ var EventSourceAddCommand = {
16102
16206
  }
16103
16207
  };
16104
16208
 
16105
- // src/commands/eventsource/remove.ts
16209
+ // src/commands/eventsource/update.ts
16106
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";
16107
16335
  var EventSourceRemoveCommand = {
16108
16336
  command: "remove <id>",
16109
16337
  aliases: ["rm"],
@@ -16119,7 +16347,7 @@ var EventSourceRemoveCommand = {
16119
16347
  default: false
16120
16348
  }),
16121
16349
  async handler(args) {
16122
- const output = new OutputService;
16350
+ const output = new OutputService2;
16123
16351
  const envService = new EnvironmentService(output);
16124
16352
  try {
16125
16353
  await envService.create({ configPath: args.config });
@@ -16142,7 +16370,7 @@ var EventSourceRemoveCommand = {
16142
16370
  const status = esComponent.getStatus(matchedSource.id);
16143
16371
  if (status === "running" && !args.force) {
16144
16372
  output.error(`事件源正在运行中,请先停止: ${matchedSource.name} (${status})`);
16145
- 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)}' 先停止`));
16146
16374
  process.exit(1);
16147
16375
  }
16148
16376
  if (status === "running") {
@@ -16151,7 +16379,7 @@ var EventSourceRemoveCommand = {
16151
16379
  }
16152
16380
  const result = esComponent.unregister(matchedSource.id);
16153
16381
  if (result) {
16154
- output.success(chalk56.green(`事件源已移除: ${matchedSource.name}`));
16382
+ output.success(chalk57.green(`事件源已移除: ${matchedSource.name}`));
16155
16383
  } else {
16156
16384
  output.error("移除失败");
16157
16385
  process.exit(1);
@@ -16163,7 +16391,7 @@ var EventSourceRemoveCommand = {
16163
16391
  };
16164
16392
 
16165
16393
  // src/commands/eventsource/start.ts
16166
- import chalk57 from "chalk";
16394
+ import chalk58 from "chalk";
16167
16395
  var EventSourceStartCommand = {
16168
16396
  command: "start <id>",
16169
16397
  describe: "启动指定的事件源",
@@ -16178,7 +16406,7 @@ var EventSourceStartCommand = {
16178
16406
  default: false
16179
16407
  }),
16180
16408
  async handler(args) {
16181
- const output = new OutputService;
16409
+ const output = new OutputService2;
16182
16410
  const envService = new EnvironmentService(output);
16183
16411
  try {
16184
16412
  await envService.create({ configPath: args.config });
@@ -16200,15 +16428,15 @@ var EventSourceStartCommand = {
16200
16428
  }
16201
16429
  const status = esComponent.getStatus(matchedSource.id);
16202
16430
  if (status === "running") {
16203
- output.log(chalk57.yellow(`事件源已在运行: ${matchedSource.name}`));
16431
+ output.log(chalk58.yellow(`事件源已在运行: ${matchedSource.name}`));
16204
16432
  return;
16205
16433
  }
16206
16434
  output.info(`正在启动事件源 '${matchedSource.name}'...`);
16207
16435
  try {
16208
16436
  await esComponent.startSource(matchedSource.id);
16209
- output.success(chalk57.green(`事件源已启动: ${matchedSource.name}`));
16437
+ output.success(chalk58.green(`事件源已启动: ${matchedSource.name}`));
16210
16438
  if (!args.background) {
16211
- output.log(chalk57.gray("按 Ctrl+C 停止..."));
16439
+ output.log(chalk58.gray("按 Ctrl+C 停止..."));
16212
16440
  await new Promise((resolve) => {
16213
16441
  const cleanup = () => {
16214
16442
  process.removeListener("SIGINT", cleanup);
@@ -16230,7 +16458,7 @@ var EventSourceStartCommand = {
16230
16458
  };
16231
16459
 
16232
16460
  // src/commands/eventsource/stop.ts
16233
- import chalk58 from "chalk";
16461
+ import chalk59 from "chalk";
16234
16462
  var EventSourceStopCommand = {
16235
16463
  command: "stop <id>",
16236
16464
  aliases: ["kill"],
@@ -16246,7 +16474,7 @@ var EventSourceStopCommand = {
16246
16474
  default: false
16247
16475
  }),
16248
16476
  async handler(args) {
16249
- const output = new OutputService;
16477
+ const output = new OutputService2;
16250
16478
  const envService = new EnvironmentService(output);
16251
16479
  try {
16252
16480
  await envService.create({ configPath: args.config });
@@ -16268,13 +16496,13 @@ var EventSourceStopCommand = {
16268
16496
  }
16269
16497
  const status = esComponent.getStatus(matchedSource.id);
16270
16498
  if (status !== "running") {
16271
- output.log(chalk58.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
16499
+ output.log(chalk59.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
16272
16500
  return;
16273
16501
  }
16274
16502
  output.info(`正在停止事件源 '${matchedSource.name}'...`);
16275
16503
  try {
16276
16504
  await esComponent.stopSource(matchedSource.id);
16277
- output.success(chalk58.green(`事件源已停止: ${matchedSource.name}`));
16505
+ output.success(chalk59.green(`事件源已停止: ${matchedSource.name}`));
16278
16506
  } catch (error) {
16279
16507
  output.error(`停止失败: ${error}`);
16280
16508
  process.exit(1);
@@ -16286,14 +16514,14 @@ var EventSourceStopCommand = {
16286
16514
  };
16287
16515
 
16288
16516
  // src/commands/eventsource/status.ts
16289
- import chalk59 from "chalk";
16517
+ import chalk60 from "chalk";
16290
16518
  var STATUS_COLORS = {
16291
- created: chalk59.gray,
16292
- starting: chalk59.yellow,
16293
- running: chalk59.green,
16294
- stopping: chalk59.yellow,
16295
- stopped: chalk59.gray,
16296
- 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
16297
16525
  };
16298
16526
  var STATUS_ICONS = {
16299
16527
  created: "○",
@@ -16325,7 +16553,7 @@ var EventSourceStatusCommand = {
16325
16553
  default: false
16326
16554
  }),
16327
16555
  async handler(args) {
16328
- const output = new OutputService;
16556
+ const output = new OutputService2;
16329
16557
  const envService = new EnvironmentService(output);
16330
16558
  try {
16331
16559
  await envService.create({ configPath: args.config });
@@ -16347,7 +16575,7 @@ var EventSourceStatusCommand = {
16347
16575
  process.exit(1);
16348
16576
  }
16349
16577
  const status = esComponent.getStatus(matchedSource.id) || "unknown";
16350
- const statusColor = STATUS_COLORS[status] || chalk59.gray;
16578
+ const statusColor = STATUS_COLORS[status] || chalk60.gray;
16351
16579
  if (args.json) {
16352
16580
  output.json({
16353
16581
  id: matchedSource.id,
@@ -16364,31 +16592,31 @@ var EventSourceStatusCommand = {
16364
16592
  });
16365
16593
  return;
16366
16594
  }
16367
- output.log(chalk59.bold("事件源详情"));
16595
+ output.log(chalk60.bold("事件源详情"));
16368
16596
  output.log("─".repeat(50));
16369
- output.log(` ID: ${chalk59.gray(matchedSource.id)}`);
16370
- output.log(` Name: ${chalk59.cyan(matchedSource.name)}`);
16371
- 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)}`);
16372
16600
  output.log(` Status: ${statusColor(`${STATUS_ICONS[status]} ${STATUS_LABELS[status]}`)}`);
16373
- output.log(` Enabled: ${matchedSource.enabled ? chalk59.green("是") : chalk59.gray("否")}`);
16601
+ output.log(` Enabled: ${matchedSource.enabled ? chalk60.green("是") : chalk60.gray("否")}`);
16374
16602
  if (matchedSource.eventTypes?.length) {
16375
- output.log(` Events: ${chalk59.gray(matchedSource.eventTypes.join(", "))}`);
16603
+ output.log(` Events: ${chalk60.gray(matchedSource.eventTypes.join(", "))}`);
16376
16604
  }
16377
16605
  if (matchedSource.command) {
16378
- output.log(` Command: ${chalk59.gray(matchedSource.command)}`);
16606
+ output.log(` Command: ${chalk60.gray(matchedSource.command)}`);
16379
16607
  }
16380
16608
  if (matchedSource.interval) {
16381
- output.log(` Interval: ${chalk59.gray(`${matchedSource.interval}ms`)}`);
16609
+ output.log(` Interval: ${chalk60.gray(`${matchedSource.interval}ms`)}`);
16382
16610
  }
16383
16611
  if (matchedSource.url) {
16384
- output.log(` URL: ${chalk59.gray(matchedSource.url)}`);
16612
+ output.log(` URL: ${chalk60.gray(matchedSource.url)}`);
16385
16613
  }
16386
16614
  output.log("");
16387
16615
  return;
16388
16616
  }
16389
16617
  const sources = esComponent.list();
16390
16618
  if (sources.length === 0) {
16391
- output.log(chalk59.yellow("没有配置的事件源"));
16619
+ output.log(chalk60.yellow("没有配置的事件源"));
16392
16620
  return;
16393
16621
  }
16394
16622
  if (args.json) {
@@ -16402,21 +16630,21 @@ var EventSourceStatusCommand = {
16402
16630
  output.json({ sources: sourcesWithStatus, count: sources.length });
16403
16631
  return;
16404
16632
  }
16405
- output.log(chalk59.bold("事件源状态概览"));
16633
+ output.log(chalk60.bold("事件源状态概览"));
16406
16634
  output.log("─".repeat(60));
16407
16635
  for (const source of sources) {
16408
16636
  const status = esComponent.getStatus(source.id) || "unknown";
16409
- const statusColor = STATUS_COLORS[status] || chalk59.gray;
16637
+ const statusColor = STATUS_COLORS[status] || chalk60.gray;
16410
16638
  const icon = STATUS_ICONS[status] || "?";
16411
16639
  const label = STATUS_LABELS[status] || status;
16412
16640
  output.log("");
16413
- output.log(` ${chalk59.cyan(source.name)} ${chalk59.gray(`(${source.type})`)}`);
16641
+ output.log(` ${chalk60.cyan(source.name)} ${chalk60.gray(`(${source.type})`)}`);
16414
16642
  output.log(` └─ Status: ${statusColor(`${icon} ${label}`)}`);
16415
- output.log(` ID: ${chalk59.gray(source.id.substring(0, 8))}...`);
16643
+ output.log(` ID: ${chalk60.gray(source.id.substring(0, 8))}...`);
16416
16644
  }
16417
16645
  output.log("");
16418
16646
  const runningCount = sources.filter((s) => esComponent.getStatus(s.id) === "running").length;
16419
- output.log(chalk59.green(`✅ ${runningCount}/${sources.length} 运行中`));
16647
+ output.log(chalk60.green(`✅ ${runningCount}/${sources.length} 运行中`));
16420
16648
  } finally {
16421
16649
  await envService.dispose();
16422
16650
  }
@@ -16428,7 +16656,7 @@ var EventSourceCommand = {
16428
16656
  command: "eventsource",
16429
16657
  aliases: ["es", "event-source"],
16430
16658
  describe: "事件源管理 - 添加、启动、停止各种事件源(lark-cli、timer、websocket)",
16431
- 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(),
16432
16660
  handler: () => {}
16433
16661
  };
16434
16662
 
@@ -16729,7 +16957,7 @@ var DebugCommand = {
16729
16957
  };
16730
16958
 
16731
16959
  // src/commands/workflow/renderers.ts
16732
- import chalk60 from "chalk";
16960
+ import chalk61 from "chalk";
16733
16961
  function truncateVisual3(str, maxWidth) {
16734
16962
  if (!str)
16735
16963
  return "-";
@@ -16764,18 +16992,18 @@ function formatDuration(ms) {
16764
16992
  function statusColor(status) {
16765
16993
  switch (status) {
16766
16994
  case "completed":
16767
- return chalk60.green;
16995
+ return chalk61.green;
16768
16996
  case "running":
16769
16997
  case "idle":
16770
- return chalk60.blue;
16998
+ return chalk61.blue;
16771
16999
  case "paused":
16772
- return chalk60.yellow;
17000
+ return chalk61.yellow;
16773
17001
  case "failed":
16774
- return chalk60.red;
17002
+ return chalk61.red;
16775
17003
  case "stopped":
16776
- return chalk60.gray;
17004
+ return chalk61.gray;
16777
17005
  default:
16778
- return chalk60.white;
17006
+ return chalk61.white;
16779
17007
  }
16780
17008
  }
16781
17009
  function renderWorkflowList(workflows, options) {
@@ -16794,7 +17022,7 @@ function renderWorkflowList(workflows, options) {
16794
17022
  }, null, 2);
16795
17023
  }
16796
17024
  if (workflows.length === 0) {
16797
- return chalk60.yellow("No workflows found");
17025
+ return chalk61.yellow("No workflows found");
16798
17026
  }
16799
17027
  const NAME_WIDTH = 30;
16800
17028
  const VERSION_WIDTH = 10;
@@ -16802,10 +17030,10 @@ function renderWorkflowList(workflows, options) {
16802
17030
  const UPDATED_WIDTH = 20;
16803
17031
  const GAP = " ";
16804
17032
  const headerLine = [
16805
- chalk60.bold("NAME".padEnd(NAME_WIDTH)),
16806
- chalk60.bold("VER".padEnd(VERSION_WIDTH)),
16807
- chalk60.bold("TAGS".padEnd(TAGS_WIDTH)),
16808
- 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")
16809
17037
  ].join(GAP);
16810
17038
  const sepLine = "─".repeat(NAME_WIDTH + VERSION_WIDTH + TAGS_WIDTH + UPDATED_WIDTH + GAP.length * 3);
16811
17039
  const rows = workflows.map((w) => {
@@ -16820,18 +17048,18 @@ function renderWorkflowList(workflows, options) {
16820
17048
  }
16821
17049
  function renderWorkflowDetail(workflow, options) {
16822
17050
  const lines = [];
16823
- lines.push(chalk60.bold(`
17051
+ lines.push(chalk61.bold(`
16824
17052
  \uD83D\uDCCB Workflow Details
16825
17053
  `));
16826
- lines.push(` ${chalk60.cyan("ID:")} ${workflow.id}`);
16827
- lines.push(` ${chalk60.cyan("Name:")} ${workflow.name}`);
16828
- lines.push(` ${chalk60.cyan("Version:")} ${workflow.version}`);
16829
- lines.push(` ${chalk60.cyan("Description:")} ${workflow.description || "-"}`);
16830
- lines.push(` ${chalk60.cyan("Tags:")} ${workflow.tags.join(", ") || "-"}`);
16831
- lines.push(` ${chalk60.cyan("Created:")} ${formatDate(workflow.createdAt)}`);
16832
- 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)}`);
16833
17061
  const nodeCount = workflow.definition.nodes.length;
16834
- lines.push(chalk60.bold(`
17062
+ lines.push(chalk61.bold(`
16835
17063
  \uD83D\uDCCA Nodes Summary
16836
17064
  `));
16837
17065
  lines.push(` Total: ${nodeCount} nodes`);
@@ -16843,7 +17071,7 @@ function renderWorkflowDetail(workflow, options) {
16843
17071
  lines.push(` - ${type}: ${count}`);
16844
17072
  }
16845
17073
  if (workflow.definition.config) {
16846
- lines.push(chalk60.bold(`
17074
+ lines.push(chalk61.bold(`
16847
17075
  ⚙️ Configuration
16848
17076
  `));
16849
17077
  if (workflow.definition.config.parallel_limit !== undefined) {
@@ -16857,7 +17085,7 @@ function renderWorkflowDetail(workflow, options) {
16857
17085
  }
16858
17086
  }
16859
17087
  if (options?.includeRuns && options.includeRuns.length > 0) {
16860
- lines.push(chalk60.bold(`
17088
+ lines.push(chalk61.bold(`
16861
17089
  \uD83D\uDCDC Recent Runs
16862
17090
  `));
16863
17091
  lines.push(renderRunsList(options.includeRuns.slice(0, 5)));
@@ -16881,7 +17109,7 @@ function renderRunsList(runs, options) {
16881
17109
  }, null, 2);
16882
17110
  }
16883
17111
  if (runs.length === 0) {
16884
- return chalk60.yellow("No runs found");
17112
+ return chalk61.yellow("No runs found");
16885
17113
  }
16886
17114
  const ID_WIDTH = 20;
16887
17115
  const STATUS_WIDTH = 12;
@@ -16889,10 +17117,10 @@ function renderRunsList(runs, options) {
16889
17117
  const UPDATED_WIDTH = 20;
16890
17118
  const GAP = " ";
16891
17119
  const headerLine = [
16892
- chalk60.bold("RUN ID".padEnd(ID_WIDTH)),
16893
- chalk60.bold("STATUS".padEnd(STATUS_WIDTH)),
16894
- chalk60.bold("DURATION".padEnd(DURATION_WIDTH)),
16895
- 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")
16896
17124
  ].join(GAP);
16897
17125
  const sepLine = "─".repeat(ID_WIDTH + STATUS_WIDTH + DURATION_WIDTH + UPDATED_WIDTH + GAP.length * 3);
16898
17126
  const rows = runs.map((r) => {
@@ -16907,34 +17135,34 @@ function renderRunsList(runs, options) {
16907
17135
  }
16908
17136
  function renderRunDetail(run) {
16909
17137
  const lines = [];
16910
- lines.push(chalk60.bold(`
17138
+ lines.push(chalk61.bold(`
16911
17139
  \uD83C\uDFC3 Run Details
16912
17140
  `));
16913
- lines.push(` ${chalk60.cyan("Run ID:")} ${run.id}`);
16914
- lines.push(` ${chalk60.cyan("Workflow:")} ${run.workflowId}`);
16915
- lines.push(` ${chalk60.cyan("Status:")} ${statusColor(run.status)(run.status)}`);
16916
- 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)}`);
16917
17145
  if (run.pausedAt) {
16918
- lines.push(` ${chalk60.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
17146
+ lines.push(` ${chalk61.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
16919
17147
  }
16920
17148
  if (run.resumedAt) {
16921
- lines.push(` ${chalk60.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
17149
+ lines.push(` ${chalk61.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
16922
17150
  }
16923
17151
  if (run.stoppedAt) {
16924
- lines.push(` ${chalk60.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
17152
+ lines.push(` ${chalk61.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
16925
17153
  }
16926
17154
  if (run.completedAt) {
16927
- lines.push(` ${chalk60.cyan("Completed:")} ${formatDate(run.completedAt)}`);
17155
+ lines.push(` ${chalk61.cyan("Completed:")} ${formatDate(run.completedAt)}`);
16928
17156
  }
16929
- lines.push(` ${chalk60.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
17157
+ lines.push(` ${chalk61.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
16930
17158
  if (run.error) {
16931
- lines.push(chalk60.bold(`
17159
+ lines.push(chalk61.bold(`
16932
17160
  ❌ Error
16933
17161
  `));
16934
- lines.push(` ${chalk60.red(run.error)}`);
17162
+ lines.push(` ${chalk61.red(run.error)}`);
16935
17163
  }
16936
17164
  if (run.output) {
16937
- lines.push(chalk60.bold(`
17165
+ lines.push(chalk61.bold(`
16938
17166
  \uD83D\uDCE4 Output
16939
17167
  `));
16940
17168
  lines.push(" " + JSON.stringify(run.output, null, 2).split(`
@@ -16945,36 +17173,36 @@ function renderRunDetail(run) {
16945
17173
  `);
16946
17174
  }
16947
17175
  function renderWorkflowAdded(workflow) {
16948
- return chalk60.green(`
17176
+ return chalk61.green(`
16949
17177
  ✅ Workflow '${workflow.name}' added successfully
16950
17178
  `) + ` ID: ${workflow.id}
16951
17179
  ` + ` Version: ${workflow.version}
16952
17180
  `;
16953
17181
  }
16954
17182
  function renderWorkflowUpdated(workflow) {
16955
- return chalk60.green(`
17183
+ return chalk61.green(`
16956
17184
  ✅ Workflow '${workflow.name}' updated successfully
16957
17185
  `) + ` ID: ${workflow.id}
16958
17186
  `;
16959
17187
  }
16960
17188
  function renderWorkflowDeleted(name) {
16961
- return chalk60.green(`
17189
+ return chalk61.green(`
16962
17190
  ✅ Workflow '${name}' deleted successfully
16963
17191
  `);
16964
17192
  }
16965
17193
  function renderRunResult(result) {
16966
17194
  const lines = [];
16967
17195
  if (result.status === "completed") {
16968
- lines.push(chalk60.green(`
17196
+ lines.push(chalk61.green(`
16969
17197
  ✅ Workflow completed successfully`));
16970
17198
  } else if (result.status === "failed") {
16971
- lines.push(chalk60.red(`
17199
+ lines.push(chalk61.red(`
16972
17200
  ❌ Workflow failed`));
16973
17201
  } else if (result.status === "stopped") {
16974
- lines.push(chalk60.yellow(`
17202
+ lines.push(chalk61.yellow(`
16975
17203
  ⚠️ Workflow stopped`));
16976
17204
  } else {
16977
- lines.push(chalk60.blue(`
17205
+ lines.push(chalk61.blue(`
16978
17206
  \uD83D\uDD04 Workflow ${result.status}`));
16979
17207
  }
16980
17208
  lines.push(` Run ID: ${result.runId}`);
@@ -16982,11 +17210,11 @@ function renderRunResult(result) {
16982
17210
  lines.push(` Duration: ${formatDuration(result.durationMs)}`);
16983
17211
  }
16984
17212
  if (result.error) {
16985
- lines.push(chalk60.red(`
17213
+ lines.push(chalk61.red(`
16986
17214
  Error: ${result.error}`));
16987
17215
  }
16988
17216
  if (result.output) {
16989
- lines.push(chalk60.bold(`
17217
+ lines.push(chalk61.bold(`
16990
17218
  \uD83D\uDCE4 Output:`));
16991
17219
  lines.push(JSON.stringify(result.output, null, 2));
16992
17220
  }
@@ -17000,10 +17228,10 @@ function renderNodesList(nodes) {
17000
17228
  const DEPS_WIDTH = 20;
17001
17229
  const GAP = " ";
17002
17230
  const headerLine = [
17003
- chalk60.bold("NODE ID".padEnd(ID_WIDTH)),
17004
- chalk60.bold("TYPE".padEnd(TYPE_WIDTH)),
17005
- chalk60.bold("NAME".padEnd(NAME_WIDTH)),
17006
- 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")
17007
17235
  ].join(GAP);
17008
17236
  const sepLine = "─".repeat(ID_WIDTH + TYPE_WIDTH + NAME_WIDTH + DEPS_WIDTH + GAP.length * 3);
17009
17237
  const rows = nodes.map((n) => {
@@ -17018,7 +17246,7 @@ function renderNodesList(nodes) {
17018
17246
  }
17019
17247
 
17020
17248
  // src/commands/workflow/commands/list.ts
17021
- import chalk61 from "chalk";
17249
+ import chalk62 from "chalk";
17022
17250
  import { createWorkflowListTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
17023
17251
  var WorkflowListCommand = {
17024
17252
  command: "list",
@@ -17081,7 +17309,7 @@ var WorkflowListCommand = {
17081
17309
  type: "string"
17082
17310
  }),
17083
17311
  async handler(args) {
17084
- const output = new OutputService;
17312
+ const output = new OutputService2;
17085
17313
  const envService = new EnvironmentService(output);
17086
17314
  try {
17087
17315
  await envService.create({ configPath: args.config });
@@ -17156,20 +17384,20 @@ var WorkflowListCommand = {
17156
17384
  if (total > workflows.length) {
17157
17385
  const start = finalOffset + 1;
17158
17386
  const end = finalOffset + workflows.length;
17159
- output.log(chalk61.green(`
17387
+ output.log(chalk62.green(`
17160
17388
  ✅ 显示 ${start}-${end} / 共 ${total} 个 Workflow`));
17161
17389
  const totalPages = Math.ceil(total / pageSize);
17162
17390
  const currentPage = Math.floor(finalOffset / pageSize) + 1;
17163
17391
  if (totalPages > 1) {
17164
- output.log(chalk61.cyan(`\uD83D\uDCC4 第 ${currentPage} / ${totalPages} 页`));
17392
+ output.log(chalk62.cyan(`\uD83D\uDCC4 第 ${currentPage} / ${totalPages} 页`));
17165
17393
  }
17166
17394
  } else {
17167
- output.log(chalk61.green(`
17395
+ output.log(chalk62.green(`
17168
17396
  ✅ 共 ${total} 个 Workflow`));
17169
17397
  }
17170
17398
  if (availableTags.length > 0) {
17171
17399
  const tagsLine = availableTags.map((t) => `${t.name}(${t.count})`).join(", ");
17172
- output.log(chalk61.cyan(`
17400
+ output.log(chalk62.cyan(`
17173
17401
  \uD83C\uDFF7️ Available tags: ${tagsLine}`));
17174
17402
  }
17175
17403
  }
@@ -17772,7 +18000,7 @@ class WorkflowValidator {
17772
18000
  }
17773
18001
 
17774
18002
  // src/commands/workflow/commands/add.ts
17775
- import chalk62 from "chalk";
18003
+ import chalk63 from "chalk";
17776
18004
  import fs3 from "fs";
17777
18005
  import path6 from "path";
17778
18006
  import { createWorkflowExtractorAgent } from "@ai-setting/roy-agent-core/env/task/plugins";
@@ -17865,7 +18093,7 @@ var WorkflowAddCommand = {
17865
18093
  不要用 bash tool + command 输出多行内容(shell 会执行失败)。`),
17866
18094
  async handler(args) {
17867
18095
  const a = args;
17868
- const output = new OutputService;
18096
+ const output = new OutputService2;
17869
18097
  const envService = new EnvironmentService(output);
17870
18098
  try {
17871
18099
  let parseTags = function(input) {
@@ -17915,7 +18143,7 @@ var WorkflowAddCommand = {
17915
18143
  definition = await parseWorkflowContent(content, filePath);
17916
18144
  workflowName = a.name || definition.name || path6.basename(filePath);
17917
18145
  if (a.validate) {
17918
- output.log(chalk62.blue("\uD83D\uDD0D Validating workflow..."));
18146
+ output.log(chalk63.blue("\uD83D\uDD0D Validating workflow..."));
17919
18147
  const validator = new WorkflowValidator;
17920
18148
  const result = validator.validate(definition);
17921
18149
  if (!result.valid) {
@@ -17930,11 +18158,11 @@ var WorkflowAddCommand = {
17930
18158
  });
17931
18159
  process.exit(1);
17932
18160
  }
17933
- output.log(chalk62.green(`✅ Workflow validation passed
18161
+ output.log(chalk63.green(`✅ Workflow validation passed
17934
18162
  `));
17935
18163
  }
17936
18164
  } else if (a.desc) {
17937
- output.log(chalk62.blue(`\uD83E\uDD16 Generating workflow from description...
18165
+ output.log(chalk63.blue(`\uD83E\uDD16 Generating workflow from description...
17938
18166
  `));
17939
18167
  const agentComponent = env.getComponent("agent");
17940
18168
  if (!agentComponent) {
@@ -17942,10 +18170,10 @@ var WorkflowAddCommand = {
17942
18170
  process.exit(1);
17943
18171
  }
17944
18172
  if (!agentComponent.getAgent("workflow-extractor")) {
17945
- output.log(chalk62.gray("Auto-registering workflow-extractor agent..."));
18173
+ output.log(chalk63.gray("Auto-registering workflow-extractor agent..."));
17946
18174
  const extractorConfig = createWorkflowExtractorAgent();
17947
18175
  agentComponent.registerAgent(extractorConfig.name, extractorConfig);
17948
- output.log(chalk62.green(`✅ workflow-extractor agent registered
18176
+ output.log(chalk63.green(`✅ workflow-extractor agent registered
17949
18177
  `));
17950
18178
  }
17951
18179
  const prompt = `## 任务
@@ -17959,20 +18187,20 @@ ${a.desc}
17959
18187
  1. 先用 \`roy-agent workflow nodes\` 查看可用的节点类型
17960
18188
  2. 生成的 YAML 必须通过 \`roy-agent workflow validate --yaml "<yaml>"\` 验证
17961
18189
  3. 验证通过后才输出最终 YAML`;
17962
- output.log(chalk62.gray("Running workflow-extractor agent..."));
18190
+ output.log(chalk63.gray("Running workflow-extractor agent..."));
17963
18191
  const result = await agentComponent.run("workflow-extractor", prompt);
17964
18192
  const agentOutput = result.finalText || "";
17965
18193
  definition = parseYamlFromAgentOutput(agentOutput);
17966
18194
  if (definition === null) {
17967
18195
  output.error("Failed to parse workflow from agent output");
17968
- output.log(chalk62.gray(`
18196
+ output.log(chalk63.gray(`
17969
18197
  Agent output:
17970
18198
  ` + agentOutput.slice(0, 500)));
17971
18199
  process.exit(1);
17972
18200
  }
17973
18201
  workflowName = a.name || definition.name;
17974
18202
  if (a.validate) {
17975
- output.log(chalk62.blue(`
18203
+ output.log(chalk63.blue(`
17976
18204
  \uD83D\uDD0D Validating generated workflow...`));
17977
18205
  const validator = new WorkflowValidator;
17978
18206
  const result2 = validator.validate(definition);
@@ -17986,16 +18214,16 @@ Agent output:
17986
18214
  output.error(` Fix: ${error.fix}
17987
18215
  `);
17988
18216
  });
17989
- output.log(chalk62.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
18217
+ output.log(chalk63.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
17990
18218
  process.exit(1);
17991
18219
  }
17992
- output.log(chalk62.green(`✅ Generated workflow validation passed
18220
+ output.log(chalk63.green(`✅ Generated workflow validation passed
17993
18221
  `));
17994
18222
  }
17995
18223
  const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
17996
- output.log(chalk62.gray("--- Generated YAML ---"));
18224
+ output.log(chalk63.gray("--- Generated YAML ---"));
17997
18225
  output.log(yaml.stringify(definition));
17998
- output.log(chalk62.gray(`------------------------
18226
+ output.log(chalk63.gray(`------------------------
17999
18227
  `));
18000
18228
  } else {
18001
18229
  output.error("Please provide --file or --desc option");
@@ -18021,10 +18249,10 @@ Agent output:
18021
18249
  force: a.force
18022
18250
  });
18023
18251
  output.log(renderWorkflowAdded(workflow));
18024
- output.log(chalk62.bold(`
18252
+ output.log(chalk63.bold(`
18025
18253
  \uD83D\uDCCA Nodes Summary:`));
18026
18254
  output.log(renderNodesList(definition.nodes));
18027
- output.log(chalk62.green(`
18255
+ output.log(chalk63.green(`
18028
18256
  ✅ Workflow '${workflowName}' added successfully`));
18029
18257
  } catch (error) {
18030
18258
  if (error.message?.includes("already exists") && !a.force) {
@@ -18041,7 +18269,7 @@ Agent output:
18041
18269
  };
18042
18270
 
18043
18271
  // src/commands/workflow/commands/get.ts
18044
- import chalk63 from "chalk";
18272
+ import chalk64 from "chalk";
18045
18273
  import { createWorkflowGetTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
18046
18274
  var WorkflowGetCommand = {
18047
18275
  command: "get <identifier>",
@@ -18077,7 +18305,7 @@ var WorkflowGetCommand = {
18077
18305
  type: "string"
18078
18306
  }),
18079
18307
  async handler(args) {
18080
- const output = new OutputService;
18308
+ const output = new OutputService2;
18081
18309
  const envService = new EnvironmentService(output);
18082
18310
  try {
18083
18311
  await envService.create({ configPath: args.config });
@@ -18179,15 +18407,15 @@ var WorkflowGetCommand = {
18179
18407
  } else {
18180
18408
  output.log(renderWorkflowDetail(workflow, { includeRuns: runs }));
18181
18409
  if (args.includeNodes) {
18182
- output.log(chalk63.bold(`
18410
+ output.log(chalk64.bold(`
18183
18411
  \uD83D\uDCCB All Nodes:`));
18184
18412
  output.log(renderNodesList(data.nodes || []));
18185
18413
  }
18186
18414
  const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
18187
18415
  const defYaml = yaml.stringify(data.definition || {}, { indent: 2 });
18188
- output.log(chalk63.bold(`
18416
+ output.log(chalk64.bold(`
18189
18417
  \uD83D\uDCC4 Definition (YAML):`));
18190
- output.log(chalk63.gray(defYaml));
18418
+ output.log(chalk64.gray(defYaml));
18191
18419
  }
18192
18420
  }
18193
18421
  } catch (error) {
@@ -18200,7 +18428,7 @@ var WorkflowGetCommand = {
18200
18428
  };
18201
18429
 
18202
18430
  // src/commands/workflow/commands/update.ts
18203
- import chalk64 from "chalk";
18431
+ import chalk65 from "chalk";
18204
18432
  import fs4 from "fs";
18205
18433
  import path7 from "path";
18206
18434
  import { parseWorkflowFile } from "@ai-setting/roy-agent-core/env/workflow/types";
@@ -18233,7 +18461,7 @@ var WorkflowUpdateCommand = {
18233
18461
  }),
18234
18462
  async handler(args) {
18235
18463
  const a = args;
18236
- const output = new OutputService;
18464
+ const output = new OutputService2;
18237
18465
  const envService = new EnvironmentService(output);
18238
18466
  try {
18239
18467
  await envService.create({ configPath: a.config });
@@ -18273,7 +18501,7 @@ var WorkflowUpdateCommand = {
18273
18501
  const tags = a.tags ? a.tags.split(",").map((t) => t.trim()) : undefined;
18274
18502
  const workflow = await service.updateWorkflow(a.name, updates, { tags });
18275
18503
  output.log(renderWorkflowUpdated(workflow));
18276
- output.log(chalk64.green(`
18504
+ output.log(chalk65.green(`
18277
18505
  ✅ Workflow '${a.name}' updated successfully`));
18278
18506
  } catch (error) {
18279
18507
  output.error(`Failed to update workflow: ${error}`);
@@ -18285,7 +18513,7 @@ var WorkflowUpdateCommand = {
18285
18513
  };
18286
18514
 
18287
18515
  // src/commands/workflow/commands/remove.ts
18288
- import chalk65 from "chalk";
18516
+ import chalk66 from "chalk";
18289
18517
  var WorkflowRemoveCommand = {
18290
18518
  command: "remove <name>",
18291
18519
  describe: "删除 Workflow",
@@ -18303,7 +18531,7 @@ var WorkflowRemoveCommand = {
18303
18531
  type: "string"
18304
18532
  }),
18305
18533
  async handler(args) {
18306
- const output = new OutputService;
18534
+ const output = new OutputService2;
18307
18535
  const envService = new EnvironmentService(output);
18308
18536
  try {
18309
18537
  await envService.create({ configPath: args.config });
@@ -18324,8 +18552,8 @@ var WorkflowRemoveCommand = {
18324
18552
  process.exit(1);
18325
18553
  }
18326
18554
  if (!args.force) {
18327
- output.log(chalk65.yellow(`Are you sure you want to delete workflow '${args.name}'?`));
18328
- 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"));
18329
18557
  process.exit(1);
18330
18558
  }
18331
18559
  const deleted = await service.deleteWorkflow(args.name);
@@ -18345,13 +18573,13 @@ var WorkflowRemoveCommand = {
18345
18573
 
18346
18574
  // src/commands/workflow/commands/run.ts
18347
18575
  var import_yaml = __toESM(require_dist(), 1);
18348
- import chalk66 from "chalk";
18576
+ import chalk67 from "chalk";
18349
18577
  import fs5 from "fs";
18350
18578
  import path8 from "path";
18351
18579
  import { createRunWorkflowTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
18352
18580
  import { getTracerProvider as getTracerProvider4, propagation, wrapFunction } from "@ai-setting/roy-agent-core";
18353
18581
  var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
18354
- const output = new OutputService;
18582
+ const output = new OutputService2;
18355
18583
  const envService = new EnvironmentService(output);
18356
18584
  const traceparent = process.env.TRACEPARENT;
18357
18585
  let traceId;
@@ -18419,7 +18647,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
18419
18647
  };
18420
18648
  if (args.sessionId) {
18421
18649
  const sessionId = args.sessionId.startsWith("workflow_") ? args.sessionId : `workflow_${args.sessionId}`;
18422
- output.log(chalk66.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
18650
+ output.log(chalk67.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
18423
18651
  const sessionComponent = workflowComponent.sessionComponent;
18424
18652
  if (!sessionComponent) {
18425
18653
  output.error("SessionComponent not available");
@@ -18481,17 +18709,17 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
18481
18709
  definition = { ...definition, name: args.name };
18482
18710
  }
18483
18711
  const workflow = await service.createWorkflow(definition, { force: true });
18484
- output.log(chalk66.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
18485
- 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})`));
18486
18714
  if (args.registerOnly) {
18487
- output.log(chalk66.gray("ℹ️ Use --register-only, skipping execution"));
18715
+ output.log(chalk67.gray("ℹ️ Use --register-only, skipping execution"));
18488
18716
  if (workflowSpan) {
18489
18717
  workflowSpan.end();
18490
18718
  }
18491
18719
  await envService.dispose();
18492
18720
  process.exit(0);
18493
18721
  }
18494
- output.log(chalk66.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
18722
+ output.log(chalk67.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
18495
18723
  const result = await service.runWorkflow(definition, input, runOptions);
18496
18724
  output.log(renderRunResult({
18497
18725
  runId: result.runId,
@@ -18501,7 +18729,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
18501
18729
  durationMs: result.durationMs
18502
18730
  }));
18503
18731
  if (result.status === "paused") {
18504
- output.log(chalk66.gray(`
18732
+ output.log(chalk67.gray(`
18505
18733
  \uD83D\uDCA1 Use "roy-agent workflow run ${result.runId} --session-id ${result.runId} --input '<response>'" to resume`));
18506
18734
  }
18507
18735
  } else {
@@ -18524,7 +18752,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
18524
18752
  durationMs: runData.duration_ms
18525
18753
  }));
18526
18754
  if (runData.status === "paused") {
18527
- output.log(chalk66.gray(`
18755
+ output.log(chalk67.gray(`
18528
18756
  \uD83D\uDCA1 Use "roy-agent workflow run ${runData.run_id} --session-id ${runData.run_id} --input '<response>'" to resume`));
18529
18757
  }
18530
18758
  }
@@ -18596,11 +18824,11 @@ var WorkflowRunCommand = {
18596
18824
  };
18597
18825
 
18598
18826
  // src/commands/workflow/commands/stop.ts
18599
- import chalk67 from "chalk";
18827
+ import chalk68 from "chalk";
18600
18828
  import { createWorkflowRunStopTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
18601
18829
  import { wrapFunction as wrapFunction2 } from "@ai-setting/roy-agent-core";
18602
18830
  var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
18603
- const output = new OutputService;
18831
+ const output = new OutputService2;
18604
18832
  const envService = new EnvironmentService(output);
18605
18833
  try {
18606
18834
  await envService.create({ configPath: args.config });
@@ -18621,7 +18849,7 @@ var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
18621
18849
  output.error(result.error || `Failed to stop workflow: ${args.runId}`);
18622
18850
  process.exit(1);
18623
18851
  }
18624
- output.log(chalk67.red(`
18852
+ output.log(chalk68.red(`
18625
18853
  ⏹️ Workflow stopped: ${args.runId}`));
18626
18854
  } catch (error) {
18627
18855
  output.error(`Failed to stop workflow: ${error}`);
@@ -18645,7 +18873,7 @@ var WorkflowStopCommand = {
18645
18873
  };
18646
18874
 
18647
18875
  // src/commands/workflow/commands/status.ts
18648
- import chalk68 from "chalk";
18876
+ import chalk69 from "chalk";
18649
18877
  import { createWorkflowRunStatusTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
18650
18878
  var WorkflowStatusCommand = {
18651
18879
  command: "status <runId>",
@@ -18669,7 +18897,7 @@ var WorkflowStatusCommand = {
18669
18897
  type: "string"
18670
18898
  }),
18671
18899
  async handler(args) {
18672
- const output = new OutputService;
18900
+ const output = new OutputService2;
18673
18901
  const envService = new EnvironmentService(output);
18674
18902
  try {
18675
18903
  await envService.create({ configPath: args.config });
@@ -18738,7 +18966,7 @@ var WorkflowStatusCommand = {
18738
18966
  stopped: "⏹️"
18739
18967
  };
18740
18968
  const emoji = statusEmoji[status] || "❓";
18741
- output.log(chalk68.bold(`
18969
+ output.log(chalk69.bold(`
18742
18970
  ${emoji} Status: ${status.toUpperCase()}`));
18743
18971
  }
18744
18972
  } catch (error) {
@@ -18751,7 +18979,7 @@ ${emoji} Status: ${status.toUpperCase()}`));
18751
18979
  };
18752
18980
 
18753
18981
  // src/commands/workflow/commands/nodes.ts
18754
- import chalk69 from "chalk";
18982
+ import chalk70 from "chalk";
18755
18983
  var BUILT_IN_NODES = [
18756
18984
  {
18757
18985
  name: "ToolNode",
@@ -19088,7 +19316,7 @@ nodes:
19088
19316
  ];
19089
19317
  function renderNodeTypesTable(nodes) {
19090
19318
  const lines = [];
19091
- lines.push(chalk69.bold(`
19319
+ lines.push(chalk70.bold(`
19092
19320
  \uD83D\uDCE6 Built-in Node Types
19093
19321
  `));
19094
19322
  lines.push("┌────────────┬────────────────────┬─────────────────────────────────────────────────────────────┐");
@@ -19106,29 +19334,29 @@ function renderNodeTypesTable(nodes) {
19106
19334
  }
19107
19335
  function renderNodeDetail(node) {
19108
19336
  const lines = [];
19109
- lines.push(chalk69.bold(`
19337
+ lines.push(chalk70.bold(`
19110
19338
  [${node.type}] ${node.name}`));
19111
- lines.push(chalk69.dim("─".repeat(60)) + `
19339
+ lines.push(chalk70.dim("─".repeat(60)) + `
19112
19340
  `);
19113
- lines.push(chalk69.bold("Description:"));
19341
+ lines.push(chalk70.bold("Description:"));
19114
19342
  lines.push(` ${node.description}
19115
19343
  `);
19116
- lines.push(chalk69.bold("Configuration:"));
19344
+ lines.push(chalk70.bold("Configuration:"));
19117
19345
  lines.push(' type: "' + node.type + '"');
19118
19346
  lines.push(" config:");
19119
19347
  for (const input of node.inputs) {
19120
- const required = input.required ? chalk69.red("*") : " ";
19348
+ const required = input.required ? chalk70.red("*") : " ";
19121
19349
  lines.push(` ${input.name} (${input.type})${required}`);
19122
19350
  lines.push(` ${input.description}`);
19123
19351
  }
19124
19352
  lines.push(`
19125
- ${chalk69.bold("Output:")} ${node.output}`);
19353
+ ${chalk70.bold("Output:")} ${node.output}`);
19126
19354
  if (node.example) {
19127
- lines.push(chalk69.bold(`
19355
+ lines.push(chalk70.bold(`
19128
19356
  Example:`));
19129
- lines.push(chalk69.gray("```yaml"));
19357
+ lines.push(chalk70.gray("```yaml"));
19130
19358
  lines.push(node.example);
19131
- lines.push(chalk69.gray("```"));
19359
+ lines.push(chalk70.gray("```"));
19132
19360
  }
19133
19361
  return lines.join(`
19134
19362
  `);
@@ -19144,16 +19372,16 @@ var WorkflowNodesCommand = {
19144
19372
  const nodeType = args.type?.toLowerCase();
19145
19373
  if (!nodeType) {
19146
19374
  console.log(renderNodeTypesTable(BUILT_IN_NODES));
19147
- console.log(chalk69.gray(`
19148
- Use `) + chalk69.cyan("roy-agent workflow nodes <type>") + chalk69.gray(" for detailed information"));
19149
- 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(", ")));
19150
19378
  return;
19151
19379
  }
19152
19380
  const node = BUILT_IN_NODES.find((n) => n.type === nodeType);
19153
19381
  if (!node) {
19154
- console.log(chalk69.red(`
19382
+ console.log(chalk70.red(`
19155
19383
  ❌ Unknown node type: ${nodeType}`));
19156
- 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(", ")));
19157
19385
  process.exit(1);
19158
19386
  }
19159
19387
  console.log(renderNodeDetail(node));
@@ -19161,7 +19389,7 @@ Use `) + chalk69.cyan("roy-agent workflow nodes <type>") + chalk69.gray(" for de
19161
19389
  };
19162
19390
 
19163
19391
  // src/commands/workflow/commands/validate.ts
19164
- import chalk70 from "chalk";
19392
+ import chalk71 from "chalk";
19165
19393
  import { readFileSync } from "fs";
19166
19394
  async function parseWorkflowInput(input, yamlStr) {
19167
19395
  const parseYaml = async (content) => {
@@ -19194,25 +19422,25 @@ function renderResult(result, options) {
19194
19422
  return;
19195
19423
  }
19196
19424
  if (result.valid) {
19197
- console.log(chalk70.green(`
19425
+ console.log(chalk71.green(`
19198
19426
  ✅ Workflow validation PASSED
19199
19427
  `));
19200
- console.log(chalk70.bold(`Workflow: ${result.workflowName}`));
19428
+ console.log(chalk71.bold(`Workflow: ${result.workflowName}`));
19201
19429
  console.log(`Nodes: ${result.nodeCount}`);
19202
19430
  console.log(`
19203
19431
  Valid nodes:`);
19204
- console.log(chalk70.green(" ✓ All nodes passed validation"));
19432
+ console.log(chalk71.green(" ✓ All nodes passed validation"));
19205
19433
  } else {
19206
- console.log(chalk70.red(`
19434
+ console.log(chalk71.red(`
19207
19435
  ❌ Workflow validation FAILED (${result.errors.length} errors found)
19208
19436
  `));
19209
19437
  result.errors.forEach((error, index) => {
19210
- console.log(chalk70.red(`[Error ${index + 1}/${result.errors.length}]${error.nodeId ? ` Node "${error.nodeId}"` : ""}`));
19211
- console.log(` ${chalk70.bold("Type:")} ${error.type}`);
19212
- console.log(` ${chalk70.bold("Description:")} ${error.description}`);
19213
- console.log(` ${chalk70.bold("Expected:")} ${error.expected}`);
19214
- console.log(` ${chalk70.bold("Actual:")} ${error.actual}`);
19215
- 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}`);
19216
19444
  console.log();
19217
19445
  });
19218
19446
  }
@@ -19237,7 +19465,7 @@ var WorkflowValidateCommand = {
19237
19465
  try {
19238
19466
  const workflow = await parseWorkflowInput(options.input, options.yaml);
19239
19467
  if (!workflow) {
19240
- console.error(chalk70.red("Failed to parse workflow input"));
19468
+ console.error(chalk71.red("Failed to parse workflow input"));
19241
19469
  process.exit(1);
19242
19470
  }
19243
19471
  const validator = new WorkflowValidator;
@@ -19245,7 +19473,7 @@ var WorkflowValidateCommand = {
19245
19473
  renderResult(result, options);
19246
19474
  process.exit(result.valid ? 0 : 1);
19247
19475
  } catch (error) {
19248
- console.error(chalk70.red(`
19476
+ console.error(chalk71.red(`
19249
19477
  Error: ${error.message}`));
19250
19478
  process.exit(1);
19251
19479
  }
@@ -19253,7 +19481,7 @@ Error: ${error.message}`));
19253
19481
  };
19254
19482
 
19255
19483
  // src/commands/workflow/commands/search.ts
19256
- import chalk71 from "chalk";
19484
+ import chalk72 from "chalk";
19257
19485
  import { wrapFunction as wrapFunction3 } from "@ai-setting/roy-agent-core";
19258
19486
  var WorkflowSearchCommand = {
19259
19487
  command: "search",
@@ -19313,7 +19541,7 @@ var WorkflowSearchCommand = {
19313
19541
  }),
19314
19542
  async handler(args) {
19315
19543
  const a = args;
19316
- const output = new OutputService;
19544
+ const output = new OutputService2;
19317
19545
  const envService = new EnvironmentService(output);
19318
19546
  try {
19319
19547
  await runWorkflowSearch({
@@ -19410,22 +19638,22 @@ var _runWorkflowSearchImpl = async function(opts) {
19410
19638
  metadata: {}
19411
19639
  }));
19412
19640
  if (renderWorkflows.length === 0) {
19413
- output.log(chalk71.yellow("\uD83D\uDD0D No workflows matched the search criteria."));
19414
- output.log(chalk71.gray(` keyword: ${keyword || "(none)"}`));
19415
- 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)"}`));
19416
19644
  } else {
19417
- output.log(chalk71.bold(`\uD83D\uDD0D Search results (${renderWorkflows.length}):`));
19645
+ output.log(chalk72.bold(`\uD83D\uDD0D Search results (${renderWorkflows.length}):`));
19418
19646
  output.log(renderWorkflowList(renderWorkflows));
19419
- output.log(chalk71.green(`
19647
+ output.log(chalk72.green(`
19420
19648
  ✅ Found ${renderWorkflows.length} workflow(s)`));
19421
19649
  }
19422
19650
  if (availableTags.length > 0) {
19423
19651
  output.log("");
19424
- 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):"));
19425
19653
  for (const t of availableTags) {
19426
19654
  const name = t.name ?? t.tag;
19427
19655
  const count = t.count ?? t.usage_count;
19428
- output.log(chalk71.gray(` - ${name} (${count})`));
19656
+ output.log(chalk72.gray(` - ${name} (${count})`));
19429
19657
  }
19430
19658
  }
19431
19659
  };
@@ -19437,7 +19665,7 @@ var runWorkflowSearch = wrapFunction3(_runWorkflowSearchImpl, "workflow.cli.sear
19437
19665
 
19438
19666
  // src/commands/workflow/commands/tag.ts
19439
19667
  import { wrapFunction as wrapFunction4 } from "@ai-setting/roy-agent-core";
19440
- import chalk72 from "chalk";
19668
+ import chalk73 from "chalk";
19441
19669
  var WorkflowTagListCommand = {
19442
19670
  command: "list",
19443
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.",
@@ -19464,7 +19692,7 @@ var WorkflowTagListCommand = {
19464
19692
  }),
19465
19693
  async handler(args) {
19466
19694
  const a = args;
19467
- const output = new OutputService;
19695
+ const output = new OutputService2;
19468
19696
  const envService = new EnvironmentService(output);
19469
19697
  try {
19470
19698
  await runWorkflowTagList({
@@ -19509,7 +19737,7 @@ var WorkflowTagGetCommand = {
19509
19737
  }),
19510
19738
  async handler(args) {
19511
19739
  const a = args;
19512
- const output = new OutputService;
19740
+ const output = new OutputService2;
19513
19741
  const envService = new EnvironmentService(output);
19514
19742
  try {
19515
19743
  await runWorkflowTagGet({
@@ -19558,17 +19786,17 @@ var _runWorkflowTagListImpl = async function(opts) {
19558
19786
  return;
19559
19787
  }
19560
19788
  if (result.tags.length === 0) {
19561
- output.log(chalk72.yellow("\uD83C\uDFF7️ No tags in the workflow_tags table yet."));
19562
- 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>`."));
19563
19791
  return;
19564
19792
  }
19565
- output.log(chalk72.bold(`\uD83C\uDFF7️ Workflow tags (${result.total}):`));
19566
- 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)}`));
19567
19795
  for (const t of result.tags) {
19568
19796
  const line = ` ${padRight(t.name, 24)}${padRight(String(t.usage_count), 8)}${padRight(formatDate2(t.created_at), 22)}`;
19569
19797
  output.log(line);
19570
19798
  }
19571
- output.log(chalk72.gray(`
19799
+ output.log(chalk73.gray(`
19572
19800
  \uD83D\uDCA1 Tip: when adding a new workflow, prefer tags from this list to ensure semantic consistency.`));
19573
19801
  };
19574
19802
  var _runWorkflowTagGetImpl = async function(opts) {
@@ -19595,7 +19823,7 @@ var _runWorkflowTagGetImpl = async function(opts) {
19595
19823
  output.json({ error: "Tag not found", name: opts.name });
19596
19824
  } else {
19597
19825
  output.error(`Tag "${opts.name}" not found in the workflow_tags table.`);
19598
- 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.`));
19599
19827
  }
19600
19828
  process.exitCode = 1;
19601
19829
  return;
@@ -19604,10 +19832,10 @@ var _runWorkflowTagGetImpl = async function(opts) {
19604
19832
  output.json(tag);
19605
19833
  return;
19606
19834
  }
19607
- output.log(chalk72.bold(`\uD83C\uDFF7️ Tag: ${tag.name}`));
19608
- output.log(chalk72.gray(` usage_count: ${tag.usage_count}`));
19609
- output.log(chalk72.gray(` created_at: ${tag.created_at}`));
19610
- 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}`));
19611
19839
  };
19612
19840
  async function callListTags(service, options) {
19613
19841
  if (typeof service.listTags !== "function") {