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

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