@keyou007/agent-bot 0.1.11 → 0.1.13-alpha.0
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/.env.example +1 -1
- package/CHANGELOG.md +19 -0
- package/README.md +63 -44
- package/README.zh.md +63 -44
- package/config.example.yaml +8 -22
- package/dist/cli/AgentPrerequisites.js +262 -0
- package/dist/cli/AgentPrerequisites.js.map +1 -0
- package/dist/cli/DefaultAgentSelection.js +47 -0
- package/dist/cli/DefaultAgentSelection.js.map +1 -0
- package/dist/cli/FeishuAppConfiguration.js +1 -1
- package/dist/cli/FeishuAppConfiguration.js.map +1 -1
- package/dist/cli/FeishuAppRegistration.js +2 -2
- package/dist/cli/FeishuAppRegistration.js.map +1 -1
- package/dist/cli/Initializer.js +166 -3
- package/dist/cli/Initializer.js.map +1 -1
- package/dist/cli/ServerStarter.js +7 -2
- package/dist/cli/ServerStarter.js.map +1 -1
- package/dist/cli/controlProtocol.js.map +1 -1
- package/dist/cli/help.js +24 -20
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/taskGroupOptions.js +95 -0
- package/dist/cli/taskGroupOptions.js.map +1 -0
- package/dist/cli.js +268 -6
- package/dist/cli.js.map +1 -1
- package/dist/codex/AppServerConnection.js +3 -3
- package/dist/codex/AppServerConnection.js.map +1 -1
- package/dist/codex/CodexProcessManager.js +4 -4
- package/dist/codex/CodexProcessManager.js.map +1 -1
- package/dist/codex/CodexRuntime.js +63 -25
- package/dist/codex/CodexRuntime.js.map +1 -1
- package/dist/config/loadConfig.js +8 -22
- package/dist/config/loadConfig.js.map +1 -1
- package/dist/config/schema.js +6 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/console/ConsoleConnector.js +3 -3
- package/dist/console/ConsoleConnector.js.map +1 -1
- package/dist/console/ConsoleTurnPresenter.js +14 -7
- package/dist/console/ConsoleTurnPresenter.js.map +1 -1
- package/dist/deprecated-cli.js +5 -0
- package/dist/deprecated-cli.js.map +1 -0
- package/dist/feishu/CardRenderer.js +13 -12
- package/dist/feishu/CardRenderer.js.map +1 -1
- package/dist/feishu/FeishuTurnPresenter.js +9 -5
- package/dist/feishu/FeishuTurnPresenter.js.map +1 -1
- package/dist/feishu/transport.js +1 -1
- package/dist/feishu/transport.js.map +1 -1
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/dist/presentation/OutboundRouter.js +2 -2
- package/dist/presentation/OutboundRouter.js.map +1 -1
- package/dist/presentation/TurnStateReducer.js +2 -1
- package/dist/presentation/TurnStateReducer.js.map +1 -1
- package/dist/proxy/ProxySessionController.js +128 -72
- package/dist/proxy/ProxySessionController.js.map +1 -1
- package/dist/runtime/AcpRuntimeAdapter.js +3 -2
- package/dist/runtime/AcpRuntimeAdapter.js.map +1 -1
- package/dist/runtime/createAgentRuntimeRegistry.js +1 -1
- package/dist/runtime/createAgentRuntimeRegistry.js.map +1 -1
- package/dist/supervision/systemEnvironment.js +129 -0
- package/dist/supervision/systemEnvironment.js.map +1 -0
- package/dist/supervisor.js +13 -1
- package/dist/supervisor.js.map +1 -1
- package/docs/technical-reference.md +53 -34
- package/docs/technical-reference.zh.md +53 -34
- package/npm-shrinkwrap.json +4 -3
- package/package.json +9 -4
- package/skills/agent-bot/SKILL.md +72 -33
- package/src/cli/AgentPrerequisites.ts +377 -0
- package/src/cli/DefaultAgentSelection.ts +56 -0
- package/src/cli/FeishuAppConfiguration.ts +2 -2
- package/src/cli/FeishuAppRegistration.ts +4 -4
- package/src/cli/Initializer.ts +206 -5
- package/src/cli/ServerStarter.ts +8 -3
- package/src/cli/controlProtocol.ts +21 -1
- package/src/cli/help.ts +24 -20
- package/src/cli/taskGroupOptions.ts +149 -0
- package/src/cli.ts +391 -9
- package/src/codex/AppServerConnection.ts +3 -3
- package/src/codex/CodexProcessManager.ts +4 -4
- package/src/codex/CodexRuntime.ts +84 -31
- package/src/config/loadConfig.ts +8 -22
- package/src/config/schema.ts +7 -1
- package/src/console/ConsoleConnector.ts +3 -3
- package/src/console/ConsoleTurnPresenter.ts +20 -7
- package/src/deprecated-cli.ts +9 -0
- package/src/feishu/CardRenderer.ts +13 -12
- package/src/feishu/FeishuTurnPresenter.ts +15 -1
- package/src/feishu/transport.ts +1 -1
- package/src/index.ts +34 -3
- package/src/presentation/OutboundRouter.ts +15 -3
- package/src/presentation/TurnStateReducer.ts +2 -0
- package/src/presentation/turnViewTypes.ts +1 -0
- package/src/proxy/ProxySessionController.ts +217 -73
- package/src/runtime/AcpRuntimeAdapter.ts +3 -1
- package/src/runtime/createAgentRuntimeRegistry.ts +1 -1
- package/src/supervision/systemEnvironment.ts +174 -0
- package/src/supervisor.ts +12 -1
package/.env.example
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# agentbot init fills these through Feishu one-click registration.
|
|
2
2
|
# Leave them blank for console-only mode. When binding an existing app manually,
|
|
3
3
|
# FEISHU_USER_OPEN_ID is the private-chat fallback for startup notifications.
|
|
4
4
|
FEISHU_APP_ID=
|
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,25 @@ The project follows [Semantic Versioning](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.1.13-alpha.0] - 2026-08-03
|
|
10
|
+
|
|
11
|
+
- Upgrade existing Profiles during `agentbot init` by filling missing `config.yaml` and `.env` settings, detecting Codex and TraeX versions, offering explicit install or upgrade actions, and requiring an interactive default-Agent selection.
|
|
12
|
+
- Keep the generated Agent list focused on Codex and TraeX while preserving existing custom Agents and user configuration during Profile upgrades.
|
|
13
|
+
- Generalize runtime messages, cards, help, documentation, and package metadata from Codex-specific wording to the selected App Server Agent.
|
|
14
|
+
- Recognize known TraeX code-mode tool-channel failures in completed responses and guide users to switch models with `/model`.
|
|
15
|
+
- Make Alpha the default release channel, with tested Alpha sequencing and explicit stable promotion commands.
|
|
16
|
+
- Publish Alpha packages under npm's `alpha` dist-tag and mark their GitHub releases as prereleases while preserving `latest` for stable versions.
|
|
17
|
+
|
|
18
|
+
## [0.1.12] - 2026-08-03
|
|
19
|
+
|
|
20
|
+
- Add a ready-to-use TraeX App Server example to the checked-in and generated default configuration.
|
|
21
|
+
- Rename the configured App Server adapter kind from `codex` to `app-server` while normalizing existing `codex` values during loading, and show the active Agent's display name in progress-card connection and waiting states.
|
|
22
|
+
- Retry `thread/list` with `updated_at` and remember that capability when a compatible App Server such as TraeX rejects Codex's `recency_at` sort extension.
|
|
23
|
+
- Add `agentbot task newgroup <task>` and `agentbot task forkgroup <task>` to create inherited task groups or fork a task's latest completed turn through the running Server, with optional titles, target-Agent and project overrides for NewGroup, and structured JSON output.
|
|
24
|
+
- Register `agentbot` as the primary CLI executable, retain `agent-bot` as a deprecated forwarding entry with a localized warning, and update current documentation and CLI guidance to use the new command.
|
|
25
|
+
- Refresh Windows Machine and User environment variables before initial Supervisor launch, replacement Supervisor launch, and every Worker launch so restarts pick up updated `PATH` and other values while preserving Profile isolation.
|
|
26
|
+
- Extend App Server session lifecycle requests to 60 seconds so slower compatible Agents such as TraeX can complete `thread/start` without producing a late unknown response.
|
|
27
|
+
|
|
9
28
|
## [0.1.11] - 2026-08-02
|
|
10
29
|
|
|
11
30
|
- Retry Feishu messages, replies, and card updates rejected by email-address content auditing with audit-safe text; keep message reactions pending until terminal presentation succeeds while allowing session and queue state to settle after presentation failures.
|
package/README.md
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
# Agent Bot
|
|
6
6
|
|
|
7
|
-
Use
|
|
7
|
+
Use Codex, TraeX, and compatible ACP agents directly from Feishu.
|
|
8
8
|
|
|
9
9
|
English | [简体中文](README.zh.md)
|
|
10
10
|
|
|
11
|
-
Agent Bot runs on your computer and connects a Feishu bot to your local
|
|
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
|
|
|
13
13
|
## What You Can Do
|
|
14
14
|
|
|
15
|
-
- Use your existing local Codex login from Feishu
|
|
15
|
+
- Use your existing local Codex or TraeX login from Feishu
|
|
16
16
|
- Create, continue, switch, fork, and stop tasks
|
|
17
17
|
- Work with text, images, groups, and threads
|
|
18
18
|
- Queue follow-up Prompts or add instructions while a task is running
|
|
@@ -24,34 +24,47 @@ Agent Bot runs on your computer and connects a Feishu bot to your local Codex en
|
|
|
24
24
|
### Requirements
|
|
25
25
|
|
|
26
26
|
- Node.js 22 or later
|
|
27
|
-
-
|
|
28
|
-
- A completed local
|
|
27
|
+
- At least one supported App Server Agent: Codex or TraeX
|
|
28
|
+
- A completed local login for the Agent you intend to use
|
|
29
29
|
|
|
30
|
-
Check the login:
|
|
30
|
+
Check the installed Agents and login state:
|
|
31
31
|
|
|
32
32
|
```powershell
|
|
33
|
+
codex --version
|
|
33
34
|
codex login status
|
|
35
|
+
traex --version
|
|
36
|
+
traex login status
|
|
34
37
|
```
|
|
35
38
|
|
|
39
|
+
You can continue to initialization when either Codex or TraeX is ready. `agentbot init` checks both Agents and can help install or upgrade either one.
|
|
40
|
+
|
|
36
41
|
### Install
|
|
37
42
|
|
|
38
43
|
```powershell
|
|
39
44
|
npm install --global @keyou007/agent-bot
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
agentbot --version
|
|
46
|
+
agentbot --help
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
To try the current Alpha channel without replacing npm's stable `latest` tag:
|
|
50
|
+
|
|
51
|
+
```powershell
|
|
52
|
+
npm install --global @keyou007/agent-bot@alpha
|
|
42
53
|
```
|
|
43
54
|
|
|
44
|
-
This installs the `agent-bot` command
|
|
55
|
+
This installs `agentbot` as the primary command. The legacy `agent-bot` command remains available temporarily, prints a deprecation warning, and will be removed in a future release. Command-line help, status, progress, prompts, and errors follow the system language for Chinese and English locales; all other locales fall back to English. JSON output remains language-neutral and stable. See the [technical reference](docs/technical-reference.md#development-and-source-installation) to install from source.
|
|
45
56
|
|
|
46
57
|
### Initialize
|
|
47
58
|
|
|
48
59
|
```powershell
|
|
49
|
-
|
|
60
|
+
agentbot init
|
|
50
61
|
```
|
|
51
62
|
|
|
52
|
-
|
|
63
|
+
Initialization detects Codex and TraeX and reports their installed versions. Missing or outdated Agents are summarized once with their exact install or upgrade commands. Enter one or more action numbers separated by commas, enter `all`, or press Enter to skip maintenance. A failed command does not block the remaining initialization steps. After these checks, select the default Agent by number or standard name; when the current default is still available, press Enter to confirm it. Agent Bot saves the selection to `defaults.agent` in `config.yaml` for future tasks.
|
|
64
|
+
|
|
65
|
+
Then follow the displayed link or scan the QR code to create and authorize the Feishu bot. Initialization prepares `~/.agent-bot`, saves the bot credentials and the authorizing user, checks the required permissions, and starts Agent Bot automatically.
|
|
53
66
|
|
|
54
|
-
Only a complete app ID and secret saved locally count as a successful bot creation. If initialization is interrupted before both credentials are saved, rerunning `
|
|
67
|
+
Only a complete app ID and secret saved locally count as a successful bot creation. If initialization is interrupted before both credentials are saved, rerunning `agentbot init` creates a new bot. If credentials were saved, initialization resumes by auditing that bot's remote permissions and subscriptions.
|
|
55
68
|
|
|
56
69
|
The `im:message.group_msg` permission cannot be added through Feishu's one-click configuration. When it is missing, Agent Bot prints a QR code and a direct Developer Console link already filtered to that permission. Add it manually, publish the app version, and complete tenant approval if required. While Agent Bot waits for it to become active, enter `Y` to skip this permission and continue initialization; the final result warns that ordinary group messages which do not mention the bot will be unavailable.
|
|
57
70
|
|
|
@@ -66,12 +79,12 @@ When optional permissions or subscriptions are missing, Agent Bot first shows th
|
|
|
66
79
|
| `--profile <directory>`| Use an isolated profile directory |
|
|
67
80
|
| `--config <path>` | Use a specific configuration file |
|
|
68
81
|
|
|
69
|
-
|
|
82
|
+
After upgrading Agent Bot, rerun `agentbot init` to refresh the Profile. It preserves existing values in `config.yaml` and `.env`, fills settings and environment variables added by the current version, lets you confirm or change the default Agent, and rechecks the Agents and bot configuration. If the server is already running, initialization leaves it running. In a non-interactive terminal, `init` cannot ask for a selection and keeps the already configured default Agent.
|
|
70
83
|
|
|
71
84
|
To fully reconfigure a Profile, stop its server and select the Profile explicitly:
|
|
72
85
|
|
|
73
86
|
```powershell
|
|
74
|
-
|
|
87
|
+
agentbot --profile ~/.agent-bot init --reset
|
|
75
88
|
```
|
|
76
89
|
|
|
77
90
|
Reset moves the active `config.yaml`, `.env`, `data/`, and `logs/` into a new timestamped directory under `.reset-backups`, then initializes clean replacements. Existing backup directories are retained. The old remote Feishu app is not deleted.
|
|
@@ -79,10 +92,10 @@ Reset moves the active `config.yaml`, `.env`, `data/`, and `logs/` into a new ti
|
|
|
79
92
|
### Start And Stop
|
|
80
93
|
|
|
81
94
|
```powershell
|
|
82
|
-
|
|
95
|
+
agentbot server status
|
|
83
96
|
```
|
|
84
97
|
|
|
85
|
-
`
|
|
98
|
+
`agentbot init` starts the server automatically. If you stop it later, run `agentbot server start` to start it again. For local-only use, initialize with `--skip-feishu` and run `agentbot console` instead.
|
|
86
99
|
|
|
87
100
|
The `Agent Bot 已启动` startup card shows the version of Agent Bot currently running.
|
|
88
101
|
|
|
@@ -91,7 +104,7 @@ Open Feishu, find the bot, and send a message. Agent Bot automatically creates a
|
|
|
91
104
|
Stop the service with:
|
|
92
105
|
|
|
93
106
|
```powershell
|
|
94
|
-
|
|
107
|
+
agentbot server stop
|
|
95
108
|
```
|
|
96
109
|
|
|
97
110
|
### Update Or Uninstall
|
|
@@ -99,15 +112,15 @@ agent-bot server stop
|
|
|
99
112
|
Stop the running service before replacing or removing the global package:
|
|
100
113
|
|
|
101
114
|
```powershell
|
|
102
|
-
|
|
115
|
+
agentbot server stop
|
|
103
116
|
npm install --global @keyou007/agent-bot@latest
|
|
104
|
-
|
|
117
|
+
agentbot server start
|
|
105
118
|
```
|
|
106
119
|
|
|
107
120
|
To uninstall:
|
|
108
121
|
|
|
109
122
|
```powershell
|
|
110
|
-
|
|
123
|
+
agentbot server stop
|
|
111
124
|
npm uninstall --global @keyou007/agent-bot
|
|
112
125
|
```
|
|
113
126
|
|
|
@@ -118,20 +131,22 @@ Uninstalling the npm package does not delete your data under `~/.agent-bot`.
|
|
|
118
131
|
### Service
|
|
119
132
|
|
|
120
133
|
```powershell
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
134
|
+
agentbot server status
|
|
135
|
+
agentbot server start
|
|
136
|
+
agentbot server stop
|
|
137
|
+
agentbot server restart
|
|
125
138
|
```
|
|
126
139
|
|
|
127
140
|
`server restart` waits for current work to finish by default. Its status card includes a `Cancel` button while the restart is still waiting. Use `--immediate` only when interruption is acceptable.
|
|
128
141
|
|
|
142
|
+
On Windows, every Supervisor and Worker launch reloads the latest Machine and User environment variables. Restart the service after changing `PATH` or another system environment variable; the active Profile selection remains isolated.
|
|
143
|
+
|
|
129
144
|
`server status` shows the Lark App ID used by the running server. Add `--json` to read it from `feishuAppId`.
|
|
130
145
|
|
|
131
146
|
### Console
|
|
132
147
|
|
|
133
148
|
```powershell
|
|
134
|
-
|
|
149
|
+
agentbot console
|
|
135
150
|
```
|
|
136
151
|
|
|
137
152
|
The Console UI works without Feishu credentials. It will not share task state with a running server unless `--force` is supplied.
|
|
@@ -139,14 +154,18 @@ The Console UI works without Feishu credentials. It will not share task state wi
|
|
|
139
154
|
### Tasks
|
|
140
155
|
|
|
141
156
|
```powershell
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
157
|
+
agentbot task list
|
|
158
|
+
agentbot task status <task>
|
|
159
|
+
agentbot task prompt <task> "<prompt>"
|
|
160
|
+
agentbot task newgroup <task> [title] [--agent <name>] [--dir <path> | --nodir]
|
|
161
|
+
agentbot task forkgroup <task> [title]
|
|
162
|
+
agentbot task title <task> "<title>"
|
|
163
|
+
agentbot task stop <task>
|
|
147
164
|
```
|
|
148
165
|
|
|
149
|
-
`<task>` can be a number from `task list`, a task ID, or an unambiguous task-ID prefix. Run `
|
|
166
|
+
`<task>` can be a number from `task list`, a task ID, or an unambiguous task-ID prefix. Run `agentbot --help` for all CLI options.
|
|
167
|
+
|
|
168
|
+
`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 the selected Agent uses its own runtime defaults for Provider, model, reasoning effort, and permission mode. `--dir` overrides the project directory and supports `~`; `--nodir` forces a Projectless App Server task. `task forkgroup` forks the source task's latest available completed turn without interrupting an active turn. Both commands require the Server to be running, invite the Profile's saved authorizing user, leave the source chat on its current task, and support `--json`.
|
|
150
169
|
|
|
151
170
|
## Feishu Commands
|
|
152
171
|
|
|
@@ -155,7 +174,7 @@ Plain text continues the current task. Messages beginning with `/` are commands.
|
|
|
155
174
|
| Command | Purpose |
|
|
156
175
|
| ---------------------------------------- | ------------------------------------------- |
|
|
157
176
|
| `/new [title] [--dir <path> \| --nodir]` | Create a task |
|
|
158
|
-
| `/sessions [keyword]` | Browse available
|
|
177
|
+
| `/sessions [keyword]` | Browse available App Server tasks |
|
|
159
178
|
| `/switch [task]` | Switch tasks or return to the previous task |
|
|
160
179
|
| `/fork [task]` | Create and open a task branch |
|
|
161
180
|
| `/status [task]` | View task progress and results |
|
|
@@ -177,7 +196,7 @@ Plain text continues the current task. Messages beginning with `/` are commands.
|
|
|
177
196
|
|
|
178
197
|
Slash commands accept any unique prefix, and compound commands accept registered initialisms: `/sess` runs `/sessions`, `/fg` runs `/forkgroup`, `/ng` runs `/newgroup`, and `/ns` runs `/nosteer`. Exact command names take priority. An ambiguous prefix such as `/s` or `/f` is rejected and reports every matching command.
|
|
179
198
|
|
|
180
|
-
`/agent`, `/provider`, `/model`, `/thinking`, and `/permissions` use the same execution-settings card when there is something to select. When more than one Agent is configured, the card adds an Agent tab for selecting the default Agent used by future tasks; `/agent` opens that tab, including when the chat has no current task. With only one configured Agent, `/agent` reports the current Agent directly instead. Existing tasks keep their original Agent, and tasks using different Agents run independently. `/agent <name>` remains available for direct selection. `/provider` likewise reports the current Provider directly when no alternative Provider is configured. The other four commands activate their matching tabs and do not accept arguments. A task created without inherited settings uses the default Provider
|
|
199
|
+
`/agent`, `/provider`, `/model`, `/thinking`, and `/permissions` use the same execution-settings card when there is something to select. When more than one Agent is configured, the card adds an Agent tab for selecting the default Agent used by future tasks; `/agent` opens that tab, including when the chat has no current task. With only one configured Agent, `/agent` reports the current Agent directly instead. Existing tasks keep their original Agent, and tasks using different Agents run independently. `/agent <name>` remains available for direct selection. `/provider` likewise reports the current Provider directly when no alternative Provider is configured. The other four commands activate their matching tabs and do not accept arguments. A task created without inherited settings uses the selected Agent's default Provider.
|
|
181
200
|
|
|
182
201
|
Private chats, group timelines, and threads keep separate current tasks. You can send an image by itself or together with text. While a task is running, plain text adds instructions to the current work; use `/queue` (or `/nosteer`) to always create a later turn.
|
|
183
202
|
|
|
@@ -187,11 +206,11 @@ Inside a thread, `/forkgroup` forks from the thread's original turn until the th
|
|
|
187
206
|
|
|
188
207
|
After `/forkgroup` creates the new group, its welcome message shows the forked task's current Provider, model, reasoning effort, and permission type.
|
|
189
208
|
|
|
190
|
-
`/new` and `/newgroup` accept the same project options. Pass `--dir <cwd>` to override the inherited project directory, or `--nodir` to force a Projectless
|
|
209
|
+
`/new` and `/newgroup` accept the same project options. Pass `--dir <cwd>` to override the inherited project directory, or `--nodir` to force a Projectless App Server task; the two options are mutually exclusive. `~`, `~/...`, and `~\...` resolve from the current user's home directory for both commands. `/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 there is no current task, Agent Bot uses the selected agent and its runtime defaults. An explicit title becomes both the group suffix and the task title.
|
|
191
210
|
|
|
192
|
-
When `/newgroup` omits the title, the task title
|
|
211
|
+
When `/newgroup` omits the title, both the task title and the group-title portion use `新任务 (mm-dd)`, producing the default group name `[agent] [project dir] 新任务 (mm-dd)`. Projectless groups omit the project segment entirely, using `[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` are capped at 60 displayed characters. When a generated name is too long, Agent Bot truncates only the title portion in the group name; the task title itself stays unchanged.
|
|
193
212
|
|
|
194
|
-
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
|
|
213
|
+
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.
|
|
195
214
|
|
|
196
215
|
## Configuration And Data
|
|
197
216
|
|
|
@@ -213,21 +232,21 @@ By default, Agent Bot responds to ordinary messages in groups containing the bot
|
|
|
213
232
|
Commands without `--profile` use the main profile at `~/.agent-bot`. To run another bot with isolated credentials, configuration, data, logs, and local control endpoint, pass its directory explicitly on every command:
|
|
214
233
|
|
|
215
234
|
```powershell
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
235
|
+
agentbot --profile ~/.agent-bot-rescue init
|
|
236
|
+
agentbot --profile ~/.agent-bot-rescue server start
|
|
237
|
+
agentbot --profile ~/.agent-bot-rescue server status
|
|
219
238
|
```
|
|
220
239
|
|
|
221
240
|
Alternative profiles are directory-based and are not registered by name. Each one uses `config.yaml`, `.env`, `data/`, and `logs/` inside the selected directory. `--profile` cannot be combined with `--config`.
|
|
222
241
|
|
|
223
242
|
## Troubleshooting
|
|
224
243
|
|
|
225
|
-
- **The bot does not respond:** run `
|
|
244
|
+
- **The bot does not respond:** run `agentbot server status` and check `~/.agent-bot/logs/agent-bot.log`.
|
|
226
245
|
- **The Worker restarted after a Node crash:** check `~/.agent-bot/data/last-crash.json`, `~/.agent-bot/logs/worker.stderr.log`, and `~/.agent-bot/data/crash-reports/`.
|
|
227
|
-
- **Feishu permissions are incomplete:** rerun `
|
|
228
|
-
- **
|
|
229
|
-
- **You only need local testing:** run `
|
|
230
|
-
- **A safe restart keeps waiting:** inspect active tasks with `
|
|
246
|
+
- **Feishu permissions are incomplete:** rerun `agentbot init` and follow the displayed authorization steps.
|
|
247
|
+
- **An Agent cannot start:** run `codex login status` or `traex login status` as the same operating-system user that runs Agent Bot, then rerun `agentbot init` to check its version.
|
|
248
|
+
- **You only need local testing:** run `agentbot init --skip-feishu`, then `agentbot console`.
|
|
249
|
+
- **A safe restart keeps waiting:** inspect active tasks with `agentbot task list --status running`.
|
|
231
250
|
|
|
232
251
|
## More Documentation
|
|
233
252
|
|
package/README.zh.md
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
# Agent Bot
|
|
6
6
|
|
|
7
|
-
通过飞书使用本机上的 Codex
|
|
7
|
+
通过飞书使用本机上的 Codex、TraeX 和兼容 ACP 的 Agent。
|
|
8
8
|
|
|
9
9
|
[English](README.md) | 简体中文
|
|
10
10
|
|
|
11
|
-
Agent Bot
|
|
11
|
+
Agent Bot 运行在你的电脑上,把飞书机器人连接到本机编程 Agent。发送消息即可开始工作;执行过程中机器人会更新进度卡,完成后发送 Markdown 最终回答。
|
|
12
12
|
|
|
13
13
|
## 可以做什么
|
|
14
14
|
|
|
15
|
-
- 在飞书中使用本机已有的 Codex 登录
|
|
15
|
+
- 在飞书中使用本机已有的 Codex 或 TraeX 登录
|
|
16
16
|
- 创建、继续、切换、分支和停止任务
|
|
17
17
|
- 使用文字、图片、群聊和话题协作
|
|
18
18
|
- 排队后续 Prompt,或在任务运行中追加指令
|
|
@@ -24,34 +24,47 @@ Agent Bot 运行在你的电脑上,把飞书机器人连接到本机 Codex 环
|
|
|
24
24
|
### 使用前提
|
|
25
25
|
|
|
26
26
|
- Node.js 22 或更高版本
|
|
27
|
-
-
|
|
28
|
-
-
|
|
27
|
+
- 至少安装一个支持的 App Server Agent:Codex 或 TraeX
|
|
28
|
+
- 已完成准备使用的 Agent 的本机登录
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
检查已安装的 Agent 和登录状态:
|
|
31
31
|
|
|
32
32
|
```powershell
|
|
33
|
+
codex --version
|
|
33
34
|
codex login status
|
|
35
|
+
traex --version
|
|
36
|
+
traex login status
|
|
34
37
|
```
|
|
35
38
|
|
|
39
|
+
Codex 或 TraeX 中任意一个准备完成后即可继续初始化。`agentbot init` 会检查两者,并可帮助安装或升级。
|
|
40
|
+
|
|
36
41
|
### 安装
|
|
37
42
|
|
|
38
43
|
```powershell
|
|
39
44
|
npm install --global @keyou007/agent-bot
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
agentbot --version
|
|
46
|
+
agentbot --help
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
如需试用当前 Alpha 通道,同时不影响 npm 的稳定版 `latest` 标签:
|
|
50
|
+
|
|
51
|
+
```powershell
|
|
52
|
+
npm install --global @keyou007/agent-bot@alpha
|
|
42
53
|
```
|
|
43
54
|
|
|
44
|
-
|
|
55
|
+
该命令会把 `agentbot` 安装为主命令。旧的 `agent-bot` 命令暂时保留,运行时会显示弃用警告,并将在后续版本中移除。命令行帮助、状态、进度、交互提示和错误会根据系统语言显示中文或英文;其他未支持语言统一回退英文。JSON 输出不做本地化并保持字段稳定。从源码安装的方法见[技术参考](docs/technical-reference.zh.md#开发与源码安装)。
|
|
45
56
|
|
|
46
57
|
### 初始化
|
|
47
58
|
|
|
48
59
|
```powershell
|
|
49
|
-
|
|
60
|
+
agentbot init
|
|
50
61
|
```
|
|
51
62
|
|
|
52
|
-
|
|
63
|
+
初始化会检测 Codex 和 TraeX,并显示已安装的版本。未安装或版本较旧的 Agent 会汇总显示对应的安装或升级命令;输入一个或多个操作编号(用逗号分隔)、输入 `all`,或直接回车跳过维护。命令执行失败不会阻塞后续初始化。检查完成后,可输入编号或标准名选择默认 Agent;当前默认值仍可用时,直接回车即可确认。Agent Bot 会把选择保存到 `config.yaml` 的 `defaults.agent`,供后续新任务使用。
|
|
64
|
+
|
|
65
|
+
然后打开命令显示的链接或扫描二维码,完成飞书机器人创建和授权。初始化会准备 `~/.agent-bot`、保存机器人凭据和授权用户、检查所需权限,并自动启动 Agent Bot。
|
|
53
66
|
|
|
54
|
-
只有 App ID 和 App Secret 都已保存到本地才视为机器人创建成功。如果初始化在完整凭据保存前中断,再次运行 `
|
|
67
|
+
只有 App ID 和 App Secret 都已保存到本地才视为机器人创建成功。如果初始化在完整凭据保存前中断,再次运行 `agentbot init` 会创建新机器人;如果凭据已经保存,则会继续检查该机器人的远端权限和订阅。
|
|
55
68
|
|
|
56
69
|
`im:message.group_msg` 无法通过飞书一键配置新增。缺少该权限时,Agent Bot 会显示二维码,以及已筛选该权限的开发者后台直达链接。请手动新增权限、发布应用版本,并在需要时完成租户管理员审批。Agent Bot 等待权限生效时,可输入 `Y` 跳过该权限并继续初始化;最终结果会提示机器人无法响应未 @ 它的普通群消息。
|
|
57
70
|
|
|
@@ -66,12 +79,12 @@ agent-bot init
|
|
|
66
79
|
| `--profile <目录>` | 使用指定目录中的独立 Profile |
|
|
67
80
|
| `--config <路径>` | 使用指定配置文件 |
|
|
68
81
|
|
|
69
|
-
|
|
82
|
+
升级 Agent Bot 后,可以重新运行 `agentbot init` 刷新 Profile。它会保留现有 `config.yaml` 和 `.env` 中的值,补齐当前版本新增的配置项和环境变量,允许确认或更换默认 Agent,并重新检查 Agent 与机器人配置。如果 Server 已在运行,初始化会保留当前服务。非交互式终端无法询问选择,此时会保留配置中已有的默认 Agent。
|
|
70
83
|
|
|
71
84
|
如需完整重新配置一个 Profile,请先停止它的 Server,并显式指定 Profile:
|
|
72
85
|
|
|
73
86
|
```powershell
|
|
74
|
-
|
|
87
|
+
agentbot --profile ~/.agent-bot init --reset
|
|
75
88
|
```
|
|
76
89
|
|
|
77
90
|
重置会把当前 `config.yaml`、`.env`、`data/` 和 `logs/` 移入 `.reset-backups` 下新的时间戳目录,再创建干净的新文件和目录。已有备份会永久保留,不会被后续重置覆盖或清理。远端旧飞书应用不会被删除。
|
|
@@ -79,10 +92,10 @@ agent-bot --profile ~/.agent-bot init --reset
|
|
|
79
92
|
### 启动与停止
|
|
80
93
|
|
|
81
94
|
```powershell
|
|
82
|
-
|
|
95
|
+
agentbot server status
|
|
83
96
|
```
|
|
84
97
|
|
|
85
|
-
`
|
|
98
|
+
`agentbot init` 会自动启动 Server。之后如果手动停止了服务,可执行 `agentbot server start` 再次启动。仅在本地使用时,请通过 `--skip-feishu` 初始化并运行 `agentbot console`。
|
|
86
99
|
|
|
87
100
|
`Agent Bot 已启动` 启动卡片会显示当前正在运行的 Agent Bot 版本。
|
|
88
101
|
|
|
@@ -91,7 +104,7 @@ agent-bot server status
|
|
|
91
104
|
停止服务:
|
|
92
105
|
|
|
93
106
|
```powershell
|
|
94
|
-
|
|
107
|
+
agentbot server stop
|
|
95
108
|
```
|
|
96
109
|
|
|
97
110
|
### 更新或卸载
|
|
@@ -99,15 +112,15 @@ agent-bot server stop
|
|
|
99
112
|
替换或移除全局包前,先停止正在运行的服务:
|
|
100
113
|
|
|
101
114
|
```powershell
|
|
102
|
-
|
|
115
|
+
agentbot server stop
|
|
103
116
|
npm install --global @keyou007/agent-bot@latest
|
|
104
|
-
|
|
117
|
+
agentbot server start
|
|
105
118
|
```
|
|
106
119
|
|
|
107
120
|
卸载:
|
|
108
121
|
|
|
109
122
|
```powershell
|
|
110
|
-
|
|
123
|
+
agentbot server stop
|
|
111
124
|
npm uninstall --global @keyou007/agent-bot
|
|
112
125
|
```
|
|
113
126
|
|
|
@@ -118,20 +131,22 @@ npm uninstall --global @keyou007/agent-bot
|
|
|
118
131
|
### 服务管理
|
|
119
132
|
|
|
120
133
|
```powershell
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
134
|
+
agentbot server status
|
|
135
|
+
agentbot server start
|
|
136
|
+
agentbot server stop
|
|
137
|
+
agentbot server restart
|
|
125
138
|
```
|
|
126
139
|
|
|
127
140
|
`server restart` 默认等待当前工作完成后再重启;等待期间可通过状态卡片下方的 `Cancel` 按钮取消。只有可接受中断时才使用 `--immediate`。
|
|
128
141
|
|
|
142
|
+
Windows 下每次启动 Supervisor 或 Worker 都会重新读取最新的系统和用户环境变量。修改 `PATH` 或其他系统环境变量后重启服务即可生效,当前 Profile 选择仍保持隔离。
|
|
143
|
+
|
|
129
144
|
`server status` 会显示当前运行服务使用的 Lark App ID;添加 `--json` 后可从 `feishuAppId` 字段读取。
|
|
130
145
|
|
|
131
146
|
### Console
|
|
132
147
|
|
|
133
148
|
```powershell
|
|
134
|
-
|
|
149
|
+
agentbot console
|
|
135
150
|
```
|
|
136
151
|
|
|
137
152
|
Console UI 不需要飞书凭据。除非传入 `--force`,否则不会与正在运行的 Server 共享任务状态。
|
|
@@ -139,14 +154,18 @@ Console UI 不需要飞书凭据。除非传入 `--force`,否则不会与正
|
|
|
139
154
|
### 任务管理
|
|
140
155
|
|
|
141
156
|
```powershell
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
157
|
+
agentbot task list
|
|
158
|
+
agentbot task status <任务>
|
|
159
|
+
agentbot task prompt <任务> "<prompt>"
|
|
160
|
+
agentbot task newgroup <任务> [标题] [--agent <标准名>] [--dir <路径> | --nodir]
|
|
161
|
+
agentbot task forkgroup <任务> [标题]
|
|
162
|
+
agentbot task title <任务> "<标题>"
|
|
163
|
+
agentbot task stop <任务>
|
|
147
164
|
```
|
|
148
165
|
|
|
149
|
-
`<任务>` 可以是 `task list` 中的序号、任务 ID 或唯一的任务 ID 前缀。运行 `
|
|
166
|
+
`<任务>` 可以是 `task list` 中的序号、任务 ID 或唯一的任务 ID 前缀。运行 `agentbot --help` 可查看完整 CLI 参数。
|
|
167
|
+
|
|
168
|
+
`task newgroup` 会创建飞书群和新任务。默认继承源任务的 Agent 和运行设置;`--agent <标准名>` 可选择另一个已配置的 Agent,此时仍继承源任务的项目形态,但 Provider、模型、思考强度和权限模式使用目标 Agent 自己的 Runtime 默认值。`--dir` 可覆盖项目目录并支持 `~`,`--nodir` 会强制创建 Projectless App Server 任务。`task forkgroup` 从源任务最新可用的已完成 turn 创建分支,不会中断正在执行的 turn。两个命令都要求 Server 正在运行,邀请 Profile 中保存的授权用户,不会切换源会话的当前任务,并支持 `--json`。
|
|
150
169
|
|
|
151
170
|
## 飞书命令
|
|
152
171
|
|
|
@@ -155,7 +174,7 @@ agent-bot task stop <任务>
|
|
|
155
174
|
| 命令 | 作用 |
|
|
156
175
|
| --------------------------------------- | -------------------------- |
|
|
157
176
|
| `/new [标题] [--dir <路径> \| --nodir]` | 创建任务 |
|
|
158
|
-
| `/sessions [关键词]` | 浏览可用的
|
|
177
|
+
| `/sessions [关键词]` | 浏览可用的 App Server 任务 |
|
|
159
178
|
| `/switch [任务]` | 切换任务,或返回上一个任务 |
|
|
160
179
|
| `/fork [任务]` | 创建并打开任务分支 |
|
|
161
180
|
| `/status [任务]` | 查看任务进度和结果 |
|
|
@@ -177,7 +196,7 @@ agent-bot task stop <任务>
|
|
|
177
196
|
|
|
178
197
|
斜杠命令支持任意唯一前缀,复合命令还支持首字母缩写:`/sess` 等同于 `/sessions`,`/fg` 等同于 `/forkgroup`,`/ng` 等同于 `/newgroup`,`/ns` 等同于 `/nosteer`。完整命令名优先;`/s`、`/f` 等匹配多个命令的前缀会被拒绝,并列出全部候选命令。
|
|
179
198
|
|
|
180
|
-
`/agent`、`/provider`、`/model`、`/thinking` 和 `/permissions` 在存在可选项时使用同一张运行设置卡片。配置了多个 Agent 时,卡片会增加 Agent tab,用于选择后续新任务使用的默认 Agent;即使当前聊天还没有任务,`/agent` 也能打开该 tab。只配置一个 Agent 时,`/agent` 直接显示当前 Agent,不打开卡片。现有任务仍保持原来的 Agent,使用不同 Agent 的任务可以相互独立地运行。`/agent <名称>` 继续支持直接选择。没有可切换的 Provider 时,`/provider` 同样只显示当前 Provider。其余四个命令激活各自对应的 tab
|
|
199
|
+
`/agent`、`/provider`、`/model`、`/thinking` 和 `/permissions` 在存在可选项时使用同一张运行设置卡片。配置了多个 Agent 时,卡片会增加 Agent tab,用于选择后续新任务使用的默认 Agent;即使当前聊天还没有任务,`/agent` 也能打开该 tab。只配置一个 Agent 时,`/agent` 直接显示当前 Agent,不打开卡片。现有任务仍保持原来的 Agent,使用不同 Agent 的任务可以相互独立地运行。`/agent <名称>` 继续支持直接选择。没有可切换的 Provider 时,`/provider` 同样只显示当前 Provider。其余四个命令激活各自对应的 tab,且不接受参数。没有可继承设置的新任务使用所选 Agent 的默认 Provider。
|
|
181
200
|
|
|
182
201
|
私聊、群正文和话题分别维护当前任务。可以单独发送图片,也可以同时发送文字和图片。任务运行中发送普通文字会追加指令;需要确保形成后续 turn 时使用 `/queue`(或 `/nosteer`)。
|
|
183
202
|
|
|
@@ -187,11 +206,11 @@ agent-bot task stop <任务>
|
|
|
187
206
|
|
|
188
207
|
`/forkgroup` 创建新群后,群内欢迎消息会显示分支任务当前使用的 Provider、模型、思考强度和权限类型。
|
|
189
208
|
|
|
190
|
-
`/new` 和 `/newgroup` 支持相同的项目参数:使用 `--dir <cwd>` 覆盖继承的项目目录,或使用 `--nodir` 强制创建 Projectless
|
|
209
|
+
`/new` 和 `/newgroup` 支持相同的项目参数:使用 `--dir <cwd>` 覆盖继承的项目目录,或使用 `--nodir` 强制创建 Projectless App Server 任务,二者不能同时使用。两条命令中的 `~`、`~/...` 和 `~\...` 均表示当前用户目录。`/newgroup` 会立即在新群中创建并绑定任务,同时继续继承当前任务的 Provider、模型、思考强度和权限模式,不影响来源任务。来源聊天没有当前任务时,则使用选定 Agent 及其运行时默认设置。显式标题会同时作为群名后缀和任务标题。
|
|
191
210
|
|
|
192
|
-
`/newgroup`
|
|
211
|
+
`/newgroup` 省略标题时,任务标题和群名中的标题部分统一使用 `新任务 (mm-dd)`,默认群名为 `[agent] [project dir] 新任务 (mm-dd)`。Projectless 群会完全省略项目段,群名格式为 `[agent] title`。`/forkgroup` 省略标题时,任务标题和群名都与 `/fork` 一样使用持久递增的 `源标题(分支 N)`,不追加日期。`/newgroup` 和 `/forkgroup` 创建的飞书群名最多显示 60 个字符。生成后的群名过长时,Agent Bot 只截断群名中的标题部分,任务标题本身保持不变。
|
|
193
212
|
|
|
194
|
-
把已绑定任务的群改名为 `[agent] [project dir] title` 时,只会把 `title` 同步到当前任务;Agent
|
|
213
|
+
把已绑定任务的群改名为 `[agent] [project dir] title` 时,只会把 `title` 同步到当前任务;Agent 和工程目录前缀仅作为群元数据,不会写入任务标题。旧的 `[agent] title` 格式仍然兼容。
|
|
195
214
|
|
|
196
215
|
## 配置与数据
|
|
197
216
|
|
|
@@ -213,21 +232,21 @@ Agent Bot 将用户相关文件保存在仓库之外:
|
|
|
213
232
|
不指定 `--profile` 时使用位于 `~/.agent-bot` 的主 Profile。运行其他相互隔离的机器人时,需要在每次命令中显式指定其目录:
|
|
214
233
|
|
|
215
234
|
```powershell
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
235
|
+
agentbot --profile ~/.agent-bot-rescue init
|
|
236
|
+
agentbot --profile ~/.agent-bot-rescue server start
|
|
237
|
+
agentbot --profile ~/.agent-bot-rescue server status
|
|
219
238
|
```
|
|
220
239
|
|
|
221
240
|
其他 Profile 不按名称注册,而是直接使用目录。每个 Profile 都在所选目录内保存自己的 `config.yaml`、`.env`、`data/` 和 `logs/`,飞书凭据与本地控制端点也相互隔离。`--profile` 不能和 `--config` 同时使用。
|
|
222
241
|
|
|
223
242
|
## 常见问题
|
|
224
243
|
|
|
225
|
-
- **机器人没有响应:** 运行 `
|
|
244
|
+
- **机器人没有响应:** 运行 `agentbot server status`,并查看 `~/.agent-bot/logs/agent-bot.log`
|
|
226
245
|
- **Node 崩溃后 Worker 被自动重启:** 查看 `~/.agent-bot/data/last-crash.json`、`~/.agent-bot/logs/worker.stderr.log` 和 `~/.agent-bot/data/crash-reports/`
|
|
227
|
-
- **飞书权限不完整:** 重新运行 `
|
|
228
|
-
- **
|
|
229
|
-
- **只需要本地测试:** 运行 `
|
|
230
|
-
- **安全重启一直等待:** 使用 `
|
|
246
|
+
- **飞书权限不完整:** 重新运行 `agentbot init`,完成显示的授权步骤
|
|
247
|
+
- **Agent 无法启动:** 使用运行 Agent Bot 的同一操作系统用户执行 `codex login status` 或 `traex login status`,然后重新运行 `agentbot init` 检查版本
|
|
248
|
+
- **只需要本地测试:** 运行 `agentbot init --skip-feishu`,然后执行 `agentbot console`
|
|
249
|
+
- **安全重启一直等待:** 使用 `agentbot task list --status running` 检查活动任务
|
|
231
250
|
|
|
232
251
|
## 更多文档
|
|
233
252
|
|
package/config.example.yaml
CHANGED
|
@@ -10,7 +10,7 @@ console:
|
|
|
10
10
|
|
|
11
11
|
agents:
|
|
12
12
|
codex:
|
|
13
|
-
kind: "
|
|
13
|
+
kind: "app-server"
|
|
14
14
|
title: "Codex"
|
|
15
15
|
command: "codex"
|
|
16
16
|
args:
|
|
@@ -21,28 +21,14 @@ agents:
|
|
|
21
21
|
- "stdio://"
|
|
22
22
|
env: {}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
traex:
|
|
25
|
+
kind: "app-server"
|
|
26
|
+
title: "TraeX"
|
|
27
|
+
command: "traex"
|
|
27
28
|
args:
|
|
28
|
-
- "
|
|
29
|
-
- "
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
coco-yolo:
|
|
33
|
-
title: "Coco YOLO"
|
|
34
|
-
command: "coco"
|
|
35
|
-
args:
|
|
36
|
-
- "acp"
|
|
37
|
-
- "serve"
|
|
38
|
-
- "--yolo"
|
|
39
|
-
env: {}
|
|
40
|
-
|
|
41
|
-
example:
|
|
42
|
-
title: "Example ACP Agent"
|
|
43
|
-
command: "node"
|
|
44
|
-
args:
|
|
45
|
-
- "./examples/example-acp-agent.js"
|
|
29
|
+
- "app-server"
|
|
30
|
+
- "--listen"
|
|
31
|
+
- "stdio://"
|
|
46
32
|
env: {}
|
|
47
33
|
|
|
48
34
|
defaults:
|