@ai-setting/roy-agent-cli 1.5.90 → 1.5.94

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.
@@ -270,12 +270,16 @@ ${COLORS.system("[已中断]")}
270
270
  providerId,
271
271
  promptTokens: metadata.usage?.promptTokens,
272
272
  completionTokens: metadata.usage?.completionTokens,
273
- totalTokens: metadata.usage?.totalTokens
273
+ totalTokens: metadata.usage?.totalTokens,
274
+ cacheRead: metadata.usage?.cacheRead,
275
+ cacheWrite: metadata.usage?.cacheWrite
274
276
  };
275
277
  const logData = {
276
278
  promptTokens: this.usageInfo.promptTokens,
277
279
  completionTokens: this.usageInfo.completionTokens,
278
- totalTokens: this.usageInfo.totalTokens
280
+ totalTokens: this.usageInfo.totalTokens,
281
+ cacheRead: this.usageInfo.cacheRead,
282
+ cacheWrite: this.usageInfo.cacheWrite
279
283
  };
280
284
  if (this.contextWindow !== undefined) {
281
285
  logData.contextWindow = this.contextWindow;
@@ -326,6 +330,109 @@ var init_stream_output_service = __esm(() => {
326
330
  };
327
331
  });
328
332
 
333
+ // src/commands/shared/clipboard-helper.ts
334
+ var exports_clipboard_helper = {};
335
+ __export(exports_clipboard_helper, {
336
+ readClipboardImage: () => readClipboardImage,
337
+ isClipboardMockActive: () => isClipboardMockActive
338
+ });
339
+ import { exec } from "node:child_process";
340
+ import { readFile } from "node:fs/promises";
341
+ import { sniffMimeType } from "@ai-setting/roy-agent-core";
342
+ function isClipboardMockActive() {
343
+ return Boolean(process.env.ROY_CLIPBOARD_MOCK_PATH || process.env.ROY_CLIPBOARD_MOCK_FAIL);
344
+ }
345
+ function pickClipboardCommand() {
346
+ const platform = process.platform;
347
+ if (platform === "darwin") {
348
+ return { cmd: "pngpaste", args: [] };
349
+ }
350
+ if (platform === "linux") {
351
+ return {
352
+ cmd: "xclip",
353
+ args: ["-selection", "clipboard", "-t", "image/png", "-o"]
354
+ };
355
+ }
356
+ return null;
357
+ }
358
+ async function readClipboardImage() {
359
+ if (process.env.ROY_CLIPBOARD_MOCK_FAIL === "true") {
360
+ return null;
361
+ }
362
+ if (process.env.ROY_CLIPBOARD_MOCK_PATH) {
363
+ return await readMockFromPath(process.env.ROY_CLIPBOARD_MOCK_PATH);
364
+ }
365
+ const cmdSpec = pickClipboardCommand();
366
+ if (!cmdSpec) {
367
+ return null;
368
+ }
369
+ const stdout = await execAsync(cmdSpec.cmd, cmdSpec.args).catch(() => null);
370
+ if (!stdout || stdout.length === 0) {
371
+ return null;
372
+ }
373
+ const buffer = Buffer.from(stdout);
374
+ const mime = sniffMimeType(buffer);
375
+ if (!mime.startsWith("image/")) {
376
+ return null;
377
+ }
378
+ return { buffer, mime };
379
+ }
380
+ async function readMockFromPath(filePath) {
381
+ try {
382
+ const buffer = await readFile(filePath);
383
+ const mime = sniffMimeType(buffer, filePath);
384
+ if (!mime.startsWith("image/")) {
385
+ return null;
386
+ }
387
+ return { buffer, mime };
388
+ } catch {
389
+ return null;
390
+ }
391
+ }
392
+ function execAsync(cmd, args) {
393
+ return new Promise((resolve) => {
394
+ exec(`${cmd} ${args.map((a) => a.includes(" ") ? `"${a}"` : a).join(" ")}`, { encoding: "buffer", maxBuffer: 10 * 1024 * 1024 }, (err, stdout) => {
395
+ if (err) {
396
+ resolve(null);
397
+ return;
398
+ }
399
+ if (!stdout) {
400
+ resolve(null);
401
+ return;
402
+ }
403
+ resolve(stdout);
404
+ });
405
+ });
406
+ }
407
+ var init_clipboard_helper = () => {};
408
+
409
+ // src/commands/shared/slash-commands.ts
410
+ var exports_slash_commands = {};
411
+ __export(exports_slash_commands, {
412
+ parseSlashCommand: () => parseSlashCommand
413
+ });
414
+ function parseSlashCommand(input) {
415
+ const trimmed = input.trim();
416
+ if (!trimmed.startsWith("/")) {
417
+ return null;
418
+ }
419
+ const spaceIdx = trimmed.indexOf(" ");
420
+ const cmdRaw = (spaceIdx === -1 ? trimmed : trimmed.slice(0, spaceIdx)).toLowerCase();
421
+ const argsRaw = spaceIdx === -1 ? "" : trimmed.slice(spaceIdx + 1).trim();
422
+ switch (cmdRaw) {
423
+ case "/attach":
424
+ return { type: "attach", path: argsRaw };
425
+ case "/list":
426
+ return { type: "list" };
427
+ case "/clear":
428
+ return { type: "clear" };
429
+ case "/paste":
430
+ return { type: "paste" };
431
+ default:
432
+ return null;
433
+ }
434
+ }
435
+
329
436
  // ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/identity.js
330
437
  var require_identity = __commonJS((exports) => {
331
438
  var ALIAS = Symbol.for("yaml.alias");
@@ -7320,7 +7427,7 @@ var require_dist = __commonJS((exports) => {
7320
7427
  var require_package = __commonJS((exports, module) => {
7321
7428
  module.exports = {
7322
7429
  name: "@ai-setting/roy-agent-cli",
7323
- version: "1.5.90",
7430
+ version: "1.5.94",
7324
7431
  type: "module",
7325
7432
  description: "CLI for roy-agent - Non-interactive command execution",
7326
7433
  main: "./dist/index.js",
@@ -8034,9 +8141,11 @@ class ContextHandlerService {
8034
8141
  const traceId = context?.metadata?.traceId;
8035
8142
  const sessionId = context?.sessionId;
8036
8143
  const tracer = this.getTracerInstance();
8144
+ const queryForTrace = typeof query === "string" ? query : JSON.stringify(query).substring(0, 200);
8037
8145
  const span = tracer?.startSpan("handleQueryWithContext", {
8038
8146
  attributes: {
8039
- query: query.substring(0, 200),
8147
+ query: queryForTrace,
8148
+ queryKind: typeof query === "string" ? "text" : "multimodal",
8040
8149
  sessionId,
8041
8150
  traceId
8042
8151
  }
@@ -8149,8 +8258,9 @@ class ContextHandlerService {
8149
8258
  hintPreview: scenarioHint.substring(0, 200)
8150
8259
  }
8151
8260
  });
8261
+ const queryText = typeof originalQuery === "string" ? originalQuery : Array.isArray(originalQuery) ? originalQuery.filter((p) => p?.type === "text").map((p) => p.text ?? "").join(" ") : "";
8152
8262
  const result = await this.sessionComponent.compact(sessionId, {
8153
- summary: originalQuery ? `Auto-compacted. Original query: ${originalQuery.substring(0, 200)}${originalQuery.length > 200 ? "..." : ""}` : "Auto-compacted due to context threshold",
8263
+ summary: queryText ? `Auto-compacted. Original query: ${queryText.substring(0, 200)}${queryText.length > 200 ? "..." : ""}` : "Auto-compacted due to context threshold",
8154
8264
  scenarioHint
8155
8265
  });
8156
8266
  this.env.pushEnvEvent({
@@ -8162,7 +8272,7 @@ class ContextHandlerService {
8162
8272
  scenarioHintUsed: !!scenarioHint
8163
8273
  }
8164
8274
  });
8165
- const newQuery = this.constructQueryWithCheckpoint(result.checkpoint, originalQuery);
8275
+ const newQuery = Array.isArray(originalQuery) ? originalQuery : this.constructQueryWithCheckpoint(result.checkpoint, originalQuery);
8166
8276
  logger3.info("[Phase 2] Compact completed", {
8167
8277
  checkpointId: result.checkpoint.id,
8168
8278
  deletedMessageCount: result.deletedMessageCount,
@@ -8200,7 +8310,7 @@ __legacyDecorateClassTS([
8200
8310
  __legacyMetadataTS("design:type", Function),
8201
8311
  __legacyMetadataTS("design:paramtypes", [
8202
8312
  String,
8203
- String
8313
+ Object
8204
8314
  ]),
8205
8315
  __legacyMetadataTS("design:returntype", typeof Promise === "undefined" ? Object : Promise)
8206
8316
  ], ContextHandlerService.prototype, "compactSessionWithTwoPhases", null);
@@ -8348,6 +8458,42 @@ function isWorkflowPausedActResult(result) {
8348
8458
  }
8349
8459
  }
8350
8460
 
8461
+ // src/commands/shared/multimodal-message.ts
8462
+ import { parseImageInput } from "@ai-setting/roy-agent-core";
8463
+ function parseActImageArgs(raw) {
8464
+ if (raw === undefined || raw === null)
8465
+ return [];
8466
+ if (typeof raw === "string") {
8467
+ return raw.length > 0 ? [raw] : [];
8468
+ }
8469
+ if (!Array.isArray(raw))
8470
+ return [];
8471
+ const cleaned = [];
8472
+ const seen = new Set;
8473
+ for (const item of raw) {
8474
+ if (typeof item !== "string")
8475
+ continue;
8476
+ const trimmed = item.trim();
8477
+ if (!trimmed)
8478
+ continue;
8479
+ if (seen.has(trimmed))
8480
+ continue;
8481
+ seen.add(trimmed);
8482
+ cleaned.push(trimmed);
8483
+ }
8484
+ return cleaned;
8485
+ }
8486
+ function assembleMultimodalMessage(text, imageArgs) {
8487
+ if (!imageArgs || imageArgs.length === 0) {
8488
+ return text;
8489
+ }
8490
+ const imageParts = Promise.all(imageArgs.map((raw) => parseImageInput(raw))).then((parts) => [
8491
+ { type: "text", text },
8492
+ ...parts
8493
+ ]);
8494
+ return imageParts;
8495
+ }
8496
+
8351
8497
  // src/commands/act.ts
8352
8498
  function createActCommand(externalEnvService) {
8353
8499
  return {
@@ -8398,6 +8544,11 @@ function createActCommand(externalEnvService) {
8398
8544
  alias: "a",
8399
8545
  describe: "指定要使用的 agent(如 explore, markdown-ontology-extractor)",
8400
8546
  type: "string"
8547
+ }).option("image", {
8548
+ alias: "i",
8549
+ describe: "附加图片到消息(可多次传入;支持本地路径 / http(s) URL / data:base64)",
8550
+ type: "array",
8551
+ string: true
8401
8552
  }),
8402
8553
  async handler(args) {
8403
8554
  const quiet = args.quiet ?? true;
@@ -8409,6 +8560,11 @@ function createActCommand(externalEnvService) {
8409
8560
  output.info('示例:roy-agent act "帮我写一个 hello world"');
8410
8561
  process.exit(1);
8411
8562
  }
8563
+ const imageArgs = parseActImageArgs(args.image);
8564
+ const hasImages = imageArgs.length > 0;
8565
+ if (hasImages && !quiet) {
8566
+ output.info(`\uD83D\uDCCE 附加 ${imageArgs.length} 张图片`);
8567
+ }
8412
8568
  const shouldDisposeEnvService = !externalEnvService;
8413
8569
  const envService = externalEnvService ?? new EnvironmentService(output);
8414
8570
  let pluginAdapterDispose = null;
@@ -8632,12 +8788,14 @@ function createActCommand(externalEnvService) {
8632
8788
  model: args.model,
8633
8789
  metadata: {
8634
8790
  originalQuery: args.message,
8635
- traceId
8791
+ traceId,
8792
+ queryKind: hasImages ? "multimodal" : "text"
8636
8793
  }
8637
8794
  };
8795
+ const finalQuery = hasImages ? await assembleMultimodalMessage(args.message, imageArgs) : args.message;
8638
8796
  let result;
8639
8797
  try {
8640
- result = await contextHandler.handleQueryWithContext(args.message, context);
8798
+ result = await contextHandler.handleQueryWithContext(finalQuery, context);
8641
8799
  rootSpan.end(result);
8642
8800
  } catch (error) {
8643
8801
  rootSpan.setAttribute("error", String(error));
@@ -8691,13 +8849,16 @@ var ActCommand = createActCommand();
8691
8849
 
8692
8850
  // src/commands/interactive.ts
8693
8851
  import * as readline2 from "readline";
8694
- import chalk4 from "chalk";
8852
+ import chalk5 from "chalk";
8695
8853
 
8696
8854
  // src/commands/shared/session-manager.ts
8855
+ import { parseImageInput as parseImageInput2 } from "@ai-setting/roy-agent-core";
8856
+
8697
8857
  class SessionManager {
8698
8858
  sessionComponent;
8699
8859
  output;
8700
8860
  quiet;
8861
+ attachedImagesMap = new Map;
8701
8862
  constructor(options) {
8702
8863
  this.sessionComponent = options.sessionComponent;
8703
8864
  this.output = options.output;
@@ -8740,6 +8901,7 @@ class SessionManager {
8740
8901
  this.output.info(`创建新会话: ${newSession.title} (${targetSessionId})`);
8741
8902
  }
8742
8903
  }
8904
+ this.clearAttachments();
8743
8905
  const session = await this.sessionComponent.get(targetSessionId);
8744
8906
  return {
8745
8907
  sessionId: targetSessionId,
@@ -8753,6 +8915,34 @@ class SessionManager {
8753
8915
  async getCurrentSession() {
8754
8916
  return this.sessionComponent.getActiveSession();
8755
8917
  }
8918
+ async attachImage(rawPath) {
8919
+ const normalized = rawPath.trim();
8920
+ if (!normalized) {
8921
+ throw new Error("attachImage: empty path");
8922
+ }
8923
+ const existing = this.attachedImagesMap.get(normalized);
8924
+ if (existing) {
8925
+ return existing;
8926
+ }
8927
+ const part = await parseImageInput2(normalized);
8928
+ this.attachedImagesMap.set(normalized, part);
8929
+ return part;
8930
+ }
8931
+ listAttachments() {
8932
+ return Array.from(this.attachedImagesMap.values());
8933
+ }
8934
+ clearAttachments() {
8935
+ this.attachedImagesMap.clear();
8936
+ }
8937
+ async getQueryPayload(text) {
8938
+ if (this.attachedImagesMap.size === 0) {
8939
+ return text;
8940
+ }
8941
+ return [
8942
+ { type: "text", text },
8943
+ ...this.listAttachments()
8944
+ ];
8945
+ }
8756
8946
  }
8757
8947
 
8758
8948
  // src/commands/shared/query-executor.ts
@@ -8868,6 +9058,9 @@ class QueryExecutor {
8868
9058
  getFullText() {
8869
9059
  return this.streamService?.getFullText() ?? "";
8870
9060
  }
9061
+ getLastUsage() {
9062
+ return this.streamService?.getUsageInfo() ?? null;
9063
+ }
8871
9064
  resetStream() {
8872
9065
  this.streamService?.reset();
8873
9066
  }
@@ -8913,7 +9106,7 @@ __legacyDecorateClassTS([
8913
9106
  TracedAs2("cli.query-executor.execute", { recordParams: true, log: true }),
8914
9107
  __legacyMetadataTS("design:type", Function),
8915
9108
  __legacyMetadataTS("design:paramtypes", [
8916
- String,
9109
+ Object,
8917
9110
  String,
8918
9111
  typeof Partial === "undefined" ? Object : Partial,
8919
9112
  String,
@@ -9435,6 +9628,42 @@ function parseUserInput(input, options) {
9435
9628
 
9436
9629
  // src/commands/interactive.ts
9437
9630
  import { AskUserError } from "@ai-setting/roy-agent-core";
9631
+
9632
+ // src/commands/shared/usage-formatter.ts
9633
+ import chalk4 from "chalk";
9634
+ var PRICING = {
9635
+ regularPerToken: 3 / 1e6,
9636
+ cacheReadPerToken: 0.3 / 1e6,
9637
+ cacheWritePerToken: 3.75 / 1e6
9638
+ };
9639
+ function formatCacheLine(usage, options = {}) {
9640
+ const { colorize = true } = options;
9641
+ if (!usage)
9642
+ return null;
9643
+ const cacheRead = usage.cacheRead ?? 0;
9644
+ const cacheWrite = usage.cacheWrite ?? 0;
9645
+ if (usage.cacheRead === undefined && usage.cacheWrite === undefined && cacheRead === 0 && cacheWrite === 0) {
9646
+ return null;
9647
+ }
9648
+ if (cacheRead === 0 && cacheWrite === 0) {
9649
+ if (!colorize)
9650
+ return "\uD83D\uDCB0 Cache: read 0 / write 0 (saved ~$0.000 / 0% hit rate)";
9651
+ return chalk4.gray("\uD83D\uDCB0 Cache: read 0 / write 0 (saved ~$0.000 / 0% hit rate)");
9652
+ }
9653
+ const saved = cacheRead * (PRICING.regularPerToken - PRICING.cacheReadPerToken);
9654
+ const denom = cacheRead + cacheWrite;
9655
+ const hitRate = denom > 0 ? (cacheRead / denom * 100).toFixed(0) : "0";
9656
+ const text = `\uD83D\uDCB0 Cache: read ${cacheRead} / write ${cacheWrite} (saved ~$${saved.toFixed(3)} / ${hitRate}% hit rate)`;
9657
+ if (!colorize)
9658
+ return text;
9659
+ if (cacheRead > 0 && cacheWrite === 0)
9660
+ return chalk4.green(text);
9661
+ if (cacheRead === 0 && cacheWrite > 0)
9662
+ return chalk4.yellow(text);
9663
+ return chalk4.yellow(text);
9664
+ }
9665
+
9666
+ // src/commands/interactive.ts
9438
9667
  var logger4 = createLogger4("cli:interactive");
9439
9668
  var USER_PROMPT = COLORS.userInput("❯ ");
9440
9669
 
@@ -9447,6 +9676,12 @@ class REPL {
9447
9676
  env = null;
9448
9677
  inputHandler;
9449
9678
  keypressHandler;
9679
+ sessionManager = null;
9680
+ lastAttachPath = undefined;
9681
+ lastUsage = null;
9682
+ setLastUsage(usage) {
9683
+ this.lastUsage = usage;
9684
+ }
9450
9685
  constructor(options, env) {
9451
9686
  this.options = options;
9452
9687
  this.env = env ?? null;
@@ -9501,10 +9736,12 @@ class REPL {
9501
9736
  this.commandRegistry.set("clear", async () => {
9502
9737
  console.clear();
9503
9738
  this.printHeader();
9739
+ this.sessionManager?.clearAttachments();
9504
9740
  });
9505
9741
  this.commandRegistry.set("cls", async () => {
9506
9742
  console.clear();
9507
9743
  this.printHeader();
9744
+ this.sessionManager?.clearAttachments();
9508
9745
  });
9509
9746
  this.commandRegistry.set("sessions", async () => {
9510
9747
  this.printSessionsHelp();
@@ -9516,6 +9753,61 @@ class REPL {
9516
9753
  this.commandRegistry.set("c", async () => {
9517
9754
  await this.options.onCompact();
9518
9755
  });
9756
+ this.commandRegistry.set("attach", async () => {
9757
+ const path2 = this.lastAttachPath;
9758
+ this.lastAttachPath = undefined;
9759
+ if (!path2) {
9760
+ console.log(`
9761
+ ${COLORS.error("用法: /attach <path|url>")}`);
9762
+ return;
9763
+ }
9764
+ try {
9765
+ await this.sessionManager.attachImage(path2);
9766
+ const list = this.sessionManager.listAttachments();
9767
+ console.log(`
9768
+ ${COLORS.system(`\uD83D\uDCCE 已添加 (共 ${list.length} 张)`)}`);
9769
+ } catch (err) {
9770
+ console.log(`
9771
+ ${COLORS.error("❌ 附加失败: " + (err instanceof Error ? err.message : String(err)))}`);
9772
+ }
9773
+ });
9774
+ this.commandRegistry.set("list", async () => {
9775
+ const list = this.sessionManager?.listAttachments() ?? [];
9776
+ if (list.length === 0) {
9777
+ console.log(`
9778
+ ${COLORS.system("\uD83D\uDCCE 当前没有 attach 图片 (使用 /attach <path> 添加)")}`);
9779
+ return;
9780
+ }
9781
+ console.log(`
9782
+ ${COLORS.system(`\uD83D\uDCCE 当前 attach 列表 (${list.length} 张):`)}`);
9783
+ list.forEach((p, i) => {
9784
+ if (p.type === "image") {
9785
+ const desc = typeof p.image === "string" ? p.image : `<buffer ${p.image.byteLength ?? 0} bytes>`;
9786
+ console.log(` ${i + 1}. ${desc}`);
9787
+ }
9788
+ });
9789
+ });
9790
+ this.commandRegistry.set("paste", async () => {
9791
+ const { readClipboardImage: readClipboardImage2 } = await Promise.resolve().then(() => (init_clipboard_helper(), exports_clipboard_helper));
9792
+ const result = await readClipboardImage2();
9793
+ if (!result) {
9794
+ console.log(`
9795
+ ${COLORS.error("❌ 剪贴板中没有图片,或剪贴板工具不可用")}`);
9796
+ return;
9797
+ }
9798
+ const tmpPath = `/tmp/roy-paste-${Date.now()}.${result.mime.split("/")[1] || "png"}`;
9799
+ try {
9800
+ const fs2 = await import("node:fs/promises");
9801
+ await fs2.writeFile(tmpPath, result.buffer);
9802
+ await this.sessionManager.attachImage(tmpPath);
9803
+ const list = this.sessionManager.listAttachments();
9804
+ console.log(`
9805
+ ${COLORS.system(`\uD83D\uDCCE 已粘贴 (共 ${list.length} 张): ${tmpPath}`)}`);
9806
+ } catch (err) {
9807
+ console.log(`
9808
+ ${COLORS.error("❌ 粘贴失败: " + (err instanceof Error ? err.message : String(err)))}`);
9809
+ }
9810
+ });
9519
9811
  this.commandRegistry.set("abort", async () => {
9520
9812
  if (this.isExecuting) {
9521
9813
  console.log(`
@@ -9576,6 +9868,11 @@ ${COLORS.system("[没有正在执行的请求]")}`);
9576
9868
  return;
9577
9869
  }
9578
9870
  if (line.startsWith("/") && this.inputHandler.getBuffer() === "") {
9871
+ const { parseSlashCommand: parseSlashCommand2 } = await Promise.resolve().then(() => exports_slash_commands);
9872
+ const slash = parseSlashCommand2(line);
9873
+ if (slash?.type === "attach") {
9874
+ this.lastAttachPath = slash.path;
9875
+ }
9579
9876
  await this.handleCommand(line.slice(1));
9580
9877
  this.inputHandler.reset();
9581
9878
  this.updatePrompt();
@@ -9618,7 +9915,8 @@ ${COLORS.system("⏳ 上一次请求尚未完成,请稍候...")}
9618
9915
  `);
9619
9916
  return;
9620
9917
  }
9621
- await this.executeInternal(message, { showPrompt: false });
9918
+ const payload = this.sessionManager ? await this.sessionManager.getQueryPayload(message) : message;
9919
+ await this.executeInternal(payload, { showPrompt: false });
9622
9920
  }
9623
9921
  async handleEventMessage(message) {
9624
9922
  console.log(`
@@ -9680,6 +9978,13 @@ ${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
9680
9978
  console.log(`${COLORS.progress("[thinking...]")}`);
9681
9979
  try {
9682
9980
  await this.options.onExecute(message, traceId, agentContext);
9981
+ if (this.options.onAfterExecute) {
9982
+ try {
9983
+ await this.options.onAfterExecute(this.lastUsage);
9984
+ } catch (hookError) {
9985
+ logger4.warn("onAfterExecute hook failed", { error: String(hookError) });
9986
+ }
9987
+ }
9683
9988
  } catch (error) {
9684
9989
  const askUserError = this.parseAskUserError(error);
9685
9990
  if (askUserError) {
@@ -9758,7 +10063,7 @@ ${COLORS.error("❌ 执行失败: " + error)}
9758
10063
  this.rl.removeListener("line", handleLine);
9759
10064
  const trimmedInput = input.trim();
9760
10065
  if (!trimmedInput) {
9761
- console.log(chalk4.yellow(`⚠️ 输入不能为空,请重新输入
10066
+ console.log(chalk5.yellow(`⚠️ 输入不能为空,请重新输入
9762
10067
  `));
9763
10068
  this.promptUser(question, options).then(resolve);
9764
10069
  return;
@@ -9766,11 +10071,11 @@ ${COLORS.error("❌ 执行失败: " + error)}
9766
10071
  const parsed = parseUserInput(trimmedInput, options);
9767
10072
  if (parsed.type === "option" && options) {
9768
10073
  const selectedOption = options[parsed.value];
9769
- console.log(chalk4.green(`✓ 您选择了: ${selectedOption}
10074
+ console.log(chalk5.green(`✓ 您选择了: ${selectedOption}
9770
10075
  `));
9771
10076
  resolve(selectedOption);
9772
10077
  } else {
9773
- console.log(chalk4.green(`✓ 您的回答: ${parsed.value}
10078
+ console.log(chalk5.green(`✓ 您的回答: ${parsed.value}
9774
10079
  `));
9775
10080
  resolve(parsed.value);
9776
10081
  }
@@ -9824,61 +10129,61 @@ ${COLORS.error("❌ 执行失败: " + error)}
9824
10129
  }
9825
10130
  }
9826
10131
  printHeader() {
9827
- console.log(chalk4.bold(`
10132
+ console.log(chalk5.bold(`
9828
10133
  ╔══════════════════════════════════════════════════╗`));
9829
- console.log(chalk4.bold("║ ") + chalk4.green.bold("roy-agent") + chalk4.bold(" Interactive Mode") + chalk4.bold(" ║"));
9830
- console.log(chalk4.bold(`╚══════════════════════════════════════════════════╝
10134
+ console.log(chalk5.bold("║ ") + chalk5.green.bold("roy-agent") + chalk5.bold(" Interactive Mode") + chalk5.bold(" ║"));
10135
+ console.log(chalk5.bold(`╚══════════════════════════════════════════════════╝
9831
10136
  `));
9832
- console.log(`${chalk4.dim("会话:")} ${this.options.sessionTitle}`);
9833
- console.log(`${chalk4.dim("输入 ")} ${COLORS.userInput("/help")} ${chalk4.dim("查看可用命令")}
10137
+ console.log(`${chalk5.dim("会话:")} ${this.options.sessionTitle}`);
10138
+ console.log(`${chalk5.dim("输入 ")} ${COLORS.userInput("/help")} ${chalk5.dim("查看可用命令")}
9834
10139
  `);
9835
10140
  }
9836
10141
  printHelp() {
9837
10142
  console.log(`
9838
- ${chalk4.bold("╭")}${chalk4.dim("─".repeat(49))}${chalk4.bold("╮")}
9839
- ${chalk4.bold("│")} ${chalk4.bold("快捷命令")} ${chalk4.bold("│")}
9840
- ${chalk4.bold("├")}${chalk4.dim("─".repeat(49))}${chalk4.bold("├")}
9841
- ${chalk4.bold("│")} ${COLORS.userInput("/help")}, ${COLORS.userInput("/h")} 显示帮助 ${chalk4.bold("│")}
9842
- ${chalk4.bold("│")} ${COLORS.userInput("/status")}, ${COLORS.userInput("/st")} 显示状态 ${chalk4.bold("│")}
9843
- ${chalk4.bold("│")} ${COLORS.userInput("/sessions")}, ${COLORS.userInput("/s")} 切换会话 ${chalk4.bold("│")}
9844
- ${chalk4.bold("│")} ${COLORS.userInput("/compact")}, ${COLORS.userInput("/c")} 压缩上下文 ${chalk4.bold("│")}
9845
- ${chalk4.bold("│")} ${COLORS.userInput("/abort")} 中断当前流式输出 ${chalk4.bold("│")}
9846
- ${chalk4.bold("│")} ${COLORS.userInput("/clear")}, ${COLORS.userInput("/cls")} 清屏 ${chalk4.bold("│")}
9847
- ${chalk4.bold("│")} ${COLORS.userInput("/exit")}, ${COLORS.userInput("/q")} 退出 ${chalk4.bold("│")}
9848
- ${chalk4.bold("├")}${chalk4.dim("─".repeat(49))}${chalk4.bold("├")}
9849
- ${chalk4.bold("│")} ${chalk4.bold("多行输入")} ${chalk4.bold("│")}
9850
- ${chalk4.bold("├")}${chalk4.dim("─".repeat(49))}${chalk4.bold("├")}
9851
- ${chalk4.bold("│")} 输入多行内容后,Alt+Enter 结束输入。 ${chalk4.bold("│")}
9852
- ${chalk4.bold("│")} Ctrl+C 可取消多行输入。 ${chalk4.bold("│")}
9853
- ${chalk4.bold("╰")}${chalk4.dim("─".repeat(49))}${chalk4.bold("╯")}
10143
+ ${chalk5.bold("╭")}${chalk5.dim("─".repeat(49))}${chalk5.bold("╮")}
10144
+ ${chalk5.bold("│")} ${chalk5.bold("快捷命令")} ${chalk5.bold("│")}
10145
+ ${chalk5.bold("├")}${chalk5.dim("─".repeat(49))}${chalk5.bold("├")}
10146
+ ${chalk5.bold("│")} ${COLORS.userInput("/help")}, ${COLORS.userInput("/h")} 显示帮助 ${chalk5.bold("│")}
10147
+ ${chalk5.bold("│")} ${COLORS.userInput("/status")}, ${COLORS.userInput("/st")} 显示状态 ${chalk5.bold("│")}
10148
+ ${chalk5.bold("│")} ${COLORS.userInput("/sessions")}, ${COLORS.userInput("/s")} 切换会话 ${chalk5.bold("│")}
10149
+ ${chalk5.bold("│")} ${COLORS.userInput("/compact")}, ${COLORS.userInput("/c")} 压缩上下文 ${chalk5.bold("│")}
10150
+ ${chalk5.bold("│")} ${COLORS.userInput("/abort")} 中断当前流式输出 ${chalk5.bold("│")}
10151
+ ${chalk5.bold("│")} ${COLORS.userInput("/clear")}, ${COLORS.userInput("/cls")} 清屏 ${chalk5.bold("│")}
10152
+ ${chalk5.bold("│")} ${COLORS.userInput("/exit")}, ${COLORS.userInput("/q")} 退出 ${chalk5.bold("│")}
10153
+ ${chalk5.bold("├")}${chalk5.dim("─".repeat(49))}${chalk5.bold("├")}
10154
+ ${chalk5.bold("│")} ${chalk5.bold("多行输入")} ${chalk5.bold("│")}
10155
+ ${chalk5.bold("├")}${chalk5.dim("─".repeat(49))}${chalk5.bold("├")}
10156
+ ${chalk5.bold("│")} 输入多行内容后,Alt+Enter 结束输入。 ${chalk5.bold("│")}
10157
+ ${chalk5.bold("│")} Ctrl+C 可取消多行输入。 ${chalk5.bold("│")}
10158
+ ${chalk5.bold("╰")}${chalk5.dim("─".repeat(49))}${chalk5.bold("╯")}
9854
10159
  `);
9855
10160
  }
9856
10161
  async printStatus() {
9857
10162
  const status = await this.options.onStatus();
9858
10163
  console.log(`
9859
- ${chalk4.bold("╭")}${chalk4.dim("─".repeat(49))}${chalk4.bold("╮")}
9860
- ${chalk4.bold("│")} ${chalk4.bold("会话状态")} ${chalk4.bold("│")}
9861
- ${chalk4.bold("├")}${chalk4.dim("─".repeat(49))}${chalk4.bold("├")}
9862
- ${chalk4.bold("│")} ${chalk4.dim("会话:")} ${status.sessionTitle.padEnd(35)} ${chalk4.bold("│")}
9863
- ${chalk4.bold("│")} ${chalk4.dim("ID:")} ${status.sessionId.padEnd(37)} ${chalk4.bold("│")}
9864
- ${chalk4.bold("│")} ${chalk4.dim("消息:")} ${String(status.messageCount).padEnd(34)} ${chalk4.bold("│")}
9865
- ${chalk4.bold("│")} ${chalk4.dim("Token:")} ${String(status.tokenCount).padEnd(33)} ${chalk4.bold("│")}
9866
- ${chalk4.bold("╰")}${chalk4.dim("─".repeat(49))}${chalk4.bold("╯")}
10164
+ ${chalk5.bold("╭")}${chalk5.dim("─".repeat(49))}${chalk5.bold("╮")}
10165
+ ${chalk5.bold("│")} ${chalk5.bold("会话状态")} ${chalk5.bold("│")}
10166
+ ${chalk5.bold("├")}${chalk5.dim("─".repeat(49))}${chalk5.bold("├")}
10167
+ ${chalk5.bold("│")} ${chalk5.dim("会话:")} ${status.sessionTitle.padEnd(35)} ${chalk5.bold("│")}
10168
+ ${chalk5.bold("│")} ${chalk5.dim("ID:")} ${status.sessionId.padEnd(37)} ${chalk5.bold("│")}
10169
+ ${chalk5.bold("│")} ${chalk5.dim("消息:")} ${String(status.messageCount).padEnd(34)} ${chalk5.bold("│")}
10170
+ ${chalk5.bold("│")} ${chalk5.dim("Token:")} ${String(status.tokenCount).padEnd(33)} ${chalk5.bold("│")}
10171
+ ${chalk5.bold("╰")}${chalk5.dim("─".repeat(49))}${chalk5.bold("╯")}
9867
10172
  `);
9868
10173
  }
9869
10174
  printSessionsHelp() {
9870
10175
  console.log(`
9871
- ${chalk4.bold("╭")}${chalk4.dim("─".repeat(49))}${chalk4.bold("╮")}
9872
- ${chalk4.bold("│")} ${chalk4.bold("切换会话")} ${chalk4.bold("│")}
9873
- ${chalk4.bold("├")}${chalk4.dim("─".repeat(49))}${chalk4.bold("├")}
9874
- ${chalk4.bold("│")} 退出当前交互模式后,使用以下命令切换会话: ${chalk4.bold("│")}
9875
- ${chalk4.bold("│")} ${chalk4.bold("│")}
9876
- ${chalk4.bold("│")} ${COLORS.userInput("roy-agent sessions list")} 列出所有会话 ${chalk4.bold("│")}
9877
- ${chalk4.bold("│")} ${COLORS.userInput("roy-agent sessions use <id>")} 切换到指定会话 ${chalk4.bold("│")}
9878
- ${chalk4.bold("│")} ${chalk4.bold("│")}
9879
- ${chalk4.bold("│")} 或直接指定会话启动: ${chalk4.bold("│")}
9880
- ${chalk4.bold("│")} ${COLORS.userInput("roy-agent interactive -s <session-id>")} ${chalk4.bold("│")}
9881
- ${chalk4.bold("╰")}${chalk4.dim("─".repeat(49))}${chalk4.bold("╯")}
10176
+ ${chalk5.bold("╭")}${chalk5.dim("─".repeat(49))}${chalk5.bold("╮")}
10177
+ ${chalk5.bold("│")} ${chalk5.bold("切换会话")} ${chalk5.bold("│")}
10178
+ ${chalk5.bold("├")}${chalk5.dim("─".repeat(49))}${chalk5.bold("├")}
10179
+ ${chalk5.bold("│")} 退出当前交互模式后,使用以下命令切换会话: ${chalk5.bold("│")}
10180
+ ${chalk5.bold("│")} ${chalk5.bold("│")}
10181
+ ${chalk5.bold("│")} ${COLORS.userInput("roy-agent sessions list")} 列出所有会话 ${chalk5.bold("│")}
10182
+ ${chalk5.bold("│")} ${COLORS.userInput("roy-agent sessions use <id>")} 切换到指定会话 ${chalk5.bold("│")}
10183
+ ${chalk5.bold("│")} ${chalk5.bold("│")}
10184
+ ${chalk5.bold("│")} 或直接指定会话启动: ${chalk5.bold("│")}
10185
+ ${chalk5.bold("│")} ${COLORS.userInput("roy-agent interactive -s <session-id>")} ${chalk5.bold("│")}
10186
+ ${chalk5.bold("╰")}${chalk5.dim("─".repeat(49))}${chalk5.bold("╯")}
9882
10187
  `);
9883
10188
  }
9884
10189
  }
@@ -10095,11 +10400,22 @@ function createInteractiveCommand(externalEnvService) {
10095
10400
  model: args.model,
10096
10401
  ...agentContext
10097
10402
  };
10098
- return queryExecutor.execute(message, sessionId, {
10403
+ const result = await queryExecutor.execute(message, sessionId, {
10099
10404
  showReasoning: args.reasoning,
10100
10405
  showToolCalls: args.toolCalls,
10101
10406
  showToolResults: args.toolResults
10102
10407
  }, traceId, mergedContext);
10408
+ repl.setLastUsage(queryExecutor.getLastUsage());
10409
+ return result;
10410
+ },
10411
+ onAfterExecute: (usage) => {
10412
+ if (usage) {
10413
+ const line = formatCacheLine(usage);
10414
+ if (line) {
10415
+ console.log(`
10416
+ ` + line);
10417
+ }
10418
+ }
10103
10419
  },
10104
10420
  onStatus: async () => {
10105
10421
  const session = await sessionComponent.get(sessionId);
@@ -10196,6 +10512,7 @@ function createInteractiveCommand(externalEnvService) {
10196
10512
  repl.handleSigint();
10197
10513
  };
10198
10514
  process.on("SIGINT", sigintHandler);
10515
+ repl.sessionManager = sessionManager;
10199
10516
  await repl.start();
10200
10517
  process.removeListener("SIGINT", sigintHandler);
10201
10518
  console.log("正在清理资源...");
@@ -10241,7 +10558,7 @@ function createInteractiveCommand(externalEnvService) {
10241
10558
  var InteractiveCommand = createInteractiveCommand();
10242
10559
 
10243
10560
  // src/commands/sessions/list.ts
10244
- import chalk5 from "chalk";
10561
+ import chalk6 from "chalk";
10245
10562
  var ListCommand = {
10246
10563
  command: "list [options]",
10247
10564
  aliases: ["ls"],
@@ -10315,15 +10632,15 @@ var ListCommand = {
10315
10632
  const hasTypeFilter = !!args.type;
10316
10633
  const hasStatusFilter = !!args.status;
10317
10634
  const header = [
10318
- chalk5.bold("#"),
10319
- chalk5.bold("Title"),
10320
- chalk5.bold("ID"),
10321
- hasTypeFilter || hasStatusFilter ? chalk5.bold("Status") : null,
10322
- chalk5.bold("Msgs"),
10323
- chalk5.bold("CP")
10635
+ chalk6.bold("#"),
10636
+ chalk6.bold("Title"),
10637
+ chalk6.bold("ID"),
10638
+ hasTypeFilter || hasStatusFilter ? chalk6.bold("Status") : null,
10639
+ chalk6.bold("Msgs"),
10640
+ chalk6.bold("CP")
10324
10641
  ].filter(Boolean).join(" │ ");
10325
10642
  const rows = sessions.map((s, i) => {
10326
- const marker = s.id === activeSessionId ? chalk5.green("▶") : " ";
10643
+ const marker = s.id === activeSessionId ? chalk6.green("▶") : " ";
10327
10644
  const hasCp = (s.metadata?.checkpoints?.checkpoints?.length ?? 0) > 0;
10328
10645
  const title = s.title.length > 20 ? s.title.slice(0, 17) + "..." : s.title;
10329
10646
  const idStr = s.id;
@@ -10333,18 +10650,18 @@ var ListCommand = {
10333
10650
  let statusDisplay = "";
10334
10651
  if (hasTypeFilter || hasStatusFilter) {
10335
10652
  if (workflowMeta) {
10336
- statusDisplay = workflowMeta.status === "running" ? chalk5.green("running") : workflowMeta.status === "paused" ? chalk5.yellow("paused") : workflowMeta.status === "completed" ? chalk5.gray("completed") : workflowMeta.status === "failed" ? chalk5.red("failed") : statusStr;
10653
+ statusDisplay = workflowMeta.status === "running" ? chalk6.green("running") : workflowMeta.status === "paused" ? chalk6.yellow("paused") : workflowMeta.status === "completed" ? chalk6.gray("completed") : workflowMeta.status === "failed" ? chalk6.red("failed") : statusStr;
10337
10654
  }
10338
10655
  }
10339
10656
  const cells = [
10340
10657
  marker + " " + (args.offset + i + 1),
10341
10658
  title,
10342
- chalk5.gray(idStr)
10659
+ chalk6.gray(idStr)
10343
10660
  ];
10344
10661
  if (hasTypeFilter || hasStatusFilter) {
10345
- cells.push(statusDisplay || chalk5.gray("-"));
10662
+ cells.push(statusDisplay || chalk6.gray("-"));
10346
10663
  }
10347
- cells.push(s.messageCount.toString(), hasCp ? chalk5.green("✓") : chalk5.gray("-"));
10664
+ cells.push(s.messageCount.toString(), hasCp ? chalk6.green("✓") : chalk6.gray("-"));
10348
10665
  return cells.join(" │ ");
10349
10666
  });
10350
10667
  const showingInfo = totalCount > sessions.length ? `Showing ${sessions.length} of ${totalCount} sessions` : `${totalCount} sessions`;
@@ -10355,7 +10672,7 @@ var ListCommand = {
10355
10672
  ...rows.map((r) => `│${r}│`),
10356
10673
  "└" + "─".repeat(header.length + 2) + "┘",
10357
10674
  "",
10358
- chalk5.gray(showingInfo)
10675
+ chalk6.gray(showingInfo)
10359
10676
  ].join(`
10360
10677
  `));
10361
10678
  }
@@ -10369,7 +10686,7 @@ var ListCommand = {
10369
10686
  };
10370
10687
 
10371
10688
  // src/commands/sessions/get.ts
10372
- import chalk6 from "chalk";
10689
+ import chalk7 from "chalk";
10373
10690
  var GetCommand = {
10374
10691
  command: "get <session-id>",
10375
10692
  aliases: ["show"],
@@ -10425,29 +10742,29 @@ var GetCommand = {
10425
10742
  });
10426
10743
  } else {
10427
10744
  const lines = [
10428
- chalk6.bold("┌─ Session Details ─────────────────────────────────┐"),
10745
+ chalk7.bold("┌─ Session Details ─────────────────────────────────┐"),
10429
10746
  `│ ID: ${session.id}`,
10430
10747
  `│ Title: ${session.title}`,
10431
10748
  `│ Directory: ${session.directory}`,
10432
10749
  `│ Messages: ${session.messageCount}`,
10433
- `│ Active: ${session.id === activeSessionId ? chalk6.green("✓") : chalk6.gray("-")}`,
10750
+ `│ Active: ${session.id === activeSessionId ? chalk7.green("✓") : chalk7.gray("-")}`,
10434
10751
  `│ Created: ${new Date(session.createdAt).toLocaleString("zh-CN")}`,
10435
10752
  `│ Updated: ${new Date(session.updatedAt).toLocaleString("zh-CN")}`
10436
10753
  ];
10437
10754
  const workflowMeta = session.metadata?.type === "workflow" ? session.metadata : null;
10438
10755
  if (workflowMeta) {
10439
10756
  lines.push("├─ Workflow Info ─────────────────────────────────────┤");
10440
- lines.push(`│ Type: ${chalk6.cyan("workflow")}`);
10757
+ lines.push(`│ Type: ${chalk7.cyan("workflow")}`);
10441
10758
  lines.push(`│ Workflow: ${workflowMeta.workflowName}`);
10442
10759
  if (workflowMeta.workflowId) {
10443
10760
  lines.push(`│ Workflow ID: ${workflowMeta.workflowId}`);
10444
10761
  }
10445
- const statusColor = workflowMeta.status === "running" ? chalk6.green : workflowMeta.status === "paused" ? chalk6.yellow : workflowMeta.status === "completed" ? chalk6.gray : chalk6.red;
10762
+ const statusColor = workflowMeta.status === "running" ? chalk7.green : workflowMeta.status === "paused" ? chalk7.yellow : workflowMeta.status === "completed" ? chalk7.gray : chalk7.red;
10446
10763
  lines.push(`│ Status: ${statusColor(workflowMeta.status)}`);
10447
10764
  if (workflowMeta.agentSessions && workflowMeta.agentSessions.length > 0) {
10448
10765
  lines.push("├─ Agent Sub-sessions ─────────────────────────────────┤");
10449
10766
  workflowMeta.agentSessions.forEach((agent) => {
10450
- const agentStatusColor = agent.status === "active" ? chalk6.green : agent.status === "paused" ? chalk6.yellow : chalk6.gray;
10767
+ const agentStatusColor = agent.status === "active" ? chalk7.green : agent.status === "paused" ? chalk7.yellow : chalk7.gray;
10451
10768
  lines.push(`│ ${agent.nodeId}: ${agent.sessionId} (${agentStatusColor(agent.status)})`);
10452
10769
  });
10453
10770
  }
@@ -10474,7 +10791,7 @@ var GetCommand = {
10474
10791
  };
10475
10792
 
10476
10793
  // src/commands/sessions/new.ts
10477
- import chalk7 from "chalk";
10794
+ import chalk8 from "chalk";
10478
10795
  var NewCommand = {
10479
10796
  command: "new [options]",
10480
10797
  aliases: ["create"],
@@ -10513,7 +10830,7 @@ var NewCommand = {
10513
10830
  }
10514
10831
  });
10515
10832
  } else {
10516
- output.success(chalk7.green("✓") + " Session created: " + session.id);
10833
+ output.success(chalk8.green("✓") + " Session created: " + session.id);
10517
10834
  output.info("Title: " + session.title);
10518
10835
  output.info("Directory: " + session.directory);
10519
10836
  }
@@ -10527,7 +10844,7 @@ var NewCommand = {
10527
10844
  };
10528
10845
 
10529
10846
  // src/commands/sessions/rename.ts
10530
- import chalk8 from "chalk";
10847
+ import chalk9 from "chalk";
10531
10848
  var RenameCommand = {
10532
10849
  command: "rename <session-id> <title>",
10533
10850
  aliases: ["mv"],
@@ -10582,7 +10899,7 @@ var RenameCommand = {
10582
10899
  }
10583
10900
  });
10584
10901
  } else {
10585
- output.success(`Session renamed: ${chalk8.green(a.title)}`);
10902
+ output.success(`Session renamed: ${chalk9.green(a.title)}`);
10586
10903
  output.info(`ID: ${a.sessionId}`);
10587
10904
  }
10588
10905
  } catch (error) {
@@ -10595,7 +10912,7 @@ var RenameCommand = {
10595
10912
  };
10596
10913
 
10597
10914
  // src/commands/sessions/delete.ts
10598
- import chalk9 from "chalk";
10915
+ import chalk10 from "chalk";
10599
10916
  var DeleteCommand = {
10600
10917
  command: "delete [session-ids...]",
10601
10918
  aliases: ["rm"],
@@ -10674,7 +10991,7 @@ var DeleteCommand = {
10674
10991
  return true;
10675
10992
  });
10676
10993
  if (a.keepActive && sessionsToDelete.length > 0) {
10677
- output.log(chalk9.yellow(`Keeping active session: ${activeSessionId}`));
10994
+ output.log(chalk10.yellow(`Keeping active session: ${activeSessionId}`));
10678
10995
  }
10679
10996
  } else if (a.olderThan !== undefined) {
10680
10997
  const cutoffDate = new Date;
@@ -10691,7 +11008,7 @@ var DeleteCommand = {
10691
11008
  }
10692
11009
  return false;
10693
11010
  });
10694
- output.log(chalk9.gray(`Deleting sessions not updated since ${cutoffDate.toISOString().split("T")[0]} (${a.olderThan} days ago)`));
11011
+ output.log(chalk10.gray(`Deleting sessions not updated since ${cutoffDate.toISOString().split("T")[0]} (${a.olderThan} days ago)`));
10695
11012
  } else {
10696
11013
  output.log("No sessions to delete");
10697
11014
  return;
@@ -10701,10 +11018,10 @@ var DeleteCommand = {
10701
11018
  return;
10702
11019
  }
10703
11020
  if (a.dryRun) {
10704
- output.log(chalk9.yellow(`[DRY RUN] Would delete ${sessionsToDelete.length} session(s):
11021
+ output.log(chalk10.yellow(`[DRY RUN] Would delete ${sessionsToDelete.length} session(s):
10705
11022
  `));
10706
11023
  sessionsToDelete.forEach((s, i) => {
10707
- const marker = s.id === activeSessionId ? chalk9.green("▶") : " ";
11024
+ const marker = s.id === activeSessionId ? chalk10.green("▶") : " ";
10708
11025
  output.log(` ${marker} ${s.id}`);
10709
11026
  output.log(` Title: ${s.title}`);
10710
11027
  output.log(` Updated: ${new Date(s.updatedAt).toLocaleString()}`);
@@ -10714,11 +11031,11 @@ var DeleteCommand = {
10714
11031
  return;
10715
11032
  }
10716
11033
  if (!a.force) {
10717
- output.log(chalk9.red(`
11034
+ output.log(chalk10.red(`
10718
11035
  ⚠️ About to delete ${sessionsToDelete.length} session(s):
10719
11036
  `));
10720
11037
  sessionsToDelete.forEach((s, i) => {
10721
- const marker = s.id === activeSessionId ? chalk9.green("▶") : " ";
11038
+ const marker = s.id === activeSessionId ? chalk10.green("▶") : " ";
10722
11039
  output.log(` ${marker} ${s.id} - ${s.title}`);
10723
11040
  });
10724
11041
  output.log("");
@@ -10728,7 +11045,7 @@ var DeleteCommand = {
10728
11045
  input: process.stdin,
10729
11046
  output: process.stdout
10730
11047
  });
10731
- rl.question(chalk9.red("Type 'yes' to confirm deletion: "), (res) => {
11048
+ rl.question(chalk10.red("Type 'yes' to confirm deletion: "), (res) => {
10732
11049
  rl.close();
10733
11050
  resolve(res);
10734
11051
  });
@@ -10756,7 +11073,7 @@ var DeleteCommand = {
10756
11073
  }
10757
11074
  }
10758
11075
  if (successCount > 0) {
10759
- output.success(chalk9.green(`✓`) + ` Deleted ${successCount} session(s)`);
11076
+ output.success(chalk10.green(`✓`) + ` Deleted ${successCount} session(s)`);
10760
11077
  }
10761
11078
  if (failCount > 0) {
10762
11079
  output.error(`✗ Failed to delete ${failCount} session(s)`);
@@ -10775,7 +11092,7 @@ var DeleteCommand = {
10775
11092
  };
10776
11093
 
10777
11094
  // src/commands/sessions/messages.ts
10778
- import chalk10 from "chalk";
11095
+ import chalk11 from "chalk";
10779
11096
  var MessagesCommand = {
10780
11097
  command: "messages <session-id>",
10781
11098
  aliases: ["msgs"],
@@ -10843,10 +11160,10 @@ var MessagesCommand = {
10843
11160
  ...` : "");
10844
11161
  };
10845
11162
  const roleColors = {
10846
- user: chalk10.blue,
10847
- assistant: chalk10.green,
10848
- system: chalk10.gray,
10849
- tool: chalk10.yellow
11163
+ user: chalk11.blue,
11164
+ assistant: chalk11.green,
11165
+ system: chalk11.gray,
11166
+ tool: chalk11.yellow
10850
11167
  };
10851
11168
  const formatMessageContent = (m) => {
10852
11169
  const lines = [];
@@ -10857,79 +11174,79 @@ var MessagesCommand = {
10857
11174
  lines.push(...text.split(`
10858
11175
  `).map((l) => l || " "));
10859
11176
  } else if (part.type === "tool-call") {
10860
- lines.push(chalk10.cyan(`[Tool Call] ${part.toolName}`));
11177
+ lines.push(chalk11.cyan(`[Tool Call] ${part.toolName}`));
10861
11178
  const argsStr = typeof part.arguments === "string" ? part.arguments : JSON.stringify(part.arguments ?? null, null, 2);
10862
11179
  if (argsStr && argsStr.length > 200) {
10863
11180
  lines.push(...argsStr.slice(0, 197).split(`
10864
- `).map((l) => chalk10.gray(l)));
10865
- lines.push(chalk10.gray("..."));
11181
+ `).map((l) => chalk11.gray(l)));
11182
+ lines.push(chalk11.gray("..."));
10866
11183
  } else if (argsStr) {
10867
11184
  lines.push(...argsStr.split(`
10868
- `).map((l) => chalk10.gray(l)));
11185
+ `).map((l) => chalk11.gray(l)));
10869
11186
  }
10870
11187
  } else if (part.type === "tool-result") {
10871
- lines.push(chalk10.yellow(`[Tool Result] ${part.toolName}`));
11188
+ lines.push(chalk11.yellow(`[Tool Result] ${part.toolName}`));
10872
11189
  const output2 = part.output?.length > 200 ? part.output.slice(0, 197) + "..." : part.output || "No output";
10873
11190
  lines.push(...output2.split(`
10874
- `).map((l) => chalk10.gray(l)));
11191
+ `).map((l) => chalk11.gray(l)));
10875
11192
  } else if (part.type === "reasoning") {
10876
- lines.push(chalk10.magenta(`[Reasoning]`));
11193
+ lines.push(chalk11.magenta(`[Reasoning]`));
10877
11194
  lines.push(...(part.content || "").split(`
10878
- `).slice(0, 5).map((l) => chalk10.gray(l)));
11195
+ `).slice(0, 5).map((l) => chalk11.gray(l)));
10879
11196
  } else if (part.type === "checkpoint") {
10880
- lines.push(chalk10.cyan(`[Checkpoint]`));
11197
+ lines.push(chalk11.cyan(`[Checkpoint]`));
10881
11198
  } else if (part.type === "workflow-node-call") {
10882
- lines.push(chalk10.blue(`[Node Call] ${part.nodeType}: ${part.nodeId}`));
11199
+ lines.push(chalk11.blue(`[Node Call] ${part.nodeType}: ${part.nodeId}`));
10883
11200
  if (part.input && Object.keys(part.input).length > 0) {
10884
11201
  const inputSummary = Object.entries(part.input).slice(0, 3).map(([k, v]) => `${k}: ${JSON.stringify(v).slice(0, 50)}`).join(", ");
10885
11202
  lines.push(...inputSummary.split(`
10886
- `).map((l) => chalk10.gray(` ${l}`)));
11203
+ `).map((l) => chalk11.gray(` ${l}`)));
10887
11204
  }
10888
11205
  if (part.agentSessionId) {
10889
- lines.push(chalk10.gray(` agentSessionId: ${part.agentSessionId}`));
11206
+ lines.push(chalk11.gray(` agentSessionId: ${part.agentSessionId}`));
10890
11207
  }
10891
11208
  } else if (part.type === "workflow-node-interrupt") {
10892
- lines.push(chalk10.yellow(`[Node Interrupt] ${part.nodeType}: ${part.nodeId}`));
10893
- lines.push(chalk10.bold(` Query: ${part.query}`));
11209
+ lines.push(chalk11.yellow(`[Node Interrupt] ${part.nodeType}: ${part.nodeId}`));
11210
+ lines.push(chalk11.bold(` Query: ${part.query}`));
10894
11211
  if (part.options && part.options.length > 0) {
10895
- lines.push(chalk10.gray(` Options: ${part.options.join(", ")}`));
11212
+ lines.push(chalk11.gray(` Options: ${part.options.join(", ")}`));
10896
11213
  }
10897
11214
  if (part.agentSessionId) {
10898
- lines.push(chalk10.gray(` agentSessionId: ${part.agentSessionId}`));
11215
+ lines.push(chalk11.gray(` agentSessionId: ${part.agentSessionId}`));
10899
11216
  }
10900
11217
  } else if (part.type === "workflow-node-result") {
10901
11218
  const status = part.error ? "❌" : "✅";
10902
- lines.push(chalk10.green(`${status} [Node Result] ${part.nodeType}: ${part.nodeId}`));
11219
+ lines.push(chalk11.green(`${status} [Node Result] ${part.nodeType}: ${part.nodeId}`));
10903
11220
  if (part.output) {
10904
11221
  const outputStr = typeof part.output === "string" ? part.output : JSON.stringify(part.output).slice(0, 200);
10905
11222
  lines.push(...outputStr.split(`
10906
- `).slice(0, 5).map((l) => chalk10.gray(` ${l}`)));
11223
+ `).slice(0, 5).map((l) => chalk11.gray(` ${l}`)));
10907
11224
  }
10908
11225
  if (part.error) {
10909
- lines.push(chalk10.red(` Error: ${part.error}`));
11226
+ lines.push(chalk11.red(` Error: ${part.error}`));
10910
11227
  }
10911
11228
  if (part.durationMs !== undefined) {
10912
- lines.push(chalk10.gray(` Duration: ${part.durationMs}ms`));
11229
+ lines.push(chalk11.gray(` Duration: ${part.durationMs}ms`));
10913
11230
  }
10914
11231
  } else if (part.type === "workflow-node-resume") {
10915
- lines.push(chalk10.green(`[Node Resume] Response: ${part.response}`));
11232
+ lines.push(chalk11.green(`[Node Resume] Response: ${part.response}`));
10916
11233
  } else if (part.type === "workflow-node-start") {
10917
- lines.push(chalk10.blue(`[Node Start] ${part.nodeId}`));
11234
+ lines.push(chalk11.blue(`[Node Start] ${part.nodeId}`));
10918
11235
  } else if (part.type === "workflow-node-end") {
10919
11236
  const status = part.error ? "❌" : "✅";
10920
- lines.push(chalk10.green(`${status} [Node End] ${part.nodeId}`));
11237
+ lines.push(chalk11.green(`${status} [Node End] ${part.nodeId}`));
10921
11238
  if (part.output) {
10922
11239
  const outputStr = typeof part.output === "string" ? part.output.slice(0, 300) : JSON.stringify(part.output, null, 2).slice(0, 300);
10923
11240
  lines.push(...outputStr.split(`
10924
- `).slice(0, 6).map((l) => chalk10.gray(` ${l}`)));
11241
+ `).slice(0, 6).map((l) => chalk11.gray(` ${l}`)));
10925
11242
  if (outputStr.length >= 300)
10926
- lines.push(chalk10.gray(" ..."));
11243
+ lines.push(chalk11.gray(" ..."));
10927
11244
  }
10928
11245
  if (part.error) {
10929
- lines.push(chalk10.red(` Error: ${part.error}`));
11246
+ lines.push(chalk11.red(` Error: ${part.error}`));
10930
11247
  }
10931
11248
  if (part.durationMs !== undefined) {
10932
- lines.push(chalk10.gray(` Duration: ${part.durationMs}ms`));
11249
+ lines.push(chalk11.gray(` Duration: ${part.durationMs}ms`));
10933
11250
  }
10934
11251
  }
10935
11252
  }
@@ -10940,28 +11257,28 @@ var MessagesCommand = {
10940
11257
  }
10941
11258
  return lines.length > 0 ? lines : ["(empty)"];
10942
11259
  };
10943
- output.log(chalk10.bold(`┌─ Messages (${a.sessionId}) ────────────────────────┐`));
11260
+ output.log(chalk11.bold(`┌─ Messages (${a.sessionId}) ────────────────────────┐`));
10944
11261
  messages.forEach((m, i) => {
10945
- const roleColor = roleColors[m.role] || chalk10.white;
11262
+ const roleColor = roleColors[m.role] || chalk11.white;
10946
11263
  const time = new Date(m.timestamp).toLocaleTimeString("zh-CN", {
10947
11264
  hour: "2-digit",
10948
11265
  minute: "2-digit"
10949
11266
  });
10950
11267
  if (m.metadata?.isCheckpoint) {
10951
- output.log(chalk10.cyan("├─ #" + (a.offset + i + 1) + " checkpoint") + " " + chalk10.gray(time));
11268
+ output.log(chalk11.cyan("├─ #" + (a.offset + i + 1) + " checkpoint") + " " + chalk11.gray(time));
10952
11269
  output.log("│");
10953
11270
  output.log("│ " + checkpointStyle(m.content).split(`
10954
11271
  `).join(`
10955
11272
  │ `));
10956
11273
  output.log("│");
10957
11274
  } else {
10958
- output.log(chalk10.cyan("├─ #" + (a.offset + i + 1) + " ") + roleColor(m.role.padEnd(10)) + " " + chalk10.gray(time));
11275
+ output.log(chalk11.cyan("├─ #" + (a.offset + i + 1) + " ") + roleColor(m.role.padEnd(10)) + " " + chalk11.gray(time));
10959
11276
  const contentLines = formatMessageContent(m);
10960
11277
  for (const line of contentLines.slice(0, 20)) {
10961
11278
  output.log("│ " + line);
10962
11279
  }
10963
11280
  if (contentLines.length > 20) {
10964
- output.log("│ " + chalk10.gray("... (truncated)"));
11281
+ output.log("│ " + chalk11.gray("... (truncated)"));
10965
11282
  }
10966
11283
  output.log("│");
10967
11284
  }
@@ -10969,7 +11286,7 @@ var MessagesCommand = {
10969
11286
  output.log("└" + "─".repeat(51) + "┘");
10970
11287
  const hasMore = a.offset + a.limit < totalMessages;
10971
11288
  const showingEnd = Math.min(a.offset + a.limit, totalMessages);
10972
- output.log(chalk10.gray(`Showing ${a.offset + 1}-${showingEnd} of ${totalMessages} messages` + (hasMore ? " (more available)" : "")));
11289
+ output.log(chalk11.gray(`Showing ${a.offset + 1}-${showingEnd} of ${totalMessages} messages` + (hasMore ? " (more available)" : "")));
10973
11290
  }
10974
11291
  } catch (error) {
10975
11292
  output.error(`Failed to get messages: ${error instanceof Error ? error.message : String(error)}`);
@@ -10981,7 +11298,7 @@ var MessagesCommand = {
10981
11298
  };
10982
11299
 
10983
11300
  // src/commands/sessions/compact.ts
10984
- import chalk11 from "chalk";
11301
+ import chalk12 from "chalk";
10985
11302
  var CompactCommand = {
10986
11303
  command: "compact <session-id>",
10987
11304
  aliases: ["compress", "checkpoint"],
@@ -11035,13 +11352,13 @@ var CompactCommand = {
11035
11352
  dryRun: true
11036
11353
  });
11037
11354
  } else {
11038
- output.log(chalk11.bold("┌─ Compact Preview ─────────────────────────────────┐"));
11355
+ output.log(chalk12.bold("┌─ Compact Preview ─────────────────────────────────┐"));
11039
11356
  output.log(`│ Session: ${session.title}`);
11040
- output.log(`│ Messages to compact: ${chalk11.yellow(preview.messageCountToCompact)}`);
11357
+ output.log(`│ Messages to compact: ${chalk12.yellow(preview.messageCountToCompact)}`);
11041
11358
  output.log(`│ Estimated checkpoint tokens: ${preview.estimatedCheckpointTokens}`);
11042
- output.log(`│ Would trigger: ${preview.wouldTrigger ? chalk11.green("Yes") : chalk11.gray("No")}`);
11359
+ output.log(`│ Would trigger: ${preview.wouldTrigger ? chalk12.green("Yes") : chalk12.gray("No")}`);
11043
11360
  output.log("│");
11044
- output.log("│ " + chalk11.gray("(Dry run - no changes made)"));
11361
+ output.log("│ " + chalk12.gray("(Dry run - no changes made)"));
11045
11362
  output.log("└" + "─".repeat(51) + "┘");
11046
11363
  }
11047
11364
  return;
@@ -11056,10 +11373,10 @@ var CompactCommand = {
11056
11373
  try {
11057
11374
  scenarioHint = await sessionComponent.generateCompactHint(a.sessionId);
11058
11375
  if (!a.json) {
11059
- output.log(chalk11.bold("├─ Auto-generated Scenario Hint ──────────────────────────┤"));
11060
- output.log("│ " + chalk11.cyan(scenarioHint.substring(0, 70)));
11376
+ output.log(chalk12.bold("├─ Auto-generated Scenario Hint ──────────────────────────┤"));
11377
+ output.log("│ " + chalk12.cyan(scenarioHint.substring(0, 70)));
11061
11378
  if (scenarioHint.length > 70) {
11062
- output.log(chalk11.gray("│ ") + scenarioHint.substring(70, 140));
11379
+ output.log(chalk12.gray("│ ") + scenarioHint.substring(70, 140));
11063
11380
  }
11064
11381
  }
11065
11382
  } catch (hintError) {
@@ -11106,29 +11423,29 @@ var CompactCommand = {
11106
11423
  }
11107
11424
  });
11108
11425
  } else {
11109
- output.log(chalk11.bold.green("┌─ Checkpoint Created ────────────────────────────────┐"));
11426
+ output.log(chalk12.bold.green("┌─ Checkpoint Created ────────────────────────────────┐"));
11110
11427
  output.log(`│ ID: ${result.checkpoint.id}`);
11111
11428
  output.log(`│ Title: ${result.checkpoint.title}`);
11112
11429
  output.log(`│ Type: compact`);
11113
11430
  output.log(`│ Created: ${new Date(result.checkpoint.createdAt).toLocaleString("zh-CN")}`);
11114
- output.log(chalk11.bold("├─ Scenario Hint ────────────────────────────────────┤"));
11431
+ output.log(chalk12.bold("├─ Scenario Hint ────────────────────────────────────┤"));
11115
11432
  if (scenarioHint) {
11116
11433
  const hintLines = scenarioHint.split(`
11117
11434
  `);
11118
11435
  hintLines.forEach((line, i) => {
11119
11436
  if (i === 0) {
11120
- output.log(chalk11.cyan("│ " + line.substring(0, 48)));
11437
+ output.log(chalk12.cyan("│ " + line.substring(0, 48)));
11121
11438
  if (line.length > 48) {
11122
11439
  for (let j = 48;j < line.length; j += 48) {
11123
- output.log(chalk11.gray("│ ") + line.substring(j, j + 48));
11440
+ output.log(chalk12.gray("│ ") + line.substring(j, j + 48));
11124
11441
  }
11125
11442
  }
11126
11443
  } else {
11127
- output.log(chalk11.gray("│ ") + line);
11444
+ output.log(chalk12.gray("│ ") + line);
11128
11445
  }
11129
11446
  });
11130
11447
  } else {
11131
- output.log(chalk11.gray("│ (no hint)"));
11448
+ output.log(chalk12.gray("│ (no hint)"));
11132
11449
  }
11133
11450
  output.log("├─ Process Key Points ─────────────────────────────────┤");
11134
11451
  result.checkpoint.processKeyPoints.forEach((p, i) => {
@@ -11153,11 +11470,11 @@ var CompactCommand = {
11153
11470
  result.checkpoint.recentMessages.forEach((msg) => {
11154
11471
  const prefix = msg.role === "user" ? "\uD83D\uDC64" : "\uD83E\uDD16";
11155
11472
  const content = msg.content.length > 60 ? msg.content.substring(0, 60) + "..." : msg.content;
11156
- output.log(chalk11.gray(`│ ${prefix} [${msg.role}] ${content}`));
11473
+ output.log(chalk12.gray(`│ ${prefix} [${msg.role}] ${content}`));
11157
11474
  });
11158
11475
  }
11159
11476
  output.log("├─ Stats ─────────────────────────────────────────────┤");
11160
- output.log(`│ Messages compacted: ${chalk11.yellow(result.deletedMessageCount)}`);
11477
+ output.log(`│ Messages compacted: ${chalk12.yellow(result.deletedMessageCount)}`);
11161
11478
  output.log(`│ Remaining messages: ${result.remainingMessageCount}`);
11162
11479
  output.log(`│ Total checkpoints: ${result.checkpointCount}`);
11163
11480
  output.log("└" + "─".repeat(51) + "┘");
@@ -11175,7 +11492,7 @@ var CompactCommand = {
11175
11492
  };
11176
11493
 
11177
11494
  // src/commands/sessions/checkpoints.ts
11178
- import chalk12 from "chalk";
11495
+ import chalk13 from "chalk";
11179
11496
  var CheckpointsCommand = {
11180
11497
  command: "checkpoints <session-id>",
11181
11498
  aliases: ["cps"],
@@ -11208,7 +11525,7 @@ var CheckpointsCommand = {
11208
11525
  }
11209
11526
  const checkpoints = await sessionComponent.getCheckpoints(a.sessionId);
11210
11527
  if (checkpoints.length === 0) {
11211
- output.log(chalk12.gray("No checkpoints for this session"));
11528
+ output.log(chalk13.gray("No checkpoints for this session"));
11212
11529
  return;
11213
11530
  }
11214
11531
  if (a.json) {
@@ -11233,7 +11550,7 @@ var CheckpointsCommand = {
11233
11550
  if (a.detail) {
11234
11551
  checkpoints.reverse().forEach((cp, i) => {
11235
11552
  const isLatest = i === 0;
11236
- output.log(chalk12.bold(`┌─ Checkpoint: ${cp.title} ${isLatest ? chalk12.green("✓") : ""} ──────` + "─".repeat(Math.max(0, 30 - cp.title.length)) + "┐"));
11553
+ output.log(chalk13.bold(`┌─ Checkpoint: ${cp.title} ${isLatest ? chalk13.green("✓") : ""} ──────` + "─".repeat(Math.max(0, 30 - cp.title.length)) + "┐"));
11237
11554
  output.log(`│ ID: ${cp.id}`);
11238
11555
  output.log(`│ Type: ${cp.type}`);
11239
11556
  output.log(`│ Message Index: ${cp.messageIndex} (${cp.messageCountBefore} messages)`);
@@ -11261,18 +11578,18 @@ var CheckpointsCommand = {
11261
11578
  });
11262
11579
  } else {
11263
11580
  const header = [
11264
- chalk12.bold("#"),
11265
- chalk12.bold("Title"),
11266
- chalk12.bold("Type"),
11267
- chalk12.bold("Messages"),
11268
- chalk12.bold("Created")
11581
+ chalk13.bold("#"),
11582
+ chalk13.bold("Title"),
11583
+ chalk13.bold("Type"),
11584
+ chalk13.bold("Messages"),
11585
+ chalk13.bold("Created")
11269
11586
  ].join(" │ ");
11270
11587
  output.log(`┌─ Checkpoints (${checkpoints.length}) ${"─".repeat(40)}┐`);
11271
11588
  output.log(`│${header}│`);
11272
11589
  output.log("├" + "─".repeat(header.length + 2) + "┤");
11273
11590
  checkpoints.reverse().forEach((cp, i) => {
11274
11591
  const isLatest = i === 0;
11275
- const marker = isLatest ? chalk12.green("✓ ") : " ";
11592
+ const marker = isLatest ? chalk13.green("✓ ") : " ";
11276
11593
  const title = cp.title.length > 25 ? cp.title.slice(0, 22) + "..." : cp.title;
11277
11594
  const created = new Date(cp.createdAt).toLocaleString("zh-CN", {
11278
11595
  month: "2-digit",
@@ -11280,7 +11597,7 @@ var CheckpointsCommand = {
11280
11597
  hour: "2-digit",
11281
11598
  minute: "2-digit"
11282
11599
  });
11283
- output.log(`│${marker}${i + 1} ${title.padEnd(25)} │ ${cp.type.padEnd(5)} │ ${cp.messageCountBefore.toString().padStart(8)} │ ${chalk12.gray(created)}│`);
11600
+ output.log(`│${marker}${i + 1} ${title.padEnd(25)} │ ${cp.type.padEnd(5)} │ ${cp.messageCountBefore.toString().padStart(8)} │ ${chalk13.gray(created)}│`);
11284
11601
  });
11285
11602
  output.log("└" + "─".repeat(header.length + 2) + "┘");
11286
11603
  }
@@ -11294,7 +11611,7 @@ var CheckpointsCommand = {
11294
11611
  };
11295
11612
 
11296
11613
  // src/commands/sessions/active.ts
11297
- import chalk13 from "chalk";
11614
+ import chalk14 from "chalk";
11298
11615
  var ActiveCommand = {
11299
11616
  command: "active",
11300
11617
  aliases: ["current"],
@@ -11321,7 +11638,7 @@ var ActiveCommand = {
11321
11638
  return;
11322
11639
  }
11323
11640
  if (!activeId) {
11324
- output.log(chalk13.gray("No active session set"));
11641
+ output.log(chalk14.gray("No active session set"));
11325
11642
  return;
11326
11643
  }
11327
11644
  const session = await sessionComponent.get(activeId);
@@ -11339,10 +11656,10 @@ var ActiveCommand = {
11339
11656
  });
11340
11657
  } else {
11341
11658
  if (!session) {
11342
- output.log(chalk13.gray("Active session not found: " + activeId));
11659
+ output.log(chalk14.gray("Active session not found: " + activeId));
11343
11660
  return;
11344
11661
  }
11345
- output.log(chalk13.bold.green("┌─ Active Session ─────────────────────────────────┐"));
11662
+ output.log(chalk14.bold.green("┌─ Active Session ─────────────────────────────────┐"));
11346
11663
  output.log(`│ ID: ${session.id}`);
11347
11664
  output.log(`│ Title: ${session.title}`);
11348
11665
  output.log(`│ Directory: ${session.directory}`);
@@ -11424,7 +11741,7 @@ var AddMessageCommand = {
11424
11741
  };
11425
11742
 
11426
11743
  // src/commands/sessions/mock.ts
11427
- import chalk14 from "chalk";
11744
+ import chalk15 from "chalk";
11428
11745
  var MOCK_SEQUENCES = [
11429
11746
  {
11430
11747
  name: "文件操作流程",
@@ -11557,7 +11874,7 @@ var MockCommand = {
11557
11874
  for (let seqIdx = 0;seqIdx < count; seqIdx++) {
11558
11875
  const sequence = MOCK_SEQUENCES[seqIdx];
11559
11876
  if (!a.json) {
11560
- output.log(chalk14.bold(`
11877
+ output.log(chalk15.bold(`
11561
11878
  \uD83D\uDCDD Sequence ${seqIdx + 1}: ${sequence.name}`));
11562
11879
  }
11563
11880
  for (const msg of sequence.messages) {
@@ -11575,7 +11892,7 @@ ${JSON.stringify(tc.args, null, 2)}
11575
11892
  if (assistantMsgId)
11576
11893
  addedMessages.push(assistantMsgId);
11577
11894
  if (!a.json) {
11578
- output.log(chalk14.cyan(` [${addedMessages.length}] assistant: \uD83D\uDD27 Tool call`));
11895
+ output.log(chalk15.cyan(` [${addedMessages.length}] assistant: \uD83D\uDD27 Tool call`));
11579
11896
  }
11580
11897
  const toolMsgId = await sessionComponent.addMessage(a.sessionId, {
11581
11898
  role: "tool",
@@ -11584,7 +11901,7 @@ ${JSON.stringify(tc.args, null, 2)}
11584
11901
  if (toolMsgId)
11585
11902
  addedMessages.push(toolMsgId);
11586
11903
  if (!a.json) {
11587
- output.log(chalk14.yellow(` [${addedMessages.length}] tool: ${msg.content.substring(0, 50)}...`));
11904
+ output.log(chalk15.yellow(` [${addedMessages.length}] tool: ${msg.content.substring(0, 50)}...`));
11588
11905
  }
11589
11906
  } else {
11590
11907
  const msgId = await sessionComponent.addMessage(a.sessionId, {
@@ -11594,7 +11911,7 @@ ${JSON.stringify(tc.args, null, 2)}
11594
11911
  if (msgId)
11595
11912
  addedMessages.push(msgId);
11596
11913
  if (!a.json) {
11597
- const roleColor = msg.role === "user" ? chalk14.green : msg.role === "assistant" ? chalk14.cyan : chalk14.gray;
11914
+ const roleColor = msg.role === "user" ? chalk15.green : msg.role === "assistant" ? chalk15.cyan : chalk15.gray;
11598
11915
  output.log(roleColor(` [${addedMessages.length}] ${msg.role}: ${msg.content.substring(0, 50)}...`));
11599
11916
  }
11600
11917
  }
@@ -11610,14 +11927,14 @@ ${JSON.stringify(tc.args, null, 2)}
11610
11927
  });
11611
11928
  } else {
11612
11929
  output.log(`
11613
- ` + chalk14.bold.green("✅ Mock data inserted successfully!"));
11930
+ ` + chalk15.bold.green("✅ Mock data inserted successfully!"));
11614
11931
  output.log(` Session: ${a.sessionId}`);
11615
11932
  output.log(` Sequences: ${count}`);
11616
11933
  output.log(` Messages: ${addedMessages.length}`);
11617
11934
  output.log("");
11618
- output.log(chalk14.gray(" Now run: "));
11619
- output.log(chalk14.gray(` roy-agent sessions compact ${a.sessionId}`));
11620
- output.log(chalk14.gray(" to trigger checkpoint generation"));
11935
+ output.log(chalk15.gray(" Now run: "));
11936
+ output.log(chalk15.gray(` roy-agent sessions compact ${a.sessionId}`));
11937
+ output.log(chalk15.gray(" to trigger checkpoint generation"));
11621
11938
  }
11622
11939
  } finally {
11623
11940
  await envService.dispose();
@@ -11626,7 +11943,7 @@ ${JSON.stringify(tc.args, null, 2)}
11626
11943
  };
11627
11944
 
11628
11945
  // src/commands/sessions/grep.ts
11629
- import chalk15 from "chalk";
11946
+ import chalk16 from "chalk";
11630
11947
  var GrepCommand = {
11631
11948
  command: "grep <query...>",
11632
11949
  aliases: ["search"],
@@ -11706,7 +12023,7 @@ var GrepCommand = {
11706
12023
  const results = await sessionComponent.searchMessages(searchOptions);
11707
12024
  if (results.length === 0) {
11708
12025
  if (!a.quiet) {
11709
- output.log(chalk15.yellow(`No results found for: ${query}`));
12026
+ output.log(chalk16.yellow(`No results found for: ${query}`));
11710
12027
  }
11711
12028
  return;
11712
12029
  }
@@ -11733,7 +12050,7 @@ var GrepCommand = {
11733
12050
  for (const result of results) {
11734
12051
  for (const match of result.matches) {
11735
12052
  const time = new Date(match.timestamp).toLocaleString("zh-CN");
11736
- output.log(`${chalk15.gray(result.sessionId)} ${chalk15.blue(result.sessionTitle)} ${chalk15.gray(time)}`);
12053
+ output.log(`${chalk16.gray(result.sessionId)} ${chalk16.blue(result.sessionTitle)} ${chalk16.gray(time)}`);
11737
12054
  output.log(` ${match.content}`);
11738
12055
  output.log("");
11739
12056
  }
@@ -11745,40 +12062,40 @@ var GrepCommand = {
11745
12062
  totalMatches += result.matches.length;
11746
12063
  const time = new Date(result.updatedAt).toLocaleString("zh-CN");
11747
12064
  const titleStr = `─ ${result.sessionTitle} (${result.sessionId})`;
11748
- output.log(chalk15.bold(`
12065
+ output.log(chalk16.bold(`
11749
12066
  ┌${titleStr}${"─".repeat(Math.max(0, 50 - titleStr.length))}┐`));
11750
- output.log(`│ ${chalk15.gray(`Updated: ${time} | ${result.messageCount} messages | ${result.matches.length} matches`)}${" ".repeat(Math.max(0, 50 - 60))}│`);
12067
+ output.log(`│ ${chalk16.gray(`Updated: ${time} | ${result.messageCount} messages | ${result.matches.length} matches`)}${" ".repeat(Math.max(0, 50 - 60))}│`);
11751
12068
  for (let i = 0;i < result.matches.length; i++) {
11752
12069
  const match = result.matches[i];
11753
- const roleColor = match.role === "user" ? chalk15.blue : match.role === "assistant" ? chalk15.green : chalk15.gray;
12070
+ const roleColor = match.role === "user" ? chalk16.blue : match.role === "assistant" ? chalk16.green : chalk16.gray;
11754
12071
  const msgTime = new Date(match.timestamp).toLocaleTimeString("zh-CN", {
11755
12072
  hour: "2-digit",
11756
12073
  minute: "2-digit"
11757
12074
  });
11758
- output.log(`├─ #${i + 1} ${roleColor(match.role.padEnd(10))} ${chalk15.gray(msgTime)}`);
12075
+ output.log(`├─ #${i + 1} ${roleColor(match.role.padEnd(10))} ${chalk16.gray(msgTime)}`);
11759
12076
  output.log("│");
11760
12077
  const lines = match.content.split(`
11761
12078
  `).map((line) => line.trim()).filter((line) => line.length > 0);
11762
12079
  const maxLines = 5;
11763
12080
  const displayLines = lines.slice(0, maxLines);
11764
12081
  if (displayLines.length === 0) {
11765
- output.log("│ " + chalk15.gray("(empty content)"));
12082
+ output.log("│ " + chalk16.gray("(empty content)"));
11766
12083
  } else {
11767
12084
  for (const line of displayLines) {
11768
12085
  const truncated = line.length > 76 ? line.slice(0, 73) + "..." : line;
11769
- output.log(`│ ${chalk15.gray(truncated)}`);
12086
+ output.log(`│ ${chalk16.gray(truncated)}`);
11770
12087
  }
11771
12088
  }
11772
12089
  if (lines.length > maxLines) {
11773
- output.log("│ " + chalk15.gray(`... (${lines.length - maxLines} more lines)`));
12090
+ output.log("│ " + chalk16.gray(`... (${lines.length - maxLines} more lines)`));
11774
12091
  }
11775
12092
  output.log("│");
11776
12093
  }
11777
12094
  output.log(`└${"─".repeat(52)}┘`);
11778
12095
  }
11779
12096
  output.log(`
11780
- ${chalk15.green("✓")} Found ${chalk15.bold(totalMatches.toString())} matches in ${chalk15.bold(results.length.toString())} sessions`);
11781
- output.log(chalk15.gray(`Query: "${query}"`));
12097
+ ${chalk16.green("✓")} Found ${chalk16.bold(totalMatches.toString())} matches in ${chalk16.bold(results.length.toString())} sessions`);
12098
+ output.log(chalk16.gray(`Query: "${query}"`));
11782
12099
  }
11783
12100
  } catch (error) {
11784
12101
  output.error(`Search failed: ${error instanceof Error ? error.message : String(error)}`);
@@ -11817,7 +12134,7 @@ var SessionsCommand = {
11817
12134
  };
11818
12135
 
11819
12136
  // src/commands/tasks/list.ts
11820
- import chalk16 from "chalk";
12137
+ import chalk17 from "chalk";
11821
12138
 
11822
12139
  // src/commands/tasks/_build-list-json.ts
11823
12140
  function buildListTasksJson(tasks, total, args, extras) {
@@ -11906,17 +12223,17 @@ var ListCommand2 = {
11906
12223
  tasks.forEach((t) => output.log(t.id.toString()));
11907
12224
  } else {
11908
12225
  const header = [
11909
- chalk16.bold("#"),
11910
- chalk16.bold("Title"),
11911
- chalk16.bold("Status"),
11912
- chalk16.bold("Priority"),
11913
- chalk16.bold("Type"),
11914
- chalk16.bold("Progress"),
11915
- chalk16.bold("Parent")
12226
+ chalk17.bold("#"),
12227
+ chalk17.bold("Title"),
12228
+ chalk17.bold("Status"),
12229
+ chalk17.bold("Priority"),
12230
+ chalk17.bold("Type"),
12231
+ chalk17.bold("Progress"),
12232
+ chalk17.bold("Parent")
11916
12233
  ].join(" │ ");
11917
12234
  const rows = tasks.map((t, i) => {
11918
- const statusColor = t.status === "completed" ? chalk16.green : t.status === "active" ? chalk16.blue : t.status === "paused" ? chalk16.yellow : t.status === "cancelled" ? chalk16.strikethrough : chalk16.gray;
11919
- const priorityColor = t.priority === "high" ? chalk16.red : t.priority === "medium" ? chalk16.yellow : chalk16.gray;
12235
+ const statusColor = t.status === "completed" ? chalk17.green : t.status === "active" ? chalk17.blue : t.status === "paused" ? chalk17.yellow : t.status === "cancelled" ? chalk17.strikethrough : chalk17.gray;
12236
+ const priorityColor = t.priority === "high" ? chalk17.red : t.priority === "medium" ? chalk17.yellow : chalk17.gray;
11920
12237
  return [
11921
12238
  (args.offset + i + 1).toString(),
11922
12239
  t.title.length > 30 ? t.title.slice(0, 27) + "..." : t.title,
@@ -11924,11 +12241,11 @@ var ListCommand2 = {
11924
12241
  priorityColor(t.priority),
11925
12242
  t.type || "normal",
11926
12243
  `${t.progress}%`,
11927
- t.parent_task_id ? `#${t.parent_task_id}` : chalk16.gray("root")
12244
+ t.parent_task_id ? `#${t.parent_task_id}` : chalk17.gray("root")
11928
12245
  ].join(" │ ");
11929
12246
  });
11930
- const depthNote = args.depth !== undefined ? chalk16.gray(` depth=${args.depth}`) : "";
11931
- const archivedNote = args.includeArchived ? chalk16.gray(" include-archived") : "";
12247
+ const depthNote = args.depth !== undefined ? chalk17.gray(` depth=${args.depth}`) : "";
12248
+ const archivedNote = args.includeArchived ? chalk17.gray(" include-archived") : "";
11932
12249
  output.log([
11933
12250
  `┌─ Tasks ${"─".repeat(55)}┐`,
11934
12251
  `│${header}│`,
@@ -11936,7 +12253,7 @@ var ListCommand2 = {
11936
12253
  ...rows.map((r) => `│${r}│`),
11937
12254
  "└" + "─".repeat(header.length + 2) + "┘",
11938
12255
  "",
11939
- chalk16.gray(`Showing ${tasks.length} of ${total} tasks (offset=${args.offset}, limit=${args.limit})${depthNote}${archivedNote}`)
12256
+ chalk17.gray(`Showing ${tasks.length} of ${total} tasks (offset=${args.offset}, limit=${args.limit})${depthNote}${archivedNote}`)
11940
12257
  ].join(`
11941
12258
  `));
11942
12259
  }
@@ -11950,7 +12267,7 @@ var ListCommand2 = {
11950
12267
  };
11951
12268
 
11952
12269
  // src/commands/tasks/get.ts
11953
- import chalk17 from "chalk";
12270
+ import chalk18 from "chalk";
11954
12271
  var GetCommand2 = {
11955
12272
  command: "get <id>",
11956
12273
  aliases: ["show"],
@@ -11989,10 +12306,10 @@ var GetCommand2 = {
11989
12306
  if (args.json) {
11990
12307
  output.json(result);
11991
12308
  } else {
11992
- output.log(chalk17.bold(`
12309
+ output.log(chalk18.bold(`
11993
12310
  Task #${result.task.id}: ${result.task.title}
11994
12311
  `));
11995
- output.log(`Status: ${chalk17.blue(result.task.status)} | Priority: ${result.task.priority} | Type: ${result.task.type} | Progress: ${result.task.progress}%`);
12312
+ output.log(`Status: ${chalk18.blue(result.task.status)} | Priority: ${result.task.priority} | Type: ${result.task.type} | Progress: ${result.task.progress}%`);
11996
12313
  output.log(`Created: ${result.task.createdAt} | Updated: ${result.task.updatedAt}`);
11997
12314
  output.log(`Project Path: ${result.task.project_path}`);
11998
12315
  output.log(`Context: ${result.task.context}`);
@@ -12000,7 +12317,7 @@ Task #${result.task.id}: ${result.task.title}
12000
12317
  output.log(`
12001
12318
  Current Status: ${result.task.current_status}`);
12002
12319
  }
12003
- output.log(chalk17.bold(`
12320
+ output.log(chalk18.bold(`
12004
12321
  Operations (${result.operations.length}):
12005
12322
  `));
12006
12323
  result.operations.forEach((op, i) => {
@@ -12020,10 +12337,10 @@ Operations (${result.operations.length}):
12020
12337
  if (args.json) {
12021
12338
  output.json(task);
12022
12339
  } else {
12023
- output.log(chalk17.bold(`
12340
+ output.log(chalk18.bold(`
12024
12341
  Task #${task.id}: ${task.title}
12025
12342
  `));
12026
- output.log(`Status: ${chalk17.blue(task.status)} | Priority: ${task.priority} | Type: ${task.type} | Progress: ${task.progress}%`);
12343
+ output.log(`Status: ${chalk18.blue(task.status)} | Priority: ${task.priority} | Type: ${task.type} | Progress: ${task.progress}%`);
12027
12344
  output.log(`Created: ${task.createdAt} | Updated: ${task.updatedAt}`);
12028
12345
  output.log(`Project Path: ${task.project_path}`);
12029
12346
  output.log(`Context: ${task.context}`);
@@ -12047,7 +12364,7 @@ Description: ${task.description}`);
12047
12364
  };
12048
12365
 
12049
12366
  // src/commands/tasks/create.ts
12050
- import chalk18 from "chalk";
12367
+ import chalk19 from "chalk";
12051
12368
  var CreateCommand = {
12052
12369
  command: "create <title>",
12053
12370
  aliases: ["add", "new"],
@@ -12125,7 +12442,7 @@ var CreateCommand = {
12125
12442
  if (args.json) {
12126
12443
  output.json(task);
12127
12444
  } else {
12128
- output.log(chalk18.green(`
12445
+ output.log(chalk19.green(`
12129
12446
  ✓ Task created: #${task.id}`));
12130
12447
  output.log(` Title: ${task.title}`);
12131
12448
  output.log(` Status: ${task.status}`);
@@ -12143,7 +12460,7 @@ var CreateCommand = {
12143
12460
  };
12144
12461
 
12145
12462
  // src/commands/tasks/update.ts
12146
- import chalk19 from "chalk";
12463
+ import chalk20 from "chalk";
12147
12464
  var UpdateCommand = {
12148
12465
  command: "update <id>",
12149
12466
  aliases: ["set"],
@@ -12201,7 +12518,7 @@ var UpdateCommand = {
12201
12518
  if (args.json) {
12202
12519
  output.json(task);
12203
12520
  } else {
12204
- output.log(chalk19.green(`
12521
+ output.log(chalk20.green(`
12205
12522
  ✓ Task updated: #${task.id}`));
12206
12523
  output.log(` Title: ${task.title}`);
12207
12524
  output.log(` Status: ${task.status}`);
@@ -12224,7 +12541,7 @@ var UpdateCommand = {
12224
12541
  };
12225
12542
 
12226
12543
  // src/commands/tasks/delete.ts
12227
- import chalk20 from "chalk";
12544
+ import chalk21 from "chalk";
12228
12545
  var DeleteCommand2 = {
12229
12546
  command: "delete <id>",
12230
12547
  aliases: ["remove", "rm", "del"],
@@ -12260,16 +12577,16 @@ var DeleteCommand2 = {
12260
12577
  process.exit(1);
12261
12578
  }
12262
12579
  if (!args.force) {
12263
- output.log(chalk20.yellow(`Are you sure you want to delete task #${args.id}?`));
12264
- output.log(chalk20.yellow(` Title: ${task.title}`));
12265
- output.log(chalk20.yellow(` Status: ${task.status}`));
12266
- output.log(chalk20.yellow(`
12580
+ output.log(chalk21.yellow(`Are you sure you want to delete task #${args.id}?`));
12581
+ output.log(chalk21.yellow(` Title: ${task.title}`));
12582
+ output.log(chalk21.yellow(` Status: ${task.status}`));
12583
+ output.log(chalk21.yellow(`
12267
12584
  Use --force to skip this confirmation`));
12268
12585
  process.exit(1);
12269
12586
  }
12270
12587
  const deleted = await taskComponent.deleteTask(args.id);
12271
12588
  if (deleted) {
12272
- output.log(chalk20.green(`
12589
+ output.log(chalk21.green(`
12273
12590
  ✓ Task deleted: #${args.id}`));
12274
12591
  } else {
12275
12592
  output.error(`Failed to delete task: ${args.id}`);
@@ -12285,7 +12602,7 @@ Use --force to skip this confirmation`));
12285
12602
  };
12286
12603
 
12287
12604
  // src/commands/tasks/complete.ts
12288
- import chalk21 from "chalk";
12605
+ import chalk22 from "chalk";
12289
12606
  var CompleteCommand = {
12290
12607
  command: "complete <id>",
12291
12608
  aliases: ["done", "finish"],
@@ -12342,7 +12659,7 @@ var CompleteCommand = {
12342
12659
  if (args.json) {
12343
12660
  output.json(task);
12344
12661
  } else {
12345
- output.log(chalk21.green(`
12662
+ output.log(chalk22.green(`
12346
12663
  ✓ Task completed: #${task.id}`));
12347
12664
  output.log(` Title: ${task.title}`);
12348
12665
  output.log(` Progress: ${task.progress}%`);
@@ -12358,7 +12675,7 @@ var CompleteCommand = {
12358
12675
  };
12359
12676
 
12360
12677
  // src/commands/tasks/operations.ts
12361
- import chalk22 from "chalk";
12678
+ import chalk23 from "chalk";
12362
12679
  var OperationsCommand = {
12363
12680
  command: "operations <task-id>",
12364
12681
  aliases: ["ops", "log"],
@@ -12408,23 +12725,23 @@ var OperationsCommand = {
12408
12725
  operations
12409
12726
  });
12410
12727
  } else {
12411
- output.log(chalk22.bold(`
12728
+ output.log(chalk23.bold(`
12412
12729
  Operations for Task #${task.id}: ${task.title}
12413
12730
  `));
12414
12731
  if (operations.length === 0) {
12415
- output.log(chalk22.gray("No operations found."));
12732
+ output.log(chalk23.gray("No operations found."));
12416
12733
  } else {
12417
12734
  operations.forEach((op, i) => {
12418
- const actionColor = op.actionType === "completed" ? chalk22.green : op.actionType === "milestone" ? chalk22.blue : op.actionType === "problem" ? chalk22.red : chalk22.gray;
12419
- output.log(`${chalk22.bold(a.offset + i + 1)}. ` + actionColor(`[${op.actionType}]`) + ` ${op.actionTitle}`);
12420
- output.log(` Session: ${chalk22.cyan(op.sessionId)} | Time: ${op.timestamp}`);
12735
+ const actionColor = op.actionType === "completed" ? chalk23.green : op.actionType === "milestone" ? chalk23.blue : op.actionType === "problem" ? chalk23.red : chalk23.gray;
12736
+ output.log(`${chalk23.bold(a.offset + i + 1)}. ` + actionColor(`[${op.actionType}]`) + ` ${op.actionTitle}`);
12737
+ output.log(` Session: ${chalk23.cyan(op.sessionId)} | Time: ${op.timestamp}`);
12421
12738
  if (op.actionDescription) {
12422
12739
  output.log(` ${op.actionDescription}`);
12423
12740
  }
12424
12741
  output.log("");
12425
12742
  });
12426
12743
  }
12427
- output.log(chalk22.gray(`Total: ${operations.length} operations`));
12744
+ output.log(chalk23.gray(`Total: ${operations.length} operations`));
12428
12745
  }
12429
12746
  } catch (error) {
12430
12747
  output.error(`Failed to list operations: ${error}`);
@@ -12436,7 +12753,7 @@ Operations for Task #${task.id}: ${task.title}
12436
12753
  };
12437
12754
 
12438
12755
  // src/commands/tasks/tree.ts
12439
- import chalk23 from "chalk";
12756
+ import chalk24 from "chalk";
12440
12757
  function buildTree(tasks) {
12441
12758
  const byParent = new Map;
12442
12759
  const nodeById = new Map;
@@ -12471,7 +12788,7 @@ function printTree(nodes, prefix, isRoot, output, currentDepth, maxDepth) {
12471
12788
  const statusColor = colorByStatus(node.task.status);
12472
12789
  const typeLabel = node.task.type ? ` [${node.task.type}]` : "";
12473
12790
  const progressLabel = node.task.progress > 0 ? ` (${node.task.progress}%)` : "";
12474
- const header = `#${node.task.id}${typeLabel} ${node.task.title} ${chalk23.gray("[" + node.task.status + "]")}${progressLabel}`;
12791
+ const header = `#${node.task.id}${typeLabel} ${node.task.title} ${chalk24.gray("[" + node.task.status + "]")}${progressLabel}`;
12475
12792
  output.log(prefix + connector + statusColor(header));
12476
12793
  if (node.children.length > 0) {
12477
12794
  const childPrefix = isRoot ? prefix : prefix + (isLast ? " " : "│ ");
@@ -12482,15 +12799,15 @@ function printTree(nodes, prefix, isRoot, output, currentDepth, maxDepth) {
12482
12799
  function colorByStatus(status) {
12483
12800
  switch (status) {
12484
12801
  case "completed":
12485
- return chalk23.green;
12802
+ return chalk24.green;
12486
12803
  case "active":
12487
- return chalk23.blue;
12804
+ return chalk24.blue;
12488
12805
  case "paused":
12489
- return chalk23.yellow;
12806
+ return chalk24.yellow;
12490
12807
  case "cancelled":
12491
- return chalk23.strikethrough;
12808
+ return chalk24.strikethrough;
12492
12809
  default:
12493
- return chalk23.gray;
12810
+ return chalk24.gray;
12494
12811
  }
12495
12812
  }
12496
12813
  var TreeCommand = {
@@ -12577,10 +12894,10 @@ var TreeCommand = {
12577
12894
  }
12578
12895
  const tree = buildTree(tasks);
12579
12896
  if (tree.length === 0) {
12580
- output.log(chalk23.gray("No tasks to display."));
12897
+ output.log(chalk24.gray("No tasks to display."));
12581
12898
  return;
12582
12899
  }
12583
- output.log(chalk23.bold(`Task Tree (${tasks.length} tasks, ${tree.length} roots)`) + (args.rootId !== undefined ? chalk23.gray(` — subtree of #${args.rootId}`) : ""));
12900
+ output.log(chalk24.bold(`Task Tree (${tasks.length} tasks, ${tree.length} roots)`) + (args.rootId !== undefined ? chalk24.gray(` — subtree of #${args.rootId}`) : ""));
12584
12901
  output.log("");
12585
12902
  printTree(tree, "", true, output, 0, args.maxDepth);
12586
12903
  } catch (error) {
@@ -12593,7 +12910,7 @@ var TreeCommand = {
12593
12910
  };
12594
12911
 
12595
12912
  // src/commands/tasks/search.ts
12596
- import chalk24 from "chalk";
12913
+ import chalk25 from "chalk";
12597
12914
  var SearchCommand = {
12598
12915
  command: "search <keywords..>",
12599
12916
  aliases: ["find", "grep"],
@@ -12657,26 +12974,26 @@ var SearchCommand = {
12657
12974
  tasks.forEach((t) => output.log(t.id.toString()));
12658
12975
  } else {
12659
12976
  const keywordStr = args.keywords.join(" ");
12660
- output.log(chalk24.bold(`
12977
+ output.log(chalk25.bold(`
12661
12978
  \uD83D\uDD0D Search: "${keywordStr}" — ${total} results
12662
12979
  `));
12663
12980
  if (tasks.length === 0) {
12664
- output.log(chalk24.gray(" No matching tasks found."));
12981
+ output.log(chalk25.gray(" No matching tasks found."));
12665
12982
  return;
12666
12983
  }
12667
12984
  for (const t of tasks) {
12668
- const statusColor = t.status === "completed" ? chalk24.green : t.status === "active" ? chalk24.blue : t.status === "paused" ? chalk24.yellow : t.status === "cancelled" ? chalk24.strikethrough : t.status === "archived" ? chalk24.gray : chalk24.gray;
12669
- const pid = t.parent_task_id ? chalk24.gray(` (#${t.parent_task_id})`) : "";
12985
+ const statusColor = t.status === "completed" ? chalk25.green : t.status === "active" ? chalk25.blue : t.status === "paused" ? chalk25.yellow : t.status === "cancelled" ? chalk25.strikethrough : t.status === "archived" ? chalk25.gray : chalk25.gray;
12986
+ const pid = t.parent_task_id ? chalk25.gray(` (#${t.parent_task_id})`) : "";
12670
12987
  output.log(` #${t.id} ${statusColor("[" + t.status + "]")} ${t.title}${pid}`);
12671
12988
  if (t.current_status) {
12672
- output.log(` ${chalk24.gray(t.current_status.slice(0, 80))}`);
12989
+ output.log(` ${chalk25.gray(t.current_status.slice(0, 80))}`);
12673
12990
  }
12674
12991
  }
12675
12992
  if (total > tasks.length) {
12676
- output.log(chalk24.gray(`
12993
+ output.log(chalk25.gray(`
12677
12994
  ... and ${total - tasks.length} more. Use --offset and --limit to paginate.`));
12678
12995
  }
12679
- output.log(chalk24.gray(` Page: ${Math.floor((args.offset || 0) / (args.limit || 20)) + 1}/${Math.ceil(total / (args.limit || 20))}`));
12996
+ output.log(chalk25.gray(` Page: ${Math.floor((args.offset || 0) / (args.limit || 20)) + 1}/${Math.ceil(total / (args.limit || 20))}`));
12680
12997
  }
12681
12998
  } catch (error) {
12682
12999
  output.error(`Failed to search tasks: ${error}`);
@@ -12936,7 +13253,7 @@ var TasksCommand = {
12936
13253
  };
12937
13254
 
12938
13255
  // src/commands/skills/list.ts
12939
- import chalk25 from "chalk";
13256
+ import chalk26 from "chalk";
12940
13257
  var ListCommand3 = {
12941
13258
  command: "list",
12942
13259
  aliases: ["ls"],
@@ -12989,26 +13306,26 @@ var ListCommand3 = {
12989
13306
  filtered.forEach((s) => output.log(s.name));
12990
13307
  } else {
12991
13308
  const header = [
12992
- chalk25.bold("Name"),
12993
- chalk25.bold("Description"),
12994
- chalk25.bold("Source")
13309
+ chalk26.bold("Name"),
13310
+ chalk26.bold("Description"),
13311
+ chalk26.bold("Source")
12995
13312
  ].join(" | ");
12996
13313
  const sourceColor = (source) => {
12997
13314
  switch (source) {
12998
13315
  case "project":
12999
- return chalk25.green;
13316
+ return chalk26.green;
13000
13317
  case "user":
13001
- return chalk25.blue;
13318
+ return chalk26.blue;
13002
13319
  case "built-in":
13003
- return chalk25.gray;
13320
+ return chalk26.gray;
13004
13321
  default:
13005
- return chalk25.white;
13322
+ return chalk26.white;
13006
13323
  }
13007
13324
  };
13008
13325
  const rows = filtered.map((s) => {
13009
13326
  const desc2 = s.description.length > 50 ? s.description.slice(0, 47) + "..." : s.description;
13010
13327
  return [
13011
- chalk25.cyan(s.name),
13328
+ chalk26.cyan(s.name),
13012
13329
  desc2,
13013
13330
  sourceColor(s.source)(`[${s.source}]`)
13014
13331
  ].join(" | ");
@@ -13020,7 +13337,7 @@ var ListCommand3 = {
13020
13337
  ...rows.map((r) => `│${r}│`),
13021
13338
  "└" + "─".repeat(header.length + 2) + "┘",
13022
13339
  "",
13023
- chalk25.gray(`Total: ${filtered.length} skills`)
13340
+ chalk26.gray(`Total: ${filtered.length} skills`)
13024
13341
  ].join(`
13025
13342
  `));
13026
13343
  }
@@ -13034,7 +13351,7 @@ var ListCommand3 = {
13034
13351
  };
13035
13352
 
13036
13353
  // src/commands/skills/get.ts
13037
- import chalk26 from "chalk";
13354
+ import chalk27 from "chalk";
13038
13355
  var GetCommand3 = {
13039
13356
  command: "get <name>",
13040
13357
  describe: "获取指定技能内容",
@@ -13078,13 +13395,13 @@ var GetCommand3 = {
13078
13395
  content: skill.content
13079
13396
  });
13080
13397
  } else {
13081
- output.log(chalk26.bold.cyan(`# ${skill.name}`));
13398
+ output.log(chalk27.bold.cyan(`# ${skill.name}`));
13082
13399
  output.log("");
13083
- output.log(`${chalk26.gray("Description:")} ${skill.description}`);
13084
- output.log(`${chalk26.gray("Source:")} ${skill.source}`);
13085
- output.log(`${chalk26.gray("File:")} ${skill.filePath}`);
13400
+ output.log(`${chalk27.gray("Description:")} ${skill.description}`);
13401
+ output.log(`${chalk27.gray("Source:")} ${skill.source}`);
13402
+ output.log(`${chalk27.gray("File:")} ${skill.filePath}`);
13086
13403
  output.log("");
13087
- output.log(chalk26.bold("--- Content ---"));
13404
+ output.log(chalk27.bold("--- Content ---"));
13088
13405
  output.log("");
13089
13406
  output.log(skill.content);
13090
13407
  }
@@ -13098,7 +13415,7 @@ var GetCommand3 = {
13098
13415
  };
13099
13416
 
13100
13417
  // src/commands/skills/search.ts
13101
- import chalk27 from "chalk";
13418
+ import chalk28 from "chalk";
13102
13419
  var SearchCommand2 = {
13103
13420
  command: "search <term>",
13104
13421
  aliases: ["find"],
@@ -13137,7 +13454,7 @@ var SearchCommand2 = {
13137
13454
  const term = args.term.toLowerCase();
13138
13455
  const results = allSkills.filter((s) => s.name.toLowerCase().includes(term) || s.description.toLowerCase().includes(term));
13139
13456
  if (results.length === 0) {
13140
- output.log(chalk27.yellow(`No skills found matching: ${args.term}`));
13457
+ output.log(chalk28.yellow(`No skills found matching: ${args.term}`));
13141
13458
  return;
13142
13459
  }
13143
13460
  if (args.json) {
@@ -13154,19 +13471,19 @@ var SearchCommand2 = {
13154
13471
  } else if (args.quiet) {
13155
13472
  results.forEach((s) => output.log(s.name));
13156
13473
  } else {
13157
- output.log(chalk27.bold(`Search results for "${args.term}":`));
13474
+ output.log(chalk28.bold(`Search results for "${args.term}":`));
13158
13475
  output.log("");
13159
13476
  const header = [
13160
- chalk27.bold("Name"),
13161
- chalk27.bold("Description"),
13162
- chalk27.bold("Match")
13477
+ chalk28.bold("Name"),
13478
+ chalk28.bold("Description"),
13479
+ chalk28.bold("Match")
13163
13480
  ].join(" | ");
13164
13481
  const rows = results.map((s) => {
13165
13482
  const matchedIn = s.name.toLowerCase().includes(term) ? "name" : "description";
13166
- const matchColor = matchedIn === "name" ? chalk27.green : chalk27.blue;
13483
+ const matchColor = matchedIn === "name" ? chalk28.green : chalk28.blue;
13167
13484
  const desc2 = s.description.length > 40 ? s.description.slice(0, 37) + "..." : s.description;
13168
13485
  return [
13169
- chalk27.cyan(s.name),
13486
+ chalk28.cyan(s.name),
13170
13487
  desc2,
13171
13488
  matchColor(`[${matchedIn}]`)
13172
13489
  ].join(" | ");
@@ -13178,7 +13495,7 @@ var SearchCommand2 = {
13178
13495
  ...rows.map((r) => `│${r}│`),
13179
13496
  "└" + "─".repeat(header.length + 2) + "┘",
13180
13497
  "",
13181
- chalk27.gray(`${results.length} matching skill(s) found.`)
13498
+ chalk28.gray(`${results.length} matching skill(s) found.`)
13182
13499
  ].join(`
13183
13500
  `));
13184
13501
  }
@@ -13192,7 +13509,7 @@ var SearchCommand2 = {
13192
13509
  };
13193
13510
 
13194
13511
  // src/commands/skills/reload.ts
13195
- import chalk28 from "chalk";
13512
+ import chalk29 from "chalk";
13196
13513
  var ReloadCommand = {
13197
13514
  command: "reload",
13198
13515
  describe: "重新扫描并更新 SkillTool",
@@ -13215,10 +13532,10 @@ var ReloadCommand = {
13215
13532
  output.error("SkillComponent not available");
13216
13533
  process.exit(1);
13217
13534
  }
13218
- output.log(chalk28.blue("Reloading skills..."));
13535
+ output.log(chalk29.blue("Reloading skills..."));
13219
13536
  await skillComponent.reload();
13220
13537
  const skills = skillComponent.getSkillList();
13221
- output.log(chalk28.green(`Successfully reloaded ${skills.length} skills`));
13538
+ output.log(chalk29.green(`Successfully reloaded ${skills.length} skills`));
13222
13539
  } catch (error) {
13223
13540
  output.error(`Failed to reload skills: ${error}`);
13224
13541
  process.exit(1);
@@ -13229,7 +13546,7 @@ var ReloadCommand = {
13229
13546
  };
13230
13547
 
13231
13548
  // src/commands/skills/show-config.ts
13232
- import chalk29 from "chalk";
13549
+ import chalk30 from "chalk";
13233
13550
  var ShowConfigCommand = {
13234
13551
  command: "show-config",
13235
13552
  aliases: ["config"],
@@ -13254,38 +13571,38 @@ var ShowConfigCommand = {
13254
13571
  process.exit(1);
13255
13572
  }
13256
13573
  const defaultConfig = skillComponent.getConfig?.();
13257
- output.log(chalk29.bold.cyan(`# Skills Configuration
13574
+ output.log(chalk30.bold.cyan(`# Skills Configuration
13258
13575
  `));
13259
- output.log(chalk29.bold(`## Scan Paths
13576
+ output.log(chalk30.bold(`## Scan Paths
13260
13577
  `));
13261
13578
  const paths = [
13262
13579
  { type: "user", desc: "用户路径", path: "~/.config/roy-agent/skills/" },
13263
13580
  { type: "project", desc: "项目路径", path: ".roy/skills/" }
13264
13581
  ];
13265
13582
  for (const p of paths) {
13266
- const typeColor = p.type === "project" ? chalk29.green : chalk29.blue;
13267
- output.log(` ${typeColor("[ " + p.type + " ]")} ${chalk29.gray(p.desc)}`);
13268
- output.log(` ${chalk29.cyan(p.path)}
13583
+ const typeColor = p.type === "project" ? chalk30.green : chalk30.blue;
13584
+ output.log(` ${typeColor("[ " + p.type + " ]")} ${chalk30.gray(p.desc)}`);
13585
+ output.log(` ${chalk30.cyan(p.path)}
13269
13586
  `);
13270
13587
  }
13271
- output.log(chalk29.bold(`## Scan Rules
13588
+ output.log(chalk30.bold(`## Scan Rules
13272
13589
  `));
13273
- output.log(` ${chalk29.gray("Pattern:")} ${chalk29.cyan("**/SKILL.md")}`);
13274
- output.log(` ${chalk29.gray("Recursive:")} ${chalk29.green("true")}`);
13275
- output.log(` ${chalk29.gray("Ignore:")} ${chalk29.cyan("**/node_modules/**")}
13590
+ output.log(` ${chalk30.gray("Pattern:")} ${chalk30.cyan("**/SKILL.md")}`);
13591
+ output.log(` ${chalk30.gray("Recursive:")} ${chalk30.green("true")}`);
13592
+ output.log(` ${chalk30.gray("Ignore:")} ${chalk30.cyan("**/node_modules/**")}
13276
13593
  `);
13277
- output.log(chalk29.bold(`## Priority (High to Low)
13594
+ output.log(chalk30.bold(`## Priority (High to Low)
13278
13595
  `));
13279
- output.log(` ${chalk29.green("1. project")} - 项目路径(最高优先级)`);
13280
- output.log(` ${chalk29.blue("2. user")} - 用户路径`);
13281
- output.log(` ${chalk29.gray("3. built-in")} - 内置路径(预留)
13596
+ output.log(` ${chalk30.green("1. project")} - 项目路径(最高优先级)`);
13597
+ output.log(` ${chalk30.blue("2. user")} - 用户路径`);
13598
+ output.log(` ${chalk30.gray("3. built-in")} - 内置路径(预留)
13282
13599
  `);
13283
- output.log(chalk29.bold(`## Usage
13600
+ output.log(chalk30.bold(`## Usage
13284
13601
  `));
13285
- output.log(` ${chalk29.cyan("roy-agent skills list")} ${chalk29.gray("- 列出所有技能")}`);
13286
- output.log(` ${chalk29.cyan("roy-agent skills get <name>")} ${chalk29.gray("- 获取技能内容")}`);
13287
- output.log(` ${chalk29.cyan("roy-agent skills search <term>")} ${chalk29.gray("- 搜索技能")}`);
13288
- output.log(` ${chalk29.cyan("roy-agent skills reload")} ${chalk29.gray("- 重新扫描技能")}`);
13602
+ output.log(` ${chalk30.cyan("roy-agent skills list")} ${chalk30.gray("- 列出所有技能")}`);
13603
+ output.log(` ${chalk30.cyan("roy-agent skills get <name>")} ${chalk30.gray("- 获取技能内容")}`);
13604
+ output.log(` ${chalk30.cyan("roy-agent skills search <term>")} ${chalk30.gray("- 搜索技能")}`);
13605
+ output.log(` ${chalk30.cyan("roy-agent skills reload")} ${chalk30.gray("- 重新扫描技能")}`);
13289
13606
  } catch (error) {
13290
13607
  output.error(`Failed to show config: ${error}`);
13291
13608
  process.exit(1);
@@ -13306,7 +13623,7 @@ var SkillsCommand = {
13306
13623
  };
13307
13624
 
13308
13625
  // src/commands/agents/list.ts
13309
- import chalk30 from "chalk";
13626
+ import chalk31 from "chalk";
13310
13627
  var ListCommand4 = {
13311
13628
  command: "list",
13312
13629
  aliases: ["ls"],
@@ -13371,25 +13688,25 @@ var ListCommand4 = {
13371
13688
  agents.forEach((a) => output.log(a.name));
13372
13689
  } else {
13373
13690
  const header = [
13374
- chalk30.bold("Name"),
13375
- chalk30.bold("Type"),
13376
- chalk30.bold("Model"),
13377
- chalk30.bold("Workflow"),
13378
- chalk30.bold("Description")
13691
+ chalk31.bold("Name"),
13692
+ chalk31.bold("Type"),
13693
+ chalk31.bold("Model"),
13694
+ chalk31.bold("Workflow"),
13695
+ chalk31.bold("Description")
13379
13696
  ].join(" | ");
13380
13697
  const typeColor = (type) => {
13381
13698
  if (type === "primary")
13382
- return chalk30.yellow;
13699
+ return chalk31.yellow;
13383
13700
  if (type === "workflow")
13384
- return chalk30.magenta;
13385
- return chalk30.blue;
13701
+ return chalk31.magenta;
13702
+ return chalk31.blue;
13386
13703
  };
13387
13704
  const rows = agents.map((a) => {
13388
13705
  const desc2 = (a.description || "").length > 40 ? (a.description || "").slice(0, 37) + "..." : a.description || "-";
13389
- const workflowDisplay = a.type === "workflow" && a.workflow ? chalk30.cyan(a.workflow.length > 30 ? a.workflow.slice(0, 27) + "..." : a.workflow) : chalk30.gray("-");
13390
- const modelDisplay = a.model ? chalk30.yellow(a.model.length > 20 ? a.model.slice(0, 17) + "..." : a.model) : chalk30.gray("-");
13706
+ const workflowDisplay = a.type === "workflow" && a.workflow ? chalk31.cyan(a.workflow.length > 30 ? a.workflow.slice(0, 27) + "..." : a.workflow) : chalk31.gray("-");
13707
+ const modelDisplay = a.model ? chalk31.yellow(a.model.length > 20 ? a.model.slice(0, 17) + "..." : a.model) : chalk31.gray("-");
13391
13708
  return [
13392
- chalk30.cyan(a.name),
13709
+ chalk31.cyan(a.name),
13393
13710
  typeColor(a.type)(a.type),
13394
13711
  modelDisplay,
13395
13712
  workflowDisplay,
@@ -13397,9 +13714,9 @@ var ListCommand4 = {
13397
13714
  ].join(" | ");
13398
13715
  });
13399
13716
  if (rows.length === 0) {
13400
- output.log(chalk30.yellow("No agents found."));
13717
+ output.log(chalk31.yellow("No agents found."));
13401
13718
  output.log("");
13402
- output.log(chalk30.gray("Tip: Create agent configs in ~/.local/share/roy-agent/agents/"));
13719
+ output.log(chalk31.gray("Tip: Create agent configs in ~/.local/share/roy-agent/agents/"));
13403
13720
  } else {
13404
13721
  output.log([
13405
13722
  `┌─ Agents ${"─".repeat(50)}┐`,
@@ -13408,7 +13725,7 @@ var ListCommand4 = {
13408
13725
  ...rows.map((r) => `│${r}│`),
13409
13726
  "└" + "─".repeat(header.length + 2) + "┘",
13410
13727
  "",
13411
- chalk30.gray(`Total: ${agents.length} agents`)
13728
+ chalk31.gray(`Total: ${agents.length} agents`)
13412
13729
  ].join(`
13413
13730
  `));
13414
13731
  }
@@ -13423,7 +13740,7 @@ var ListCommand4 = {
13423
13740
  };
13424
13741
 
13425
13742
  // src/commands/agents/get.ts
13426
- import chalk31 from "chalk";
13743
+ import chalk32 from "chalk";
13427
13744
  var GetCommand4 = {
13428
13745
  command: "get <name>",
13429
13746
  describe: "获取指定 agent 的详细信息",
@@ -13482,69 +13799,69 @@ var GetCommand4 = {
13482
13799
  filterHistory: agent.filterHistory
13483
13800
  });
13484
13801
  } else {
13485
- output.log(chalk31.bold.cyan(`# Agent: ${agent.name}`));
13802
+ output.log(chalk32.bold.cyan(`# Agent: ${agent.name}`));
13486
13803
  output.log("");
13487
- output.log(chalk31.bold("Basic Info:"));
13488
- output.log(` ${chalk31.cyan("name:")} ${agent.name}`);
13489
- output.log(` ${chalk31.cyan("type:")} ${agent.type}`);
13804
+ output.log(chalk32.bold("Basic Info:"));
13805
+ output.log(` ${chalk32.cyan("name:")} ${agent.name}`);
13806
+ output.log(` ${chalk32.cyan("type:")} ${agent.type}`);
13490
13807
  if (agent.description) {
13491
- output.log(` ${chalk31.cyan("description:")} ${agent.description}`);
13808
+ output.log(` ${chalk32.cyan("description:")} ${agent.description}`);
13492
13809
  }
13493
13810
  output.log("");
13494
13811
  if (agent.type === "workflow") {
13495
- output.log(chalk31.bold("Workflow:"));
13812
+ output.log(chalk32.bold("Workflow:"));
13496
13813
  if (agent.workflow) {
13497
- output.log(` ${chalk31.cyan("workflow:")} ${agent.workflow}`);
13498
- output.log(` ${chalk31.gray("→")} ${chalk31.gray(`roy-agent workflow run ${agent.workflow} --input '{"query":"..."}'`)}`);
13814
+ output.log(` ${chalk32.cyan("workflow:")} ${agent.workflow}`);
13815
+ output.log(` ${chalk32.gray("→")} ${chalk32.gray(`roy-agent workflow run ${agent.workflow} --input '{"query":"..."}'`)}`);
13499
13816
  } else {
13500
- output.log(` ${chalk31.gray("(no workflow configured)")}`);
13817
+ output.log(` ${chalk32.gray("(no workflow configured)")}`);
13501
13818
  }
13502
13819
  output.log("");
13503
13820
  }
13504
- output.log(chalk31.bold("System Prompt:"));
13821
+ output.log(chalk32.bold("System Prompt:"));
13505
13822
  if (agent.systemPromptRef) {
13506
- output.log(` ${chalk31.green("[ref]")} ${chalk31.cyan("systemPromptRef:")} ${agent.systemPromptRef}`);
13823
+ output.log(` ${chalk32.green("[ref]")} ${chalk32.cyan("systemPromptRef:")} ${agent.systemPromptRef}`);
13507
13824
  }
13508
13825
  if (agent.systemPrompt && !agent.systemPromptRef) {
13509
13826
  const promptPreview = agent.systemPrompt.length > 100 ? agent.systemPrompt.slice(0, 97) + "..." : agent.systemPrompt;
13510
- output.log(` ${chalk31.gray("[inline]")}`);
13511
- output.log(` ${chalk31.gray(promptPreview.split(`
13827
+ output.log(` ${chalk32.gray("[inline]")}`);
13828
+ output.log(` ${chalk32.gray(promptPreview.split(`
13512
13829
  `).join(`
13513
13830
  `))}`);
13514
13831
  }
13515
13832
  if (resolvedSystemPrompt) {
13516
13833
  const resolvedPreview = resolvedSystemPrompt.length > 200 ? resolvedSystemPrompt.slice(0, 197) + "..." : resolvedSystemPrompt;
13517
- output.log(` ${chalk31.green("[resolved]")}`);
13518
- output.log(` ${chalk31.gray(resolvedPreview.split(`
13834
+ output.log(` ${chalk32.green("[resolved]")}`);
13835
+ output.log(` ${chalk32.gray(resolvedPreview.split(`
13519
13836
  `).join(`
13520
13837
  `))}`);
13521
13838
  }
13522
13839
  if (!agent.systemPromptRef && !agent.systemPrompt && !resolvedSystemPrompt) {
13523
- output.log(` ${chalk31.gray("(none)")}`);
13840
+ output.log(` ${chalk32.gray("(none)")}`);
13524
13841
  }
13525
13842
  output.log("");
13526
13843
  const hasOptions = agent.model || agent.maxIterations || agent.toolTimeout;
13527
13844
  if (hasOptions) {
13528
- output.log(chalk31.bold("Options:"));
13845
+ output.log(chalk32.bold("Options:"));
13529
13846
  if (agent.model) {
13530
- output.log(` ${chalk31.cyan("model:")} ${agent.model}`);
13847
+ output.log(` ${chalk32.cyan("model:")} ${agent.model}`);
13531
13848
  }
13532
13849
  if (agent.maxIterations) {
13533
- output.log(` ${chalk31.cyan("maxIterations:")} ${agent.maxIterations}`);
13850
+ output.log(` ${chalk32.cyan("maxIterations:")} ${agent.maxIterations}`);
13534
13851
  }
13535
13852
  if (agent.toolTimeout) {
13536
- output.log(` ${chalk31.cyan("toolTimeout:")} ${agent.toolTimeout}ms`);
13853
+ output.log(` ${chalk32.cyan("toolTimeout:")} ${agent.toolTimeout}ms`);
13537
13854
  }
13538
13855
  output.log("");
13539
13856
  }
13540
13857
  const hasTools = agent.allowedTools?.length || agent.deniedTools?.length;
13541
13858
  if (hasTools) {
13542
- output.log(chalk31.bold("Tool Permissions:"));
13859
+ output.log(chalk32.bold("Tool Permissions:"));
13543
13860
  if (agent.allowedTools?.length) {
13544
- output.log(` ${chalk31.green("allowed:")} ${agent.allowedTools.join(", ")}`);
13861
+ output.log(` ${chalk32.green("allowed:")} ${agent.allowedTools.join(", ")}`);
13545
13862
  }
13546
13863
  if (agent.deniedTools?.length) {
13547
- output.log(` ${chalk31.red("denied:")} ${agent.deniedTools.join(", ")}`);
13864
+ output.log(` ${chalk32.red("denied:")} ${agent.deniedTools.join(", ")}`);
13548
13865
  }
13549
13866
  output.log("");
13550
13867
  }
@@ -13559,7 +13876,7 @@ var GetCommand4 = {
13559
13876
  };
13560
13877
 
13561
13878
  // src/commands/agents/add.ts
13562
- import chalk32 from "chalk";
13879
+ import chalk33 from "chalk";
13563
13880
  function parseToolList(value) {
13564
13881
  if (!value?.trim()) {
13565
13882
  return;
@@ -13651,8 +13968,8 @@ var AddCommand = {
13651
13968
  if (args.json) {
13652
13969
  output.json({ agent, filePath });
13653
13970
  } else {
13654
- output.log(chalk32.green(`✓ Agent '${args.name}' created`));
13655
- output.log(chalk32.gray(` ${filePath}`));
13971
+ output.log(chalk33.green(`✓ Agent '${args.name}' created`));
13972
+ output.log(chalk33.gray(` ${filePath}`));
13656
13973
  }
13657
13974
  } catch (error) {
13658
13975
  output.error(`Failed to add agent: ${error}`);
@@ -13664,7 +13981,7 @@ var AddCommand = {
13664
13981
  };
13665
13982
 
13666
13983
  // src/commands/agents/delete.ts
13667
- import chalk33 from "chalk";
13984
+ import chalk34 from "chalk";
13668
13985
  var DeleteCommand3 = {
13669
13986
  command: "delete <name>",
13670
13987
  describe: "删除 agent 配置文件",
@@ -13706,7 +14023,7 @@ var DeleteCommand3 = {
13706
14023
  }
13707
14024
  const filePath = registry.getAgentFilePath(args.name);
13708
14025
  if (!args.yes) {
13709
- output.log(chalk33.yellow(`Delete agent '${args.name}'? This removes ${filePath} (use --yes to skip confirmation)`));
14026
+ output.log(chalk34.yellow(`Delete agent '${args.name}'? This removes ${filePath} (use --yes to skip confirmation)`));
13710
14027
  process.exit(1);
13711
14028
  }
13712
14029
  const deleted = await registry.deleteAgent(args.name);
@@ -13717,7 +14034,7 @@ var DeleteCommand3 = {
13717
14034
  if (args.json) {
13718
14035
  output.json({ deleted: true, name: args.name, filePath });
13719
14036
  } else {
13720
- output.log(chalk33.green(`✓ Agent '${args.name}' deleted`));
14037
+ output.log(chalk34.green(`✓ Agent '${args.name}' deleted`));
13721
14038
  }
13722
14039
  } catch (error) {
13723
14040
  output.error(`Failed to delete agent: ${error}`);
@@ -13729,7 +14046,7 @@ var DeleteCommand3 = {
13729
14046
  };
13730
14047
 
13731
14048
  // src/commands/agents/config-dir.ts
13732
- import chalk34 from "chalk";
14049
+ import chalk35 from "chalk";
13733
14050
  var ConfigDirCommand = {
13734
14051
  command: "config-dir",
13735
14052
  describe: "显示 agent 配置目录路径",
@@ -13760,8 +14077,8 @@ var ConfigDirCommand = {
13760
14077
  if (args.json) {
13761
14078
  output.json({ configDir, exists });
13762
14079
  } else {
13763
- output.log(`${chalk34.cyan("Agent Config Directory:")} ${configDir}`);
13764
- output.log(`${chalk34.gray("Exists:")} ${exists ? "yes" : "no"}`);
14080
+ output.log(`${chalk35.cyan("Agent Config Directory:")} ${configDir}`);
14081
+ output.log(`${chalk35.gray("Exists:")} ${exists ? "yes" : "no"}`);
13765
14082
  }
13766
14083
  } catch (error) {
13767
14084
  output.error(`Failed to get config dir: ${error}`);
@@ -13784,7 +14101,7 @@ var AgentsCommand = {
13784
14101
  };
13785
14102
 
13786
14103
  // src/commands/prompt/list.ts
13787
- import chalk35 from "chalk";
14104
+ import chalk36 from "chalk";
13788
14105
  var ListCommand5 = {
13789
14106
  command: "list",
13790
14107
  aliases: ["ls"],
@@ -13840,17 +14157,17 @@ var ListCommand5 = {
13840
14157
  prompts.forEach((p) => output.log(p.name));
13841
14158
  } else {
13842
14159
  const header = [
13843
- chalk35.bold("Name"),
13844
- chalk35.bold("Source")
14160
+ chalk36.bold("Name"),
14161
+ chalk36.bold("Source")
13845
14162
  ].join(" | ");
13846
14163
  const rows = prompts.map((p) => {
13847
14164
  return [
13848
- chalk35.cyan(p.name),
13849
- chalk35.gray(`[${p.source}]`)
14165
+ chalk36.cyan(p.name),
14166
+ chalk36.gray(`[${p.source}]`)
13850
14167
  ].join(" | ");
13851
14168
  });
13852
14169
  if (rows.length === 0) {
13853
- output.log(chalk35.yellow("No prompts found."));
14170
+ output.log(chalk36.yellow("No prompts found."));
13854
14171
  } else {
13855
14172
  output.log([
13856
14173
  `┌─ Prompts ${"─".repeat(50)}┐`,
@@ -13859,7 +14176,7 @@ var ListCommand5 = {
13859
14176
  ...rows.map((r) => `│${r}│`),
13860
14177
  "└" + "─".repeat(header.length + 2) + "┘",
13861
14178
  "",
13862
- chalk35.gray(`Total: ${prompts.length} prompts`)
14179
+ chalk36.gray(`Total: ${prompts.length} prompts`)
13863
14180
  ].join(`
13864
14181
  `));
13865
14182
  }
@@ -13874,7 +14191,7 @@ var ListCommand5 = {
13874
14191
  };
13875
14192
 
13876
14193
  // src/commands/prompt/get.ts
13877
- import chalk36 from "chalk";
14194
+ import chalk37 from "chalk";
13878
14195
  var GetCommand5 = {
13879
14196
  command: "get <name>",
13880
14197
  describe: "获取指定 prompt 的内容",
@@ -13921,16 +14238,16 @@ var GetCommand5 = {
13921
14238
  variables: vars
13922
14239
  });
13923
14240
  } else {
13924
- output.log(chalk36.bold.cyan(`# Prompt: ${args.name}`));
14241
+ output.log(chalk37.bold.cyan(`# Prompt: ${args.name}`));
13925
14242
  output.log("");
13926
14243
  if (Object.keys(vars).length > 0) {
13927
- output.log(chalk36.gray("Variables:"));
14244
+ output.log(chalk37.gray("Variables:"));
13928
14245
  for (const [key, value] of Object.entries(vars)) {
13929
- output.log(` ${chalk36.cyan(key + ":")} ${value}`);
14246
+ output.log(` ${chalk37.cyan(key + ":")} ${value}`);
13930
14247
  }
13931
14248
  output.log("");
13932
14249
  }
13933
- output.log(chalk36.bold("Content:"));
14250
+ output.log(chalk37.bold("Content:"));
13934
14251
  output.log("─".repeat(60));
13935
14252
  output.log(prompt);
13936
14253
  output.log("─".repeat(60));
@@ -13959,8 +14276,8 @@ function parseVars(vars) {
13959
14276
  }
13960
14277
 
13961
14278
  // src/commands/prompt/add.ts
13962
- import { readFile } from "fs/promises";
13963
- import chalk37 from "chalk";
14279
+ import { readFile as readFile2 } from "fs/promises";
14280
+ import chalk38 from "chalk";
13964
14281
  var AddCommand2 = {
13965
14282
  command: "add <name>",
13966
14283
  describe: "添加 prompt 并持久化到 ~/.local/share/roy-agent/prompts/",
@@ -14001,7 +14318,7 @@ var AddCommand2 = {
14001
14318
  output.error("PromptComponent not available");
14002
14319
  process.exit(1);
14003
14320
  }
14004
- const content = args.file ? await readFile(args.file, "utf-8") : args.content;
14321
+ const content = args.file ? await readFile2(args.file, "utf-8") : args.content;
14005
14322
  const filePath = await promptComponent.savePrompt(args.name, content);
14006
14323
  if (args.json) {
14007
14324
  output.json({
@@ -14011,8 +14328,8 @@ var AddCommand2 = {
14011
14328
  length: content.trim().length
14012
14329
  });
14013
14330
  } else {
14014
- output.log(chalk37.green(`✓ Prompt '${args.name}' saved`));
14015
- output.log(chalk37.gray(` ${filePath}`));
14331
+ output.log(chalk38.green(`✓ Prompt '${args.name}' saved`));
14332
+ output.log(chalk38.gray(` ${filePath}`));
14016
14333
  }
14017
14334
  } catch (error) {
14018
14335
  output.error(`Failed to add prompt: ${error}`);
@@ -14024,7 +14341,7 @@ var AddCommand2 = {
14024
14341
  };
14025
14342
 
14026
14343
  // src/commands/prompt/config-dir.ts
14027
- import chalk38 from "chalk";
14344
+ import chalk39 from "chalk";
14028
14345
  var ConfigDirCommand2 = {
14029
14346
  command: "config-dir",
14030
14347
  describe: "显示 prompt 持久化目录路径",
@@ -14054,8 +14371,8 @@ var ConfigDirCommand2 = {
14054
14371
  if (args.json) {
14055
14372
  output.json({ configDir, exists });
14056
14373
  } else {
14057
- output.log(`${chalk38.cyan("Prompt Config Directory:")} ${configDir}`);
14058
- output.log(`${chalk38.gray("Exists:")} ${exists ? "yes" : "no"}`);
14374
+ output.log(`${chalk39.cyan("Prompt Config Directory:")} ${configDir}`);
14375
+ output.log(`${chalk39.gray("Exists:")} ${exists ? "yes" : "no"}`);
14059
14376
  }
14060
14377
  } catch (error) {
14061
14378
  output.error(`Failed to get config dir: ${error}`);
@@ -14077,7 +14394,7 @@ var PromptCommand = {
14077
14394
  };
14078
14395
 
14079
14396
  // src/commands/commands-list.ts
14080
- import chalk39 from "chalk";
14397
+ import chalk40 from "chalk";
14081
14398
  function truncateVisual(str, maxWidth) {
14082
14399
  let result = "";
14083
14400
  let width = 0;
@@ -14092,16 +14409,16 @@ function truncateVisual(str, maxWidth) {
14092
14409
  }
14093
14410
  function formatCommandsTable(commands) {
14094
14411
  if (commands.length === 0) {
14095
- return chalk39.yellow("命令目录为空,使用 'roy-agent commands add' 添加命令");
14412
+ return chalk40.yellow("命令目录为空,使用 'roy-agent commands add' 添加命令");
14096
14413
  }
14097
14414
  const NAME_WIDTH = 20;
14098
14415
  const SOURCE_WIDTH = 10;
14099
14416
  const DESC_WIDTH = 50;
14100
14417
  const GAP = " ";
14101
14418
  const headerLine = [
14102
- chalk39.bold("NAME".padEnd(NAME_WIDTH)),
14103
- chalk39.bold("SOURCE".padEnd(SOURCE_WIDTH)),
14104
- chalk39.bold("DESCRIPTION")
14419
+ chalk40.bold("NAME".padEnd(NAME_WIDTH)),
14420
+ chalk40.bold("SOURCE".padEnd(SOURCE_WIDTH)),
14421
+ chalk40.bold("DESCRIPTION")
14105
14422
  ].join(GAP);
14106
14423
  const sepLine = "─".repeat(NAME_WIDTH + SOURCE_WIDTH + DESC_WIDTH + GAP.length * 2);
14107
14424
  const formatRow = (cmd) => {
@@ -14164,7 +14481,7 @@ var CommandsListCommand = {
14164
14481
  }));
14165
14482
  output.log(formatCommandsTable(rows));
14166
14483
  output.info("");
14167
- output.log(chalk39.green(`✅ 共 ${result.commands.length} 个命令`) + chalk39.gray(` (user: ${result.stats.userCount}, project: ${result.stats.projectCount})`));
14484
+ output.log(chalk40.green(`✅ 共 ${result.commands.length} 个命令`) + chalk40.gray(` (user: ${result.stats.userCount}, project: ${result.stats.projectCount})`));
14168
14485
  }
14169
14486
  } catch (error) {
14170
14487
  output.error(`Failed to list commands: ${error}`);
@@ -14176,7 +14493,7 @@ var CommandsListCommand = {
14176
14493
  };
14177
14494
 
14178
14495
  // src/commands/commands-add.ts
14179
- import chalk40 from "chalk";
14496
+ import chalk41 from "chalk";
14180
14497
  var CommandsAddCommand = {
14181
14498
  command: "add <name> <target>",
14182
14499
  describe: "添加收藏命令(自动创建 symlink)",
@@ -14237,10 +14554,10 @@ var CommandsAddCommand = {
14237
14554
  });
14238
14555
  const dirs = await commandsComponent.getCommandDirs();
14239
14556
  const targetDir = source === "user" ? dirs.user : dirs.project;
14240
- output.log(chalk40.green(`✅ 已添加命令 '${args.name}'`));
14241
- output.log(chalk40.gray(` 目标: ${args.target}`));
14242
- output.log(chalk40.gray(` 位置: ${targetDir}/${args.name}`));
14243
- output.log(chalk40.gray(` 级别: ${source === "user" ? "USER" : "PROJECT"}`));
14557
+ output.log(chalk41.green(`✅ 已添加命令 '${args.name}'`));
14558
+ output.log(chalk41.gray(` 目标: ${args.target}`));
14559
+ output.log(chalk41.gray(` 位置: ${targetDir}/${args.name}`));
14560
+ output.log(chalk41.gray(` 级别: ${source === "user" ? "USER" : "PROJECT"}`));
14244
14561
  } catch (error) {
14245
14562
  output.error(`添加失败: ${error.message}`);
14246
14563
  process.exit(1);
@@ -14251,7 +14568,7 @@ var CommandsAddCommand = {
14251
14568
  };
14252
14569
 
14253
14570
  // src/commands/commands-remove.ts
14254
- import chalk41 from "chalk";
14571
+ import chalk42 from "chalk";
14255
14572
  var CommandsRemoveCommand = {
14256
14573
  command: "remove <name>",
14257
14574
  aliases: ["rm"],
@@ -14295,7 +14612,7 @@ var CommandsRemoveCommand = {
14295
14612
  name: args.name,
14296
14613
  source: "user"
14297
14614
  });
14298
- output.log(chalk41.green(`✅ 已从用户目录移除命令 '${args.name}'`));
14615
+ output.log(chalk42.green(`✅ 已从用户目录移除命令 '${args.name}'`));
14299
14616
  } catch (error) {
14300
14617
  if (!error.message?.includes("不存在")) {
14301
14618
  throw error;
@@ -14308,7 +14625,7 @@ var CommandsRemoveCommand = {
14308
14625
  name: args.name,
14309
14626
  source: "project"
14310
14627
  });
14311
- output.log(chalk41.green(`✅ 已从项目目录移除命令 '${args.name}'`));
14628
+ output.log(chalk42.green(`✅ 已从项目目录移除命令 '${args.name}'`));
14312
14629
  } catch (error) {
14313
14630
  if (!error.message?.includes("不存在")) {
14314
14631
  throw error;
@@ -14322,7 +14639,7 @@ var CommandsRemoveCommand = {
14322
14639
  name: args.name,
14323
14640
  source: "user"
14324
14641
  });
14325
- output.log(chalk41.green(`✅ 已从用户目录移除命令 '${args.name}'`));
14642
+ output.log(chalk42.green(`✅ 已从用户目录移除命令 '${args.name}'`));
14326
14643
  removed = true;
14327
14644
  } catch (error) {
14328
14645
  if (!error.message?.includes("不存在")) {
@@ -14334,7 +14651,7 @@ var CommandsRemoveCommand = {
14334
14651
  name: args.name,
14335
14652
  source: "project"
14336
14653
  });
14337
- output.log(chalk41.green(`✅ 已从项目目录移除命令 '${args.name}'`));
14654
+ output.log(chalk42.green(`✅ 已从项目目录移除命令 '${args.name}'`));
14338
14655
  removed = true;
14339
14656
  } catch (error) {
14340
14657
  if (!error.message?.includes("不存在")) {
@@ -14356,10 +14673,10 @@ var CommandsRemoveCommand = {
14356
14673
  };
14357
14674
 
14358
14675
  // src/commands/commands-info.ts
14359
- import chalk42 from "chalk";
14360
- import { exec } from "child_process";
14676
+ import chalk43 from "chalk";
14677
+ import { exec as exec2 } from "child_process";
14361
14678
  import { promisify } from "util";
14362
- var execAsync = promisify(exec);
14679
+ var execAsync2 = promisify(exec2);
14363
14680
  var CommandsInfoCommand = {
14364
14681
  command: "info <name>",
14365
14682
  describe: "显示命令详细信息",
@@ -14391,22 +14708,22 @@ var CommandsInfoCommand = {
14391
14708
  output.error(`命令 '${args.name}' 不存在`);
14392
14709
  process.exit(1);
14393
14710
  }
14394
- output.log(chalk42.bold("Name:") + ` ${info.name}`);
14395
- output.log(chalk42.bold("Path:") + ` ${info.path}`);
14396
- output.log(chalk42.bold("Source:") + ` ${info.source.toUpperCase()}`);
14397
- output.log(chalk42.bold("Description:") + ` ${info.shortDescription || "-"}`);
14711
+ output.log(chalk43.bold("Name:") + ` ${info.name}`);
14712
+ output.log(chalk43.bold("Path:") + ` ${info.path}`);
14713
+ output.log(chalk43.bold("Source:") + ` ${info.source.toUpperCase()}`);
14714
+ output.log(chalk43.bold("Description:") + ` ${info.shortDescription || "-"}`);
14398
14715
  output.log();
14399
- output.log(chalk42.gray("─".repeat(50)));
14716
+ output.log(chalk43.gray("─".repeat(50)));
14400
14717
  output.log();
14401
14718
  try {
14402
- const { stdout } = await execAsync(`${info.path} --help`, { timeout: 5000 });
14719
+ const { stdout } = await execAsync2(`${info.path} --help`, { timeout: 5000 });
14403
14720
  output.log(stdout);
14404
14721
  } catch {
14405
14722
  try {
14406
- const { stdout } = await execAsync(`${info.path} -h`, { timeout: 5000 });
14723
+ const { stdout } = await execAsync2(`${info.path} -h`, { timeout: 5000 });
14407
14724
  output.log(stdout);
14408
14725
  } catch {
14409
- output.log(chalk42.gray("(无法获取帮助信息)"));
14726
+ output.log(chalk43.gray("(无法获取帮助信息)"));
14410
14727
  }
14411
14728
  }
14412
14729
  } catch (error) {
@@ -14419,7 +14736,7 @@ var CommandsInfoCommand = {
14419
14736
  };
14420
14737
 
14421
14738
  // src/commands/commands-dirs.ts
14422
- import chalk43 from "chalk";
14739
+ import chalk44 from "chalk";
14423
14740
  var CommandsDirsCommand = {
14424
14741
  command: "dirs",
14425
14742
  describe: "显示命令目录",
@@ -14451,10 +14768,10 @@ var CommandsDirsCommand = {
14451
14768
  if (args.json) {
14452
14769
  output.json(dirs);
14453
14770
  } else {
14454
- output.log(chalk43.bold("命令目录:"));
14771
+ output.log(chalk44.bold("命令目录:"));
14455
14772
  output.log();
14456
- output.log(chalk43.cyan("USER:") + ` ${dirs.user}`);
14457
- output.log(chalk43.cyan("PROJECT:") + ` ${dirs.project}`);
14773
+ output.log(chalk44.cyan("USER:") + ` ${dirs.user}`);
14774
+ output.log(chalk44.cyan("PROJECT:") + ` ${dirs.project}`);
14458
14775
  }
14459
14776
  } catch (error) {
14460
14777
  output.error(`错误: ${error.message}`);
@@ -14474,7 +14791,7 @@ var CommandsCommand = {
14474
14791
  };
14475
14792
 
14476
14793
  // src/commands/config/list.ts
14477
- import chalk44 from "chalk";
14794
+ import chalk45 from "chalk";
14478
14795
 
14479
14796
  // src/commands/config/config-service.ts
14480
14797
  import * as fsSync from "fs";
@@ -14778,7 +15095,7 @@ var ConfigListCommand = {
14778
15095
  output.log("");
14779
15096
  output.log("Supported components:");
14780
15097
  for (const comp of SUPPORTED_COMPONENTS) {
14781
- output.log(` ${chalk44.cyan(comp.padEnd(15))} ${COMPONENT_DESCRIPTIONS[comp] || ""}`);
15098
+ output.log(` ${chalk45.cyan(comp.padEnd(15))} ${COMPONENT_DESCRIPTIONS[comp] || ""}`);
14782
15099
  }
14783
15100
  process.exit(1);
14784
15101
  }
@@ -14796,27 +15113,27 @@ var ConfigListCommand = {
14796
15113
  }
14797
15114
  };
14798
15115
  function showHelp(output) {
14799
- output.log(chalk44.bold.cyan("# roy-agent config list"));
15116
+ output.log(chalk45.bold.cyan("# roy-agent config list"));
14800
15117
  output.log("");
14801
15118
  output.log("查看 roy-agent 组件配置信息");
14802
15119
  output.log("");
14803
- output.log(chalk44.bold("Usage:"));
14804
- output.log(` ${chalk44.cyan("roy-agent config list [component] [options]")}`);
15120
+ output.log(chalk45.bold("Usage:"));
15121
+ output.log(` ${chalk45.cyan("roy-agent config list [component] [options]")}`);
14805
15122
  output.log("");
14806
- output.log(chalk44.bold("Components:"));
15123
+ output.log(chalk45.bold("Components:"));
14807
15124
  for (const comp of SUPPORTED_COMPONENTS) {
14808
- output.log(` ${chalk44.cyan(comp.padEnd(15))} ${chalk44.gray(COMPONENT_DESCRIPTIONS[comp] || "")}`);
15125
+ output.log(` ${chalk45.cyan(comp.padEnd(15))} ${chalk45.gray(COMPONENT_DESCRIPTIONS[comp] || "")}`);
14809
15126
  }
14810
- output.log(` ${chalk44.cyan("all".padEnd(15))} 显示所有 components 概览`);
15127
+ output.log(` ${chalk45.cyan("all".padEnd(15))} 显示所有 components 概览`);
14811
15128
  output.log("");
14812
- output.log(chalk44.bold("Options:"));
14813
- output.log(` ${chalk44.cyan("-j, --json")} JSON 格式输出`);
14814
- output.log(` ${chalk44.cyan("-k, --keys")} 只显示配置键`);
14815
- output.log(` ${chalk44.cyan("-s, --sources")} 只显示配置源`);
15129
+ output.log(chalk45.bold("Options:"));
15130
+ output.log(` ${chalk45.cyan("-j, --json")} JSON 格式输出`);
15131
+ output.log(` ${chalk45.cyan("-k, --keys")} 只显示配置键`);
15132
+ output.log(` ${chalk45.cyan("-s, --sources")} 只显示配置源`);
14816
15133
  output.log("");
14817
- output.log(chalk44.bold("Examples:"));
15134
+ output.log(chalk45.bold("Examples:"));
14818
15135
  for (const { command: command2, description } of USAGE_COMMANDS) {
14819
- output.log(` ${chalk44.cyan(command2.padEnd(40))} ${chalk44.gray(description)}`);
15136
+ output.log(` ${chalk45.cyan(command2.padEnd(40))} ${chalk45.gray(description)}`);
14820
15137
  }
14821
15138
  }
14822
15139
  async function showAllComponents(output, configService) {
@@ -14825,13 +15142,13 @@ async function showAllComponents(output, configService) {
14825
15142
  const config = configService.getComponentConfig(compName);
14826
15143
  components.push({ name: compName, config });
14827
15144
  }
14828
- output.log(chalk44.bold.cyan("# All Components Overview"));
15145
+ output.log(chalk45.bold.cyan("# All Components Overview"));
14829
15146
  output.log("");
14830
- output.log(` ${chalk44.cyan("Component".padEnd(15))} ${chalk44.cyan("Keys".padEnd(10))} ${chalk44.gray("Description")}`);
14831
- output.log(` ${chalk44.gray("─".repeat(60))}`);
15147
+ output.log(` ${chalk45.cyan("Component".padEnd(15))} ${chalk45.cyan("Keys".padEnd(10))} ${chalk45.gray("Description")}`);
15148
+ output.log(` ${chalk45.gray("─".repeat(60))}`);
14832
15149
  for (const comp of components) {
14833
15150
  const keyCount = Object.keys(comp.config).length;
14834
- output.log(` ${chalk44.cyan(comp.name.padEnd(15))} ${keyCount.toString().padEnd(10)} ${chalk44.gray(COMPONENT_DESCRIPTIONS[comp.name] || "")}`);
15151
+ output.log(` ${chalk45.cyan(comp.name.padEnd(15))} ${keyCount.toString().padEnd(10)} ${chalk45.gray(COMPONENT_DESCRIPTIONS[comp.name] || "")}`);
14835
15152
  }
14836
15153
  }
14837
15154
  async function showComponentConfig(componentName, output, configService, options) {
@@ -14853,22 +15170,22 @@ async function showComponentConfig(componentName, output, configService, options
14853
15170
  });
14854
15171
  return;
14855
15172
  }
14856
- output.log(chalk44.bold.cyan(`# ${componentName} Component Configuration`));
15173
+ output.log(chalk45.bold.cyan(`# ${componentName} Component Configuration`));
14857
15174
  output.log("");
14858
15175
  if (filePath) {
14859
- output.log(chalk44.bold("File:"));
14860
- output.log(` ${chalk44.cyan(filePath)}`);
15176
+ output.log(chalk45.bold("File:"));
15177
+ output.log(` ${chalk45.cyan(filePath)}`);
14861
15178
  output.log("");
14862
15179
  }
14863
15180
  if (!options.sources) {
14864
- output.log(chalk44.bold("Configuration:"));
15181
+ output.log(chalk45.bold("Configuration:"));
14865
15182
  if (Object.keys(config).length === 0) {
14866
- output.log(` ${chalk44.gray("(无配置)")}`);
15183
+ output.log(` ${chalk45.gray("(无配置)")}`);
14867
15184
  } else {
14868
15185
  const flatConfig = flattenConfig(config);
14869
15186
  for (const [key, value] of flatConfig) {
14870
15187
  const displayValue = formatValue(value);
14871
- output.log(` ${chalk44.cyan(key + ":")} ${displayValue}`);
15188
+ output.log(` ${chalk45.cyan(key + ":")} ${displayValue}`);
14872
15189
  }
14873
15190
  }
14874
15191
  output.log("");
@@ -14883,17 +15200,17 @@ async function showAgentComponentConfig(output, configService, options) {
14883
15200
  });
14884
15201
  return;
14885
15202
  }
14886
- output.log(chalk44.bold.cyan("# Agent Component Configuration"));
15203
+ output.log(chalk45.bold.cyan("# Agent Component Configuration"));
14887
15204
  output.log("");
14888
15205
  if (!options.sources) {
14889
- output.log(chalk44.bold("Configuration:"));
15206
+ output.log(chalk45.bold("Configuration:"));
14890
15207
  if (Object.keys(config).length === 0) {
14891
- output.log(` ${chalk44.gray("(无配置,使用默认值)")}`);
15208
+ output.log(` ${chalk45.gray("(无配置,使用默认值)")}`);
14892
15209
  } else {
14893
15210
  const flatConfig = flattenConfig(config);
14894
15211
  for (const [key, value] of flatConfig) {
14895
15212
  const displayValue = formatValue(value);
14896
- output.log(` ${chalk44.cyan(key + ":")} ${displayValue}`);
15213
+ output.log(` ${chalk45.cyan(key + ":")} ${displayValue}`);
14897
15214
  }
14898
15215
  }
14899
15216
  output.log("");
@@ -14907,10 +15224,10 @@ async function showAgentComponentConfig(output, configService, options) {
14907
15224
  const configDir = registry.getConfigDir();
14908
15225
  const exists = registry.configDirExists();
14909
15226
  const agentCount = registry.list().length;
14910
- output.log(chalk44.bold("Agent Config Directory:"));
14911
- output.log(` ${chalk44.cyan("path:")} ${configDir}`);
14912
- output.log(` ${chalk44.cyan("exists:")} ${exists ? chalk44.green("yes") : chalk44.red("no")}`);
14913
- output.log(` ${chalk44.cyan("agents:")} ${agentCount} loaded`);
15227
+ output.log(chalk45.bold("Agent Config Directory:"));
15228
+ output.log(` ${chalk45.cyan("path:")} ${configDir}`);
15229
+ output.log(` ${chalk45.cyan("exists:")} ${exists ? chalk45.green("yes") : chalk45.red("no")}`);
15230
+ output.log(` ${chalk45.cyan("agents:")} ${agentCount} loaded`);
14914
15231
  output.log("");
14915
15232
  }
14916
15233
  }
@@ -14926,41 +15243,41 @@ async function showPromptComponentConfig(output, configService, options, envServ
14926
15243
  });
14927
15244
  return;
14928
15245
  }
14929
- output.log(chalk44.bold.cyan("# Prompt Component Configuration"));
15246
+ output.log(chalk45.bold.cyan("# Prompt Component Configuration"));
14930
15247
  output.log("");
14931
15248
  if (filePath) {
14932
- output.log(chalk44.bold("File:"));
14933
- output.log(` ${chalk44.cyan(filePath)}`);
15249
+ output.log(chalk45.bold("File:"));
15250
+ output.log(` ${chalk45.cyan(filePath)}`);
14934
15251
  output.log("");
14935
15252
  }
14936
15253
  if (!options.sources) {
14937
- output.log(chalk44.bold("Configuration:"));
15254
+ output.log(chalk45.bold("Configuration:"));
14938
15255
  if (Object.keys(config).length === 0) {
14939
- output.log(` ${chalk44.gray("(无配置,使用默认值)")}`);
15256
+ output.log(` ${chalk45.gray("(无配置,使用默认值)")}`);
14940
15257
  } else {
14941
15258
  const flatConfig = flattenConfig(config);
14942
15259
  for (const [key, value] of flatConfig) {
14943
15260
  const displayValue = formatValue(value);
14944
- output.log(` ${chalk44.cyan(key + ":")} ${displayValue}`);
15261
+ output.log(` ${chalk45.cyan(key + ":")} ${displayValue}`);
14945
15262
  }
14946
15263
  }
14947
15264
  output.log("");
14948
15265
  }
14949
- output.log(chalk44.bold("Prompts:"));
14950
- output.log(` ${chalk44.gray("- 内置: 5 个(default, coding, review, project-memory, global-memory)")}`);
15266
+ output.log(chalk45.bold("Prompts:"));
15267
+ output.log(` ${chalk45.gray("- 内置: 5 个(default, coding, review, project-memory, global-memory)")}`);
14951
15268
  const promptPaths = config?.promptPaths;
14952
15269
  if (promptPaths && Array.isArray(promptPaths) && promptPaths.length > 0) {
14953
- output.log(` ${chalk44.gray("- 外部: " + promptPaths.length + " 个路径")}`);
15270
+ output.log(` ${chalk45.gray("- 外部: " + promptPaths.length + " 个路径")}`);
14954
15271
  for (const p of promptPaths) {
14955
- output.log(` ${chalk44.cyan(p.path)} ${chalk44.gray("(type: " + p.type + ")")}`);
15272
+ output.log(` ${chalk45.cyan(p.path)} ${chalk45.gray("(type: " + p.type + ")")}`);
14956
15273
  }
14957
15274
  } else {
14958
- output.log(` ${chalk44.gray("- 外部: 0 个(未配置 promptPaths)")}`);
15275
+ output.log(` ${chalk45.gray("- 外部: 0 个(未配置 promptPaths)")}`);
14959
15276
  }
14960
15277
  output.log("");
14961
15278
  const defaultName = config?.defaultName || "default";
14962
- output.log(chalk44.bold("Default Prompt:"));
14963
- output.log(` ${chalk44.cyan("defaultName:")} ${defaultName}`);
15279
+ output.log(chalk45.bold("Default Prompt:"));
15280
+ output.log(` ${chalk45.cyan("defaultName:")} ${defaultName}`);
14964
15281
  output.log("");
14965
15282
  const env = envService?.getEnvironment?.();
14966
15283
  if (env) {
@@ -14975,10 +15292,10 @@ async function showPromptComponentConfig(output, configService, options, envServ
14975
15292
  const stored = await store?.loadAll?.();
14976
15293
  promptCount = Array.isArray(stored) ? stored.length : 0;
14977
15294
  } catch {}
14978
- output.log(chalk44.bold("Prompt Storage Directory:"));
14979
- output.log(` ${chalk44.cyan("path:")} ${configDir}`);
14980
- output.log(` ${chalk44.cyan("exists:")} ${exists ? chalk44.green("yes") : chalk44.red("no")}`);
14981
- output.log(` ${chalk44.cyan("prompts:")} ${promptCount} loaded`);
15295
+ output.log(chalk45.bold("Prompt Storage Directory:"));
15296
+ output.log(` ${chalk45.cyan("path:")} ${configDir}`);
15297
+ output.log(` ${chalk45.cyan("exists:")} ${exists ? chalk45.green("yes") : chalk45.red("no")}`);
15298
+ output.log(` ${chalk45.cyan("prompts:")} ${promptCount} loaded`);
14982
15299
  output.log("");
14983
15300
  }
14984
15301
  }
@@ -15004,19 +15321,19 @@ function flattenConfig(obj, prefix = "") {
15004
15321
  }
15005
15322
  function formatValue(value) {
15006
15323
  if (value === undefined) {
15007
- return chalk44.gray("undefined");
15324
+ return chalk45.gray("undefined");
15008
15325
  }
15009
15326
  if (value === null) {
15010
- return chalk44.gray("null");
15327
+ return chalk45.gray("null");
15011
15328
  }
15012
15329
  if (typeof value === "object") {
15013
- return chalk44.gray(JSON.stringify(value));
15330
+ return chalk45.gray(JSON.stringify(value));
15014
15331
  }
15015
15332
  return String(value);
15016
15333
  }
15017
15334
 
15018
15335
  // src/commands/config/export.ts
15019
- import chalk45 from "chalk";
15336
+ import chalk46 from "chalk";
15020
15337
  var ConfigExportCommand = {
15021
15338
  command: "export <component>",
15022
15339
  describe: "导出组件配置到文件",
@@ -15061,7 +15378,7 @@ var ConfigExportCommand = {
15061
15378
  output.log("");
15062
15379
  output.log("Supported components:");
15063
15380
  for (const comp of SUPPORTED_COMPONENTS) {
15064
- output.log(` ${chalk45.cyan(comp)}`);
15381
+ output.log(` ${chalk46.cyan(comp)}`);
15065
15382
  }
15066
15383
  process.exit(1);
15067
15384
  }
@@ -15079,7 +15396,7 @@ var ConfigExportCommand = {
15079
15396
  };
15080
15397
 
15081
15398
  // src/commands/config/import.ts
15082
- import chalk46 from "chalk";
15399
+ import chalk47 from "chalk";
15083
15400
  var ConfigImportCommand = {
15084
15401
  command: "import <component>",
15085
15402
  describe: "从文件导入配置到组件的 file source",
@@ -15129,7 +15446,7 @@ var ConfigImportCommand = {
15129
15446
  output.log("");
15130
15447
  output.log("Supported components:");
15131
15448
  for (const comp of SUPPORTED_COMPONENTS) {
15132
- output.log(` ${chalk46.cyan(comp)}`);
15449
+ output.log(` ${chalk47.cyan(comp)}`);
15133
15450
  }
15134
15451
  process.exit(1);
15135
15452
  }
@@ -15144,7 +15461,7 @@ var ConfigImportCommand = {
15144
15461
  }
15145
15462
  if (result.merged && result.changes.length > 0 && args.verbose) {
15146
15463
  output.log("");
15147
- output.log(chalk46.bold("变更详情:"));
15464
+ output.log(chalk47.bold("变更详情:"));
15148
15465
  for (const change of result.changes) {
15149
15466
  output.log(` ${change.key}: ${JSON.stringify(change.oldValue)} → ${JSON.stringify(change.newValue)}`);
15150
15467
  }
@@ -15168,7 +15485,7 @@ var ConfigCommand = {
15168
15485
  };
15169
15486
 
15170
15487
  // src/commands/mcp/list.ts
15171
- import chalk47 from "chalk";
15488
+ import chalk48 from "chalk";
15172
15489
  var ListCommand6 = {
15173
15490
  command: "list",
15174
15491
  aliases: ["ls"],
@@ -15214,30 +15531,30 @@ var ListCommand6 = {
15214
15531
  servers.forEach((s) => output.log(s.name));
15215
15532
  } else {
15216
15533
  if (servers.length === 0) {
15217
- output.log(chalk47.yellow("No MCP servers configured"));
15534
+ output.log(chalk48.yellow("No MCP servers configured"));
15218
15535
  return;
15219
15536
  }
15220
15537
  const statusColor = (status) => {
15221
15538
  switch (status) {
15222
15539
  case "connected":
15223
- return chalk47.green;
15540
+ return chalk48.green;
15224
15541
  case "connecting":
15225
- return chalk47.yellow;
15542
+ return chalk48.yellow;
15226
15543
  case "error":
15227
- return chalk47.red;
15544
+ return chalk48.red;
15228
15545
  case "disconnected":
15229
- return chalk47.gray;
15546
+ return chalk48.gray;
15230
15547
  default:
15231
- return chalk47.white;
15548
+ return chalk48.white;
15232
15549
  }
15233
15550
  };
15234
15551
  const header = [
15235
- chalk47.bold("Name"),
15236
- chalk47.bold("Status"),
15237
- chalk47.bold("Tools")
15552
+ chalk48.bold("Name"),
15553
+ chalk48.bold("Status"),
15554
+ chalk48.bold("Tools")
15238
15555
  ].join(" | ");
15239
15556
  const rows = servers.map((s) => [
15240
- chalk47.cyan(s.name),
15557
+ chalk48.cyan(s.name),
15241
15558
  statusColor(s.status)(`[${s.status}]`),
15242
15559
  s.toolsCount !== undefined ? String(s.toolsCount) : "-"
15243
15560
  ].join(" | "));
@@ -15248,7 +15565,7 @@ var ListCommand6 = {
15248
15565
  ...rows.map((r) => `│${r}│`),
15249
15566
  "└" + "─".repeat(header.length + 2) + "┘",
15250
15567
  "",
15251
- chalk47.gray(`Total: ${servers.length} servers`)
15568
+ chalk48.gray(`Total: ${servers.length} servers`)
15252
15569
  ].join(`
15253
15570
  `));
15254
15571
  }
@@ -15262,7 +15579,7 @@ var ListCommand6 = {
15262
15579
  };
15263
15580
 
15264
15581
  // src/commands/mcp/tools.ts
15265
- import chalk48 from "chalk";
15582
+ import chalk49 from "chalk";
15266
15583
  var ToolsCommand = {
15267
15584
  command: "tools",
15268
15585
  aliases: ["t"],
@@ -15315,7 +15632,7 @@ var ToolsCommand = {
15315
15632
  tools.forEach((t) => output.log(t.name));
15316
15633
  } else {
15317
15634
  if (tools.length === 0) {
15318
- output.log(chalk48.yellow("No MCP tools available"));
15635
+ output.log(chalk49.yellow("No MCP tools available"));
15319
15636
  return;
15320
15637
  }
15321
15638
  const byServer = new Map;
@@ -15327,15 +15644,15 @@ var ToolsCommand = {
15327
15644
  byServer.get(serverName).push(tool);
15328
15645
  }
15329
15646
  for (const [serverName, serverTools] of byServer) {
15330
- output.log(chalk48.bold.cyan(`
15647
+ output.log(chalk49.bold.cyan(`
15331
15648
  [${serverName}] ${serverTools.length} tools`));
15332
15649
  for (const tool of serverTools) {
15333
15650
  const desc2 = tool.description.length > 80 ? tool.description.slice(0, 77) + "..." : tool.description;
15334
- output.log(` ${chalk48.green("+")} ${chalk48.white(tool.name)}`);
15335
- output.log(` ${chalk48.gray(desc2)}`);
15651
+ output.log(` ${chalk49.green("+")} ${chalk49.white(tool.name)}`);
15652
+ output.log(` ${chalk49.gray(desc2)}`);
15336
15653
  }
15337
15654
  }
15338
- output.log(chalk48.gray(`
15655
+ output.log(chalk49.gray(`
15339
15656
  Total: ${tools.length} tools across ${byServer.size} servers`));
15340
15657
  }
15341
15658
  } catch (error) {
@@ -15348,7 +15665,7 @@ Total: ${tools.length} tools across ${byServer.size} servers`));
15348
15665
  };
15349
15666
 
15350
15667
  // src/commands/mcp/reload.ts
15351
- import chalk49 from "chalk";
15668
+ import chalk50 from "chalk";
15352
15669
  var ReloadCommand2 = {
15353
15670
  command: "reload",
15354
15671
  aliases: ["r"],
@@ -15369,19 +15686,19 @@ var ReloadCommand2 = {
15369
15686
  output.error("McpComponent not available");
15370
15687
  process.exit(1);
15371
15688
  }
15372
- output.log(chalk49.cyan("Reloading MCP servers..."));
15689
+ output.log(chalk50.cyan("Reloading MCP servers..."));
15373
15690
  await mcpComponent.reload();
15374
15691
  const servers = mcpComponent.listServers();
15375
15692
  const connected = servers.filter((s) => s.status === "connected").length;
15376
15693
  const errors = servers.filter((s) => s.status === "error").length;
15377
- output.log(chalk49.green(`✓ Reloaded ${servers.length} servers`));
15694
+ output.log(chalk50.green(`✓ Reloaded ${servers.length} servers`));
15378
15695
  if (connected > 0) {
15379
- output.log(chalk49.green(` • ${connected} connected`));
15696
+ output.log(chalk50.green(` • ${connected} connected`));
15380
15697
  }
15381
15698
  if (errors > 0) {
15382
15699
  output.warn(` • ${errors} failed`);
15383
15700
  for (const server of servers.filter((s) => s.status === "error")) {
15384
- output.log(chalk49.gray(` - ${server.name}: ${server.error}`));
15701
+ output.log(chalk50.gray(` - ${server.name}: ${server.error}`));
15385
15702
  }
15386
15703
  }
15387
15704
  } catch (error) {
@@ -15402,7 +15719,7 @@ var McpCommand = {
15402
15719
  };
15403
15720
 
15404
15721
  // src/commands/tools/list.ts
15405
- import chalk50 from "chalk";
15722
+ import chalk51 from "chalk";
15406
15723
  var ListCommand7 = {
15407
15724
  command: "list",
15408
15725
  aliases: ["ls"],
@@ -15447,16 +15764,16 @@ var ListCommand7 = {
15447
15764
  tools.forEach((t) => output.log(t.name));
15448
15765
  } else {
15449
15766
  const header = [
15450
- chalk50.bold("Name"),
15451
- chalk50.bold("Description"),
15452
- chalk50.bold("Category")
15767
+ chalk51.bold("Name"),
15768
+ chalk51.bold("Description"),
15769
+ chalk51.bold("Category")
15453
15770
  ].join(" | ");
15454
15771
  const rows = tools.map((t) => {
15455
15772
  const desc2 = t.description.length > 40 ? t.description.slice(0, 37) + "..." : t.description;
15456
15773
  return [
15457
- chalk50.cyan(t.name),
15774
+ chalk51.cyan(t.name),
15458
15775
  desc2,
15459
- t.metadata?.category ? chalk50.gray(`[${t.metadata.category}]`) : "-"
15776
+ t.metadata?.category ? chalk51.gray(`[${t.metadata.category}]`) : "-"
15460
15777
  ].join(" | ");
15461
15778
  });
15462
15779
  output.log([
@@ -15466,7 +15783,7 @@ var ListCommand7 = {
15466
15783
  ...rows.map((r) => `│${r}│`),
15467
15784
  "└" + "─".repeat(header.length + 2) + "┘",
15468
15785
  "",
15469
- chalk50.gray(`Total: ${tools.length} tools`)
15786
+ chalk51.gray(`Total: ${tools.length} tools`)
15470
15787
  ].join(`
15471
15788
  `));
15472
15789
  }
@@ -15480,7 +15797,7 @@ var ListCommand7 = {
15480
15797
  };
15481
15798
 
15482
15799
  // src/commands/tools/get.ts
15483
- import chalk51 from "chalk";
15800
+ import chalk52 from "chalk";
15484
15801
 
15485
15802
  // src/commands/tools/shared/schema-helper.ts
15486
15803
  import { zodToJsonSchema } from "zod-to-json-schema";
@@ -15555,8 +15872,8 @@ var GetCommand6 = {
15555
15872
  }))
15556
15873
  });
15557
15874
  } else {
15558
- output.log(chalk51.bold.cyan(`Tool: ${tool.name}`));
15559
- output.log(chalk51.gray("─".repeat(60)));
15875
+ output.log(chalk52.bold.cyan(`Tool: ${tool.name}`));
15876
+ output.log(chalk52.gray("─".repeat(60)));
15560
15877
  output.log(`Description: ${tool.description}`);
15561
15878
  if (tool.metadata?.category) {
15562
15879
  output.log(`Category: ${tool.metadata.category}`);
@@ -15565,9 +15882,9 @@ var GetCommand6 = {
15565
15882
  output.log(`Tags: ${tool.metadata.tags.join(", ")}`);
15566
15883
  }
15567
15884
  output.log("");
15568
- output.log(chalk51.bold("Parameters:"));
15885
+ output.log(chalk52.bold("Parameters:"));
15569
15886
  for (const param of params) {
15570
- const required = param.required ? chalk51.red("(required)") : chalk51.gray("(optional)");
15887
+ const required = param.required ? chalk52.red("(required)") : chalk52.gray("(optional)");
15571
15888
  const defaultVal = param.default !== undefined ? ` [default: ${JSON.stringify(param.default)}]` : "";
15572
15889
  output.log(` --${param.name} <${param.type}> ${required}`);
15573
15890
  output.log(` ${param.description}${defaultVal}`);
@@ -15676,14 +15993,14 @@ var ToolsCommand2 = {
15676
15993
  };
15677
15994
 
15678
15995
  // src/commands/memory/record.ts
15679
- import chalk52 from "chalk";
15996
+ import chalk53 from "chalk";
15680
15997
  import { createMemoryAgentTools, getBuiltInPrompt } from "@ai-setting/roy-agent-core";
15681
15998
  import { bashTool, globTool, readFileTool } from "@ai-setting/roy-agent-core";
15682
15999
  async function runExtractMode(output, memoryComponent, agentComponent, sessionComponent, env, options) {
15683
16000
  const { scope, sessionId, require: userRequirement } = options;
15684
- output.log(chalk52.blue(`
16001
+ output.log(chalk53.blue(`
15685
16002
  \uD83D\uDD0D Memory Extract Mode (${scope})`));
15686
- output.log(chalk52.gray(`正在分析会话历史,生成记忆...
16003
+ output.log(chalk53.gray(`正在分析会话历史,生成记忆...
15687
16004
  `));
15688
16005
  try {
15689
16006
  const currentMemory = await memoryComponent.recallMemory(scope) || "(无现有记忆)";
@@ -15729,13 +16046,13 @@ async function runExtractMode(output, memoryComponent, agentComponent, sessionCo
15729
16046
  for (const tool of agentTools) {
15730
16047
  try {
15731
16048
  toolComponent.register(tool);
15732
- output.log(chalk52.gray(`Tool registered: ${tool.name}`));
16049
+ output.log(chalk53.gray(`Tool registered: ${tool.name}`));
15733
16050
  } catch (err) {
15734
- output.log(chalk52.gray(`Tool already registered: ${tool.name}`));
16051
+ output.log(chalk53.gray(`Tool already registered: ${tool.name}`));
15735
16052
  }
15736
16053
  }
15737
16054
  }
15738
- output.log(chalk52.gray(`Agent "${agentName}" registered with ${agentTools.length} tools`));
16055
+ output.log(chalk53.gray(`Agent "${agentName}" registered with ${agentTools.length} tools`));
15739
16056
  const query = `请分析会话历史,提炼${scope === "project" ? "项目" : "全局"}记忆并写入记忆文件。`;
15740
16057
  let result;
15741
16058
  try {
@@ -15749,12 +16066,12 @@ async function runExtractMode(output, memoryComponent, agentComponent, sessionCo
15749
16066
  if (result && result.startsWith("执行失败")) {
15750
16067
  output.error(`提取失败: ${result}`);
15751
16068
  } else if (result) {
15752
- output.log(chalk52.green(`
16069
+ output.log(chalk53.green(`
15753
16070
  ✅ 记忆提取完成`));
15754
- output.log(chalk52.gray(`记忆已保存到 memory 文件。
16071
+ output.log(chalk53.gray(`记忆已保存到 memory 文件。
15755
16072
  `));
15756
16073
  if (result.length > 0 && result !== "✅ 记忆提取完成") {
15757
- output.log(chalk52.gray(`执行摘要: ${result.substring(0, 200)}${result.length > 200 ? "..." : ""}`));
16074
+ output.log(chalk53.gray(`执行摘要: ${result.substring(0, 200)}${result.length > 200 ? "..." : ""}`));
15758
16075
  }
15759
16076
  }
15760
16077
  agentComponent.unregisterAgent(agentName);
@@ -15872,11 +16189,11 @@ var RecordCommand = {
15872
16189
  prepend: "已插入内容到记忆文件开头",
15873
16190
  delete: "已删除记忆文件"
15874
16191
  };
15875
- output.log(chalk52.green(`✓ ${actionMessages[result.action]}`));
15876
- output.log(chalk52.gray(`路径: ${result.path}`));
16192
+ output.log(chalk53.green(`✓ ${actionMessages[result.action]}`));
16193
+ output.log(chalk53.gray(`路径: ${result.path}`));
15877
16194
  if (result.action !== "delete" && a.content) {
15878
16195
  const preview = a.content.substring(0, 100);
15879
- output.log(chalk52.gray(`内容预览: ${preview}${a.content.length > 100 ? "..." : ""}`));
16196
+ output.log(chalk53.gray(`内容预览: ${preview}${a.content.length > 100 ? "..." : ""}`));
15880
16197
  }
15881
16198
  } catch (error) {
15882
16199
  output.error(`Failed to record memory: ${error}`);
@@ -15888,7 +16205,7 @@ var RecordCommand = {
15888
16205
  };
15889
16206
 
15890
16207
  // src/commands/memory/recall.ts
15891
- import chalk53 from "chalk";
16208
+ import chalk54 from "chalk";
15892
16209
  var RecallCommand = {
15893
16210
  command: "recall",
15894
16211
  aliases: ["load"],
@@ -15924,7 +16241,7 @@ var RecallCommand = {
15924
16241
  }
15925
16242
  const content = await memoryComponent.recallMemory(a.scope);
15926
16243
  if (!content) {
15927
- output.log(chalk53.gray("(No memory files found)"));
16244
+ output.log(chalk54.gray("(No memory files found)"));
15928
16245
  return;
15929
16246
  }
15930
16247
  if (a.json) {
@@ -15950,7 +16267,7 @@ var MemoryCommand = {
15950
16267
  handler: () => {}
15951
16268
  };
15952
16269
  // src/commands/eventsource/list.ts
15953
- import chalk54 from "chalk";
16270
+ import chalk55 from "chalk";
15954
16271
  function truncateVisual2(str, maxWidth) {
15955
16272
  let result = "";
15956
16273
  let width = 0;
@@ -15965,7 +16282,7 @@ function truncateVisual2(str, maxWidth) {
15965
16282
  }
15966
16283
  function formatSourcesTable(sources) {
15967
16284
  if (sources.length === 0) {
15968
- return chalk54.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加");
16285
+ return chalk55.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加");
15969
16286
  }
15970
16287
  const ID_WIDTH = 10;
15971
16288
  const NAME_WIDTH = 20;
@@ -15974,11 +16291,11 @@ function formatSourcesTable(sources) {
15974
16291
  const ENABLED_WIDTH = 8;
15975
16292
  const GAP = " ";
15976
16293
  const headerLine = [
15977
- chalk54.bold("ID".padEnd(ID_WIDTH)),
15978
- chalk54.bold("NAME".padEnd(NAME_WIDTH)),
15979
- chalk54.bold("TYPE".padEnd(TYPE_WIDTH)),
15980
- chalk54.bold("STATUS".padEnd(STATUS_WIDTH)),
15981
- chalk54.bold("ENABLED".padEnd(ENABLED_WIDTH))
16294
+ chalk55.bold("ID".padEnd(ID_WIDTH)),
16295
+ chalk55.bold("NAME".padEnd(NAME_WIDTH)),
16296
+ chalk55.bold("TYPE".padEnd(TYPE_WIDTH)),
16297
+ chalk55.bold("STATUS".padEnd(STATUS_WIDTH)),
16298
+ chalk55.bold("ENABLED".padEnd(ENABLED_WIDTH))
15982
16299
  ].join(GAP);
15983
16300
  const sepLine = "─".repeat(ID_WIDTH + NAME_WIDTH + TYPE_WIDTH + STATUS_WIDTH + ENABLED_WIDTH + GAP.length * 4);
15984
16301
  const formatRow = (src) => {
@@ -16031,7 +16348,7 @@ var EventSourceListCommand = {
16031
16348
  if (args.json) {
16032
16349
  output.json({ sources: [], count: 0 });
16033
16350
  } else {
16034
- output.log(chalk54.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加"));
16351
+ output.log(chalk55.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加"));
16035
16352
  }
16036
16353
  return;
16037
16354
  }
@@ -16046,26 +16363,26 @@ var EventSourceListCommand = {
16046
16363
  const rows = sources.map((s) => {
16047
16364
  const status = esComponent.getStatus(s.id) || "unknown";
16048
16365
  const statusColorMap = {
16049
- running: chalk54.green,
16050
- stopped: chalk54.gray,
16051
- error: chalk54.red,
16052
- starting: chalk54.yellow,
16053
- created: chalk54.gray,
16054
- stopping: chalk54.yellow,
16055
- unknown: chalk54.gray
16366
+ running: chalk55.green,
16367
+ stopped: chalk55.gray,
16368
+ error: chalk55.red,
16369
+ starting: chalk55.yellow,
16370
+ created: chalk55.gray,
16371
+ stopping: chalk55.yellow,
16372
+ unknown: chalk55.gray
16056
16373
  };
16057
- const statusColor = statusColorMap[status] || chalk54.gray;
16374
+ const statusColor = statusColorMap[status] || chalk55.gray;
16058
16375
  return {
16059
16376
  id: s.id.substring(0, 8),
16060
16377
  name: s.name,
16061
16378
  type: s.type,
16062
16379
  status: statusColor(status),
16063
- enabled: s.enabled ? chalk54.green("✓") : chalk54.gray("✗")
16380
+ enabled: s.enabled ? chalk55.green("✓") : chalk55.gray("✗")
16064
16381
  };
16065
16382
  });
16066
16383
  output.log(formatSourcesTable(rows));
16067
16384
  output.info("");
16068
- output.log(chalk54.green(`✅ 共 ${sources.length} 个事件源`));
16385
+ output.log(chalk55.green(`✅ 共 ${sources.length} 个事件源`));
16069
16386
  } catch (error) {
16070
16387
  output.error(`Failed to list event sources: ${error}`);
16071
16388
  process.exit(1);
@@ -16076,7 +16393,7 @@ var EventSourceListCommand = {
16076
16393
  };
16077
16394
 
16078
16395
  // src/commands/eventsource/add.ts
16079
- import chalk55 from "chalk";
16396
+ import chalk56 from "chalk";
16080
16397
  import { generateId } from "@ai-setting/roy-agent-core";
16081
16398
  function uuid() {
16082
16399
  return generateId();
@@ -16111,6 +16428,19 @@ var EventSourceAddCommand = {
16111
16428
  }).option("cron", {
16112
16429
  describe: "Cron 表达式",
16113
16430
  type: "string"
16431
+ }).option("profile", {
16432
+ describe: "lark-cli profile(lark-cli 类型用,多 appId 场景必要,参考 #1637)",
16433
+ type: "string"
16434
+ }).option("address", {
16435
+ describe: "Agent IM 地址(bounty-im 类型用,格式:agent-id@host)",
16436
+ type: "string"
16437
+ }).option("im-server-url", {
16438
+ describe: "IM Server WebSocket URL(bounty-im 类型用,如 ws://localhost:4005/ws)",
16439
+ type: "string"
16440
+ }).option("tls-skip-verify", {
16441
+ describe: "跳过 TLS 证书校验(bounty-im 类型用,wss:// 自签名场景,生产环境不推荐)",
16442
+ type: "boolean",
16443
+ default: false
16114
16444
  }).option("prompt", {
16115
16445
  describe: "自定义 prompt 消息(timer 类型,替换默认 SelfReminder 内容)",
16116
16446
  type: "string"
@@ -16142,27 +16472,43 @@ var EventSourceAddCommand = {
16142
16472
  url: a.url,
16143
16473
  interval: a.interval,
16144
16474
  cron: a.cron,
16475
+ profile: a.profile,
16476
+ address: a.address,
16477
+ imServerUrl: a.imServerUrl,
16478
+ tlsSkipVerify: a.tlsSkipVerify === true,
16145
16479
  options: a.prompt ? { prompt: a.prompt } : undefined
16146
16480
  };
16147
16481
  esComponent.register(config);
16148
- output.success(chalk55.green(`事件源 '${a.name}' 添加成功!`));
16482
+ output.success(chalk56.green(`事件源 '${a.name}' 添加成功!`));
16149
16483
  output.log("");
16150
- output.log(` ID: ${chalk55.gray(config.id)}`);
16151
- output.log(` Type: ${chalk55.cyan(a.type)}`);
16484
+ output.log(` ID: ${chalk56.gray(config.id)}`);
16485
+ output.log(` Type: ${chalk56.cyan(a.type)}`);
16152
16486
  if (eventTypes?.length) {
16153
- output.log(` Event Types: ${chalk55.gray(eventTypes.join(", "))}`);
16487
+ output.log(` Event Types: ${chalk56.gray(eventTypes.join(", "))}`);
16154
16488
  }
16155
16489
  if (a.command) {
16156
- output.log(` Command: ${chalk55.gray(a.command)}`);
16490
+ output.log(` Command: ${chalk56.gray(a.command)}`);
16157
16491
  }
16158
16492
  if (a.interval) {
16159
- output.log(` Interval: ${chalk55.gray(`${a.interval}ms`)}`);
16493
+ output.log(` Interval: ${chalk56.gray(`${a.interval}ms`)}`);
16494
+ }
16495
+ if (a.profile) {
16496
+ output.log(` Profile: ${chalk56.gray(a.profile)}`);
16497
+ }
16498
+ if (a.address) {
16499
+ output.log(` Address: ${chalk56.gray(a.address)}`);
16500
+ }
16501
+ if (a.imServerUrl) {
16502
+ output.log(` IM Server URL: ${chalk56.gray(a.imServerUrl)}`);
16503
+ }
16504
+ if (a.tlsSkipVerify) {
16505
+ output.log(` TLS Skip Verify: ${chalk56.yellow("⚠ true (自签名场景)")}`);
16160
16506
  }
16161
16507
  if (a.prompt) {
16162
- output.log(` Prompt: ${chalk55.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
16508
+ output.log(` Prompt: ${chalk56.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
16163
16509
  }
16164
16510
  output.log("");
16165
- output.log(chalk55.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
16511
+ output.log(chalk56.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
16166
16512
  } finally {
16167
16513
  await envService.dispose();
16168
16514
  }
@@ -16170,7 +16516,7 @@ var EventSourceAddCommand = {
16170
16516
  };
16171
16517
 
16172
16518
  // src/commands/eventsource/update.ts
16173
- import chalk56 from "chalk";
16519
+ import chalk57 from "chalk";
16174
16520
  function findSource(esComponent, id) {
16175
16521
  const sources = esComponent.list();
16176
16522
  const matched = sources.find((s) => s.id === id || s.id.startsWith(id));
@@ -16213,6 +16559,15 @@ var EventSourceUpdateCommand = {
16213
16559
  }).option("enabled", {
16214
16560
  describe: "是否启用",
16215
16561
  type: "boolean"
16562
+ }).option("address", {
16563
+ describe: "Agent IM 地址(bounty-im 类型用,格式:agent-id@host)",
16564
+ type: "string"
16565
+ }).option("im-server-url", {
16566
+ describe: "IM Server WebSocket URL(bounty-im 类型用,如 ws://localhost:4005/ws)",
16567
+ type: "string"
16568
+ }).option("tls-skip-verify", {
16569
+ describe: "跳过 TLS 证书校验(bounty-im 类型用,wss:// 自签名场景,生产环境不推荐)",
16570
+ type: "boolean"
16216
16571
  }),
16217
16572
  async handler(args) {
16218
16573
  const a = args;
@@ -16236,7 +16591,7 @@ var EventSourceUpdateCommand = {
16236
16591
  const all = esComponent.list();
16237
16592
  if (all.length > 0) {
16238
16593
  output.info("");
16239
- output.info(chalk56.gray("可用的事件源:"));
16594
+ output.info(chalk57.gray("可用的事件源:"));
16240
16595
  for (const s of all) {
16241
16596
  output.info(` - ${s.id.substring(0, 8)}: ${s.name} (${s.type})`);
16242
16597
  }
@@ -16259,6 +16614,12 @@ var EventSourceUpdateCommand = {
16259
16614
  partial.cron = a.cron;
16260
16615
  if (a.enabled !== undefined)
16261
16616
  partial.enabled = a.enabled;
16617
+ if (a.address !== undefined)
16618
+ partial.address = a.address;
16619
+ if (a.imServerUrl !== undefined)
16620
+ partial.imServerUrl = a.imServerUrl;
16621
+ if (a.tlsSkipVerify !== undefined)
16622
+ partial.tlsSkipVerify = a.tlsSkipVerify === true;
16262
16623
  if (a.prompt !== undefined) {
16263
16624
  const existingOptions = match.source.options ?? {};
16264
16625
  partial.options = { ...existingOptions, prompt: a.prompt };
@@ -16269,19 +16630,19 @@ var EventSourceUpdateCommand = {
16269
16630
  }
16270
16631
  try {
16271
16632
  const result = await esComponent.update(match.fullId, partial);
16272
- output.success(chalk56.green(`✅ 事件源已更新: ${match.source.name}`));
16633
+ output.success(chalk57.green(`✅ 事件源已更新: ${match.source.name}`));
16273
16634
  output.log("");
16274
- output.log(chalk56.bold("修改字段:"));
16635
+ output.log(chalk57.bold("修改字段:"));
16275
16636
  const before = match.source;
16276
16637
  const after = result.updated;
16277
16638
  for (const field of result.fields) {
16278
16639
  const beforeVal = JSON.stringify(before[field] ?? before.options?.[field]);
16279
16640
  const afterVal = JSON.stringify(after[field] ?? after.options?.[field]);
16280
- output.log(` ${chalk56.cyan(field)}: ${chalk56.gray(beforeVal)} ${chalk56.gray("→")} ${chalk56.green(afterVal)}`);
16641
+ output.log(` ${chalk57.cyan(field)}: ${chalk57.gray(beforeVal)} ${chalk57.gray("→")} ${chalk57.green(afterVal)}`);
16281
16642
  }
16282
16643
  output.log("");
16283
16644
  if (result.wasRunning) {
16284
- output.info(chalk56.yellow(`⚠️ 事件源在更新前正在运行,已自动停止。请使用 'roy-agent eventsource start ${match.fullId.substring(0, 8)}' 手动启动以应用新配置。`));
16645
+ output.info(chalk57.yellow(`⚠️ 事件源在更新前正在运行,已自动停止。请使用 'roy-agent eventsource start ${match.fullId.substring(0, 8)}' 手动启动以应用新配置。`));
16285
16646
  }
16286
16647
  } catch (error) {
16287
16648
  output.error(`❌ 更新失败: ${error instanceof Error ? error.message : String(error)}`);
@@ -16294,7 +16655,7 @@ var EventSourceUpdateCommand = {
16294
16655
  };
16295
16656
 
16296
16657
  // src/commands/eventsource/remove.ts
16297
- import chalk57 from "chalk";
16658
+ import chalk58 from "chalk";
16298
16659
  var EventSourceRemoveCommand = {
16299
16660
  command: "remove <id>",
16300
16661
  aliases: ["rm"],
@@ -16333,7 +16694,7 @@ var EventSourceRemoveCommand = {
16333
16694
  const status = esComponent.getStatus(matchedSource.id);
16334
16695
  if (status === "running" && !args.force) {
16335
16696
  output.error(`事件源正在运行中,请先停止: ${matchedSource.name} (${status})`);
16336
- output.log(chalk57.gray(`使用 --force 强制移除或 'roy-agent eventsource stop ${matchedSource.id.substring(0, 8)}' 先停止`));
16697
+ output.log(chalk58.gray(`使用 --force 强制移除或 'roy-agent eventsource stop ${matchedSource.id.substring(0, 8)}' 先停止`));
16337
16698
  process.exit(1);
16338
16699
  }
16339
16700
  if (status === "running") {
@@ -16342,7 +16703,7 @@ var EventSourceRemoveCommand = {
16342
16703
  }
16343
16704
  const result = esComponent.unregister(matchedSource.id);
16344
16705
  if (result) {
16345
- output.success(chalk57.green(`事件源已移除: ${matchedSource.name}`));
16706
+ output.success(chalk58.green(`事件源已移除: ${matchedSource.name}`));
16346
16707
  } else {
16347
16708
  output.error("移除失败");
16348
16709
  process.exit(1);
@@ -16354,7 +16715,7 @@ var EventSourceRemoveCommand = {
16354
16715
  };
16355
16716
 
16356
16717
  // src/commands/eventsource/start.ts
16357
- import chalk58 from "chalk";
16718
+ import chalk59 from "chalk";
16358
16719
  var EventSourceStartCommand = {
16359
16720
  command: "start <id>",
16360
16721
  describe: "启动指定的事件源",
@@ -16391,15 +16752,15 @@ var EventSourceStartCommand = {
16391
16752
  }
16392
16753
  const status = esComponent.getStatus(matchedSource.id);
16393
16754
  if (status === "running") {
16394
- output.log(chalk58.yellow(`事件源已在运行: ${matchedSource.name}`));
16755
+ output.log(chalk59.yellow(`事件源已在运行: ${matchedSource.name}`));
16395
16756
  return;
16396
16757
  }
16397
16758
  output.info(`正在启动事件源 '${matchedSource.name}'...`);
16398
16759
  try {
16399
16760
  await esComponent.startSource(matchedSource.id);
16400
- output.success(chalk58.green(`事件源已启动: ${matchedSource.name}`));
16761
+ output.success(chalk59.green(`事件源已启动: ${matchedSource.name}`));
16401
16762
  if (!args.background) {
16402
- output.log(chalk58.gray("按 Ctrl+C 停止..."));
16763
+ output.log(chalk59.gray("按 Ctrl+C 停止..."));
16403
16764
  await new Promise((resolve) => {
16404
16765
  const cleanup = () => {
16405
16766
  process.removeListener("SIGINT", cleanup);
@@ -16421,7 +16782,7 @@ var EventSourceStartCommand = {
16421
16782
  };
16422
16783
 
16423
16784
  // src/commands/eventsource/stop.ts
16424
- import chalk59 from "chalk";
16785
+ import chalk60 from "chalk";
16425
16786
  var EventSourceStopCommand = {
16426
16787
  command: "stop <id>",
16427
16788
  aliases: ["kill"],
@@ -16459,13 +16820,13 @@ var EventSourceStopCommand = {
16459
16820
  }
16460
16821
  const status = esComponent.getStatus(matchedSource.id);
16461
16822
  if (status !== "running") {
16462
- output.log(chalk59.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
16823
+ output.log(chalk60.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
16463
16824
  return;
16464
16825
  }
16465
16826
  output.info(`正在停止事件源 '${matchedSource.name}'...`);
16466
16827
  try {
16467
16828
  await esComponent.stopSource(matchedSource.id);
16468
- output.success(chalk59.green(`事件源已停止: ${matchedSource.name}`));
16829
+ output.success(chalk60.green(`事件源已停止: ${matchedSource.name}`));
16469
16830
  } catch (error) {
16470
16831
  output.error(`停止失败: ${error}`);
16471
16832
  process.exit(1);
@@ -16477,14 +16838,14 @@ var EventSourceStopCommand = {
16477
16838
  };
16478
16839
 
16479
16840
  // src/commands/eventsource/status.ts
16480
- import chalk60 from "chalk";
16841
+ import chalk61 from "chalk";
16481
16842
  var STATUS_COLORS = {
16482
- created: chalk60.gray,
16483
- starting: chalk60.yellow,
16484
- running: chalk60.green,
16485
- stopping: chalk60.yellow,
16486
- stopped: chalk60.gray,
16487
- error: chalk60.red
16843
+ created: chalk61.gray,
16844
+ starting: chalk61.yellow,
16845
+ running: chalk61.green,
16846
+ stopping: chalk61.yellow,
16847
+ stopped: chalk61.gray,
16848
+ error: chalk61.red
16488
16849
  };
16489
16850
  var STATUS_ICONS = {
16490
16851
  created: "○",
@@ -16538,7 +16899,7 @@ var EventSourceStatusCommand = {
16538
16899
  process.exit(1);
16539
16900
  }
16540
16901
  const status = esComponent.getStatus(matchedSource.id) || "unknown";
16541
- const statusColor = STATUS_COLORS[status] || chalk60.gray;
16902
+ const statusColor = STATUS_COLORS[status] || chalk61.gray;
16542
16903
  if (args.json) {
16543
16904
  output.json({
16544
16905
  id: matchedSource.id,
@@ -16555,31 +16916,31 @@ var EventSourceStatusCommand = {
16555
16916
  });
16556
16917
  return;
16557
16918
  }
16558
- output.log(chalk60.bold("事件源详情"));
16919
+ output.log(chalk61.bold("事件源详情"));
16559
16920
  output.log("─".repeat(50));
16560
- output.log(` ID: ${chalk60.gray(matchedSource.id)}`);
16561
- output.log(` Name: ${chalk60.cyan(matchedSource.name)}`);
16562
- output.log(` Type: ${chalk60.cyan(matchedSource.type)}`);
16921
+ output.log(` ID: ${chalk61.gray(matchedSource.id)}`);
16922
+ output.log(` Name: ${chalk61.cyan(matchedSource.name)}`);
16923
+ output.log(` Type: ${chalk61.cyan(matchedSource.type)}`);
16563
16924
  output.log(` Status: ${statusColor(`${STATUS_ICONS[status]} ${STATUS_LABELS[status]}`)}`);
16564
- output.log(` Enabled: ${matchedSource.enabled ? chalk60.green("是") : chalk60.gray("否")}`);
16925
+ output.log(` Enabled: ${matchedSource.enabled ? chalk61.green("是") : chalk61.gray("否")}`);
16565
16926
  if (matchedSource.eventTypes?.length) {
16566
- output.log(` Events: ${chalk60.gray(matchedSource.eventTypes.join(", "))}`);
16927
+ output.log(` Events: ${chalk61.gray(matchedSource.eventTypes.join(", "))}`);
16567
16928
  }
16568
16929
  if (matchedSource.command) {
16569
- output.log(` Command: ${chalk60.gray(matchedSource.command)}`);
16930
+ output.log(` Command: ${chalk61.gray(matchedSource.command)}`);
16570
16931
  }
16571
16932
  if (matchedSource.interval) {
16572
- output.log(` Interval: ${chalk60.gray(`${matchedSource.interval}ms`)}`);
16933
+ output.log(` Interval: ${chalk61.gray(`${matchedSource.interval}ms`)}`);
16573
16934
  }
16574
16935
  if (matchedSource.url) {
16575
- output.log(` URL: ${chalk60.gray(matchedSource.url)}`);
16936
+ output.log(` URL: ${chalk61.gray(matchedSource.url)}`);
16576
16937
  }
16577
16938
  output.log("");
16578
16939
  return;
16579
16940
  }
16580
16941
  const sources = esComponent.list();
16581
16942
  if (sources.length === 0) {
16582
- output.log(chalk60.yellow("没有配置的事件源"));
16943
+ output.log(chalk61.yellow("没有配置的事件源"));
16583
16944
  return;
16584
16945
  }
16585
16946
  if (args.json) {
@@ -16593,21 +16954,21 @@ var EventSourceStatusCommand = {
16593
16954
  output.json({ sources: sourcesWithStatus, count: sources.length });
16594
16955
  return;
16595
16956
  }
16596
- output.log(chalk60.bold("事件源状态概览"));
16957
+ output.log(chalk61.bold("事件源状态概览"));
16597
16958
  output.log("─".repeat(60));
16598
16959
  for (const source of sources) {
16599
16960
  const status = esComponent.getStatus(source.id) || "unknown";
16600
- const statusColor = STATUS_COLORS[status] || chalk60.gray;
16961
+ const statusColor = STATUS_COLORS[status] || chalk61.gray;
16601
16962
  const icon = STATUS_ICONS[status] || "?";
16602
16963
  const label = STATUS_LABELS[status] || status;
16603
16964
  output.log("");
16604
- output.log(` ${chalk60.cyan(source.name)} ${chalk60.gray(`(${source.type})`)}`);
16965
+ output.log(` ${chalk61.cyan(source.name)} ${chalk61.gray(`(${source.type})`)}`);
16605
16966
  output.log(` └─ Status: ${statusColor(`${icon} ${label}`)}`);
16606
- output.log(` ID: ${chalk60.gray(source.id.substring(0, 8))}...`);
16967
+ output.log(` ID: ${chalk61.gray(source.id.substring(0, 8))}...`);
16607
16968
  }
16608
16969
  output.log("");
16609
16970
  const runningCount = sources.filter((s) => esComponent.getStatus(s.id) === "running").length;
16610
- output.log(chalk60.green(`✅ ${runningCount}/${sources.length} 运行中`));
16971
+ output.log(chalk61.green(`✅ ${runningCount}/${sources.length} 运行中`));
16611
16972
  } finally {
16612
16973
  await envService.dispose();
16613
16974
  }
@@ -16920,7 +17281,7 @@ var DebugCommand = {
16920
17281
  };
16921
17282
 
16922
17283
  // src/commands/workflow/renderers.ts
16923
- import chalk61 from "chalk";
17284
+ import chalk62 from "chalk";
16924
17285
  function truncateVisual3(str, maxWidth) {
16925
17286
  if (!str)
16926
17287
  return "-";
@@ -16955,18 +17316,18 @@ function formatDuration(ms) {
16955
17316
  function statusColor(status) {
16956
17317
  switch (status) {
16957
17318
  case "completed":
16958
- return chalk61.green;
17319
+ return chalk62.green;
16959
17320
  case "running":
16960
17321
  case "idle":
16961
- return chalk61.blue;
17322
+ return chalk62.blue;
16962
17323
  case "paused":
16963
- return chalk61.yellow;
17324
+ return chalk62.yellow;
16964
17325
  case "failed":
16965
- return chalk61.red;
17326
+ return chalk62.red;
16966
17327
  case "stopped":
16967
- return chalk61.gray;
17328
+ return chalk62.gray;
16968
17329
  default:
16969
- return chalk61.white;
17330
+ return chalk62.white;
16970
17331
  }
16971
17332
  }
16972
17333
  function renderWorkflowList(workflows, options) {
@@ -16985,7 +17346,7 @@ function renderWorkflowList(workflows, options) {
16985
17346
  }, null, 2);
16986
17347
  }
16987
17348
  if (workflows.length === 0) {
16988
- return chalk61.yellow("No workflows found");
17349
+ return chalk62.yellow("No workflows found");
16989
17350
  }
16990
17351
  const NAME_WIDTH = 30;
16991
17352
  const VERSION_WIDTH = 10;
@@ -16993,10 +17354,10 @@ function renderWorkflowList(workflows, options) {
16993
17354
  const UPDATED_WIDTH = 20;
16994
17355
  const GAP = " ";
16995
17356
  const headerLine = [
16996
- chalk61.bold("NAME".padEnd(NAME_WIDTH)),
16997
- chalk61.bold("VER".padEnd(VERSION_WIDTH)),
16998
- chalk61.bold("TAGS".padEnd(TAGS_WIDTH)),
16999
- chalk61.bold("UPDATED")
17357
+ chalk62.bold("NAME".padEnd(NAME_WIDTH)),
17358
+ chalk62.bold("VER".padEnd(VERSION_WIDTH)),
17359
+ chalk62.bold("TAGS".padEnd(TAGS_WIDTH)),
17360
+ chalk62.bold("UPDATED")
17000
17361
  ].join(GAP);
17001
17362
  const sepLine = "─".repeat(NAME_WIDTH + VERSION_WIDTH + TAGS_WIDTH + UPDATED_WIDTH + GAP.length * 3);
17002
17363
  const rows = workflows.map((w) => {
@@ -17011,18 +17372,18 @@ function renderWorkflowList(workflows, options) {
17011
17372
  }
17012
17373
  function renderWorkflowDetail(workflow, options) {
17013
17374
  const lines = [];
17014
- lines.push(chalk61.bold(`
17375
+ lines.push(chalk62.bold(`
17015
17376
  \uD83D\uDCCB Workflow Details
17016
17377
  `));
17017
- lines.push(` ${chalk61.cyan("ID:")} ${workflow.id}`);
17018
- lines.push(` ${chalk61.cyan("Name:")} ${workflow.name}`);
17019
- lines.push(` ${chalk61.cyan("Version:")} ${workflow.version}`);
17020
- lines.push(` ${chalk61.cyan("Description:")} ${workflow.description || "-"}`);
17021
- lines.push(` ${chalk61.cyan("Tags:")} ${workflow.tags.join(", ") || "-"}`);
17022
- lines.push(` ${chalk61.cyan("Created:")} ${formatDate(workflow.createdAt)}`);
17023
- lines.push(` ${chalk61.cyan("Updated:")} ${formatDate(workflow.updatedAt)}`);
17378
+ lines.push(` ${chalk62.cyan("ID:")} ${workflow.id}`);
17379
+ lines.push(` ${chalk62.cyan("Name:")} ${workflow.name}`);
17380
+ lines.push(` ${chalk62.cyan("Version:")} ${workflow.version}`);
17381
+ lines.push(` ${chalk62.cyan("Description:")} ${workflow.description || "-"}`);
17382
+ lines.push(` ${chalk62.cyan("Tags:")} ${workflow.tags.join(", ") || "-"}`);
17383
+ lines.push(` ${chalk62.cyan("Created:")} ${formatDate(workflow.createdAt)}`);
17384
+ lines.push(` ${chalk62.cyan("Updated:")} ${formatDate(workflow.updatedAt)}`);
17024
17385
  const nodeCount = workflow.definition.nodes.length;
17025
- lines.push(chalk61.bold(`
17386
+ lines.push(chalk62.bold(`
17026
17387
  \uD83D\uDCCA Nodes Summary
17027
17388
  `));
17028
17389
  lines.push(` Total: ${nodeCount} nodes`);
@@ -17034,7 +17395,7 @@ function renderWorkflowDetail(workflow, options) {
17034
17395
  lines.push(` - ${type}: ${count}`);
17035
17396
  }
17036
17397
  if (workflow.definition.config) {
17037
- lines.push(chalk61.bold(`
17398
+ lines.push(chalk62.bold(`
17038
17399
  ⚙️ Configuration
17039
17400
  `));
17040
17401
  if (workflow.definition.config.parallel_limit !== undefined) {
@@ -17048,7 +17409,7 @@ function renderWorkflowDetail(workflow, options) {
17048
17409
  }
17049
17410
  }
17050
17411
  if (options?.includeRuns && options.includeRuns.length > 0) {
17051
- lines.push(chalk61.bold(`
17412
+ lines.push(chalk62.bold(`
17052
17413
  \uD83D\uDCDC Recent Runs
17053
17414
  `));
17054
17415
  lines.push(renderRunsList(options.includeRuns.slice(0, 5)));
@@ -17072,7 +17433,7 @@ function renderRunsList(runs, options) {
17072
17433
  }, null, 2);
17073
17434
  }
17074
17435
  if (runs.length === 0) {
17075
- return chalk61.yellow("No runs found");
17436
+ return chalk62.yellow("No runs found");
17076
17437
  }
17077
17438
  const ID_WIDTH = 20;
17078
17439
  const STATUS_WIDTH = 12;
@@ -17080,10 +17441,10 @@ function renderRunsList(runs, options) {
17080
17441
  const UPDATED_WIDTH = 20;
17081
17442
  const GAP = " ";
17082
17443
  const headerLine = [
17083
- chalk61.bold("RUN ID".padEnd(ID_WIDTH)),
17084
- chalk61.bold("STATUS".padEnd(STATUS_WIDTH)),
17085
- chalk61.bold("DURATION".padEnd(DURATION_WIDTH)),
17086
- chalk61.bold("STARTED")
17444
+ chalk62.bold("RUN ID".padEnd(ID_WIDTH)),
17445
+ chalk62.bold("STATUS".padEnd(STATUS_WIDTH)),
17446
+ chalk62.bold("DURATION".padEnd(DURATION_WIDTH)),
17447
+ chalk62.bold("STARTED")
17087
17448
  ].join(GAP);
17088
17449
  const sepLine = "─".repeat(ID_WIDTH + STATUS_WIDTH + DURATION_WIDTH + UPDATED_WIDTH + GAP.length * 3);
17089
17450
  const rows = runs.map((r) => {
@@ -17098,34 +17459,34 @@ function renderRunsList(runs, options) {
17098
17459
  }
17099
17460
  function renderRunDetail(run) {
17100
17461
  const lines = [];
17101
- lines.push(chalk61.bold(`
17462
+ lines.push(chalk62.bold(`
17102
17463
  \uD83C\uDFC3 Run Details
17103
17464
  `));
17104
- lines.push(` ${chalk61.cyan("Run ID:")} ${run.id}`);
17105
- lines.push(` ${chalk61.cyan("Workflow:")} ${run.workflowId}`);
17106
- lines.push(` ${chalk61.cyan("Status:")} ${statusColor(run.status)(run.status)}`);
17107
- lines.push(` ${chalk61.cyan("Started:")} ${formatDate(run.startedAt)}`);
17465
+ lines.push(` ${chalk62.cyan("Run ID:")} ${run.id}`);
17466
+ lines.push(` ${chalk62.cyan("Workflow:")} ${run.workflowId}`);
17467
+ lines.push(` ${chalk62.cyan("Status:")} ${statusColor(run.status)(run.status)}`);
17468
+ lines.push(` ${chalk62.cyan("Started:")} ${formatDate(run.startedAt)}`);
17108
17469
  if (run.pausedAt) {
17109
- lines.push(` ${chalk61.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
17470
+ lines.push(` ${chalk62.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
17110
17471
  }
17111
17472
  if (run.resumedAt) {
17112
- lines.push(` ${chalk61.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
17473
+ lines.push(` ${chalk62.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
17113
17474
  }
17114
17475
  if (run.stoppedAt) {
17115
- lines.push(` ${chalk61.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
17476
+ lines.push(` ${chalk62.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
17116
17477
  }
17117
17478
  if (run.completedAt) {
17118
- lines.push(` ${chalk61.cyan("Completed:")} ${formatDate(run.completedAt)}`);
17479
+ lines.push(` ${chalk62.cyan("Completed:")} ${formatDate(run.completedAt)}`);
17119
17480
  }
17120
- lines.push(` ${chalk61.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
17481
+ lines.push(` ${chalk62.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
17121
17482
  if (run.error) {
17122
- lines.push(chalk61.bold(`
17483
+ lines.push(chalk62.bold(`
17123
17484
  ❌ Error
17124
17485
  `));
17125
- lines.push(` ${chalk61.red(run.error)}`);
17486
+ lines.push(` ${chalk62.red(run.error)}`);
17126
17487
  }
17127
17488
  if (run.output) {
17128
- lines.push(chalk61.bold(`
17489
+ lines.push(chalk62.bold(`
17129
17490
  \uD83D\uDCE4 Output
17130
17491
  `));
17131
17492
  lines.push(" " + JSON.stringify(run.output, null, 2).split(`
@@ -17136,36 +17497,36 @@ function renderRunDetail(run) {
17136
17497
  `);
17137
17498
  }
17138
17499
  function renderWorkflowAdded(workflow) {
17139
- return chalk61.green(`
17500
+ return chalk62.green(`
17140
17501
  ✅ Workflow '${workflow.name}' added successfully
17141
17502
  `) + ` ID: ${workflow.id}
17142
17503
  ` + ` Version: ${workflow.version}
17143
17504
  `;
17144
17505
  }
17145
17506
  function renderWorkflowUpdated(workflow) {
17146
- return chalk61.green(`
17507
+ return chalk62.green(`
17147
17508
  ✅ Workflow '${workflow.name}' updated successfully
17148
17509
  `) + ` ID: ${workflow.id}
17149
17510
  `;
17150
17511
  }
17151
17512
  function renderWorkflowDeleted(name) {
17152
- return chalk61.green(`
17513
+ return chalk62.green(`
17153
17514
  ✅ Workflow '${name}' deleted successfully
17154
17515
  `);
17155
17516
  }
17156
17517
  function renderRunResult(result) {
17157
17518
  const lines = [];
17158
17519
  if (result.status === "completed") {
17159
- lines.push(chalk61.green(`
17520
+ lines.push(chalk62.green(`
17160
17521
  ✅ Workflow completed successfully`));
17161
17522
  } else if (result.status === "failed") {
17162
- lines.push(chalk61.red(`
17523
+ lines.push(chalk62.red(`
17163
17524
  ❌ Workflow failed`));
17164
17525
  } else if (result.status === "stopped") {
17165
- lines.push(chalk61.yellow(`
17526
+ lines.push(chalk62.yellow(`
17166
17527
  ⚠️ Workflow stopped`));
17167
17528
  } else {
17168
- lines.push(chalk61.blue(`
17529
+ lines.push(chalk62.blue(`
17169
17530
  \uD83D\uDD04 Workflow ${result.status}`));
17170
17531
  }
17171
17532
  lines.push(` Run ID: ${result.runId}`);
@@ -17173,11 +17534,11 @@ function renderRunResult(result) {
17173
17534
  lines.push(` Duration: ${formatDuration(result.durationMs)}`);
17174
17535
  }
17175
17536
  if (result.error) {
17176
- lines.push(chalk61.red(`
17537
+ lines.push(chalk62.red(`
17177
17538
  Error: ${result.error}`));
17178
17539
  }
17179
17540
  if (result.output) {
17180
- lines.push(chalk61.bold(`
17541
+ lines.push(chalk62.bold(`
17181
17542
  \uD83D\uDCE4 Output:`));
17182
17543
  lines.push(JSON.stringify(result.output, null, 2));
17183
17544
  }
@@ -17191,10 +17552,10 @@ function renderNodesList(nodes) {
17191
17552
  const DEPS_WIDTH = 20;
17192
17553
  const GAP = " ";
17193
17554
  const headerLine = [
17194
- chalk61.bold("NODE ID".padEnd(ID_WIDTH)),
17195
- chalk61.bold("TYPE".padEnd(TYPE_WIDTH)),
17196
- chalk61.bold("NAME".padEnd(NAME_WIDTH)),
17197
- chalk61.bold("DEPENDS ON")
17555
+ chalk62.bold("NODE ID".padEnd(ID_WIDTH)),
17556
+ chalk62.bold("TYPE".padEnd(TYPE_WIDTH)),
17557
+ chalk62.bold("NAME".padEnd(NAME_WIDTH)),
17558
+ chalk62.bold("DEPENDS ON")
17198
17559
  ].join(GAP);
17199
17560
  const sepLine = "─".repeat(ID_WIDTH + TYPE_WIDTH + NAME_WIDTH + DEPS_WIDTH + GAP.length * 3);
17200
17561
  const rows = nodes.map((n) => {
@@ -17209,7 +17570,7 @@ function renderNodesList(nodes) {
17209
17570
  }
17210
17571
 
17211
17572
  // src/commands/workflow/commands/list.ts
17212
- import chalk62 from "chalk";
17573
+ import chalk63 from "chalk";
17213
17574
  import { createWorkflowListTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
17214
17575
  function buildListWorkflowsJson(workflows, total, args, availableTags) {
17215
17576
  const output = {
@@ -17357,20 +17718,20 @@ var WorkflowListCommand = {
17357
17718
  if (total > workflows.length) {
17358
17719
  const start = finalOffset + 1;
17359
17720
  const end = finalOffset + workflows.length;
17360
- output.log(chalk62.green(`
17721
+ output.log(chalk63.green(`
17361
17722
  ✅ 显示 ${start}-${end} / 共 ${total} 个 Workflow`));
17362
17723
  const totalPages = Math.ceil(total / pageSize);
17363
17724
  const currentPage = Math.floor(finalOffset / pageSize) + 1;
17364
17725
  if (totalPages > 1) {
17365
- output.log(chalk62.cyan(`\uD83D\uDCC4 第 ${currentPage} / ${totalPages} 页`));
17726
+ output.log(chalk63.cyan(`\uD83D\uDCC4 第 ${currentPage} / ${totalPages} 页`));
17366
17727
  }
17367
17728
  } else {
17368
- output.log(chalk62.green(`
17729
+ output.log(chalk63.green(`
17369
17730
  ✅ 共 ${total} 个 Workflow`));
17370
17731
  }
17371
17732
  if (availableTags.length > 0) {
17372
17733
  const tagsLine = availableTags.map((t) => `${t.name}(${t.count})`).join(", ");
17373
- output.log(chalk62.cyan(`
17734
+ output.log(chalk63.cyan(`
17374
17735
  \uD83C\uDFF7️ Available tags: ${tagsLine}`));
17375
17736
  }
17376
17737
  }
@@ -17973,8 +18334,8 @@ class WorkflowValidator {
17973
18334
  }
17974
18335
 
17975
18336
  // src/commands/workflow/commands/add.ts
17976
- import { validateWorkflowDefinition } from "@ai-setting/roy-agent-core/env/workflow/utils/validate-workflow-definition";
17977
- import chalk63 from "chalk";
18337
+ import { validateWorkflowDefinition } from "@ai-setting/roy-agent-core/env/workflow/utils";
18338
+ import chalk64 from "chalk";
17978
18339
  import fs3 from "fs";
17979
18340
  import path6 from "path";
17980
18341
  async function parseWorkflowContent(content, filename) {
@@ -18116,7 +18477,7 @@ var WorkflowAddCommand = {
18116
18477
  definition = await parseWorkflowContent(content, filePath);
18117
18478
  workflowName = a.name || definition.name || path6.basename(filePath);
18118
18479
  if (a.validate) {
18119
- output.log(chalk63.blue("\uD83D\uDD0D Validating workflow..."));
18480
+ output.log(chalk64.blue("\uD83D\uDD0D Validating workflow..."));
18120
18481
  const dagResult = validateWorkflowDefinition(definition);
18121
18482
  if (!dagResult.valid) {
18122
18483
  output.error(`
@@ -18140,11 +18501,11 @@ var WorkflowAddCommand = {
18140
18501
  });
18141
18502
  process.exit(1);
18142
18503
  }
18143
- output.log(chalk63.green(`✅ Workflow validation passed
18504
+ output.log(chalk64.green(`✅ Workflow validation passed
18144
18505
  `));
18145
18506
  }
18146
18507
  } else if (a.desc) {
18147
- output.log(chalk63.blue(`\uD83E\uDD16 Generating workflow from description...
18508
+ output.log(chalk64.blue(`\uD83E\uDD16 Generating workflow from description...
18148
18509
  `));
18149
18510
  const agentComponent = env.getComponent("agent");
18150
18511
  if (!agentComponent) {
@@ -18166,20 +18527,20 @@ ${a.desc}
18166
18527
  1. 先用 \`roy-agent workflow nodes\` 查看可用的节点类型
18167
18528
  2. 生成的 YAML 必须通过 \`roy-agent workflow validate --yaml "<yaml>"\` 验证
18168
18529
  3. 验证通过后才输出最终 YAML`;
18169
- output.log(chalk63.gray("Running workflow-extract agent..."));
18530
+ output.log(chalk64.gray("Running workflow-extract agent..."));
18170
18531
  const result = await agentComponent.run("workflow-extract", prompt);
18171
18532
  const agentOutput = result.finalText || "";
18172
18533
  definition = parseYamlFromAgentOutput(agentOutput);
18173
18534
  if (definition === null) {
18174
18535
  output.error("Failed to parse workflow from agent output");
18175
- output.log(chalk63.gray(`
18536
+ output.log(chalk64.gray(`
18176
18537
  Agent output:
18177
18538
  ` + agentOutput.slice(0, 500)));
18178
18539
  process.exit(1);
18179
18540
  }
18180
18541
  workflowName = a.name || definition.name;
18181
18542
  if (a.validate) {
18182
- output.log(chalk63.blue(`
18543
+ output.log(chalk64.blue(`
18183
18544
  \uD83D\uDD0D Validating generated workflow...`));
18184
18545
  const dagResult = validateWorkflowDefinition(definition);
18185
18546
  if (!dagResult.valid) {
@@ -18188,7 +18549,7 @@ Agent output:
18188
18549
  dagResult.errors.forEach((msg, i) => {
18189
18550
  output.error(`[Error ${i + 1}/${dagResult.errors.length}] ${msg}`);
18190
18551
  });
18191
- output.log(chalk63.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
18552
+ output.log(chalk64.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
18192
18553
  process.exit(1);
18193
18554
  }
18194
18555
  const validator = new WorkflowValidator;
@@ -18203,16 +18564,16 @@ Agent output:
18203
18564
  output.error(` Fix: ${error.fix}
18204
18565
  `);
18205
18566
  });
18206
- output.log(chalk63.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
18567
+ output.log(chalk64.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
18207
18568
  process.exit(1);
18208
18569
  }
18209
- output.log(chalk63.green(`✅ Generated workflow validation passed
18570
+ output.log(chalk64.green(`✅ Generated workflow validation passed
18210
18571
  `));
18211
18572
  }
18212
18573
  const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
18213
- output.log(chalk63.gray("--- Generated YAML ---"));
18574
+ output.log(chalk64.gray("--- Generated YAML ---"));
18214
18575
  output.log(yaml.stringify(definition));
18215
- output.log(chalk63.gray(`------------------------
18576
+ output.log(chalk64.gray(`------------------------
18216
18577
  `));
18217
18578
  } else {
18218
18579
  output.error("Please provide --file or --desc option");
@@ -18238,10 +18599,10 @@ Agent output:
18238
18599
  force: a.force
18239
18600
  });
18240
18601
  output.log(renderWorkflowAdded(workflow));
18241
- output.log(chalk63.bold(`
18602
+ output.log(chalk64.bold(`
18242
18603
  \uD83D\uDCCA Nodes Summary:`));
18243
18604
  output.log(renderNodesList(definition.nodes));
18244
- output.log(chalk63.green(`
18605
+ output.log(chalk64.green(`
18245
18606
  ✅ Workflow '${workflowName}' added successfully`));
18246
18607
  } catch (error) {
18247
18608
  if (error.message?.includes("already exists") && !a.force) {
@@ -18258,7 +18619,7 @@ Agent output:
18258
18619
  };
18259
18620
 
18260
18621
  // src/commands/workflow/commands/get.ts
18261
- import chalk64 from "chalk";
18622
+ import chalk65 from "chalk";
18262
18623
  import { createWorkflowGetTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
18263
18624
  var WorkflowGetCommand = {
18264
18625
  command: "get <identifier>",
@@ -18396,15 +18757,15 @@ var WorkflowGetCommand = {
18396
18757
  } else {
18397
18758
  output.log(renderWorkflowDetail(workflow, { includeRuns: runs }));
18398
18759
  if (args.includeNodes) {
18399
- output.log(chalk64.bold(`
18760
+ output.log(chalk65.bold(`
18400
18761
  \uD83D\uDCCB All Nodes:`));
18401
18762
  output.log(renderNodesList(data.nodes || []));
18402
18763
  }
18403
18764
  const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
18404
18765
  const defYaml = yaml.stringify(data.definition || {}, { indent: 2 });
18405
- output.log(chalk64.bold(`
18766
+ output.log(chalk65.bold(`
18406
18767
  \uD83D\uDCC4 Definition (YAML):`));
18407
- output.log(chalk64.gray(defYaml));
18768
+ output.log(chalk65.gray(defYaml));
18408
18769
  }
18409
18770
  }
18410
18771
  } catch (error) {
@@ -18417,7 +18778,7 @@ var WorkflowGetCommand = {
18417
18778
  };
18418
18779
 
18419
18780
  // src/commands/workflow/commands/update.ts
18420
- import chalk65 from "chalk";
18781
+ import chalk66 from "chalk";
18421
18782
  import fs4 from "fs";
18422
18783
  import path7 from "path";
18423
18784
  import { parseWorkflowFile } from "@ai-setting/roy-agent-core/env/workflow/types";
@@ -18490,7 +18851,7 @@ var WorkflowUpdateCommand = {
18490
18851
  const tags = a.tags ? a.tags.split(",").map((t) => t.trim()) : undefined;
18491
18852
  const workflow = await service.updateWorkflow(a.name, updates, { tags });
18492
18853
  output.log(renderWorkflowUpdated(workflow));
18493
- output.log(chalk65.green(`
18854
+ output.log(chalk66.green(`
18494
18855
  ✅ Workflow '${a.name}' updated successfully`));
18495
18856
  } catch (error) {
18496
18857
  output.error(`Failed to update workflow: ${error}`);
@@ -18502,7 +18863,7 @@ var WorkflowUpdateCommand = {
18502
18863
  };
18503
18864
 
18504
18865
  // src/commands/workflow/commands/remove.ts
18505
- import chalk66 from "chalk";
18866
+ import chalk67 from "chalk";
18506
18867
  var WorkflowRemoveCommand = {
18507
18868
  command: "remove <name>",
18508
18869
  describe: "删除 Workflow",
@@ -18541,8 +18902,8 @@ var WorkflowRemoveCommand = {
18541
18902
  process.exit(1);
18542
18903
  }
18543
18904
  if (!args.force) {
18544
- output.log(chalk66.yellow(`Are you sure you want to delete workflow '${args.name}'?`));
18545
- output.log(chalk66.gray("Use --force to skip confirmation"));
18905
+ output.log(chalk67.yellow(`Are you sure you want to delete workflow '${args.name}'?`));
18906
+ output.log(chalk67.gray("Use --force to skip confirmation"));
18546
18907
  process.exit(1);
18547
18908
  }
18548
18909
  const deleted = await service.deleteWorkflow(args.name);
@@ -18562,7 +18923,7 @@ var WorkflowRemoveCommand = {
18562
18923
 
18563
18924
  // src/commands/workflow/commands/run.ts
18564
18925
  var import_yaml = __toESM(require_dist(), 1);
18565
- import chalk67 from "chalk";
18926
+ import chalk68 from "chalk";
18566
18927
  import fs5 from "fs";
18567
18928
  import path8 from "path";
18568
18929
  import { createRunWorkflowTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
@@ -18636,7 +18997,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
18636
18997
  };
18637
18998
  if (args.sessionId) {
18638
18999
  const sessionId = args.sessionId.startsWith("workflow_") ? args.sessionId : `workflow_${args.sessionId}`;
18639
- output.log(chalk67.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
19000
+ output.log(chalk68.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
18640
19001
  const sessionComponent = workflowComponent.sessionComponent;
18641
19002
  if (!sessionComponent) {
18642
19003
  output.error("SessionComponent not available");
@@ -18698,17 +19059,17 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
18698
19059
  definition = { ...definition, name: args.name };
18699
19060
  }
18700
19061
  const workflow = await service.createWorkflow(definition, { force: true });
18701
- output.log(chalk67.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
18702
- output.log(chalk67.green(`✅ Workflow registered: ${workflow.name} (${workflow.id})`));
19062
+ output.log(chalk68.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
19063
+ output.log(chalk68.green(`✅ Workflow registered: ${workflow.name} (${workflow.id})`));
18703
19064
  if (args.registerOnly) {
18704
- output.log(chalk67.gray("ℹ️ Use --register-only, skipping execution"));
19065
+ output.log(chalk68.gray("ℹ️ Use --register-only, skipping execution"));
18705
19066
  if (workflowSpan) {
18706
19067
  workflowSpan.end();
18707
19068
  }
18708
19069
  await envService.dispose();
18709
19070
  process.exit(0);
18710
19071
  }
18711
- output.log(chalk67.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
19072
+ output.log(chalk68.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
18712
19073
  const result = await service.runWorkflow(definition, input, runOptions);
18713
19074
  output.log(renderRunResult({
18714
19075
  runId: result.runId,
@@ -18718,7 +19079,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
18718
19079
  durationMs: result.durationMs
18719
19080
  }));
18720
19081
  if (result.status === "paused") {
18721
- output.log(chalk67.gray(`
19082
+ output.log(chalk68.gray(`
18722
19083
  \uD83D\uDCA1 Use "roy-agent workflow run ${result.runId} --session-id ${result.runId} --input '<response>'" to resume`));
18723
19084
  }
18724
19085
  } else {
@@ -18741,7 +19102,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
18741
19102
  durationMs: runData.duration_ms
18742
19103
  }));
18743
19104
  if (runData.status === "paused") {
18744
- output.log(chalk67.gray(`
19105
+ output.log(chalk68.gray(`
18745
19106
  \uD83D\uDCA1 Use "roy-agent workflow run ${runData.run_id} --session-id ${runData.run_id} --input '<response>'" to resume`));
18746
19107
  }
18747
19108
  }
@@ -18813,7 +19174,7 @@ var WorkflowRunCommand = {
18813
19174
  };
18814
19175
 
18815
19176
  // src/commands/workflow/commands/stop.ts
18816
- import chalk68 from "chalk";
19177
+ import chalk69 from "chalk";
18817
19178
  import { createWorkflowRunStopTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
18818
19179
  import { wrapFunction as wrapFunction2 } from "@ai-setting/roy-agent-core";
18819
19180
  var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
@@ -18838,7 +19199,7 @@ var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
18838
19199
  output.error(result.error || `Failed to stop workflow: ${args.runId}`);
18839
19200
  process.exit(1);
18840
19201
  }
18841
- output.log(chalk68.red(`
19202
+ output.log(chalk69.red(`
18842
19203
  ⏹️ Workflow stopped: ${args.runId}`));
18843
19204
  } catch (error) {
18844
19205
  output.error(`Failed to stop workflow: ${error}`);
@@ -18862,7 +19223,7 @@ var WorkflowStopCommand = {
18862
19223
  };
18863
19224
 
18864
19225
  // src/commands/workflow/commands/status.ts
18865
- import chalk69 from "chalk";
19226
+ import chalk70 from "chalk";
18866
19227
  import { createWorkflowRunStatusTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
18867
19228
  var WorkflowStatusCommand = {
18868
19229
  command: "status <runId>",
@@ -18955,7 +19316,7 @@ var WorkflowStatusCommand = {
18955
19316
  stopped: "⏹️"
18956
19317
  };
18957
19318
  const emoji = statusEmoji[status] || "❓";
18958
- output.log(chalk69.bold(`
19319
+ output.log(chalk70.bold(`
18959
19320
  ${emoji} Status: ${status.toUpperCase()}`));
18960
19321
  }
18961
19322
  } catch (error) {
@@ -18968,7 +19329,7 @@ ${emoji} Status: ${status.toUpperCase()}`));
18968
19329
  };
18969
19330
 
18970
19331
  // src/commands/workflow/commands/nodes.ts
18971
- import chalk70 from "chalk";
19332
+ import chalk71 from "chalk";
18972
19333
  var BUILT_IN_NODES = [
18973
19334
  {
18974
19335
  name: "ToolNode",
@@ -19305,7 +19666,7 @@ nodes:
19305
19666
  ];
19306
19667
  function renderNodeTypesTable(nodes) {
19307
19668
  const lines = [];
19308
- lines.push(chalk70.bold(`
19669
+ lines.push(chalk71.bold(`
19309
19670
  \uD83D\uDCE6 Built-in Node Types
19310
19671
  `));
19311
19672
  lines.push("┌────────────┬────────────────────┬─────────────────────────────────────────────────────────────┐");
@@ -19323,29 +19684,29 @@ function renderNodeTypesTable(nodes) {
19323
19684
  }
19324
19685
  function renderNodeDetail(node) {
19325
19686
  const lines = [];
19326
- lines.push(chalk70.bold(`
19687
+ lines.push(chalk71.bold(`
19327
19688
  [${node.type}] ${node.name}`));
19328
- lines.push(chalk70.dim("─".repeat(60)) + `
19689
+ lines.push(chalk71.dim("─".repeat(60)) + `
19329
19690
  `);
19330
- lines.push(chalk70.bold("Description:"));
19691
+ lines.push(chalk71.bold("Description:"));
19331
19692
  lines.push(` ${node.description}
19332
19693
  `);
19333
- lines.push(chalk70.bold("Configuration:"));
19694
+ lines.push(chalk71.bold("Configuration:"));
19334
19695
  lines.push(' type: "' + node.type + '"');
19335
19696
  lines.push(" config:");
19336
19697
  for (const input of node.inputs) {
19337
- const required = input.required ? chalk70.red("*") : " ";
19698
+ const required = input.required ? chalk71.red("*") : " ";
19338
19699
  lines.push(` ${input.name} (${input.type})${required}`);
19339
19700
  lines.push(` ${input.description}`);
19340
19701
  }
19341
19702
  lines.push(`
19342
- ${chalk70.bold("Output:")} ${node.output}`);
19703
+ ${chalk71.bold("Output:")} ${node.output}`);
19343
19704
  if (node.example) {
19344
- lines.push(chalk70.bold(`
19705
+ lines.push(chalk71.bold(`
19345
19706
  Example:`));
19346
- lines.push(chalk70.gray("```yaml"));
19707
+ lines.push(chalk71.gray("```yaml"));
19347
19708
  lines.push(node.example);
19348
- lines.push(chalk70.gray("```"));
19709
+ lines.push(chalk71.gray("```"));
19349
19710
  }
19350
19711
  return lines.join(`
19351
19712
  `);
@@ -19361,16 +19722,16 @@ var WorkflowNodesCommand = {
19361
19722
  const nodeType = args.type?.toLowerCase();
19362
19723
  if (!nodeType) {
19363
19724
  console.log(renderNodeTypesTable(BUILT_IN_NODES));
19364
- console.log(chalk70.gray(`
19365
- Use `) + chalk70.cyan("roy-agent workflow nodes <type>") + chalk70.gray(" for detailed information"));
19366
- console.log(chalk70.gray("Available types: ") + chalk70.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
19725
+ console.log(chalk71.gray(`
19726
+ Use `) + chalk71.cyan("roy-agent workflow nodes <type>") + chalk71.gray(" for detailed information"));
19727
+ console.log(chalk71.gray("Available types: ") + chalk71.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
19367
19728
  return;
19368
19729
  }
19369
19730
  const node = BUILT_IN_NODES.find((n) => n.type === nodeType);
19370
19731
  if (!node) {
19371
- console.log(chalk70.red(`
19732
+ console.log(chalk71.red(`
19372
19733
  ❌ Unknown node type: ${nodeType}`));
19373
- console.log(chalk70.gray("Available types: ") + chalk70.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
19734
+ console.log(chalk71.gray("Available types: ") + chalk71.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
19374
19735
  process.exit(1);
19375
19736
  }
19376
19737
  console.log(renderNodeDetail(node));
@@ -19378,7 +19739,7 @@ Use `) + chalk70.cyan("roy-agent workflow nodes <type>") + chalk70.gray(" for de
19378
19739
  };
19379
19740
 
19380
19741
  // src/commands/workflow/commands/validate.ts
19381
- import chalk71 from "chalk";
19742
+ import chalk72 from "chalk";
19382
19743
  import { readFileSync } from "fs";
19383
19744
  async function parseWorkflowInput(input, yamlStr) {
19384
19745
  const parseYaml = async (content) => {
@@ -19411,25 +19772,25 @@ function renderResult(result, options) {
19411
19772
  return;
19412
19773
  }
19413
19774
  if (result.valid) {
19414
- console.log(chalk71.green(`
19775
+ console.log(chalk72.green(`
19415
19776
  ✅ Workflow validation PASSED
19416
19777
  `));
19417
- console.log(chalk71.bold(`Workflow: ${result.workflowName}`));
19778
+ console.log(chalk72.bold(`Workflow: ${result.workflowName}`));
19418
19779
  console.log(`Nodes: ${result.nodeCount}`);
19419
19780
  console.log(`
19420
19781
  Valid nodes:`);
19421
- console.log(chalk71.green(" ✓ All nodes passed validation"));
19782
+ console.log(chalk72.green(" ✓ All nodes passed validation"));
19422
19783
  } else {
19423
- console.log(chalk71.red(`
19784
+ console.log(chalk72.red(`
19424
19785
  ❌ Workflow validation FAILED (${result.errors.length} errors found)
19425
19786
  `));
19426
19787
  result.errors.forEach((error, index) => {
19427
- console.log(chalk71.red(`[Error ${index + 1}/${result.errors.length}]${error.nodeId ? ` Node "${error.nodeId}"` : ""}`));
19428
- console.log(` ${chalk71.bold("Type:")} ${error.type}`);
19429
- console.log(` ${chalk71.bold("Description:")} ${error.description}`);
19430
- console.log(` ${chalk71.bold("Expected:")} ${error.expected}`);
19431
- console.log(` ${chalk71.bold("Actual:")} ${error.actual}`);
19432
- console.log(` ${chalk71.green("Fix:")} ${error.fix}`);
19788
+ console.log(chalk72.red(`[Error ${index + 1}/${result.errors.length}]${error.nodeId ? ` Node "${error.nodeId}"` : ""}`));
19789
+ console.log(` ${chalk72.bold("Type:")} ${error.type}`);
19790
+ console.log(` ${chalk72.bold("Description:")} ${error.description}`);
19791
+ console.log(` ${chalk72.bold("Expected:")} ${error.expected}`);
19792
+ console.log(` ${chalk72.bold("Actual:")} ${error.actual}`);
19793
+ console.log(` ${chalk72.green("Fix:")} ${error.fix}`);
19433
19794
  console.log();
19434
19795
  });
19435
19796
  }
@@ -19454,7 +19815,7 @@ var WorkflowValidateCommand = {
19454
19815
  try {
19455
19816
  const workflow = await parseWorkflowInput(options.input, options.yaml);
19456
19817
  if (!workflow) {
19457
- console.error(chalk71.red("Failed to parse workflow input"));
19818
+ console.error(chalk72.red("Failed to parse workflow input"));
19458
19819
  process.exit(1);
19459
19820
  }
19460
19821
  const validator = new WorkflowValidator;
@@ -19462,7 +19823,7 @@ var WorkflowValidateCommand = {
19462
19823
  renderResult(result, options);
19463
19824
  process.exit(result.valid ? 0 : 1);
19464
19825
  } catch (error) {
19465
- console.error(chalk71.red(`
19826
+ console.error(chalk72.red(`
19466
19827
  Error: ${error.message}`));
19467
19828
  process.exit(1);
19468
19829
  }
@@ -19470,7 +19831,7 @@ Error: ${error.message}`));
19470
19831
  };
19471
19832
 
19472
19833
  // src/commands/workflow/commands/search.ts
19473
- import chalk72 from "chalk";
19834
+ import chalk73 from "chalk";
19474
19835
  import { wrapFunction as wrapFunction3 } from "@ai-setting/roy-agent-core";
19475
19836
  var WorkflowSearchCommand = {
19476
19837
  command: "search",
@@ -19627,22 +19988,22 @@ var _runWorkflowSearchImpl = async function(opts) {
19627
19988
  metadata: {}
19628
19989
  }));
19629
19990
  if (renderWorkflows.length === 0) {
19630
- output.log(chalk72.yellow("\uD83D\uDD0D No workflows matched the search criteria."));
19631
- output.log(chalk72.gray(` keyword: ${keyword || "(none)"}`));
19632
- output.log(chalk72.gray(` tags: ${tags && tags.length > 0 ? tags.join(", ") : "(none)"}`));
19991
+ output.log(chalk73.yellow("\uD83D\uDD0D No workflows matched the search criteria."));
19992
+ output.log(chalk73.gray(` keyword: ${keyword || "(none)"}`));
19993
+ output.log(chalk73.gray(` tags: ${tags && tags.length > 0 ? tags.join(", ") : "(none)"}`));
19633
19994
  } else {
19634
- output.log(chalk72.bold(`\uD83D\uDD0D Search results (${renderWorkflows.length}):`));
19995
+ output.log(chalk73.bold(`\uD83D\uDD0D Search results (${renderWorkflows.length}):`));
19635
19996
  output.log(renderWorkflowList(renderWorkflows));
19636
- output.log(chalk72.green(`
19997
+ output.log(chalk73.green(`
19637
19998
  ✅ Found ${renderWorkflows.length} workflow(s)`));
19638
19999
  }
19639
20000
  if (availableTags.length > 0) {
19640
20001
  output.log("");
19641
- output.log(chalk72.bold("\uD83D\uDCDA Available tags (sorted by usage_count):"));
20002
+ output.log(chalk73.bold("\uD83D\uDCDA Available tags (sorted by usage_count):"));
19642
20003
  for (const t of availableTags) {
19643
20004
  const name = t.name ?? t.tag;
19644
20005
  const count = t.count ?? t.usage_count;
19645
- output.log(chalk72.gray(` - ${name} (${count})`));
20006
+ output.log(chalk73.gray(` - ${name} (${count})`));
19646
20007
  }
19647
20008
  }
19648
20009
  };
@@ -19654,7 +20015,7 @@ var runWorkflowSearch = wrapFunction3(_runWorkflowSearchImpl, "workflow.cli.sear
19654
20015
 
19655
20016
  // src/commands/workflow/commands/tag.ts
19656
20017
  import { wrapFunction as wrapFunction4 } from "@ai-setting/roy-agent-core";
19657
- import chalk73 from "chalk";
20018
+ import chalk74 from "chalk";
19658
20019
  var WorkflowTagListCommand = {
19659
20020
  command: "list",
19660
20021
  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.",
@@ -19775,17 +20136,17 @@ var _runWorkflowTagListImpl = async function(opts) {
19775
20136
  return;
19776
20137
  }
19777
20138
  if (result.tags.length === 0) {
19778
- output.log(chalk73.yellow("\uD83C\uDFF7️ No tags in the workflow_tags table yet."));
19779
- output.log(chalk73.gray(" Tags are created automatically when you run `workflow add --tags <name>`."));
20139
+ output.log(chalk74.yellow("\uD83C\uDFF7️ No tags in the workflow_tags table yet."));
20140
+ output.log(chalk74.gray(" Tags are created automatically when you run `workflow add --tags <name>`."));
19780
20141
  return;
19781
20142
  }
19782
- output.log(chalk73.bold(`\uD83C\uDFF7️ Workflow tags (${result.total}):`));
19783
- output.log(chalk73.gray(` ${padRight("NAME", 24)}${padRight("USAGE", 8)}${padRight("CREATED", 22)}`));
20143
+ output.log(chalk74.bold(`\uD83C\uDFF7️ Workflow tags (${result.total}):`));
20144
+ output.log(chalk74.gray(` ${padRight("NAME", 24)}${padRight("USAGE", 8)}${padRight("CREATED", 22)}`));
19784
20145
  for (const t of result.tags) {
19785
20146
  const line = ` ${padRight(t.name, 24)}${padRight(String(t.usage_count), 8)}${padRight(formatDate2(t.created_at), 22)}`;
19786
20147
  output.log(line);
19787
20148
  }
19788
- output.log(chalk73.gray(`
20149
+ output.log(chalk74.gray(`
19789
20150
  \uD83D\uDCA1 Tip: when adding a new workflow, prefer tags from this list to ensure semantic consistency.`));
19790
20151
  };
19791
20152
  var _runWorkflowTagGetImpl = async function(opts) {
@@ -19812,7 +20173,7 @@ var _runWorkflowTagGetImpl = async function(opts) {
19812
20173
  output.json({ error: "Tag not found", name: opts.name });
19813
20174
  } else {
19814
20175
  output.error(`Tag "${opts.name}" not found in the workflow_tags table.`);
19815
- output.log(chalk73.gray(`Tip: run \`roy-agent workflow tag list\` to see available tags.`));
20176
+ output.log(chalk74.gray(`Tip: run \`roy-agent workflow tag list\` to see available tags.`));
19816
20177
  }
19817
20178
  process.exitCode = 1;
19818
20179
  return;
@@ -19821,10 +20182,10 @@ var _runWorkflowTagGetImpl = async function(opts) {
19821
20182
  output.json(tag);
19822
20183
  return;
19823
20184
  }
19824
- output.log(chalk73.bold(`\uD83C\uDFF7️ Tag: ${tag.name}`));
19825
- output.log(chalk73.gray(` usage_count: ${tag.usage_count}`));
19826
- output.log(chalk73.gray(` created_at: ${tag.created_at}`));
19827
- output.log(chalk73.gray(` updated_at: ${tag.updated_at}`));
20185
+ output.log(chalk74.bold(`\uD83C\uDFF7️ Tag: ${tag.name}`));
20186
+ output.log(chalk74.gray(` usage_count: ${tag.usage_count}`));
20187
+ output.log(chalk74.gray(` created_at: ${tag.created_at}`));
20188
+ output.log(chalk74.gray(` updated_at: ${tag.updated_at}`));
19828
20189
  };
19829
20190
  async function callListTags(service, options) {
19830
20191
  if (typeof service.listTags !== "function") {