@keyou007/agent-bot 0.1.14-alpha.0 → 0.1.14-alpha.2
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 +26 -0
- package/README.md +82 -55
- package/README.zh.md +82 -55
- package/config.example.yaml +5 -1
- package/dist/cli/AutostartManager.js +431 -0
- package/dist/cli/AutostartManager.js.map +1 -0
- package/dist/cli/FeishuAppConfiguration.js +17 -13
- package/dist/cli/FeishuAppConfiguration.js.map +1 -1
- package/dist/cli/Initializer.js +35 -0
- package/dist/cli/Initializer.js.map +1 -1
- package/dist/cli/SelfUpdateRunner.js +552 -0
- package/dist/cli/SelfUpdateRunner.js.map +1 -0
- package/dist/cli/SelfUpdater.js +431 -0
- package/dist/cli/SelfUpdater.js.map +1 -0
- package/dist/cli/autostartOutput.js +63 -0
- package/dist/cli/autostartOutput.js.map +1 -0
- package/dist/cli/controlProtocol.js.map +1 -1
- package/dist/cli/help.js +92 -18
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/taskGroupOptions.js +14 -11
- package/dist/cli/taskGroupOptions.js.map +1 -1
- package/dist/cli/taskListOutput.js +3 -0
- package/dist/cli/taskListOutput.js.map +1 -1
- package/dist/cli/taskTarget.js +99 -0
- package/dist/cli/taskTarget.js.map +1 -0
- package/dist/cli.js +643 -58
- package/dist/cli.js.map +1 -1
- package/dist/codex/CodexRuntime.js +16 -5
- package/dist/codex/CodexRuntime.js.map +1 -1
- package/dist/commands/CommandRouter.js +20 -1
- package/dist/commands/CommandRouter.js.map +1 -1
- package/dist/config/loadConfig.js +2 -0
- package/dist/config/loadConfig.js.map +1 -1
- package/dist/config/schema.js +2 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/console/ConsoleTurnPresenter.js +2 -0
- package/dist/console/ConsoleTurnPresenter.js.map +1 -1
- package/dist/feishu/CardRenderer.js +584 -16
- package/dist/feishu/CardRenderer.js.map +1 -1
- package/dist/feishu/FeishuConnector.js +29 -8
- package/dist/feishu/FeishuConnector.js.map +1 -1
- package/dist/feishu/FeishuMarkdown.js +25 -1
- package/dist/feishu/FeishuMarkdown.js.map +1 -1
- package/dist/feishu/FeishuMessageClient.js +43 -0
- package/dist/feishu/FeishuMessageClient.js.map +1 -1
- package/dist/feishu/FeishuTurnPresenter.js +29 -1
- package/dist/feishu/FeishuTurnPresenter.js.map +1 -1
- package/dist/feishu/ownerAccess.js +7 -0
- package/dist/feishu/ownerAccess.js.map +1 -0
- package/dist/index.js +148 -19
- package/dist/index.js.map +1 -1
- package/dist/presentation/OutboundRouter.js +19 -1
- package/dist/presentation/OutboundRouter.js.map +1 -1
- package/dist/proxy/ProxySessionController.js +1444 -66
- package/dist/proxy/ProxySessionController.js.map +1 -1
- package/dist/startup/StartupNotifier.js +65 -16
- package/dist/startup/StartupNotifier.js.map +1 -1
- package/dist/startup/startFeishu.js +2 -2
- package/dist/startup/startFeishu.js.map +1 -1
- package/dist/state/StateStore.js +268 -67
- package/dist/state/StateStore.js.map +1 -1
- package/dist/state/migrations.js +26 -0
- package/dist/state/migrations.js.map +1 -1
- package/dist/supervision/SafeRestartNotifier.js +17 -16
- package/dist/supervision/SafeRestartNotifier.js.map +1 -1
- package/dist/supervision/SafeRestartScheduler.js +12 -7
- package/dist/supervision/SafeRestartScheduler.js.map +1 -1
- package/dist/supervision/replacementSupervisor.js +45 -4
- package/dist/supervision/replacementSupervisor.js.map +1 -1
- package/dist/supervisor.js +30 -18
- package/dist/supervisor.js.map +1 -1
- package/docs/technical-reference.md +33 -10
- package/docs/technical-reference.zh.md +33 -10
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
- package/skills/agent-bot/SKILL.md +107 -182
- package/src/cli/AutostartManager.ts +579 -0
- package/src/cli/FeishuAppConfiguration.ts +22 -7
- package/src/cli/Initializer.ts +57 -0
- package/src/cli/SelfUpdateRunner.ts +817 -0
- package/src/cli/SelfUpdater.ts +688 -0
- package/src/cli/autostartOutput.ts +75 -0
- package/src/cli/controlProtocol.ts +111 -1
- package/src/cli/help.ts +92 -18
- package/src/cli/taskGroupOptions.ts +27 -17
- package/src/cli/taskListOutput.ts +10 -0
- package/src/cli/taskTarget.ts +168 -0
- package/src/cli.ts +781 -65
- package/src/codex/CodexRuntime.ts +17 -5
- package/src/commands/CommandRouter.ts +19 -1
- package/src/commands/commandTypes.ts +3 -0
- package/src/config/loadConfig.ts +2 -0
- package/src/config/schema.ts +2 -0
- package/src/console/ConsoleTurnPresenter.ts +4 -1
- package/src/feishu/CardRenderer.ts +716 -16
- package/src/feishu/FeishuConnector.ts +44 -10
- package/src/feishu/FeishuMarkdown.ts +27 -1
- package/src/feishu/FeishuMessageClient.ts +58 -0
- package/src/feishu/FeishuTurnPresenter.ts +35 -2
- package/src/feishu/ownerAccess.ts +7 -0
- package/src/feishu/types.ts +7 -0
- package/src/index.ts +192 -22
- package/src/presentation/OutboundRouter.ts +28 -3
- package/src/proxy/ProxySessionController.ts +1707 -70
- package/src/runtime/types.ts +1 -0
- package/src/startup/StartupNotifier.ts +67 -17
- package/src/startup/startFeishu.ts +5 -3
- package/src/state/StateStore.ts +413 -65
- package/src/state/migrations.ts +26 -0
- package/src/supervision/SafeRestartNotifier.ts +17 -17
- package/src/supervision/SafeRestartScheduler.ts +13 -6
- package/src/supervision/replacementSupervisor.ts +50 -4
- package/src/supervisor.ts +35 -16
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,32 @@ The project follows [Semantic Versioning](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.1.14-alpha.2] - 2026-08-12
|
|
10
|
+
|
|
11
|
+
- 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.
|
|
12
|
+
|
|
13
|
+
- 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.
|
|
14
|
+
|
|
15
|
+
- 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.
|
|
16
|
+
- 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.
|
|
17
|
+
- 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.
|
|
18
|
+
- Install or refresh the managed Agent Bot Skill after every successful initialization, including the non-interactive initialization run automatically after package updates.
|
|
19
|
+
- 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.
|
|
20
|
+
- Preserve local file line and column references in Feishu Markdown link labels so source links remain understandable when Feishu cannot open their local targets.
|
|
21
|
+
|
|
22
|
+
## [0.1.14-alpha.1] - 2026-08-08
|
|
23
|
+
|
|
24
|
+
- 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.
|
|
25
|
+
- Add `feishu.respondToOwnerOnly`, enabled by default, to ignore non-owner Feishu messages and card actions before processing acknowledgements, reactions, downloads, commands, or Agent work.
|
|
26
|
+
- Automatically retry transient LLM turn failures up to three times in the same task, with a fresh thinking card for each retry and persisted retry counts and message-reaction bindings across Worker restarts; permanent request failures remain terminal immediately.
|
|
27
|
+
- 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.
|
|
28
|
+
- 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.
|
|
29
|
+
- 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.
|
|
30
|
+
- 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.
|
|
31
|
+
- 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.
|
|
32
|
+
- 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.
|
|
33
|
+
- 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.
|
|
34
|
+
|
|
9
35
|
## [0.1.14-alpha.0] - 2026-08-07
|
|
10
36
|
|
|
11
37
|
- Split table-heavy final answers across multiple Feishu cards so the platform's per-card table limit cannot suppress a completed task result.
|
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
|
|
|
@@ -17,6 +17,7 @@ Agent Bot runs on your computer and connects a Feishu bot to your local coding a
|
|
|
17
17
|
- Reset the current conversation from any successfully completed progress card
|
|
18
18
|
- Collaborate with text, images, group chats, and topics
|
|
19
19
|
- Queue follow-up Prompts or add instructions while a task is running
|
|
20
|
+
- Automatically retry temporary model-service failures
|
|
20
21
|
- Continue existing work after Agent Bot restarts
|
|
21
22
|
- Run through the local Console UI without Feishu
|
|
22
23
|
|
|
@@ -52,6 +53,14 @@ agentbot --help
|
|
|
52
53
|
|
|
53
54
|
See the [technical reference](docs/technical-reference.md#development-and-source-installation) to install from source.
|
|
54
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
|
+
|
|
55
64
|
### Initialize
|
|
56
65
|
|
|
57
66
|
```bash
|
|
@@ -60,10 +69,10 @@ agentbot init
|
|
|
60
69
|
|
|
61
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`.
|
|
62
71
|
|
|
63
|
-
A fresh initialization
|
|
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.
|
|
64
73
|
|
|
65
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.
|
|
66
|
-
2. **
|
|
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.
|
|
67
76
|
3. **Add the remaining event and callback.** The bot-creation template already provides the other permissions Agent Bot needs. The third step adds only:
|
|
68
77
|
|
|
69
78
|
| Type | Event or callback | Purpose |
|
|
@@ -71,7 +80,7 @@ A fresh initialization normally presents three QR-code or link steps in the term
|
|
|
71
80
|
| Event | `im.chat.updated_v1` | Detect group renames and synchronize them to Agent task titles. |
|
|
72
81
|
| Callback | `card.action.trigger` | Enable card button interactions. |
|
|
73
82
|
|
|
74
|
-
After these steps, the `~/.agent-bot` directory is initialized and Agent Bot starts
|
|
83
|
+
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.
|
|
75
84
|
|
|
76
85
|
Agent Bot includes a keepalive mechanism that automatically reconnects after Agent Bot, Codex, or TraeX crashes.
|
|
77
86
|
|
|
@@ -102,7 +111,16 @@ Safely restart the service:
|
|
|
102
111
|
agentbot server restart
|
|
103
112
|
```
|
|
104
113
|
|
|
105
|
-
It waits for currently running Agent tasks to finish before restarting, allowing every task to complete normally.
|
|
114
|
+
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.
|
|
115
|
+
|
|
116
|
+
Enable startup at the next user login:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
agentbot server autostart enable
|
|
120
|
+
agentbot server autostart status
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
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.
|
|
106
124
|
|
|
107
125
|
### Update Or Uninstall
|
|
108
126
|
|
|
@@ -117,6 +135,7 @@ agentbot init # Update the Profile and start the Server
|
|
|
117
135
|
To uninstall:
|
|
118
136
|
|
|
119
137
|
```bash
|
|
138
|
+
agentbot server autostart disable
|
|
120
139
|
agentbot server stop
|
|
121
140
|
npm uninstall --global @keyou007/agent-bot
|
|
122
141
|
```
|
|
@@ -134,6 +153,7 @@ Create a new Profile with:
|
|
|
134
153
|
agentbot --profile ~/.agent-bot-rescue init
|
|
135
154
|
agentbot --profile ~/.agent-bot-rescue server start
|
|
136
155
|
agentbot --profile ~/.agent-bot-rescue server status
|
|
156
|
+
agentbot --profile ~/.agent-bot-rescue server autostart enable
|
|
137
157
|
```
|
|
138
158
|
|
|
139
159
|
Commands without `--profile` use the main Profile at `~/.agent-bot`.
|
|
@@ -168,62 +188,65 @@ The Console UI does not require Feishu credentials. It does not share task state
|
|
|
168
188
|
```bash
|
|
169
189
|
agentbot task list
|
|
170
190
|
agentbot task current [--json]
|
|
171
|
-
agentbot task status
|
|
172
|
-
agentbot task prompt
|
|
173
|
-
agentbot task
|
|
174
|
-
agentbot task
|
|
175
|
-
agentbot task
|
|
176
|
-
agentbot task
|
|
191
|
+
agentbot task status [task]
|
|
192
|
+
agentbot task prompt [task] "<prompt>"
|
|
193
|
+
agentbot task new [task] [title] [--agent <standard-name>] [--dir <path> | --nodir]
|
|
194
|
+
agentbot task newgroup [task] [title] [--agent <standard-name>] [--dir <path> | --nodir]
|
|
195
|
+
agentbot task fork [task]
|
|
196
|
+
agentbot task forkgroup [task] [title]
|
|
197
|
+
agentbot task queue [task] "<prompt>"
|
|
198
|
+
agentbot task model [task] [model]
|
|
199
|
+
agentbot task goal [task] [action-or-objective]
|
|
200
|
+
agentbot task turns [task]
|
|
201
|
+
agentbot task reset [task] <Turn ID>
|
|
202
|
+
agentbot task dir [task] [directory]
|
|
203
|
+
agentbot task file [task] <path>
|
|
204
|
+
agentbot task title [task] "<title>"
|
|
205
|
+
agentbot task stop [task]
|
|
206
|
+
agentbot task archive [task]
|
|
177
207
|
```
|
|
178
208
|
|
|
179
|
-
`task
|
|
209
|
+
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, directory, file, shell, and restart operation has a CLI counterpart. Run `agentbot --help` for the complete list and options.
|
|
180
210
|
|
|
181
211
|
`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`.
|
|
182
212
|
|
|
183
213
|
## Feishu Commands
|
|
184
214
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
| Command
|
|
188
|
-
|
|
|
189
|
-
| `/new [title] [--dir <path> \| --nodir]`
|
|
190
|
-
| `/
|
|
191
|
-
| `/
|
|
192
|
-
| `/
|
|
193
|
-
| `/
|
|
194
|
-
| `/
|
|
195
|
-
| `/
|
|
196
|
-
| `/
|
|
197
|
-
| `/
|
|
198
|
-
| `/
|
|
199
|
-
| `/
|
|
200
|
-
| `/
|
|
201
|
-
| `/
|
|
202
|
-
| `/
|
|
203
|
-
| `/
|
|
204
|
-
| `/
|
|
205
|
-
| `/
|
|
206
|
-
| `/agent [name]`
|
|
207
|
-
| `/
|
|
208
|
-
| `/
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
After `/forkgroup` creates a new group, its welcome message shows the forked task's current Provider, model, reasoning effort, and permission type.
|
|
221
|
-
|
|
222
|
-
`/new` and `/newgroup` support the same project options. Use `--dir <cwd>` to override the inherited project directory, or `--nodir` to force a Projectless App Server task; the two options cannot be combined. In both commands, `~`, `~/...`, and `~\...` represent the current user's home directory. `/newgroup` immediately creates and binds the task in the new group while continuing to inherit the current task's Provider, model, reasoning effort, and permission mode without affecting the source task. If the source chat has no current task, Agent Bot uses the selected Agent and its Runtime defaults. An explicit title becomes both the group-name suffix and the task title.
|
|
223
|
-
|
|
224
|
-
When `/newgroup` omits the title, the task title and the title portion of the group name both use `新任务 (mm-dd)`, producing `[agent] [project dir] 新任务 (mm-dd)`. Projectless groups omit the project segment entirely and use `[agent] title`. When `/forkgroup` omits the title, its task and group name use the same persistent `source title(分支 N)` sequence as `/fork`, without a date suffix. Feishu group names created by `/newgroup` and `/forkgroup` display at most 60 characters. If the generated name is too long, Agent Bot truncates only the title portion of the group name; the task title itself remains unchanged.
|
|
225
|
-
|
|
226
|
-
Renaming a bound group to `[agent] [project dir] title` synchronizes only `title` to the current task. The Agent and project-directory prefixes remain group metadata and are never included in the task title. The older `[agent] title` format remains supported.
|
|
215
|
+
Send a message beginning with `/` to run a command. Use `/help` in Feishu for the latest command list.
|
|
216
|
+
|
|
217
|
+
| Command | Purpose |
|
|
218
|
+
| --------------------------------------------- | ------------------------------------ |
|
|
219
|
+
| `/new [title] [--dir <path> \| --nodir]` | Start a new task |
|
|
220
|
+
| `/dir [path]` | Browse files or start work in a directory |
|
|
221
|
+
| `/sessions [keyword]` | Find and manage tasks |
|
|
222
|
+
| `/archive [task]` | Archive the current or selected task |
|
|
223
|
+
| `/switch [task]` | Switch tasks or return to the previous task |
|
|
224
|
+
| `/fork [task]` | Branch a task |
|
|
225
|
+
| `/turns` | Restore an earlier conversation turn |
|
|
226
|
+
| `/status [task]` | View task status |
|
|
227
|
+
| `/title <title>` | Rename the current task |
|
|
228
|
+
| `/stop` | Stop the current execution |
|
|
229
|
+
| `/queue <prompt>` | Run a Prompt after the current turn |
|
|
230
|
+
| `/nosteer <prompt>` | Same as `/queue` |
|
|
231
|
+
| `/goal [objective]` | Manage a long-running objective |
|
|
232
|
+
| `/provider` | Choose a Provider |
|
|
233
|
+
| `/model` | Choose a model |
|
|
234
|
+
| `/thinking` | Set reasoning effort |
|
|
235
|
+
| `/permissions` | Set execution permissions |
|
|
236
|
+
| `/agent [name]` | Choose the Agent for new tasks |
|
|
237
|
+
| `/newgroup [title] [--dir <path> \| --nodir]` | Start a task in a new private group |
|
|
238
|
+
| `/forkgroup [title]` | Branch a task into a new private group |
|
|
239
|
+
| `/restart [--force]` | Restart safely, or interrupt with `--force` |
|
|
240
|
+
| `/mute [on\|off]` | Require @ mentions in the current group |
|
|
241
|
+
| `/help` | Show command help |
|
|
242
|
+
|
|
243
|
+
Private chats, group timelines, and topics keep separate current tasks. Ordinary messages sent while a task is running add instructions to that turn; use `/queue` when the message should run afterward as a separate turn.
|
|
244
|
+
|
|
245
|
+
In a group, `/mute` and `/mute on` make the bot process only messages that mention it. Mention the bot and send `/mute off` to restore automatic responses. The setting applies to every topic in that group.
|
|
246
|
+
|
|
247
|
+
`/new` and `/newgroup` inherit the current Agent, project, and execution settings. Use `--dir` to choose another directory or `--nodir` to start without a project directory; `~` represents your home directory.
|
|
248
|
+
|
|
249
|
+
`/fork` and `/forkgroup` branch from completed work without interrupting a running turn. `/sessions` manages tasks across projects, while `/turns` restores conversation context without reverting local files.
|
|
227
250
|
|
|
228
251
|
## Local Commands
|
|
229
252
|
|
|
@@ -246,7 +269,11 @@ Set `AGENT_BOT_HOME` to use another user-data directory. See [config.example.yam
|
|
|
246
269
|
|
|
247
270
|
Agent processes inherit ordinary parent-process variables and their explicit `agents.<name>.env` settings. Before starting an Agent, Agent Bot removes inherited `FEISHU_*` credentials and internal `AGENT_BOT_*` state, then provides only namespaced, non-secret Profile and Lark identity context. `FEISHU_APP_SECRET` is never forwarded to an Agent process.
|
|
248
271
|
|
|
249
|
-
By default,
|
|
272
|
+
By default, `feishu.respondToOwnerOnly: true` accepts only messages and card actions from the bot owner identified by `feishu.userOpenId`; other users are ignored before any processing reaction is added. Set it to `false` to allow collaborators. When enabled without an owner Open ID, all Feishu user input is ignored until the owner is configured.
|
|
273
|
+
|
|
274
|
+
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.
|
|
275
|
+
|
|
276
|
+
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.
|
|
250
277
|
|
|
251
278
|
## Troubleshooting
|
|
252
279
|
|
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
|
|
|
@@ -17,6 +17,7 @@ Agent Bot 运行在你的电脑上,把飞书机器人连接到本机编程 Age
|
|
|
17
17
|
- 从任意成功完成的思考卡片重置当前对话
|
|
18
18
|
- 使用文字、图片、群聊和话题协作
|
|
19
19
|
- 排队后续 Prompt,或在任务运行中追加指令
|
|
20
|
+
- 模型服务临时失败时自动重试
|
|
20
21
|
- Agent Bot 重启后继续已有工作
|
|
21
22
|
- 不使用飞书时通过本地 Console UI 运行
|
|
22
23
|
|
|
@@ -52,6 +53,14 @@ agentbot --help
|
|
|
52
53
|
|
|
53
54
|
从源码安装的方法见[技术参考](docs/technical-reference.zh.md#开发与源码安装)。
|
|
54
55
|
|
|
56
|
+
### 更新
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
agentbot update
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
正式版默认检查稳定通道,Alpha 版默认检查 Alpha 通道。也可以使用 `--stable`、`--alpha` 或 `--version <版本>` 明确选择。服务正在运行时,Agent Bot 会等待当前任务完成后更新并自动恢复服务;源码目录和 `npm link` 安装不会被自更新命令修改。
|
|
63
|
+
|
|
55
64
|
### 初始化
|
|
56
65
|
|
|
57
66
|
```bash
|
|
@@ -60,10 +69,10 @@ agentbot init
|
|
|
60
69
|
|
|
61
70
|
初始化会检测 Codex 和 TraeX,并显示已安装的版本。未安装或版本较旧的 Agent 会汇总显示对应的安装或升级命令。Agent Bot 会把配置保存到 `~/.agent-bot/config.yaml` 中。
|
|
62
71
|
|
|
63
|
-
|
|
72
|
+
全新的初始化会先询问群消息响应方式:接收所有群消息,或者只有明确 @ 机器人才接收。根据选择不同,终端随后会显示 2 或 3 轮二维码或链接。
|
|
64
73
|
|
|
65
74
|
1. **创建机器人。** 创建带有标准基础消息配置的飞书应用,并保存 App ID、App Secret 和授权用户。该步骤不能跳过,否则 Agent Bot 无法连接飞书。创建时已经提供的权限不再在下方重复列出。
|
|
66
|
-
2.
|
|
75
|
+
2. **按需添加“接收所有群消息”权限。** 只有选择“接收所有群消息”时才会出现这一步。`im:message.group_msg` 用于接收未 @ 机器人的普通群消息,飞书要求用户在开发者后台手动添加。选择“明确 @ 机器人”时不会申请该权限;出现本步骤后输入 `Y` 跳过等待,也会保持仅 @ 响应。
|
|
67
76
|
3. **补充剩余事件和回调。** 创建机器人时使用的模板已经提供 Agent Bot 所需的其他权限,第三步实际只新增:
|
|
68
77
|
|
|
69
78
|
| 类型 | 事件或回调 | 功能 |
|
|
@@ -71,7 +80,7 @@ agentbot init
|
|
|
71
80
|
| 事件 | `im.chat.updated_v1` | 检测群改名,把群名同步到 agent 任务标题。 |
|
|
72
81
|
| 回调 | `card.action.trigger` | 卡片按钮交互。 |
|
|
73
82
|
|
|
74
|
-
完成这些步骤后,即完成了 `~/.agent-bot` 目录的初始化,Agent Bot
|
|
83
|
+
完成这些步骤后,即完成了 `~/.agent-bot` 目录的初始化,Agent Bot 会立即启动。每次 `agentbot init` 成功后,机器人都会向授权用户私聊发送一张包含 Agent Bot Logo 的欢迎卡片:首次初始化会介绍主要能力,升级后初始化会展示新版亮点,同版本再次初始化则会确认 Profile 已刷新。
|
|
75
84
|
|
|
76
85
|
Agent Bot 自带保活机制,确保在 Agent Bot,Codex 或 TraeX 崩溃后能够自动重新连接。
|
|
77
86
|
|
|
@@ -102,7 +111,16 @@ agentbot server stop
|
|
|
102
111
|
agentbot server restart
|
|
103
112
|
```
|
|
104
113
|
|
|
105
|
-
|
|
114
|
+
它会等待当前运行中的 Agent 任务完成后自动重启,确保所有任务都能正常执行。在飞书话题中触发时,重启状态和重启后的启动卡都会返回原话题。
|
|
115
|
+
|
|
116
|
+
启用下次用户登录时自动启动:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
agentbot server autostart enable
|
|
120
|
+
agentbot server autostart status
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
每个 Profile 都会创建独立的操作系统启动项:Windows 使用任务计划程序,macOS 使用 LaunchAgent,Linux 使用 systemd 用户单元。如果 Windows 策略拒绝创建计划任务,Agent Bot 会自动改用当前用户的启动文件夹,无需管理员权限。Linux 如需在用户尚未登录时启动,可执行 `agentbot server autostart enable --linger`;该命令会启用用户 linger,可能需要系统授权。`server autostart disable` 只移除启动项,不停止当前正在运行的 Server;它也不会关闭 Linux linger,因为其他用户服务可能依赖 linger。
|
|
106
124
|
|
|
107
125
|
### 更新或卸载
|
|
108
126
|
|
|
@@ -117,6 +135,7 @@ agentbot init # 更新 Profile 并启动 Server
|
|
|
117
135
|
卸载:
|
|
118
136
|
|
|
119
137
|
```bash
|
|
138
|
+
agentbot server autostart disable
|
|
120
139
|
agentbot server stop
|
|
121
140
|
npm uninstall --global @keyou007/agent-bot
|
|
122
141
|
```
|
|
@@ -134,6 +153,7 @@ npm uninstall --global @keyou007/agent-bot
|
|
|
134
153
|
agentbot --profile ~/.agent-bot-rescue init
|
|
135
154
|
agentbot --profile ~/.agent-bot-rescue server start
|
|
136
155
|
agentbot --profile ~/.agent-bot-rescue server status
|
|
156
|
+
agentbot --profile ~/.agent-bot-rescue server autostart enable
|
|
137
157
|
```
|
|
138
158
|
|
|
139
159
|
不指定 `--profile` 时使用位于 `~/.agent-bot` 的主 Profile。
|
|
@@ -168,62 +188,65 @@ Console UI 不需要飞书凭据。除非传入 `--force`,否则不会与正
|
|
|
168
188
|
```bash
|
|
169
189
|
agentbot task list
|
|
170
190
|
agentbot task current [--json]
|
|
171
|
-
agentbot task status
|
|
172
|
-
agentbot task prompt
|
|
173
|
-
agentbot task
|
|
174
|
-
agentbot task
|
|
175
|
-
agentbot task
|
|
176
|
-
agentbot task
|
|
191
|
+
agentbot task status [任务]
|
|
192
|
+
agentbot task prompt [任务] "<prompt>"
|
|
193
|
+
agentbot task new [任务] [标题] [--agent <标准名>] [--dir <路径> | --nodir]
|
|
194
|
+
agentbot task newgroup [任务] [标题] [--agent <标准名>] [--dir <路径> | --nodir]
|
|
195
|
+
agentbot task fork [任务]
|
|
196
|
+
agentbot task forkgroup [任务] [标题]
|
|
197
|
+
agentbot task queue [任务] "<prompt>"
|
|
198
|
+
agentbot task model [任务] [模型]
|
|
199
|
+
agentbot task goal [任务] [操作或目标]
|
|
200
|
+
agentbot task turns [任务]
|
|
201
|
+
agentbot task reset [任务] <Turn ID>
|
|
202
|
+
agentbot task dir [任务] [目录]
|
|
203
|
+
agentbot task file [任务] <路径>
|
|
204
|
+
agentbot task title [任务] "<标题>"
|
|
205
|
+
agentbot task stop [任务]
|
|
206
|
+
agentbot task archive [任务]
|
|
177
207
|
```
|
|
178
208
|
|
|
179
|
-
|
|
209
|
+
在 Agent Bot 启动的 Agent 中,省略 `[任务]` 会自动使用当前任务;需要操作其他任务时可传入 `--task <任务>`。普通终端仍必须指定任务。`task current` 用于查看自动识别出的任务详情。任务引用可以是 `task list` 中的序号、任务 ID 或唯一的任务 ID 前缀。飞书中的任务、分支、排队、Agent、Provider、模型、思考强度、权限、Goal、历史 Turn、Reset、群静音、目录、文件、Shell 和重启能力都有对应的 CLI 命令;运行 `agentbot --help` 查看完整列表和参数。
|
|
180
210
|
|
|
181
211
|
`task newgroup` 会创建飞书群和新任务。默认继承源任务的 Agent 和运行设置;`--agent <标准名>` 可选择另一个已配置的 Agent,此时仍继承源任务的项目形态,但 Provider、模型、思考强度和权限模式使用目标 Agent 自己的 Runtime 默认值。`--dir` 可覆盖项目目录并支持 `~`,`--nodir` 会强制创建 Projectless App Server 任务。`task forkgroup` 从源任务最新可用的已完成 turn 创建分支,不会中断正在执行的 turn。两个命令都要求 Server 正在运行,邀请 Profile 中保存的授权用户,不会切换源会话的当前任务,并支持 `--json`。
|
|
182
212
|
|
|
183
213
|
## 飞书命令
|
|
184
214
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
| 命令
|
|
188
|
-
|
|
|
189
|
-
| `/new [标题] [--dir <路径> \| --nodir]`
|
|
190
|
-
| `/
|
|
191
|
-
| `/
|
|
192
|
-
| `/
|
|
193
|
-
| `/
|
|
194
|
-
| `/
|
|
195
|
-
| `/
|
|
196
|
-
| `/
|
|
197
|
-
| `/
|
|
198
|
-
| `/
|
|
199
|
-
| `/
|
|
200
|
-
| `/
|
|
201
|
-
| `/
|
|
202
|
-
| `/
|
|
203
|
-
| `/
|
|
204
|
-
| `/
|
|
205
|
-
| `/
|
|
206
|
-
| `/agent [名称]`
|
|
207
|
-
| `/
|
|
208
|
-
| `/
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
`/forkgroup` 创建新群后,群内欢迎消息会显示分支任务当前使用的 Provider、模型、思考强度和权限类型。
|
|
221
|
-
|
|
222
|
-
`/new` 和 `/newgroup` 支持相同的项目参数:使用 `--dir <cwd>` 覆盖继承的项目目录,或使用 `--nodir` 强制创建 Projectless App Server 任务,二者不能同时使用。两条命令中的 `~`、`~/...` 和 `~\...` 均表示当前用户目录。`/newgroup` 会立即在新群中创建并绑定任务,同时继续继承当前任务的 Provider、模型、思考强度和权限模式,不影响来源任务。来源聊天没有当前任务时,则使用选定 Agent 及其运行时默认设置。显式标题会同时作为群名后缀和任务标题。
|
|
223
|
-
|
|
224
|
-
`/newgroup` 省略标题时,任务标题和群名中的标题部分统一使用 `新任务 (mm-dd)`,默认群名为 `[agent] [project dir] 新任务 (mm-dd)`。Projectless 群会完全省略项目段,群名格式为 `[agent] title`。`/forkgroup` 省略标题时,任务标题和群名都与 `/fork` 一样使用持久递增的 `源标题(分支 N)`,不追加日期。`/newgroup` 和 `/forkgroup` 创建的飞书群名最多显示 60 个字符。生成后的群名过长时,Agent Bot 只截断群名中的标题部分,任务标题本身保持不变。
|
|
225
|
-
|
|
226
|
-
把已绑定任务的群改名为 `[agent] [project dir] title` 时,只会把 `title` 同步到当前任务;Agent 和工程目录前缀仅作为群元数据,不会写入任务标题。旧的 `[agent] title` 格式仍然兼容。
|
|
215
|
+
发送 `/` 开头的消息即可执行命令。使用飞书中的 `/help` 查看最新命令列表。
|
|
216
|
+
|
|
217
|
+
| 命令 | 作用 |
|
|
218
|
+
| --------------------------------------------- | ---------------------------- |
|
|
219
|
+
| `/new [标题] [--dir <路径> \| --nodir]` | 开始新任务 |
|
|
220
|
+
| `/dir [路径]` | 浏览文件,或在指定目录开始任务 |
|
|
221
|
+
| `/sessions [关键词]` | 查找和管理任务 |
|
|
222
|
+
| `/archive [任务]` | 归档当前或指定任务 |
|
|
223
|
+
| `/switch [任务]` | 切换任务,或返回上一个任务 |
|
|
224
|
+
| `/fork [任务]` | 创建任务分支 |
|
|
225
|
+
| `/turns` | 恢复到更早的对话轮次 |
|
|
226
|
+
| `/status [任务]` | 查看任务状态 |
|
|
227
|
+
| `/title <标题>` | 修改当前任务标题 |
|
|
228
|
+
| `/stop` | 停止当前执行 |
|
|
229
|
+
| `/queue <prompt>` | 在当前轮次结束后执行 Prompt |
|
|
230
|
+
| `/nosteer <prompt>` | 与 `/queue` 相同 |
|
|
231
|
+
| `/goal [目标]` | 管理长期目标 |
|
|
232
|
+
| `/provider` | 选择 Provider |
|
|
233
|
+
| `/model` | 选择模型 |
|
|
234
|
+
| `/thinking` | 设置思考强度 |
|
|
235
|
+
| `/permissions` | 设置执行权限 |
|
|
236
|
+
| `/agent [名称]` | 选择新任务使用的 Agent |
|
|
237
|
+
| `/newgroup [标题] [--dir <路径> \| --nodir]` | 在新私有群中开始任务 |
|
|
238
|
+
| `/forkgroup [标题]` | 将任务分支到新私有群 |
|
|
239
|
+
| `/restart [--force]` | 安全重启;`--force` 会中断任务 |
|
|
240
|
+
| `/mute [on\|off]` | 设置当前群仅响应 @ 消息 |
|
|
241
|
+
| `/help` | 显示命令帮助 |
|
|
242
|
+
|
|
243
|
+
私聊、群正文和话题分别维护当前任务。任务运行时发送普通消息会向当前轮次追加指令;需要在本轮结束后独立执行时,使用 `/queue`。
|
|
244
|
+
|
|
245
|
+
在群聊中发送 `/mute` 或 `/mute on` 后,机器人只处理 @ 它的消息;@ 机器人并发送 `/mute off` 可恢复自动响应。该设置对群内所有话题生效。
|
|
246
|
+
|
|
247
|
+
`/new` 和 `/newgroup` 会继承当前 Agent、项目和运行设置。使用 `--dir` 指定其他目录,或使用 `--nodir` 创建无项目目录的任务;`~` 表示用户主目录。
|
|
248
|
+
|
|
249
|
+
`/fork` 和 `/forkgroup` 会从已完成的工作创建分支,不会中断正在执行的轮次。`/sessions` 用于跨项目管理任务,`/turns` 用于恢复对话上下文,不会回退本地文件。
|
|
227
250
|
|
|
228
251
|
## 本地命令
|
|
229
252
|
|
|
@@ -246,7 +269,11 @@ Agent Bot 将用户相关文件保存在仓库之外:
|
|
|
246
269
|
|
|
247
270
|
Agent 进程会继承普通父进程变量及其显式配置的 `agents.<name>.env`。启动 Agent 前,Agent Bot 会移除继承的 `FEISHU_*` 凭据和内部 `AGENT_BOT_*` 状态,再仅提供带命名空间的非敏感 Profile 与 Lark 身份上下文;`FEISHU_APP_SECRET` 永远不会传入 Agent 进程。
|
|
248
271
|
|
|
249
|
-
|
|
272
|
+
默认配置 `feishu.respondToOwnerOnly: true` 只接受 `feishu.userOpenId` 所标识的机器人拥有者发送的消息和卡片操作;其他用户会在添加处理 reaction 之前被忽略。设为 `false` 可允许其他协作者使用。开启后若未配置拥有者 Open ID,Agent Bot 会忽略所有飞书用户输入,直到完成拥有者配置。
|
|
273
|
+
|
|
274
|
+
Agent Bot 会响应机器人所在群内拥有者发送的普通消息。将 `feishu.respondToAllGroupMessages` 设为 `false` 后,还会要求拥有者在群消息中 @ 当前机器人;私聊不受这一项影响。初始化仍会申请完整的群消息权限,因此以后切换该配置无需重新授权。
|
|
275
|
+
|
|
276
|
+
思考卡片默认使用分组布局:辅助 Commentary 和用户追加消息保持直接显示,每个执行组只显示最新一段原生思考,点击后可展开完整的工具命令和结果。显示命令时会省略常见的 PowerShell、zsh、bash 和 sh 启动包装前缀。失败工具仍会在自己的工具面板中标记,但不会让整个执行组显示失败图标或红色边框。执行组默认折叠,并使用稳定的组件标识,使用户在飞书中手动打开的面板在卡片更新后继续保持展开。长任务会根据完整渲染后的卡片内容大小翻页,不再使用固定的消息数或工具数。将 `feishu.thinkingCardLayout` 设为 `timeline` 可临时恢复原版布局。
|
|
250
277
|
|
|
251
278
|
## 常见问题
|
|
252
279
|
|
package/config.example.yaml
CHANGED
|
@@ -2,8 +2,12 @@ feishu:
|
|
|
2
2
|
appId: "${FEISHU_APP_ID}"
|
|
3
3
|
appSecret: "${FEISHU_APP_SECRET}"
|
|
4
4
|
userOpenId: "${FEISHU_USER_OPEN_ID}"
|
|
5
|
-
# Set to false to
|
|
5
|
+
# Set to false to accept messages and card actions from users other than the bot owner.
|
|
6
|
+
respondToOwnerOnly: true
|
|
7
|
+
# Fresh init and init --reset ask whether group messages require an @ mention.
|
|
6
8
|
respondToAllGroupMessages: true
|
|
9
|
+
# Use "timeline" to temporarily restore the original thinking-card layout.
|
|
10
|
+
thinkingCardLayout: "grouped"
|
|
7
11
|
|
|
8
12
|
console:
|
|
9
13
|
enabled: true
|