@epoch-agent/tui 0.27.0 → 0.28.0

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.d.ts CHANGED
@@ -991,6 +991,15 @@ interface SlashCommand {
991
991
  name: string;
992
992
  /** 别名,同样不带斜杠 */
993
993
  aliases?: string[];
994
+ /**
995
+ * 给人看的称呼(自定义命令 frontmatter 的 `displayName`,2026-10-10)。
996
+ * 内置命令不写。
997
+ *
998
+ * ⚠️ 终端里**左列照旧印 `/name`** —— 那是用户真要敲的东西,换成称呼等于让他
999
+ * 照着屏幕敲一个认不出来的命令。称呼印在右列说明的前面,见 `parse.ts` 的
1000
+ * `describeCommand`。
1001
+ */
1002
+ displayName?: string;
994
1003
  /** 一行说明,出现在补全面板和 /help 里 */
995
1004
  description: string;
996
1005
  /** 参数占位符,例如 `[level]`;只用于展示 */
@@ -1397,6 +1406,11 @@ declare function findCommand(commands: readonly SlashCommand[], name: string): S
1397
1406
  *
1398
1407
  * `/` 单独一个字符时列出全部命令(用户刚敲下斜杠,正等着看有什么可用)。
1399
1408
  * 已经带了参数(有空格)时不再补全 —— 那时候用户在填参数,不该再弹列表。
1409
+ *
1410
+ * 称呼(`displayName`)也按前缀认(2026-10-10):插件命令的名字是
1411
+ * `aione:bailing_daily_report` 这种,用户记得住的是「百灵投放日报」,打 `/百灵`
1412
+ * 该找得到它。⚠️ 同样是**前缀**不是子串,判据和名字那一支一致 —— 子串的话
1413
+ * `/c` 会捞出所有称呼里带个 c 的命令。web 那一份(`composer/commands.tsx`)逐字镜像。
1400
1414
  */
1401
1415
  declare function matchCommands(commands: readonly SlashCommand[], text: string): readonly SlashCommand[];
1402
1416
 
package/dist/index.js CHANGED
@@ -25,9 +25,12 @@ function matchCommands(commands, text) {
25
25
  const prefix = body.toLowerCase();
26
26
  if (!prefix) return commands;
27
27
  return commands.filter(
28
- (c) => c.name.startsWith(prefix) || c.aliases?.some((a) => a.startsWith(prefix))
28
+ (c) => c.name.startsWith(prefix) || c.aliases?.some((a) => a.startsWith(prefix)) || c.displayName?.toLowerCase().startsWith(prefix) === true
29
29
  );
30
30
  }
31
+ function describeCommand(cmd) {
32
+ return cmd.displayName ? `${cmd.displayName} \xB7 ${cmd.description}` : cmd.description;
33
+ }
31
34
  // src/commands/prefix.ts
32
35
  function classifyInput(text, commands) {
33
36
  if (text.includes("\n")) return { kind: "text" };
@@ -708,7 +711,7 @@ function CommandPalette({
708
711
  return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", children: [
709
712
  /* @__PURE__ */ jsx6(Box5, { width: 2, flexShrink: 0, children: /* @__PURE__ */ jsx6(Text5, { color: selected ? accent3 : dim4, children: selected ? "\u276F " : " " }) }),
710
713
  /* @__PURE__ */ jsx6(Box5, { flexShrink: 0, children: /* @__PURE__ */ jsx6(Text5, { color: selected ? accent3 : "#F8F8F2", bold: selected, children: padEndByWidth(label, nameWidth + 1) }) }),
711
- /* @__PURE__ */ jsx6(Text5, { color: dim4, dimColor: true, children: cmd.description })
714
+ /* @__PURE__ */ jsx6(Text5, { color: dim4, dimColor: true, children: describeCommand(cmd) })
712
715
  ] }, cmd.name);
713
716
  }),
714
717
  /* @__PURE__ */ jsx6(Box5, { flexDirection: "row", children: /* @__PURE__ */ jsxs5(Text5, { color: dim4, dimColor: true, children: [
@@ -5403,7 +5406,7 @@ var help = {
5403
5406
  ) + 2;
5404
5407
  const format = (c) => {
5405
5408
  const label = `/${c.name}${c.argHint ? " " + c.argHint : ""}`;
5406
- return ` ${padEndByWidth(label, width)}${c.description}`;
5409
+ return ` ${padEndByWidth(label, width)}${describeCommand(c)}`;
5407
5410
  };
5408
5411
  const builtin = ctx.commands.filter((c) => !c.source);
5409
5412
  const custom = ctx.commands.filter((c) => c.source);
@@ -5779,6 +5782,7 @@ function availableCommands(host, commands = BUILTIN_COMMANDS) {
5779
5782
  function toSlashCommand(def) {
5780
5783
  return {
5781
5784
  name: def.name,
5785
+ ...def.displayName ? { displayName: def.displayName } : {},
5782
5786
  description: def.description,
5783
5787
  source: def.source,
5784
5788
  ...def.argumentHint ? { argHint: def.argumentHint } : {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epoch-agent/tui",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "private": false,
5
5
  "description": "epoch-agent Ink TUI 界面",
6
6
  "repository": {
@@ -29,8 +29,8 @@
29
29
  "mnemonist": "0",
30
30
  "string-width": "8",
31
31
  "strip-ansi": "7",
32
- "@epoch-agent/protocol": "0.27.0",
33
- "@epoch-agent/view": "0.27.0"
32
+ "@epoch-agent/protocol": "0.28.0",
33
+ "@epoch-agent/view": "0.28.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "^26.1.2",