@keyou007/agent-bot 0.1.3 → 0.1.5
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 +11 -0
- package/README.md +14 -1
- package/README.zh.md +14 -1
- package/dist/cli/FeishuAppConfiguration.js +10 -10
- package/dist/cli/FeishuAppConfiguration.js.map +1 -1
- package/dist/cli/FeishuAppRegistration.js +9 -9
- package/dist/cli/FeishuAppRegistration.js.map +1 -1
- package/dist/cli/Initializer.js +64 -5
- package/dist/cli/Initializer.js.map +1 -1
- package/dist/cli/LocalControlClient.js +2 -2
- package/dist/cli/LocalControlClient.js.map +1 -1
- package/dist/cli/LocalControlServer.js +1 -1
- package/dist/cli/LocalControlServer.js.map +1 -1
- package/dist/cli/ServerStarter.js +3 -3
- package/dist/cli/ServerStarter.js.map +1 -1
- package/dist/cli/SkillRegistry.js +4 -4
- package/dist/cli/SkillRegistry.js.map +1 -1
- package/dist/cli/help.js +9 -57
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/initOptions.js +24 -0
- package/dist/cli/initOptions.js.map +1 -0
- package/dist/cli/packageVersion.js +1 -1
- package/dist/cli/packageVersion.js.map +1 -1
- package/dist/cli/profile.js +3 -3
- package/dist/cli/profile.js.map +1 -1
- package/dist/cli/serverStatus.js +37 -0
- package/dist/cli/serverStatus.js.map +1 -0
- package/dist/cli/taskChatRoute.js +2 -2
- package/dist/cli/taskChatRoute.js.map +1 -1
- package/dist/cli.js +154 -136
- package/dist/cli.js.map +1 -1
- package/dist/feishu/CardRenderer.js +1 -1
- package/dist/feishu/CardRenderer.js.map +1 -1
- package/dist/feishu/transport.js +1 -1
- package/dist/feishu/transport.js.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/proxy/ProxySessionController.js +10 -10
- package/dist/proxy/ProxySessionController.js.map +1 -1
- package/dist/startup/StartupNotifier.js +1 -0
- package/dist/startup/StartupNotifier.js.map +1 -1
- package/docs/technical-reference.md +5 -1
- package/docs/technical-reference.zh.md +5 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/skills/agent-bot/SKILL.md +3 -1
- package/src/cli/FeishuAppConfiguration.ts +10 -10
- package/src/cli/FeishuAppRegistration.ts +9 -9
- package/src/cli/Initializer.ts +76 -6
- package/src/cli/LocalControlClient.ts +2 -2
- package/src/cli/LocalControlServer.ts +1 -1
- package/src/cli/ServerStarter.ts +3 -3
- package/src/cli/SkillRegistry.ts +4 -4
- package/src/cli/help.ts +9 -66
- package/src/cli/initOptions.ts +33 -0
- package/src/cli/packageVersion.ts +1 -1
- package/src/cli/profile.ts +3 -3
- package/src/cli/serverStatus.ts +39 -0
- package/src/cli/taskChatRoute.ts +2 -2
- package/src/cli.ts +158 -139
- package/src/feishu/CardRenderer.ts +2 -0
- package/src/feishu/transport.ts +1 -1
- package/src/index.ts +8 -4
- package/src/proxy/ProxySessionController.ts +10 -10
- package/src/startup/StartupNotifier.ts +2 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export function withConfiguredFeishuAppId(
|
|
2
|
+
data: unknown,
|
|
3
|
+
configuredFeishuAppId?: string,
|
|
4
|
+
): Record<string, unknown> {
|
|
5
|
+
const value = data && typeof data === "object"
|
|
6
|
+
? data as Record<string, unknown>
|
|
7
|
+
: {};
|
|
8
|
+
if (Object.hasOwn(value, "feishuAppId")) return value;
|
|
9
|
+
return {
|
|
10
|
+
...value,
|
|
11
|
+
feishuAppId: configuredFeishuAppId ?? null,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function formatServerStatus(data: unknown): string {
|
|
16
|
+
const value = data && typeof data === "object" ? data as Record<string, unknown> : {};
|
|
17
|
+
const activity = value.activity && typeof value.activity === "object"
|
|
18
|
+
? value.activity as Record<string, unknown>
|
|
19
|
+
: {};
|
|
20
|
+
const state = value.running === false
|
|
21
|
+
? "not running"
|
|
22
|
+
: value.ready === false
|
|
23
|
+
? "starting (connecting to Lark)"
|
|
24
|
+
: "running";
|
|
25
|
+
const safeRestart = value.safeRestartScheduled
|
|
26
|
+
? `pending (${String(value.safeRestartReason ?? "no reason provided")})`
|
|
27
|
+
: "not scheduled";
|
|
28
|
+
return [
|
|
29
|
+
`Agent Bot server: ${state}`,
|
|
30
|
+
`Lark App ID: ${value.feishuAppId ?? "not configured"}`,
|
|
31
|
+
`PID: ${value.pid ?? "-"}`,
|
|
32
|
+
`Started at: ${value.startedAt ?? "-"}`,
|
|
33
|
+
`Supervisor: ${value.supervised ? "enabled" : "disabled"}`,
|
|
34
|
+
`Running tasks: ${activity.runningSessions ?? 0}`,
|
|
35
|
+
`Pending final deliveries: ${activity.pendingFinalDeliveries ?? 0}`,
|
|
36
|
+
`Safe restart: ${safeRestart}`,
|
|
37
|
+
"",
|
|
38
|
+
].join("\n");
|
|
39
|
+
}
|
package/src/cli/taskChatRoute.ts
CHANGED
|
@@ -15,10 +15,10 @@ export function taskChatRoute(session: SessionRecord): TaskChatRoute {
|
|
|
15
15
|
const contextKey = session.contextKey;
|
|
16
16
|
const baseContextKey = baseChatContextKey(contextKey);
|
|
17
17
|
if (!baseContextKey.startsWith(CHAT_CONTEXT_PREFIX)) {
|
|
18
|
-
throw new Error(
|
|
18
|
+
throw new Error(`The task is not bound to a Lark chat: ${session.remoteSessionId ?? session.acpSessionId ?? session.localSessionId}`);
|
|
19
19
|
}
|
|
20
20
|
const chatId = baseContextKey.slice(CHAT_CONTEXT_PREFIX.length);
|
|
21
|
-
if (!chatId) throw new Error(
|
|
21
|
+
if (!chatId) throw new Error(`The task has an invalid Lark chat ID: ${contextKey}`);
|
|
22
22
|
const threadId = isThreadContextKey(contextKey)
|
|
23
23
|
? contextKey.slice(contextKey.indexOf(THREAD_CONTEXT_MARKER) + THREAD_CONTEXT_MARKER.length)
|
|
24
24
|
: undefined;
|