@keyou007/agent-bot 0.1.14-alpha.1 → 0.1.14-alpha.3

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 (80) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/README.md +48 -15
  3. package/README.zh.md +48 -15
  4. package/config.example.yaml +1 -1
  5. package/dist/cli/AutostartManager.js +431 -0
  6. package/dist/cli/AutostartManager.js.map +1 -0
  7. package/dist/cli/FeishuAppConfiguration.js +21 -13
  8. package/dist/cli/FeishuAppConfiguration.js.map +1 -1
  9. package/dist/cli/Initializer.js +35 -0
  10. package/dist/cli/Initializer.js.map +1 -1
  11. package/dist/cli/SelfUpdateRunner.js +552 -0
  12. package/dist/cli/SelfUpdateRunner.js.map +1 -0
  13. package/dist/cli/SelfUpdater.js +431 -0
  14. package/dist/cli/SelfUpdater.js.map +1 -0
  15. package/dist/cli/autostartOutput.js +63 -0
  16. package/dist/cli/autostartOutput.js.map +1 -0
  17. package/dist/cli/controlProtocol.js.map +1 -1
  18. package/dist/cli/help.js +94 -18
  19. package/dist/cli/help.js.map +1 -1
  20. package/dist/cli/taskGroupOptions.js +14 -11
  21. package/dist/cli/taskGroupOptions.js.map +1 -1
  22. package/dist/cli/taskListOutput.js +3 -0
  23. package/dist/cli/taskListOutput.js.map +1 -1
  24. package/dist/cli/taskTarget.js +99 -0
  25. package/dist/cli/taskTarget.js.map +1 -0
  26. package/dist/cli.js +661 -58
  27. package/dist/cli.js.map +1 -1
  28. package/dist/codex/CodexRuntime.js +8 -2
  29. package/dist/codex/CodexRuntime.js.map +1 -1
  30. package/dist/commands/CommandRouter.js +16 -1
  31. package/dist/commands/CommandRouter.js.map +1 -1
  32. package/dist/feishu/CardRenderer.js +266 -38
  33. package/dist/feishu/CardRenderer.js.map +1 -1
  34. package/dist/feishu/FeishuMarkdown.js +25 -1
  35. package/dist/feishu/FeishuMarkdown.js.map +1 -1
  36. package/dist/feishu/FeishuMessageClient.js +16 -0
  37. package/dist/feishu/FeishuMessageClient.js.map +1 -1
  38. package/dist/feishu/FeishuTurnPresenter.js +42 -6
  39. package/dist/feishu/FeishuTurnPresenter.js.map +1 -1
  40. package/dist/index.js +136 -2
  41. package/dist/index.js.map +1 -1
  42. package/dist/presentation/OutboundRouter.js +7 -0
  43. package/dist/presentation/OutboundRouter.js.map +1 -1
  44. package/dist/presentation/TurnStateReducer.js +21 -7
  45. package/dist/presentation/TurnStateReducer.js.map +1 -1
  46. package/dist/proxy/ProxySessionController.js +537 -13
  47. package/dist/proxy/ProxySessionController.js.map +1 -1
  48. package/dist/state/StateStore.js +53 -0
  49. package/dist/state/StateStore.js.map +1 -1
  50. package/docs/technical-reference.md +17 -7
  51. package/docs/technical-reference.zh.md +17 -7
  52. package/npm-shrinkwrap.json +2 -2
  53. package/package.json +2 -2
  54. package/skills/agent-bot/SKILL.md +109 -188
  55. package/src/cli/AutostartManager.ts +579 -0
  56. package/src/cli/FeishuAppConfiguration.ts +26 -7
  57. package/src/cli/Initializer.ts +57 -0
  58. package/src/cli/SelfUpdateRunner.ts +817 -0
  59. package/src/cli/SelfUpdater.ts +688 -0
  60. package/src/cli/autostartOutput.ts +75 -0
  61. package/src/cli/controlProtocol.ts +119 -1
  62. package/src/cli/help.ts +94 -18
  63. package/src/cli/taskGroupOptions.ts +27 -17
  64. package/src/cli/taskListOutput.ts +10 -0
  65. package/src/cli/taskTarget.ts +168 -0
  66. package/src/cli.ts +809 -65
  67. package/src/codex/CodexRuntime.ts +8 -2
  68. package/src/commands/CommandRouter.ts +14 -1
  69. package/src/commands/commandTypes.ts +2 -0
  70. package/src/feishu/CardRenderer.ts +313 -35
  71. package/src/feishu/FeishuMarkdown.ts +27 -1
  72. package/src/feishu/FeishuMessageClient.ts +33 -0
  73. package/src/feishu/FeishuTurnPresenter.ts +43 -6
  74. package/src/feishu/types.ts +1 -0
  75. package/src/index.ts +174 -2
  76. package/src/presentation/OutboundRouter.ts +7 -0
  77. package/src/presentation/TurnStateReducer.ts +21 -7
  78. package/src/proxy/ProxySessionController.ts +661 -16
  79. package/src/runtime/types.ts +1 -0
  80. package/src/state/StateStore.ts +56 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,24 @@ The project follows [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.1.14-alpha.3] - 2026-08-12
10
+
11
+ - Refresh elapsed time in the Feishu thinking-card header at least every three seconds, and freeze it when a turn completes or stops unexpectedly.
12
+ - Add a compact `/dismiss` confirmation card and matching `agentbot task dismiss --yes` command to archive the current task and dissolve its bot-owned Feishu group.
13
+
14
+ ## [0.1.14-alpha.2] - 2026-08-12
15
+
16
+ - Ask users during first initialization and `init --reset` whether group messages should be received automatically or require an explicit @ mention, and request `im:message.group_msg` only for the all-group-message mode.
17
+
18
+ - Add Profile-specific `agentbot server autostart enable|status|disable` support through Windows Task Scheduler, macOS LaunchAgents, and Linux systemd user units, with optional Linux lingering for startup before login and combined OS-registration and live-server status.
19
+
20
+ - Add `agentbot update` for global npm installations, with release-channel selection, candidate-package validation, safe idle shutdown, automatic non-interactive Profile initialization, an external installer, automatic npm rollback, and a complete-package service fallback; source checkouts and `npm link` installs are never modified.
21
+ - Add CLI counterparts for every Feishu command, including same-conversation task creation and forks, queues, Agent and execution settings, Goals, Turn history and Reset, group mute, directory browsing, file delivery, task-directory shell commands, task switching, and task-scoped restart requests.
22
+ - Let every `agentbot task` command automatically target the invoking Agent's current task when its task argument is omitted, while preserving positional references and adding a consistent `--task <task>` override.
23
+ - Install or refresh the managed Agent Bot Skill after every successful initialization, including the non-interactive initialization run automatically after package updates.
24
+ - Keep early Commentary visible on long grouped thinking cards, move omitted reasoning and tool activity into paginated history, and use compact head-and-tail truncation for tool commands and results.
25
+ - Preserve local file line and column references in Feishu Markdown link labels so source links remain understandable when Feishu cannot open their local targets.
26
+
9
27
  ## [0.1.14-alpha.1] - 2026-08-08
10
28
 
11
29
  - Add persistent group-level `/mute [on|off]` control so a muted group and all its topics respond only to messages that @ the current bot, filtering ordinary messages before reactions or other work.
@@ -14,7 +32,7 @@ The project follows [Semantic Versioning](https://semver.org/).
14
32
  - Keep each pending safe-restart card bound to the reason supplied by its own requesting conversation, so a later request from another chat or topic cannot overwrite the earlier card with an unrelated reason.
15
33
  - Preserve exact Feishu topic routes and message anchors through Supervisor replacement so the post-restart startup card returns to the triggering topic instead of creating a new root topic in its parent group.
16
34
  - Persist every accepted turn before starting Agent work and automatically recover tasks active during the preceding five minutes after every Worker restart, notifying the original private chat, group, or topic and continuing interrupted work with a fresh thinking card while only redelivering turns already completed remotely; older unfinished history is expired instead of resumed.
17
- - Add a grouped thinking-card layout that keeps Commentary and user steering visible, shows only the latest native reasoning per execution group, defaults execution panels to collapsed while keeping stable component identities for client-side expansion, preserves complete expandable tool results, and paginates long tasks by rendered UTF-8 size and component count instead of fixed activity or tool counts, while retaining the original `timeline` layout as a configuration fallback.
35
+ - Add a grouped thinking-card layout that keeps Commentary and user steering visible, shows only the latest native reasoning per execution group, defaults execution panels to collapsed while keeping stable component identities for client-side expansion, preserves complete expandable tool results without promoting child failures to a red or failed execution group, omits PowerShell and POSIX shell launcher prefixes from displayed commands, and paginates long tasks by rendered UTF-8 size and component count instead of fixed activity or tool counts, while retaining the original `timeline` layout as a configuration fallback.
18
36
  - Add a `/dir` file-browser card with a stable 16-row file area, Windows drive names and selection, directory navigation, distinct image and binary-file icons, clickable file delivery, and `New` / `NewGroup` actions for creating work in the selected directory.
19
37
  - Rename the `/sessions` card to `任务列表`, show five tasks per page, group tasks by project, place project-level `New` / `NewGroup` actions on each project row, and render each task as a compact bordered collapsed row with an action menu that stays well within Feishu's 200-element card limit.
20
38
  - Allow standalone Feishu topics, including replies to messages without a persisted turn binding, to show status or start a fresh task instead of failing automatic fork initialization.
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Use local Codex, TraeX, and compatible ACP agents through Feishu.
8
8
 
9
- English | [简体中文](README.zh.md)
9
+ [Website](https://keyou.github.io/agent-bot/) | English | [简体中文](README.zh.md)
10
10
 
11
11
  Agent Bot runs on your computer and connects a Feishu bot to your local coding agents. Send a message to start working; the bot updates a progress card while the agent runs and sends the final answer as Markdown.
12
12
 
@@ -53,6 +53,14 @@ agentbot --help
53
53
 
54
54
  See the [technical reference](docs/technical-reference.md#development-and-source-installation) to install from source.
55
55
 
56
+ ### Update
57
+
58
+ ```bash
59
+ agentbot update
60
+ ```
61
+
62
+ Stable installations check the stable channel by default; Alpha installations stay on the Alpha channel. Use `--stable`, `--alpha`, or `--version <version>` to choose explicitly. When the service is running, Agent Bot waits for active tasks to finish, updates, and restores the service automatically. Source checkouts and `npm link` installations are never modified by self-update.
63
+
56
64
  ### Initialize
57
65
 
58
66
  ```bash
@@ -61,18 +69,19 @@ agentbot init
61
69
 
62
70
  Initialization detects Codex and TraeX and reports their installed versions. Missing or outdated Agents are listed with the appropriate install or upgrade commands. Agent Bot saves its configuration to `~/.agent-bot/config.yaml`.
63
71
 
64
- A fresh initialization normally presents three QR-code or link steps in the terminal.
72
+ A fresh initialization first asks how group messages should be handled: receive every group message, or respond only when the bot is explicitly @ mentioned. It then presents two or three QR-code or link steps, depending on that choice.
65
73
 
66
74
  1. **Create the bot.** This creates a Feishu app with the standard basic messaging configuration and saves its App ID, App Secret, and authorizing user. This step cannot be skipped because Agent Bot cannot connect to Feishu without it. Permissions already provided during creation are not repeated below.
67
- 2. **Add the all-group-message permission.** The only additional core permission needed after bot creation is `im:message.group_msg`. It lets Agent Bot receive ordinary group messages that do not @ the bot. Feishu requires this permission to be added manually in the Developer Console. Enter `Y` to skip waiting; private chats still work without it, but group users must @ the bot.
68
- 3. **Add the remaining event and callback.** The bot-creation template already provides the other permissions Agent Bot needs. The third step adds only:
75
+ 2. **Optionally add the all-group-message permission.** This step appears only after choosing to receive all group messages. The `im:message.group_msg` permission lets Agent Bot receive ordinary group messages that do not @ the bot, and Feishu requires it to be added manually in the Developer Console. Mention-only mode does not request this permission. When this step is shown, entering `Y` skips waiting and leaves group conversations in mention-only mode.
76
+ 3. **Add the remaining permission, event, and callback.** The third step adds only:
69
77
 
70
- | Type | Event or callback | Purpose |
71
- | ---- | ----------------- | ------- |
78
+ | Type | Permission, event, or callback | Purpose |
79
+ | ---- | ------------------------------ | ------- |
80
+ | Permission | `im:chat:delete` | Let `/dismiss` dissolve a group created and owned by the bot. Without it, other Agent Bot features still work. |
72
81
  | Event | `im.chat.updated_v1` | Detect group renames and synchronize them to Agent task titles. |
73
82
  | Callback | `card.action.trigger` | Enable card button interactions. |
74
83
 
75
- After these steps, the `~/.agent-bot` directory is initialized and Agent Bot starts automatically. Every successful `agentbot init` sends a private welcome card containing the Agent Bot logo. The first card introduces the main capabilities; after an upgrade it highlights the new version, while a same-version rerun confirms that the Profile was refreshed.
84
+ After these steps, the `~/.agent-bot` directory is initialized and Agent Bot starts immediately. Every successful `agentbot init` sends a private welcome card containing the Agent Bot logo. The first card introduces the main capabilities; after an upgrade it highlights the new version, while a same-version rerun confirms that the Profile was refreshed.
76
85
 
77
86
  Agent Bot includes a keepalive mechanism that automatically reconnects after Agent Bot, Codex, or TraeX crashes.
78
87
 
@@ -105,6 +114,15 @@ agentbot server restart
105
114
 
106
115
  It waits for currently running Agent tasks to finish before restarting, allowing every task to complete normally. When triggered from a Feishu topic, both restart status and the post-restart startup card return to that topic.
107
116
 
117
+ Enable startup at the next user login:
118
+
119
+ ```bash
120
+ agentbot server autostart enable
121
+ agentbot server autostart status
122
+ ```
123
+
124
+ This creates a separate OS registration for the selected Profile: Task Scheduler on Windows, a LaunchAgent on macOS, or a systemd user unit on Linux. If Windows policy denies creating a scheduled task, Agent Bot automatically uses the current user's Startup folder instead, without requiring administrator access. Linux users who need startup before login can run `agentbot server autostart enable --linger`; this enables user lingering and may require system authorization. `server autostart disable` removes only the startup registration and leaves the currently running Server untouched. It intentionally does not disable Linux linger because other user services may depend on it.
125
+
108
126
  ### Update Or Uninstall
109
127
 
110
128
  Stop the running service before replacing or removing the global package:
@@ -118,6 +136,7 @@ agentbot init # Update the Profile and start the Server
118
136
  To uninstall:
119
137
 
120
138
  ```bash
139
+ agentbot server autostart disable
121
140
  agentbot server stop
122
141
  npm uninstall --global @keyou007/agent-bot
123
142
  ```
@@ -135,6 +154,7 @@ Create a new Profile with:
135
154
  agentbot --profile ~/.agent-bot-rescue init
136
155
  agentbot --profile ~/.agent-bot-rescue server start
137
156
  agentbot --profile ~/.agent-bot-rescue server status
157
+ agentbot --profile ~/.agent-bot-rescue server autostart enable
138
158
  ```
139
159
 
140
160
  Commands without `--profile` use the main Profile at `~/.agent-bot`.
@@ -169,15 +189,26 @@ The Console UI does not require Feishu credentials. It does not share task state
169
189
  ```bash
170
190
  agentbot task list
171
191
  agentbot task current [--json]
172
- agentbot task status <task>
173
- agentbot task prompt <task> "<prompt>"
174
- agentbot task newgroup <task> [title] [--agent <standard-name>] [--dir <path> | --nodir]
175
- agentbot task forkgroup <task> [title]
176
- agentbot task title <task> "<title>"
177
- agentbot task stop <task>
192
+ agentbot task status [task]
193
+ agentbot task prompt [task] "<prompt>"
194
+ agentbot task new [task] [title] [--agent <standard-name>] [--dir <path> | --nodir]
195
+ agentbot task newgroup [task] [title] [--agent <standard-name>] [--dir <path> | --nodir]
196
+ agentbot task fork [task]
197
+ agentbot task forkgroup [task] [title]
198
+ agentbot task queue [task] "<prompt>"
199
+ agentbot task model [task] [model]
200
+ agentbot task goal [task] [action-or-objective]
201
+ agentbot task turns [task]
202
+ agentbot task reset [task] <Turn ID>
203
+ agentbot task dir [task] [directory]
204
+ agentbot task file [task] <path>
205
+ agentbot task title [task] "<title>"
206
+ agentbot task stop [task]
207
+ agentbot task archive [task]
208
+ agentbot task dismiss [task] --yes
178
209
  ```
179
210
 
180
- `task current` shows details for the Codex or TraeX task currently invoking the CLI. Its JSON output includes Agent Bot's `localSessionId` and the native `remoteSessionId`. `<task>` can be a number from `task list`, a task ID, or an unambiguous task-ID prefix. Run `agentbot --help` for all CLI options.
211
+ Inside an Agent started by Agent Bot, `[task]` defaults to the current task; use `--task <task>` to target another task explicitly. A regular terminal must supply a task. `task current` shows the automatically detected task details. A task reference can be a number from `task list`, a task ID, or an unambiguous task-ID prefix. Every Feishu task, fork, queue, Agent, Provider, model, thinking, permission, Goal, historical Turn, Reset, group mute, group dismissal, directory, file, shell, and restart operation has a CLI counterpart. Run `agentbot --help` for the complete list and options.
181
212
 
182
213
  `task newgroup` creates a Feishu group and a new task. By default, it inherits the source task's Agent and execution settings. `--agent <standard-name>` selects another configured Agent; the source project shape is still inherited, while Provider, model, reasoning effort, and permission mode use the target Agent's own Runtime defaults. `--dir` overrides the project directory and supports `~`; `--nodir` forces a Projectless App Server task. `task forkgroup` forks from the source task's latest available completed turn without interrupting an active turn. Both commands require the Server to be running, invite the authorizing user saved in the Profile, leave the source conversation on its current task, and support `--json`.
183
214
 
@@ -190,6 +221,8 @@ Send a message beginning with `/` to run a command. Use `/help` in Feishu for th
190
221
  | `/new [title] [--dir <path> \| --nodir]` | Start a new task |
191
222
  | `/dir [path]` | Browse files or start work in a directory |
192
223
  | `/sessions [keyword]` | Find and manage tasks |
224
+ | `/archive [task]` | Archive the current or selected task |
225
+ | `/dismiss` | Archive the current task and dissolve the group after confirmation |
193
226
  | `/switch [task]` | Switch tasks or return to the previous task |
194
227
  | `/fork [task]` | Branch a task |
195
228
  | `/turns` | Restore an earlier conversation turn |
@@ -243,7 +276,7 @@ By default, `feishu.respondToOwnerOnly: true` accepts only messages and card act
243
276
 
244
277
  Agent Bot responds to ordinary owner messages in groups containing the bot. Set `feishu.respondToAllGroupMessages` to `false` to additionally require the owner to @ the bot in groups; private chats are unchanged. Initialization still requests the complete group-message permission set so changing this option later does not require another authorization.
245
278
 
246
- Thinking cards use the grouped layout by default: auxiliary Commentary and user steering remain visible, while each execution group shows only its latest native reasoning and expands to reveal complete tool commands and results. Execution groups start collapsed and keep stable component identities so a group manually opened in Feishu stays open across card updates. On long turns, pagination measures the fully rendered card content instead of using fixed message or tool counts. Set `feishu.thinkingCardLayout` to `timeline` to temporarily restore the original layout.
279
+ Thinking cards use the grouped layout by default: auxiliary Commentary and user steering remain visible, while each execution group shows only its latest native reasoning and expands to reveal complete tool commands and results. Common PowerShell, zsh, bash, and sh launcher prefixes are omitted from the displayed commands. A failed tool remains marked inside its own tool panel but does not turn the complete execution group red or give the group a failure icon. Execution groups start collapsed and keep stable component identities so a group manually opened in Feishu stays open across card updates. On long turns, pagination measures the fully rendered card content instead of using fixed message or tool counts. Set `feishu.thinkingCardLayout` to `timeline` to temporarily restore the original layout.
247
280
 
248
281
  ## Troubleshooting
249
282
 
package/README.zh.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  通过飞书使用本机上的 Codex、TraeX 和兼容 ACP 的 Agent。
8
8
 
9
- [English](README.md) | 简体中文
9
+ [项目主页](https://keyou.github.io/agent-bot/) | [English](README.md) | 简体中文
10
10
 
11
11
  Agent Bot 运行在你的电脑上,把飞书机器人连接到本机编程 Agent。发送消息即可开始工作;执行过程中机器人会更新进度卡,完成后发送 Markdown 最终回答。
12
12
 
@@ -53,6 +53,14 @@ agentbot --help
53
53
 
54
54
  从源码安装的方法见[技术参考](docs/technical-reference.zh.md#开发与源码安装)。
55
55
 
56
+ ### 更新
57
+
58
+ ```bash
59
+ agentbot update
60
+ ```
61
+
62
+ 正式版默认检查稳定通道,Alpha 版默认检查 Alpha 通道。也可以使用 `--stable`、`--alpha` 或 `--version <版本>` 明确选择。服务正在运行时,Agent Bot 会等待当前任务完成后更新并自动恢复服务;源码目录和 `npm link` 安装不会被自更新命令修改。
63
+
56
64
  ### 初始化
57
65
 
58
66
  ```bash
@@ -61,18 +69,19 @@ agentbot init
61
69
 
62
70
  初始化会检测 Codex 和 TraeX,并显示已安装的版本。未安装或版本较旧的 Agent 会汇总显示对应的安装或升级命令。Agent Bot 会把配置保存到 `~/.agent-bot/config.yaml` 中。
63
71
 
64
- 全新的初始化,终端通常会依次显示 3 轮二维码或链接。
72
+ 全新的初始化会先询问群消息响应方式:接收所有群消息,或者只有明确 @ 机器人才接收。根据选择不同,终端随后会显示 2 或 3 轮二维码或链接。
65
73
 
66
74
  1. **创建机器人。** 创建带有标准基础消息配置的飞书应用,并保存 App ID、App Secret 和授权用户。该步骤不能跳过,否则 Agent Bot 无法连接飞书。创建时已经提供的权限不再在下方重复列出。
67
- 2. **添加“接收所有群消息”权限。** 创建机器人后唯一需要额外处理的核心权限是 `im:message.group_msg`,用于接收未 @ 机器人的普通群消息。飞书要求用户在开发者后台手动添加该权限。可以输入 `Y` 跳过等待;缺少该权限时,私聊仍然可用,但群成员必须 @ 机器人才会响应。
68
- 3. **补充剩余事件和回调。** 创建机器人时使用的模板已经提供 Agent Bot 所需的其他权限,第三步实际只新增:
75
+ 2. **按需添加“接收所有群消息”权限。** 只有选择“接收所有群消息”时才会出现这一步。`im:message.group_msg` 用于接收未 @ 机器人的普通群消息,飞书要求用户在开发者后台手动添加。选择“明确 @ 机器人”时不会申请该权限;出现本步骤后输入 `Y` 跳过等待,也会保持仅 @ 响应。
76
+ 3. **补充剩余权限、事件和回调。** 第三步实际只新增:
69
77
 
70
- | 类型 | 事件或回调 | 功能 |
71
- | ---- | ---------- | ------------------ |
78
+ | 类型 | 权限、事件或回调 | 功能 |
79
+ | ---- | ---------------- | ------------------ |
80
+ | 权限 | `im:chat:delete` | 允许 `/dismiss` 解散由机器人创建并担任群主的群;缺失时不影响其他功能。 |
72
81
  | 事件 | `im.chat.updated_v1` | 检测群改名,把群名同步到 agent 任务标题。 |
73
82
  | 回调 | `card.action.trigger` | 卡片按钮交互。 |
74
83
 
75
- 完成这些步骤后,即完成了 `~/.agent-bot` 目录的初始化,Agent Bot 会自动启动。每次 `agentbot init` 成功后,机器人都会向授权用户私聊发送一张包含 Agent Bot Logo 的欢迎卡片:首次初始化会介绍主要能力,升级后初始化会展示新版亮点,同版本再次初始化则会确认 Profile 已刷新。
84
+ 完成这些步骤后,即完成了 `~/.agent-bot` 目录的初始化,Agent Bot 会立即启动。每次 `agentbot init` 成功后,机器人都会向授权用户私聊发送一张包含 Agent Bot Logo 的欢迎卡片:首次初始化会介绍主要能力,升级后初始化会展示新版亮点,同版本再次初始化则会确认 Profile 已刷新。
76
85
 
77
86
  Agent Bot 自带保活机制,确保在 Agent Bot,Codex 或 TraeX 崩溃后能够自动重新连接。
78
87
 
@@ -105,6 +114,15 @@ agentbot server restart
105
114
 
106
115
  它会等待当前运行中的 Agent 任务完成后自动重启,确保所有任务都能正常执行。在飞书话题中触发时,重启状态和重启后的启动卡都会返回原话题。
107
116
 
117
+ 启用下次用户登录时自动启动:
118
+
119
+ ```bash
120
+ agentbot server autostart enable
121
+ agentbot server autostart status
122
+ ```
123
+
124
+ 每个 Profile 都会创建独立的操作系统启动项:Windows 使用任务计划程序,macOS 使用 LaunchAgent,Linux 使用 systemd 用户单元。如果 Windows 策略拒绝创建计划任务,Agent Bot 会自动改用当前用户的启动文件夹,无需管理员权限。Linux 如需在用户尚未登录时启动,可执行 `agentbot server autostart enable --linger`;该命令会启用用户 linger,可能需要系统授权。`server autostart disable` 只移除启动项,不停止当前正在运行的 Server;它也不会关闭 Linux linger,因为其他用户服务可能依赖 linger。
125
+
108
126
  ### 更新或卸载
109
127
 
110
128
  替换或移除全局包前,先停止正在运行的服务:
@@ -118,6 +136,7 @@ agentbot init # 更新 Profile 并启动 Server
118
136
  卸载:
119
137
 
120
138
  ```bash
139
+ agentbot server autostart disable
121
140
  agentbot server stop
122
141
  npm uninstall --global @keyou007/agent-bot
123
142
  ```
@@ -135,6 +154,7 @@ npm uninstall --global @keyou007/agent-bot
135
154
  agentbot --profile ~/.agent-bot-rescue init
136
155
  agentbot --profile ~/.agent-bot-rescue server start
137
156
  agentbot --profile ~/.agent-bot-rescue server status
157
+ agentbot --profile ~/.agent-bot-rescue server autostart enable
138
158
  ```
139
159
 
140
160
  不指定 `--profile` 时使用位于 `~/.agent-bot` 的主 Profile。
@@ -169,15 +189,26 @@ Console UI 不需要飞书凭据。除非传入 `--force`,否则不会与正
169
189
  ```bash
170
190
  agentbot task list
171
191
  agentbot task current [--json]
172
- agentbot task status <任务>
173
- agentbot task prompt <任务> "<prompt>"
174
- agentbot task newgroup <任务> [标题] [--agent <标准名>] [--dir <路径> | --nodir]
175
- agentbot task forkgroup <任务> [标题]
176
- agentbot task title <任务> "<标题>"
177
- agentbot task stop <任务>
192
+ agentbot task status [任务]
193
+ agentbot task prompt [任务] "<prompt>"
194
+ agentbot task new [任务] [标题] [--agent <标准名>] [--dir <路径> | --nodir]
195
+ agentbot task newgroup [任务] [标题] [--agent <标准名>] [--dir <路径> | --nodir]
196
+ agentbot task fork [任务]
197
+ agentbot task forkgroup [任务] [标题]
198
+ agentbot task queue [任务] "<prompt>"
199
+ agentbot task model [任务] [模型]
200
+ agentbot task goal [任务] [操作或目标]
201
+ agentbot task turns [任务]
202
+ agentbot task reset [任务] <Turn ID>
203
+ agentbot task dir [任务] [目录]
204
+ agentbot task file [任务] <路径>
205
+ agentbot task title [任务] "<标题>"
206
+ agentbot task stop [任务]
207
+ agentbot task archive [任务]
208
+ agentbot task dismiss [任务] --yes
178
209
  ```
179
210
 
180
- `task current` 会显示当前调用 CLI 的 Codex 或 TraeX 任务详情;JSON 输出包含 Agent Bot 的 `localSessionId` 和原生 `remoteSessionId`。`<任务>` 可以是 `task list` 中的序号、任务 ID 或唯一的任务 ID 前缀。运行 `agentbot --help` 可查看完整 CLI 参数。
211
+ 在 Agent Bot 启动的 Agent 中,省略 `[任务]` 会自动使用当前任务;需要操作其他任务时可传入 `--task <任务>`。普通终端仍必须指定任务。`task current` 用于查看自动识别出的任务详情。任务引用可以是 `task list` 中的序号、任务 ID 或唯一的任务 ID 前缀。飞书中的任务、分支、排队、Agent、Provider、模型、思考强度、权限、Goal、历史 Turn、Reset、群静音、解散群、目录、文件、Shell 和重启能力都有对应的 CLI 命令;运行 `agentbot --help` 查看完整列表和参数。
181
212
 
182
213
  `task newgroup` 会创建飞书群和新任务。默认继承源任务的 Agent 和运行设置;`--agent <标准名>` 可选择另一个已配置的 Agent,此时仍继承源任务的项目形态,但 Provider、模型、思考强度和权限模式使用目标 Agent 自己的 Runtime 默认值。`--dir` 可覆盖项目目录并支持 `~`,`--nodir` 会强制创建 Projectless App Server 任务。`task forkgroup` 从源任务最新可用的已完成 turn 创建分支,不会中断正在执行的 turn。两个命令都要求 Server 正在运行,邀请 Profile 中保存的授权用户,不会切换源会话的当前任务,并支持 `--json`。
183
214
 
@@ -190,6 +221,8 @@ agentbot task stop <任务>
190
221
  | `/new [标题] [--dir <路径> \| --nodir]` | 开始新任务 |
191
222
  | `/dir [路径]` | 浏览文件,或在指定目录开始任务 |
192
223
  | `/sessions [关键词]` | 查找和管理任务 |
224
+ | `/archive [任务]` | 归档当前或指定任务 |
225
+ | `/dismiss` | 确认后归档当前任务并解散群聊 |
193
226
  | `/switch [任务]` | 切换任务,或返回上一个任务 |
194
227
  | `/fork [任务]` | 创建任务分支 |
195
228
  | `/turns` | 恢复到更早的对话轮次 |
@@ -243,7 +276,7 @@ Agent 进程会继承普通父进程变量及其显式配置的 `agents.<name>.e
243
276
 
244
277
  Agent Bot 会响应机器人所在群内拥有者发送的普通消息。将 `feishu.respondToAllGroupMessages` 设为 `false` 后,还会要求拥有者在群消息中 @ 当前机器人;私聊不受这一项影响。初始化仍会申请完整的群消息权限,因此以后切换该配置无需重新授权。
245
278
 
246
- 思考卡片默认使用分组布局:辅助 Commentary 和用户追加消息保持直接显示,每个执行组只显示最新一段原生思考,点击后可展开完整的工具命令和结果。执行组默认折叠,并使用稳定的组件标识,使用户在飞书中手动打开的面板在卡片更新后继续保持展开。长任务会根据完整渲染后的卡片内容大小翻页,不再使用固定的消息数或工具数。将 `feishu.thinkingCardLayout` 设为 `timeline` 可临时恢复原版布局。
279
+ 思考卡片默认使用分组布局:辅助 Commentary 和用户追加消息保持直接显示,每个执行组只显示最新一段原生思考,点击后可展开完整的工具命令和结果。显示命令时会省略常见的 PowerShell、zsh、bash 和 sh 启动包装前缀。失败工具仍会在自己的工具面板中标记,但不会让整个执行组显示失败图标或红色边框。执行组默认折叠,并使用稳定的组件标识,使用户在飞书中手动打开的面板在卡片更新后继续保持展开。长任务会根据完整渲染后的卡片内容大小翻页,不再使用固定的消息数或工具数。将 `feishu.thinkingCardLayout` 设为 `timeline` 可临时恢复原版布局。
247
280
 
248
281
  ## 常见问题
249
282
 
@@ -4,7 +4,7 @@ feishu:
4
4
  userOpenId: "${FEISHU_USER_OPEN_ID}"
5
5
  # Set to false to accept messages and card actions from users other than the bot owner.
6
6
  respondToOwnerOnly: true
7
- # Set to false to require an @ mention before processing group messages.
7
+ # Fresh init and init --reset ask whether group messages require an @ mention.
8
8
  respondToAllGroupMessages: true
9
9
  # Use "timeline" to temporarily restore the original thinking-card layout.
10
10
  thinkingCardLayout: "grouped"