@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.
Files changed (65) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +14 -1
  3. package/README.zh.md +14 -1
  4. package/dist/cli/FeishuAppConfiguration.js +10 -10
  5. package/dist/cli/FeishuAppConfiguration.js.map +1 -1
  6. package/dist/cli/FeishuAppRegistration.js +9 -9
  7. package/dist/cli/FeishuAppRegistration.js.map +1 -1
  8. package/dist/cli/Initializer.js +64 -5
  9. package/dist/cli/Initializer.js.map +1 -1
  10. package/dist/cli/LocalControlClient.js +2 -2
  11. package/dist/cli/LocalControlClient.js.map +1 -1
  12. package/dist/cli/LocalControlServer.js +1 -1
  13. package/dist/cli/LocalControlServer.js.map +1 -1
  14. package/dist/cli/ServerStarter.js +3 -3
  15. package/dist/cli/ServerStarter.js.map +1 -1
  16. package/dist/cli/SkillRegistry.js +4 -4
  17. package/dist/cli/SkillRegistry.js.map +1 -1
  18. package/dist/cli/help.js +9 -57
  19. package/dist/cli/help.js.map +1 -1
  20. package/dist/cli/initOptions.js +24 -0
  21. package/dist/cli/initOptions.js.map +1 -0
  22. package/dist/cli/packageVersion.js +1 -1
  23. package/dist/cli/packageVersion.js.map +1 -1
  24. package/dist/cli/profile.js +3 -3
  25. package/dist/cli/profile.js.map +1 -1
  26. package/dist/cli/serverStatus.js +37 -0
  27. package/dist/cli/serverStatus.js.map +1 -0
  28. package/dist/cli/taskChatRoute.js +2 -2
  29. package/dist/cli/taskChatRoute.js.map +1 -1
  30. package/dist/cli.js +154 -136
  31. package/dist/cli.js.map +1 -1
  32. package/dist/feishu/CardRenderer.js +1 -1
  33. package/dist/feishu/CardRenderer.js.map +1 -1
  34. package/dist/feishu/transport.js +1 -1
  35. package/dist/feishu/transport.js.map +1 -1
  36. package/dist/index.js +8 -4
  37. package/dist/index.js.map +1 -1
  38. package/dist/proxy/ProxySessionController.js +10 -10
  39. package/dist/proxy/ProxySessionController.js.map +1 -1
  40. package/dist/startup/StartupNotifier.js +1 -0
  41. package/dist/startup/StartupNotifier.js.map +1 -1
  42. package/docs/technical-reference.md +5 -1
  43. package/docs/technical-reference.zh.md +5 -1
  44. package/npm-shrinkwrap.json +2 -2
  45. package/package.json +1 -1
  46. package/skills/agent-bot/SKILL.md +3 -1
  47. package/src/cli/FeishuAppConfiguration.ts +10 -10
  48. package/src/cli/FeishuAppRegistration.ts +9 -9
  49. package/src/cli/Initializer.ts +76 -6
  50. package/src/cli/LocalControlClient.ts +2 -2
  51. package/src/cli/LocalControlServer.ts +1 -1
  52. package/src/cli/ServerStarter.ts +3 -3
  53. package/src/cli/SkillRegistry.ts +4 -4
  54. package/src/cli/help.ts +9 -66
  55. package/src/cli/initOptions.ts +33 -0
  56. package/src/cli/packageVersion.ts +1 -1
  57. package/src/cli/profile.ts +3 -3
  58. package/src/cli/serverStatus.ts +39 -0
  59. package/src/cli/taskChatRoute.ts +2 -2
  60. package/src/cli.ts +158 -139
  61. package/src/feishu/CardRenderer.ts +2 -0
  62. package/src/feishu/transport.ts +1 -1
  63. package/src/index.ts +8 -4
  64. package/src/proxy/ProxySessionController.ts +10 -10
  65. 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
+ }
@@ -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(`任务没有绑定飞书会话:${session.remoteSessionId ?? session.acpSessionId ?? session.localSessionId}`);
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(`任务的飞书会话 ID 无效:${contextKey}`);
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;