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