@keyou007/agent-bot 0.1.22 → 0.1.24-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.
Files changed (77) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +26 -2
  3. package/README.zh.md +26 -2
  4. package/config.example.yaml +5 -0
  5. package/dist/cli/controlProtocol.js.map +1 -1
  6. package/dist/cli/help.js +4 -0
  7. package/dist/cli/help.js.map +1 -1
  8. package/dist/cli/taskGroupOptions.js +27 -0
  9. package/dist/cli/taskGroupOptions.js.map +1 -1
  10. package/dist/cli.js +21 -1
  11. package/dist/cli.js.map +1 -1
  12. package/dist/codex/CodexProcessManager.js +19 -3
  13. package/dist/codex/CodexProcessManager.js.map +1 -1
  14. package/dist/codex/CodexRuntime.js +92 -9
  15. package/dist/codex/CodexRuntime.js.map +1 -1
  16. package/dist/commands/CommandRouter.js +27 -0
  17. package/dist/commands/CommandRouter.js.map +1 -1
  18. package/dist/config/loadConfig.js +4 -0
  19. package/dist/config/loadConfig.js.map +1 -1
  20. package/dist/config/schema.js +1 -0
  21. package/dist/config/schema.js.map +1 -1
  22. package/dist/feishu/CardRenderer.js +31 -2
  23. package/dist/feishu/CardRenderer.js.map +1 -1
  24. package/dist/feishu/FeishuMessageClient.js +6 -3
  25. package/dist/feishu/FeishuMessageClient.js.map +1 -1
  26. package/dist/feishu/MergedForwardMessage.js +17 -7
  27. package/dist/feishu/MergedForwardMessage.js.map +1 -1
  28. package/dist/index.js +50 -0
  29. package/dist/index.js.map +1 -1
  30. package/dist/local-files/TurnPreviewPage.js +106 -87
  31. package/dist/local-files/TurnPreviewPage.js.map +1 -1
  32. package/dist/proxy/ConversationExport.js +41 -0
  33. package/dist/proxy/ConversationExport.js.map +1 -0
  34. package/dist/proxy/ProxySessionController.js +118 -7
  35. package/dist/proxy/ProxySessionController.js.map +1 -1
  36. package/dist/state/StateStore.js +65 -0
  37. package/dist/state/StateStore.js.map +1 -1
  38. package/dist/state/migrations.js +12 -0
  39. package/dist/state/migrations.js.map +1 -1
  40. package/dist/updates/AutomaticUpdatePreparer.js +66 -0
  41. package/dist/updates/AutomaticUpdatePreparer.js.map +1 -0
  42. package/dist/updates/DailyUpdateMonitor.js +261 -0
  43. package/dist/updates/DailyUpdateMonitor.js.map +1 -0
  44. package/dist/updates/PublishedRelease.js +43 -0
  45. package/dist/updates/PublishedRelease.js.map +1 -0
  46. package/dist/updates/types.js +2 -0
  47. package/dist/updates/types.js.map +1 -0
  48. package/docs/technical-reference.md +4 -0
  49. package/docs/technical-reference.zh.md +4 -0
  50. package/npm-shrinkwrap.json +2 -2
  51. package/package.json +1 -1
  52. package/skills/agent-bot/SKILL.md +11 -0
  53. package/src/cli/controlProtocol.ts +9 -0
  54. package/src/cli/help.ts +4 -0
  55. package/src/cli/taskGroupOptions.ts +33 -3
  56. package/src/cli.ts +21 -0
  57. package/src/codex/CodexProcessManager.ts +21 -4
  58. package/src/codex/CodexRuntime.ts +104 -12
  59. package/src/commands/CommandRouter.ts +24 -0
  60. package/src/commands/commandTypes.ts +1 -0
  61. package/src/config/loadConfig.ts +4 -0
  62. package/src/config/schema.ts +4 -1
  63. package/src/feishu/CardRenderer.ts +34 -2
  64. package/src/feishu/FeishuMessageClient.ts +6 -2
  65. package/src/feishu/MergedForwardMessage.ts +29 -7
  66. package/src/feishu/types.ts +1 -1
  67. package/src/index.ts +49 -0
  68. package/src/local-files/TurnPreviewPage.ts +105 -88
  69. package/src/proxy/ConversationExport.ts +43 -0
  70. package/src/proxy/ProxySessionController.ts +166 -8
  71. package/src/runtime/types.ts +6 -0
  72. package/src/state/StateStore.ts +69 -0
  73. package/src/state/migrations.ts +12 -0
  74. package/src/updates/AutomaticUpdatePreparer.ts +76 -0
  75. package/src/updates/DailyUpdateMonitor.ts +252 -0
  76. package/src/updates/PublishedRelease.ts +44 -0
  77. package/src/updates/types.ts +19 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,19 @@ The project follows [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.1.24-alpha.0] - 2026-09-17
10
+
11
+ - Load each Codex Agent's `CODEX_HOME/.env` at Worker startup for Provider model discovery and the Codex process, without overriding existing environment or explicit Agent settings or sharing those values with other Agents.
12
+ - Retrieve original quoted and merged-forwarded card content, including available text and images, instead of client-upgrade placeholders.
13
+ - Retry ignored Provider and model changes on a thread forked through the latest completed Turn, verify the result before rebinding, and preserve the previous settings on failure.
14
+ - Add `/clone`, `/clonegroup`, and matching CLI commands to transfer user Prompts and final answers into a fresh task, optionally on another Agent or in a new group, without copying reasoning, tool logs, or image payloads.
15
+
16
+ ## [0.1.23] - 2026-09-16
17
+
18
+ - Check stable npm updates once daily between 10:00 and 17:00, notify the owner privately with release notes and a cancellable 60-second countdown, then prepare updates in the background and activate only after tasks and final deliveries finish. Persist per-version reminders and cancellations across restarts, and retain npm-only installation and rollback protections.
19
+ - Simplify Turn Preview tools to one collapsed level with command summaries, compact live durations, status icons, a shared scroll area, and a fixed detail footer. Hide touch-device scrollbars while preserving gesture scrolling, and display project files using relative paths.
20
+ - Refresh the model shown in subsequent Turn previews after changing Model or Provider, without relabeling running or completed Turns.
21
+
9
22
  ## [0.1.22] - 2026-09-12
10
23
 
11
24
  - Preserve Windows separators, underscores, and Markdown delimiters as literal text in file-change paths, including `\__init__.py`, without changing card layout.
package/README.md CHANGED
@@ -130,6 +130,10 @@ agentbot update
130
130
 
131
131
  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 sends a safe-restart card, waits for active tasks to finish, updates, and restores the service automatically. If no task is active, the update restarts the service immediately. Source checkouts and `npm link` installations are never modified by self-update.
132
132
 
133
+ While the Feishu service is running, automatic updates check only npm's stable `latest` once daily at a persisted random time between 10:00 and 17:00 in the server's local timezone. A newer version sends the configured owner one private card containing that version's release notes, a 60-second countdown, and **Cancel this update**. No cancellation means the package is downloaded and validated in the background, then installed and restarted only after active tasks, final-message deliveries, and the quiet inbound window are clear. Existing rollback protection applies. Each version is notified only once per Profile; cancelling skips that version even after restart. Interrupted countdowns restart at 60 seconds on the same card, without sending another reminder.
134
+
135
+ Set `updates.enabled: false` in the Profile configuration and safely restart to disable automatic checks. Without a configured private recipient, confirmed card delivery, or release notes, no automatic installation starts. Failed checks are retried on the next day's schedule; failed installations are not automatically retried for the same version. Automatic updates never install Alpha versions or downgrade, and the same npm-only installation protection applies. Manual `agentbot update` behavior is unchanged.
136
+
133
137
  To replace the global package manually, stop the running service first:
134
138
 
135
139
  ```bash
@@ -202,6 +206,8 @@ agentbot task new [task] [title] [--agent <standard-name>] [--dir <path> | --nod
202
206
  agentbot task newgroup [task] [title] [--agent <standard-name>] [--dir <path> | --nodir]
203
207
  agentbot task fork [task]
204
208
  agentbot task forkgroup [task] [title]
209
+ agentbot task clone [task] [title] [--agent <standard-name>]
210
+ agentbot task clonegroup [task] [title] [--agent <standard-name>]
205
211
  agentbot task queue [task] "<prompt>"
206
212
  agentbot task model [task] [model]
207
213
  agentbot task goal [task] [action-or-objective]
@@ -219,6 +225,10 @@ Inside an Agent started by Agent Bot, `[task]` defaults to the current task; use
219
225
 
220
226
  `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 saved defaults. `--dir` overrides the project directory and supports `~`; `--nodir` forces a Projectless App Server task. Project and Projectless group names can be customized separately through `feishu.groupNameFormat`. `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`.
221
227
 
228
+ `task clone` and `task clonegroup` (also available as `/clone` and `/clonegroup`, abbreviated `/cg`) transfer lightweight dialogue, even between different Agents. They export user Prompts and final answers in order through the latest completed Turn to a local text file, then automatically ask a fresh Agent to read it, acknowledge, and wait for the next request. No LLM summary, reasoning, tool calls/results, image payloads, or native session files are copied. Large files can be read in sections. App Server history uses summary pagination; ACP sources export only dialogue already saved by Agent Bot.
229
+
230
+ The target uses the conversation's default Agent unless `--agent` is supplied, even when that differs from the source Agent. Provider, model, and reasoning use the target Agent's saved defaults; permissions and project directory come from the source, with a fresh workspace for Projectless App Server tasks. `clone` switches the conversation only after task creation and import start succeed; `clonegroup` creates a new private group without switching the source conversation. Neither interrupts active source work or includes its unfinished Turn. In a topic without completed task history, the mapped source Turn is the cutoff. Both CLI commands support `--json`; group creation requires the Profile's authorized user. Files remain under `context-transfers` beside the configured SQLite file (normally `~/.agent-bot/data/context-transfers`); retain them while cloned tasks need them. This transfers text context, not executable session state or local file changes.
231
+
222
232
  ## Feishu Commands
223
233
 
224
234
  Send a message beginning with `/` to run a command. Use `/help` in Feishu for the latest command list.
@@ -233,6 +243,7 @@ Send a message beginning with `/` to run a command. Use `/help` in Feishu for th
233
243
  | `/dismiss` | Archive the current task and dissolve the group after confirmation |
234
244
  | `/switch [task]` | Switch tasks or return to the previous task |
235
245
  | `/fork [task]` | Branch a task |
246
+ | `/clone [title] [--agent <name>]` | Transfer dialogue into a fresh task |
236
247
  | `/turn [Turn ID or index]` | Browse turn history or view one turn's runtime details |
237
248
  | `/status [task]` | View task status, Turn count, and disk usage |
238
249
  | `/title <title>` | Rename the current task |
@@ -247,6 +258,7 @@ Send a message beginning with `/` to run a command. Use `/help` in Feishu for th
247
258
  | `/agent [name]` | Choose the Agent for new tasks |
248
259
  | `/newgroup [title] [--dir <path> \| --nodir]` | Start a task in a new private group |
249
260
  | `/forkgroup [title]` | Branch a task into a new private group |
261
+ | `/clonegroup [title] [--agent <name>]` | Transfer dialogue into a new private group |
250
262
  | `/restart [--force]` | Restart safely, or interrupt with `--force` |
251
263
  | `/release` | Release Agent Bot's App Server tasks for Desktop |
252
264
  | `/mute [on\|off]` | Require @ mentions in the current group |
@@ -296,12 +308,18 @@ Set `AGENT_BOT_HOME` to use another user-data directory. See [config.example.yam
296
308
 
297
309
  Local non-image files and directories referenced in Agent replies become signed, read-only viewer links for source code, Markdown, logs, PDFs, common media files, or downward directory browsing. By default, links open only on the computer running Agent Bot. Setting `fileViewer.host` to `0.0.0.0` automatically selects a LAN address in wired, Wi-Fi, other physical, then VPN order. Use `fileViewer.publicBaseUrl` to override that address for a domain, HTTPS reverse proxy, or port mapping.
298
310
 
299
- Progress cards include a `Preview` button that opens the saved Turn timeline in a compact, mobile-friendly browser view. Consecutive native reasoning entries share one collapsed section. Commands are shown in a code-style header, outputs are collapsed, and identical output/error logs appear once. Tool status, start time, and duration appear on the output row. Running Turns update live while preserving your expanded or collapsed steps. Click a file in the file changes or tool file list to preview its current contents in a new tab; deleted or unavailable files remain plain text. Turn previews use the same signed viewer address and access rules as local file links.
311
+ Progress cards include a `Preview` button that opens the saved Turn timeline in a compact, mobile-friendly browser view. Native reasoning is hidden. Tool blocks have a single collapse level and start collapsed with a meaningful one-line command summary, a compact duration (`58s` or `2:32`), and completion status. Expanding a block shows the full command prefixed by `$`, followed directly by its results, images, and changed files. Identical output/error logs appear once. Running Turns update live while preserving your expanded or collapsed steps and scroll positions. Click a file in the file changes or tool file list to preview its current contents in a new tab; deleted or unavailable files remain plain text. Turn previews use the same signed viewer address and access rules as local file links.
312
+
313
+ The compact Turn Preview header uses dot-separated values, keeps the duration label, and abbreviates token counts with K, M, and B units. It wraps to fit narrow screens. Prompt, Commentary, and result text use a regular weight and a slightly larger font than tool calls. Tool commands and outputs preserve line breaks and indentation; long lines scroll horizontally within the tool block without wrapping. Commands and results share one scroll area capped at 30 lines in height. Thin, subtle scrollbars have no arrow buttons. On desktop they appear on hover or keyboard focus; on touch devices they are hidden while gesture scrolling remains available.
300
314
 
301
- The compact Turn Preview header uses dot-separated values, keeps the duration label, and abbreviates token counts with K, M, and B units. It wraps to fit narrow screens. Prompt, Commentary, and result text use a regular weight and a slightly larger font than tool calls. Tool commands and outputs preserve line breaks and indentation; long lines scroll horizontally within the tool block without wrapping. Commands show up to 15 lines at a time; scroll vertically within the command area to see the rest. Thin, subtle scrollbars have no arrow buttons. On desktop they appear on hover or keyboard focus; on touch devices they remain available for scrolling.
315
+ Tool blocks have a subtle outline. Horizontal separators appear after the Prompt, before the file-change summary, and before the answer, with no separator after the final answer. The file-change summary starts collapsed, shows the file count, and preserves your expanded state during live updates. Both file lists show project files as relative paths and files outside the project as absolute paths.
316
+
317
+ Tool titles start with the same status icons as the thinking card: an hourglass while running, a check mark on success, or a cross on failure. Running blocks have an accent border. Header summaries omit shell line-continuation markers while preserving file paths and the full expanded command. Durations remain hidden at zero seconds. The expanded footer shows the execution status, start time, duration, and result character count outside the scroll area; running durations update live in both the header and footer.
302
318
 
303
319
  Local images in Turn Preview Prompts, Commentary, and results load through signed file URLs, including live updates. Relative image paths resolve from the task's project directory.
304
320
 
321
+ Changing the model or Provider updates the model shown for subsequent Turns in Preview. A change during execution does not relabel the running Turn or earlier Turns.
322
+
305
323
  Markdown previews keep table cells at their content width. Wide tables scroll horizontally within the preview instead of squeezing columns on narrow screens, and live updates preserve each table's horizontal scroll position.
306
324
 
307
325
  Local links in rendered Markdown open signed viewer pages for the referenced files or directories. Relative paths resolve from the Markdown file's directory; absolute paths, `file://` URLs, and line references are supported, and local images load through the same read-only service. Web links and the original code view are unchanged. Sharing a Markdown viewer link also gives its readers access to the local paths referenced in that document, so only share trusted documents.
@@ -316,14 +334,20 @@ Provider changes require an idle task. Wait for an active turn to finish, or sto
316
334
 
317
335
  `feishu.groupNameFormat` defines separate name templates for new Project and Projectless groups, with variables for the operating system, Agent, project, task name, and date. See the [technical reference](docs/technical-reference.md#configuration-model) for the complete format.
318
336
 
337
+ If Codex ignores the requested Provider or model when resuming an existing task, Agent Bot retries on a new Codex thread forked through the latest completed Turn. The local task, title, and directory remain unchanged; later failed or interrupted Turns remain only in the original thread. The replacement is adopted only after the settings are verified.
338
+
319
339
  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.
320
340
 
341
+ At startup, Agent Bot also reads each Codex Agent's `CODEX_HOME/.env` (default: `~/.codex/.env`) for Provider model discovery and the Codex process. You do not need to duplicate those keys in Agent Bot's `.env`. Existing environment values and explicit Agent settings take precedence. Safely restart Agent Bot after editing the file.
342
+
321
343
  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.
322
344
 
323
345
  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 requests the manually published all-group-message permission only when this option is enabled. After changing it from `false` to `true`, rerun `agentbot init` and complete the final permission step.
324
346
 
325
347
  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. When Codex compacts its context, the card shows the live compaction state as a progress activity, including elapsed time, before/after context token counts, executed Turn count, and rollout disk usage when available. 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.
326
348
 
349
+ Quoted cards and cards inside merged forwards include their available original text and images in the Agent's context.
350
+
327
351
  File-change summaries display paths as plain text, preserving Windows separators and literal underscores (including `\__init__.py`) instead of interpreting them as Markdown formatting.
328
352
 
329
353
  ## Troubleshooting
package/README.zh.md CHANGED
@@ -130,6 +130,10 @@ agentbot update
130
130
 
131
131
  正式版默认检查稳定通道,Alpha 版默认检查 Alpha 通道。也可以使用 `--stable`、`--alpha` 或 `--version <版本>` 明确选择。服务正在运行时,Agent Bot 会发送安全重启卡片,等待当前任务完成后更新并自动恢复服务;如果没有任务在执行,则立即重启更新。源码目录和 `npm link` 安装不会被自更新命令修改。
132
132
 
133
+ 飞书服务运行期间,默认每天按服务器本地时区在 10:00–17:00 随机检查一次,只查询 npm 正式版 `latest`,检查时间会持久化。发现新版本后,向配置的用户私聊发送一张更新提醒卡片,包含本版新功能说明、60 秒倒计时和“取消本次更新”按钮。未取消则在后台下载并校验,等任务执行、最终结果投递及入站消息静默窗口全部结束后,再安装并自动重启;保留原有失败回滚保护。同一 Profile 中每个版本只提醒一次,取消后即使重启也不会再次自动更新该版本。倒计时期间重启会在原卡片上重新给足 60 秒,不另发提醒。
134
+
135
+ 在 Profile 配置中设置 `updates.enabled: false` 并安全重启,可关闭自动检查。没有配置私聊用户、没有确认卡片投递成功或无法读取版本说明时,不会自动安装。检查失败等待次日检查,安装失败不会对同一版本自动重试。自动更新不安装 Alpha、不降级,仍只支持 npm 全局安装,保留源码目录和 `npm link` 保护。手动 `agentbot update` 行为不变。
136
+
133
137
  如需手动替换全局包,请先停止正在运行的服务:
134
138
 
135
139
  ```bash
@@ -202,6 +206,8 @@ agentbot task new [任务] [标题] [--agent <标准名>] [--dir <路径> | --no
202
206
  agentbot task newgroup [任务] [标题] [--agent <标准名>] [--dir <路径> | --nodir]
203
207
  agentbot task fork [任务]
204
208
  agentbot task forkgroup [任务] [标题]
209
+ agentbot task clone [任务] [标题] [--agent <标准名>]
210
+ agentbot task clonegroup [任务] [标题] [--agent <标准名>]
205
211
  agentbot task queue [任务] "<prompt>"
206
212
  agentbot task model [任务] [模型]
207
213
  agentbot task goal [任务] [操作或目标]
@@ -219,6 +225,10 @@ agentbot task dismiss [任务] --yes
219
225
 
220
226
  `task newgroup` 会创建飞书群和新任务。默认继承源任务的 Agent 和运行设置;`--agent <标准名>` 可选择另一个已配置的 Agent,此时仍继承源任务的项目形态,但 Provider、模型、思考强度和权限模式使用目标 Agent 已保存的默认值。`--dir` 可覆盖项目目录并支持 `~`,`--nodir` 会强制创建 Projectless App Server 任务。Project 与 Projectless 群名可在 `feishu.groupNameFormat` 中分别自定义。`task forkgroup` 从源任务最新可用的已完成 turn 创建分支,不会中断正在执行的 turn。两个命令都要求 Server 正在运行,邀请 Profile 中保存的授权用户,不会切换源会话的当前任务,并支持 `--json`。
221
227
 
228
+ `task clone` 和 `task clonegroup`(飞书命令为 `/clone` 和 `/clonegroup`,后者可缩写为 `/cg`)支持跨 Agent 的轻量上下文迁移:按时间顺序将截至最近已完成 Turn 的用户 Prompt 和最终回答导出为本地文本文件,再自动让新 Agent 阅读、简短确认并等待后续指令。不调用模型生成摘要,不复制思考过程、工具调用及输出、图片数据或原生会话文件;大文本文件可分段读取。App Server 通过摘要分页读取历史,ACP 来源只导出 Agent Bot 已保存的对话。
229
+
230
+ 目标 Agent 默认取当前会话设置的默认 Agent,不一定与源任务相同;可用 `--agent` 显式指定。Provider、模型和思考强度使用目标 Agent 已保存的默认值,权限和项目目录继承源任务;Projectless App Server 任务会使用新的工作目录。`clone` 在新任务创建并启动上下文读取后切换当前任务,`clonegroup` 新建私有群且不切换源会话。两者都不中断源任务,也不导出未完成轮次;话题尚无已完成任务历史时,以对应的原始 Turn 为截止点。CLI 均支持 `--json`,建群需要 Profile 中的授权用户。文件保存在配置的 SQLite 旁的 `context-transfers` 目录,通常为 `~/.agent-bot/data/context-transfers`;克隆任务仍需使用时请保留文件。这是文本上下文迁移,不是原生会话状态或工作文件的复制。
231
+
222
232
  ## 飞书命令
223
233
 
224
234
  发送 `/` 开头的消息即可执行命令。使用飞书中的 `/help` 查看最新命令列表。
@@ -233,6 +243,7 @@ agentbot task dismiss [任务] --yes
233
243
  | `/dismiss` | 确认后归档当前任务并解散群聊 |
234
244
  | `/switch [任务]` | 切换任务,或返回上一个任务 |
235
245
  | `/fork [任务]` | 创建任务分支 |
246
+ | `/clone [标题] [--agent <名称>]` | 将对话上下文迁移到新任务 |
236
247
  | `/turn [Turn ID 或序号]` | 浏览历史轮次或查看指定轮次的运行信息 |
237
248
  | `/status [任务]` | 查看任务状态、轮次和磁盘占用 |
238
249
  | `/title <标题>` | 修改当前任务标题 |
@@ -247,6 +258,7 @@ agentbot task dismiss [任务] --yes
247
258
  | `/agent [名称]` | 选择新任务使用的 Agent |
248
259
  | `/newgroup [标题] [--dir <路径> \| --nodir]` | 在新私有群中开始任务 |
249
260
  | `/forkgroup [标题]` | 将任务分支到新私有群 |
261
+ | `/clonegroup [标题] [--agent <名称>]` | 将对话上下文迁移到新私有群 |
250
262
  | `/restart [--force]` | 安全重启;`--force` 会中断任务 |
251
263
  | `/release` | 释放 Agent Bot 占用的 App Server 任务 |
252
264
  | `/mute [on\|off]` | 设置当前群仅响应 @ 消息 |
@@ -292,12 +304,18 @@ Agent Bot 将用户相关文件保存在仓库之外:
292
304
 
293
305
  回答中引用的本地非图片文件或目录会自动变成只读查看链接,可在浏览器中查看源码、Markdown、日志、PDF、常见媒体文件,或向下浏览目录内容。默认链接只在运行 Agent Bot 的电脑上打开;将 `fileViewer.host` 设为 `0.0.0.0` 后,会按有线、Wi-Fi、其他物理网卡、VPN 的顺序自动选择局域网地址。域名、HTTPS 反向代理或端口映射可通过 `fileViewer.publicBaseUrl` 覆盖自动地址。链接带有当前 Profile 独立的签名。
294
306
 
295
- 思考卡片底部操作区提供 `Preview` 按钮,可在浏览器中查看本轮已保存的执行时间线,采用紧凑布局并适配手机。连续的原生思考合并到同一个默认折叠的区域。命令以代码样式显示在 Header,输出默认折叠,相同的输出和错误日志只显示一次。工具状态、开始时间和耗时显示在输出行。执行中的 Turn 会自动实时更新,并保留你手动展开或折叠的步骤。点击文件变更列表或工具文件列表中的文件,可在新标签页预览其当前内容;已删除或不可用的文件保留为路径文字。Turn Preview 与本地文件链接共用相同的签名、访问地址和网络范围。
307
+ 思考卡片底部操作区提供 `Preview` 按钮,可在浏览器中查看本轮已保存的执行时间线,采用紧凑布局并适配手机,不显示原生思考。工具块只有一级折叠,默认只显示有意义的单行命令摘要、简短耗时(如 `58s` 或 `2:32`)和完成状态。展开后先显示以 `$` 开头的完整命令,随后直接显示结果、图片和修改文件。相同的输出和错误日志只显示一次。执行中的 Turn 会自动实时更新,并保留手动展开状态及滚动位置。点击文件变更列表或工具文件列表中的文件,可在新标签页预览其当前内容;已删除或不可用的文件保留为路径文字。Turn Preview 与本地文件链接共用相同的签名、访问地址和网络范围。
308
+
309
+ Turn Preview 顶部用点分隔各项信息,保留“耗时”标签,Token 数量使用 K、M、B 单位简写,窄屏下自动换行。Prompt、Commentary 和结果正文使用普通字重,字号比工具调用大一号。展开后的工具命令和输出保留换行与缩进,长行在工具块内横向滚动,不自动折行。命令和结果共用一个最多 30 行高的滚动区域。滚动条采用无箭头的浅色细条,鼠标设备上悬停或键盘聚焦时显示,触屏设备隐藏滚动条,仍可用手势滚动。
296
310
 
297
- Turn Preview 顶部用点分隔各项信息,保留“耗时”标签,Token 数量使用 K、M、B 单位简写,窄屏下自动换行。Prompt、Commentary 和结果正文使用普通字重,字号比工具调用大一号。工具命令和输出保留换行与缩进,长行在工具块内横向滚动,不自动折行。命令区域最多显示 15 行,超出部分可在区域内纵向滚动查看。滚动条采用无箭头的浅色细条,鼠标设备上悬停或键盘聚焦时显示,触屏设备保留可用的滚动条。
311
+ 工具块保留浅色边框。Prompt 之后、文件变更汇总之前和答案之前显示横向分隔线,最终答案之后不再显示分隔线。文件变更汇总默认折叠,标题显示文件数量,实时更新时保留手动展开状态。文件变更汇总和工具文件列表中,项目内的文件显示相对路径,项目外的文件显示绝对路径。
312
+
313
+ 工具标题开头使用与思考卡片相同的状态图标:执行中为沙漏,成功为对号,失败为叉号;执行中的工具边框突出显示。标题摘要省略命令续行符,保留文件路径和展开后的完整命令。时长为 0 秒时隐藏。展开后的底部显示执行状态、开始时间、耗时和结果字符数,不随内容滚动;执行中标题和底部的耗时都会实时更新。
298
314
 
299
315
  Turn Preview 的 Prompt、Commentary 和结果中的本地图片通过签名文件链接加载,实时更新时同样生效。相对图片路径按任务的项目目录解析。
300
316
 
317
+ 切换模型或 Provider 后,后续轮次的 Preview 会显示更新后的模型。执行过程中切换模型不会改变当前轮次或历史轮次的模型标记。
318
+
301
319
  HTML 文件(`.html`、`.htm`)默认以预览模式打开,并支持切换代码、行号定位和实时更新。自包含 HTML 的内联样式、内联脚本和嵌入媒体可在隔离框架内运行;不开放外部资源、相对路径本地资源、网络请求、表单提交及对外层查看页的访问。预览会渲染完整文档,仅代码视图限制为开头 2 MiB。
302
320
 
303
321
  Provider、模型、思考强度和权限设置会作用于当前任务,同时保存到对应 Agent 的 `defaults` 中。以后创建没有同 Agent 设置可继承的新任务时,会使用这些默认值;每个已配置 Agent 分别保存自己的设置。
@@ -308,14 +326,20 @@ Provider、模型、思考强度和权限设置会作用于当前任务,同时
308
326
 
309
327
  `feishu.groupNameFormat` 可分别设置 Project 与 Projectless 新群的名称模板,支持系统、Agent、项目、任务名和日期变量。完整格式说明见[技术参考](docs/technical-reference.zh.md#配置模型)。
310
328
 
329
+ 如果 Codex 在恢复已有任务时忽略指定的 Provider 或模型,Agent Bot 会从最新已完成轮次创建新的 Codex 分支重试。本地任务、标题和目录保持不变,之后失败或中断的轮次仅保留在原线程中。新线程的设置通过校验后才会被采用。
330
+
311
331
  Agent 进程会继承普通父进程变量及其显式配置的 `agents.<name>.env`。启动 Agent 前,Agent Bot 会移除继承的 `FEISHU_*` 凭据和内部 `AGENT_BOT_*` 状态,再仅提供带命名空间的非敏感 Profile 与 Lark 身份上下文;`FEISHU_APP_SECRET` 永远不会传入 Agent 进程。
312
332
 
333
+ Agent Bot 启动时还会读取每个 Codex Agent 的 `CODEX_HOME/.env`(默认 `~/.codex/.env`),供 Provider 模型发现和 Codex 进程使用,无需把这些密钥重复写入 Agent Bot 的 `.env`。已有环境变量和 Agent 显式配置优先。修改该文件后需安全重启 Agent Bot。
334
+
313
335
  默认配置 `feishu.respondToOwnerOnly: true` 只接受 `feishu.userOpenId` 所标识的机器人拥有者发送的消息和卡片操作;其他用户会在添加处理 reaction 之前被忽略。设为 `false` 可允许其他协作者使用。开启后若未配置拥有者 Open ID,Agent Bot 会忽略所有飞书用户输入,直到完成拥有者配置。
314
336
 
315
337
  Agent Bot 会响应机器人所在群内拥有者发送的普通消息。将 `feishu.respondToAllGroupMessages` 设为 `false` 后,还会要求拥有者在群消息中 @ 当前机器人;私聊不受这一项影响。只有开启该配置时,初始化才会申请需要手动发布的“接收所有群消息”权限。从 `false` 改为 `true` 后,需要重新运行 `agentbot init` 并完成最后的权限步骤。
316
338
 
317
339
  思考卡片默认使用分组布局:辅助 Commentary 和用户追加消息保持直接显示,每个执行组只显示最新一段原生思考,点击后可展开完整的工具命令和结果。显示命令时会省略常见的 PowerShell、zsh、bash 和 sh 启动包装前缀。失败工具仍会在自己的工具面板中标记,但不会让整个执行组显示失败图标或红色边框。执行组默认折叠,并使用稳定的组件标识,使用户在飞书中手动打开的面板在卡片更新后继续保持展开。Codex 压缩上下文时,卡片内部会把实时压缩状态显示为一条进度活动;协议提供数据时,还会显示耗时、压缩前后的上下文 token 数、已执行轮次和 rollout 磁盘占用。长任务会根据完整渲染后的卡片内容大小翻页,不再使用固定的消息数或工具数。将 `feishu.thinkingCardLayout` 设为 `timeline` 可临时恢复原版布局。
318
340
 
341
+ 引用卡片或合并转发中的卡片时,Agent 会收到可读取的原始文字和图片。
342
+
319
343
  文件变更摘要中的路径保持普通文本样式,完整保留 Windows 路径分隔符和下划线(包括 `\__init__.py`),不会将其解析为 Markdown 格式。
320
344
 
321
345
  ## 常见问题
@@ -18,6 +18,11 @@ feishu:
18
18
  console:
19
19
  enabled: true
20
20
 
21
+ # Check npm latest once daily between 10:00 and 17:00 (server local time).
22
+ # Notify the owner privately; allow 60 seconds to cancel, then update when idle.
23
+ updates:
24
+ enabled: true
25
+
21
26
  # Signed, read-only pages for local files referenced in Agent replies.
22
27
  fileViewer:
23
28
  enabled: true
@@ -1 +1 @@
1
- {"version":3,"file":"controlProtocol.js","sourceRoot":"","sources":["../../src/cli/controlProtocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAgL7B,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,GAAG,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC/F,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO;QACjC,CAAC,CAAC,0BAA0B,GAAG,EAAE;QACjC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC;AACtE,CAAC"}
1
+ {"version":3,"file":"controlProtocol.js","sourceRoot":"","sources":["../../src/cli/controlProtocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAyL7B,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,GAAG,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC/F,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO;QACjC,CAAC,CAAC,0BAA0B,GAAG,EAAE;QACjC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC;AACtE,CAAC"}
package/dist/cli/help.js CHANGED
@@ -29,6 +29,8 @@ export function renderCliHelp(version, language = cliLanguage) {
29
29
  task newgroup [任务] [标题] 创建新群;支持 --agent、--dir、--nodir
30
30
  task fork [任务] 从任务最近完成的 Turn 创建分支
31
31
  task forkgroup [任务] [标题] 从任务 Fork 新群
32
+ task clone [任务] [标题] 用对话文件创建新任务;支持 --agent
33
+ task clonegroup [任务] [标题] 用对话文件创建新群;支持 --agent
32
34
  task switch [任务] [目标任务] 切换会话任务;--previous 切回上一任务
33
35
  task queue [任务] <提示词> 将提示词排队;nosteer 是别名
34
36
  task agent [任务] [名称] 查看或设置该会话的新任务默认 Agent
@@ -121,6 +123,8 @@ Task commands:
121
123
  task newgroup [task] [title] Create a group; supports --agent, --dir, --nodir
122
124
  task fork [task] Fork the task's latest completed Turn
123
125
  task forkgroup [task] [title] Fork a task into a new group
126
+ task clone [task] [title] Create a task from a conversation file; supports --agent
127
+ task clonegroup [task] [title] Create a group from a conversation file; supports --agent
124
128
  task switch [task] [target] Switch the conversation task; --previous selects the prior task
125
129
  task queue [task] <prompt> Queue a Prompt; nosteer is an alias
126
130
  task agent [task] [name] Show or set the conversation's default Agent for new tasks
@@ -1 +1 @@
1
- {"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoB,MAAM,WAAW,CAAC;AAE1D,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,QAAQ,GAAgB,WAAW;IAChF,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,OAAO,aAAa,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0F9B,CAAC;IACA,CAAC;IAED,OAAO,aAAa,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0F5B,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoB,MAAM,WAAW,CAAC;AAE1D,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,QAAQ,GAAgB,WAAW;IAChF,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,OAAO,aAAa,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4F9B,CAAC;IACA,CAAC;IAED,OAAO,aAAa,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4F5B,CAAC;AACF,CAAC"}
@@ -81,6 +81,33 @@ export function parseTaskForkGroupOptions(input, language = cliLanguage) {
81
81
  json,
82
82
  };
83
83
  }
84
+ export function parseTaskCloneOptions(input, action, language = cliLanguage) {
85
+ const positionals = [];
86
+ let agentName;
87
+ let json = false;
88
+ for (let index = 0; index < input.length; index += 1) {
89
+ const argument = input[index];
90
+ if (argument === "--json") {
91
+ json = true;
92
+ }
93
+ else if (argument === "--agent") {
94
+ if (agentName !== undefined)
95
+ throw optionError(action, "--agent", language);
96
+ const name = input[++index];
97
+ if (!name?.trim() || name.startsWith("--"))
98
+ throw new Error(cliText(`task ${action} requires an Agent name after --agent.`, `task ${action} 需要在 --agent 后指定 Agent 名称。`, language));
99
+ agentName = name.trim();
100
+ }
101
+ else {
102
+ if (argument.startsWith("--"))
103
+ throw unsupportedOption(action, argument, language);
104
+ positionals.push(argument);
105
+ }
106
+ }
107
+ const [reference, ...title] = positionals;
108
+ requireTaskReference(action, reference, language);
109
+ return { reference, title: title.join(" ").trim() || undefined, agentName, json };
110
+ }
84
111
  function requireTaskReference(action, reference, language) {
85
112
  if (reference && !reference.startsWith("--"))
86
113
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"taskGroupOptions.js","sourceRoot":"","sources":["../../src/cli/taskGroupOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAoB,MAAM,WAAW,CAAC;AAmBnE,MAAM,UAAU,wBAAwB,CACtC,KAAe,EACf,QAAQ,GAAgB,WAAW;IAEnC,OAAO,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,KAAe,EACf,MAAM,GAAuB,KAAK,EAClC,QAAQ,GAAgB,WAAW;IAEnC,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,IAAI,GAAuB,CAAC;IAC5B,IAAI,SAA6B,CAAC;IAClC,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACrD,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAE,CAAC;QAC/B,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAC1B,IAAI,GAAG,IAAI,CAAC;YACZ,SAAS;QACX,CAAC;QACD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,IAAI,WAAW;gBAAE,MAAM,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;YAChE,IAAI,GAAG,KAAK,SAAS;gBAAE,MAAM,yBAAyB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACzE,WAAW,GAAG,IAAI,CAAC;YACnB,SAAS;QACX,CAAC;QACD,IAAI,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,GAAG,EAClC,QAAQ,CACT,CAAC,CAAC;AACL,CAAC;AAED,SAAS,yBAAyB,CAAC,MAA0B,EAAE,QAAqB;IAClF,OAAO,IAAI,KAAK,CAAC,OAAO,CACtB,QAAQ,MAAM,oCAAoC,EAClD,QAAQ,MAAM,4BAA4B,EAC1C,QAAQ,CACT,CAAC,CAAC;AACL,CAAC;AAED,SAAS,iBAAiB,CACxB,MAAiE,EACjE,MAAc,EACd,QAAqB;IAErB,OAAO,IAAI,KAAK,CAAC,OAAO,CACtB,QAAQ,MAAM,6BAA6B,MAAM,GAAG,EACpD,QAAQ,MAAM,UAAU,MAAM,GAAG,EACjC,QAAQ,CACT,CAAC,CAAC;AACL,CAAC"}
package/dist/cli.js CHANGED
@@ -28,7 +28,7 @@ import { currentAppServerThreadIds, formatTaskList, taskStateLabel, } from "./cl
28
28
  import { resolveCurrentTaskFromEnvironment, resolveRestartNotificationTask, resolveTask, resolveTaskCommandTarget, } from "./cli/taskTarget.js";
29
29
  import { isThreadContextKey } from "./feishu/contextKey.js";
30
30
  import { refreshedSystemEnvironment } from "./supervision/systemEnvironment.js";
31
- import { parseTaskForkGroupOptions, parseTaskNewOptions, parseTaskNewGroupOptions, } from "./cli/taskGroupOptions.js";
31
+ import { parseTaskCloneOptions, parseTaskForkGroupOptions, parseTaskNewOptions, parseTaskNewGroupOptions, } from "./cli/taskGroupOptions.js";
32
32
  import { StateStore } from "./state/StateStore.js";
33
33
  import { nodeDiagnosticReportArguments, prepareCrashReportDirectory, resolveSupervisorDiagnosticsPaths, } from "./supervision/SupervisorDiagnostics.js";
34
34
  import { agentBotHome, defaultSqlitePath } from "./config/paths.js";
@@ -1193,6 +1193,26 @@ async function taskCommand(input) {
1193
1193
  await serverCommand(["restart", "--task", target.session.localSessionId, ...translated]);
1194
1194
  return;
1195
1195
  }
1196
+ if (action === "clone" || action === "clonegroup") {
1197
+ const target = resolveTaskCommandTarget(allSessions, rest, action);
1198
+ const options = parseTaskCloneOptions([target.session.localSessionId, ...target.args], action);
1199
+ if (action === "clonegroup")
1200
+ requireCliGroupUser(config.feishu.userOpenId);
1201
+ const response = await sendControlRequest(controlEndpoint(config.storage.sqlitePath), {
1202
+ action: action === "clonegroup" ? "task_clone_group" : "task_clone",
1203
+ localSessionId: target.session.localSessionId,
1204
+ ...(options.title ? { title: options.title } : {}),
1205
+ ...(options.agentName ? { agentName: options.agentName } : {}),
1206
+ }, 120_000);
1207
+ if (!response.ok)
1208
+ throw new Error(response.message ?? cliText("Failed to clone the task.", "克隆任务失败。"));
1209
+ const result = response.data;
1210
+ if (options.json)
1211
+ printJson(result);
1212
+ else
1213
+ process.stdout.write(cliText(`Cloned task: ${result.task.title ?? result.task.localSessionId}\nAgent: ${result.task.agentName}\nContext: ${result.contextFile} (${result.turnCount} turns)\n${result.group ? `Group: ${result.group.name}\n` : ""}`, `克隆任务:${result.task.title ?? result.task.localSessionId}\nAgent:${result.task.agentName}\n上下文:${result.contextFile}(${result.turnCount} 轮)\n${result.group ? `群:${result.group.name}\n` : ""}`));
1214
+ return;
1215
+ }
1196
1216
  if (action === "newgroup") {
1197
1217
  const target = resolveTaskCommandTarget(allSessions, rest, action);
1198
1218
  const options = parseTaskNewGroupOptions([target.session.localSessionId, ...target.args]);