@ai-setting/roy-agent-cli 1.5.113 → 1.5.115

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
@@ -7426,7 +7426,7 @@ var require_dist = __commonJS((exports) => {
7426
7426
  var require_package = __commonJS((exports, module) => {
7427
7427
  module.exports = {
7428
7428
  name: "@ai-setting/roy-agent-cli",
7429
- version: "1.5.113",
7429
+ version: "1.5.115",
7430
7430
  type: "module",
7431
7431
  description: "CLI for roy-agent - Non-interactive command execution",
7432
7432
  main: "./dist/index.js",
@@ -9494,7 +9494,6 @@ class EventHandler {
9494
9494
  console.error(`[EventHandler] 处理事件失败:`, error);
9495
9495
  }
9496
9496
  }
9497
- this.clearActiveSession();
9498
9497
  this.isProcessing = false;
9499
9498
  }
9500
9499
  async ensureActiveSession() {
@@ -9511,13 +9510,29 @@ class EventHandler {
9511
9510
  return null;
9512
9511
  }
9513
9512
  this.activeEventSessionId = existing.id;
9513
+ await this.sessionComponent.setActiveSession(existing.id);
9514
9514
  return existing.id;
9515
9515
  }
9516
- console.warn(`[EventHandler] Parent session ${triggerSessionId} not found, creating new session`);
9516
+ console.warn(`[EventHandler] Parent session ${triggerSessionId} not found, trying global active session`);
9517
9517
  } catch (error) {
9518
9518
  console.error(`[EventHandler] Failed to lookup parent session ${triggerSessionId}:`, error);
9519
9519
  }
9520
9520
  }
9521
+ try {
9522
+ const activeId = this.sessionComponent.getActiveSessionId();
9523
+ if (activeId) {
9524
+ const existing = await this.sessionComponent.get(activeId);
9525
+ if (existing) {
9526
+ if (this.isStopped) {
9527
+ return null;
9528
+ }
9529
+ this.activeEventSessionId = existing.id;
9530
+ return existing.id;
9531
+ }
9532
+ }
9533
+ } catch (error) {
9534
+ console.error(`[EventHandler] Failed to lookup global active session:`, error);
9535
+ }
9521
9536
  return this.createNewEventSession();
9522
9537
  }
9523
9538
  async createNewEventSession() {
@@ -9530,6 +9545,7 @@ class EventHandler {
9530
9545
  return null;
9531
9546
  }
9532
9547
  this.activeEventSessionId = session.id;
9548
+ await this.sessionComponent.setActiveSession(session.id);
9533
9549
  return session.id;
9534
9550
  } catch (error) {
9535
9551
  console.error(`[EventHandler] 创建事件 session 失败:`, error);
@@ -9952,6 +9968,7 @@ class REPL {
9952
9968
  inputHandler;
9953
9969
  keypressHandler;
9954
9970
  sessionManager = null;
9971
+ sessionComponent = null;
9955
9972
  lastAttachPath = undefined;
9956
9973
  lastUsage = null;
9957
9974
  setLastUsage(usage) {
@@ -10190,9 +10207,22 @@ ${COLORS.system("⏳ 上一次请求尚未完成,请稍候...")}
10190
10207
  `);
10191
10208
  return;
10192
10209
  }
10210
+ await this.ensureActiveSession();
10193
10211
  const payload = this.sessionManager ? await this.sessionManager.getQueryPayload(message) : message;
10194
10212
  await this.executeInternal(payload, { showPrompt: false });
10195
10213
  }
10214
+ async ensureActiveSession() {
10215
+ if (!this.sessionComponent)
10216
+ return;
10217
+ try {
10218
+ const activeId = this.sessionComponent.getActiveSessionId();
10219
+ if (!activeId && this.sessionManager) {
10220
+ await this.sessionManager.init(undefined, false);
10221
+ }
10222
+ } catch (error) {
10223
+ console.error(`[REPL] Failed to ensure active session:`, error);
10224
+ }
10225
+ }
10196
10226
  async handleEventMessage(message) {
10197
10227
  console.log(`
10198
10228
  ${COLORS.system("[通知] ❯ " + message.replace(/\n/g, `
@@ -10206,6 +10236,7 @@ ${COLORS.system("[通知] ❯ " + message.replace(/\n/g, `
10206
10236
  ${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
10207
10237
  ` + COLORS.system("[通知2] ❯ ")))}
10208
10238
  `);
10239
+ await this.ensureActiveSession();
10209
10240
  const sourceId = envEvent.metadata?.sourceId;
10210
10241
  let pluginEnabled = envEvent.metadata?.pluginEnabled;
10211
10242
  let plugins = envEvent.metadata?.plugins;
@@ -10774,6 +10805,7 @@ function createInteractiveCommand(externalEnvService) {
10774
10805
  };
10775
10806
  process.on("SIGINT", sigintHandler);
10776
10807
  repl.sessionManager = sessionManager;
10808
+ repl.sessionComponent = sessionComponent;
10777
10809
  await repl.start();
10778
10810
  process.removeListener("SIGINT", sigintHandler);
10779
10811
  console.log("正在清理资源...");
@@ -10818,8 +10850,56 @@ function createInteractiveCommand(externalEnvService) {
10818
10850
  }
10819
10851
  var InteractiveCommand = createInteractiveCommand();
10820
10852
 
10821
- // src/commands/sessions/list.ts
10853
+ // src/commands/shared/list-output.ts
10822
10854
  import chalk6 from "chalk";
10855
+ var PAGINATION_OPTIONS = {
10856
+ limit: {
10857
+ alias: "n",
10858
+ type: "number",
10859
+ default: 20,
10860
+ description: "每页数量(-n alias)"
10861
+ },
10862
+ offset: {
10863
+ alias: "o",
10864
+ type: "number",
10865
+ default: 0,
10866
+ description: "分页偏移(-o alias)"
10867
+ }
10868
+ };
10869
+ function applyPagination(items, args) {
10870
+ const offset = Math.max(0, args.offset);
10871
+ const limit = Math.max(1, args.limit);
10872
+ return items.slice(offset, offset + limit);
10873
+ }
10874
+ function renderPaginationFooter(opts) {
10875
+ const { total, count, offset, limit, itemName, extras = [] } = opts;
10876
+ const start = total === 0 ? 0 : offset + 1;
10877
+ const end = offset + count;
10878
+ const items = `${itemName}${count === 1 ? "" : "s"}`;
10879
+ const base = `Showing ${start}-${end} of ${total} ${items}`;
10880
+ const suffix = extras.length > 0 ? ` (${extras.join(", ")})` : "";
10881
+ const truncatedHint = total > count && offset + count < total ? chalk6.cyan(` — use -o ${offset + limit} for next page`) : "";
10882
+ return chalk6.gray(base + suffix + truncatedHint);
10883
+ }
10884
+ function renderQuietHeader(total, itemName) {
10885
+ const items = `${itemName}${total === 1 ? "" : "s"}`;
10886
+ return `# Total: ${total} ${items}`;
10887
+ }
10888
+ function renderQuietLine(id, name) {
10889
+ return `${id} ${name}`;
10890
+ }
10891
+ function renderQuietPaginationHint(opts) {
10892
+ const { count, total, offset, limit } = opts;
10893
+ if (total <= count) {
10894
+ return "";
10895
+ }
10896
+ const start = offset + 1;
10897
+ const end = offset + count;
10898
+ return `# (showing ${start}-${end} of ${total}, use -o ${offset + limit} for next page)`;
10899
+ }
10900
+
10901
+ // src/commands/sessions/list.ts
10902
+ import chalk7 from "chalk";
10823
10903
 
10824
10904
  // src/commands/sessions/session-graph.ts
10825
10905
  function buildSessionTree(sessions) {
@@ -10982,14 +11062,9 @@ var ListCommand = {
10982
11062
  command: "list [options]",
10983
11063
  aliases: ["ls"],
10984
11064
  describe: "列出所有会话",
10985
- builder: (yargs) => yargs.option("limit", { alias: "n", type: "number", default: 20 }).option("offset", { type: "number", default: 0 }).option("sort", { type: "string", default: "updatedAt" }).option("order", { type: "string", default: "desc" }).option("json", { alias: "j", type: "boolean", default: false }).option("quiet", { alias: "q", type: "boolean", hidden: true }).option("id", { alias: "i", type: "boolean", default: false, description: "显示 Session ID" }).option("type", { alias: "t", type: "string", description: "按 session 类型过滤 (如 workflow)" }).option("status", { alias: "s", type: "string", description: "按状态过滤 (如 running, paused)" }).option("graph", { alias: "g", type: "boolean", default: false, description: "以层次化树形结构展示 session 父子关系" }).option("short-id", { type: "boolean", default: false, description: "[graph] 用 8 字符截断 id 显示(默认显示完整 sessionId)" }),
11065
+ builder: (yargs) => yargs.option("limit", { alias: "n", type: "number", default: 20 }).option("offset", { alias: "o", type: "number", default: 0, description: "分页偏移(-o alias)" }).option("sort", { type: "string", default: "updatedAt" }).option("order", { type: "string", default: "desc" }).option("json", { alias: "j", type: "boolean", default: false }).option("quiet", { alias: "q", type: "boolean", hidden: true }).option("id", { alias: "i", type: "boolean", default: false, description: "显示 Session ID" }).option("type", { alias: "t", type: "string", description: "按 session 类型过滤 (如 workflow)" }).option("status", { alias: "s", type: "string", description: "按状态过滤 (如 running, paused)" }).option("graph", { alias: "g", type: "boolean", default: false, description: "以层次化树形结构展示 session 父子关系" }).option("short-id", { type: "boolean", default: false, description: "[graph] 用 8 字符截断 id 显示(默认显示完整 sessionId)" }),
10986
11066
  async handler(args) {
10987
- const isQuiet = args.quiet === true;
10988
- if (isQuiet) {
10989
- CliQuietModeService.getInstance().setQuiet(true);
10990
- }
10991
11067
  const output = new OutputService2;
10992
- output.configure({ quiet: isQuiet });
10993
11068
  const envService = new EnvironmentService(output);
10994
11069
  try {
10995
11070
  await envService.create({ configPath: args.config });
@@ -11030,8 +11105,11 @@ var ListCommand = {
11030
11105
  }
11031
11106
  if (args.json) {
11032
11107
  output.json({
11033
- total: sessions.length,
11034
- totalCount,
11108
+ total: totalCount,
11109
+ count: sessions.length,
11110
+ truncated: totalCount > sessions.length,
11111
+ limit: args.limit,
11112
+ offset: args.offset,
11035
11113
  sessions: sessions.map((s) => {
11036
11114
  const workflowMeta = s.metadata?.type === "workflow" ? s.metadata : null;
11037
11115
  return {
@@ -11052,48 +11130,58 @@ var ListCommand = {
11052
11130
  };
11053
11131
  })
11054
11132
  });
11055
- } else if (args.quiet || args.id) {
11133
+ } else if (args.id) {
11056
11134
  sessions.forEach((s) => output.log(s.id));
11135
+ } else if (args.quiet) {
11136
+ output.log(renderQuietHeader(totalCount, "session"));
11137
+ sessions.forEach((s) => output.log(renderQuietLine(s.id, s.title)));
11138
+ const hint = renderQuietPaginationHint({
11139
+ count: sessions.length,
11140
+ total: totalCount,
11141
+ offset: args.offset ?? 0,
11142
+ limit: args.limit ?? 20
11143
+ });
11144
+ if (hint)
11145
+ output.log(hint);
11057
11146
  } else {
11058
11147
  const hasTypeFilter = !!args.type;
11059
11148
  const hasStatusFilter = !!args.status;
11060
11149
  const header = [
11061
- chalk6.bold("#"),
11062
- chalk6.bold("Title"),
11063
- chalk6.bold("ID"),
11064
- chalk6.bold("Parent"),
11065
- hasTypeFilter || hasStatusFilter ? chalk6.bold("Status") : null,
11066
- chalk6.bold("Msgs"),
11067
- chalk6.bold("CP")
11150
+ chalk7.bold("#"),
11151
+ chalk7.bold("Title"),
11152
+ chalk7.bold("ID"),
11153
+ chalk7.bold("Parent"),
11154
+ hasTypeFilter || hasStatusFilter ? chalk7.bold("Status") : null,
11155
+ chalk7.bold("Msgs"),
11156
+ chalk7.bold("CP")
11068
11157
  ].filter(Boolean).join(" │ ");
11069
11158
  const rows = sessions.map((s, i) => {
11070
- const marker = s.id === activeSessionId ? chalk6.green("▶") : " ";
11159
+ const marker = s.id === activeSessionId ? chalk7.green("▶") : " ";
11071
11160
  const hasCp = (s.metadata?.checkpoints?.checkpoints?.length ?? 0) > 0;
11072
11161
  const title = s.title.length > 20 ? s.title.slice(0, 17) + "..." : s.title;
11073
11162
  const idStr = s.id;
11074
11163
  const useShortId = args.shortId === true;
11075
- const parentStr = s.parentSessionId ? chalk6.gray(useShortId ? shortSessionId(s.parentSessionId) : s.parentSessionId) : chalk6.gray("-");
11164
+ const parentStr = s.parentSessionId ? chalk7.gray(useShortId ? shortSessionId(s.parentSessionId) : s.parentSessionId) : chalk7.gray("-");
11076
11165
  const workflowMeta = s.metadata?.type === "workflow" ? s.metadata : null;
11077
11166
  const statusStr = workflowMeta?.status || "";
11078
11167
  let statusDisplay = "";
11079
11168
  if (hasTypeFilter || hasStatusFilter) {
11080
11169
  if (workflowMeta) {
11081
- 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;
11170
+ statusDisplay = workflowMeta.status === "running" ? chalk7.green("running") : workflowMeta.status === "paused" ? chalk7.yellow("paused") : workflowMeta.status === "completed" ? chalk7.gray("completed") : workflowMeta.status === "failed" ? chalk7.red("failed") : statusStr;
11082
11171
  }
11083
11172
  }
11084
11173
  const cells = [
11085
11174
  marker + " " + (args.offset + i + 1),
11086
11175
  title,
11087
- chalk6.gray(idStr),
11176
+ chalk7.gray(idStr),
11088
11177
  parentStr
11089
11178
  ];
11090
11179
  if (hasTypeFilter || hasStatusFilter) {
11091
- cells.push(statusDisplay || chalk6.gray("-"));
11180
+ cells.push(statusDisplay || chalk7.gray("-"));
11092
11181
  }
11093
- cells.push(s.messageCount.toString(), hasCp ? chalk6.green("✓") : chalk6.gray("-"));
11182
+ cells.push(s.messageCount.toString(), hasCp ? chalk7.green("✓") : chalk7.gray("-"));
11094
11183
  return cells.join(" │ ");
11095
11184
  });
11096
- const showingInfo = totalCount > sessions.length ? `Showing ${sessions.length} of ${totalCount} sessions` : `${totalCount} sessions`;
11097
11185
  output.log([
11098
11186
  `┌─ Sessions ${"─".repeat(50)}┐`,
11099
11187
  `│${header}│`,
@@ -11101,7 +11189,17 @@ var ListCommand = {
11101
11189
  ...rows.map((r) => `│${r}│`),
11102
11190
  "└" + "─".repeat(header.length + 2) + "┘",
11103
11191
  "",
11104
- chalk6.gray(showingInfo)
11192
+ renderPaginationFooter({
11193
+ total: totalCount,
11194
+ count: sessions.length,
11195
+ offset: args.offset ?? 0,
11196
+ limit: args.limit ?? 20,
11197
+ itemName: "session",
11198
+ extras: [
11199
+ ...args.type ? [`type=${args.type}`] : [],
11200
+ ...args.status ? [`status=${args.status}`] : []
11201
+ ]
11202
+ })
11105
11203
  ].join(`
11106
11204
  `));
11107
11205
  }
@@ -11115,7 +11213,7 @@ var ListCommand = {
11115
11213
  };
11116
11214
 
11117
11215
  // src/commands/sessions/get.ts
11118
- import chalk7 from "chalk";
11216
+ import chalk8 from "chalk";
11119
11217
  var GetCommand = {
11120
11218
  command: "get <session-id>",
11121
11219
  aliases: ["show"],
@@ -11171,29 +11269,29 @@ var GetCommand = {
11171
11269
  });
11172
11270
  } else {
11173
11271
  const lines = [
11174
- chalk7.bold("┌─ Session Details ─────────────────────────────────┐"),
11272
+ chalk8.bold("┌─ Session Details ─────────────────────────────────┐"),
11175
11273
  `│ ID: ${session.id}`,
11176
11274
  `│ Title: ${session.title}`,
11177
11275
  `│ Directory: ${session.directory}`,
11178
11276
  `│ Messages: ${session.messageCount}`,
11179
- `│ Active: ${session.id === activeSessionId ? chalk7.green("✓") : chalk7.gray("-")}`,
11277
+ `│ Active: ${session.id === activeSessionId ? chalk8.green("✓") : chalk8.gray("-")}`,
11180
11278
  `│ Created: ${new Date(session.createdAt).toLocaleString("zh-CN")}`,
11181
11279
  `│ Updated: ${new Date(session.updatedAt).toLocaleString("zh-CN")}`
11182
11280
  ];
11183
11281
  const workflowMeta = session.metadata?.type === "workflow" ? session.metadata : null;
11184
11282
  if (workflowMeta) {
11185
11283
  lines.push("├─ Workflow Info ─────────────────────────────────────┤");
11186
- lines.push(`│ Type: ${chalk7.cyan("workflow")}`);
11284
+ lines.push(`│ Type: ${chalk8.cyan("workflow")}`);
11187
11285
  lines.push(`│ Workflow: ${workflowMeta.workflowName}`);
11188
11286
  if (workflowMeta.workflowId) {
11189
11287
  lines.push(`│ Workflow ID: ${workflowMeta.workflowId}`);
11190
11288
  }
11191
- const statusColor = workflowMeta.status === "running" ? chalk7.green : workflowMeta.status === "paused" ? chalk7.yellow : workflowMeta.status === "completed" ? chalk7.gray : chalk7.red;
11289
+ const statusColor = workflowMeta.status === "running" ? chalk8.green : workflowMeta.status === "paused" ? chalk8.yellow : workflowMeta.status === "completed" ? chalk8.gray : chalk8.red;
11192
11290
  lines.push(`│ Status: ${statusColor(workflowMeta.status)}`);
11193
11291
  if (workflowMeta.agentSessions && workflowMeta.agentSessions.length > 0) {
11194
11292
  lines.push("├─ Agent Sub-sessions ─────────────────────────────────┤");
11195
11293
  workflowMeta.agentSessions.forEach((agent) => {
11196
- const agentStatusColor = agent.status === "active" ? chalk7.green : agent.status === "paused" ? chalk7.yellow : chalk7.gray;
11294
+ const agentStatusColor = agent.status === "active" ? chalk8.green : agent.status === "paused" ? chalk8.yellow : chalk8.gray;
11197
11295
  lines.push(`│ ${agent.nodeId}: ${agent.sessionId} (${agentStatusColor(agent.status)})`);
11198
11296
  });
11199
11297
  }
@@ -11220,7 +11318,7 @@ var GetCommand = {
11220
11318
  };
11221
11319
 
11222
11320
  // src/commands/sessions/new.ts
11223
- import chalk8 from "chalk";
11321
+ import chalk9 from "chalk";
11224
11322
  var NewCommand = {
11225
11323
  command: "new [options]",
11226
11324
  aliases: ["create"],
@@ -11259,7 +11357,7 @@ var NewCommand = {
11259
11357
  }
11260
11358
  });
11261
11359
  } else {
11262
- output.success(chalk8.green("✓") + " Session created: " + session.id);
11360
+ output.success(chalk9.green("✓") + " Session created: " + session.id);
11263
11361
  output.info("Title: " + session.title);
11264
11362
  output.info("Directory: " + session.directory);
11265
11363
  }
@@ -11273,7 +11371,7 @@ var NewCommand = {
11273
11371
  };
11274
11372
 
11275
11373
  // src/commands/sessions/rename.ts
11276
- import chalk9 from "chalk";
11374
+ import chalk10 from "chalk";
11277
11375
  var RenameCommand = {
11278
11376
  command: "rename <session-id> <title>",
11279
11377
  aliases: ["mv"],
@@ -11328,7 +11426,7 @@ var RenameCommand = {
11328
11426
  }
11329
11427
  });
11330
11428
  } else {
11331
- output.success(`Session renamed: ${chalk9.green(a.title)}`);
11429
+ output.success(`Session renamed: ${chalk10.green(a.title)}`);
11332
11430
  output.info(`ID: ${a.sessionId}`);
11333
11431
  }
11334
11432
  } catch (error) {
@@ -11341,7 +11439,7 @@ var RenameCommand = {
11341
11439
  };
11342
11440
 
11343
11441
  // src/commands/sessions/delete.ts
11344
- import chalk10 from "chalk";
11442
+ import chalk11 from "chalk";
11345
11443
  var DeleteCommand = {
11346
11444
  command: "delete [session-ids...]",
11347
11445
  aliases: ["rm"],
@@ -11420,7 +11518,7 @@ var DeleteCommand = {
11420
11518
  return true;
11421
11519
  });
11422
11520
  if (a.keepActive && sessionsToDelete.length > 0) {
11423
- output.log(chalk10.yellow(`Keeping active session: ${activeSessionId}`));
11521
+ output.log(chalk11.yellow(`Keeping active session: ${activeSessionId}`));
11424
11522
  }
11425
11523
  } else if (a.olderThan !== undefined) {
11426
11524
  const cutoffDate = new Date;
@@ -11437,7 +11535,7 @@ var DeleteCommand = {
11437
11535
  }
11438
11536
  return false;
11439
11537
  });
11440
- output.log(chalk10.gray(`Deleting sessions not updated since ${cutoffDate.toISOString().split("T")[0]} (${a.olderThan} days ago)`));
11538
+ output.log(chalk11.gray(`Deleting sessions not updated since ${cutoffDate.toISOString().split("T")[0]} (${a.olderThan} days ago)`));
11441
11539
  } else {
11442
11540
  output.log("No sessions to delete");
11443
11541
  return;
@@ -11447,10 +11545,10 @@ var DeleteCommand = {
11447
11545
  return;
11448
11546
  }
11449
11547
  if (a.dryRun) {
11450
- output.log(chalk10.yellow(`[DRY RUN] Would delete ${sessionsToDelete.length} session(s):
11548
+ output.log(chalk11.yellow(`[DRY RUN] Would delete ${sessionsToDelete.length} session(s):
11451
11549
  `));
11452
11550
  sessionsToDelete.forEach((s, i) => {
11453
- const marker = s.id === activeSessionId ? chalk10.green("▶") : " ";
11551
+ const marker = s.id === activeSessionId ? chalk11.green("▶") : " ";
11454
11552
  output.log(` ${marker} ${s.id}`);
11455
11553
  output.log(` Title: ${s.title}`);
11456
11554
  output.log(` Updated: ${new Date(s.updatedAt).toLocaleString()}`);
@@ -11460,11 +11558,11 @@ var DeleteCommand = {
11460
11558
  return;
11461
11559
  }
11462
11560
  if (!a.force) {
11463
- output.log(chalk10.red(`
11561
+ output.log(chalk11.red(`
11464
11562
  ⚠️ About to delete ${sessionsToDelete.length} session(s):
11465
11563
  `));
11466
11564
  sessionsToDelete.forEach((s, i) => {
11467
- const marker = s.id === activeSessionId ? chalk10.green("▶") : " ";
11565
+ const marker = s.id === activeSessionId ? chalk11.green("▶") : " ";
11468
11566
  output.log(` ${marker} ${s.id} - ${s.title}`);
11469
11567
  });
11470
11568
  output.log("");
@@ -11474,7 +11572,7 @@ var DeleteCommand = {
11474
11572
  input: process.stdin,
11475
11573
  output: process.stdout
11476
11574
  });
11477
- rl.question(chalk10.red("Type 'yes' to confirm deletion: "), (res) => {
11575
+ rl.question(chalk11.red("Type 'yes' to confirm deletion: "), (res) => {
11478
11576
  rl.close();
11479
11577
  resolve(res);
11480
11578
  });
@@ -11502,7 +11600,7 @@ var DeleteCommand = {
11502
11600
  }
11503
11601
  }
11504
11602
  if (successCount > 0) {
11505
- output.success(chalk10.green(`✓`) + ` Deleted ${successCount} session(s)`);
11603
+ output.success(chalk11.green(`✓`) + ` Deleted ${successCount} session(s)`);
11506
11604
  }
11507
11605
  if (failCount > 0) {
11508
11606
  output.error(`✗ Failed to delete ${failCount} session(s)`);
@@ -11521,7 +11619,7 @@ var DeleteCommand = {
11521
11619
  };
11522
11620
 
11523
11621
  // src/commands/sessions/messages.ts
11524
- import chalk11 from "chalk";
11622
+ import chalk12 from "chalk";
11525
11623
 
11526
11624
  // src/commands/sessions/format-message-content.ts
11527
11625
  var TEXT_MAX_CHARS = 300;
@@ -11733,20 +11831,20 @@ var MessagesCommand = {
11733
11831
  } else {
11734
11832
  const detail = a.detail === true;
11735
11833
  const roleColors = {
11736
- user: chalk11.blue,
11737
- assistant: chalk11.green,
11738
- system: chalk11.gray,
11739
- tool: chalk11.yellow
11834
+ user: chalk12.blue,
11835
+ assistant: chalk12.green,
11836
+ system: chalk12.gray,
11837
+ tool: chalk12.yellow
11740
11838
  };
11741
- output.log(chalk11.bold(`┌─ Messages (${a.sessionId}) ────────────────────────┐`));
11839
+ output.log(chalk12.bold(`┌─ Messages (${a.sessionId}) ────────────────────────┐`));
11742
11840
  messages.forEach((m, i) => {
11743
- const roleColor = roleColors[m.role] || chalk11.white;
11841
+ const roleColor = roleColors[m.role] || chalk12.white;
11744
11842
  const time = new Date(m.timestamp).toLocaleTimeString("zh-CN", {
11745
11843
  hour: "2-digit",
11746
11844
  minute: "2-digit"
11747
11845
  });
11748
11846
  if (m.metadata?.isCheckpoint) {
11749
- output.log(chalk11.cyan("├─ #" + (a.offset + i + 1) + " checkpoint") + " " + chalk11.gray(time));
11847
+ output.log(chalk12.cyan("├─ #" + (a.offset + i + 1) + " checkpoint") + " " + chalk12.gray(time));
11750
11848
  output.log("│");
11751
11849
  const checkpointContent = formatCheckpointContent(m.content, { detail });
11752
11850
  output.log("│ " + checkpointContent.split(`
@@ -11754,7 +11852,7 @@ var MessagesCommand = {
11754
11852
  │ `));
11755
11853
  output.log("│");
11756
11854
  } else {
11757
- output.log(chalk11.cyan("├─ #" + (a.offset + i + 1) + " ") + roleColor(m.role.padEnd(10)) + " " + chalk11.gray(time));
11855
+ output.log(chalk12.cyan("├─ #" + (a.offset + i + 1) + " ") + roleColor(m.role.padEnd(10)) + " " + chalk12.gray(time));
11758
11856
  const rawLines = formatMessageContent(m, { detail });
11759
11857
  const contentLines = colorizeContentLines(rawLines, m);
11760
11858
  const finalLines = detail ? contentLines : contentLines.slice(0, MAX_CONTENT_LINES);
@@ -11762,7 +11860,7 @@ var MessagesCommand = {
11762
11860
  output.log("│ " + line);
11763
11861
  }
11764
11862
  if (!detail && contentLines.length > MAX_CONTENT_LINES) {
11765
- output.log("│ " + chalk11.gray(`... (truncated, total ${contentLines.length} lines)`));
11863
+ output.log("│ " + chalk12.gray(`... (truncated, total ${contentLines.length} lines)`));
11766
11864
  }
11767
11865
  output.log("│");
11768
11866
  }
@@ -11770,7 +11868,7 @@ var MessagesCommand = {
11770
11868
  output.log("└" + "─".repeat(51) + "┘");
11771
11869
  const hasMore = a.offset + a.limit < totalMessages;
11772
11870
  const showingEnd = Math.min(a.offset + a.limit, totalMessages);
11773
- output.log(chalk11.gray(`Showing ${a.offset + 1}-${showingEnd} of ${totalMessages} messages` + (hasMore ? " (more available)" : "")));
11871
+ output.log(chalk12.gray(`Showing ${a.offset + 1}-${showingEnd} of ${totalMessages} messages` + (hasMore ? " (more available)" : "")));
11774
11872
  }
11775
11873
  } catch (error) {
11776
11874
  output.error(`Failed to get messages: ${error instanceof Error ? error.message : String(error)}`);
@@ -11783,43 +11881,43 @@ var MessagesCommand = {
11783
11881
  function colorizeContentLines(lines, _m) {
11784
11882
  return lines.map((line) => {
11785
11883
  if (line.startsWith("[Tool Call]"))
11786
- return chalk11.cyan(line);
11884
+ return chalk12.cyan(line);
11787
11885
  if (line.startsWith("[Tool Result]"))
11788
- return chalk11.yellow(line);
11886
+ return chalk12.yellow(line);
11789
11887
  if (line === "[Reasoning]")
11790
- return chalk11.magenta(line);
11888
+ return chalk12.magenta(line);
11791
11889
  if (line === "[Checkpoint]")
11792
- return chalk11.cyan(line);
11890
+ return chalk12.cyan(line);
11793
11891
  if (line.startsWith("[Node Call]"))
11794
- return chalk11.blue(line);
11892
+ return chalk12.blue(line);
11795
11893
  if (line.startsWith("[Node Interrupt]"))
11796
- return chalk11.yellow(line);
11894
+ return chalk12.yellow(line);
11797
11895
  if (line.startsWith("[Node Resume]"))
11798
- return chalk11.green(line);
11896
+ return chalk12.green(line);
11799
11897
  if (line.startsWith("[Node Start]"))
11800
- return chalk11.blue(line);
11898
+ return chalk12.blue(line);
11801
11899
  if (line.startsWith("✅") || line.startsWith("❌")) {
11802
11900
  if (line.includes("[Node Result]"))
11803
- return chalk11.green(line);
11901
+ return chalk12.green(line);
11804
11902
  if (line.includes("[Node End]"))
11805
- return chalk11.green(line);
11903
+ return chalk12.green(line);
11806
11904
  return line;
11807
11905
  }
11808
11906
  if (line.startsWith(" ")) {
11809
11907
  if (line.startsWith(" Error:"))
11810
- return chalk11.red(line);
11908
+ return chalk12.red(line);
11811
11909
  if (line.startsWith(" Query:"))
11812
- return chalk11.bold(line);
11910
+ return chalk12.bold(line);
11813
11911
  if (line.startsWith(" Options:") || line.startsWith(" agentSessionId:") || line.startsWith(" Duration:"))
11814
- return chalk11.gray(line);
11815
- return chalk11.gray(line);
11912
+ return chalk12.gray(line);
11913
+ return chalk12.gray(line);
11816
11914
  }
11817
11915
  return line;
11818
11916
  });
11819
11917
  }
11820
11918
 
11821
11919
  // src/commands/sessions/compact.ts
11822
- import chalk12 from "chalk";
11920
+ import chalk13 from "chalk";
11823
11921
  var CompactCommand = {
11824
11922
  command: "compact <session-id>",
11825
11923
  aliases: ["compress", "checkpoint"],
@@ -11873,13 +11971,13 @@ var CompactCommand = {
11873
11971
  dryRun: true
11874
11972
  });
11875
11973
  } else {
11876
- output.log(chalk12.bold("┌─ Compact Preview ─────────────────────────────────┐"));
11974
+ output.log(chalk13.bold("┌─ Compact Preview ─────────────────────────────────┐"));
11877
11975
  output.log(`│ Session: ${session.title}`);
11878
- output.log(`│ Messages to compact: ${chalk12.yellow(preview.messageCountToCompact)}`);
11976
+ output.log(`│ Messages to compact: ${chalk13.yellow(preview.messageCountToCompact)}`);
11879
11977
  output.log(`│ Estimated checkpoint tokens: ${preview.estimatedCheckpointTokens}`);
11880
- output.log(`│ Would trigger: ${preview.wouldTrigger ? chalk12.green("Yes") : chalk12.gray("No")}`);
11978
+ output.log(`│ Would trigger: ${preview.wouldTrigger ? chalk13.green("Yes") : chalk13.gray("No")}`);
11881
11979
  output.log("│");
11882
- output.log("│ " + chalk12.gray("(Dry run - no changes made)"));
11980
+ output.log("│ " + chalk13.gray("(Dry run - no changes made)"));
11883
11981
  output.log("└" + "─".repeat(51) + "┘");
11884
11982
  }
11885
11983
  return;
@@ -11894,10 +11992,10 @@ var CompactCommand = {
11894
11992
  try {
11895
11993
  scenarioHint = await sessionComponent.generateCompactHint(a.sessionId);
11896
11994
  if (!a.json) {
11897
- output.log(chalk12.bold("├─ Auto-generated Scenario Hint ──────────────────────────┤"));
11898
- output.log("│ " + chalk12.cyan(scenarioHint.substring(0, 70)));
11995
+ output.log(chalk13.bold("├─ Auto-generated Scenario Hint ──────────────────────────┤"));
11996
+ output.log("│ " + chalk13.cyan(scenarioHint.substring(0, 70)));
11899
11997
  if (scenarioHint.length > 70) {
11900
- output.log(chalk12.gray("│ ") + scenarioHint.substring(70, 140));
11998
+ output.log(chalk13.gray("│ ") + scenarioHint.substring(70, 140));
11901
11999
  }
11902
12000
  }
11903
12001
  } catch (hintError) {
@@ -11944,29 +12042,29 @@ var CompactCommand = {
11944
12042
  }
11945
12043
  });
11946
12044
  } else {
11947
- output.log(chalk12.bold.green("┌─ Checkpoint Created ────────────────────────────────┐"));
12045
+ output.log(chalk13.bold.green("┌─ Checkpoint Created ────────────────────────────────┐"));
11948
12046
  output.log(`│ ID: ${result.checkpoint.id}`);
11949
12047
  output.log(`│ Title: ${result.checkpoint.title}`);
11950
12048
  output.log(`│ Type: compact`);
11951
12049
  output.log(`│ Created: ${new Date(result.checkpoint.createdAt).toLocaleString("zh-CN")}`);
11952
- output.log(chalk12.bold("├─ Scenario Hint ────────────────────────────────────┤"));
12050
+ output.log(chalk13.bold("├─ Scenario Hint ────────────────────────────────────┤"));
11953
12051
  if (scenarioHint) {
11954
12052
  const hintLines = scenarioHint.split(`
11955
12053
  `);
11956
12054
  hintLines.forEach((line, i) => {
11957
12055
  if (i === 0) {
11958
- output.log(chalk12.cyan("│ " + line.substring(0, 48)));
12056
+ output.log(chalk13.cyan("│ " + line.substring(0, 48)));
11959
12057
  if (line.length > 48) {
11960
12058
  for (let j = 48;j < line.length; j += 48) {
11961
- output.log(chalk12.gray("│ ") + line.substring(j, j + 48));
12059
+ output.log(chalk13.gray("│ ") + line.substring(j, j + 48));
11962
12060
  }
11963
12061
  }
11964
12062
  } else {
11965
- output.log(chalk12.gray("│ ") + line);
12063
+ output.log(chalk13.gray("│ ") + line);
11966
12064
  }
11967
12065
  });
11968
12066
  } else {
11969
- output.log(chalk12.gray("│ (no hint)"));
12067
+ output.log(chalk13.gray("│ (no hint)"));
11970
12068
  }
11971
12069
  output.log("├─ Process Key Points ─────────────────────────────────┤");
11972
12070
  result.checkpoint.processKeyPoints.forEach((p, i) => {
@@ -11991,11 +12089,11 @@ var CompactCommand = {
11991
12089
  result.checkpoint.recentMessages.forEach((msg) => {
11992
12090
  const prefix = msg.role === "user" ? "\uD83D\uDC64" : "\uD83E\uDD16";
11993
12091
  const content = msg.content.length > 60 ? msg.content.substring(0, 60) + "..." : msg.content;
11994
- output.log(chalk12.gray(`│ ${prefix} [${msg.role}] ${content}`));
12092
+ output.log(chalk13.gray(`│ ${prefix} [${msg.role}] ${content}`));
11995
12093
  });
11996
12094
  }
11997
12095
  output.log("├─ Stats ─────────────────────────────────────────────┤");
11998
- output.log(`│ Messages compacted: ${chalk12.yellow(result.deletedMessageCount)}`);
12096
+ output.log(`│ Messages compacted: ${chalk13.yellow(result.deletedMessageCount)}`);
11999
12097
  output.log(`│ Remaining messages: ${result.remainingMessageCount}`);
12000
12098
  output.log(`│ Total checkpoints: ${result.checkpointCount}`);
12001
12099
  output.log("└" + "─".repeat(51) + "┘");
@@ -12013,7 +12111,7 @@ var CompactCommand = {
12013
12111
  };
12014
12112
 
12015
12113
  // src/commands/sessions/checkpoints.ts
12016
- import chalk13 from "chalk";
12114
+ import chalk14 from "chalk";
12017
12115
  var CheckpointsCommand = {
12018
12116
  command: "checkpoints <session-id>",
12019
12117
  aliases: ["cps"],
@@ -12046,7 +12144,7 @@ var CheckpointsCommand = {
12046
12144
  }
12047
12145
  const checkpoints = await sessionComponent.getCheckpoints(a.sessionId);
12048
12146
  if (checkpoints.length === 0) {
12049
- output.log(chalk13.gray("No checkpoints for this session"));
12147
+ output.log(chalk14.gray("No checkpoints for this session"));
12050
12148
  return;
12051
12149
  }
12052
12150
  if (a.json) {
@@ -12071,7 +12169,7 @@ var CheckpointsCommand = {
12071
12169
  if (a.detail) {
12072
12170
  checkpoints.reverse().forEach((cp, i) => {
12073
12171
  const isLatest = i === 0;
12074
- output.log(chalk13.bold(`┌─ Checkpoint: ${cp.title} ${isLatest ? chalk13.green("✓") : ""} ──────` + "─".repeat(Math.max(0, 30 - cp.title.length)) + "┐"));
12172
+ output.log(chalk14.bold(`┌─ Checkpoint: ${cp.title} ${isLatest ? chalk14.green("✓") : ""} ──────` + "─".repeat(Math.max(0, 30 - cp.title.length)) + "┐"));
12075
12173
  output.log(`│ ID: ${cp.id}`);
12076
12174
  output.log(`│ Type: ${cp.type}`);
12077
12175
  output.log(`│ Message Index: ${cp.messageIndex} (${cp.messageCountBefore} messages)`);
@@ -12099,18 +12197,18 @@ var CheckpointsCommand = {
12099
12197
  });
12100
12198
  } else {
12101
12199
  const header = [
12102
- chalk13.bold("#"),
12103
- chalk13.bold("Title"),
12104
- chalk13.bold("Type"),
12105
- chalk13.bold("Messages"),
12106
- chalk13.bold("Created")
12200
+ chalk14.bold("#"),
12201
+ chalk14.bold("Title"),
12202
+ chalk14.bold("Type"),
12203
+ chalk14.bold("Messages"),
12204
+ chalk14.bold("Created")
12107
12205
  ].join(" │ ");
12108
12206
  output.log(`┌─ Checkpoints (${checkpoints.length}) ${"─".repeat(40)}┐`);
12109
12207
  output.log(`│${header}│`);
12110
12208
  output.log("├" + "─".repeat(header.length + 2) + "┤");
12111
12209
  checkpoints.reverse().forEach((cp, i) => {
12112
12210
  const isLatest = i === 0;
12113
- const marker = isLatest ? chalk13.green("✓ ") : " ";
12211
+ const marker = isLatest ? chalk14.green("✓ ") : " ";
12114
12212
  const title = cp.title.length > 25 ? cp.title.slice(0, 22) + "..." : cp.title;
12115
12213
  const created = new Date(cp.createdAt).toLocaleString("zh-CN", {
12116
12214
  month: "2-digit",
@@ -12118,7 +12216,7 @@ var CheckpointsCommand = {
12118
12216
  hour: "2-digit",
12119
12217
  minute: "2-digit"
12120
12218
  });
12121
- output.log(`│${marker}${i + 1} ${title.padEnd(25)} │ ${cp.type.padEnd(5)} │ ${cp.messageCountBefore.toString().padStart(8)} │ ${chalk13.gray(created)}│`);
12219
+ output.log(`│${marker}${i + 1} ${title.padEnd(25)} │ ${cp.type.padEnd(5)} │ ${cp.messageCountBefore.toString().padStart(8)} │ ${chalk14.gray(created)}│`);
12122
12220
  });
12123
12221
  output.log("└" + "─".repeat(header.length + 2) + "┘");
12124
12222
  }
@@ -12132,7 +12230,7 @@ var CheckpointsCommand = {
12132
12230
  };
12133
12231
 
12134
12232
  // src/commands/sessions/active.ts
12135
- import chalk14 from "chalk";
12233
+ import chalk15 from "chalk";
12136
12234
  var ActiveCommand = {
12137
12235
  command: "active",
12138
12236
  aliases: ["current"],
@@ -12159,7 +12257,7 @@ var ActiveCommand = {
12159
12257
  return;
12160
12258
  }
12161
12259
  if (!activeId) {
12162
- output.log(chalk14.gray("No active session set"));
12260
+ output.log(chalk15.gray("No active session set"));
12163
12261
  return;
12164
12262
  }
12165
12263
  const session = await sessionComponent.get(activeId);
@@ -12177,10 +12275,10 @@ var ActiveCommand = {
12177
12275
  });
12178
12276
  } else {
12179
12277
  if (!session) {
12180
- output.log(chalk14.gray("Active session not found: " + activeId));
12278
+ output.log(chalk15.gray("Active session not found: " + activeId));
12181
12279
  return;
12182
12280
  }
12183
- output.log(chalk14.bold.green("┌─ Active Session ─────────────────────────────────┐"));
12281
+ output.log(chalk15.bold.green("┌─ Active Session ─────────────────────────────────┐"));
12184
12282
  output.log(`│ ID: ${session.id}`);
12185
12283
  output.log(`│ Title: ${session.title}`);
12186
12284
  output.log(`│ Directory: ${session.directory}`);
@@ -12262,7 +12360,7 @@ var AddMessageCommand = {
12262
12360
  };
12263
12361
 
12264
12362
  // src/commands/sessions/mock.ts
12265
- import chalk15 from "chalk";
12363
+ import chalk16 from "chalk";
12266
12364
  var MOCK_SEQUENCES = [
12267
12365
  {
12268
12366
  name: "文件操作流程",
@@ -12395,7 +12493,7 @@ var MockCommand = {
12395
12493
  for (let seqIdx = 0;seqIdx < count; seqIdx++) {
12396
12494
  const sequence = MOCK_SEQUENCES[seqIdx];
12397
12495
  if (!a.json) {
12398
- output.log(chalk15.bold(`
12496
+ output.log(chalk16.bold(`
12399
12497
  \uD83D\uDCDD Sequence ${seqIdx + 1}: ${sequence.name}`));
12400
12498
  }
12401
12499
  for (const msg of sequence.messages) {
@@ -12413,7 +12511,7 @@ ${JSON.stringify(tc.args, null, 2)}
12413
12511
  if (assistantMsgId)
12414
12512
  addedMessages.push(assistantMsgId);
12415
12513
  if (!a.json) {
12416
- output.log(chalk15.cyan(` [${addedMessages.length}] assistant: \uD83D\uDD27 Tool call`));
12514
+ output.log(chalk16.cyan(` [${addedMessages.length}] assistant: \uD83D\uDD27 Tool call`));
12417
12515
  }
12418
12516
  const toolMsgId = await sessionComponent.addMessage(a.sessionId, {
12419
12517
  role: "tool",
@@ -12422,7 +12520,7 @@ ${JSON.stringify(tc.args, null, 2)}
12422
12520
  if (toolMsgId)
12423
12521
  addedMessages.push(toolMsgId);
12424
12522
  if (!a.json) {
12425
- output.log(chalk15.yellow(` [${addedMessages.length}] tool: ${msg.content.substring(0, 50)}...`));
12523
+ output.log(chalk16.yellow(` [${addedMessages.length}] tool: ${msg.content.substring(0, 50)}...`));
12426
12524
  }
12427
12525
  } else {
12428
12526
  const msgId = await sessionComponent.addMessage(a.sessionId, {
@@ -12432,7 +12530,7 @@ ${JSON.stringify(tc.args, null, 2)}
12432
12530
  if (msgId)
12433
12531
  addedMessages.push(msgId);
12434
12532
  if (!a.json) {
12435
- const roleColor = msg.role === "user" ? chalk15.green : msg.role === "assistant" ? chalk15.cyan : chalk15.gray;
12533
+ const roleColor = msg.role === "user" ? chalk16.green : msg.role === "assistant" ? chalk16.cyan : chalk16.gray;
12436
12534
  output.log(roleColor(` [${addedMessages.length}] ${msg.role}: ${msg.content.substring(0, 50)}...`));
12437
12535
  }
12438
12536
  }
@@ -12448,14 +12546,14 @@ ${JSON.stringify(tc.args, null, 2)}
12448
12546
  });
12449
12547
  } else {
12450
12548
  output.log(`
12451
- ` + chalk15.bold.green("✅ Mock data inserted successfully!"));
12549
+ ` + chalk16.bold.green("✅ Mock data inserted successfully!"));
12452
12550
  output.log(` Session: ${a.sessionId}`);
12453
12551
  output.log(` Sequences: ${count}`);
12454
12552
  output.log(` Messages: ${addedMessages.length}`);
12455
12553
  output.log("");
12456
- output.log(chalk15.gray(" Now run: "));
12457
- output.log(chalk15.gray(` roy-agent sessions compact ${a.sessionId}`));
12458
- output.log(chalk15.gray(" to trigger checkpoint generation"));
12554
+ output.log(chalk16.gray(" Now run: "));
12555
+ output.log(chalk16.gray(` roy-agent sessions compact ${a.sessionId}`));
12556
+ output.log(chalk16.gray(" to trigger checkpoint generation"));
12459
12557
  }
12460
12558
  } finally {
12461
12559
  await envService.dispose();
@@ -12464,7 +12562,7 @@ ${JSON.stringify(tc.args, null, 2)}
12464
12562
  };
12465
12563
 
12466
12564
  // src/commands/sessions/grep.ts
12467
- import chalk16 from "chalk";
12565
+ import chalk17 from "chalk";
12468
12566
  var GrepCommand = {
12469
12567
  command: "grep <query...>",
12470
12568
  aliases: ["search"],
@@ -12544,7 +12642,7 @@ var GrepCommand = {
12544
12642
  const results = await sessionComponent.searchMessages(searchOptions);
12545
12643
  if (results.length === 0) {
12546
12644
  if (!a.quiet) {
12547
- output.log(chalk16.yellow(`No results found for: ${query}`));
12645
+ output.log(chalk17.yellow(`No results found for: ${query}`));
12548
12646
  }
12549
12647
  return;
12550
12648
  }
@@ -12571,7 +12669,7 @@ var GrepCommand = {
12571
12669
  for (const result of results) {
12572
12670
  for (const match of result.matches) {
12573
12671
  const time = new Date(match.timestamp).toLocaleString("zh-CN");
12574
- output.log(`${chalk16.gray(result.sessionId)} ${chalk16.blue(result.sessionTitle)} ${chalk16.gray(time)}`);
12672
+ output.log(`${chalk17.gray(result.sessionId)} ${chalk17.blue(result.sessionTitle)} ${chalk17.gray(time)}`);
12575
12673
  output.log(` ${match.content}`);
12576
12674
  output.log("");
12577
12675
  }
@@ -12583,40 +12681,40 @@ var GrepCommand = {
12583
12681
  totalMatches += result.matches.length;
12584
12682
  const time = new Date(result.updatedAt).toLocaleString("zh-CN");
12585
12683
  const titleStr = `─ ${result.sessionTitle} (${result.sessionId})`;
12586
- output.log(chalk16.bold(`
12684
+ output.log(chalk17.bold(`
12587
12685
  ┌${titleStr}${"─".repeat(Math.max(0, 50 - titleStr.length))}┐`));
12588
- output.log(`│ ${chalk16.gray(`Updated: ${time} | ${result.messageCount} messages | ${result.matches.length} matches`)}${" ".repeat(Math.max(0, 50 - 60))}│`);
12686
+ output.log(`│ ${chalk17.gray(`Updated: ${time} | ${result.messageCount} messages | ${result.matches.length} matches`)}${" ".repeat(Math.max(0, 50 - 60))}│`);
12589
12687
  for (let i = 0;i < result.matches.length; i++) {
12590
12688
  const match = result.matches[i];
12591
- const roleColor = match.role === "user" ? chalk16.blue : match.role === "assistant" ? chalk16.green : chalk16.gray;
12689
+ const roleColor = match.role === "user" ? chalk17.blue : match.role === "assistant" ? chalk17.green : chalk17.gray;
12592
12690
  const msgTime = new Date(match.timestamp).toLocaleTimeString("zh-CN", {
12593
12691
  hour: "2-digit",
12594
12692
  minute: "2-digit"
12595
12693
  });
12596
- output.log(`├─ #${i + 1} ${roleColor(match.role.padEnd(10))} ${chalk16.gray(msgTime)}`);
12694
+ output.log(`├─ #${i + 1} ${roleColor(match.role.padEnd(10))} ${chalk17.gray(msgTime)}`);
12597
12695
  output.log("│");
12598
12696
  const lines = match.content.split(`
12599
12697
  `).map((line) => line.trim()).filter((line) => line.length > 0);
12600
12698
  const maxLines = 5;
12601
12699
  const displayLines = lines.slice(0, maxLines);
12602
12700
  if (displayLines.length === 0) {
12603
- output.log("│ " + chalk16.gray("(empty content)"));
12701
+ output.log("│ " + chalk17.gray("(empty content)"));
12604
12702
  } else {
12605
12703
  for (const line of displayLines) {
12606
12704
  const truncated = line.length > 76 ? line.slice(0, 73) + "..." : line;
12607
- output.log(`│ ${chalk16.gray(truncated)}`);
12705
+ output.log(`│ ${chalk17.gray(truncated)}`);
12608
12706
  }
12609
12707
  }
12610
12708
  if (lines.length > maxLines) {
12611
- output.log("│ " + chalk16.gray(`... (${lines.length - maxLines} more lines)`));
12709
+ output.log("│ " + chalk17.gray(`... (${lines.length - maxLines} more lines)`));
12612
12710
  }
12613
12711
  output.log("│");
12614
12712
  }
12615
12713
  output.log(`└${"─".repeat(52)}┘`);
12616
12714
  }
12617
12715
  output.log(`
12618
- ${chalk16.green("✓")} Found ${chalk16.bold(totalMatches.toString())} matches in ${chalk16.bold(results.length.toString())} sessions`);
12619
- output.log(chalk16.gray(`Query: "${query}"`));
12716
+ ${chalk17.green("✓")} Found ${chalk17.bold(totalMatches.toString())} matches in ${chalk17.bold(results.length.toString())} sessions`);
12717
+ output.log(chalk17.gray(`Query: "${query}"`));
12620
12718
  }
12621
12719
  } catch (error) {
12622
12720
  output.error(`Search failed: ${error instanceof Error ? error.message : String(error)}`);
@@ -12655,7 +12753,7 @@ var SessionsCommand = {
12655
12753
  };
12656
12754
 
12657
12755
  // src/commands/tasks/list.ts
12658
- import chalk17 from "chalk";
12756
+ import chalk18 from "chalk";
12659
12757
 
12660
12758
  // src/commands/tasks/_build-list-json.ts
12661
12759
  function buildListTasksJson(tasks, total, args, extras) {
@@ -12703,7 +12801,7 @@ var ListCommand2 = {
12703
12801
  type: "string",
12704
12802
  choices: ["normal", "cycle", "longterm"],
12705
12803
  description: "按任务类型筛选"
12706
- }).option("limit", { alias: "n", type: "number", default: 20, description: "返回数量" }).option("offset", { type: "number", default: 0, description: "偏移量" }).option("depth", {
12804
+ }).option("limit", { alias: "n", type: "number", default: 20, description: "返回数量" }).option("offset", { alias: "o", type: "number", default: 0, description: "分页偏移(-o alias)" }).option("depth", {
12707
12805
  type: "number",
12708
12806
  description: "检索层级深度:0=只根任务(无父任务),1=根+一层子任务,2=根+二层子任务,-1 或忽略=全部"
12709
12807
  }).option("include-archived", {
@@ -12741,20 +12839,29 @@ var ListCommand2 = {
12741
12839
  if (args.json) {
12742
12840
  output.json(buildListTasksJson(tasks, total, args));
12743
12841
  } else if (args.quiet) {
12744
- tasks.forEach((t) => output.log(t.id.toString()));
12842
+ output.log(renderQuietHeader(total, "task"));
12843
+ tasks.forEach((t) => output.log(renderQuietLine(t.id, t.title)));
12844
+ const hint = renderQuietPaginationHint({
12845
+ count: tasks.length,
12846
+ total,
12847
+ offset: args.offset ?? 0,
12848
+ limit: args.limit ?? 20
12849
+ });
12850
+ if (hint)
12851
+ output.log(hint);
12745
12852
  } else {
12746
12853
  const header = [
12747
- chalk17.bold("#"),
12748
- chalk17.bold("Title"),
12749
- chalk17.bold("Status"),
12750
- chalk17.bold("Priority"),
12751
- chalk17.bold("Type"),
12752
- chalk17.bold("Progress"),
12753
- chalk17.bold("Parent")
12854
+ chalk18.bold("#"),
12855
+ chalk18.bold("Title"),
12856
+ chalk18.bold("Status"),
12857
+ chalk18.bold("Priority"),
12858
+ chalk18.bold("Type"),
12859
+ chalk18.bold("Progress"),
12860
+ chalk18.bold("Parent")
12754
12861
  ].join(" │ ");
12755
12862
  const rows = tasks.map((t, i) => {
12756
- const statusColor = t.status === "completed" ? chalk17.green : t.status === "active" ? chalk17.blue : t.status === "paused" ? chalk17.yellow : t.status === "cancelled" ? chalk17.strikethrough : chalk17.gray;
12757
- const priorityColor = t.priority === "high" ? chalk17.red : t.priority === "medium" ? chalk17.yellow : chalk17.gray;
12863
+ const statusColor = t.status === "completed" ? chalk18.green : t.status === "active" ? chalk18.blue : t.status === "paused" ? chalk18.yellow : t.status === "cancelled" ? chalk18.strikethrough : chalk18.gray;
12864
+ const priorityColor = t.priority === "high" ? chalk18.red : t.priority === "medium" ? chalk18.yellow : chalk18.gray;
12758
12865
  return [
12759
12866
  (args.offset + i + 1).toString(),
12760
12867
  t.title.length > 30 ? t.title.slice(0, 27) + "..." : t.title,
@@ -12762,11 +12869,11 @@ var ListCommand2 = {
12762
12869
  priorityColor(t.priority),
12763
12870
  t.type || "normal",
12764
12871
  `${t.progress}%`,
12765
- t.parent_task_id ? `#${t.parent_task_id}` : chalk17.gray("root")
12872
+ t.parent_task_id ? `#${t.parent_task_id}` : chalk18.gray("root")
12766
12873
  ].join(" │ ");
12767
12874
  });
12768
- const depthNote = args.depth !== undefined ? chalk17.gray(` depth=${args.depth}`) : "";
12769
- const archivedNote = args.includeArchived ? chalk17.gray(" include-archived") : "";
12875
+ const depthNote = args.depth !== undefined ? chalk18.gray(` depth=${args.depth}`) : "";
12876
+ const archivedNote = args.includeArchived ? chalk18.gray(" include-archived") : "";
12770
12877
  output.log([
12771
12878
  `┌─ Tasks ${"─".repeat(55)}┐`,
12772
12879
  `│${header}│`,
@@ -12774,7 +12881,7 @@ var ListCommand2 = {
12774
12881
  ...rows.map((r) => `│${r}│`),
12775
12882
  "└" + "─".repeat(header.length + 2) + "┘",
12776
12883
  "",
12777
- chalk17.gray(`Showing ${tasks.length} of ${total} tasks (offset=${args.offset}, limit=${args.limit})${depthNote}${archivedNote}`)
12884
+ chalk18.gray(`Showing ${tasks.length} of ${total} tasks (offset=${args.offset}, limit=${args.limit})${depthNote}${archivedNote}`)
12778
12885
  ].join(`
12779
12886
  `));
12780
12887
  }
@@ -12788,7 +12895,7 @@ var ListCommand2 = {
12788
12895
  };
12789
12896
 
12790
12897
  // src/commands/tasks/get.ts
12791
- import chalk18 from "chalk";
12898
+ import chalk19 from "chalk";
12792
12899
  var GetCommand2 = {
12793
12900
  command: "get <id>",
12794
12901
  aliases: ["show"],
@@ -12827,10 +12934,10 @@ var GetCommand2 = {
12827
12934
  if (args.json) {
12828
12935
  output.json(result);
12829
12936
  } else {
12830
- output.log(chalk18.bold(`
12937
+ output.log(chalk19.bold(`
12831
12938
  Task #${result.task.id}: ${result.task.title}
12832
12939
  `));
12833
- output.log(`Status: ${chalk18.blue(result.task.status)} | Priority: ${result.task.priority} | Type: ${result.task.type} | Progress: ${result.task.progress}%`);
12940
+ output.log(`Status: ${chalk19.blue(result.task.status)} | Priority: ${result.task.priority} | Type: ${result.task.type} | Progress: ${result.task.progress}%`);
12834
12941
  output.log(`Created: ${result.task.createdAt} | Updated: ${result.task.updatedAt}`);
12835
12942
  output.log(`Project Path: ${result.task.project_path}`);
12836
12943
  output.log(`Context: ${result.task.context}`);
@@ -12838,7 +12945,7 @@ Task #${result.task.id}: ${result.task.title}
12838
12945
  output.log(`
12839
12946
  Current Status: ${result.task.current_status}`);
12840
12947
  }
12841
- output.log(chalk18.bold(`
12948
+ output.log(chalk19.bold(`
12842
12949
  Operations (${result.operations.length}):
12843
12950
  `));
12844
12951
  result.operations.forEach((op, i) => {
@@ -12858,10 +12965,10 @@ Operations (${result.operations.length}):
12858
12965
  if (args.json) {
12859
12966
  output.json(task);
12860
12967
  } else {
12861
- output.log(chalk18.bold(`
12968
+ output.log(chalk19.bold(`
12862
12969
  Task #${task.id}: ${task.title}
12863
12970
  `));
12864
- output.log(`Status: ${chalk18.blue(task.status)} | Priority: ${task.priority} | Type: ${task.type} | Progress: ${task.progress}%`);
12971
+ output.log(`Status: ${chalk19.blue(task.status)} | Priority: ${task.priority} | Type: ${task.type} | Progress: ${task.progress}%`);
12865
12972
  output.log(`Created: ${task.createdAt} | Updated: ${task.updatedAt}`);
12866
12973
  output.log(`Project Path: ${task.project_path}`);
12867
12974
  output.log(`Context: ${task.context}`);
@@ -12885,7 +12992,7 @@ Description: ${task.description}`);
12885
12992
  };
12886
12993
 
12887
12994
  // src/commands/tasks/create.ts
12888
- import chalk19 from "chalk";
12995
+ import chalk20 from "chalk";
12889
12996
  var CreateCommand = {
12890
12997
  command: "create <title>",
12891
12998
  aliases: ["add", "new"],
@@ -12963,7 +13070,7 @@ var CreateCommand = {
12963
13070
  if (args.json) {
12964
13071
  output.json(task);
12965
13072
  } else {
12966
- output.log(chalk19.green(`
13073
+ output.log(chalk20.green(`
12967
13074
  ✓ Task created: #${task.id}`));
12968
13075
  output.log(` Title: ${task.title}`);
12969
13076
  output.log(` Status: ${task.status}`);
@@ -12981,7 +13088,7 @@ var CreateCommand = {
12981
13088
  };
12982
13089
 
12983
13090
  // src/commands/tasks/update.ts
12984
- import chalk20 from "chalk";
13091
+ import chalk21 from "chalk";
12985
13092
  var UpdateCommand = {
12986
13093
  command: "update <id>",
12987
13094
  aliases: ["set"],
@@ -13039,7 +13146,7 @@ var UpdateCommand = {
13039
13146
  if (args.json) {
13040
13147
  output.json(task);
13041
13148
  } else {
13042
- output.log(chalk20.green(`
13149
+ output.log(chalk21.green(`
13043
13150
  ✓ Task updated: #${task.id}`));
13044
13151
  output.log(` Title: ${task.title}`);
13045
13152
  output.log(` Status: ${task.status}`);
@@ -13062,7 +13169,7 @@ var UpdateCommand = {
13062
13169
  };
13063
13170
 
13064
13171
  // src/commands/tasks/delete.ts
13065
- import chalk21 from "chalk";
13172
+ import chalk22 from "chalk";
13066
13173
  var DeleteCommand2 = {
13067
13174
  command: "delete <id>",
13068
13175
  aliases: ["remove", "rm", "del"],
@@ -13098,16 +13205,16 @@ var DeleteCommand2 = {
13098
13205
  process.exit(1);
13099
13206
  }
13100
13207
  if (!args.force) {
13101
- output.log(chalk21.yellow(`Are you sure you want to delete task #${args.id}?`));
13102
- output.log(chalk21.yellow(` Title: ${task.title}`));
13103
- output.log(chalk21.yellow(` Status: ${task.status}`));
13104
- output.log(chalk21.yellow(`
13208
+ output.log(chalk22.yellow(`Are you sure you want to delete task #${args.id}?`));
13209
+ output.log(chalk22.yellow(` Title: ${task.title}`));
13210
+ output.log(chalk22.yellow(` Status: ${task.status}`));
13211
+ output.log(chalk22.yellow(`
13105
13212
  Use --force to skip this confirmation`));
13106
13213
  process.exit(1);
13107
13214
  }
13108
13215
  const deleted = await taskComponent.deleteTask(args.id);
13109
13216
  if (deleted) {
13110
- output.log(chalk21.green(`
13217
+ output.log(chalk22.green(`
13111
13218
  ✓ Task deleted: #${args.id}`));
13112
13219
  } else {
13113
13220
  output.error(`Failed to delete task: ${args.id}`);
@@ -13123,7 +13230,7 @@ Use --force to skip this confirmation`));
13123
13230
  };
13124
13231
 
13125
13232
  // src/commands/tasks/complete.ts
13126
- import chalk22 from "chalk";
13233
+ import chalk23 from "chalk";
13127
13234
  var CompleteCommand = {
13128
13235
  command: "complete <id>",
13129
13236
  aliases: ["done", "finish"],
@@ -13180,7 +13287,7 @@ var CompleteCommand = {
13180
13287
  if (args.json) {
13181
13288
  output.json(task);
13182
13289
  } else {
13183
- output.log(chalk22.green(`
13290
+ output.log(chalk23.green(`
13184
13291
  ✓ Task completed: #${task.id}`));
13185
13292
  output.log(` Title: ${task.title}`);
13186
13293
  output.log(` Progress: ${task.progress}%`);
@@ -13196,7 +13303,7 @@ var CompleteCommand = {
13196
13303
  };
13197
13304
 
13198
13305
  // src/commands/tasks/operations.ts
13199
- import chalk23 from "chalk";
13306
+ import chalk24 from "chalk";
13200
13307
  var OperationsCommand = {
13201
13308
  command: "operations <task-id>",
13202
13309
  aliases: ["ops", "log"],
@@ -13246,23 +13353,23 @@ var OperationsCommand = {
13246
13353
  operations
13247
13354
  });
13248
13355
  } else {
13249
- output.log(chalk23.bold(`
13356
+ output.log(chalk24.bold(`
13250
13357
  Operations for Task #${task.id}: ${task.title}
13251
13358
  `));
13252
13359
  if (operations.length === 0) {
13253
- output.log(chalk23.gray("No operations found."));
13360
+ output.log(chalk24.gray("No operations found."));
13254
13361
  } else {
13255
13362
  operations.forEach((op, i) => {
13256
- const actionColor = op.actionType === "completed" ? chalk23.green : op.actionType === "milestone" ? chalk23.blue : op.actionType === "problem" ? chalk23.red : chalk23.gray;
13257
- output.log(`${chalk23.bold(a.offset + i + 1)}. ` + actionColor(`[${op.actionType}]`) + ` ${op.actionTitle}`);
13258
- output.log(` Session: ${chalk23.cyan(op.sessionId)} | Time: ${op.timestamp}`);
13363
+ const actionColor = op.actionType === "completed" ? chalk24.green : op.actionType === "milestone" ? chalk24.blue : op.actionType === "problem" ? chalk24.red : chalk24.gray;
13364
+ output.log(`${chalk24.bold(a.offset + i + 1)}. ` + actionColor(`[${op.actionType}]`) + ` ${op.actionTitle}`);
13365
+ output.log(` Session: ${chalk24.cyan(op.sessionId)} | Time: ${op.timestamp}`);
13259
13366
  if (op.actionDescription) {
13260
13367
  output.log(` ${op.actionDescription}`);
13261
13368
  }
13262
13369
  output.log("");
13263
13370
  });
13264
13371
  }
13265
- output.log(chalk23.gray(`Total: ${operations.length} operations`));
13372
+ output.log(chalk24.gray(`Total: ${operations.length} operations`));
13266
13373
  }
13267
13374
  } catch (error) {
13268
13375
  output.error(`Failed to list operations: ${error}`);
@@ -13274,7 +13381,7 @@ Operations for Task #${task.id}: ${task.title}
13274
13381
  };
13275
13382
 
13276
13383
  // src/commands/tasks/tree.ts
13277
- import chalk24 from "chalk";
13384
+ import chalk25 from "chalk";
13278
13385
  function buildTree(tasks) {
13279
13386
  const byParent = new Map;
13280
13387
  const nodeById = new Map;
@@ -13309,7 +13416,7 @@ function printTree(nodes, prefix, isRoot, output, currentDepth, maxDepth) {
13309
13416
  const statusColor = colorByStatus(node.task.status);
13310
13417
  const typeLabel = node.task.type ? ` [${node.task.type}]` : "";
13311
13418
  const progressLabel = node.task.progress > 0 ? ` (${node.task.progress}%)` : "";
13312
- const header = `#${node.task.id}${typeLabel} ${node.task.title} ${chalk24.gray("[" + node.task.status + "]")}${progressLabel}`;
13419
+ const header = `#${node.task.id}${typeLabel} ${node.task.title} ${chalk25.gray("[" + node.task.status + "]")}${progressLabel}`;
13313
13420
  output.log(prefix + connector + statusColor(header));
13314
13421
  if (node.children.length > 0) {
13315
13422
  const childPrefix = isRoot ? prefix : prefix + (isLast ? " " : "│ ");
@@ -13320,15 +13427,15 @@ function printTree(nodes, prefix, isRoot, output, currentDepth, maxDepth) {
13320
13427
  function colorByStatus(status) {
13321
13428
  switch (status) {
13322
13429
  case "completed":
13323
- return chalk24.green;
13430
+ return chalk25.green;
13324
13431
  case "active":
13325
- return chalk24.blue;
13432
+ return chalk25.blue;
13326
13433
  case "paused":
13327
- return chalk24.yellow;
13434
+ return chalk25.yellow;
13328
13435
  case "cancelled":
13329
- return chalk24.strikethrough;
13436
+ return chalk25.strikethrough;
13330
13437
  default:
13331
- return chalk24.gray;
13438
+ return chalk25.gray;
13332
13439
  }
13333
13440
  }
13334
13441
  var TreeCommand = {
@@ -13415,10 +13522,10 @@ var TreeCommand = {
13415
13522
  }
13416
13523
  const tree = buildTree(tasks);
13417
13524
  if (tree.length === 0) {
13418
- output.log(chalk24.gray("No tasks to display."));
13525
+ output.log(chalk25.gray("No tasks to display."));
13419
13526
  return;
13420
13527
  }
13421
- output.log(chalk24.bold(`Task Tree (${tasks.length} tasks, ${tree.length} roots)`) + (args.rootId !== undefined ? chalk24.gray(` — subtree of #${args.rootId}`) : ""));
13528
+ output.log(chalk25.bold(`Task Tree (${tasks.length} tasks, ${tree.length} roots)`) + (args.rootId !== undefined ? chalk25.gray(` — subtree of #${args.rootId}`) : ""));
13422
13529
  output.log("");
13423
13530
  printTree(tree, "", true, output, 0, args.maxDepth);
13424
13531
  } catch (error) {
@@ -13431,7 +13538,7 @@ var TreeCommand = {
13431
13538
  };
13432
13539
 
13433
13540
  // src/commands/tasks/search.ts
13434
- import chalk25 from "chalk";
13541
+ import chalk26 from "chalk";
13435
13542
  var SearchCommand = {
13436
13543
  command: "search <keywords..>",
13437
13544
  aliases: ["find", "grep"],
@@ -13441,7 +13548,7 @@ var SearchCommand = {
13441
13548
  array: true,
13442
13549
  describe: "搜索关键词(多个关键词 AND 逻辑)",
13443
13550
  demandOption: true
13444
- }).option("limit", { alias: "n", type: "number", default: 20, description: "返回数量" }).option("offset", { type: "number", default: 0, description: "偏移量" }).option("status", {
13551
+ }).option("limit", { alias: "n", type: "number", default: 20, description: "返回数量" }).option("offset", { alias: "o", type: "number", default: 0, description: "分页偏移(-o alias)" }).option("status", {
13445
13552
  alias: "s",
13446
13553
  type: "string",
13447
13554
  choices: ["todo", "active", "completed", "paused", "cancelled", "archived"],
@@ -13492,29 +13599,38 @@ var SearchCommand = {
13492
13599
  if (args.json) {
13493
13600
  output.json(buildListTasksJson(tasks, total, { limit: args.limit, offset: args.offset }, { keywords: args.keywords }));
13494
13601
  } else if (args.quiet) {
13495
- tasks.forEach((t) => output.log(t.id.toString()));
13602
+ output.log(renderQuietHeader(total, "task"));
13603
+ tasks.forEach((t) => output.log(renderQuietLine(t.id, t.title)));
13604
+ const hint = renderQuietPaginationHint({
13605
+ count: tasks.length,
13606
+ total,
13607
+ offset: args.offset ?? 0,
13608
+ limit: args.limit ?? 20
13609
+ });
13610
+ if (hint)
13611
+ output.log(hint);
13496
13612
  } else {
13497
13613
  const keywordStr = args.keywords.join(" ");
13498
- output.log(chalk25.bold(`
13614
+ output.log(chalk26.bold(`
13499
13615
  \uD83D\uDD0D Search: "${keywordStr}" — ${total} results
13500
13616
  `));
13501
13617
  if (tasks.length === 0) {
13502
- output.log(chalk25.gray(" No matching tasks found."));
13618
+ output.log(chalk26.gray(" No matching tasks found."));
13503
13619
  return;
13504
13620
  }
13505
13621
  for (const t of tasks) {
13506
- 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;
13507
- const pid = t.parent_task_id ? chalk25.gray(` (#${t.parent_task_id})`) : "";
13622
+ const statusColor = t.status === "completed" ? chalk26.green : t.status === "active" ? chalk26.blue : t.status === "paused" ? chalk26.yellow : t.status === "cancelled" ? chalk26.strikethrough : t.status === "archived" ? chalk26.gray : chalk26.gray;
13623
+ const pid = t.parent_task_id ? chalk26.gray(` (#${t.parent_task_id})`) : "";
13508
13624
  output.log(` #${t.id} ${statusColor("[" + t.status + "]")} ${t.title}${pid}`);
13509
13625
  if (t.current_status) {
13510
- output.log(` ${chalk25.gray(t.current_status.slice(0, 80))}`);
13626
+ output.log(` ${chalk26.gray(t.current_status.slice(0, 80))}`);
13511
13627
  }
13512
13628
  }
13513
13629
  if (total > tasks.length) {
13514
- output.log(chalk25.gray(`
13630
+ output.log(chalk26.gray(`
13515
13631
  ... and ${total - tasks.length} more. Use --offset and --limit to paginate.`));
13516
13632
  }
13517
- output.log(chalk25.gray(` Page: ${Math.floor((args.offset || 0) / (args.limit || 20)) + 1}/${Math.ceil(total / (args.limit || 20))}`));
13633
+ output.log(chalk26.gray(` Page: ${Math.floor((args.offset || 0) / (args.limit || 20)) + 1}/${Math.ceil(total / (args.limit || 20))}`));
13518
13634
  }
13519
13635
  } catch (error) {
13520
13636
  output.error(`Failed to search tasks: ${error}`);
@@ -13774,7 +13890,7 @@ var TasksCommand = {
13774
13890
  };
13775
13891
 
13776
13892
  // src/commands/skills/list.ts
13777
- import chalk26 from "chalk";
13893
+ import chalk27 from "chalk";
13778
13894
  var ListCommand3 = {
13779
13895
  command: "list",
13780
13896
  aliases: ["ls"],
@@ -13790,12 +13906,7 @@ var ListCommand3 = {
13790
13906
  type: "boolean",
13791
13907
  default: false,
13792
13908
  description: "JSON 输出"
13793
- }).option("quiet", {
13794
- alias: "q",
13795
- type: "boolean",
13796
- default: false,
13797
- description: "简洁输出"
13798
- }),
13909
+ }).option("limit", PAGINATION_OPTIONS.limit).option("offset", PAGINATION_OPTIONS.offset).option("quiet", { alias: "q", type: "boolean", hidden: true }),
13799
13910
  async handler(args) {
13800
13911
  const a = args;
13801
13912
  const output = new OutputService2;
@@ -13812,41 +13923,61 @@ var ListCommand3 = {
13812
13923
  output.error("SkillComponent not available");
13813
13924
  process.exit(1);
13814
13925
  }
13815
- const skills = skillComponent.getSkillList();
13816
- const filtered = a.source && a.source !== "all" ? skills.filter((s) => s.source === a.source) : skills;
13926
+ const allSkills = skillComponent.getSkillList();
13927
+ const filtered = a.source && a.source !== "all" ? allSkills.filter((s) => s.source === a.source) : allSkills;
13928
+ const total = filtered.length;
13929
+ const page = {
13930
+ limit: a.limit ?? 20,
13931
+ offset: a.offset ?? 0
13932
+ };
13933
+ const skills = applyPagination(filtered, page);
13817
13934
  if (a.json) {
13818
13935
  output.json({
13819
- count: filtered.length,
13820
- skills: filtered.map((s) => ({
13936
+ total,
13937
+ count: skills.length,
13938
+ truncated: total > skills.length,
13939
+ limit: page.limit,
13940
+ offset: page.offset,
13941
+ source: a.source ?? "all",
13942
+ skills: skills.map((s) => ({
13821
13943
  name: s.name,
13822
13944
  description: s.description,
13823
13945
  source: s.source
13824
13946
  }))
13825
13947
  });
13826
13948
  } else if (a.quiet) {
13827
- filtered.forEach((s) => output.log(s.name));
13949
+ output.log(renderQuietHeader(total, "skill"));
13950
+ skills.forEach((s) => output.log(renderQuietLine(s.name, s.name)));
13951
+ const hint = renderQuietPaginationHint({
13952
+ count: skills.length,
13953
+ total,
13954
+ offset: page.offset,
13955
+ limit: page.limit
13956
+ });
13957
+ if (hint)
13958
+ output.log(hint);
13828
13959
  } else {
13829
13960
  const header = [
13830
- chalk26.bold("Name"),
13831
- chalk26.bold("Description"),
13832
- chalk26.bold("Source")
13961
+ chalk27.bold("Name"),
13962
+ chalk27.bold("Description"),
13963
+ chalk27.bold("Source")
13833
13964
  ].join(" | ");
13834
13965
  const sourceColor = (source) => {
13835
13966
  switch (source) {
13836
13967
  case "project":
13837
- return chalk26.green;
13968
+ return chalk27.green;
13838
13969
  case "user":
13839
- return chalk26.blue;
13970
+ return chalk27.blue;
13840
13971
  case "built-in":
13841
- return chalk26.gray;
13972
+ return chalk27.gray;
13842
13973
  default:
13843
- return chalk26.white;
13974
+ return chalk27.white;
13844
13975
  }
13845
13976
  };
13846
- const rows = filtered.map((s) => {
13977
+ const rows = skills.map((s) => {
13847
13978
  const desc2 = s.description.length > 50 ? s.description.slice(0, 47) + "..." : s.description;
13848
13979
  return [
13849
- chalk26.cyan(s.name),
13980
+ chalk27.cyan(s.name),
13850
13981
  desc2,
13851
13982
  sourceColor(s.source)(`[${s.source}]`)
13852
13983
  ].join(" | ");
@@ -13858,7 +13989,14 @@ var ListCommand3 = {
13858
13989
  ...rows.map((r) => `│${r}│`),
13859
13990
  "└" + "─".repeat(header.length + 2) + "┘",
13860
13991
  "",
13861
- chalk26.gray(`Total: ${filtered.length} skills`)
13992
+ renderPaginationFooter({
13993
+ total,
13994
+ count: skills.length,
13995
+ offset: page.offset,
13996
+ limit: page.limit,
13997
+ itemName: "skill",
13998
+ extras: a.source && a.source !== "all" ? [`source=${a.source}`] : []
13999
+ })
13862
14000
  ].join(`
13863
14001
  `));
13864
14002
  }
@@ -13872,7 +14010,7 @@ var ListCommand3 = {
13872
14010
  };
13873
14011
 
13874
14012
  // src/commands/skills/get.ts
13875
- import chalk27 from "chalk";
14013
+ import chalk28 from "chalk";
13876
14014
  var GetCommand3 = {
13877
14015
  command: "get <name>",
13878
14016
  describe: "获取指定技能内容",
@@ -13916,13 +14054,13 @@ var GetCommand3 = {
13916
14054
  content: skill.content
13917
14055
  });
13918
14056
  } else {
13919
- output.log(chalk27.bold.cyan(`# ${skill.name}`));
14057
+ output.log(chalk28.bold.cyan(`# ${skill.name}`));
13920
14058
  output.log("");
13921
- output.log(`${chalk27.gray("Description:")} ${skill.description}`);
13922
- output.log(`${chalk27.gray("Source:")} ${skill.source}`);
13923
- output.log(`${chalk27.gray("File:")} ${skill.filePath}`);
14059
+ output.log(`${chalk28.gray("Description:")} ${skill.description}`);
14060
+ output.log(`${chalk28.gray("Source:")} ${skill.source}`);
14061
+ output.log(`${chalk28.gray("File:")} ${skill.filePath}`);
13924
14062
  output.log("");
13925
- output.log(chalk27.bold("--- Content ---"));
14063
+ output.log(chalk28.bold("--- Content ---"));
13926
14064
  output.log("");
13927
14065
  output.log(skill.content);
13928
14066
  }
@@ -13936,7 +14074,7 @@ var GetCommand3 = {
13936
14074
  };
13937
14075
 
13938
14076
  // src/commands/skills/search.ts
13939
- import chalk28 from "chalk";
14077
+ import chalk29 from "chalk";
13940
14078
  var SearchCommand2 = {
13941
14079
  command: "search <term>",
13942
14080
  aliases: ["find"],
@@ -13975,7 +14113,7 @@ var SearchCommand2 = {
13975
14113
  const term = args.term.toLowerCase();
13976
14114
  const results = allSkills.filter((s) => s.name.toLowerCase().includes(term) || s.description.toLowerCase().includes(term));
13977
14115
  if (results.length === 0) {
13978
- output.log(chalk28.yellow(`No skills found matching: ${args.term}`));
14116
+ output.log(chalk29.yellow(`No skills found matching: ${args.term}`));
13979
14117
  return;
13980
14118
  }
13981
14119
  if (args.json) {
@@ -13992,19 +14130,19 @@ var SearchCommand2 = {
13992
14130
  } else if (args.quiet) {
13993
14131
  results.forEach((s) => output.log(s.name));
13994
14132
  } else {
13995
- output.log(chalk28.bold(`Search results for "${args.term}":`));
14133
+ output.log(chalk29.bold(`Search results for "${args.term}":`));
13996
14134
  output.log("");
13997
14135
  const header = [
13998
- chalk28.bold("Name"),
13999
- chalk28.bold("Description"),
14000
- chalk28.bold("Match")
14136
+ chalk29.bold("Name"),
14137
+ chalk29.bold("Description"),
14138
+ chalk29.bold("Match")
14001
14139
  ].join(" | ");
14002
14140
  const rows = results.map((s) => {
14003
14141
  const matchedIn = s.name.toLowerCase().includes(term) ? "name" : "description";
14004
- const matchColor = matchedIn === "name" ? chalk28.green : chalk28.blue;
14142
+ const matchColor = matchedIn === "name" ? chalk29.green : chalk29.blue;
14005
14143
  const desc2 = s.description.length > 40 ? s.description.slice(0, 37) + "..." : s.description;
14006
14144
  return [
14007
- chalk28.cyan(s.name),
14145
+ chalk29.cyan(s.name),
14008
14146
  desc2,
14009
14147
  matchColor(`[${matchedIn}]`)
14010
14148
  ].join(" | ");
@@ -14016,7 +14154,7 @@ var SearchCommand2 = {
14016
14154
  ...rows.map((r) => `│${r}│`),
14017
14155
  "└" + "─".repeat(header.length + 2) + "┘",
14018
14156
  "",
14019
- chalk28.gray(`${results.length} matching skill(s) found.`)
14157
+ chalk29.gray(`${results.length} matching skill(s) found.`)
14020
14158
  ].join(`
14021
14159
  `));
14022
14160
  }
@@ -14030,7 +14168,7 @@ var SearchCommand2 = {
14030
14168
  };
14031
14169
 
14032
14170
  // src/commands/skills/reload.ts
14033
- import chalk29 from "chalk";
14171
+ import chalk30 from "chalk";
14034
14172
  var ReloadCommand = {
14035
14173
  command: "reload",
14036
14174
  describe: "重新扫描并更新 SkillTool",
@@ -14053,10 +14191,10 @@ var ReloadCommand = {
14053
14191
  output.error("SkillComponent not available");
14054
14192
  process.exit(1);
14055
14193
  }
14056
- output.log(chalk29.blue("Reloading skills..."));
14194
+ output.log(chalk30.blue("Reloading skills..."));
14057
14195
  await skillComponent.reload();
14058
14196
  const skills = skillComponent.getSkillList();
14059
- output.log(chalk29.green(`Successfully reloaded ${skills.length} skills`));
14197
+ output.log(chalk30.green(`Successfully reloaded ${skills.length} skills`));
14060
14198
  } catch (error) {
14061
14199
  output.error(`Failed to reload skills: ${error}`);
14062
14200
  process.exit(1);
@@ -14067,7 +14205,7 @@ var ReloadCommand = {
14067
14205
  };
14068
14206
 
14069
14207
  // src/commands/skills/show-config.ts
14070
- import chalk30 from "chalk";
14208
+ import chalk31 from "chalk";
14071
14209
  var ShowConfigCommand = {
14072
14210
  command: "show-config",
14073
14211
  aliases: ["config"],
@@ -14092,38 +14230,38 @@ var ShowConfigCommand = {
14092
14230
  process.exit(1);
14093
14231
  }
14094
14232
  const defaultConfig = skillComponent.getConfig?.();
14095
- output.log(chalk30.bold.cyan(`# Skills Configuration
14233
+ output.log(chalk31.bold.cyan(`# Skills Configuration
14096
14234
  `));
14097
- output.log(chalk30.bold(`## Scan Paths
14235
+ output.log(chalk31.bold(`## Scan Paths
14098
14236
  `));
14099
14237
  const paths = [
14100
14238
  { type: "user", desc: "用户路径", path: "~/.config/roy-agent/skills/" },
14101
14239
  { type: "project", desc: "项目路径", path: ".roy/skills/" }
14102
14240
  ];
14103
14241
  for (const p of paths) {
14104
- const typeColor = p.type === "project" ? chalk30.green : chalk30.blue;
14105
- output.log(` ${typeColor("[ " + p.type + " ]")} ${chalk30.gray(p.desc)}`);
14106
- output.log(` ${chalk30.cyan(p.path)}
14242
+ const typeColor = p.type === "project" ? chalk31.green : chalk31.blue;
14243
+ output.log(` ${typeColor("[ " + p.type + " ]")} ${chalk31.gray(p.desc)}`);
14244
+ output.log(` ${chalk31.cyan(p.path)}
14107
14245
  `);
14108
14246
  }
14109
- output.log(chalk30.bold(`## Scan Rules
14247
+ output.log(chalk31.bold(`## Scan Rules
14110
14248
  `));
14111
- output.log(` ${chalk30.gray("Pattern:")} ${chalk30.cyan("**/SKILL.md")}`);
14112
- output.log(` ${chalk30.gray("Recursive:")} ${chalk30.green("true")}`);
14113
- output.log(` ${chalk30.gray("Ignore:")} ${chalk30.cyan("**/node_modules/**")}
14249
+ output.log(` ${chalk31.gray("Pattern:")} ${chalk31.cyan("**/SKILL.md")}`);
14250
+ output.log(` ${chalk31.gray("Recursive:")} ${chalk31.green("true")}`);
14251
+ output.log(` ${chalk31.gray("Ignore:")} ${chalk31.cyan("**/node_modules/**")}
14114
14252
  `);
14115
- output.log(chalk30.bold(`## Priority (High to Low)
14253
+ output.log(chalk31.bold(`## Priority (High to Low)
14116
14254
  `));
14117
- output.log(` ${chalk30.green("1. project")} - 项目路径(最高优先级)`);
14118
- output.log(` ${chalk30.blue("2. user")} - 用户路径`);
14119
- output.log(` ${chalk30.gray("3. built-in")} - 内置路径(预留)
14255
+ output.log(` ${chalk31.green("1. project")} - 项目路径(最高优先级)`);
14256
+ output.log(` ${chalk31.blue("2. user")} - 用户路径`);
14257
+ output.log(` ${chalk31.gray("3. built-in")} - 内置路径(预留)
14120
14258
  `);
14121
- output.log(chalk30.bold(`## Usage
14259
+ output.log(chalk31.bold(`## Usage
14122
14260
  `));
14123
- output.log(` ${chalk30.cyan("roy-agent skills list")} ${chalk30.gray("- 列出所有技能")}`);
14124
- output.log(` ${chalk30.cyan("roy-agent skills get <name>")} ${chalk30.gray("- 获取技能内容")}`);
14125
- output.log(` ${chalk30.cyan("roy-agent skills search <term>")} ${chalk30.gray("- 搜索技能")}`);
14126
- output.log(` ${chalk30.cyan("roy-agent skills reload")} ${chalk30.gray("- 重新扫描技能")}`);
14261
+ output.log(` ${chalk31.cyan("roy-agent skills list")} ${chalk31.gray("- 列出所有技能")}`);
14262
+ output.log(` ${chalk31.cyan("roy-agent skills get <name>")} ${chalk31.gray("- 获取技能内容")}`);
14263
+ output.log(` ${chalk31.cyan("roy-agent skills search <term>")} ${chalk31.gray("- 搜索技能")}`);
14264
+ output.log(` ${chalk31.cyan("roy-agent skills reload")} ${chalk31.gray("- 重新扫描技能")}`);
14127
14265
  } catch (error) {
14128
14266
  output.error(`Failed to show config: ${error}`);
14129
14267
  process.exit(1);
@@ -14144,7 +14282,7 @@ var SkillsCommand = {
14144
14282
  };
14145
14283
 
14146
14284
  // src/commands/agents/list.ts
14147
- import chalk31 from "chalk";
14285
+ import chalk32 from "chalk";
14148
14286
  var ListCommand4 = {
14149
14287
  command: "list",
14150
14288
  aliases: ["ls"],
@@ -14160,12 +14298,7 @@ var ListCommand4 = {
14160
14298
  type: "boolean",
14161
14299
  default: false,
14162
14300
  description: "JSON 输出"
14163
- }).option("quiet", {
14164
- alias: "q",
14165
- type: "boolean",
14166
- default: false,
14167
- description: "简洁输出"
14168
- }),
14301
+ }).option("limit", PAGINATION_OPTIONS.limit).option("offset", PAGINATION_OPTIONS.offset).option("quiet", { alias: "q", type: "boolean", hidden: true }),
14169
14302
  async handler(args) {
14170
14303
  const output = new OutputService2;
14171
14304
  const envService = new EnvironmentService(output);
@@ -14197,10 +14330,21 @@ var ListCommand4 = {
14197
14330
  } else {
14198
14331
  agents = registry.list();
14199
14332
  }
14333
+ const total = agents.length;
14334
+ const page = {
14335
+ limit: args.limit ?? 20,
14336
+ offset: args.offset ?? 0
14337
+ };
14338
+ const pagedAgents = applyPagination(agents, page);
14200
14339
  if (args.json) {
14201
14340
  output.json({
14202
- count: agents.length,
14203
- agents: agents.map((a) => ({
14341
+ total,
14342
+ count: pagedAgents.length,
14343
+ truncated: total > pagedAgents.length,
14344
+ limit: page.limit,
14345
+ offset: page.offset,
14346
+ type: args.type ?? "all",
14347
+ agents: pagedAgents.map((a) => ({
14204
14348
  name: a.name,
14205
14349
  type: a.type,
14206
14350
  source: builtInSubAgentNames.has(a.name) ? "built-in" : "user",
@@ -14212,30 +14356,39 @@ var ListCommand4 = {
14212
14356
  }))
14213
14357
  });
14214
14358
  } else if (args.quiet) {
14215
- agents.forEach((a) => output.log(a.name));
14359
+ output.log(renderQuietHeader(total, "agent"));
14360
+ pagedAgents.forEach((a) => output.log(renderQuietLine(a.name, a.name)));
14361
+ const hint = renderQuietPaginationHint({
14362
+ count: pagedAgents.length,
14363
+ total,
14364
+ offset: page.offset,
14365
+ limit: page.limit
14366
+ });
14367
+ if (hint)
14368
+ output.log(hint);
14216
14369
  } else {
14217
14370
  const header = [
14218
- chalk31.bold("Name"),
14219
- chalk31.bold("Type"),
14220
- chalk31.bold("Source"),
14221
- chalk31.bold("Model"),
14222
- chalk31.bold("Workflow"),
14223
- chalk31.bold("Description")
14371
+ chalk32.bold("Name"),
14372
+ chalk32.bold("Type"),
14373
+ chalk32.bold("Source"),
14374
+ chalk32.bold("Model"),
14375
+ chalk32.bold("Workflow"),
14376
+ chalk32.bold("Description")
14224
14377
  ].join(" | ");
14225
14378
  const typeColor = (type) => {
14226
14379
  if (type === "primary")
14227
- return chalk31.yellow;
14380
+ return chalk32.yellow;
14228
14381
  if (type === "workflow")
14229
- return chalk31.magenta;
14230
- return chalk31.blue;
14382
+ return chalk32.magenta;
14383
+ return chalk32.blue;
14231
14384
  };
14232
- const rows = agents.map((a) => {
14385
+ const rows = pagedAgents.map((a) => {
14233
14386
  const desc2 = (a.description || "").length > 40 ? (a.description || "").slice(0, 37) + "..." : a.description || "-";
14234
- const workflowDisplay = a.type === "workflow" && a.workflow ? chalk31.cyan(a.workflow.length > 30 ? a.workflow.slice(0, 27) + "..." : a.workflow) : chalk31.gray("-");
14235
- const modelDisplay = a.model ? chalk31.yellow(a.model.length > 20 ? a.model.slice(0, 17) + "..." : a.model) : chalk31.gray("-");
14236
- const sourceDisplay = builtInSubAgentNames.has(a.name) ? chalk31.green("built-in") : chalk31.gray("user");
14387
+ const workflowDisplay = a.type === "workflow" && a.workflow ? chalk32.cyan(a.workflow.length > 30 ? a.workflow.slice(0, 27) + "..." : a.workflow) : chalk32.gray("-");
14388
+ const modelDisplay = a.model ? chalk32.yellow(a.model.length > 20 ? a.model.slice(0, 17) + "..." : a.model) : chalk32.gray("-");
14389
+ const sourceDisplay = builtInSubAgentNames.has(a.name) ? chalk32.green("built-in") : chalk32.gray("user");
14237
14390
  return [
14238
- chalk31.cyan(a.name),
14391
+ chalk32.cyan(a.name),
14239
14392
  typeColor(a.type)(a.type),
14240
14393
  sourceDisplay,
14241
14394
  modelDisplay,
@@ -14244,9 +14397,9 @@ var ListCommand4 = {
14244
14397
  ].join(" | ");
14245
14398
  });
14246
14399
  if (rows.length === 0) {
14247
- output.log(chalk31.yellow("No agents found."));
14400
+ output.log(chalk32.yellow("No agents found."));
14248
14401
  output.log("");
14249
- output.log(chalk31.gray("Tip: Create agent configs in ~/.local/share/roy-agent/agents/"));
14402
+ output.log(chalk32.gray("Tip: Create agent configs in ~/.local/share/roy-agent/agents/"));
14250
14403
  } else {
14251
14404
  output.log([
14252
14405
  `┌─ Agents ${"─".repeat(50)}┐`,
@@ -14255,7 +14408,14 @@ var ListCommand4 = {
14255
14408
  ...rows.map((r) => `│${r}│`),
14256
14409
  "└" + "─".repeat(header.length + 2) + "┘",
14257
14410
  "",
14258
- chalk31.gray(`Total: ${agents.length} agents`)
14411
+ renderPaginationFooter({
14412
+ total,
14413
+ count: pagedAgents.length,
14414
+ offset: page.offset,
14415
+ limit: page.limit,
14416
+ itemName: "agent",
14417
+ extras: args.type && args.type !== "all" ? [`type=${args.type}`] : []
14418
+ })
14259
14419
  ].join(`
14260
14420
  `));
14261
14421
  }
@@ -14270,7 +14430,7 @@ var ListCommand4 = {
14270
14430
  };
14271
14431
 
14272
14432
  // src/commands/agents/get.ts
14273
- import chalk32 from "chalk";
14433
+ import chalk33 from "chalk";
14274
14434
  var GetCommand4 = {
14275
14435
  command: "get <name>",
14276
14436
  describe: "获取指定 agent 的详细信息",
@@ -14329,69 +14489,69 @@ var GetCommand4 = {
14329
14489
  filterHistory: agent.filterHistory
14330
14490
  });
14331
14491
  } else {
14332
- output.log(chalk32.bold.cyan(`# Agent: ${agent.name}`));
14492
+ output.log(chalk33.bold.cyan(`# Agent: ${agent.name}`));
14333
14493
  output.log("");
14334
- output.log(chalk32.bold("Basic Info:"));
14335
- output.log(` ${chalk32.cyan("name:")} ${agent.name}`);
14336
- output.log(` ${chalk32.cyan("type:")} ${agent.type}`);
14494
+ output.log(chalk33.bold("Basic Info:"));
14495
+ output.log(` ${chalk33.cyan("name:")} ${agent.name}`);
14496
+ output.log(` ${chalk33.cyan("type:")} ${agent.type}`);
14337
14497
  if (agent.description) {
14338
- output.log(` ${chalk32.cyan("description:")} ${agent.description}`);
14498
+ output.log(` ${chalk33.cyan("description:")} ${agent.description}`);
14339
14499
  }
14340
14500
  output.log("");
14341
14501
  if (agent.type === "workflow") {
14342
- output.log(chalk32.bold("Workflow:"));
14502
+ output.log(chalk33.bold("Workflow:"));
14343
14503
  if (agent.workflow) {
14344
- output.log(` ${chalk32.cyan("workflow:")} ${agent.workflow}`);
14345
- output.log(` ${chalk32.gray("→")} ${chalk32.gray(`roy-agent workflow run ${agent.workflow} --input '{"query":"..."}'`)}`);
14504
+ output.log(` ${chalk33.cyan("workflow:")} ${agent.workflow}`);
14505
+ output.log(` ${chalk33.gray("→")} ${chalk33.gray(`roy-agent workflow run ${agent.workflow} --input '{"query":"..."}'`)}`);
14346
14506
  } else {
14347
- output.log(` ${chalk32.gray("(no workflow configured)")}`);
14507
+ output.log(` ${chalk33.gray("(no workflow configured)")}`);
14348
14508
  }
14349
14509
  output.log("");
14350
14510
  }
14351
- output.log(chalk32.bold("System Prompt:"));
14511
+ output.log(chalk33.bold("System Prompt:"));
14352
14512
  if (agent.systemPromptRef) {
14353
- output.log(` ${chalk32.green("[ref]")} ${chalk32.cyan("systemPromptRef:")} ${agent.systemPromptRef}`);
14513
+ output.log(` ${chalk33.green("[ref]")} ${chalk33.cyan("systemPromptRef:")} ${agent.systemPromptRef}`);
14354
14514
  }
14355
14515
  if (agent.systemPrompt && !agent.systemPromptRef) {
14356
14516
  const promptPreview = agent.systemPrompt.length > 100 ? agent.systemPrompt.slice(0, 97) + "..." : agent.systemPrompt;
14357
- output.log(` ${chalk32.gray("[inline]")}`);
14358
- output.log(` ${chalk32.gray(promptPreview.split(`
14517
+ output.log(` ${chalk33.gray("[inline]")}`);
14518
+ output.log(` ${chalk33.gray(promptPreview.split(`
14359
14519
  `).join(`
14360
14520
  `))}`);
14361
14521
  }
14362
14522
  if (resolvedSystemPrompt) {
14363
14523
  const resolvedPreview = resolvedSystemPrompt.length > 200 ? resolvedSystemPrompt.slice(0, 197) + "..." : resolvedSystemPrompt;
14364
- output.log(` ${chalk32.green("[resolved]")}`);
14365
- output.log(` ${chalk32.gray(resolvedPreview.split(`
14524
+ output.log(` ${chalk33.green("[resolved]")}`);
14525
+ output.log(` ${chalk33.gray(resolvedPreview.split(`
14366
14526
  `).join(`
14367
14527
  `))}`);
14368
14528
  }
14369
14529
  if (!agent.systemPromptRef && !agent.systemPrompt && !resolvedSystemPrompt) {
14370
- output.log(` ${chalk32.gray("(none)")}`);
14530
+ output.log(` ${chalk33.gray("(none)")}`);
14371
14531
  }
14372
14532
  output.log("");
14373
14533
  const hasOptions = agent.model || agent.maxIterations || agent.toolTimeout;
14374
14534
  if (hasOptions) {
14375
- output.log(chalk32.bold("Options:"));
14535
+ output.log(chalk33.bold("Options:"));
14376
14536
  if (agent.model) {
14377
- output.log(` ${chalk32.cyan("model:")} ${agent.model}`);
14537
+ output.log(` ${chalk33.cyan("model:")} ${agent.model}`);
14378
14538
  }
14379
14539
  if (agent.maxIterations) {
14380
- output.log(` ${chalk32.cyan("maxIterations:")} ${agent.maxIterations}`);
14540
+ output.log(` ${chalk33.cyan("maxIterations:")} ${agent.maxIterations}`);
14381
14541
  }
14382
14542
  if (agent.toolTimeout) {
14383
- output.log(` ${chalk32.cyan("toolTimeout:")} ${agent.toolTimeout}ms`);
14543
+ output.log(` ${chalk33.cyan("toolTimeout:")} ${agent.toolTimeout}ms`);
14384
14544
  }
14385
14545
  output.log("");
14386
14546
  }
14387
14547
  const hasTools = agent.allowedTools?.length || agent.deniedTools?.length;
14388
14548
  if (hasTools) {
14389
- output.log(chalk32.bold("Tool Permissions:"));
14549
+ output.log(chalk33.bold("Tool Permissions:"));
14390
14550
  if (agent.allowedTools?.length) {
14391
- output.log(` ${chalk32.green("allowed:")} ${agent.allowedTools.join(", ")}`);
14551
+ output.log(` ${chalk33.green("allowed:")} ${agent.allowedTools.join(", ")}`);
14392
14552
  }
14393
14553
  if (agent.deniedTools?.length) {
14394
- output.log(` ${chalk32.red("denied:")} ${agent.deniedTools.join(", ")}`);
14554
+ output.log(` ${chalk33.red("denied:")} ${agent.deniedTools.join(", ")}`);
14395
14555
  }
14396
14556
  output.log("");
14397
14557
  }
@@ -14406,7 +14566,7 @@ var GetCommand4 = {
14406
14566
  };
14407
14567
 
14408
14568
  // src/commands/agents/add.ts
14409
- import chalk33 from "chalk";
14569
+ import chalk34 from "chalk";
14410
14570
  function parseToolList(value) {
14411
14571
  if (!value?.trim()) {
14412
14572
  return;
@@ -14498,8 +14658,8 @@ var AddCommand = {
14498
14658
  if (args.json) {
14499
14659
  output.json({ agent, filePath });
14500
14660
  } else {
14501
- output.log(chalk33.green(`✓ Agent '${args.name}' created`));
14502
- output.log(chalk33.gray(` ${filePath}`));
14661
+ output.log(chalk34.green(`✓ Agent '${args.name}' created`));
14662
+ output.log(chalk34.gray(` ${filePath}`));
14503
14663
  }
14504
14664
  } catch (error) {
14505
14665
  output.error(`Failed to add agent: ${error}`);
@@ -14511,7 +14671,7 @@ var AddCommand = {
14511
14671
  };
14512
14672
 
14513
14673
  // src/commands/agents/delete.ts
14514
- import chalk34 from "chalk";
14674
+ import chalk35 from "chalk";
14515
14675
  var DeleteCommand3 = {
14516
14676
  command: "delete <name>",
14517
14677
  describe: "删除 agent 配置文件",
@@ -14553,7 +14713,7 @@ var DeleteCommand3 = {
14553
14713
  }
14554
14714
  const filePath = registry.getAgentFilePath(args.name);
14555
14715
  if (!args.yes) {
14556
- output.log(chalk34.yellow(`Delete agent '${args.name}'? This removes ${filePath} (use --yes to skip confirmation)`));
14716
+ output.log(chalk35.yellow(`Delete agent '${args.name}'? This removes ${filePath} (use --yes to skip confirmation)`));
14557
14717
  process.exit(1);
14558
14718
  }
14559
14719
  const deleted = await registry.deleteAgent(args.name);
@@ -14564,7 +14724,7 @@ var DeleteCommand3 = {
14564
14724
  if (args.json) {
14565
14725
  output.json({ deleted: true, name: args.name, filePath });
14566
14726
  } else {
14567
- output.log(chalk34.green(`✓ Agent '${args.name}' deleted`));
14727
+ output.log(chalk35.green(`✓ Agent '${args.name}' deleted`));
14568
14728
  }
14569
14729
  } catch (error) {
14570
14730
  output.error(`Failed to delete agent: ${error}`);
@@ -14576,7 +14736,7 @@ var DeleteCommand3 = {
14576
14736
  };
14577
14737
 
14578
14738
  // src/commands/agents/config-dir.ts
14579
- import chalk35 from "chalk";
14739
+ import chalk36 from "chalk";
14580
14740
  var ConfigDirCommand = {
14581
14741
  command: "config-dir",
14582
14742
  describe: "显示 agent 配置目录路径",
@@ -14607,8 +14767,8 @@ var ConfigDirCommand = {
14607
14767
  if (args.json) {
14608
14768
  output.json({ configDir, exists });
14609
14769
  } else {
14610
- output.log(`${chalk35.cyan("Agent Config Directory:")} ${configDir}`);
14611
- output.log(`${chalk35.gray("Exists:")} ${exists ? "yes" : "no"}`);
14770
+ output.log(`${chalk36.cyan("Agent Config Directory:")} ${configDir}`);
14771
+ output.log(`${chalk36.gray("Exists:")} ${exists ? "yes" : "no"}`);
14612
14772
  }
14613
14773
  } catch (error) {
14614
14774
  output.error(`Failed to get config dir: ${error}`);
@@ -14631,7 +14791,7 @@ var AgentsCommand = {
14631
14791
  };
14632
14792
 
14633
14793
  // src/commands/prompt/list.ts
14634
- import chalk36 from "chalk";
14794
+ import chalk37 from "chalk";
14635
14795
  var ListCommand5 = {
14636
14796
  command: "list",
14637
14797
  aliases: ["ls"],
@@ -14647,12 +14807,7 @@ var ListCommand5 = {
14647
14807
  type: "boolean",
14648
14808
  default: false,
14649
14809
  description: "JSON 输出"
14650
- }).option("quiet", {
14651
- alias: "q",
14652
- type: "boolean",
14653
- default: false,
14654
- description: "简洁输出"
14655
- }),
14810
+ }).option("limit", PAGINATION_OPTIONS.limit).option("offset", PAGINATION_OPTIONS.offset).option("quiet", { alias: "q", type: "boolean", hidden: true }),
14656
14811
  async handler(args) {
14657
14812
  const output = new OutputService2;
14658
14813
  const envService = new EnvironmentService(output);
@@ -14668,36 +14823,54 @@ var ListCommand5 = {
14668
14823
  output.error("PromptComponent not available");
14669
14824
  process.exit(1);
14670
14825
  }
14671
- let prompts = promptComponent.listEntries().map((entry) => ({
14826
+ const allPrompts = promptComponent.listEntries().map((entry) => ({
14672
14827
  name: entry.name,
14673
14828
  source: entry.source
14674
14829
  }));
14675
- if (args.source && args.source !== "all") {
14676
- prompts = prompts.filter((p) => p.source === args.source);
14677
- }
14830
+ const filtered = args.source && args.source !== "all" ? allPrompts.filter((p) => p.source === args.source) : allPrompts;
14831
+ const total = filtered.length;
14832
+ const page = {
14833
+ limit: args.limit ?? 20,
14834
+ offset: args.offset ?? 0
14835
+ };
14836
+ const prompts = applyPagination(filtered, page);
14678
14837
  if (args.json) {
14679
14838
  output.json({
14839
+ total,
14840
+ count: prompts.length,
14841
+ truncated: total > prompts.length,
14842
+ limit: page.limit,
14843
+ offset: page.offset,
14844
+ source: args.source ?? "all",
14680
14845
  prompts: prompts.map((p) => ({
14681
14846
  name: p.name,
14682
14847
  source: p.source
14683
- })),
14684
- count: prompts.length
14848
+ }))
14685
14849
  });
14686
14850
  } else if (args.quiet) {
14687
- prompts.forEach((p) => output.log(p.name));
14851
+ output.log(renderQuietHeader(total, "prompt"));
14852
+ prompts.forEach((p) => output.log(renderQuietLine(p.name, p.name)));
14853
+ const hint = renderQuietPaginationHint({
14854
+ count: prompts.length,
14855
+ total,
14856
+ offset: page.offset,
14857
+ limit: page.limit
14858
+ });
14859
+ if (hint)
14860
+ output.log(hint);
14688
14861
  } else {
14689
14862
  const header = [
14690
- chalk36.bold("Name"),
14691
- chalk36.bold("Source")
14863
+ chalk37.bold("Name"),
14864
+ chalk37.bold("Source")
14692
14865
  ].join(" | ");
14693
14866
  const rows = prompts.map((p) => {
14694
14867
  return [
14695
- chalk36.cyan(p.name),
14696
- chalk36.gray(`[${p.source}]`)
14868
+ chalk37.cyan(p.name),
14869
+ chalk37.gray(`[${p.source}]`)
14697
14870
  ].join(" | ");
14698
14871
  });
14699
14872
  if (rows.length === 0) {
14700
- output.log(chalk36.yellow("No prompts found."));
14873
+ output.log(chalk37.yellow("No prompts found."));
14701
14874
  } else {
14702
14875
  output.log([
14703
14876
  `┌─ Prompts ${"─".repeat(50)}┐`,
@@ -14706,7 +14879,14 @@ var ListCommand5 = {
14706
14879
  ...rows.map((r) => `│${r}│`),
14707
14880
  "└" + "─".repeat(header.length + 2) + "┘",
14708
14881
  "",
14709
- chalk36.gray(`Total: ${prompts.length} prompts`)
14882
+ renderPaginationFooter({
14883
+ total,
14884
+ count: prompts.length,
14885
+ offset: page.offset,
14886
+ limit: page.limit,
14887
+ itemName: "prompt",
14888
+ extras: args.source && args.source !== "all" ? [`source=${args.source}`] : []
14889
+ })
14710
14890
  ].join(`
14711
14891
  `));
14712
14892
  }
@@ -14721,7 +14901,7 @@ var ListCommand5 = {
14721
14901
  };
14722
14902
 
14723
14903
  // src/commands/prompt/get.ts
14724
- import chalk37 from "chalk";
14904
+ import chalk38 from "chalk";
14725
14905
  var GetCommand5 = {
14726
14906
  command: "get <name>",
14727
14907
  describe: "获取指定 prompt 的内容",
@@ -14768,16 +14948,16 @@ var GetCommand5 = {
14768
14948
  variables: vars
14769
14949
  });
14770
14950
  } else {
14771
- output.log(chalk37.bold.cyan(`# Prompt: ${args.name}`));
14951
+ output.log(chalk38.bold.cyan(`# Prompt: ${args.name}`));
14772
14952
  output.log("");
14773
14953
  if (Object.keys(vars).length > 0) {
14774
- output.log(chalk37.gray("Variables:"));
14954
+ output.log(chalk38.gray("Variables:"));
14775
14955
  for (const [key, value] of Object.entries(vars)) {
14776
- output.log(` ${chalk37.cyan(key + ":")} ${value}`);
14956
+ output.log(` ${chalk38.cyan(key + ":")} ${value}`);
14777
14957
  }
14778
14958
  output.log("");
14779
14959
  }
14780
- output.log(chalk37.bold("Content:"));
14960
+ output.log(chalk38.bold("Content:"));
14781
14961
  output.log("─".repeat(60));
14782
14962
  output.log(prompt);
14783
14963
  output.log("─".repeat(60));
@@ -14807,7 +14987,7 @@ function parseVars(vars) {
14807
14987
 
14808
14988
  // src/commands/prompt/add.ts
14809
14989
  import { readFile as readFile2 } from "fs/promises";
14810
- import chalk38 from "chalk";
14990
+ import chalk39 from "chalk";
14811
14991
  var AddCommand2 = {
14812
14992
  command: "add <name>",
14813
14993
  describe: "添加 prompt 并持久化到 ~/.local/share/roy-agent/prompts/",
@@ -14858,8 +15038,8 @@ var AddCommand2 = {
14858
15038
  length: content.trim().length
14859
15039
  });
14860
15040
  } else {
14861
- output.log(chalk38.green(`✓ Prompt '${args.name}' saved`));
14862
- output.log(chalk38.gray(` ${filePath}`));
15041
+ output.log(chalk39.green(`✓ Prompt '${args.name}' saved`));
15042
+ output.log(chalk39.gray(` ${filePath}`));
14863
15043
  }
14864
15044
  } catch (error) {
14865
15045
  output.error(`Failed to add prompt: ${error}`);
@@ -14871,7 +15051,7 @@ var AddCommand2 = {
14871
15051
  };
14872
15052
 
14873
15053
  // src/commands/prompt/config-dir.ts
14874
- import chalk39 from "chalk";
15054
+ import chalk40 from "chalk";
14875
15055
  var ConfigDirCommand2 = {
14876
15056
  command: "config-dir",
14877
15057
  describe: "显示 prompt 持久化目录路径",
@@ -14901,8 +15081,8 @@ var ConfigDirCommand2 = {
14901
15081
  if (args.json) {
14902
15082
  output.json({ configDir, exists });
14903
15083
  } else {
14904
- output.log(`${chalk39.cyan("Prompt Config Directory:")} ${configDir}`);
14905
- output.log(`${chalk39.gray("Exists:")} ${exists ? "yes" : "no"}`);
15084
+ output.log(`${chalk40.cyan("Prompt Config Directory:")} ${configDir}`);
15085
+ output.log(`${chalk40.gray("Exists:")} ${exists ? "yes" : "no"}`);
14906
15086
  }
14907
15087
  } catch (error) {
14908
15088
  output.error(`Failed to get config dir: ${error}`);
@@ -14924,7 +15104,7 @@ var PromptCommand = {
14924
15104
  };
14925
15105
 
14926
15106
  // src/commands/commands-list.ts
14927
- import chalk40 from "chalk";
15107
+ import chalk41 from "chalk";
14928
15108
  function truncateVisual(str, maxWidth) {
14929
15109
  let result = "";
14930
15110
  let width = 0;
@@ -14939,16 +15119,16 @@ function truncateVisual(str, maxWidth) {
14939
15119
  }
14940
15120
  function formatCommandsTable(commands) {
14941
15121
  if (commands.length === 0) {
14942
- return chalk40.yellow("命令目录为空,使用 'roy-agent commands add' 添加命令");
15122
+ return chalk41.yellow("命令目录为空,使用 'roy-agent commands add' 添加命令");
14943
15123
  }
14944
15124
  const NAME_WIDTH = 20;
14945
15125
  const SOURCE_WIDTH = 10;
14946
15126
  const DESC_WIDTH = 50;
14947
15127
  const GAP = " ";
14948
15128
  const headerLine = [
14949
- chalk40.bold("NAME".padEnd(NAME_WIDTH)),
14950
- chalk40.bold("SOURCE".padEnd(SOURCE_WIDTH)),
14951
- chalk40.bold("DESCRIPTION")
15129
+ chalk41.bold("NAME".padEnd(NAME_WIDTH)),
15130
+ chalk41.bold("SOURCE".padEnd(SOURCE_WIDTH)),
15131
+ chalk41.bold("DESCRIPTION")
14952
15132
  ].join(GAP);
14953
15133
  const sepLine = "─".repeat(NAME_WIDTH + SOURCE_WIDTH + DESC_WIDTH + GAP.length * 2);
14954
15134
  const formatRow = (cmd) => {
@@ -14972,7 +15152,7 @@ var CommandsListCommand = {
14972
15152
  describe: "JSON 格式输出",
14973
15153
  type: "boolean",
14974
15154
  default: false
14975
- }).option("config", {
15155
+ }).option("limit", PAGINATION_OPTIONS.limit).option("offset", PAGINATION_OPTIONS.offset).option("quiet", { alias: "q", type: "boolean", hidden: true }).option("config", {
14976
15156
  describe: "配置文件路径",
14977
15157
  type: "string"
14978
15158
  }),
@@ -14992,18 +15172,41 @@ var CommandsListCommand = {
14992
15172
  process.exit(1);
14993
15173
  }
14994
15174
  const result = await commandsComponent.discover({ pattern: args.pattern });
15175
+ const total = result.commands.length;
15176
+ const page = {
15177
+ limit: args.limit ?? 20,
15178
+ offset: args.offset ?? 0
15179
+ };
15180
+ const commands = applyPagination(result.commands, page);
14995
15181
  if (args.json) {
14996
15182
  output.json({
14997
- commands: result.commands.map((cmd) => ({
15183
+ total,
15184
+ count: commands.length,
15185
+ truncated: total > commands.length,
15186
+ limit: page.limit,
15187
+ offset: page.offset,
15188
+ pattern: args.pattern ?? null,
15189
+ stats: result.stats,
15190
+ commands: commands.map((cmd) => ({
14998
15191
  name: cmd.name,
14999
15192
  path: cmd.path,
15000
15193
  source: cmd.source,
15001
15194
  description: cmd.shortDescription
15002
- })),
15003
- stats: result.stats
15195
+ }))
15196
+ });
15197
+ } else if (args.quiet) {
15198
+ output.log(renderQuietHeader(total, "command"));
15199
+ commands.forEach((cmd) => output.log(renderQuietLine(cmd.name, cmd.name)));
15200
+ const hint = renderQuietPaginationHint({
15201
+ count: commands.length,
15202
+ total,
15203
+ offset: page.offset,
15204
+ limit: page.limit
15004
15205
  });
15206
+ if (hint)
15207
+ output.log(hint);
15005
15208
  } else {
15006
- const rows = result.commands.map((cmd) => ({
15209
+ const rows = commands.map((cmd) => ({
15007
15210
  name: cmd.name,
15008
15211
  path: cmd.path,
15009
15212
  source: cmd.source === "user" ? "USER" : "PROJECT",
@@ -15011,7 +15214,17 @@ var CommandsListCommand = {
15011
15214
  }));
15012
15215
  output.log(formatCommandsTable(rows));
15013
15216
  output.info("");
15014
- output.log(chalk40.green(`✅ 共 ${result.commands.length} 个命令`) + chalk40.gray(` (user: ${result.stats.userCount}, project: ${result.stats.projectCount})`));
15217
+ output.log(renderPaginationFooter({
15218
+ total,
15219
+ count: commands.length,
15220
+ offset: page.offset,
15221
+ limit: page.limit,
15222
+ itemName: "command",
15223
+ extras: [
15224
+ `user:${result.stats.userCount}`,
15225
+ `project:${result.stats.projectCount}`
15226
+ ]
15227
+ }));
15015
15228
  }
15016
15229
  } catch (error) {
15017
15230
  output.error(`Failed to list commands: ${error}`);
@@ -15023,7 +15236,7 @@ var CommandsListCommand = {
15023
15236
  };
15024
15237
 
15025
15238
  // src/commands/commands-add.ts
15026
- import chalk41 from "chalk";
15239
+ import chalk42 from "chalk";
15027
15240
  var CommandsAddCommand = {
15028
15241
  command: "add <name> <target>",
15029
15242
  describe: "添加收藏命令(自动创建 symlink)",
@@ -15084,10 +15297,10 @@ var CommandsAddCommand = {
15084
15297
  });
15085
15298
  const dirs = await commandsComponent.getCommandDirs();
15086
15299
  const targetDir = source === "user" ? dirs.user : dirs.project;
15087
- output.log(chalk41.green(`✅ 已添加命令 '${args.name}'`));
15088
- output.log(chalk41.gray(` 目标: ${args.target}`));
15089
- output.log(chalk41.gray(` 位置: ${targetDir}/${args.name}`));
15090
- output.log(chalk41.gray(` 级别: ${source === "user" ? "USER" : "PROJECT"}`));
15300
+ output.log(chalk42.green(`✅ 已添加命令 '${args.name}'`));
15301
+ output.log(chalk42.gray(` 目标: ${args.target}`));
15302
+ output.log(chalk42.gray(` 位置: ${targetDir}/${args.name}`));
15303
+ output.log(chalk42.gray(` 级别: ${source === "user" ? "USER" : "PROJECT"}`));
15091
15304
  } catch (error) {
15092
15305
  output.error(`添加失败: ${error.message}`);
15093
15306
  process.exit(1);
@@ -15098,7 +15311,7 @@ var CommandsAddCommand = {
15098
15311
  };
15099
15312
 
15100
15313
  // src/commands/commands-remove.ts
15101
- import chalk42 from "chalk";
15314
+ import chalk43 from "chalk";
15102
15315
  var CommandsRemoveCommand = {
15103
15316
  command: "remove <name>",
15104
15317
  aliases: ["rm"],
@@ -15142,7 +15355,7 @@ var CommandsRemoveCommand = {
15142
15355
  name: args.name,
15143
15356
  source: "user"
15144
15357
  });
15145
- output.log(chalk42.green(`✅ 已从用户目录移除命令 '${args.name}'`));
15358
+ output.log(chalk43.green(`✅ 已从用户目录移除命令 '${args.name}'`));
15146
15359
  } catch (error) {
15147
15360
  if (!error.message?.includes("不存在")) {
15148
15361
  throw error;
@@ -15155,7 +15368,7 @@ var CommandsRemoveCommand = {
15155
15368
  name: args.name,
15156
15369
  source: "project"
15157
15370
  });
15158
- output.log(chalk42.green(`✅ 已从项目目录移除命令 '${args.name}'`));
15371
+ output.log(chalk43.green(`✅ 已从项目目录移除命令 '${args.name}'`));
15159
15372
  } catch (error) {
15160
15373
  if (!error.message?.includes("不存在")) {
15161
15374
  throw error;
@@ -15169,7 +15382,7 @@ var CommandsRemoveCommand = {
15169
15382
  name: args.name,
15170
15383
  source: "user"
15171
15384
  });
15172
- output.log(chalk42.green(`✅ 已从用户目录移除命令 '${args.name}'`));
15385
+ output.log(chalk43.green(`✅ 已从用户目录移除命令 '${args.name}'`));
15173
15386
  removed = true;
15174
15387
  } catch (error) {
15175
15388
  if (!error.message?.includes("不存在")) {
@@ -15181,7 +15394,7 @@ var CommandsRemoveCommand = {
15181
15394
  name: args.name,
15182
15395
  source: "project"
15183
15396
  });
15184
- output.log(chalk42.green(`✅ 已从项目目录移除命令 '${args.name}'`));
15397
+ output.log(chalk43.green(`✅ 已从项目目录移除命令 '${args.name}'`));
15185
15398
  removed = true;
15186
15399
  } catch (error) {
15187
15400
  if (!error.message?.includes("不存在")) {
@@ -15203,7 +15416,7 @@ var CommandsRemoveCommand = {
15203
15416
  };
15204
15417
 
15205
15418
  // src/commands/commands-info.ts
15206
- import chalk43 from "chalk";
15419
+ import chalk44 from "chalk";
15207
15420
  import { exec as exec2 } from "child_process";
15208
15421
  import { promisify } from "util";
15209
15422
  var execAsync2 = promisify(exec2);
@@ -15238,12 +15451,12 @@ var CommandsInfoCommand = {
15238
15451
  output.error(`命令 '${args.name}' 不存在`);
15239
15452
  process.exit(1);
15240
15453
  }
15241
- output.log(chalk43.bold("Name:") + ` ${info.name}`);
15242
- output.log(chalk43.bold("Path:") + ` ${info.path}`);
15243
- output.log(chalk43.bold("Source:") + ` ${info.source.toUpperCase()}`);
15244
- output.log(chalk43.bold("Description:") + ` ${info.shortDescription || "-"}`);
15454
+ output.log(chalk44.bold("Name:") + ` ${info.name}`);
15455
+ output.log(chalk44.bold("Path:") + ` ${info.path}`);
15456
+ output.log(chalk44.bold("Source:") + ` ${info.source.toUpperCase()}`);
15457
+ output.log(chalk44.bold("Description:") + ` ${info.shortDescription || "-"}`);
15245
15458
  output.log();
15246
- output.log(chalk43.gray("─".repeat(50)));
15459
+ output.log(chalk44.gray("─".repeat(50)));
15247
15460
  output.log();
15248
15461
  try {
15249
15462
  const { stdout } = await execAsync2(`${info.path} --help`, { timeout: 5000 });
@@ -15253,7 +15466,7 @@ var CommandsInfoCommand = {
15253
15466
  const { stdout } = await execAsync2(`${info.path} -h`, { timeout: 5000 });
15254
15467
  output.log(stdout);
15255
15468
  } catch {
15256
- output.log(chalk43.gray("(无法获取帮助信息)"));
15469
+ output.log(chalk44.gray("(无法获取帮助信息)"));
15257
15470
  }
15258
15471
  }
15259
15472
  } catch (error) {
@@ -15266,7 +15479,7 @@ var CommandsInfoCommand = {
15266
15479
  };
15267
15480
 
15268
15481
  // src/commands/commands-dirs.ts
15269
- import chalk44 from "chalk";
15482
+ import chalk45 from "chalk";
15270
15483
  var CommandsDirsCommand = {
15271
15484
  command: "dirs",
15272
15485
  describe: "显示命令目录",
@@ -15298,10 +15511,10 @@ var CommandsDirsCommand = {
15298
15511
  if (args.json) {
15299
15512
  output.json(dirs);
15300
15513
  } else {
15301
- output.log(chalk44.bold("命令目录:"));
15514
+ output.log(chalk45.bold("命令目录:"));
15302
15515
  output.log();
15303
- output.log(chalk44.cyan("USER:") + ` ${dirs.user}`);
15304
- output.log(chalk44.cyan("PROJECT:") + ` ${dirs.project}`);
15516
+ output.log(chalk45.cyan("USER:") + ` ${dirs.user}`);
15517
+ output.log(chalk45.cyan("PROJECT:") + ` ${dirs.project}`);
15305
15518
  }
15306
15519
  } catch (error) {
15307
15520
  output.error(`错误: ${error.message}`);
@@ -15321,7 +15534,7 @@ var CommandsCommand = {
15321
15534
  };
15322
15535
 
15323
15536
  // src/commands/config/list.ts
15324
- import chalk45 from "chalk";
15537
+ import chalk46 from "chalk";
15325
15538
 
15326
15539
  // src/commands/config/config-service.ts
15327
15540
  import * as fsSync from "fs";
@@ -15625,7 +15838,7 @@ var ConfigListCommand = {
15625
15838
  output.log("");
15626
15839
  output.log("Supported components:");
15627
15840
  for (const comp of SUPPORTED_COMPONENTS) {
15628
- output.log(` ${chalk45.cyan(comp.padEnd(15))} ${COMPONENT_DESCRIPTIONS[comp] || ""}`);
15841
+ output.log(` ${chalk46.cyan(comp.padEnd(15))} ${COMPONENT_DESCRIPTIONS[comp] || ""}`);
15629
15842
  }
15630
15843
  process.exit(1);
15631
15844
  }
@@ -15643,27 +15856,27 @@ var ConfigListCommand = {
15643
15856
  }
15644
15857
  };
15645
15858
  function showHelp(output) {
15646
- output.log(chalk45.bold.cyan("# roy-agent config list"));
15859
+ output.log(chalk46.bold.cyan("# roy-agent config list"));
15647
15860
  output.log("");
15648
15861
  output.log("查看 roy-agent 组件配置信息");
15649
15862
  output.log("");
15650
- output.log(chalk45.bold("Usage:"));
15651
- output.log(` ${chalk45.cyan("roy-agent config list [component] [options]")}`);
15863
+ output.log(chalk46.bold("Usage:"));
15864
+ output.log(` ${chalk46.cyan("roy-agent config list [component] [options]")}`);
15652
15865
  output.log("");
15653
- output.log(chalk45.bold("Components:"));
15866
+ output.log(chalk46.bold("Components:"));
15654
15867
  for (const comp of SUPPORTED_COMPONENTS) {
15655
- output.log(` ${chalk45.cyan(comp.padEnd(15))} ${chalk45.gray(COMPONENT_DESCRIPTIONS[comp] || "")}`);
15868
+ output.log(` ${chalk46.cyan(comp.padEnd(15))} ${chalk46.gray(COMPONENT_DESCRIPTIONS[comp] || "")}`);
15656
15869
  }
15657
- output.log(` ${chalk45.cyan("all".padEnd(15))} 显示所有 components 概览`);
15870
+ output.log(` ${chalk46.cyan("all".padEnd(15))} 显示所有 components 概览`);
15658
15871
  output.log("");
15659
- output.log(chalk45.bold("Options:"));
15660
- output.log(` ${chalk45.cyan("-j, --json")} JSON 格式输出`);
15661
- output.log(` ${chalk45.cyan("-k, --keys")} 只显示配置键`);
15662
- output.log(` ${chalk45.cyan("-s, --sources")} 只显示配置源`);
15872
+ output.log(chalk46.bold("Options:"));
15873
+ output.log(` ${chalk46.cyan("-j, --json")} JSON 格式输出`);
15874
+ output.log(` ${chalk46.cyan("-k, --keys")} 只显示配置键`);
15875
+ output.log(` ${chalk46.cyan("-s, --sources")} 只显示配置源`);
15663
15876
  output.log("");
15664
- output.log(chalk45.bold("Examples:"));
15877
+ output.log(chalk46.bold("Examples:"));
15665
15878
  for (const { command: command2, description } of USAGE_COMMANDS) {
15666
- output.log(` ${chalk45.cyan(command2.padEnd(40))} ${chalk45.gray(description)}`);
15879
+ output.log(` ${chalk46.cyan(command2.padEnd(40))} ${chalk46.gray(description)}`);
15667
15880
  }
15668
15881
  }
15669
15882
  async function showAllComponents(output, configService) {
@@ -15672,13 +15885,13 @@ async function showAllComponents(output, configService) {
15672
15885
  const config = configService.getComponentConfig(compName);
15673
15886
  components.push({ name: compName, config });
15674
15887
  }
15675
- output.log(chalk45.bold.cyan("# All Components Overview"));
15888
+ output.log(chalk46.bold.cyan("# All Components Overview"));
15676
15889
  output.log("");
15677
- output.log(` ${chalk45.cyan("Component".padEnd(15))} ${chalk45.cyan("Keys".padEnd(10))} ${chalk45.gray("Description")}`);
15678
- output.log(` ${chalk45.gray("─".repeat(60))}`);
15890
+ output.log(` ${chalk46.cyan("Component".padEnd(15))} ${chalk46.cyan("Keys".padEnd(10))} ${chalk46.gray("Description")}`);
15891
+ output.log(` ${chalk46.gray("─".repeat(60))}`);
15679
15892
  for (const comp of components) {
15680
15893
  const keyCount = Object.keys(comp.config).length;
15681
- output.log(` ${chalk45.cyan(comp.name.padEnd(15))} ${keyCount.toString().padEnd(10)} ${chalk45.gray(COMPONENT_DESCRIPTIONS[comp.name] || "")}`);
15894
+ output.log(` ${chalk46.cyan(comp.name.padEnd(15))} ${keyCount.toString().padEnd(10)} ${chalk46.gray(COMPONENT_DESCRIPTIONS[comp.name] || "")}`);
15682
15895
  }
15683
15896
  }
15684
15897
  async function showComponentConfig(componentName, output, configService, options) {
@@ -15700,22 +15913,22 @@ async function showComponentConfig(componentName, output, configService, options
15700
15913
  });
15701
15914
  return;
15702
15915
  }
15703
- output.log(chalk45.bold.cyan(`# ${componentName} Component Configuration`));
15916
+ output.log(chalk46.bold.cyan(`# ${componentName} Component Configuration`));
15704
15917
  output.log("");
15705
15918
  if (filePath) {
15706
- output.log(chalk45.bold("File:"));
15707
- output.log(` ${chalk45.cyan(filePath)}`);
15919
+ output.log(chalk46.bold("File:"));
15920
+ output.log(` ${chalk46.cyan(filePath)}`);
15708
15921
  output.log("");
15709
15922
  }
15710
15923
  if (!options.sources) {
15711
- output.log(chalk45.bold("Configuration:"));
15924
+ output.log(chalk46.bold("Configuration:"));
15712
15925
  if (Object.keys(config).length === 0) {
15713
- output.log(` ${chalk45.gray("(无配置)")}`);
15926
+ output.log(` ${chalk46.gray("(无配置)")}`);
15714
15927
  } else {
15715
15928
  const flatConfig = flattenConfig(config);
15716
15929
  for (const [key, value] of flatConfig) {
15717
15930
  const displayValue = formatValue(value);
15718
- output.log(` ${chalk45.cyan(key + ":")} ${displayValue}`);
15931
+ output.log(` ${chalk46.cyan(key + ":")} ${displayValue}`);
15719
15932
  }
15720
15933
  }
15721
15934
  output.log("");
@@ -15730,17 +15943,17 @@ async function showAgentComponentConfig(output, configService, options) {
15730
15943
  });
15731
15944
  return;
15732
15945
  }
15733
- output.log(chalk45.bold.cyan("# Agent Component Configuration"));
15946
+ output.log(chalk46.bold.cyan("# Agent Component Configuration"));
15734
15947
  output.log("");
15735
15948
  if (!options.sources) {
15736
- output.log(chalk45.bold("Configuration:"));
15949
+ output.log(chalk46.bold("Configuration:"));
15737
15950
  if (Object.keys(config).length === 0) {
15738
- output.log(` ${chalk45.gray("(无配置,使用默认值)")}`);
15951
+ output.log(` ${chalk46.gray("(无配置,使用默认值)")}`);
15739
15952
  } else {
15740
15953
  const flatConfig = flattenConfig(config);
15741
15954
  for (const [key, value] of flatConfig) {
15742
15955
  const displayValue = formatValue(value);
15743
- output.log(` ${chalk45.cyan(key + ":")} ${displayValue}`);
15956
+ output.log(` ${chalk46.cyan(key + ":")} ${displayValue}`);
15744
15957
  }
15745
15958
  }
15746
15959
  output.log("");
@@ -15754,10 +15967,10 @@ async function showAgentComponentConfig(output, configService, options) {
15754
15967
  const configDir = registry.getConfigDir();
15755
15968
  const exists = registry.configDirExists();
15756
15969
  const agentCount = registry.list().length;
15757
- output.log(chalk45.bold("Agent Config Directory:"));
15758
- output.log(` ${chalk45.cyan("path:")} ${configDir}`);
15759
- output.log(` ${chalk45.cyan("exists:")} ${exists ? chalk45.green("yes") : chalk45.red("no")}`);
15760
- output.log(` ${chalk45.cyan("agents:")} ${agentCount} loaded`);
15970
+ output.log(chalk46.bold("Agent Config Directory:"));
15971
+ output.log(` ${chalk46.cyan("path:")} ${configDir}`);
15972
+ output.log(` ${chalk46.cyan("exists:")} ${exists ? chalk46.green("yes") : chalk46.red("no")}`);
15973
+ output.log(` ${chalk46.cyan("agents:")} ${agentCount} loaded`);
15761
15974
  output.log("");
15762
15975
  }
15763
15976
  }
@@ -15773,41 +15986,41 @@ async function showPromptComponentConfig(output, configService, options, envServ
15773
15986
  });
15774
15987
  return;
15775
15988
  }
15776
- output.log(chalk45.bold.cyan("# Prompt Component Configuration"));
15989
+ output.log(chalk46.bold.cyan("# Prompt Component Configuration"));
15777
15990
  output.log("");
15778
15991
  if (filePath) {
15779
- output.log(chalk45.bold("File:"));
15780
- output.log(` ${chalk45.cyan(filePath)}`);
15992
+ output.log(chalk46.bold("File:"));
15993
+ output.log(` ${chalk46.cyan(filePath)}`);
15781
15994
  output.log("");
15782
15995
  }
15783
15996
  if (!options.sources) {
15784
- output.log(chalk45.bold("Configuration:"));
15997
+ output.log(chalk46.bold("Configuration:"));
15785
15998
  if (Object.keys(config).length === 0) {
15786
- output.log(` ${chalk45.gray("(无配置,使用默认值)")}`);
15999
+ output.log(` ${chalk46.gray("(无配置,使用默认值)")}`);
15787
16000
  } else {
15788
16001
  const flatConfig = flattenConfig(config);
15789
16002
  for (const [key, value] of flatConfig) {
15790
16003
  const displayValue = formatValue(value);
15791
- output.log(` ${chalk45.cyan(key + ":")} ${displayValue}`);
16004
+ output.log(` ${chalk46.cyan(key + ":")} ${displayValue}`);
15792
16005
  }
15793
16006
  }
15794
16007
  output.log("");
15795
16008
  }
15796
- output.log(chalk45.bold("Prompts:"));
15797
- output.log(` ${chalk45.gray("- 内置: 5 个(default, coding, review, project-memory, global-memory)")}`);
16009
+ output.log(chalk46.bold("Prompts:"));
16010
+ output.log(` ${chalk46.gray("- 内置: 5 个(default, coding, review, project-memory, global-memory)")}`);
15798
16011
  const promptPaths = config?.promptPaths;
15799
16012
  if (promptPaths && Array.isArray(promptPaths) && promptPaths.length > 0) {
15800
- output.log(` ${chalk45.gray("- 外部: " + promptPaths.length + " 个路径")}`);
16013
+ output.log(` ${chalk46.gray("- 外部: " + promptPaths.length + " 个路径")}`);
15801
16014
  for (const p of promptPaths) {
15802
- output.log(` ${chalk45.cyan(p.path)} ${chalk45.gray("(type: " + p.type + ")")}`);
16015
+ output.log(` ${chalk46.cyan(p.path)} ${chalk46.gray("(type: " + p.type + ")")}`);
15803
16016
  }
15804
16017
  } else {
15805
- output.log(` ${chalk45.gray("- 外部: 0 个(未配置 promptPaths)")}`);
16018
+ output.log(` ${chalk46.gray("- 外部: 0 个(未配置 promptPaths)")}`);
15806
16019
  }
15807
16020
  output.log("");
15808
16021
  const defaultName = config?.defaultName || "default";
15809
- output.log(chalk45.bold("Default Prompt:"));
15810
- output.log(` ${chalk45.cyan("defaultName:")} ${defaultName}`);
16022
+ output.log(chalk46.bold("Default Prompt:"));
16023
+ output.log(` ${chalk46.cyan("defaultName:")} ${defaultName}`);
15811
16024
  output.log("");
15812
16025
  const env = envService?.getEnvironment?.();
15813
16026
  if (env) {
@@ -15822,10 +16035,10 @@ async function showPromptComponentConfig(output, configService, options, envServ
15822
16035
  const stored = await store?.loadAll?.();
15823
16036
  promptCount = Array.isArray(stored) ? stored.length : 0;
15824
16037
  } catch {}
15825
- output.log(chalk45.bold("Prompt Storage Directory:"));
15826
- output.log(` ${chalk45.cyan("path:")} ${configDir}`);
15827
- output.log(` ${chalk45.cyan("exists:")} ${exists ? chalk45.green("yes") : chalk45.red("no")}`);
15828
- output.log(` ${chalk45.cyan("prompts:")} ${promptCount} loaded`);
16038
+ output.log(chalk46.bold("Prompt Storage Directory:"));
16039
+ output.log(` ${chalk46.cyan("path:")} ${configDir}`);
16040
+ output.log(` ${chalk46.cyan("exists:")} ${exists ? chalk46.green("yes") : chalk46.red("no")}`);
16041
+ output.log(` ${chalk46.cyan("prompts:")} ${promptCount} loaded`);
15829
16042
  output.log("");
15830
16043
  }
15831
16044
  }
@@ -15851,19 +16064,19 @@ function flattenConfig(obj, prefix = "") {
15851
16064
  }
15852
16065
  function formatValue(value) {
15853
16066
  if (value === undefined) {
15854
- return chalk45.gray("undefined");
16067
+ return chalk46.gray("undefined");
15855
16068
  }
15856
16069
  if (value === null) {
15857
- return chalk45.gray("null");
16070
+ return chalk46.gray("null");
15858
16071
  }
15859
16072
  if (typeof value === "object") {
15860
- return chalk45.gray(JSON.stringify(value));
16073
+ return chalk46.gray(JSON.stringify(value));
15861
16074
  }
15862
16075
  return String(value);
15863
16076
  }
15864
16077
 
15865
16078
  // src/commands/config/export.ts
15866
- import chalk46 from "chalk";
16079
+ import chalk47 from "chalk";
15867
16080
  var ConfigExportCommand = {
15868
16081
  command: "export <component>",
15869
16082
  describe: "导出组件配置到文件",
@@ -15908,7 +16121,7 @@ var ConfigExportCommand = {
15908
16121
  output.log("");
15909
16122
  output.log("Supported components:");
15910
16123
  for (const comp of SUPPORTED_COMPONENTS) {
15911
- output.log(` ${chalk46.cyan(comp)}`);
16124
+ output.log(` ${chalk47.cyan(comp)}`);
15912
16125
  }
15913
16126
  process.exit(1);
15914
16127
  }
@@ -15926,7 +16139,7 @@ var ConfigExportCommand = {
15926
16139
  };
15927
16140
 
15928
16141
  // src/commands/config/import.ts
15929
- import chalk47 from "chalk";
16142
+ import chalk48 from "chalk";
15930
16143
  var ConfigImportCommand = {
15931
16144
  command: "import <component>",
15932
16145
  describe: "从文件导入配置到组件的 file source",
@@ -15976,7 +16189,7 @@ var ConfigImportCommand = {
15976
16189
  output.log("");
15977
16190
  output.log("Supported components:");
15978
16191
  for (const comp of SUPPORTED_COMPONENTS) {
15979
- output.log(` ${chalk47.cyan(comp)}`);
16192
+ output.log(` ${chalk48.cyan(comp)}`);
15980
16193
  }
15981
16194
  process.exit(1);
15982
16195
  }
@@ -15991,7 +16204,7 @@ var ConfigImportCommand = {
15991
16204
  }
15992
16205
  if (result.merged && result.changes.length > 0 && args.verbose) {
15993
16206
  output.log("");
15994
- output.log(chalk47.bold("变更详情:"));
16207
+ output.log(chalk48.bold("变更详情:"));
15995
16208
  for (const change of result.changes) {
15996
16209
  output.log(` ${change.key}: ${JSON.stringify(change.oldValue)} → ${JSON.stringify(change.newValue)}`);
15997
16210
  }
@@ -16015,7 +16228,7 @@ var ConfigCommand = {
16015
16228
  };
16016
16229
 
16017
16230
  // src/commands/mcp/list.ts
16018
- import chalk48 from "chalk";
16231
+ import chalk49 from "chalk";
16019
16232
  var ListCommand6 = {
16020
16233
  command: "list",
16021
16234
  aliases: ["ls"],
@@ -16025,12 +16238,7 @@ var ListCommand6 = {
16025
16238
  type: "boolean",
16026
16239
  default: false,
16027
16240
  description: "JSON 输出"
16028
- }).option("quiet", {
16029
- alias: "q",
16030
- type: "boolean",
16031
- default: false,
16032
- description: "简洁输出"
16033
- }),
16241
+ }).option("limit", PAGINATION_OPTIONS.limit).option("offset", PAGINATION_OPTIONS.offset).option("quiet", { alias: "q", type: "boolean", hidden: true }),
16034
16242
  async handler(args) {
16035
16243
  const output = new OutputService2;
16036
16244
  const envService = new EnvironmentService(output);
@@ -16046,45 +16254,64 @@ var ListCommand6 = {
16046
16254
  output.error("McpComponent not available");
16047
16255
  process.exit(1);
16048
16256
  }
16049
- const servers = mcpComponent.listServers();
16257
+ const allServers = mcpComponent.listServers();
16258
+ const total = allServers.length;
16259
+ const page = {
16260
+ limit: args.limit ?? 20,
16261
+ offset: args.offset ?? 0
16262
+ };
16263
+ const servers = applyPagination(allServers, page);
16050
16264
  if (args.json) {
16051
16265
  output.json({
16266
+ total,
16267
+ count: servers.length,
16268
+ truncated: total > servers.length,
16269
+ limit: page.limit,
16270
+ offset: page.offset,
16052
16271
  servers: servers.map((s) => ({
16053
16272
  name: s.name,
16054
16273
  status: s.status,
16055
16274
  error: s.error,
16056
16275
  toolsCount: s.toolsCount
16057
- })),
16058
- count: servers.length
16276
+ }))
16059
16277
  });
16060
16278
  } else if (args.quiet) {
16061
- servers.forEach((s) => output.log(s.name));
16279
+ output.log(renderQuietHeader(total, "mcp server"));
16280
+ servers.forEach((s) => output.log(renderQuietLine(s.name, s.name)));
16281
+ const hint = renderQuietPaginationHint({
16282
+ count: servers.length,
16283
+ total,
16284
+ offset: page.offset,
16285
+ limit: page.limit
16286
+ });
16287
+ if (hint)
16288
+ output.log(hint);
16062
16289
  } else {
16063
16290
  if (servers.length === 0) {
16064
- output.log(chalk48.yellow("No MCP servers configured"));
16291
+ output.log(chalk49.yellow("No MCP servers configured"));
16065
16292
  return;
16066
16293
  }
16067
16294
  const statusColor = (status) => {
16068
16295
  switch (status) {
16069
16296
  case "connected":
16070
- return chalk48.green;
16297
+ return chalk49.green;
16071
16298
  case "connecting":
16072
- return chalk48.yellow;
16299
+ return chalk49.yellow;
16073
16300
  case "error":
16074
- return chalk48.red;
16301
+ return chalk49.red;
16075
16302
  case "disconnected":
16076
- return chalk48.gray;
16303
+ return chalk49.gray;
16077
16304
  default:
16078
- return chalk48.white;
16305
+ return chalk49.white;
16079
16306
  }
16080
16307
  };
16081
16308
  const header = [
16082
- chalk48.bold("Name"),
16083
- chalk48.bold("Status"),
16084
- chalk48.bold("Tools")
16309
+ chalk49.bold("Name"),
16310
+ chalk49.bold("Status"),
16311
+ chalk49.bold("Tools")
16085
16312
  ].join(" | ");
16086
16313
  const rows = servers.map((s) => [
16087
- chalk48.cyan(s.name),
16314
+ chalk49.cyan(s.name),
16088
16315
  statusColor(s.status)(`[${s.status}]`),
16089
16316
  s.toolsCount !== undefined ? String(s.toolsCount) : "-"
16090
16317
  ].join(" | "));
@@ -16095,7 +16322,13 @@ var ListCommand6 = {
16095
16322
  ...rows.map((r) => `│${r}│`),
16096
16323
  "└" + "─".repeat(header.length + 2) + "┘",
16097
16324
  "",
16098
- chalk48.gray(`Total: ${servers.length} servers`)
16325
+ renderPaginationFooter({
16326
+ total,
16327
+ count: servers.length,
16328
+ offset: page.offset,
16329
+ limit: page.limit,
16330
+ itemName: "mcp server"
16331
+ })
16099
16332
  ].join(`
16100
16333
  `));
16101
16334
  }
@@ -16109,7 +16342,7 @@ var ListCommand6 = {
16109
16342
  };
16110
16343
 
16111
16344
  // src/commands/mcp/tools.ts
16112
- import chalk49 from "chalk";
16345
+ import chalk50 from "chalk";
16113
16346
  var ToolsCommand = {
16114
16347
  command: "tools",
16115
16348
  aliases: ["t"],
@@ -16162,7 +16395,7 @@ var ToolsCommand = {
16162
16395
  tools.forEach((t) => output.log(t.name));
16163
16396
  } else {
16164
16397
  if (tools.length === 0) {
16165
- output.log(chalk49.yellow("No MCP tools available"));
16398
+ output.log(chalk50.yellow("No MCP tools available"));
16166
16399
  return;
16167
16400
  }
16168
16401
  const byServer = new Map;
@@ -16174,15 +16407,15 @@ var ToolsCommand = {
16174
16407
  byServer.get(serverName).push(tool);
16175
16408
  }
16176
16409
  for (const [serverName, serverTools] of byServer) {
16177
- output.log(chalk49.bold.cyan(`
16410
+ output.log(chalk50.bold.cyan(`
16178
16411
  [${serverName}] ${serverTools.length} tools`));
16179
16412
  for (const tool of serverTools) {
16180
16413
  const desc2 = tool.description.length > 80 ? tool.description.slice(0, 77) + "..." : tool.description;
16181
- output.log(` ${chalk49.green("+")} ${chalk49.white(tool.name)}`);
16182
- output.log(` ${chalk49.gray(desc2)}`);
16414
+ output.log(` ${chalk50.green("+")} ${chalk50.white(tool.name)}`);
16415
+ output.log(` ${chalk50.gray(desc2)}`);
16183
16416
  }
16184
16417
  }
16185
- output.log(chalk49.gray(`
16418
+ output.log(chalk50.gray(`
16186
16419
  Total: ${tools.length} tools across ${byServer.size} servers`));
16187
16420
  }
16188
16421
  } catch (error) {
@@ -16195,7 +16428,7 @@ Total: ${tools.length} tools across ${byServer.size} servers`));
16195
16428
  };
16196
16429
 
16197
16430
  // src/commands/mcp/reload.ts
16198
- import chalk50 from "chalk";
16431
+ import chalk51 from "chalk";
16199
16432
  var ReloadCommand2 = {
16200
16433
  command: "reload",
16201
16434
  aliases: ["r"],
@@ -16216,19 +16449,19 @@ var ReloadCommand2 = {
16216
16449
  output.error("McpComponent not available");
16217
16450
  process.exit(1);
16218
16451
  }
16219
- output.log(chalk50.cyan("Reloading MCP servers..."));
16452
+ output.log(chalk51.cyan("Reloading MCP servers..."));
16220
16453
  await mcpComponent.reload();
16221
16454
  const servers = mcpComponent.listServers();
16222
16455
  const connected = servers.filter((s) => s.status === "connected").length;
16223
16456
  const errors = servers.filter((s) => s.status === "error").length;
16224
- output.log(chalk50.green(`✓ Reloaded ${servers.length} servers`));
16457
+ output.log(chalk51.green(`✓ Reloaded ${servers.length} servers`));
16225
16458
  if (connected > 0) {
16226
- output.log(chalk50.green(` • ${connected} connected`));
16459
+ output.log(chalk51.green(` • ${connected} connected`));
16227
16460
  }
16228
16461
  if (errors > 0) {
16229
16462
  output.warn(` • ${errors} failed`);
16230
16463
  for (const server of servers.filter((s) => s.status === "error")) {
16231
- output.log(chalk50.gray(` - ${server.name}: ${server.error}`));
16464
+ output.log(chalk51.gray(` - ${server.name}: ${server.error}`));
16232
16465
  }
16233
16466
  }
16234
16467
  } catch (error) {
@@ -16249,7 +16482,7 @@ var McpCommand = {
16249
16482
  };
16250
16483
 
16251
16484
  // src/commands/tools/list.ts
16252
- import chalk51 from "chalk";
16485
+ import chalk52 from "chalk";
16253
16486
  var ListCommand7 = {
16254
16487
  command: "list",
16255
16488
  aliases: ["ls"],
@@ -16259,12 +16492,7 @@ var ListCommand7 = {
16259
16492
  type: "boolean",
16260
16493
  default: false,
16261
16494
  description: "JSON 输出"
16262
- }).option("quiet", {
16263
- alias: "q",
16264
- type: "boolean",
16265
- default: false,
16266
- description: "简洁输出(仅名称)"
16267
- }),
16495
+ }).option("limit", PAGINATION_OPTIONS.limit).option("offset", PAGINATION_OPTIONS.offset).option("quiet", { alias: "q", type: "boolean", hidden: true }),
16268
16496
  async handler(args) {
16269
16497
  const output = new OutputService2;
16270
16498
  const envService = new EnvironmentService(output);
@@ -16280,10 +16508,20 @@ var ListCommand7 = {
16280
16508
  output.error("ToolComponent not available");
16281
16509
  process.exit(1);
16282
16510
  }
16283
- const tools = toolComponent.listTools();
16511
+ const allTools = toolComponent.listTools();
16512
+ const total = allTools.length;
16513
+ const page = {
16514
+ limit: args.limit ?? 20,
16515
+ offset: args.offset ?? 0
16516
+ };
16517
+ const tools = applyPagination(allTools, page);
16284
16518
  if (args.json) {
16285
16519
  output.json({
16520
+ total,
16286
16521
  count: tools.length,
16522
+ truncated: total > tools.length,
16523
+ limit: page.limit,
16524
+ offset: page.offset,
16287
16525
  tools: tools.map((t) => ({
16288
16526
  name: t.name,
16289
16527
  description: t.description,
@@ -16291,19 +16529,28 @@ var ListCommand7 = {
16291
16529
  }))
16292
16530
  });
16293
16531
  } else if (args.quiet) {
16294
- tools.forEach((t) => output.log(t.name));
16532
+ output.log(renderQuietHeader(total, "tool"));
16533
+ tools.forEach((t) => output.log(renderQuietLine(t.name, t.name)));
16534
+ const hint = renderQuietPaginationHint({
16535
+ count: tools.length,
16536
+ total,
16537
+ offset: page.offset,
16538
+ limit: page.limit
16539
+ });
16540
+ if (hint)
16541
+ output.log(hint);
16295
16542
  } else {
16296
16543
  const header = [
16297
- chalk51.bold("Name"),
16298
- chalk51.bold("Description"),
16299
- chalk51.bold("Category")
16544
+ chalk52.bold("Name"),
16545
+ chalk52.bold("Description"),
16546
+ chalk52.bold("Category")
16300
16547
  ].join(" | ");
16301
16548
  const rows = tools.map((t) => {
16302
16549
  const desc2 = t.description.length > 40 ? t.description.slice(0, 37) + "..." : t.description;
16303
16550
  return [
16304
- chalk51.cyan(t.name),
16551
+ chalk52.cyan(t.name),
16305
16552
  desc2,
16306
- t.metadata?.category ? chalk51.gray(`[${t.metadata.category}]`) : "-"
16553
+ t.metadata?.category ? chalk52.gray(`[${t.metadata.category}]`) : "-"
16307
16554
  ].join(" | ");
16308
16555
  });
16309
16556
  output.log([
@@ -16313,7 +16560,13 @@ var ListCommand7 = {
16313
16560
  ...rows.map((r) => `│${r}│`),
16314
16561
  "└" + "─".repeat(header.length + 2) + "┘",
16315
16562
  "",
16316
- chalk51.gray(`Total: ${tools.length} tools`)
16563
+ renderPaginationFooter({
16564
+ total,
16565
+ count: tools.length,
16566
+ offset: page.offset,
16567
+ limit: page.limit,
16568
+ itemName: "tool"
16569
+ })
16317
16570
  ].join(`
16318
16571
  `));
16319
16572
  }
@@ -16327,7 +16580,7 @@ var ListCommand7 = {
16327
16580
  };
16328
16581
 
16329
16582
  // src/commands/tools/get.ts
16330
- import chalk52 from "chalk";
16583
+ import chalk53 from "chalk";
16331
16584
 
16332
16585
  // src/commands/tools/shared/schema-helper.ts
16333
16586
  import { zodToJsonSchema } from "zod-to-json-schema";
@@ -16402,8 +16655,8 @@ var GetCommand6 = {
16402
16655
  }))
16403
16656
  });
16404
16657
  } else {
16405
- output.log(chalk52.bold.cyan(`Tool: ${tool.name}`));
16406
- output.log(chalk52.gray("─".repeat(60)));
16658
+ output.log(chalk53.bold.cyan(`Tool: ${tool.name}`));
16659
+ output.log(chalk53.gray("─".repeat(60)));
16407
16660
  output.log(`Description: ${tool.description}`);
16408
16661
  if (tool.metadata?.category) {
16409
16662
  output.log(`Category: ${tool.metadata.category}`);
@@ -16412,9 +16665,9 @@ var GetCommand6 = {
16412
16665
  output.log(`Tags: ${tool.metadata.tags.join(", ")}`);
16413
16666
  }
16414
16667
  output.log("");
16415
- output.log(chalk52.bold("Parameters:"));
16668
+ output.log(chalk53.bold("Parameters:"));
16416
16669
  for (const param of params) {
16417
- const required = param.required ? chalk52.red("(required)") : chalk52.gray("(optional)");
16670
+ const required = param.required ? chalk53.red("(required)") : chalk53.gray("(optional)");
16418
16671
  const defaultVal = param.default !== undefined ? ` [default: ${JSON.stringify(param.default)}]` : "";
16419
16672
  output.log(` --${param.name} <${param.type}> ${required}`);
16420
16673
  output.log(` ${param.description}${defaultVal}`);
@@ -16523,14 +16776,14 @@ var ToolsCommand2 = {
16523
16776
  };
16524
16777
 
16525
16778
  // src/commands/memory/record.ts
16526
- import chalk53 from "chalk";
16779
+ import chalk54 from "chalk";
16527
16780
  import { createMemoryAgentTools, getBuiltInPrompt } from "@ai-setting/roy-agent-core";
16528
16781
  import { bashTool, globTool, readFileTool } from "@ai-setting/roy-agent-core";
16529
16782
  async function runExtractMode(output, memoryComponent, agentComponent, sessionComponent, env, options) {
16530
16783
  const { scope, sessionId, require: userRequirement } = options;
16531
- output.log(chalk53.blue(`
16784
+ output.log(chalk54.blue(`
16532
16785
  \uD83D\uDD0D Memory Extract Mode (${scope})`));
16533
- output.log(chalk53.gray(`正在分析会话历史,生成记忆...
16786
+ output.log(chalk54.gray(`正在分析会话历史,生成记忆...
16534
16787
  `));
16535
16788
  try {
16536
16789
  const currentMemory = await memoryComponent.recallMemory(scope) || "(无现有记忆)";
@@ -16576,13 +16829,13 @@ async function runExtractMode(output, memoryComponent, agentComponent, sessionCo
16576
16829
  for (const tool of agentTools) {
16577
16830
  try {
16578
16831
  toolComponent.register(tool);
16579
- output.log(chalk53.gray(`Tool registered: ${tool.name}`));
16832
+ output.log(chalk54.gray(`Tool registered: ${tool.name}`));
16580
16833
  } catch (err) {
16581
- output.log(chalk53.gray(`Tool already registered: ${tool.name}`));
16834
+ output.log(chalk54.gray(`Tool already registered: ${tool.name}`));
16582
16835
  }
16583
16836
  }
16584
16837
  }
16585
- output.log(chalk53.gray(`Agent "${agentName}" registered with ${agentTools.length} tools`));
16838
+ output.log(chalk54.gray(`Agent "${agentName}" registered with ${agentTools.length} tools`));
16586
16839
  const query = `请分析会话历史,提炼${scope === "project" ? "项目" : "全局"}记忆并写入记忆文件。`;
16587
16840
  let result;
16588
16841
  try {
@@ -16596,12 +16849,12 @@ async function runExtractMode(output, memoryComponent, agentComponent, sessionCo
16596
16849
  if (result && result.startsWith("执行失败")) {
16597
16850
  output.error(`提取失败: ${result}`);
16598
16851
  } else if (result) {
16599
- output.log(chalk53.green(`
16852
+ output.log(chalk54.green(`
16600
16853
  ✅ 记忆提取完成`));
16601
- output.log(chalk53.gray(`记忆已保存到 memory 文件。
16854
+ output.log(chalk54.gray(`记忆已保存到 memory 文件。
16602
16855
  `));
16603
16856
  if (result.length > 0 && result !== "✅ 记忆提取完成") {
16604
- output.log(chalk53.gray(`执行摘要: ${result.substring(0, 200)}${result.length > 200 ? "..." : ""}`));
16857
+ output.log(chalk54.gray(`执行摘要: ${result.substring(0, 200)}${result.length > 200 ? "..." : ""}`));
16605
16858
  }
16606
16859
  }
16607
16860
  agentComponent.unregisterAgent(agentName);
@@ -16719,11 +16972,11 @@ var RecordCommand = {
16719
16972
  prepend: "已插入内容到记忆文件开头",
16720
16973
  delete: "已删除记忆文件"
16721
16974
  };
16722
- output.log(chalk53.green(`✓ ${actionMessages[result.action]}`));
16723
- output.log(chalk53.gray(`路径: ${result.path}`));
16975
+ output.log(chalk54.green(`✓ ${actionMessages[result.action]}`));
16976
+ output.log(chalk54.gray(`路径: ${result.path}`));
16724
16977
  if (result.action !== "delete" && a.content) {
16725
16978
  const preview = a.content.substring(0, 100);
16726
- output.log(chalk53.gray(`内容预览: ${preview}${a.content.length > 100 ? "..." : ""}`));
16979
+ output.log(chalk54.gray(`内容预览: ${preview}${a.content.length > 100 ? "..." : ""}`));
16727
16980
  }
16728
16981
  } catch (error) {
16729
16982
  output.error(`Failed to record memory: ${error}`);
@@ -16735,7 +16988,7 @@ var RecordCommand = {
16735
16988
  };
16736
16989
 
16737
16990
  // src/commands/memory/recall.ts
16738
- import chalk54 from "chalk";
16991
+ import chalk55 from "chalk";
16739
16992
  var RecallCommand = {
16740
16993
  command: "recall",
16741
16994
  aliases: ["load"],
@@ -16771,7 +17024,7 @@ var RecallCommand = {
16771
17024
  }
16772
17025
  const content = await memoryComponent.recallMemory(a.scope);
16773
17026
  if (!content) {
16774
- output.log(chalk54.gray("(No memory files found)"));
17027
+ output.log(chalk55.gray("(No memory files found)"));
16775
17028
  return;
16776
17029
  }
16777
17030
  if (a.json) {
@@ -16797,7 +17050,7 @@ var MemoryCommand = {
16797
17050
  handler: () => {}
16798
17051
  };
16799
17052
  // src/commands/eventsource/list.ts
16800
- import chalk55 from "chalk";
17053
+ import chalk56 from "chalk";
16801
17054
  function truncateVisual2(str, maxWidth) {
16802
17055
  let result = "";
16803
17056
  let width = 0;
@@ -16812,7 +17065,7 @@ function truncateVisual2(str, maxWidth) {
16812
17065
  }
16813
17066
  function formatSourcesTable(sources) {
16814
17067
  if (sources.length === 0) {
16815
- return chalk55.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加");
17068
+ return chalk56.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加");
16816
17069
  }
16817
17070
  const ID_WIDTH = 10;
16818
17071
  const NAME_WIDTH = 20;
@@ -16821,11 +17074,11 @@ function formatSourcesTable(sources) {
16821
17074
  const ENABLED_WIDTH = 8;
16822
17075
  const GAP = " ";
16823
17076
  const headerLine = [
16824
- chalk55.bold("ID".padEnd(ID_WIDTH)),
16825
- chalk55.bold("NAME".padEnd(NAME_WIDTH)),
16826
- chalk55.bold("TYPE".padEnd(TYPE_WIDTH)),
16827
- chalk55.bold("STATUS".padEnd(STATUS_WIDTH)),
16828
- chalk55.bold("ENABLED".padEnd(ENABLED_WIDTH))
17077
+ chalk56.bold("ID".padEnd(ID_WIDTH)),
17078
+ chalk56.bold("NAME".padEnd(NAME_WIDTH)),
17079
+ chalk56.bold("TYPE".padEnd(TYPE_WIDTH)),
17080
+ chalk56.bold("STATUS".padEnd(STATUS_WIDTH)),
17081
+ chalk56.bold("ENABLED".padEnd(ENABLED_WIDTH))
16829
17082
  ].join(GAP);
16830
17083
  const sepLine = "─".repeat(ID_WIDTH + NAME_WIDTH + TYPE_WIDTH + STATUS_WIDTH + ENABLED_WIDTH + GAP.length * 4);
16831
17084
  const formatRow = (src) => {
@@ -16849,15 +17102,9 @@ var EventSourceListCommand = {
16849
17102
  describe: "JSON 格式输出",
16850
17103
  type: "boolean",
16851
17104
  default: false
16852
- }).option("quiet", {
16853
- alias: "q",
16854
- describe: "静默模式",
16855
- type: "boolean",
16856
- default: false
16857
- }),
17105
+ }).option("limit", PAGINATION_OPTIONS.limit).option("offset", PAGINATION_OPTIONS.offset).option("quiet", { alias: "q", type: "boolean", hidden: true }),
16858
17106
  async handler(args) {
16859
17107
  const output = new OutputService2;
16860
- output.configure({ quiet: args.quiet });
16861
17108
  const envService = new EnvironmentService(output);
16862
17109
  try {
16863
17110
  await envService.create({ configPath: args.config });
@@ -16866,53 +17113,90 @@ var EventSourceListCommand = {
16866
17113
  output.error("Failed to create environment");
16867
17114
  process.exit(1);
16868
17115
  }
16869
- const components = env.listComponents().map((c) => c.name);
16870
- output.log("Available components: " + components.join(", "));
16871
17116
  const esComponent = env.getComponent("event-source");
16872
17117
  if (!esComponent) {
16873
17118
  output.error("EventSourceComponent not available");
16874
17119
  process.exit(1);
16875
17120
  }
16876
- const sources = esComponent.list();
16877
- if (!sources || sources.length === 0) {
17121
+ const allSources = esComponent.list() ?? [];
17122
+ const total = allSources.length;
17123
+ const page = {
17124
+ limit: args.limit ?? 20,
17125
+ offset: args.offset ?? 0
17126
+ };
17127
+ const sources = applyPagination(allSources, page);
17128
+ if (total === 0) {
16878
17129
  if (args.json) {
16879
- output.json({ sources: [], count: 0 });
17130
+ output.json({
17131
+ total: 0,
17132
+ count: 0,
17133
+ truncated: false,
17134
+ limit: page.limit,
17135
+ offset: page.offset,
17136
+ sources: []
17137
+ });
16880
17138
  } else {
16881
- output.log(chalk55.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加"));
17139
+ output.log(chalk56.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加"));
16882
17140
  }
16883
17141
  return;
16884
17142
  }
17143
+ const sourcesWithStatus = sources.map((s) => ({
17144
+ ...s,
17145
+ status: esComponent.getStatus(s.id) || "unknown"
17146
+ }));
16885
17147
  if (args.json) {
16886
- const sourcesWithStatus = sources.map((s) => ({
16887
- ...s,
16888
- status: esComponent.getStatus(s.id) || "unknown"
16889
- }));
16890
- output.json({ sources: sourcesWithStatus, count: sources.length });
17148
+ output.json({
17149
+ total,
17150
+ count: sourcesWithStatus.length,
17151
+ truncated: total > sourcesWithStatus.length,
17152
+ limit: page.limit,
17153
+ offset: page.offset,
17154
+ sources: sourcesWithStatus
17155
+ });
17156
+ return;
17157
+ }
17158
+ if (args.quiet) {
17159
+ output.log(renderQuietHeader(total, "event source"));
17160
+ sources.forEach((s) => output.log(renderQuietLine(s.id, s.name)));
17161
+ const hint = renderQuietPaginationHint({
17162
+ count: sources.length,
17163
+ total,
17164
+ offset: page.offset,
17165
+ limit: page.limit
17166
+ });
17167
+ if (hint)
17168
+ output.log(hint);
16891
17169
  return;
16892
17170
  }
16893
17171
  const rows = sources.map((s) => {
16894
17172
  const status = esComponent.getStatus(s.id) || "unknown";
16895
17173
  const statusColorMap = {
16896
- running: chalk55.green,
16897
- stopped: chalk55.gray,
16898
- error: chalk55.red,
16899
- starting: chalk55.yellow,
16900
- created: chalk55.gray,
16901
- stopping: chalk55.yellow,
16902
- unknown: chalk55.gray
17174
+ running: chalk56.green,
17175
+ stopped: chalk56.gray,
17176
+ error: chalk56.red,
17177
+ starting: chalk56.yellow,
17178
+ created: chalk56.gray,
17179
+ stopping: chalk56.yellow,
17180
+ unknown: chalk56.gray
16903
17181
  };
16904
- const statusColor = statusColorMap[status] || chalk55.gray;
17182
+ const statusColor = statusColorMap[status] || chalk56.gray;
16905
17183
  return {
16906
17184
  id: s.id.substring(0, 8),
16907
17185
  name: s.name,
16908
17186
  type: s.type,
16909
17187
  status: statusColor(status),
16910
- enabled: s.enabled ? chalk55.green("✓") : chalk55.gray("✗")
17188
+ enabled: s.enabled ? chalk56.green("✓") : chalk56.gray("✗")
16911
17189
  };
16912
17190
  });
16913
17191
  output.log(formatSourcesTable(rows));
16914
- output.info("");
16915
- output.log(chalk55.green(`✅ 共 ${sources.length} 个事件源`));
17192
+ output.log("");
17193
+ output.log(renderPaginationFooter({
17194
+ total,
17195
+ count: sources.length,
17196
+ offset: page.offset,
17197
+ limit: page.limit,
17198
+ itemName: "event source"
17199
+ }));
16916
17200
  } catch (error) {
16917
17201
  output.error(`Failed to list event sources: ${error}`);
16918
17202
  process.exit(1);
@@ -16923,11 +17207,11 @@ var EventSourceListCommand = {
16923
17207
  };
16924
17208
 
16925
17209
  // src/commands/eventsource/add.ts
16926
- import chalk57 from "chalk";
17210
+ import chalk58 from "chalk";
16927
17211
  import { generateId } from "@ai-setting/roy-agent-core";
16928
17212
 
16929
17213
  // src/commands/eventsource/server-url-option.ts
16930
- import chalk56 from "chalk";
17214
+ import chalk57 from "chalk";
16931
17215
  function addServerUrlOption(yargs) {
16932
17216
  return yargs.option("server-url", {
16933
17217
  alias: "s",
@@ -16943,7 +17227,7 @@ function resolveServerUrl(serverUrl, fallback) {
16943
17227
  return fallback;
16944
17228
  const trimmed = serverUrl.replace(/\/+$/, "");
16945
17229
  if (!/^(https?|wss?):\/\//.test(trimmed)) {
16946
- console.error(chalk56.red(`
17230
+ console.error(chalk57.red(`
16947
17231
  ✗ Invalid --server-url: "${serverUrl}". Must start with http://, https://, ws://, or wss://
16948
17232
  `));
16949
17233
  process.exit(1);
@@ -17036,39 +17320,39 @@ var EventSourceAddCommand = {
17036
17320
  options: a.prompt ? { prompt: a.prompt } : undefined
17037
17321
  };
17038
17322
  esComponent.register(config);
17039
- output.success(chalk57.green(`事件源 '${a.name}' 添加成功!`));
17323
+ output.success(chalk58.green(`事件源 '${a.name}' 添加成功!`));
17040
17324
  output.log("");
17041
- output.log(` ID: ${chalk57.gray(config.id)}`);
17042
- output.log(` Type: ${chalk57.cyan(a.type)}`);
17325
+ output.log(` ID: ${chalk58.gray(config.id)}`);
17326
+ output.log(` Type: ${chalk58.cyan(a.type)}`);
17043
17327
  if (eventTypes?.length) {
17044
- output.log(` Event Types: ${chalk57.gray(eventTypes.join(", "))}`);
17328
+ output.log(` Event Types: ${chalk58.gray(eventTypes.join(", "))}`);
17045
17329
  }
17046
17330
  if (a.command) {
17047
- output.log(` Command: ${chalk57.gray(a.command)}`);
17331
+ output.log(` Command: ${chalk58.gray(a.command)}`);
17048
17332
  }
17049
17333
  if (a.interval) {
17050
- output.log(` Interval: ${chalk57.gray(`${a.interval}ms`)}`);
17334
+ output.log(` Interval: ${chalk58.gray(`${a.interval}ms`)}`);
17051
17335
  }
17052
17336
  if (a.profile) {
17053
- output.log(` Profile: ${chalk57.gray(a.profile)}`);
17337
+ output.log(` Profile: ${chalk58.gray(a.profile)}`);
17054
17338
  }
17055
17339
  if (a.address) {
17056
- output.log(` Address: ${chalk57.gray(a.address)}`);
17340
+ output.log(` Address: ${chalk58.gray(a.address)}`);
17057
17341
  }
17058
17342
  if (a.imServerUrl) {
17059
- output.log(` IM Server URL: ${chalk57.gray(a.imServerUrl)}`);
17343
+ output.log(` IM Server URL: ${chalk58.gray(a.imServerUrl)}`);
17060
17344
  }
17061
17345
  if (resolvedServerUrl) {
17062
- output.log(` Server URL: ${chalk57.gray(resolvedServerUrl)}`);
17346
+ output.log(` Server URL: ${chalk58.gray(resolvedServerUrl)}`);
17063
17347
  }
17064
17348
  if (a.tlsSkipVerify) {
17065
- output.log(` TLS Skip Verify: ${chalk57.yellow("⚠ true (自签名场景)")}`);
17349
+ output.log(` TLS Skip Verify: ${chalk58.yellow("⚠ true (自签名场景)")}`);
17066
17350
  }
17067
17351
  if (a.prompt) {
17068
- output.log(` Prompt: ${chalk57.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
17352
+ output.log(` Prompt: ${chalk58.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
17069
17353
  }
17070
17354
  output.log("");
17071
- output.log(chalk57.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
17355
+ output.log(chalk58.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
17072
17356
  } finally {
17073
17357
  await envService.dispose();
17074
17358
  }
@@ -17076,7 +17360,7 @@ var EventSourceAddCommand = {
17076
17360
  };
17077
17361
 
17078
17362
  // src/commands/eventsource/update.ts
17079
- import chalk58 from "chalk";
17363
+ import chalk59 from "chalk";
17080
17364
  function findSource(esComponent, id) {
17081
17365
  const sources = esComponent.list();
17082
17366
  const matched = sources.find((s) => s.id === id || s.id.startsWith(id));
@@ -17148,7 +17432,7 @@ var EventSourceUpdateCommand = {
17148
17432
  const all = esComponent.list();
17149
17433
  if (all.length > 0) {
17150
17434
  output.info("");
17151
- output.info(chalk58.gray("可用的事件源:"));
17435
+ output.info(chalk59.gray("可用的事件源:"));
17152
17436
  for (const s of all) {
17153
17437
  output.info(` - ${s.id.substring(0, 8)}: ${s.name} (${s.type})`);
17154
17438
  }
@@ -17190,19 +17474,19 @@ var EventSourceUpdateCommand = {
17190
17474
  }
17191
17475
  try {
17192
17476
  const result = await esComponent.update(match.fullId, partial);
17193
- output.success(chalk58.green(`✅ 事件源已更新: ${match.source.name}`));
17477
+ output.success(chalk59.green(`✅ 事件源已更新: ${match.source.name}`));
17194
17478
  output.log("");
17195
- output.log(chalk58.bold("修改字段:"));
17479
+ output.log(chalk59.bold("修改字段:"));
17196
17480
  const before = match.source;
17197
17481
  const after = result.updated;
17198
17482
  for (const field of result.fields) {
17199
17483
  const beforeVal = JSON.stringify(before[field] ?? before.options?.[field]);
17200
17484
  const afterVal = JSON.stringify(after[field] ?? after.options?.[field]);
17201
- output.log(` ${chalk58.cyan(field)}: ${chalk58.gray(beforeVal)} ${chalk58.gray("→")} ${chalk58.green(afterVal)}`);
17485
+ output.log(` ${chalk59.cyan(field)}: ${chalk59.gray(beforeVal)} ${chalk59.gray("→")} ${chalk59.green(afterVal)}`);
17202
17486
  }
17203
17487
  output.log("");
17204
17488
  if (result.wasRunning) {
17205
- output.info(chalk58.yellow(`⚠️ 事件源在更新前正在运行,已自动停止。请使用 'roy-agent eventsource start ${match.fullId.substring(0, 8)}' 手动启动以应用新配置。`));
17489
+ output.info(chalk59.yellow(`⚠️ 事件源在更新前正在运行,已自动停止。请使用 'roy-agent eventsource start ${match.fullId.substring(0, 8)}' 手动启动以应用新配置。`));
17206
17490
  }
17207
17491
  } catch (error) {
17208
17492
  output.error(`❌ 更新失败: ${error instanceof Error ? error.message : String(error)}`);
@@ -17215,7 +17499,7 @@ var EventSourceUpdateCommand = {
17215
17499
  };
17216
17500
 
17217
17501
  // src/commands/eventsource/remove.ts
17218
- import chalk59 from "chalk";
17502
+ import chalk60 from "chalk";
17219
17503
  var EventSourceRemoveCommand = {
17220
17504
  command: "remove <id>",
17221
17505
  aliases: ["rm"],
@@ -17254,7 +17538,7 @@ var EventSourceRemoveCommand = {
17254
17538
  const status = esComponent.getStatus(matchedSource.id);
17255
17539
  if (status === "running" && !args.force) {
17256
17540
  output.error(`事件源正在运行中,请先停止: ${matchedSource.name} (${status})`);
17257
- output.log(chalk59.gray(`使用 --force 强制移除或 'roy-agent eventsource stop ${matchedSource.id.substring(0, 8)}' 先停止`));
17541
+ output.log(chalk60.gray(`使用 --force 强制移除或 'roy-agent eventsource stop ${matchedSource.id.substring(0, 8)}' 先停止`));
17258
17542
  process.exit(1);
17259
17543
  }
17260
17544
  if (status === "running") {
@@ -17263,7 +17547,7 @@ var EventSourceRemoveCommand = {
17263
17547
  }
17264
17548
  const result = esComponent.unregister(matchedSource.id);
17265
17549
  if (result) {
17266
- output.success(chalk59.green(`事件源已移除: ${matchedSource.name}`));
17550
+ output.success(chalk60.green(`事件源已移除: ${matchedSource.name}`));
17267
17551
  } else {
17268
17552
  output.error("移除失败");
17269
17553
  process.exit(1);
@@ -17275,7 +17559,7 @@ var EventSourceRemoveCommand = {
17275
17559
  };
17276
17560
 
17277
17561
  // src/commands/eventsource/start.ts
17278
- import chalk60 from "chalk";
17562
+ import chalk61 from "chalk";
17279
17563
  var EventSourceStartCommand = {
17280
17564
  command: "start <id>",
17281
17565
  describe: "启动指定的事件源",
@@ -17312,15 +17596,15 @@ var EventSourceStartCommand = {
17312
17596
  }
17313
17597
  const status = esComponent.getStatus(matchedSource.id);
17314
17598
  if (status === "running") {
17315
- output.log(chalk60.yellow(`事件源已在运行: ${matchedSource.name}`));
17599
+ output.log(chalk61.yellow(`事件源已在运行: ${matchedSource.name}`));
17316
17600
  return;
17317
17601
  }
17318
17602
  output.info(`正在启动事件源 '${matchedSource.name}'...`);
17319
17603
  try {
17320
17604
  await esComponent.startSource(matchedSource.id);
17321
- output.success(chalk60.green(`事件源已启动: ${matchedSource.name}`));
17605
+ output.success(chalk61.green(`事件源已启动: ${matchedSource.name}`));
17322
17606
  if (!args.background) {
17323
- output.log(chalk60.gray("按 Ctrl+C 停止..."));
17607
+ output.log(chalk61.gray("按 Ctrl+C 停止..."));
17324
17608
  await new Promise((resolve) => {
17325
17609
  const cleanup = () => {
17326
17610
  process.removeListener("SIGINT", cleanup);
@@ -17342,7 +17626,7 @@ var EventSourceStartCommand = {
17342
17626
  };
17343
17627
 
17344
17628
  // src/commands/eventsource/stop.ts
17345
- import chalk61 from "chalk";
17629
+ import chalk62 from "chalk";
17346
17630
  var EventSourceStopCommand = {
17347
17631
  command: "stop <id>",
17348
17632
  aliases: ["kill"],
@@ -17380,13 +17664,13 @@ var EventSourceStopCommand = {
17380
17664
  }
17381
17665
  const status = esComponent.getStatus(matchedSource.id);
17382
17666
  if (status !== "running") {
17383
- output.log(chalk61.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
17667
+ output.log(chalk62.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
17384
17668
  return;
17385
17669
  }
17386
17670
  output.info(`正在停止事件源 '${matchedSource.name}'...`);
17387
17671
  try {
17388
17672
  await esComponent.stopSource(matchedSource.id);
17389
- output.success(chalk61.green(`事件源已停止: ${matchedSource.name}`));
17673
+ output.success(chalk62.green(`事件源已停止: ${matchedSource.name}`));
17390
17674
  } catch (error) {
17391
17675
  output.error(`停止失败: ${error}`);
17392
17676
  process.exit(1);
@@ -17398,14 +17682,14 @@ var EventSourceStopCommand = {
17398
17682
  };
17399
17683
 
17400
17684
  // src/commands/eventsource/status.ts
17401
- import chalk62 from "chalk";
17685
+ import chalk63 from "chalk";
17402
17686
  var STATUS_COLORS = {
17403
- created: chalk62.gray,
17404
- starting: chalk62.yellow,
17405
- running: chalk62.green,
17406
- stopping: chalk62.yellow,
17407
- stopped: chalk62.gray,
17408
- error: chalk62.red
17687
+ created: chalk63.gray,
17688
+ starting: chalk63.yellow,
17689
+ running: chalk63.green,
17690
+ stopping: chalk63.yellow,
17691
+ stopped: chalk63.gray,
17692
+ error: chalk63.red
17409
17693
  };
17410
17694
  var STATUS_ICONS = {
17411
17695
  created: "○",
@@ -17459,7 +17743,7 @@ var EventSourceStatusCommand = {
17459
17743
  process.exit(1);
17460
17744
  }
17461
17745
  const status = esComponent.getStatus(matchedSource.id) || "unknown";
17462
- const statusColor = STATUS_COLORS[status] || chalk62.gray;
17746
+ const statusColor = STATUS_COLORS[status] || chalk63.gray;
17463
17747
  if (args.json) {
17464
17748
  output.json({
17465
17749
  id: matchedSource.id,
@@ -17476,31 +17760,31 @@ var EventSourceStatusCommand = {
17476
17760
  });
17477
17761
  return;
17478
17762
  }
17479
- output.log(chalk62.bold("事件源详情"));
17763
+ output.log(chalk63.bold("事件源详情"));
17480
17764
  output.log("─".repeat(50));
17481
- output.log(` ID: ${chalk62.gray(matchedSource.id)}`);
17482
- output.log(` Name: ${chalk62.cyan(matchedSource.name)}`);
17483
- output.log(` Type: ${chalk62.cyan(matchedSource.type)}`);
17765
+ output.log(` ID: ${chalk63.gray(matchedSource.id)}`);
17766
+ output.log(` Name: ${chalk63.cyan(matchedSource.name)}`);
17767
+ output.log(` Type: ${chalk63.cyan(matchedSource.type)}`);
17484
17768
  output.log(` Status: ${statusColor(`${STATUS_ICONS[status]} ${STATUS_LABELS[status]}`)}`);
17485
- output.log(` Enabled: ${matchedSource.enabled ? chalk62.green("是") : chalk62.gray("否")}`);
17769
+ output.log(` Enabled: ${matchedSource.enabled ? chalk63.green("是") : chalk63.gray("否")}`);
17486
17770
  if (matchedSource.eventTypes?.length) {
17487
- output.log(` Events: ${chalk62.gray(matchedSource.eventTypes.join(", "))}`);
17771
+ output.log(` Events: ${chalk63.gray(matchedSource.eventTypes.join(", "))}`);
17488
17772
  }
17489
17773
  if (matchedSource.command) {
17490
- output.log(` Command: ${chalk62.gray(matchedSource.command)}`);
17774
+ output.log(` Command: ${chalk63.gray(matchedSource.command)}`);
17491
17775
  }
17492
17776
  if (matchedSource.interval) {
17493
- output.log(` Interval: ${chalk62.gray(`${matchedSource.interval}ms`)}`);
17777
+ output.log(` Interval: ${chalk63.gray(`${matchedSource.interval}ms`)}`);
17494
17778
  }
17495
17779
  if (matchedSource.url) {
17496
- output.log(` URL: ${chalk62.gray(matchedSource.url)}`);
17780
+ output.log(` URL: ${chalk63.gray(matchedSource.url)}`);
17497
17781
  }
17498
17782
  output.log("");
17499
17783
  return;
17500
17784
  }
17501
17785
  const sources = esComponent.list();
17502
17786
  if (sources.length === 0) {
17503
- output.log(chalk62.yellow("没有配置的事件源"));
17787
+ output.log(chalk63.yellow("没有配置的事件源"));
17504
17788
  return;
17505
17789
  }
17506
17790
  if (args.json) {
@@ -17514,21 +17798,21 @@ var EventSourceStatusCommand = {
17514
17798
  output.json({ sources: sourcesWithStatus, count: sources.length });
17515
17799
  return;
17516
17800
  }
17517
- output.log(chalk62.bold("事件源状态概览"));
17801
+ output.log(chalk63.bold("事件源状态概览"));
17518
17802
  output.log("─".repeat(60));
17519
17803
  for (const source of sources) {
17520
17804
  const status = esComponent.getStatus(source.id) || "unknown";
17521
- const statusColor = STATUS_COLORS[status] || chalk62.gray;
17805
+ const statusColor = STATUS_COLORS[status] || chalk63.gray;
17522
17806
  const icon = STATUS_ICONS[status] || "?";
17523
17807
  const label = STATUS_LABELS[status] || status;
17524
17808
  output.log("");
17525
- output.log(` ${chalk62.cyan(source.name)} ${chalk62.gray(`(${source.type})`)}`);
17809
+ output.log(` ${chalk63.cyan(source.name)} ${chalk63.gray(`(${source.type})`)}`);
17526
17810
  output.log(` └─ Status: ${statusColor(`${icon} ${label}`)}`);
17527
- output.log(` ID: ${chalk62.gray(source.id.substring(0, 8))}...`);
17811
+ output.log(` ID: ${chalk63.gray(source.id.substring(0, 8))}...`);
17528
17812
  }
17529
17813
  output.log("");
17530
17814
  const runningCount = sources.filter((s) => esComponent.getStatus(s.id) === "running").length;
17531
- output.log(chalk62.green(`✅ ${runningCount}/${sources.length} 运行中`));
17815
+ output.log(chalk63.green(`✅ ${runningCount}/${sources.length} 运行中`));
17532
17816
  } finally {
17533
17817
  await envService.dispose();
17534
17818
  }
@@ -17841,7 +18125,7 @@ var DebugCommand = {
17841
18125
  };
17842
18126
 
17843
18127
  // src/commands/workflow/renderers.ts
17844
- import chalk63 from "chalk";
18128
+ import chalk64 from "chalk";
17845
18129
  function truncateVisual3(str, maxWidth) {
17846
18130
  if (!str)
17847
18131
  return "-";
@@ -17876,18 +18160,18 @@ function formatDuration(ms) {
17876
18160
  function statusColor(status) {
17877
18161
  switch (status) {
17878
18162
  case "completed":
17879
- return chalk63.green;
18163
+ return chalk64.green;
17880
18164
  case "running":
17881
18165
  case "idle":
17882
- return chalk63.blue;
18166
+ return chalk64.blue;
17883
18167
  case "paused":
17884
- return chalk63.yellow;
18168
+ return chalk64.yellow;
17885
18169
  case "failed":
17886
- return chalk63.red;
18170
+ return chalk64.red;
17887
18171
  case "stopped":
17888
- return chalk63.gray;
18172
+ return chalk64.gray;
17889
18173
  default:
17890
- return chalk63.white;
18174
+ return chalk64.white;
17891
18175
  }
17892
18176
  }
17893
18177
  function renderWorkflowList(workflows, options) {
@@ -17906,7 +18190,7 @@ function renderWorkflowList(workflows, options) {
17906
18190
  }, null, 2);
17907
18191
  }
17908
18192
  if (workflows.length === 0) {
17909
- return chalk63.yellow("No workflows found");
18193
+ return chalk64.yellow("No workflows found");
17910
18194
  }
17911
18195
  const NAME_WIDTH = 30;
17912
18196
  const VERSION_WIDTH = 10;
@@ -17914,10 +18198,10 @@ function renderWorkflowList(workflows, options) {
17914
18198
  const UPDATED_WIDTH = 20;
17915
18199
  const GAP = " ";
17916
18200
  const headerLine = [
17917
- chalk63.bold("NAME".padEnd(NAME_WIDTH)),
17918
- chalk63.bold("VER".padEnd(VERSION_WIDTH)),
17919
- chalk63.bold("TAGS".padEnd(TAGS_WIDTH)),
17920
- chalk63.bold("UPDATED")
18201
+ chalk64.bold("NAME".padEnd(NAME_WIDTH)),
18202
+ chalk64.bold("VER".padEnd(VERSION_WIDTH)),
18203
+ chalk64.bold("TAGS".padEnd(TAGS_WIDTH)),
18204
+ chalk64.bold("UPDATED")
17921
18205
  ].join(GAP);
17922
18206
  const sepLine = "─".repeat(NAME_WIDTH + VERSION_WIDTH + TAGS_WIDTH + UPDATED_WIDTH + GAP.length * 3);
17923
18207
  const rows = workflows.map((w) => {
@@ -17932,18 +18216,18 @@ function renderWorkflowList(workflows, options) {
17932
18216
  }
17933
18217
  function renderWorkflowDetail(workflow, options) {
17934
18218
  const lines = [];
17935
- lines.push(chalk63.bold(`
18219
+ lines.push(chalk64.bold(`
17936
18220
  \uD83D\uDCCB Workflow Details
17937
18221
  `));
17938
- lines.push(` ${chalk63.cyan("ID:")} ${workflow.id}`);
17939
- lines.push(` ${chalk63.cyan("Name:")} ${workflow.name}`);
17940
- lines.push(` ${chalk63.cyan("Version:")} ${workflow.version}`);
17941
- lines.push(` ${chalk63.cyan("Description:")} ${workflow.description || "-"}`);
17942
- lines.push(` ${chalk63.cyan("Tags:")} ${workflow.tags.join(", ") || "-"}`);
17943
- lines.push(` ${chalk63.cyan("Created:")} ${formatDate(workflow.createdAt)}`);
17944
- lines.push(` ${chalk63.cyan("Updated:")} ${formatDate(workflow.updatedAt)}`);
18222
+ lines.push(` ${chalk64.cyan("ID:")} ${workflow.id}`);
18223
+ lines.push(` ${chalk64.cyan("Name:")} ${workflow.name}`);
18224
+ lines.push(` ${chalk64.cyan("Version:")} ${workflow.version}`);
18225
+ lines.push(` ${chalk64.cyan("Description:")} ${workflow.description || "-"}`);
18226
+ lines.push(` ${chalk64.cyan("Tags:")} ${workflow.tags.join(", ") || "-"}`);
18227
+ lines.push(` ${chalk64.cyan("Created:")} ${formatDate(workflow.createdAt)}`);
18228
+ lines.push(` ${chalk64.cyan("Updated:")} ${formatDate(workflow.updatedAt)}`);
17945
18229
  const nodeCount = workflow.definition.nodes.length;
17946
- lines.push(chalk63.bold(`
18230
+ lines.push(chalk64.bold(`
17947
18231
  \uD83D\uDCCA Nodes Summary
17948
18232
  `));
17949
18233
  lines.push(` Total: ${nodeCount} nodes`);
@@ -17955,7 +18239,7 @@ function renderWorkflowDetail(workflow, options) {
17955
18239
  lines.push(` - ${type}: ${count}`);
17956
18240
  }
17957
18241
  if (workflow.definition.config) {
17958
- lines.push(chalk63.bold(`
18242
+ lines.push(chalk64.bold(`
17959
18243
  ⚙️ Configuration
17960
18244
  `));
17961
18245
  if (workflow.definition.config.parallel_limit !== undefined) {
@@ -17969,7 +18253,7 @@ function renderWorkflowDetail(workflow, options) {
17969
18253
  }
17970
18254
  }
17971
18255
  if (options?.includeRuns && options.includeRuns.length > 0) {
17972
- lines.push(chalk63.bold(`
18256
+ lines.push(chalk64.bold(`
17973
18257
  \uD83D\uDCDC Recent Runs
17974
18258
  `));
17975
18259
  lines.push(renderRunsList(options.includeRuns.slice(0, 5)));
@@ -17993,7 +18277,7 @@ function renderRunsList(runs, options) {
17993
18277
  }, null, 2);
17994
18278
  }
17995
18279
  if (runs.length === 0) {
17996
- return chalk63.yellow("No runs found");
18280
+ return chalk64.yellow("No runs found");
17997
18281
  }
17998
18282
  const ID_WIDTH = 20;
17999
18283
  const STATUS_WIDTH = 12;
@@ -18001,10 +18285,10 @@ function renderRunsList(runs, options) {
18001
18285
  const UPDATED_WIDTH = 20;
18002
18286
  const GAP = " ";
18003
18287
  const headerLine = [
18004
- chalk63.bold("RUN ID".padEnd(ID_WIDTH)),
18005
- chalk63.bold("STATUS".padEnd(STATUS_WIDTH)),
18006
- chalk63.bold("DURATION".padEnd(DURATION_WIDTH)),
18007
- chalk63.bold("STARTED")
18288
+ chalk64.bold("RUN ID".padEnd(ID_WIDTH)),
18289
+ chalk64.bold("STATUS".padEnd(STATUS_WIDTH)),
18290
+ chalk64.bold("DURATION".padEnd(DURATION_WIDTH)),
18291
+ chalk64.bold("STARTED")
18008
18292
  ].join(GAP);
18009
18293
  const sepLine = "─".repeat(ID_WIDTH + STATUS_WIDTH + DURATION_WIDTH + UPDATED_WIDTH + GAP.length * 3);
18010
18294
  const rows = runs.map((r) => {
@@ -18019,34 +18303,34 @@ function renderRunsList(runs, options) {
18019
18303
  }
18020
18304
  function renderRunDetail(run) {
18021
18305
  const lines = [];
18022
- lines.push(chalk63.bold(`
18306
+ lines.push(chalk64.bold(`
18023
18307
  \uD83C\uDFC3 Run Details
18024
18308
  `));
18025
- lines.push(` ${chalk63.cyan("Run ID:")} ${run.id}`);
18026
- lines.push(` ${chalk63.cyan("Workflow:")} ${run.workflowId}`);
18027
- lines.push(` ${chalk63.cyan("Status:")} ${statusColor(run.status)(run.status)}`);
18028
- lines.push(` ${chalk63.cyan("Started:")} ${formatDate(run.startedAt)}`);
18309
+ lines.push(` ${chalk64.cyan("Run ID:")} ${run.id}`);
18310
+ lines.push(` ${chalk64.cyan("Workflow:")} ${run.workflowId}`);
18311
+ lines.push(` ${chalk64.cyan("Status:")} ${statusColor(run.status)(run.status)}`);
18312
+ lines.push(` ${chalk64.cyan("Started:")} ${formatDate(run.startedAt)}`);
18029
18313
  if (run.pausedAt) {
18030
- lines.push(` ${chalk63.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
18314
+ lines.push(` ${chalk64.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
18031
18315
  }
18032
18316
  if (run.resumedAt) {
18033
- lines.push(` ${chalk63.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
18317
+ lines.push(` ${chalk64.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
18034
18318
  }
18035
18319
  if (run.stoppedAt) {
18036
- lines.push(` ${chalk63.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
18320
+ lines.push(` ${chalk64.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
18037
18321
  }
18038
18322
  if (run.completedAt) {
18039
- lines.push(` ${chalk63.cyan("Completed:")} ${formatDate(run.completedAt)}`);
18323
+ lines.push(` ${chalk64.cyan("Completed:")} ${formatDate(run.completedAt)}`);
18040
18324
  }
18041
- lines.push(` ${chalk63.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
18325
+ lines.push(` ${chalk64.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
18042
18326
  if (run.error) {
18043
- lines.push(chalk63.bold(`
18327
+ lines.push(chalk64.bold(`
18044
18328
  ❌ Error
18045
18329
  `));
18046
- lines.push(` ${chalk63.red(run.error)}`);
18330
+ lines.push(` ${chalk64.red(run.error)}`);
18047
18331
  }
18048
18332
  if (run.output) {
18049
- lines.push(chalk63.bold(`
18333
+ lines.push(chalk64.bold(`
18050
18334
  \uD83D\uDCE4 Output
18051
18335
  `));
18052
18336
  lines.push(" " + JSON.stringify(run.output, null, 2).split(`
@@ -18057,36 +18341,36 @@ function renderRunDetail(run) {
18057
18341
  `);
18058
18342
  }
18059
18343
  function renderWorkflowAdded(workflow) {
18060
- return chalk63.green(`
18344
+ return chalk64.green(`
18061
18345
  ✅ Workflow '${workflow.name}' added successfully
18062
18346
  `) + ` ID: ${workflow.id}
18063
18347
  ` + ` Version: ${workflow.version}
18064
18348
  `;
18065
18349
  }
18066
18350
  function renderWorkflowUpdated(workflow) {
18067
- return chalk63.green(`
18351
+ return chalk64.green(`
18068
18352
  ✅ Workflow '${workflow.name}' updated successfully
18069
18353
  `) + ` ID: ${workflow.id}
18070
18354
  `;
18071
18355
  }
18072
18356
  function renderWorkflowDeleted(name) {
18073
- return chalk63.green(`
18357
+ return chalk64.green(`
18074
18358
  ✅ Workflow '${name}' deleted successfully
18075
18359
  `);
18076
18360
  }
18077
18361
  function renderRunResult(result) {
18078
18362
  const lines = [];
18079
18363
  if (result.status === "completed") {
18080
- lines.push(chalk63.green(`
18364
+ lines.push(chalk64.green(`
18081
18365
  ✅ Workflow completed successfully`));
18082
18366
  } else if (result.status === "failed") {
18083
- lines.push(chalk63.red(`
18367
+ lines.push(chalk64.red(`
18084
18368
  ❌ Workflow failed`));
18085
18369
  } else if (result.status === "stopped") {
18086
- lines.push(chalk63.yellow(`
18370
+ lines.push(chalk64.yellow(`
18087
18371
  ⚠️ Workflow stopped`));
18088
18372
  } else {
18089
- lines.push(chalk63.blue(`
18373
+ lines.push(chalk64.blue(`
18090
18374
  \uD83D\uDD04 Workflow ${result.status}`));
18091
18375
  }
18092
18376
  lines.push(` Run ID: ${result.runId}`);
@@ -18094,11 +18378,11 @@ function renderRunResult(result) {
18094
18378
  lines.push(` Duration: ${formatDuration(result.durationMs)}`);
18095
18379
  }
18096
18380
  if (result.error) {
18097
- lines.push(chalk63.red(`
18381
+ lines.push(chalk64.red(`
18098
18382
  Error: ${result.error}`));
18099
18383
  }
18100
18384
  if (result.output) {
18101
- lines.push(chalk63.bold(`
18385
+ lines.push(chalk64.bold(`
18102
18386
  \uD83D\uDCE4 Output:`));
18103
18387
  lines.push(JSON.stringify(result.output, null, 2));
18104
18388
  }
@@ -18112,10 +18396,10 @@ function renderNodesList(nodes) {
18112
18396
  const DEPS_WIDTH = 20;
18113
18397
  const GAP = " ";
18114
18398
  const headerLine = [
18115
- chalk63.bold("NODE ID".padEnd(ID_WIDTH)),
18116
- chalk63.bold("TYPE".padEnd(TYPE_WIDTH)),
18117
- chalk63.bold("NAME".padEnd(NAME_WIDTH)),
18118
- chalk63.bold("DEPENDS ON")
18399
+ chalk64.bold("NODE ID".padEnd(ID_WIDTH)),
18400
+ chalk64.bold("TYPE".padEnd(TYPE_WIDTH)),
18401
+ chalk64.bold("NAME".padEnd(NAME_WIDTH)),
18402
+ chalk64.bold("DEPENDS ON")
18119
18403
  ].join(GAP);
18120
18404
  const sepLine = "─".repeat(ID_WIDTH + TYPE_WIDTH + NAME_WIDTH + DEPS_WIDTH + GAP.length * 3);
18121
18405
  const rows = nodes.map((n) => {
@@ -18130,7 +18414,7 @@ function renderNodesList(nodes) {
18130
18414
  }
18131
18415
 
18132
18416
  // src/commands/workflow/commands/list.ts
18133
- import chalk64 from "chalk";
18417
+ import chalk65 from "chalk";
18134
18418
  import { createWorkflowListTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
18135
18419
  function buildListWorkflowsJson(workflows, total, args, availableTags) {
18136
18420
  const output = {
@@ -18161,10 +18445,10 @@ var WorkflowListCommand = {
18161
18445
  describe: "搜索 description 和 tags(支持 AND/OR/NOT 语法)",
18162
18446
  type: "string"
18163
18447
  }).option("limit", {
18164
- alias: "l",
18165
- describe: "返回数量限制",
18448
+ alias: ["l", "n"],
18449
+ describe: "返回数量限制(-l 旧 alias, -n 新统一 alias)",
18166
18450
  type: "number",
18167
- default: 50
18451
+ default: 20
18168
18452
  }).option("offset", {
18169
18453
  alias: "o",
18170
18454
  describe: "分页偏移",
@@ -18262,6 +18546,18 @@ var WorkflowListCommand = {
18262
18546
  offset: finalOffset,
18263
18547
  page: page > 1 ? page : Math.floor(finalOffset / pageSize) + 1
18264
18548
  }, availableTags));
18549
+ } else if (args.quiet) {
18550
+ output.log(renderQuietHeader(total, "workflow"));
18551
+ workflows.forEach((w) => output.log(renderQuietLine(w.name, w.name)));
18552
+ const hint = renderQuietPaginationHint({
18553
+ count: workflows.length,
18554
+ total,
18555
+ offset: finalOffset,
18556
+ limit: pageSize
18557
+ });
18558
+ if (hint)
18559
+ output.log(hint);
18560
+ return;
18265
18561
  } else {
18266
18562
  const renderWorkflows = workflows.map((w) => ({
18267
18563
  id: w.name,
@@ -18278,20 +18574,20 @@ var WorkflowListCommand = {
18278
18574
  if (total > workflows.length) {
18279
18575
  const start = finalOffset + 1;
18280
18576
  const end = finalOffset + workflows.length;
18281
- output.log(chalk64.green(`
18577
+ output.log(chalk65.green(`
18282
18578
  ✅ 显示 ${start}-${end} / 共 ${total} 个 Workflow`));
18283
18579
  const totalPages = Math.ceil(total / pageSize);
18284
18580
  const currentPage = Math.floor(finalOffset / pageSize) + 1;
18285
18581
  if (totalPages > 1) {
18286
- output.log(chalk64.cyan(`\uD83D\uDCC4 第 ${currentPage} / ${totalPages} 页`));
18582
+ output.log(chalk65.cyan(`\uD83D\uDCC4 第 ${currentPage} / ${totalPages} 页`));
18287
18583
  }
18288
18584
  } else {
18289
- output.log(chalk64.green(`
18585
+ output.log(chalk65.green(`
18290
18586
  ✅ 共 ${total} 个 Workflow`));
18291
18587
  }
18292
18588
  if (availableTags.length > 0) {
18293
18589
  const tagsLine = availableTags.map((t) => `${t.name}(${t.count})`).join(", ");
18294
- output.log(chalk64.cyan(`
18590
+ output.log(chalk65.cyan(`
18295
18591
  \uD83C\uDFF7️ Available tags: ${tagsLine}`));
18296
18592
  }
18297
18593
  }
@@ -18895,7 +19191,7 @@ class WorkflowValidator {
18895
19191
 
18896
19192
  // src/commands/workflow/commands/add.ts
18897
19193
  import { validateWorkflowDefinition } from "@ai-setting/roy-agent-core/env/workflow/utils";
18898
- import chalk65 from "chalk";
19194
+ import chalk66 from "chalk";
18899
19195
  import fs3 from "fs";
18900
19196
  import path6 from "path";
18901
19197
  async function parseWorkflowContent(content, filename) {
@@ -19037,7 +19333,7 @@ var WorkflowAddCommand = {
19037
19333
  definition = await parseWorkflowContent(content, filePath);
19038
19334
  workflowName = a.name || definition.name || path6.basename(filePath);
19039
19335
  if (a.validate) {
19040
- output.log(chalk65.blue("\uD83D\uDD0D Validating workflow..."));
19336
+ output.log(chalk66.blue("\uD83D\uDD0D Validating workflow..."));
19041
19337
  const dagResult = validateWorkflowDefinition(definition);
19042
19338
  if (!dagResult.valid) {
19043
19339
  output.error(`
@@ -19061,11 +19357,11 @@ var WorkflowAddCommand = {
19061
19357
  });
19062
19358
  process.exit(1);
19063
19359
  }
19064
- output.log(chalk65.green(`✅ Workflow validation passed
19360
+ output.log(chalk66.green(`✅ Workflow validation passed
19065
19361
  `));
19066
19362
  }
19067
19363
  } else if (a.desc) {
19068
- output.log(chalk65.blue(`\uD83E\uDD16 Generating workflow from description...
19364
+ output.log(chalk66.blue(`\uD83E\uDD16 Generating workflow from description...
19069
19365
  `));
19070
19366
  const agentComponent = env.getComponent("agent");
19071
19367
  if (!agentComponent) {
@@ -19087,20 +19383,20 @@ ${a.desc}
19087
19383
  1. 先用 \`roy-agent workflow nodes\` 查看可用的节点类型
19088
19384
  2. 生成的 YAML 必须通过 \`roy-agent workflow validate --yaml "<yaml>"\` 验证
19089
19385
  3. 验证通过后才输出最终 YAML`;
19090
- output.log(chalk65.gray("Running workflow-extract agent..."));
19386
+ output.log(chalk66.gray("Running workflow-extract agent..."));
19091
19387
  const result = await agentComponent.run("workflow-extract", prompt);
19092
19388
  const agentOutput = result.finalText || "";
19093
19389
  definition = parseYamlFromAgentOutput(agentOutput);
19094
19390
  if (definition === null) {
19095
19391
  output.error("Failed to parse workflow from agent output");
19096
- output.log(chalk65.gray(`
19392
+ output.log(chalk66.gray(`
19097
19393
  Agent output:
19098
19394
  ` + agentOutput.slice(0, 500)));
19099
19395
  process.exit(1);
19100
19396
  }
19101
19397
  workflowName = a.name || definition.name;
19102
19398
  if (a.validate) {
19103
- output.log(chalk65.blue(`
19399
+ output.log(chalk66.blue(`
19104
19400
  \uD83D\uDD0D Validating generated workflow...`));
19105
19401
  const dagResult = validateWorkflowDefinition(definition);
19106
19402
  if (!dagResult.valid) {
@@ -19109,7 +19405,7 @@ Agent output:
19109
19405
  dagResult.errors.forEach((msg, i) => {
19110
19406
  output.error(`[Error ${i + 1}/${dagResult.errors.length}] ${msg}`);
19111
19407
  });
19112
- output.log(chalk65.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
19408
+ output.log(chalk66.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
19113
19409
  process.exit(1);
19114
19410
  }
19115
19411
  const validator = new WorkflowValidator;
@@ -19124,16 +19420,16 @@ Agent output:
19124
19420
  output.error(` Fix: ${error.fix}
19125
19421
  `);
19126
19422
  });
19127
- output.log(chalk65.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
19423
+ output.log(chalk66.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
19128
19424
  process.exit(1);
19129
19425
  }
19130
- output.log(chalk65.green(`✅ Generated workflow validation passed
19426
+ output.log(chalk66.green(`✅ Generated workflow validation passed
19131
19427
  `));
19132
19428
  }
19133
19429
  const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
19134
- output.log(chalk65.gray("--- Generated YAML ---"));
19430
+ output.log(chalk66.gray("--- Generated YAML ---"));
19135
19431
  output.log(yaml.stringify(definition));
19136
- output.log(chalk65.gray(`------------------------
19432
+ output.log(chalk66.gray(`------------------------
19137
19433
  `));
19138
19434
  } else {
19139
19435
  output.error("Please provide --file or --desc option");
@@ -19159,10 +19455,10 @@ Agent output:
19159
19455
  force: a.force
19160
19456
  });
19161
19457
  output.log(renderWorkflowAdded(workflow));
19162
- output.log(chalk65.bold(`
19458
+ output.log(chalk66.bold(`
19163
19459
  \uD83D\uDCCA Nodes Summary:`));
19164
19460
  output.log(renderNodesList(definition.nodes));
19165
- output.log(chalk65.green(`
19461
+ output.log(chalk66.green(`
19166
19462
  ✅ Workflow '${workflowName}' added successfully`));
19167
19463
  } catch (error) {
19168
19464
  if (error.message?.includes("already exists") && !a.force) {
@@ -19179,7 +19475,7 @@ Agent output:
19179
19475
  };
19180
19476
 
19181
19477
  // src/commands/workflow/commands/get.ts
19182
- import chalk66 from "chalk";
19478
+ import chalk67 from "chalk";
19183
19479
  import { createWorkflowGetTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
19184
19480
  var WorkflowGetCommand = {
19185
19481
  command: "get <identifier>",
@@ -19317,15 +19613,15 @@ var WorkflowGetCommand = {
19317
19613
  } else {
19318
19614
  output.log(renderWorkflowDetail(workflow, { includeRuns: runs }));
19319
19615
  if (args.includeNodes) {
19320
- output.log(chalk66.bold(`
19616
+ output.log(chalk67.bold(`
19321
19617
  \uD83D\uDCCB All Nodes:`));
19322
19618
  output.log(renderNodesList(data.nodes || []));
19323
19619
  }
19324
19620
  const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
19325
19621
  const defYaml = yaml.stringify(data.definition || {}, { indent: 2 });
19326
- output.log(chalk66.bold(`
19622
+ output.log(chalk67.bold(`
19327
19623
  \uD83D\uDCC4 Definition (YAML):`));
19328
- output.log(chalk66.gray(defYaml));
19624
+ output.log(chalk67.gray(defYaml));
19329
19625
  }
19330
19626
  }
19331
19627
  } catch (error) {
@@ -19338,7 +19634,7 @@ var WorkflowGetCommand = {
19338
19634
  };
19339
19635
 
19340
19636
  // src/commands/workflow/commands/update.ts
19341
- import chalk67 from "chalk";
19637
+ import chalk68 from "chalk";
19342
19638
  import fs4 from "fs";
19343
19639
  import path7 from "path";
19344
19640
  import { parseWorkflowFile } from "@ai-setting/roy-agent-core/env/workflow/types";
@@ -19411,7 +19707,7 @@ var WorkflowUpdateCommand = {
19411
19707
  const tags = a.tags ? a.tags.split(",").map((t) => t.trim()) : undefined;
19412
19708
  const workflow = await service.updateWorkflow(a.name, updates, { tags });
19413
19709
  output.log(renderWorkflowUpdated(workflow));
19414
- output.log(chalk67.green(`
19710
+ output.log(chalk68.green(`
19415
19711
  ✅ Workflow '${a.name}' updated successfully`));
19416
19712
  } catch (error) {
19417
19713
  output.error(`Failed to update workflow: ${error}`);
@@ -19423,7 +19719,7 @@ var WorkflowUpdateCommand = {
19423
19719
  };
19424
19720
 
19425
19721
  // src/commands/workflow/commands/remove.ts
19426
- import chalk68 from "chalk";
19722
+ import chalk69 from "chalk";
19427
19723
  var WorkflowRemoveCommand = {
19428
19724
  command: "remove <name>",
19429
19725
  describe: "删除 Workflow",
@@ -19462,8 +19758,8 @@ var WorkflowRemoveCommand = {
19462
19758
  process.exit(1);
19463
19759
  }
19464
19760
  if (!args.force) {
19465
- output.log(chalk68.yellow(`Are you sure you want to delete workflow '${args.name}'?`));
19466
- output.log(chalk68.gray("Use --force to skip confirmation"));
19761
+ output.log(chalk69.yellow(`Are you sure you want to delete workflow '${args.name}'?`));
19762
+ output.log(chalk69.gray("Use --force to skip confirmation"));
19467
19763
  process.exit(1);
19468
19764
  }
19469
19765
  const deleted = await service.deleteWorkflow(args.name);
@@ -19483,7 +19779,7 @@ var WorkflowRemoveCommand = {
19483
19779
 
19484
19780
  // src/commands/workflow/commands/run.ts
19485
19781
  var import_yaml = __toESM(require_dist(), 1);
19486
- import chalk69 from "chalk";
19782
+ import chalk70 from "chalk";
19487
19783
  import fs5 from "fs";
19488
19784
  import path8 from "path";
19489
19785
  import { createRunWorkflowTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
@@ -19570,7 +19866,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
19570
19866
  }
19571
19867
  if (args.session) {
19572
19868
  const sessionId = args.session;
19573
- output.log(chalk69.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
19869
+ output.log(chalk70.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
19574
19870
  const sessionComponent = workflowComponent.sessionComponent;
19575
19871
  if (!sessionComponent) {
19576
19872
  output.error("SessionComponent not available");
@@ -19632,17 +19928,17 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
19632
19928
  definition = { ...definition, name: args.name };
19633
19929
  }
19634
19930
  const workflow = await service.createWorkflow(definition, { force: true });
19635
- output.log(chalk69.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
19636
- output.log(chalk69.green(`✅ Workflow registered: ${workflow.name} (${workflow.id})`));
19931
+ output.log(chalk70.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
19932
+ output.log(chalk70.green(`✅ Workflow registered: ${workflow.name} (${workflow.id})`));
19637
19933
  if (args.registerOnly) {
19638
- output.log(chalk69.gray("ℹ️ Use --register-only, skipping execution"));
19934
+ output.log(chalk70.gray("ℹ️ Use --register-only, skipping execution"));
19639
19935
  if (workflowSpan) {
19640
19936
  workflowSpan.end();
19641
19937
  }
19642
19938
  await envService.dispose();
19643
19939
  process.exit(0);
19644
19940
  }
19645
- output.log(chalk69.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
19941
+ output.log(chalk70.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
19646
19942
  const result = await service.runWorkflow(definition, input, runOptions);
19647
19943
  output.log(renderRunResult({
19648
19944
  runId: result.runId,
@@ -19652,7 +19948,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
19652
19948
  durationMs: result.durationMs
19653
19949
  }));
19654
19950
  if (result.status === "paused") {
19655
- output.log(chalk69.gray(`
19951
+ output.log(chalk70.gray(`
19656
19952
  \uD83D\uDCA1 Use "roy-agent workflow run ${result.runId} --session ${result.runId} --input '<response>'" to resume`));
19657
19953
  }
19658
19954
  } else {
@@ -19675,7 +19971,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
19675
19971
  durationMs: runData.duration_ms
19676
19972
  }));
19677
19973
  if (runData.status === "paused") {
19678
- output.log(chalk69.gray(`
19974
+ output.log(chalk70.gray(`
19679
19975
  \uD83D\uDCA1 Use "roy-agent workflow run ${runData.run_id} --session ${runData.run_id} --input '<response>'" to resume`));
19680
19976
  }
19681
19977
  }
@@ -19747,7 +20043,7 @@ var WorkflowRunCommand = {
19747
20043
  };
19748
20044
 
19749
20045
  // src/commands/workflow/commands/stop.ts
19750
- import chalk70 from "chalk";
20046
+ import chalk71 from "chalk";
19751
20047
  import { createWorkflowRunStopTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
19752
20048
  import { wrapFunction as wrapFunction2 } from "@ai-setting/roy-agent-core";
19753
20049
  var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
@@ -19772,7 +20068,7 @@ var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
19772
20068
  output.error(result.error || `Failed to stop workflow: ${args.runId}`);
19773
20069
  process.exit(1);
19774
20070
  }
19775
- output.log(chalk70.red(`
20071
+ output.log(chalk71.red(`
19776
20072
  ⏹️ Workflow stopped: ${args.runId}`));
19777
20073
  } catch (error) {
19778
20074
  output.error(`Failed to stop workflow: ${error}`);
@@ -19796,7 +20092,7 @@ var WorkflowStopCommand = {
19796
20092
  };
19797
20093
 
19798
20094
  // src/commands/workflow/commands/status.ts
19799
- import chalk71 from "chalk";
20095
+ import chalk72 from "chalk";
19800
20096
  import { createWorkflowRunStatusTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
19801
20097
  var WorkflowStatusCommand = {
19802
20098
  command: "status <runId>",
@@ -19889,7 +20185,7 @@ var WorkflowStatusCommand = {
19889
20185
  stopped: "⏹️"
19890
20186
  };
19891
20187
  const emoji = statusEmoji[status] || "❓";
19892
- output.log(chalk71.bold(`
20188
+ output.log(chalk72.bold(`
19893
20189
  ${emoji} Status: ${status.toUpperCase()}`));
19894
20190
  }
19895
20191
  } catch (error) {
@@ -19902,7 +20198,7 @@ ${emoji} Status: ${status.toUpperCase()}`));
19902
20198
  };
19903
20199
 
19904
20200
  // src/commands/workflow/commands/nodes.ts
19905
- import chalk72 from "chalk";
20201
+ import chalk73 from "chalk";
19906
20202
  var BUILT_IN_NODES = [
19907
20203
  {
19908
20204
  name: "ToolNode",
@@ -20239,7 +20535,7 @@ nodes:
20239
20535
  ];
20240
20536
  function renderNodeTypesTable(nodes) {
20241
20537
  const lines = [];
20242
- lines.push(chalk72.bold(`
20538
+ lines.push(chalk73.bold(`
20243
20539
  \uD83D\uDCE6 Built-in Node Types
20244
20540
  `));
20245
20541
  lines.push("┌────────────┬────────────────────┬─────────────────────────────────────────────────────────────┐");
@@ -20257,29 +20553,29 @@ function renderNodeTypesTable(nodes) {
20257
20553
  }
20258
20554
  function renderNodeDetail(node) {
20259
20555
  const lines = [];
20260
- lines.push(chalk72.bold(`
20556
+ lines.push(chalk73.bold(`
20261
20557
  [${node.type}] ${node.name}`));
20262
- lines.push(chalk72.dim("─".repeat(60)) + `
20558
+ lines.push(chalk73.dim("─".repeat(60)) + `
20263
20559
  `);
20264
- lines.push(chalk72.bold("Description:"));
20560
+ lines.push(chalk73.bold("Description:"));
20265
20561
  lines.push(` ${node.description}
20266
20562
  `);
20267
- lines.push(chalk72.bold("Configuration:"));
20563
+ lines.push(chalk73.bold("Configuration:"));
20268
20564
  lines.push(' type: "' + node.type + '"');
20269
20565
  lines.push(" config:");
20270
20566
  for (const input of node.inputs) {
20271
- const required = input.required ? chalk72.red("*") : " ";
20567
+ const required = input.required ? chalk73.red("*") : " ";
20272
20568
  lines.push(` ${input.name} (${input.type})${required}`);
20273
20569
  lines.push(` ${input.description}`);
20274
20570
  }
20275
20571
  lines.push(`
20276
- ${chalk72.bold("Output:")} ${node.output}`);
20572
+ ${chalk73.bold("Output:")} ${node.output}`);
20277
20573
  if (node.example) {
20278
- lines.push(chalk72.bold(`
20574
+ lines.push(chalk73.bold(`
20279
20575
  Example:`));
20280
- lines.push(chalk72.gray("```yaml"));
20576
+ lines.push(chalk73.gray("```yaml"));
20281
20577
  lines.push(node.example);
20282
- lines.push(chalk72.gray("```"));
20578
+ lines.push(chalk73.gray("```"));
20283
20579
  }
20284
20580
  return lines.join(`
20285
20581
  `);
@@ -20295,16 +20591,16 @@ var WorkflowNodesCommand = {
20295
20591
  const nodeType = args.type?.toLowerCase();
20296
20592
  if (!nodeType) {
20297
20593
  console.log(renderNodeTypesTable(BUILT_IN_NODES));
20298
- console.log(chalk72.gray(`
20299
- Use `) + chalk72.cyan("roy-agent workflow nodes <type>") + chalk72.gray(" for detailed information"));
20300
- console.log(chalk72.gray("Available types: ") + chalk72.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
20594
+ console.log(chalk73.gray(`
20595
+ Use `) + chalk73.cyan("roy-agent workflow nodes <type>") + chalk73.gray(" for detailed information"));
20596
+ console.log(chalk73.gray("Available types: ") + chalk73.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
20301
20597
  return;
20302
20598
  }
20303
20599
  const node = BUILT_IN_NODES.find((n) => n.type === nodeType);
20304
20600
  if (!node) {
20305
- console.log(chalk72.red(`
20601
+ console.log(chalk73.red(`
20306
20602
  ❌ Unknown node type: ${nodeType}`));
20307
- console.log(chalk72.gray("Available types: ") + chalk72.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
20603
+ console.log(chalk73.gray("Available types: ") + chalk73.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
20308
20604
  process.exit(1);
20309
20605
  }
20310
20606
  console.log(renderNodeDetail(node));
@@ -20312,7 +20608,7 @@ Use `) + chalk72.cyan("roy-agent workflow nodes <type>") + chalk72.gray(" for de
20312
20608
  };
20313
20609
 
20314
20610
  // src/commands/workflow/commands/validate.ts
20315
- import chalk73 from "chalk";
20611
+ import chalk74 from "chalk";
20316
20612
  import { readFileSync } from "fs";
20317
20613
  async function parseWorkflowInput(input, yamlStr) {
20318
20614
  const parseYaml = async (content) => {
@@ -20345,25 +20641,25 @@ function renderResult(result, options) {
20345
20641
  return;
20346
20642
  }
20347
20643
  if (result.valid) {
20348
- console.log(chalk73.green(`
20644
+ console.log(chalk74.green(`
20349
20645
  ✅ Workflow validation PASSED
20350
20646
  `));
20351
- console.log(chalk73.bold(`Workflow: ${result.workflowName}`));
20647
+ console.log(chalk74.bold(`Workflow: ${result.workflowName}`));
20352
20648
  console.log(`Nodes: ${result.nodeCount}`);
20353
20649
  console.log(`
20354
20650
  Valid nodes:`);
20355
- console.log(chalk73.green(" ✓ All nodes passed validation"));
20651
+ console.log(chalk74.green(" ✓ All nodes passed validation"));
20356
20652
  } else {
20357
- console.log(chalk73.red(`
20653
+ console.log(chalk74.red(`
20358
20654
  ❌ Workflow validation FAILED (${result.errors.length} errors found)
20359
20655
  `));
20360
20656
  result.errors.forEach((error, index) => {
20361
- console.log(chalk73.red(`[Error ${index + 1}/${result.errors.length}]${error.nodeId ? ` Node "${error.nodeId}"` : ""}`));
20362
- console.log(` ${chalk73.bold("Type:")} ${error.type}`);
20363
- console.log(` ${chalk73.bold("Description:")} ${error.description}`);
20364
- console.log(` ${chalk73.bold("Expected:")} ${error.expected}`);
20365
- console.log(` ${chalk73.bold("Actual:")} ${error.actual}`);
20366
- console.log(` ${chalk73.green("Fix:")} ${error.fix}`);
20657
+ console.log(chalk74.red(`[Error ${index + 1}/${result.errors.length}]${error.nodeId ? ` Node "${error.nodeId}"` : ""}`));
20658
+ console.log(` ${chalk74.bold("Type:")} ${error.type}`);
20659
+ console.log(` ${chalk74.bold("Description:")} ${error.description}`);
20660
+ console.log(` ${chalk74.bold("Expected:")} ${error.expected}`);
20661
+ console.log(` ${chalk74.bold("Actual:")} ${error.actual}`);
20662
+ console.log(` ${chalk74.green("Fix:")} ${error.fix}`);
20367
20663
  console.log();
20368
20664
  });
20369
20665
  }
@@ -20388,7 +20684,7 @@ var WorkflowValidateCommand = {
20388
20684
  try {
20389
20685
  const workflow = await parseWorkflowInput(options.input, options.yaml);
20390
20686
  if (!workflow) {
20391
- console.error(chalk73.red("Failed to parse workflow input"));
20687
+ console.error(chalk74.red("Failed to parse workflow input"));
20392
20688
  process.exit(1);
20393
20689
  }
20394
20690
  const validator = new WorkflowValidator;
@@ -20396,7 +20692,7 @@ var WorkflowValidateCommand = {
20396
20692
  renderResult(result, options);
20397
20693
  process.exit(result.valid ? 0 : 1);
20398
20694
  } catch (error) {
20399
- console.error(chalk73.red(`
20695
+ console.error(chalk74.red(`
20400
20696
  Error: ${error.message}`));
20401
20697
  process.exit(1);
20402
20698
  }
@@ -20404,7 +20700,7 @@ Error: ${error.message}`));
20404
20700
  };
20405
20701
 
20406
20702
  // src/commands/workflow/commands/search.ts
20407
- import chalk74 from "chalk";
20703
+ import chalk75 from "chalk";
20408
20704
  import { wrapFunction as wrapFunction3 } from "@ai-setting/roy-agent-core";
20409
20705
  var WorkflowSearchCommand = {
20410
20706
  command: "search",
@@ -20561,22 +20857,22 @@ var _runWorkflowSearchImpl = async function(opts) {
20561
20857
  metadata: {}
20562
20858
  }));
20563
20859
  if (renderWorkflows.length === 0) {
20564
- output.log(chalk74.yellow("\uD83D\uDD0D No workflows matched the search criteria."));
20565
- output.log(chalk74.gray(` keyword: ${keyword || "(none)"}`));
20566
- output.log(chalk74.gray(` tags: ${tags && tags.length > 0 ? tags.join(", ") : "(none)"}`));
20860
+ output.log(chalk75.yellow("\uD83D\uDD0D No workflows matched the search criteria."));
20861
+ output.log(chalk75.gray(` keyword: ${keyword || "(none)"}`));
20862
+ output.log(chalk75.gray(` tags: ${tags && tags.length > 0 ? tags.join(", ") : "(none)"}`));
20567
20863
  } else {
20568
- output.log(chalk74.bold(`\uD83D\uDD0D Search results (${renderWorkflows.length}):`));
20864
+ output.log(chalk75.bold(`\uD83D\uDD0D Search results (${renderWorkflows.length}):`));
20569
20865
  output.log(renderWorkflowList(renderWorkflows));
20570
- output.log(chalk74.green(`
20866
+ output.log(chalk75.green(`
20571
20867
  ✅ Found ${renderWorkflows.length} workflow(s)`));
20572
20868
  }
20573
20869
  if (availableTags.length > 0) {
20574
20870
  output.log("");
20575
- output.log(chalk74.bold("\uD83D\uDCDA Available tags (sorted by usage_count):"));
20871
+ output.log(chalk75.bold("\uD83D\uDCDA Available tags (sorted by usage_count):"));
20576
20872
  for (const t of availableTags) {
20577
20873
  const name = t.name ?? t.tag;
20578
20874
  const count = t.count ?? t.usage_count;
20579
- output.log(chalk74.gray(` - ${name} (${count})`));
20875
+ output.log(chalk75.gray(` - ${name} (${count})`));
20580
20876
  }
20581
20877
  }
20582
20878
  };
@@ -20588,7 +20884,7 @@ var runWorkflowSearch = wrapFunction3(_runWorkflowSearchImpl, "workflow.cli.sear
20588
20884
 
20589
20885
  // src/commands/workflow/commands/tag.ts
20590
20886
  import { wrapFunction as wrapFunction4 } from "@ai-setting/roy-agent-core";
20591
- import chalk75 from "chalk";
20887
+ import chalk76 from "chalk";
20592
20888
  var WorkflowTagListCommand = {
20593
20889
  command: "list",
20594
20890
  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.",
@@ -20709,17 +21005,17 @@ var _runWorkflowTagListImpl = async function(opts) {
20709
21005
  return;
20710
21006
  }
20711
21007
  if (result.tags.length === 0) {
20712
- output.log(chalk75.yellow("\uD83C\uDFF7️ No tags in the workflow_tags table yet."));
20713
- output.log(chalk75.gray(" Tags are created automatically when you run `workflow add --tags <name>`."));
21008
+ output.log(chalk76.yellow("\uD83C\uDFF7️ No tags in the workflow_tags table yet."));
21009
+ output.log(chalk76.gray(" Tags are created automatically when you run `workflow add --tags <name>`."));
20714
21010
  return;
20715
21011
  }
20716
- output.log(chalk75.bold(`\uD83C\uDFF7️ Workflow tags (${result.total}):`));
20717
- output.log(chalk75.gray(` ${padRight("NAME", 24)}${padRight("USAGE", 8)}${padRight("CREATED", 22)}`));
21012
+ output.log(chalk76.bold(`\uD83C\uDFF7️ Workflow tags (${result.total}):`));
21013
+ output.log(chalk76.gray(` ${padRight("NAME", 24)}${padRight("USAGE", 8)}${padRight("CREATED", 22)}`));
20718
21014
  for (const t of result.tags) {
20719
21015
  const line = ` ${padRight(t.name, 24)}${padRight(String(t.usage_count), 8)}${padRight(formatDate2(t.created_at), 22)}`;
20720
21016
  output.log(line);
20721
21017
  }
20722
- output.log(chalk75.gray(`
21018
+ output.log(chalk76.gray(`
20723
21019
  \uD83D\uDCA1 Tip: when adding a new workflow, prefer tags from this list to ensure semantic consistency.`));
20724
21020
  };
20725
21021
  var _runWorkflowTagGetImpl = async function(opts) {
@@ -20746,7 +21042,7 @@ var _runWorkflowTagGetImpl = async function(opts) {
20746
21042
  output.json({ error: "Tag not found", name: opts.name });
20747
21043
  } else {
20748
21044
  output.error(`Tag "${opts.name}" not found in the workflow_tags table.`);
20749
- output.log(chalk75.gray(`Tip: run \`roy-agent workflow tag list\` to see available tags.`));
21045
+ output.log(chalk76.gray(`Tip: run \`roy-agent workflow tag list\` to see available tags.`));
20750
21046
  }
20751
21047
  process.exitCode = 1;
20752
21048
  return;
@@ -20755,10 +21051,10 @@ var _runWorkflowTagGetImpl = async function(opts) {
20755
21051
  output.json(tag);
20756
21052
  return;
20757
21053
  }
20758
- output.log(chalk75.bold(`\uD83C\uDFF7️ Tag: ${tag.name}`));
20759
- output.log(chalk75.gray(` usage_count: ${tag.usage_count}`));
20760
- output.log(chalk75.gray(` created_at: ${tag.created_at}`));
20761
- output.log(chalk75.gray(` updated_at: ${tag.updated_at}`));
21054
+ output.log(chalk76.bold(`\uD83C\uDFF7️ Tag: ${tag.name}`));
21055
+ output.log(chalk76.gray(` usage_count: ${tag.usage_count}`));
21056
+ output.log(chalk76.gray(` created_at: ${tag.created_at}`));
21057
+ output.log(chalk76.gray(` updated_at: ${tag.updated_at}`));
20762
21058
  };
20763
21059
  async function callListTags(service, options) {
20764
21060
  if (typeof service.listTags !== "function") {
@@ -21412,6 +21708,10 @@ var InstallCommand = {
21412
21708
 
21413
21709
  // src/cli.ts
21414
21710
  function quietModeMiddleware(argv) {
21711
+ if (argv.noquiet === true) {
21712
+ argv.quiet = false;
21713
+ delete argv.noquiet;
21714
+ }
21415
21715
  const quietService = CliQuietModeService.getInstance();
21416
21716
  if (argv.quiet === true) {
21417
21717
  quietService.setQuiet(true);
@@ -21453,6 +21753,10 @@ async function runCli() {
21453
21753
  type: "boolean",
21454
21754
  default: true,
21455
21755
  global: true
21756
+ }).option("noquiet", {
21757
+ type: "boolean",
21758
+ description: "Alias for --no-quiet (no hyphen form). Disables quiet mode.",
21759
+ global: true
21456
21760
  }).option("plugin", {
21457
21761
  alias: "p",
21458
21762
  type: "string",