@keyou007/agent-bot 0.1.10 → 0.1.12

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 (121) hide show
  1. package/.env.example +1 -1
  2. package/CHANGELOG.md +25 -0
  3. package/README.md +55 -43
  4. package/README.zh.md +55 -43
  5. package/assets/agent-bot-logo.png +0 -0
  6. package/config.example.yaml +11 -1
  7. package/dist/acp/AcpSessionManager.js +78 -46
  8. package/dist/acp/AcpSessionManager.js.map +1 -1
  9. package/dist/cli/FeishuAppConfiguration.js +1 -1
  10. package/dist/cli/FeishuAppConfiguration.js.map +1 -1
  11. package/dist/cli/FeishuAppRegistration.js +2 -2
  12. package/dist/cli/FeishuAppRegistration.js.map +1 -1
  13. package/dist/cli/Initializer.js +1 -1
  14. package/dist/cli/Initializer.js.map +1 -1
  15. package/dist/cli/ServerStarter.js +7 -2
  16. package/dist/cli/ServerStarter.js.map +1 -1
  17. package/dist/cli/controlProtocol.js.map +1 -1
  18. package/dist/cli/help.js +20 -16
  19. package/dist/cli/help.js.map +1 -1
  20. package/dist/cli/taskGroupOptions.js +95 -0
  21. package/dist/cli/taskGroupOptions.js.map +1 -0
  22. package/dist/cli.js +74 -2
  23. package/dist/cli.js.map +1 -1
  24. package/dist/codex/AppServerConnection.js +15 -1
  25. package/dist/codex/AppServerConnection.js.map +1 -1
  26. package/dist/codex/CodexLocalActivityDetector.js +4 -1
  27. package/dist/codex/CodexLocalActivityDetector.js.map +1 -1
  28. package/dist/codex/CodexProcessManager.js +1 -0
  29. package/dist/codex/CodexProcessManager.js.map +1 -1
  30. package/dist/codex/CodexRuntime.js +112 -11
  31. package/dist/codex/CodexRuntime.js.map +1 -1
  32. package/dist/commands/CommandRouter.js +64 -49
  33. package/dist/commands/CommandRouter.js.map +1 -1
  34. package/dist/config/loadConfig.js +11 -1
  35. package/dist/config/loadConfig.js.map +1 -1
  36. package/dist/config/schema.js +6 -1
  37. package/dist/config/schema.js.map +1 -1
  38. package/dist/console/ConsoleConnector.js +1 -1
  39. package/dist/console/ConsoleConnector.js.map +1 -1
  40. package/dist/console/ConsoleTurnPresenter.js +15 -8
  41. package/dist/console/ConsoleTurnPresenter.js.map +1 -1
  42. package/dist/deprecated-cli.js +5 -0
  43. package/dist/deprecated-cli.js.map +1 -0
  44. package/dist/feishu/CardRenderer.js +350 -15
  45. package/dist/feishu/CardRenderer.js.map +1 -1
  46. package/dist/feishu/FeishuMessageClient.js +51 -5
  47. package/dist/feishu/FeishuMessageClient.js.map +1 -1
  48. package/dist/feishu/FeishuTurnPresenter.js +17 -8
  49. package/dist/feishu/FeishuTurnPresenter.js.map +1 -1
  50. package/dist/feishu/transport.js +1 -1
  51. package/dist/feishu/transport.js.map +1 -1
  52. package/dist/index.js +38 -19
  53. package/dist/index.js.map +1 -1
  54. package/dist/presentation/OutboundRouter.js +2 -2
  55. package/dist/presentation/OutboundRouter.js.map +1 -1
  56. package/dist/presentation/TurnStateReducer.js +2 -1
  57. package/dist/presentation/TurnStateReducer.js.map +1 -1
  58. package/dist/proxy/ProxySessionController.js +665 -225
  59. package/dist/proxy/ProxySessionController.js.map +1 -1
  60. package/dist/runtime/AcpRuntimeAdapter.js +1 -0
  61. package/dist/runtime/AcpRuntimeAdapter.js.map +1 -1
  62. package/dist/runtime/AgentRuntimeRegistry.js +7 -4
  63. package/dist/runtime/AgentRuntimeRegistry.js.map +1 -1
  64. package/dist/runtime/createAgentRuntimeRegistry.js +22 -0
  65. package/dist/runtime/createAgentRuntimeRegistry.js.map +1 -0
  66. package/dist/startup/SessionMetadataHydrator.js +2 -2
  67. package/dist/startup/SessionMetadataHydrator.js.map +1 -1
  68. package/dist/startup/StartupNotifier.js +1 -0
  69. package/dist/startup/StartupNotifier.js.map +1 -1
  70. package/dist/state/StateStore.js +21 -15
  71. package/dist/state/StateStore.js.map +1 -1
  72. package/dist/supervision/SafeRestartScheduler.js +5 -0
  73. package/dist/supervision/SafeRestartScheduler.js.map +1 -1
  74. package/dist/supervision/systemEnvironment.js +129 -0
  75. package/dist/supervision/systemEnvironment.js.map +1 -0
  76. package/dist/supervisor.js +13 -1
  77. package/dist/supervisor.js.map +1 -1
  78. package/docs/technical-reference.md +35 -21
  79. package/docs/technical-reference.zh.md +35 -21
  80. package/npm-shrinkwrap.json +4 -3
  81. package/package.json +4 -2
  82. package/skills/agent-bot/SKILL.md +73 -30
  83. package/src/acp/AcpSessionManager.ts +73 -54
  84. package/src/cli/FeishuAppConfiguration.ts +2 -2
  85. package/src/cli/FeishuAppRegistration.ts +4 -4
  86. package/src/cli/Initializer.ts +2 -2
  87. package/src/cli/ServerStarter.ts +8 -3
  88. package/src/cli/controlProtocol.ts +21 -1
  89. package/src/cli/help.ts +20 -16
  90. package/src/cli/taskGroupOptions.ts +149 -0
  91. package/src/cli.ts +98 -4
  92. package/src/codex/AppServerConnection.ts +21 -1
  93. package/src/codex/CodexLocalActivityDetector.ts +8 -1
  94. package/src/codex/CodexProcessManager.ts +1 -0
  95. package/src/codex/CodexRuntime.ts +137 -15
  96. package/src/commands/CommandRouter.ts +71 -49
  97. package/src/commands/commandTypes.ts +6 -11
  98. package/src/config/loadConfig.ts +11 -1
  99. package/src/config/schema.ts +7 -1
  100. package/src/console/ConsoleConnector.ts +1 -1
  101. package/src/console/ConsoleTurnPresenter.ts +21 -8
  102. package/src/deprecated-cli.ts +9 -0
  103. package/src/feishu/CardRenderer.ts +423 -15
  104. package/src/feishu/FeishuMessageClient.ts +66 -3
  105. package/src/feishu/FeishuTurnPresenter.ts +22 -3
  106. package/src/feishu/transport.ts +1 -1
  107. package/src/index.ts +54 -24
  108. package/src/presentation/OutboundRouter.ts +15 -3
  109. package/src/presentation/TurnStateReducer.ts +2 -0
  110. package/src/presentation/turnViewTypes.ts +1 -0
  111. package/src/proxy/ProxySessionController.ts +870 -228
  112. package/src/runtime/AcpRuntimeAdapter.ts +1 -0
  113. package/src/runtime/AgentRuntimeRegistry.ts +7 -6
  114. package/src/runtime/createAgentRuntimeRegistry.ts +25 -0
  115. package/src/runtime/types.ts +18 -0
  116. package/src/startup/SessionMetadataHydrator.ts +2 -2
  117. package/src/startup/StartupNotifier.ts +1 -0
  118. package/src/state/StateStore.ts +29 -15
  119. package/src/supervision/SafeRestartScheduler.ts +5 -0
  120. package/src/supervision/systemEnvironment.ts +174 -0
  121. package/src/supervisor.ts +12 -1
package/.env.example CHANGED
@@ -1,4 +1,4 @@
1
- # agent-bot init fills these through Feishu one-click registration.
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,31 @@ The project follows [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.1.12] - 2026-08-03
10
+
11
+ - Add a ready-to-use TraeX App Server example to the checked-in and generated default configuration.
12
+ - 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.
13
+ - 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.
14
+ - 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.
15
+ - 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.
16
+ - 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.
17
+ - 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.
18
+
19
+ ## [0.1.11] - 2026-08-02
20
+
21
+ - 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.
22
+ - Use a shorter image-only prompt that asks the active Agent to inspect the attached image.
23
+ - Reduce the packaged project logo size without changing the documented asset path.
24
+ - Keep `/new` and `/newgroup` project options aligned: both support `--dir <cwd>` with `~`-based home-directory paths and `--nodir` for a forced Projectless Codex task, while `/newgroup` continues to inherit execution settings from the source task.
25
+ - Send `excludeTurns: true` by default for every Codex fork, reducing response size without removing branch history, and retry once without the experimental field when an older App Server explicitly rejects it.
26
+ - Remove obsolete `/mode`, `/modes`, `/ask`, `/agents`, and `/use` commands, consolidating Agent selection under `/agent`.
27
+ - Omit the `[Projectless]` segment from `/newgroup` and `/forkgroup` group names while preserving Projectless task behavior.
28
+ - Add a unified execution-settings card with Provider, Model, Thinking, and Permission tabs plus an Agent tab when multiple agents are configured; route multi-option Agent and Provider selection through the same card, report their current value directly when no alternative exists, persist and inherit Provider across task lifecycle operations, and leave new tasks on the Codex-configured default Provider.
29
+ - Make Feishu `/restart` schedule a safe restart by default, with `/restart --force` as the only immediate-restart form.
30
+ - Preserve Windows separators before dot-prefixed directories in Feishu file-change summaries instead of letting Markdown consume the separator as an escape.
31
+ - Isolate every configured Agent by standard name with its own process and runtime connection, aggregate Codex tasks across those isolated runtimes, and scope persisted remote task identities by Agent.
32
+ - Add the Agent Bot logo to both READMEs and include the high-resolution PNG in the npm package.
33
+
9
34
  ## [0.1.10] - 2026-08-01
10
35
 
11
36
  - Open a filtered Feishu Developer Console permission page for manual `im:message.group_msg` setup instead of incorrectly including the unsupported scope in one-click configuration; allow `Y` to skip its wait and report the resulting mention-only group behavior.
package/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ <p align="center">
2
+ <img src="assets/agent-bot-logo.png" alt="Agent Bot logo" width="180">
3
+ </p>
4
+
1
5
  # Agent Bot
2
6
 
3
7
  Use local Codex and ACP agents directly from Feishu.
@@ -33,21 +37,21 @@ codex login status
33
37
 
34
38
  ```powershell
35
39
  npm install --global @keyou007/agent-bot
36
- agent-bot --version
37
- agent-bot --help
40
+ agentbot --version
41
+ agentbot --help
38
42
  ```
39
43
 
40
- This installs the `agent-bot` command globally. 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.
44
+ 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.
41
45
 
42
46
  ### Initialize
43
47
 
44
48
  ```powershell
45
- agent-bot init
49
+ agentbot init
46
50
  ```
47
51
 
48
52
  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.
49
53
 
50
- 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 `agent-bot init` creates a new bot. If credentials were saved, initialization resumes by auditing that bot's remote permissions and subscriptions.
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 `agentbot init` creates a new bot. If credentials were saved, initialization resumes by auditing that bot's remote permissions and subscriptions.
51
55
 
52
56
  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.
53
57
 
@@ -62,12 +66,12 @@ When optional permissions or subscriptions are missing, Agent Bot first shows th
62
66
  | `--profile <directory>`| Use an isolated profile directory |
63
67
  | `--config <path>` | Use a specific configuration file |
64
68
 
65
- You can rerun `agent-bot init` later to check or complete the bot configuration. If the server is already running, initialization leaves it running.
69
+ You can rerun `agentbot init` later to check or complete the bot configuration. If the server is already running, initialization leaves it running.
66
70
 
67
71
  To fully reconfigure a Profile, stop its server and select the Profile explicitly:
68
72
 
69
73
  ```powershell
70
- agent-bot --profile ~/.agent-bot init --reset
74
+ agentbot --profile ~/.agent-bot init --reset
71
75
  ```
72
76
 
73
77
  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.
@@ -75,10 +79,10 @@ Reset moves the active `config.yaml`, `.env`, `data/`, and `logs/` into a new ti
75
79
  ### Start And Stop
76
80
 
77
81
  ```powershell
78
- agent-bot server status
82
+ agentbot server status
79
83
  ```
80
84
 
81
- `agent-bot init` starts the server automatically. If you stop it later, run `agent-bot server start` to start it again. For local-only use, initialize with `--skip-feishu` and run `agent-bot console` instead.
85
+ `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.
82
86
 
83
87
  The `Agent Bot 已启动` startup card shows the version of Agent Bot currently running.
84
88
 
@@ -87,7 +91,7 @@ Open Feishu, find the bot, and send a message. Agent Bot automatically creates a
87
91
  Stop the service with:
88
92
 
89
93
  ```powershell
90
- agent-bot server stop
94
+ agentbot server stop
91
95
  ```
92
96
 
93
97
  ### Update Or Uninstall
@@ -95,15 +99,15 @@ agent-bot server stop
95
99
  Stop the running service before replacing or removing the global package:
96
100
 
97
101
  ```powershell
98
- agent-bot server stop
102
+ agentbot server stop
99
103
  npm install --global @keyou007/agent-bot@latest
100
- agent-bot server start
104
+ agentbot server start
101
105
  ```
102
106
 
103
107
  To uninstall:
104
108
 
105
109
  ```powershell
106
- agent-bot server stop
110
+ agentbot server stop
107
111
  npm uninstall --global @keyou007/agent-bot
108
112
  ```
109
113
 
@@ -114,20 +118,22 @@ Uninstalling the npm package does not delete your data under `~/.agent-bot`.
114
118
  ### Service
115
119
 
116
120
  ```powershell
117
- agent-bot server status
118
- agent-bot server start
119
- agent-bot server stop
120
- agent-bot server restart
121
+ agentbot server status
122
+ agentbot server start
123
+ agentbot server stop
124
+ agentbot server restart
121
125
  ```
122
126
 
123
127
  `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.
124
128
 
129
+ 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.
130
+
125
131
  `server status` shows the Lark App ID used by the running server. Add `--json` to read it from `feishuAppId`.
126
132
 
127
133
  ### Console
128
134
 
129
135
  ```powershell
130
- agent-bot console
136
+ agentbot console
131
137
  ```
132
138
 
133
139
  The Console UI works without Feishu credentials. It will not share task state with a running server unless `--force` is supplied.
@@ -135,14 +141,18 @@ The Console UI works without Feishu credentials. It will not share task state wi
135
141
  ### Tasks
136
142
 
137
143
  ```powershell
138
- agent-bot task list
139
- agent-bot task status <task>
140
- agent-bot task prompt <task> "<prompt>"
141
- agent-bot task title <task> "<title>"
142
- agent-bot task stop <task>
144
+ agentbot task list
145
+ agentbot task status <task>
146
+ agentbot task prompt <task> "<prompt>"
147
+ agentbot task newgroup <task> [title] [--agent <name>] [--dir <path> | --nodir]
148
+ agentbot task forkgroup <task> [title]
149
+ agentbot task title <task> "<title>"
150
+ agentbot task stop <task>
143
151
  ```
144
152
 
145
- `<task>` can be a number from `task list`, a task ID, or an unambiguous task-ID prefix. Run `agent-bot --help` for all CLI options.
153
+ `<task>` can be a number from `task list`, a task ID, or an unambiguous task-ID prefix. Run `agentbot --help` for all CLI options.
154
+
155
+ `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`.
146
156
 
147
157
  ## Feishu Commands
148
158
 
@@ -151,7 +161,7 @@ Plain text continues the current task. Messages beginning with `/` are commands.
151
161
  | Command | Purpose |
152
162
  | ---------------------------------------- | ------------------------------------------- |
153
163
  | `/new [title] [--dir <path> \| --nodir]` | Create a task |
154
- | `/sessions [keyword]` | Browse available Codex tasks |
164
+ | `/sessions [keyword]` | Browse available App Server tasks |
155
165
  | `/switch [task]` | Switch tasks or return to the previous task |
156
166
  | `/fork [task]` | Create and open a task branch |
157
167
  | `/status [task]` | View task progress and results |
@@ -160,32 +170,34 @@ Plain text continues the current task. Messages beginning with `/` are commands.
160
170
  | `/queue <prompt>` | Queue a separate follow-up Prompt |
161
171
  | `/nosteer <prompt>` | Same as `/queue` |
162
172
  | `/goal [objective]` | View or manage a persistent Goal |
163
- | `/model [name]` | View or change the model |
164
- | `/thinking [level]` | View or change reasoning effort |
165
- | `/permissions auto\|confirm` | Change tool approval behavior |
166
- | `/newgroup [title]` | Create a private group for a new task |
173
+ | `/provider` | Open execution settings on the Provider tab |
174
+ | `/model` | Open execution settings on the Model tab |
175
+ | `/thinking` | Open execution settings on the Thinking tab |
176
+ | `/permissions` | Open execution settings on the Permission tab |
177
+ | `/newgroup [title] [--dir <cwd> \| --nodir]` | Create a private group for a new task |
167
178
  | `/forkgroup [title]` | Fork the current position into a private group |
168
- | `/agent [name]` | View or change the default agent |
169
- | `/use <agent> [cwd]` | Select an agent and create a task |
179
+ | `/agent [name]` | Open Agent settings or select the default Agent |
170
180
  | `! <command>` | Run a local command in the task directory |
171
- | `/restart` | Gracefully restart Agent Bot |
181
+ | `/restart [--force]` | Restart safely, or immediately with `--force` |
172
182
  | `/help` | Show in-chat help |
173
183
 
174
184
  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.
175
185
 
186
+ `/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 from your Codex configuration.
187
+
176
188
  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.
177
189
 
178
190
  The `/sessions` card provides `NewGroup` and `ForkGroup` actions for each task, so you can create a project-matched group or fork a selected task directly into a new group.
179
191
 
180
192
  Inside a thread, `/forkgroup` forks from the thread's original turn until the thread task completes its own turn. After that, it forks from the thread task's latest completed turn. A currently running turn is never used as a fork point.
181
193
 
182
- After `/forkgroup` creates the new group, its welcome message shows the forked task's current model, reasoning effort, and permission type.
194
+ After `/forkgroup` creates the new group, its welcome message shows the forked task's current Provider, model, reasoning effort, and permission type.
183
195
 
184
- `/newgroup` immediately creates a new task in the new group. It inherits the current task's project directory, 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.
196
+ `/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.
185
197
 
186
- When `/newgroup` omits the title, the task title is `新任务` and the default group name is `[agent] [project dir] 新任务 (mm-dd)`. 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.
198
+ 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.
187
199
 
188
- 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 Codex task title. The older `[agent] title` format remains supported.
200
+ 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.
189
201
 
190
202
  ## Configuration And Data
191
203
 
@@ -207,21 +219,21 @@ By default, Agent Bot responds to ordinary messages in groups containing the bot
207
219
  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:
208
220
 
209
221
  ```powershell
210
- agent-bot --profile ~/.agent-bot-rescue init
211
- agent-bot --profile ~/.agent-bot-rescue server start
212
- agent-bot --profile ~/.agent-bot-rescue server status
222
+ agentbot --profile ~/.agent-bot-rescue init
223
+ agentbot --profile ~/.agent-bot-rescue server start
224
+ agentbot --profile ~/.agent-bot-rescue server status
213
225
  ```
214
226
 
215
227
  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`.
216
228
 
217
229
  ## Troubleshooting
218
230
 
219
- - **The bot does not respond:** run `agent-bot server status` and check `~/.agent-bot/logs/agent-bot.log`.
231
+ - **The bot does not respond:** run `agentbot server status` and check `~/.agent-bot/logs/agent-bot.log`.
220
232
  - **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/`.
221
- - **Feishu permissions are incomplete:** rerun `agent-bot init` and follow the displayed authorization steps.
233
+ - **Feishu permissions are incomplete:** rerun `agentbot init` and follow the displayed authorization steps.
222
234
  - **Codex cannot start:** run `codex login status` as the same operating-system user that runs Agent Bot.
223
- - **You only need local testing:** run `agent-bot init --skip-feishu`, then `agent-bot console`.
224
- - **A safe restart keeps waiting:** inspect active tasks with `agent-bot task list --status running`.
235
+ - **You only need local testing:** run `agentbot init --skip-feishu`, then `agentbot console`.
236
+ - **A safe restart keeps waiting:** inspect active tasks with `agentbot task list --status running`.
225
237
 
226
238
  ## More Documentation
227
239
 
package/README.zh.md CHANGED
@@ -1,3 +1,7 @@
1
+ <p align="center">
2
+ <img src="assets/agent-bot-logo.png" alt="Agent Bot Logo" width="180">
3
+ </p>
4
+
1
5
  # Agent Bot
2
6
 
3
7
  通过飞书使用本机上的 Codex 和 ACP Agent。
@@ -33,21 +37,21 @@ codex login status
33
37
 
34
38
  ```powershell
35
39
  npm install --global @keyou007/agent-bot
36
- agent-bot --version
37
- agent-bot --help
40
+ agentbot --version
41
+ agentbot --help
38
42
  ```
39
43
 
40
- 该命令会全局安装 `agent-bot`。命令行帮助、状态、进度、交互提示和错误会根据系统语言显示中文或英文;其他未支持语言统一回退英文。JSON 输出不做本地化并保持字段稳定。从源码安装的方法见[技术参考](docs/technical-reference.zh.md#开发与源码安装)。
44
+ 该命令会把 `agentbot` 安装为主命令。旧的 `agent-bot` 命令暂时保留,运行时会显示弃用警告,并将在后续版本中移除。命令行帮助、状态、进度、交互提示和错误会根据系统语言显示中文或英文;其他未支持语言统一回退英文。JSON 输出不做本地化并保持字段稳定。从源码安装的方法见[技术参考](docs/technical-reference.zh.md#开发与源码安装)。
41
45
 
42
46
  ### 初始化
43
47
 
44
48
  ```powershell
45
- agent-bot init
49
+ agentbot init
46
50
  ```
47
51
 
48
52
  打开命令显示的链接或扫描二维码,完成飞书机器人创建和授权。初始化会准备 `~/.agent-bot`、保存机器人凭据和授权用户、检查所需权限,并自动启动 Agent Bot。
49
53
 
50
- 只有 App ID 和 App Secret 都已保存到本地才视为机器人创建成功。如果初始化在完整凭据保存前中断,再次运行 `agent-bot init` 会创建新机器人;如果凭据已经保存,则会继续检查该机器人的远端权限和订阅。
54
+ 只有 App ID 和 App Secret 都已保存到本地才视为机器人创建成功。如果初始化在完整凭据保存前中断,再次运行 `agentbot init` 会创建新机器人;如果凭据已经保存,则会继续检查该机器人的远端权限和订阅。
51
55
 
52
56
  `im:message.group_msg` 无法通过飞书一键配置新增。缺少该权限时,Agent Bot 会显示二维码,以及已筛选该权限的开发者后台直达链接。请手动新增权限、发布应用版本,并在需要时完成租户管理员审批。Agent Bot 等待权限生效时,可输入 `Y` 跳过该权限并继续初始化;最终结果会提示机器人无法响应未 @ 它的普通群消息。
53
57
 
@@ -62,12 +66,12 @@ agent-bot init
62
66
  | `--profile <目录>` | 使用指定目录中的独立 Profile |
63
67
  | `--config <路径>` | 使用指定配置文件 |
64
68
 
65
- 之后可以重新运行 `agent-bot init` 检查或补齐机器人配置。如果 Server 已在运行,初始化会保留当前服务。
69
+ 之后可以重新运行 `agentbot init` 检查或补齐机器人配置。如果 Server 已在运行,初始化会保留当前服务。
66
70
 
67
71
  如需完整重新配置一个 Profile,请先停止它的 Server,并显式指定 Profile:
68
72
 
69
73
  ```powershell
70
- agent-bot --profile ~/.agent-bot init --reset
74
+ agentbot --profile ~/.agent-bot init --reset
71
75
  ```
72
76
 
73
77
  重置会把当前 `config.yaml`、`.env`、`data/` 和 `logs/` 移入 `.reset-backups` 下新的时间戳目录,再创建干净的新文件和目录。已有备份会永久保留,不会被后续重置覆盖或清理。远端旧飞书应用不会被删除。
@@ -75,10 +79,10 @@ agent-bot --profile ~/.agent-bot init --reset
75
79
  ### 启动与停止
76
80
 
77
81
  ```powershell
78
- agent-bot server status
82
+ agentbot server status
79
83
  ```
80
84
 
81
- `agent-bot init` 会自动启动 Server。之后如果手动停止了服务,可执行 `agent-bot server start` 再次启动。仅在本地使用时,请通过 `--skip-feishu` 初始化并运行 `agent-bot console`。
85
+ `agentbot init` 会自动启动 Server。之后如果手动停止了服务,可执行 `agentbot server start` 再次启动。仅在本地使用时,请通过 `--skip-feishu` 初始化并运行 `agentbot console`。
82
86
 
83
87
  `Agent Bot 已启动` 启动卡片会显示当前正在运行的 Agent Bot 版本。
84
88
 
@@ -87,7 +91,7 @@ agent-bot server status
87
91
  停止服务:
88
92
 
89
93
  ```powershell
90
- agent-bot server stop
94
+ agentbot server stop
91
95
  ```
92
96
 
93
97
  ### 更新或卸载
@@ -95,15 +99,15 @@ agent-bot server stop
95
99
  替换或移除全局包前,先停止正在运行的服务:
96
100
 
97
101
  ```powershell
98
- agent-bot server stop
102
+ agentbot server stop
99
103
  npm install --global @keyou007/agent-bot@latest
100
- agent-bot server start
104
+ agentbot server start
101
105
  ```
102
106
 
103
107
  卸载:
104
108
 
105
109
  ```powershell
106
- agent-bot server stop
110
+ agentbot server stop
107
111
  npm uninstall --global @keyou007/agent-bot
108
112
  ```
109
113
 
@@ -114,20 +118,22 @@ npm uninstall --global @keyou007/agent-bot
114
118
  ### 服务管理
115
119
 
116
120
  ```powershell
117
- agent-bot server status
118
- agent-bot server start
119
- agent-bot server stop
120
- agent-bot server restart
121
+ agentbot server status
122
+ agentbot server start
123
+ agentbot server stop
124
+ agentbot server restart
121
125
  ```
122
126
 
123
127
  `server restart` 默认等待当前工作完成后再重启;等待期间可通过状态卡片下方的 `Cancel` 按钮取消。只有可接受中断时才使用 `--immediate`。
124
128
 
129
+ Windows 下每次启动 Supervisor 或 Worker 都会重新读取最新的系统和用户环境变量。修改 `PATH` 或其他系统环境变量后重启服务即可生效,当前 Profile 选择仍保持隔离。
130
+
125
131
  `server status` 会显示当前运行服务使用的 Lark App ID;添加 `--json` 后可从 `feishuAppId` 字段读取。
126
132
 
127
133
  ### Console
128
134
 
129
135
  ```powershell
130
- agent-bot console
136
+ agentbot console
131
137
  ```
132
138
 
133
139
  Console UI 不需要飞书凭据。除非传入 `--force`,否则不会与正在运行的 Server 共享任务状态。
@@ -135,14 +141,18 @@ Console UI 不需要飞书凭据。除非传入 `--force`,否则不会与正
135
141
  ### 任务管理
136
142
 
137
143
  ```powershell
138
- agent-bot task list
139
- agent-bot task status <任务>
140
- agent-bot task prompt <任务> "<prompt>"
141
- agent-bot task title <任务> "<标题>"
142
- agent-bot task stop <任务>
144
+ agentbot task list
145
+ agentbot task status <任务>
146
+ agentbot task prompt <任务> "<prompt>"
147
+ agentbot task newgroup <任务> [标题] [--agent <标准名>] [--dir <路径> | --nodir]
148
+ agentbot task forkgroup <任务> [标题]
149
+ agentbot task title <任务> "<标题>"
150
+ agentbot task stop <任务>
143
151
  ```
144
152
 
145
- `<任务>` 可以是 `task list` 中的序号、任务 ID 或唯一的任务 ID 前缀。运行 `agent-bot --help` 可查看完整 CLI 参数。
153
+ `<任务>` 可以是 `task list` 中的序号、任务 ID 或唯一的任务 ID 前缀。运行 `agentbot --help` 可查看完整 CLI 参数。
154
+
155
+ `task newgroup` 会创建飞书群和新任务。默认继承源任务的 Agent 和运行设置;`--agent <标准名>` 可选择另一个已配置的 Agent,此时仍继承源任务的项目形态,但 Provider、模型、思考强度和权限模式使用目标 Agent 自己的 Runtime 默认值。`--dir` 可覆盖项目目录并支持 `~`,`--nodir` 会强制创建 Projectless App Server 任务。`task forkgroup` 从源任务最新可用的已完成 turn 创建分支,不会中断正在执行的 turn。两个命令都要求 Server 正在运行,邀请 Profile 中保存的授权用户,不会切换源会话的当前任务,并支持 `--json`。
146
156
 
147
157
  ## 飞书命令
148
158
 
@@ -151,7 +161,7 @@ agent-bot task stop <任务>
151
161
  | 命令 | 作用 |
152
162
  | --------------------------------------- | -------------------------- |
153
163
  | `/new [标题] [--dir <路径> \| --nodir]` | 创建任务 |
154
- | `/sessions [关键词]` | 浏览可用的 Codex 任务 |
164
+ | `/sessions [关键词]` | 浏览可用的 App Server 任务 |
155
165
  | `/switch [任务]` | 切换任务,或返回上一个任务 |
156
166
  | `/fork [任务]` | 创建并打开任务分支 |
157
167
  | `/status [任务]` | 查看任务进度和结果 |
@@ -160,32 +170,34 @@ agent-bot task stop <任务>
160
170
  | `/queue <prompt>` | 排队一个独立的后续 Prompt |
161
171
  | `/nosteer <prompt>` | 与 `/queue` 相同 |
162
172
  | `/goal [目标]` | 查看或管理持久 Goal |
163
- | `/model [名称]` | 查看或切换模型 |
164
- | `/thinking [级别]` | 查看或切换思考强度 |
165
- | `/permissions auto\|confirm` | 修改工具授权方式 |
166
- | `/newgroup [标题]` | 为新任务创建私有群 |
173
+ | `/provider` | 打开运行设置的 Provider tab |
174
+ | `/model` | 打开运行设置的 Model tab |
175
+ | `/thinking` | 打开运行设置的 Thinking tab |
176
+ | `/permissions` | 打开运行设置的 Permission tab |
177
+ | `/newgroup [标题] [--dir <cwd> \| --nodir]` | 为新任务创建私有群 |
167
178
  | `/forkgroup [标题]` | 将当前位置分支到私有群 |
168
- | `/agent [名称]` | 查看或切换默认 Agent |
169
- | `/use <agent> [cwd]` | 选择 Agent 并创建任务 |
179
+ | `/agent [名称]` | 打开 Agent 设置或切换默认 Agent |
170
180
  | `! <命令>` | 在任务目录执行本地命令 |
171
- | `/restart` | 优雅重启 Agent Bot |
181
+ | `/restart [--force]` | 默认安全重启;`--force` 立即重启 |
172
182
  | `/help` | 显示聊天内帮助 |
173
183
 
174
184
  斜杠命令支持任意唯一前缀,复合命令还支持首字母缩写:`/sess` 等同于 `/sessions`,`/fg` 等同于 `/forkgroup`,`/ng` 等同于 `/newgroup`,`/ns` 等同于 `/nosteer`。完整命令名优先;`/s`、`/f` 等匹配多个命令的前缀会被拒绝,并列出全部候选命令。
175
185
 
186
+ `/agent`、`/provider`、`/model`、`/thinking` 和 `/permissions` 在存在可选项时使用同一张运行设置卡片。配置了多个 Agent 时,卡片会增加 Agent tab,用于选择后续新任务使用的默认 Agent;即使当前聊天还没有任务,`/agent` 也能打开该 tab。只配置一个 Agent 时,`/agent` 直接显示当前 Agent,不打开卡片。现有任务仍保持原来的 Agent,使用不同 Agent 的任务可以相互独立地运行。`/agent <名称>` 继续支持直接选择。没有可切换的 Provider 时,`/provider` 同样只显示当前 Provider。其余四个命令激活各自对应的 tab,且不接受参数。没有可继承设置的新任务使用 Codex 配置中的默认 Provider。
187
+
176
188
  私聊、群正文和话题分别维护当前任务。可以单独发送图片,也可以同时发送文字和图片。任务运行中发送普通文字会追加指令;需要确保形成后续 turn 时使用 `/queue`(或 `/nosteer`)。
177
189
 
178
190
  `/sessions` 卡片为每个任务提供 `NewGroup` 和 `ForkGroup` 操作,可直接按所选任务创建同项目的新群,或把所选任务 Fork 到新群。
179
191
 
180
192
  在话题中使用 `/forkgroup` 时,如果话题任务还没有完成过自己的 turn,则从话题原始 turn fork;完成过后则从话题任务最近完成的 turn fork。正在执行的 turn 不会作为 fork 点。
181
193
 
182
- `/forkgroup` 创建新群后,群内欢迎消息会显示分支任务当前使用的模型、思考强度和权限类型。
194
+ `/forkgroup` 创建新群后,群内欢迎消息会显示分支任务当前使用的 Provider、模型、思考强度和权限类型。
183
195
 
184
- `/newgroup` 会立即在新群中创建并绑定一个新任务。新任务继承当前任务的项目目录、模型、思考强度和权限模式,不影响来源任务;来源聊天没有当前任务时,则使用选定 Agent 及其运行时默认设置。显式标题会同时作为群名后缀和任务标题。
196
+ `/new` 和 `/newgroup` 支持相同的项目参数:使用 `--dir <cwd>` 覆盖继承的项目目录,或使用 `--nodir` 强制创建 Projectless App Server 任务,二者不能同时使用。两条命令中的 `~`、`~/...` 和 `~\...` 均表示当前用户目录。`/newgroup` 会立即在新群中创建并绑定任务,同时继续继承当前任务的 Provider、模型、思考强度和权限模式,不影响来源任务。来源聊天没有当前任务时,则使用选定 Agent 及其运行时默认设置。显式标题会同时作为群名后缀和任务标题。
185
197
 
186
- `/newgroup` 省略标题时,任务标题为 `新任务`,默认群名为 `[agent] [project dir] 新任务 (mm-dd)`。`/forkgroup` 省略标题时,任务标题和群名都与 `/fork` 一样使用持久递增的 `源标题(分支 N)`,不追加日期。`/newgroup` 和 `/forkgroup` 创建的飞书群名最多显示 60 个字符。生成后的群名过长时,Agent Bot 只截断群名中的标题部分,任务标题本身保持不变。
198
+ `/newgroup` 省略标题时,任务标题和群名中的标题部分统一使用 `新任务 (mm-dd)`,默认群名为 `[agent] [project dir] 新任务 (mm-dd)`。Projectless 群会完全省略项目段,群名格式为 `[agent] title`。`/forkgroup` 省略标题时,任务标题和群名都与 `/fork` 一样使用持久递增的 `源标题(分支 N)`,不追加日期。`/newgroup` 和 `/forkgroup` 创建的飞书群名最多显示 60 个字符。生成后的群名过长时,Agent Bot 只截断群名中的标题部分,任务标题本身保持不变。
187
199
 
188
- 把已绑定任务的群改名为 `[agent] [project dir] title` 时,只会把 `title` 同步到当前任务;Agent 和工程目录前缀仅作为群元数据,不会写入 Codex 任务标题。旧的 `[agent] title` 格式仍然兼容。
200
+ 把已绑定任务的群改名为 `[agent] [project dir] title` 时,只会把 `title` 同步到当前任务;Agent 和工程目录前缀仅作为群元数据,不会写入任务标题。旧的 `[agent] title` 格式仍然兼容。
189
201
 
190
202
  ## 配置与数据
191
203
 
@@ -207,21 +219,21 @@ Agent Bot 将用户相关文件保存在仓库之外:
207
219
  不指定 `--profile` 时使用位于 `~/.agent-bot` 的主 Profile。运行其他相互隔离的机器人时,需要在每次命令中显式指定其目录:
208
220
 
209
221
  ```powershell
210
- agent-bot --profile ~/.agent-bot-rescue init
211
- agent-bot --profile ~/.agent-bot-rescue server start
212
- agent-bot --profile ~/.agent-bot-rescue server status
222
+ agentbot --profile ~/.agent-bot-rescue init
223
+ agentbot --profile ~/.agent-bot-rescue server start
224
+ agentbot --profile ~/.agent-bot-rescue server status
213
225
  ```
214
226
 
215
227
  其他 Profile 不按名称注册,而是直接使用目录。每个 Profile 都在所选目录内保存自己的 `config.yaml`、`.env`、`data/` 和 `logs/`,飞书凭据与本地控制端点也相互隔离。`--profile` 不能和 `--config` 同时使用。
216
228
 
217
229
  ## 常见问题
218
230
 
219
- - **机器人没有响应:** 运行 `agent-bot server status`,并查看 `~/.agent-bot/logs/agent-bot.log`
231
+ - **机器人没有响应:** 运行 `agentbot server status`,并查看 `~/.agent-bot/logs/agent-bot.log`
220
232
  - **Node 崩溃后 Worker 被自动重启:** 查看 `~/.agent-bot/data/last-crash.json`、`~/.agent-bot/logs/worker.stderr.log` 和 `~/.agent-bot/data/crash-reports/`
221
- - **飞书权限不完整:** 重新运行 `agent-bot init`,完成显示的授权步骤
233
+ - **飞书权限不完整:** 重新运行 `agentbot init`,完成显示的授权步骤
222
234
  - **Codex 无法启动:** 使用运行 Agent Bot 的同一操作系统用户执行 `codex login status`
223
- - **只需要本地测试:** 运行 `agent-bot init --skip-feishu`,然后执行 `agent-bot console`
224
- - **安全重启一直等待:** 使用 `agent-bot task list --status running` 检查活动任务
235
+ - **只需要本地测试:** 运行 `agentbot init --skip-feishu`,然后执行 `agentbot console`
236
+ - **安全重启一直等待:** 使用 `agentbot task list --status running` 检查活动任务
225
237
 
226
238
  ## 更多文档
227
239
 
Binary file
@@ -10,7 +10,7 @@ console:
10
10
 
11
11
  agents:
12
12
  codex:
13
- kind: "codex"
13
+ kind: "app-server"
14
14
  title: "Codex"
15
15
  command: "codex"
16
16
  args:
@@ -21,6 +21,16 @@ agents:
21
21
  - "stdio://"
22
22
  env: {}
23
23
 
24
+ traex:
25
+ kind: "app-server"
26
+ title: "TraeX"
27
+ command: "traex"
28
+ args:
29
+ - "app-server"
30
+ - "--listen"
31
+ - "stdio://"
32
+ env: {}
33
+
24
34
  coco:
25
35
  title: "Coco"
26
36
  command: "coco"