@keyou007/agent-bot 0.1.9 → 0.1.10

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +7 -1
  3. package/README.zh.md +7 -1
  4. package/dist/cli/FeishuAppConfiguration.js +84 -22
  5. package/dist/cli/FeishuAppConfiguration.js.map +1 -1
  6. package/dist/cli/FeishuAppRegistration.js +12 -9
  7. package/dist/cli/FeishuAppRegistration.js.map +1 -1
  8. package/dist/cli/Initializer.js +7 -6
  9. package/dist/cli/Initializer.js.map +1 -1
  10. package/dist/cli/LocalControlClient.js +3 -2
  11. package/dist/cli/LocalControlClient.js.map +1 -1
  12. package/dist/cli/LocalControlServer.js +2 -1
  13. package/dist/cli/LocalControlServer.js.map +1 -1
  14. package/dist/cli/OptionalAuthorizationSkip.js +27 -6
  15. package/dist/cli/OptionalAuthorizationSkip.js.map +1 -1
  16. package/dist/cli/ServerStarter.js +12 -3
  17. package/dist/cli/ServerStarter.js.map +1 -1
  18. package/dist/cli/SkillRegistry.js +5 -4
  19. package/dist/cli/SkillRegistry.js.map +1 -1
  20. package/dist/cli/VerificationOutput.js +2 -1
  21. package/dist/cli/VerificationOutput.js.map +1 -1
  22. package/dist/cli/help.js +48 -1
  23. package/dist/cli/help.js.map +1 -1
  24. package/dist/cli/i18n.js +27 -0
  25. package/dist/cli/i18n.js.map +1 -0
  26. package/dist/cli/initOptions.js +5 -4
  27. package/dist/cli/initOptions.js.map +1 -1
  28. package/dist/cli/packageVersion.js +2 -1
  29. package/dist/cli/packageVersion.js.map +1 -1
  30. package/dist/cli/profile.js +4 -3
  31. package/dist/cli/profile.js.map +1 -1
  32. package/dist/cli/serverStatus.js +15 -14
  33. package/dist/cli/serverStatus.js.map +1 -1
  34. package/dist/cli/taskChatRoute.js +3 -2
  35. package/dist/cli/taskChatRoute.js.map +1 -1
  36. package/dist/cli.js +165 -107
  37. package/dist/cli.js.map +1 -1
  38. package/dist/commands/CommandRouter.js +49 -3
  39. package/dist/commands/CommandRouter.js.map +1 -1
  40. package/dist/proxy/ProxySessionController.js +6 -0
  41. package/dist/proxy/ProxySessionController.js.map +1 -1
  42. package/docs/technical-reference.md +13 -2
  43. package/docs/technical-reference.zh.md +13 -2
  44. package/npm-shrinkwrap.json +2 -2
  45. package/package.json +1 -1
  46. package/skills/agent-bot/SKILL.md +6 -6
  47. package/src/cli/FeishuAppConfiguration.ts +130 -18
  48. package/src/cli/FeishuAppRegistration.ts +24 -9
  49. package/src/cli/Initializer.ts +25 -6
  50. package/src/cli/LocalControlClient.ts +9 -2
  51. package/src/cli/LocalControlServer.ts +2 -1
  52. package/src/cli/OptionalAuthorizationSkip.ts +51 -6
  53. package/src/cli/ServerStarter.ts +20 -3
  54. package/src/cli/SkillRegistry.ts +17 -4
  55. package/src/cli/VerificationOutput.ts +4 -1
  56. package/src/cli/help.ts +50 -1
  57. package/src/cli/i18n.ts +38 -0
  58. package/src/cli/initOptions.ts +17 -4
  59. package/src/cli/packageVersion.ts +5 -1
  60. package/src/cli/profile.ts +13 -3
  61. package/src/cli/serverStatus.ts +19 -14
  62. package/src/cli/taskChatRoute.ts +9 -2
  63. package/src/cli.ts +290 -103
  64. package/src/commands/CommandRouter.ts +58 -3
  65. package/src/proxy/ProxySessionController.ts +6 -0
@@ -1,5 +1,39 @@
1
1
  import type { Command } from "./commandTypes.js";
2
2
 
3
+ const COMMAND_NAMES = [
4
+ "agent",
5
+ "agents",
6
+ "ask",
7
+ "fork",
8
+ "forkgroup",
9
+ "goal",
10
+ "help",
11
+ "mode",
12
+ "model",
13
+ "modes",
14
+ "new",
15
+ "newgroup",
16
+ "nosteer",
17
+ "permissions",
18
+ "queue",
19
+ "restart",
20
+ "sessions",
21
+ "status",
22
+ "stop",
23
+ "switch",
24
+ "thinking",
25
+ "title",
26
+ "use",
27
+ ] as const;
28
+
29
+ type CommandName = (typeof COMMAND_NAMES)[number];
30
+
31
+ const COMMAND_INITIALISMS: Partial<Record<CommandName, string>> = {
32
+ forkgroup: "fg",
33
+ newgroup: "ng",
34
+ nosteer: "ns",
35
+ };
36
+
3
37
  export class CommandRouter {
4
38
  parse(text: string): Command {
5
39
  const trimmed = text.trim();
@@ -13,7 +47,7 @@ export class CommandRouter {
13
47
  }
14
48
 
15
49
  const [rawCommand, ...args] = splitArgs(trimmed);
16
- const command = rawCommand.slice(1).toLowerCase();
50
+ const command = resolveCommandName(rawCommand);
17
51
 
18
52
  switch (command) {
19
53
  case "agents":
@@ -86,12 +120,33 @@ export class CommandRouter {
86
120
  }
87
121
  case "help":
88
122
  return { type: "help" };
89
- default:
90
- throw new Error(`未知命令:${rawCommand}。发送 /help 查看可用命令。`);
91
123
  }
92
124
  }
93
125
  }
94
126
 
127
+ function resolveCommandName(rawCommand: string): CommandName {
128
+ const input = rawCommand.slice(1).toLowerCase();
129
+ if (!input) throw unknownCommand(rawCommand);
130
+
131
+ const exact = COMMAND_NAMES.find((command) => command === input);
132
+ if (exact) return exact;
133
+
134
+ const matches = COMMAND_NAMES.filter(
135
+ (command) => command.startsWith(input) || COMMAND_INITIALISMS[command] === input,
136
+ );
137
+ if (matches.length === 1) return matches[0]!;
138
+ if (matches.length > 1) {
139
+ throw new Error(
140
+ `命令前缀 ${rawCommand} 不唯一,可匹配:${matches.map((command) => `/${command}`).join("、")}。请输入更长的命令前缀。`,
141
+ );
142
+ }
143
+ throw unknownCommand(rawCommand);
144
+ }
145
+
146
+ function unknownCommand(rawCommand: string): Error {
147
+ return new Error(`未知命令:${rawCommand}。发送 /help 查看可用命令。`);
148
+ }
149
+
95
150
  function requireArg<T>(value: string | undefined, name: string, create: (value: string) => T): T {
96
151
  if (!value) {
97
152
  throw new Error(`Missing ${name}.`);
@@ -1675,6 +1675,9 @@ export class ProxySessionController {
1675
1675
  `已从${prepared.sourceDescription}创建分支。`,
1676
1676
  `当前任务:${taskDescription}`,
1677
1677
  `当前 Project 目录:${boundProjectCwd ?? "未绑定(Projectless)"}`,
1678
+ `当前模型:${forked.session.model ?? "默认"}`,
1679
+ `思考强度:${forked.session.reasoningEffort ?? "自动"}`,
1680
+ `权限类型:${forked.session.permissionMode === "confirm" ? "执行前确认" : "自动执行"}`,
1678
1681
  ].join("\n"),
1679
1682
  );
1680
1683
  await this.outbound.sendText(
@@ -2827,6 +2830,9 @@ export class ProxySessionController {
2827
2830
  {
2828
2831
  lines: [
2829
2832
  "直接发送消息即可继续当前任务;执行中发送的新消息会追加到本次任务。",
2833
+ "> 命令前缀示例:/sess 等同于 /sessions。",
2834
+ "> 命令缩写示例:/fg 等同于 /forkgroup。",
2835
+ "前缀或缩写匹配多个命令时,需要输入更长的形式。",
2830
2836
  "**[参数]** 可选 **&#60;参数&#62;** 必填",
2831
2837
  ],
2832
2838
  },