@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.
- package/CHANGELOG.md +8 -0
- package/README.md +7 -1
- package/README.zh.md +7 -1
- package/dist/cli/FeishuAppConfiguration.js +84 -22
- package/dist/cli/FeishuAppConfiguration.js.map +1 -1
- package/dist/cli/FeishuAppRegistration.js +12 -9
- package/dist/cli/FeishuAppRegistration.js.map +1 -1
- package/dist/cli/Initializer.js +7 -6
- package/dist/cli/Initializer.js.map +1 -1
- package/dist/cli/LocalControlClient.js +3 -2
- package/dist/cli/LocalControlClient.js.map +1 -1
- package/dist/cli/LocalControlServer.js +2 -1
- package/dist/cli/LocalControlServer.js.map +1 -1
- package/dist/cli/OptionalAuthorizationSkip.js +27 -6
- package/dist/cli/OptionalAuthorizationSkip.js.map +1 -1
- package/dist/cli/ServerStarter.js +12 -3
- package/dist/cli/ServerStarter.js.map +1 -1
- package/dist/cli/SkillRegistry.js +5 -4
- package/dist/cli/SkillRegistry.js.map +1 -1
- package/dist/cli/VerificationOutput.js +2 -1
- package/dist/cli/VerificationOutput.js.map +1 -1
- package/dist/cli/help.js +48 -1
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/i18n.js +27 -0
- package/dist/cli/i18n.js.map +1 -0
- package/dist/cli/initOptions.js +5 -4
- package/dist/cli/initOptions.js.map +1 -1
- package/dist/cli/packageVersion.js +2 -1
- package/dist/cli/packageVersion.js.map +1 -1
- package/dist/cli/profile.js +4 -3
- package/dist/cli/profile.js.map +1 -1
- package/dist/cli/serverStatus.js +15 -14
- package/dist/cli/serverStatus.js.map +1 -1
- package/dist/cli/taskChatRoute.js +3 -2
- package/dist/cli/taskChatRoute.js.map +1 -1
- package/dist/cli.js +165 -107
- package/dist/cli.js.map +1 -1
- package/dist/commands/CommandRouter.js +49 -3
- package/dist/commands/CommandRouter.js.map +1 -1
- package/dist/proxy/ProxySessionController.js +6 -0
- package/dist/proxy/ProxySessionController.js.map +1 -1
- package/docs/technical-reference.md +13 -2
- package/docs/technical-reference.zh.md +13 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/skills/agent-bot/SKILL.md +6 -6
- package/src/cli/FeishuAppConfiguration.ts +130 -18
- package/src/cli/FeishuAppRegistration.ts +24 -9
- package/src/cli/Initializer.ts +25 -6
- package/src/cli/LocalControlClient.ts +9 -2
- package/src/cli/LocalControlServer.ts +2 -1
- package/src/cli/OptionalAuthorizationSkip.ts +51 -6
- package/src/cli/ServerStarter.ts +20 -3
- package/src/cli/SkillRegistry.ts +17 -4
- package/src/cli/VerificationOutput.ts +4 -1
- package/src/cli/help.ts +50 -1
- package/src/cli/i18n.ts +38 -0
- package/src/cli/initOptions.ts +17 -4
- package/src/cli/packageVersion.ts +5 -1
- package/src/cli/profile.ts +13 -3
- package/src/cli/serverStatus.ts +19 -14
- package/src/cli/taskChatRoute.ts +9 -2
- package/src/cli.ts +290 -103
- package/src/commands/CommandRouter.ts +58 -3
- 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
|
|
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
|
"**[参数]** 可选 **<参数>** 必填",
|
|
2831
2837
|
],
|
|
2832
2838
|
},
|