@keyou007/agent-bot 0.1.25-alpha.1 → 0.1.25

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 (81) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +34 -6
  3. package/README.zh.md +34 -6
  4. package/config.example.yaml +1 -3
  5. package/dist/cli/help.js +2 -0
  6. package/dist/cli/help.js.map +1 -1
  7. package/dist/codex/CodexRuntime.js +15 -5
  8. package/dist/codex/CodexRuntime.js.map +1 -1
  9. package/dist/commands/CommandRouter.js +3 -0
  10. package/dist/commands/CommandRouter.js.map +1 -1
  11. package/dist/config/SettingsStore.js +341 -0
  12. package/dist/config/SettingsStore.js.map +1 -0
  13. package/dist/config/loadConfig.js +1 -2
  14. package/dist/config/loadConfig.js.map +1 -1
  15. package/dist/config/schema.js +0 -1
  16. package/dist/config/schema.js.map +1 -1
  17. package/dist/console/ConsoleTurnPresenter.js +3 -0
  18. package/dist/console/ConsoleTurnPresenter.js.map +1 -1
  19. package/dist/feishu/CardRenderer.js +34 -99
  20. package/dist/feishu/CardRenderer.js.map +1 -1
  21. package/dist/feishu/FeishuConnector.js +9 -0
  22. package/dist/feishu/FeishuConnector.js.map +1 -1
  23. package/dist/feishu/FeishuMessageClient.js +23 -18
  24. package/dist/feishu/FeishuMessageClient.js.map +1 -1
  25. package/dist/feishu/FeishuTurnPresenter.js +36 -23
  26. package/dist/feishu/FeishuTurnPresenter.js.map +1 -1
  27. package/dist/feishu/LocalCardImage.js +0 -4
  28. package/dist/feishu/LocalCardImage.js.map +1 -1
  29. package/dist/feishu/LocalImageMarkdown.js +59 -3
  30. package/dist/feishu/LocalImageMarkdown.js.map +1 -1
  31. package/dist/feishu/SettingsCard.js +199 -0
  32. package/dist/feishu/SettingsCard.js.map +1 -0
  33. package/dist/index.js +3 -6
  34. package/dist/index.js.map +1 -1
  35. package/dist/local-files/TurnPreviewPage.js +8 -4
  36. package/dist/local-files/TurnPreviewPage.js.map +1 -1
  37. package/dist/presentation/TurnStateReducer.js +21 -2
  38. package/dist/presentation/TurnStateReducer.js.map +1 -1
  39. package/dist/presentation/turnStatus.js +34 -0
  40. package/dist/presentation/turnStatus.js.map +1 -0
  41. package/dist/proxy/ProxySessionController.js +409 -163
  42. package/dist/proxy/ProxySessionController.js.map +1 -1
  43. package/dist/runtime/submissionErrors.js +15 -0
  44. package/dist/runtime/submissionErrors.js.map +1 -0
  45. package/dist/state/ExecutionProvenanceStore.js +58 -0
  46. package/dist/state/ExecutionProvenanceStore.js.map +1 -0
  47. package/dist/state/StateStore.js +96 -33
  48. package/dist/state/StateStore.js.map +1 -1
  49. package/dist/state/migrations.js +12 -0
  50. package/dist/state/migrations.js.map +1 -1
  51. package/docs/technical-reference.md +11 -8
  52. package/docs/technical-reference.zh.md +11 -8
  53. package/npm-shrinkwrap.json +2 -2
  54. package/package.json +1 -1
  55. package/skills/agent-bot/SKILL.md +9 -3
  56. package/src/cli/help.ts +2 -0
  57. package/src/codex/CodexRuntime.ts +14 -5
  58. package/src/commands/CommandRouter.ts +3 -0
  59. package/src/commands/commandTypes.ts +1 -0
  60. package/src/config/SettingsStore.ts +588 -0
  61. package/src/config/loadConfig.ts +1 -2
  62. package/src/config/schema.ts +0 -1
  63. package/src/console/ConsoleTurnPresenter.ts +2 -0
  64. package/src/feishu/CardRenderer.ts +35 -114
  65. package/src/feishu/FeishuConnector.ts +9 -0
  66. package/src/feishu/FeishuMessageClient.ts +23 -22
  67. package/src/feishu/FeishuTurnPresenter.ts +33 -22
  68. package/src/feishu/LocalCardImage.ts +0 -6
  69. package/src/feishu/LocalImageMarkdown.ts +54 -3
  70. package/src/feishu/SettingsCard.ts +231 -0
  71. package/src/index.ts +3 -6
  72. package/src/local-files/TurnPreviewPage.ts +8 -4
  73. package/src/presentation/TurnStateReducer.ts +21 -2
  74. package/src/presentation/turnStatus.ts +38 -0
  75. package/src/presentation/turnViewTypes.ts +3 -0
  76. package/src/proxy/ProxySessionController.ts +382 -162
  77. package/src/runtime/submissionErrors.ts +15 -0
  78. package/src/runtime/types.ts +1 -0
  79. package/src/state/ExecutionProvenanceStore.ts +100 -0
  80. package/src/state/StateStore.ts +118 -33
  81. package/src/state/migrations.ts +12 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,35 @@ The project follows [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.1.25] - 2026-11-20
10
+
11
+ - Promote 0.1.25-alpha.2 to the stable release channel, including the changes from all 0.1.25 Alpha releases.
12
+ - Add confirmed one-time and Cron schedules with busy-task queueing, a 60-minute latest-start deadline, execution records, and Prompt delivery before thinking cards.
13
+ - Keep execution settings task-scoped, persist submission and cancellation boundaries, and verify uncertain recovery without replaying old instructions or duplicating final replies.
14
+ - Add owner-only global settings panels with validated, atomic configuration saves and explicit safe-restart activation.
15
+ - Unify outbound local-image handling across Feishu cards and final replies, with upload reuse and safe text fallback; use one grouped thinking-card renderer.
16
+ - Automatically upgrade legacy recent-context receipt databases without losing records, distinguish local-state errors from Feishu permissions, and preserve accepted work when receipt writes fail.
17
+ - Fix quoted/merged-forward message pairing and resource downloads, and retain minimal delayed-message diagnostics.
18
+
19
+ ## [0.1.25-alpha.2] - 2026-11-19
20
+
21
+ - Automatically migrate legacy recent-context receipt tables at startup without losing records or guessing source Prompts; distinguish local-state failures from Feishu permission errors, and keep accepted tasks running if receipt persistence fails.
22
+
23
+ - Unify local image handling at the Feishu outbound boundary for all cards and final answers, including live thinking-card updates; reuse uploads, degrade unavailable images to text, and preserve code examples, native image keys and callback data without per-card opt-in flags.
24
+
25
+ - Remove the retired chronological thinking-card renderer, layout configuration and fixed-count pagination. Progress, execution-details and history cards now share grouped rendering; saved history and web Preview are unchanged.
26
+
27
+ - Add owner-only `/settings` panels with a compact Common-first layout for Profile and per-Agent defaults, response/display policies and service options, with validated atomic YAML saves, stale-card protection and explicit safe-restart activation; existing tasks and history remain unchanged.
28
+ - Keep the Agent settings page to model, reasoning and permission dropdowns, using runtime catalogs with model/effort validation and preserving existing Provider settings and unavailable current values.
29
+ - Autosave settings per component without a page Save button, protect independent edits with field revisions, and keep invalid input unsaved. Single-Agent profiles show Provider/model defaults on Common instead of an Agent selector; the public base URL remains YAML-only.
30
+
31
+ - Keep Provider/model/thinking/permission changes scoped to the selected task without changing Agent defaults or conversation history.
32
+ - Persist submission boundaries: reattach known turns, retry only proven unsubmitted requests, and show uncertain execution as unverified without replaying old instructions.
33
+ - Persist Stop across preparation, retries, continuations and restarts; retain independent queued messages and verify termination instead of assuming an interrupt succeeded.
34
+ - Keep cards, task status and Preview consistent across disconnects and late events, without duplicating final replies.
35
+ - Record minimal execution provenance and effective dispatch settings in `/turn` details; preserve logical instruction identity across authorized continuations.
36
+ - Add cross-module regression tests for settings isolation, ambiguous requests, cancellation races, scheduling, migrations, Preview and delivery deduplication.
37
+
9
38
  ## [0.1.25-alpha.1] - 2026-11-05
10
39
 
11
40
  - 修复状态卡片将最终回答中的本地图片路径误当成飞书图片 key 导致发送失败:本地及外部任务的结果、执行详情复用图片上传缓存,覆盖发送、话题回复和刷新;缺失或上传失败时降级为文字,不改变普通工具日志。
package/README.md CHANGED
@@ -10,14 +10,22 @@ Use local Codex, TraeX, and compatible ACP agents through Feishu.
10
10
 
11
11
  Agent Bot runs on your computer and connects a Feishu bot to your local coding agents. Send a message to start working; the bot updates a progress card while the agent runs and sends the final answer as Markdown.
12
12
 
13
+ Cards, task lists and Turn Preview show **Unverified** when execution cannot be confirmed. Connection loss is not a failed or completed task; a later verified result updates the same card. Preview connectivity and final-message delivery are tracked separately from execution.
14
+
13
15
  ## What You Can Do
14
16
 
17
+ Recovery separates reattachment from resubmission. Only durably confirmed unsubmitted requests may retry automatically. Known active turns are reattached; ambiguous timeouts, disconnects and missing turn IDs are marked unverified without replay or timestamp-based adoption. Automatic queue dispatch pauses while unresolved, preserving queued messages; inspect execution records and send a new message to continue. Transient errors after submission no longer replay the original Prompt.
18
+
19
+ Stop persists its cancellation boundary before network operations. Pending preparation, retries and automatic continuations accepted before Stop cannot launch afterward, including after restart. An unsuccessful interrupt remains requested, not silently undone; termination is reported only when verified. Stop does not delete independent queued messages or future schedules. A new explicit instruction can start new work.
20
+
21
+ `/turn <id or index>` details show the execution source, original instruction ID, dispatch time, optional parent Turn/planned time, and actual Agent/Provider/model/thinking/permission settings at submission. This metadata survives restart; ordinary progress cards are unchanged, and historical records without provenance are not guessed or backfilled.
22
+
15
23
  - Use your existing local Codex or TraeX login from Feishu
16
24
  - Create, continue, switch, fork, and stop tasks
17
25
  - Reset the current conversation from any successfully completed progress card
18
26
  - Collaborate with text, images, files, quoted messages, merged-forwarded chat records, group chats, and topics
19
27
  - Queue follow-up Prompts or add instructions while a task is running
20
- - Automatically retry temporary model-service failures
28
+ - Automatically retry proven pre-submission transient failures
21
29
  - Continue existing work after Agent Bot restarts
22
30
  - Run through the local Console UI without Feishu
23
31
 
@@ -268,6 +276,7 @@ Send a message beginning with `/` to run a command. Use `/help` in Feishu for th
268
276
  | `/thinking` | Set reasoning effort |
269
277
  | `/permissions` | Set execution permissions |
270
278
  | `/agent [name]` | Choose the Agent for new tasks |
279
+ | `/settings` | Configure Profile and Agent defaults (owner only) |
271
280
  | `/newgroup [title] [--agent <name>] [--dir <path> \| --nodir]` | Start a task in a new private group |
272
281
  | `/forkgroup [title]` | Branch a task into a new private group |
273
282
  | `/clonegroup [title] [--agent <name>]` | Transfer dialogue into a new private group |
@@ -292,10 +301,29 @@ In a group, `/mute` and `/mute on` make the bot process only messages that menti
292
301
 
293
302
  Only groups explicitly enabled with `/mute` or `/mute on` supplement ordinary @-mention Prompts with recent human text and images. Topic requests read only that topic; ordinary group requests exclude topic messages. Reads are limited to two reverse-chronological pages of 30 messages, selecting up to 20 messages before the triggering mention, 16,000 text characters (2,000 per message), and six additional images, newest first. Bot messages, deleted messages, and later messages are excluded; non-image attachments and forwarded bundles are not expanded automatically. The original question remains the card Prompt. Included context is marked as reference data, not authorization. Successful submissions persist a bounded deduplication ledger scoped to the task, remote branch, and conversation. Scanning stops at the first message already submitted to that Agent conversation (either a direct Prompt or previously injected context): that message and all older messages are excluded, and no earlier page is requested. Queued-but-not-submitted context is deduplicated without becoming a stop boundary. `/mute off`, private chats, unmentioned messages, and slash/Shell commands do not trigger this read. Existing topic-root and explicit-reply handling remains unchanged. Reading requires the bot to have the relevant Feishu history/group-message/resource permissions; denied reads or image-download failures are reported without submitting an incomplete Prompt. This feature does not enable permissions automatically.
294
303
 
304
+ Older databases upgrade automatically at startup, including recent-context receipts created without a source Prompt field. Existing records are retained, but unknown sources are not guessed or used as conversation stop boundaries. Local database read errors are not labeled as Feishu permission failures. A receipt-write failure after a Prompt has been accepted is logged without marking the running task failed or automatically resubmitting it.
305
+
295
306
  `/new` and `/newgroup` use the conversation's default Agent unless `--agent <name>` selects another configured Agent for this task only; the source conversation's default is unchanged. For example, `/new Fix tests --agent codex` or `/newgroup Review --agent traex --dir ~/dev/project`. They inherit the current project; execution settings are inherited only when the selected Agent matches the current task's Agent, otherwise Provider, model, reasoning, and permission mode use the target Agent's saved defaults. Use `--dir` to choose another directory or `--nodir` to start without a project directory; `--nodir` requires the selected Agent to be App Server, and `~` represents your home directory.
296
307
 
297
308
  `/dir` opens the file browser. `NewFolder` creates a child directory and opens it in the same card at page one, without changing the task's working directory. `Back` cancels creation and restores the previous directory and page.
298
309
 
310
+ ### Global Settings Panel
311
+
312
+ Send `/settings` to configure the current Profile. It opens on Common, with compact tabs for Common, Agent, Group names and Advanced. Only the configured Agent Bot owner can use it, including when normal conversations accept other users; no current task is required.
313
+
314
+ | Section | Options |
315
+ | --- | --- |
316
+ | Common | Default Agent when multiple Agents are configured; otherwise default Provider and model. Also owner-only responses, all-group-message responses and automatic stable updates |
317
+ | Agent | Default model, reasoning effort and permissions as dropdowns; with one Agent, model selection moves to Common and no Agent selector is shown. Select Use Agent default to clear an override |
318
+ | Group names | Project/projectless templates and date format |
319
+ | Advanced | Console, web terminal, file/Turn Preview, listen host/port and log level |
320
+
321
+ Each control saves independently to the Profile YAML, with no separate Save button. Selectors and checkboxes save on change; text and number fields save when Feishu sends their native input-submit callback (use the input's own submit icon, not a page Save button). Feishu does not expose a blur/keystroke callback. Invalid input keeps the previous value and displays an error on the same card. **Changes take effect after a safe restart**, which remains an explicit action waiting for active tasks, terminals and final delivery. Field-level revision checks prevent stale overwrites while independent edits can be saved from the same card. No-op saves preserve the file exactly; updates retain comments, environment references and unrelated fields.
322
+
323
+ Agent model and reasoning choices come from that Agent's configured Provider, preserving upstream IDs and display names. The reasoning dropdown lists available efforts; saving validates the chosen model/effort pair. Changing the single Agent's default Provider retains its model when supported, otherwise selects the new Provider's default/first available model (or uses the Agent default if discovery is unavailable). Incompatible reasoning overrides return to the Agent default. Discovery failures show a warning; unrelated edits retain unavailable current values. The public base URL is not editable in this panel; existing `fileViewer.publicBaseUrl` values remain unchanged and can still be managed in YAML.
324
+
325
+ Global defaults never rewrite existing tasks or history; same-Agent new tasks and forks still prefer inherited settings. Naming changes do not rename existing groups. All-group-message mode still requires the corresponding Lark permissions and does not grant them automatically. Credentials, owner identity, Agent launch commands/environment, database/log paths and Lark transport debugging options remain local configuration or `agentbot init` concerns and are not displayed on cards.
326
+
299
327
  ### Scheduled Tasks
300
328
 
301
329
  `/schedule` opens this conversation's plans: create/edit forms, confirmation, pause/resume, run-now, deletion, and the latest ten run records. Plan details and run history use separate views: plan controls stay in details, while history only offers per-run details and verification. Compact navigation switches views, refreshes the current view, or returns to the list. Only the configured Agent Bot owner can manage them in Lark. A plan targets an existing local task and preserves its original private/group/topic reply route; switching the current task does not retarget it. Execution follows that task's current Provider, model, and permissions, without forking, changing history, or elevating permissions.
@@ -379,7 +407,7 @@ Relative file links in Feishu answers and thinking cards, such as `outputs/repor
379
407
 
380
408
  `/status` cards also include **Preview** beside Refresh and Stop/Switch. It opens the active Turn, or the latest Turn when idle, and updates its target when you refresh the card. For external tasks not yet recorded by Agent Bot, opening Preview loads the selected Turn from the Agent and caches its full execution details. Read failures can be retried by refreshing the page. The button is hidden if there is no Turn, no supported history reader, or the file viewer is unavailable. Viewing another task’s status does not switch or take over that task.
381
409
 
382
- Status-card results and execution details upload local Markdown images as previewable Feishu images, reusing unchanged uploads when refreshed. Missing files or upload failures fall back to readable text without blocking the card. Other card Markdown, including tool-log examples, is not automatically expanded.
410
+ All Feishu cards and final answers share one outbound image pipeline for sending, replying and updating. Local Markdown images become previewable Feishu images, with unchanged uploads reused across cards and refreshes. Missing files or upload failures fall back to readable text without blocking the card. Code examples, existing Feishu image keys and button callback data remain unchanged; individual cards do not need image-processing flags.
383
411
 
384
412
  Progress cards include a `Preview` button that opens the saved Turn timeline in a compact, mobile-friendly browser view. Reasoning panels use the content title as their collapsed header and show the text directly on expansion. 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 by patching changed sections in place, preserving expanded or collapsed steps, scroll positions, and unchanged image elements instead of reloading them. Token and other metadata updates do not replace the timeline. Collapsed tool steps and the file-change summary initially contain only their headers; commands, logs, images, and file lists are fetched on expansion. Reopening reuses loaded content, and live updates refresh only expanded details whose content changed. Failed loads offer Retry. Finished Turns do not open a live SSE connection. The waiting-for-progress placeholder is hidden once a response or other visible progress is available, and is never shown for finished Turns. 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. Beside Final answer, download and copy icons export the original Markdown (including formatting, code blocks, and unchanged link targets), not the rendered HTML. Download saves a UTF-8 `.md` file; Copy uses the clipboard with a fallback for HTTP/LAN previews and shows success or failure feedback. Both work on completed pages and when the final answer arrives live.
385
413
 
@@ -425,13 +453,13 @@ HTML files (`.html` and `.htm`) open in preview mode with a code toggle, line an
425
453
 
426
454
  CSV files (`.csv`, case-insensitive) open as read-only tables with row numbers, column letters, sticky labels, and horizontal/vertical scrolling. The first row remains data, not an inferred header. Standard comma-separated fields support quoted commas, escaped quotes, embedded newlines, empty cells, and UTF-8/UTF-16 BOM or GB18030 text decoding; numeric strings and formulas remain plain text. Preview reads at most the first 2 MiB and displays up to 500 records, 50 columns, and 4,000 characters per cell, with explicit truncation or malformed-quote notices. Incomplete records at the byte boundary are omitted. The code view displays up to 2,000 physical lines; raw/download links preserve the entire original file. Live updates retain the selected view and table scroll position.
427
455
 
428
- Provider, model, reasoning effort, and permission choices apply to the current task and are also saved under that Agent's `defaults`. If an older configuration has no `defaults` section for that Agent, it is created automatically on the first change. Future tasks that have no same-Agent settings to inherit start with those saved defaults; each configured Agent keeps its own values.
456
+ Provider, model, reasoning effort, and permission choices apply only to the current task; they never create or update Agent defaults in `config.yaml`. Use the Agent defaults page in `/settings` or explicitly edit `agents.<name>.defaults` to choose defaults for unrelated new tasks. Same-Agent `/new` and `/newgroup` still inherit the source task's settings, and `/fork` and `/forkgroup` preserve source-task settings and history.
429
457
 
430
458
  For App Server tasks, permission changes apply both approval and sandbox policies on the next Turn: `auto` uses no sandbox and no approval prompts; `confirm` uses the workspace-write sandbox and on-request approval. Choose the mode in `/permissions`, or use `agentbot task permissions auto|confirm`. Switching requires no Agent restart, fork, or new task and does not change already-running tool processes or steering requests. Workspace writable roots, network access, and temporary-directory exclusions retain the Agent's configured values.
431
459
 
432
460
  The execution settings card ends with a one-sentence Markdown blockquote for the selected tab's scope and timing. Agent selection changes only the default for new tasks in that conversation, without migrating the current task. Model, reasoning, and permission changes apply from the next turn. Agent and Provider options show their identifiers without duplicate display names, while retaining current/default indicators. `/provider` opens this card even when only one Provider is available, keeping the Model, Thinking, and Permission tabs accessible.
433
461
 
434
- Provider changes requested during an Agent Bot turn are saved as pending without interrupting it. The settings card immediately shows the target Provider and the model that will be used; the Model tab lists that Provider’s models, and later selections replace the pending choice. Thinking and permission changes made while a Provider switch is pending are staged with it. The switch is applied after the current turn ends, before a queued, retried, or new turn starts; idle tasks switch immediately. Pending settings survive restarts and do not overwrite active settings or Agent defaults until applied. If a deferred switch fails, Agent Bot restores the previous Provider and model. After verified rollback, the card returns to the original settings with an error notice, clears the pending choice, and queued/new turns continue using the original settings. Only failed or unverified rollback pauses further turns and keeps queued prompts for manual recovery. For a custom Provider, Agent Bot uses its OpenAI-compatible `/models` endpoint when available and shows only that Provider's models. A switch keeps the previous model when the target supports it, otherwise selects the target's default model or its first returned model. Providers without a model-list endpoint remain usable: Agent Bot keeps the current or configured model as the single fallback candidate and lets Codex apply it. Agent Bot verifies the task ID, Provider, and model before saving or reporting success. Tasks with history always preserve their remote thread ID and all history, including failed and interrupted Turns. Before the first message, a verified empty task without inherited history or a Goal may switch through a new remote thread, keeping the same local task, conversation, directory, and title. The old thread remains attached until the new Provider/model and persistence succeed; failure keeps the original task. No synthetic Prompt or history rewrite is used. If a switch fails, the previous settings are retained and remote recovery is attempted. If recovery also fails, further turns are blocked until a Provider switch succeeds.
462
+ Provider changes requested during an Agent Bot turn are saved as pending without interrupting it. The settings card immediately shows the target Provider and the model that will be used; the Model tab lists that Provider’s models, and later selections replace the pending choice. Thinking and permission changes made while a Provider switch is pending are staged with it. The switch is applied after the current turn ends, before a queued, retried, or new turn starts; idle tasks switch immediately. Pending settings survive restarts and do not overwrite active settings until applied; applying them never changes Agent defaults. If a deferred switch fails, Agent Bot restores the previous Provider and model. After verified rollback, the card returns to the original settings with an error notice, clears the pending choice, and queued/new turns continue using the original settings. Only failed or unverified rollback pauses further turns and keeps queued prompts for manual recovery. For a custom Provider, Agent Bot uses its OpenAI-compatible `/models` endpoint when available and shows only that Provider's models. A switch keeps the previous model when the target supports it, otherwise selects the target's default model or its first returned model. Providers without a model-list endpoint remain usable: Agent Bot keeps the current or configured model as the single fallback candidate and lets Codex apply it. Agent Bot verifies the task ID, Provider, and model before saving or reporting success. Tasks with history always preserve their remote thread ID and all history, including failed and interrupted Turns. Before the first message, a verified empty task without inherited history or a Goal may switch through a new remote thread, keeping the same local task, conversation, directory, and title. The old thread remains attached until the new Provider/model and persistence succeed; failure keeps the original task. No synthetic Prompt or history rewrite is used. If a switch fails, the previous settings are retained and remote recovery is attempted. If recovery also fails, further turns are blocked until a Provider switch succeeds.
435
463
 
436
464
  For TraeX's built-in `trae` Provider, Agent Bot uses the complete native `model/list` catalog, including model names and reasoning options, without requiring a custom Provider `base_url`. Other custom Providers keep their own model discovery and fallback behavior.
437
465
 
@@ -453,7 +481,7 @@ By default, `feishu.respondToOwnerOnly: true` accepts only messages and card act
453
481
 
454
482
  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.
455
483
 
456
- 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.
484
+ Thinking cards, execution details and activity-history cards use only the grouped layout: 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. The retired layout option is ignored in existing configuration; saved history and web Preview are unchanged.
457
485
 
458
486
  Whitespace-only Commentary does not use a pinned message slot. Adjacent omission markers generated by the card are shown once, without removing literal message text or changing saved history.
459
487
 
@@ -469,7 +497,7 @@ File-change summaries display paths as plain text, preserving Windows separators
469
497
 
470
498
  ## Troubleshooting
471
499
 
472
- After a crash, an unfinished Codex rollout alone no longer means the task is running: unloaded threads also require a live writer process. Agent Bot confirms session resume before creating a new running card. Writer conflicts stop automatic recovery with an occupancy card; other unconfirmed recovery failures are retried every five seconds for a one-minute window, then marked interrupted with a notification. No external process is closed automatically. Already-confirmed live turns remain monitored, including during temporary connection outages, and are not subject to this recovery timeout.
500
+ After a crash, Agent Bot checks recent attempts without replaying submitted work. Writer conflicts stop checks immediately; other unconfirmed checks stop after one minute and leave execution unverified. Already-confirmed live turns remain monitored, including during temporary connection outages. No external process is closed automatically.
473
501
 
474
502
  - **The bot does not respond:** run `agentbot server status` and check today's `~/.agent-bot/logs/agent-bot.YYYY-MM-DD.log`
475
503
  - **The Worker restarted after a Node crash:** check `~/.agent-bot/data/last-crash.json`, that day's `~/.agent-bot/logs/worker.stderr.YYYY-MM-DD.log`, and `~/.agent-bot/data/crash-reports/`
package/README.zh.md CHANGED
@@ -10,14 +10,22 @@
10
10
 
11
11
  Agent Bot 运行在你的电脑上,把飞书机器人连接到本机编程 Agent。发送消息即可开始工作;执行过程中机器人会更新进度卡,完成后发送 Markdown 最终回答。
12
12
 
13
+ 无法确认执行结果时,卡片、任务列表和 Turn Preview 显示 **待核实**。连接中断不代表任务失败或完成;后续确认结果会更新原卡片。网页连接状态、最终回答投递状态与任务执行状态分别记录。
14
+
13
15
  ## 可以做什么
14
16
 
17
+ 任务恢复区分重连与重发:只有持久化记录明确证明尚未提交的请求可以自动重试。已确认的活跃轮次只重连;提交超时、断连或缺失轮次 ID 显示“待核实”,不重发原 Prompt,也不凭时间匹配其他轮次。待核实时自动队列暂停,排队消息仍保留;核实执行记录后发送新消息继续。已提交轮次的临时模型错误不再触发原 Prompt 重放。
18
+
19
+ Stop 在网络操作前持久化停止边界。停止之前的准备、重试和自动续接不能在之后启动,重启后仍有效。中断失败不会撤回停止意图,也不会假报已经停止。Stop 不删除独立排队消息或未来的定时计划;新的明确指令仍可启动新工作。
20
+
21
+ `/turn <id 或序号>` 的执行详情显示触发来源、原始指令 ID、发起时间、来源轮次或计划时间,以及提交时实际使用的 Agent、Provider、模型、思考强度和权限。记录跨重启保留,不增加进度卡或改变普通思考卡片;旧轮次没有来源记录时不猜测补全。
22
+
15
23
  - 在飞书中使用本机已有的 Codex 或 TraeX 登录
16
24
  - 创建、继续、切换、分支和停止任务
17
25
  - 从任意成功完成的思考卡片重置当前对话
18
26
  - 使用文字、图片、文件、引用消息、合并转发记录、群聊和话题协作
19
27
  - 排队后续 Prompt,或在任务运行中追加指令
20
- - 模型服务临时失败时自动重试
28
+ - 仅对确认尚未提交的临时错误自动重试
21
29
  - Agent Bot 重启后继续已有工作
22
30
  - 不使用飞书时通过本地 Console UI 运行
23
31
 
@@ -265,6 +273,7 @@ agentbot task dismiss [任务] --yes
265
273
  | `/thinking` | 设置思考强度 |
266
274
  | `/permissions` | 设置执行权限 |
267
275
  | `/agent [名称]` | 选择新任务使用的 Agent |
276
+ | `/settings` | 配置 Profile 和 Agent 默认值(仅所有者) |
268
277
  | `/newgroup [标题] [--agent <名称>] [--dir <路径> \| --nodir]` | 在新私有群中开始任务 |
269
278
  | `/forkgroup [标题]` | 将任务分支到新私有群 |
270
279
  | `/clonegroup [标题] [--agent <名称>]` | 将对话上下文迁移到新私有群 |
@@ -293,10 +302,29 @@ Fork 只记录来源任务和分支轮次,不同步完整历史。普通任务
293
302
 
294
303
  只有显式开启 `/mute` 或 `/mute on` 的群,普通 @ 提问才会自动补充近期成员文字和图片。话题内仅查询当前话题,普通群主会话排除其他话题消息。最多倒序读取 2 页、每页 30 条,从中选取本次 @ 之前最多 20 条消息;文字上限 16,000 字符、单条 2,000 字符,额外图片最多 6 张,优先最近内容。排除机器人、已删除及后续消息,不自动展开文件附件或合并转发。卡片 Prompt 保留原始提问,补充内容标记为参考资料而非操作授权。提交成功后按任务、远端分支和群/话题持久化有限的去重记录。从新到旧扫描,遇到第一条已提交给当前 Agent 会话的消息(普通提问或已补充的上下文)立即停止:不重复附带该消息,不提取更早内容,也不再请求更早一页。仅在队列中尚未提交的上下文只去重,不作为停止边界。`/mute off`、私聊、未 @ 消息、斜杠及 Shell 命令不触发补读;原有话题根消息和显式引用逻辑不变。机器人需要相应的飞书历史消息、群消息和资源权限;读取或图片下载失败会明确提示,不向 Agent 提交残缺请求,也不会自动开启权限。
295
304
 
305
+ 旧数据库会在启动时自动升级,包括缺少来源 Prompt 字段的近期上下文记录。已有记录保留,但无法确认的来源不猜测、不作为停止边界。本地数据库读取失败不会误报为飞书权限不足;Prompt 已被接受后,去重记录写入失败只记录警告,不把正在执行的任务标为失败,也不自动重发。
306
+
296
307
  `/new` 和 `/newgroup` 默认使用当前会话设置的默认 Agent,也可用 `--agent <名称>` 为本次任务指定已配置的 Agent,不改变源会话的默认值。例如:`/new 修复测试 --agent codex`、`/newgroup 代码审查 --agent traex --dir ~/dev/project`。项目目录仍继承当前任务;选中的 Agent 与当前任务相同时继承运行设置,不同时使用目标 Agent 已保存的 Provider、模型、思考强度和权限默认值。使用 `--dir` 指定其他目录,或使用 `--nodir` 创建无项目目录的任务;`--nodir` 要求选中的 Agent 为 App Server,`~` 表示用户主目录。
297
308
 
298
309
  `/dir` 打开文件浏览卡片。`NewFolder` 创建子目录后,原卡片直接进入新目录的第一页,不改变任务工作目录;`Back` 取消创建并回到原目录和页码。
299
310
 
311
+ ### 全局配置面板
312
+
313
+ 发送 `/settings` 打开当前 Profile 的配置面板,默认进入“常用”,顶部提供常用、Agent、群名、高级四个紧凑页签。仅 Agent Bot 所有者可操作,无需先创建任务。
314
+
315
+ | 分组 | 可配置选项 |
316
+ | --- | --- |
317
+ | 常用 | 多 Agent 时设置默认 Agent;仅有一个 Agent 时直接设置默认 Provider 和模型。另有仅响应所有者、响应群内所有消息、正式版自动更新 |
318
+ | Agent | 默认模型、默认思考强度、默认权限下拉列表;仅有一个 Agent 时模型移至常用页,不显示 Agent 选择器。选择“使用 Agent 默认”可清除覆盖值 |
319
+ | 群名 | 项目群和无项目群的命名模板、日期格式 |
320
+ | 高级 | 本地控制台、网页终端、文件与 Turn 预览、监听地址、端口、日志级别 |
321
+
322
+ 各配置项独立保存到当前 Profile 的 YAML,不再提供单独的“保存”按钮。下拉框和开关在变更后保存;文本和数字输入框在飞书回传输入内容后保存,需要点击输入框自身的提交图标,飞书不提供失焦或逐字输入回调。无效输入不会写入,并在原卡片显示错误。**安全重启后生效**,仍需独立点击安全重启按钮,等待活跃任务、终端和结果投递结束。逐项版本校验防止覆盖同一项的新值,同一卡片修改不同项不会互相覆盖。无修改保存不重写文件;注释、环境变量引用和无关配置保持不变。
323
+
324
+ 模型和思考强度选项来自该 Agent 已配置的 Provider,保留上游 ID 和显示名称。思考强度下拉列出可用强度,保存时校验与所选模型是否兼容。单 Agent 切换默认 Provider 时,原模型受支持则保留,否则选择新 Provider 的默认或首个可用模型;列表不可用时使用 Agent 默认。不兼容的思考强度覆盖值恢复为 Agent 默认。列表获取失败会显示提示,修改其他设置不会清除不可用的当前值。“对外访问地址”不再出现在面板中;已有 `fileViewer.publicBaseUrl` 保持不变,仍可通过 YAML 管理。
325
+
326
+ 全局默认值不会修改已有任务或历史;同 Agent 的新建任务和 Fork 仍优先继承来源设置。修改群名模板不会重命名已有群。开启群内全消息响应仍需飞书对应权限,不会自动申请授权。密钥、所有者身份、Agent 启动命令/环境变量、数据库及日志路径、飞书传输调试选项仍通过本机配置或 `agentbot init` 管理,不显示在卡片中。
327
+
300
328
  ### 定时任务
301
329
 
302
330
  `/schedule` 打开当前私聊、群或话题的计划列表,提供新建/编辑表单、确认启用、暂停/恢复、立即执行、删除及最近 10 次执行记录。卡片将“计划详情”和“执行记录”分开:详情页管理计划,记录页只提供单次运行详情和状态核实;顶部轻量导航用于切换视图、刷新当前页及返回列表。只有配置的 Agent Bot 所有者可以在飞书中管理计划。计划固定绑定已有本地任务和原始回复位置,不随“当前任务”切换;执行时使用目标任务当时的 Provider、模型及权限,不 Fork、不改写历史、不自动提高权限。
@@ -374,7 +402,7 @@ Agent Bot 将用户相关文件保存在仓库之外:
374
402
 
375
403
  `/status` 状态卡片底部也提供 **Preview**,与 Refresh、Stop/Switch 放在同一行。点击可查看正在执行的轮次,空闲时则查看最近一轮;刷新卡片后会更新目标。对于尚未被 Agent Bot 记录的外部任务,打开 Preview 时会从 Agent 按需读取所选轮次并缓存完整执行详情;读取失败可刷新页面重试。没有轮次、无法读取历史且无本地记录,或文件预览服务不可用时不显示按钮。查看其他任务的状态不会切换或接管任务。
376
404
 
377
- 状态卡片的最终结果和执行详情会将本地 Markdown 图片上传为可预览的飞书图片,刷新时复用未变更的图片。文件缺失或上传失败时降级为文字,不影响整张卡片显示。其他卡片的 Markdown(包括工具日志中的示例)不自动展开图片。
405
+ 所有飞书卡片和最终回答在发送、回复、更新时共用统一图片处理链路。本地 Markdown 图片上传为可预览的飞书图片,跨卡片及刷新复用未变更的上传结果。文件缺失或上传失败时降级为文字,不影响整张卡片显示。代码示例、已有飞书图片 key 和按钮回调数据保持不变,不再要求各类卡片单独标记是否处理图片。
378
406
 
379
407
  思考卡片底部操作区提供 `Preview` 按钮,可在浏览器中查看本轮已保存的执行时间线,采用紧凑布局并适配手机,思考块直接以内容标题作为折叠标题,展开后显示内容。只有标题而没有正文时保留普通标题行,不显示折叠箭头、不请求详情;实时更新收到正文后才变为可展开项。工具块只有一级折叠,默认只显示有意义的单行命令摘要、简短耗时(如 `58s` 或 `2:32`)和完成状态。展开后先显示以 `$` 开头的完整命令,随后直接显示结果、图片和修改文件。相同的输出和错误日志只显示一次。执行中的 Turn 会通过局部更新实时显示变化,保留手动展开状态、滚动位置和未变化的图片节点,避免图片反复加载;Token 等元数据更新不会替换时间线。折叠工具块和文件变更汇总首屏只加载摘要,展开时才请求命令、日志、图片和文件列表;再次展开复用已加载内容,运行中只刷新已展开且内容变化的详情,加载失败可点击重试。已结束的 Turn 不再建立 SSE 实时连接。“正在等待 Agent 返回进度”只在尚无可显示进度时出现,已有回答、其他可见进展或 Turn 已结束时不再显示。点击文件变更列表或工具文件列表中的文件,可在新标签页预览其当前内容;已删除或不可用的文件保留为路径文字。Turn Preview 与本地文件链接共用相同的签名、访问地址和网络范围。“最终回答”旁提供下载、复制两个图标,导出原始 Markdown(保留格式、代码块和原始链接),而非渲染后的网页内容。下载为 UTF-8 `.md` 文件;复制支持 HTTP/局域网页面的回退方式,并显示成功或失败提示。已结束页面及实时到达的最终回答均可使用。
380
408
 
@@ -416,13 +444,13 @@ HTML 文件(`.html`、`.htm`)默认以预览模式打开,并支持切换
416
444
 
417
445
  CSV 文件(`.csv`,不区分大小写)默认显示只读表格,带行号、列字母和固定标签,可横向及纵向滚动;首行保留为数据,不自动当作表头。支持标准逗号分隔、引号内逗号和换行、双引号转义、空单元格,以及现有 UTF-8、带 BOM 的 UTF-16、GB18030 编码识别;数字字符串和公式均按普通文本显示。预览最多读取开头 2 MiB,表格最多显示 500 条记录、50 列、每格 4000 个字符,超限或引号格式错误时明确提示,字节边界处不完整的记录不展示。代码视图最多显示 2000 个物理行,原始文件和下载保持完整内容;实时更新保留所选模式和表格滚动位置。
418
446
 
419
- Provider、模型、思考强度和权限设置会作用于当前任务,同时保存到对应 Agent 的 `defaults` 中。以后创建没有同 Agent 设置可继承的新任务时,会使用这些默认值;每个已配置 Agent 分别保存自己的设置。
447
+ Provider、模型、思考强度和权限设置只作用于当前任务,不会在 `config.yaml` 中创建或修改 Agent 默认值。无关新任务的默认值请通过 `/settings` 的 Agent 默认值页面或显式配置 `agents.<name>.defaults` 修改。同 Agent 的 `/new` 和 `/newgroup` 仍继承源任务设置,`/fork` 和 `/forkgroup` 仍保留源任务的设置与历史。
420
448
 
421
449
  App Server 任务切换权限时,下一轮会同时应用审批与沙箱策略:`auto` 为关闭沙箱且不弹审批,`confirm` 为工作区可写沙箱并按需审批。可在 `/permissions` 卡片中选择,或使用 `agentbot task permissions auto|confirm`。切换无需重启 Agent、Fork 或新建任务,不改变已在执行的工具进程,也不会通过追加消息(steer)修改当前轮次沙箱。工作区额外可写目录、网络访问及临时目录排除项保留 Agent 的配置。
422
450
 
423
451
  运行设置卡片末尾以 Markdown 引用块显示当前选项页的一句重点提示,标明作用范围和生效时机。Agent 只改变本聊天或话题中新任务的默认 Agent,不迁移当前任务;模型、思考强度和权限从下一轮生效。Agent 和 Provider 选项只显示标识,去掉重复的展示名称,保留当前与默认状态标记。只有一个 Provider 时,`/provider` 仍会打开运行设置卡片,可以继续切换到 Model、Thinking 和 Permission 页。
424
452
 
425
- 任务正在 Agent Bot 中执行时,切换 Provider 会保存为待生效设置,不中断本轮。运行设置卡片立即显示目标 Provider 和将使用的模型,Model 页切换为该 Provider 的模型列表,可继续选择,以最后选择为准;此时修改思考强度和权限也一起暂存。本轮结束后、排队消息、重试或新轮次开始前实际应用,空闲任务则立即切换。待生效设置重启后保留,应用前不改动实际运行设置或 Agent 默认值。如果延迟切换失败,自动回退之前的 Provider 和模型;确认回退成功后,卡片恢复显示原设置并提示失败原因,清除待生效选择,排队消息和后续轮次继续使用原设置。只有回退也失败或无法确认时才暂停后续轮次、保留排队消息,等待重新选择恢复。对于自定义 Provider,Agent Bot 会在接口可用时读取其 OpenAI 兼容 `/models` 接口,并只展示该 Provider 返回的模型。切换时优先保留目标 Provider 也支持的原模型;否则选择目标 Provider 的默认模型,没有默认模型时选择返回列表中的第一个模型。未提供模型列表接口的 Provider 仍可使用:Agent Bot 会把当前或已配置模型作为唯一候选交给 Codex 应用。Agent Bot 校验任务 ID、Provider 和模型后才保存并提示成功。已有历史的任务切换时保留远端线程 ID 和全部历史,包括失败、中断的轮次。首次发消息前,确认没有历史、分支来源或 Goal 的空会话可通过新建底层线程切换 Provider,本地任务、群聊/话题绑定、目录和标题保持不变;新 Provider/模型及持久化成功前保留原线程,失败仍使用原会话,不发送虚构 Prompt 或改写历史。切换失败时保留原设置并尝试恢复远端;如果恢复也失败,将阻止后续执行,直到重新切换 Provider 成功。
453
+ 任务正在 Agent Bot 中执行时,切换 Provider 会保存为待生效设置,不中断本轮。运行设置卡片立即显示目标 Provider 和将使用的模型,Model 页切换为该 Provider 的模型列表,可继续选择,以最后选择为准;此时修改思考强度和权限也一起暂存。本轮结束后、排队消息、重试或新轮次开始前实际应用,空闲任务则立即切换。待生效设置重启后保留,应用前不改动实际运行设置;应用后也不会修改 Agent 默认值。如果延迟切换失败,自动回退之前的 Provider 和模型;确认回退成功后,卡片恢复显示原设置并提示失败原因,清除待生效选择,排队消息和后续轮次继续使用原设置。只有回退也失败或无法确认时才暂停后续轮次、保留排队消息,等待重新选择恢复。对于自定义 Provider,Agent Bot 会在接口可用时读取其 OpenAI 兼容 `/models` 接口,并只展示该 Provider 返回的模型。切换时优先保留目标 Provider 也支持的原模型;否则选择目标 Provider 的默认模型,没有默认模型时选择返回列表中的第一个模型。未提供模型列表接口的 Provider 仍可使用:Agent Bot 会把当前或已配置模型作为唯一候选交给 Codex 应用。Agent Bot 校验任务 ID、Provider 和模型后才保存并提示成功。已有历史的任务切换时保留远端线程 ID 和全部历史,包括失败、中断的轮次。首次发消息前,确认没有历史、分支来源或 Goal 的空会话可通过新建底层线程切换 Provider,本地任务、群聊/话题绑定、目录和标题保持不变;新 Provider/模型及持久化成功前保留原线程,失败仍使用原会话,不发送虚构 Prompt 或改写历史。切换失败时保留原设置并尝试恢复远端;如果恢复也失败,将阻止后续执行,直到重新切换 Provider 成功。
426
454
 
427
455
  `feishu.groupNameFormat` 可分别设置 Project 与 Projectless 新群的名称模板,支持系统、Agent、项目、任务名和日期变量。完整格式说明见[技术参考](docs/technical-reference.zh.md#配置模型)。
428
456
 
@@ -444,7 +472,7 @@ Agent Bot 启动时还会读取每个 Codex Agent 的 `CODEX_HOME/.env`(默认
444
472
 
445
473
  Agent Bot 会响应机器人所在群内拥有者发送的普通消息。将 `feishu.respondToAllGroupMessages` 设为 `false` 后,还会要求拥有者在群消息中 @ 当前机器人;私聊不受这一项影响。只有开启该配置时,初始化才会申请需要手动发布的“接收所有群消息”权限。从 `false` 改为 `true` 后,需要重新运行 `agentbot init` 并完成最后的权限步骤。
446
474
 
447
- 思考卡片默认使用分组布局:辅助 Commentary 和用户追加消息保持直接显示,每个执行组只显示最新一段原生思考,点击后可展开完整的工具命令和结果。显示命令时会省略常见的 PowerShell、zsh、bash 和 sh 启动包装前缀。失败工具仍会在自己的工具面板中标记,但不会让整个执行组显示失败图标或红色边框。执行组默认折叠,并使用稳定的组件标识,使用户在飞书中手动打开的面板在卡片更新后继续保持展开。Codex 压缩上下文时,卡片内部会把实时压缩状态显示为一条进度活动;协议提供数据时,还会显示耗时、压缩前后的上下文 token 数、已执行轮次和 rollout 磁盘占用。长任务会根据完整渲染后的卡片内容大小翻页,不再使用固定的消息数或工具数。将 `feishu.thinkingCardLayout` 设为 `timeline` 可临时恢复原版布局。
475
+ 思考卡片、执行详情和活动历史卡片只使用分组布局:辅助 Commentary 和用户追加消息保持直接显示,每个执行组只显示最新一段原生思考,点击后可展开完整的工具命令和结果。显示命令时会省略常见的 PowerShell、zsh、bash 和 sh 启动包装前缀。失败工具仍会在自己的工具面板中标记,但不会让整个执行组显示失败图标或红色边框。执行组默认折叠,并使用稳定的组件标识,使用户在飞书中手动打开的面板在卡片更新后继续保持展开。Codex 压缩上下文时,卡片内部会把实时压缩状态显示为一条进度活动;协议提供数据时,还会显示耗时、压缩前后的上下文 token 数、已执行轮次和 rollout 磁盘占用。长任务会根据完整渲染后的卡片内容大小翻页,不再使用固定的消息数或工具数。已有配置中的废弃布局字段会被忽略,保存的历史数据和网页 Preview 展示不变。
448
476
 
449
477
  纯空白 Commentary 不占用固定展示名额。卡片生成的连续省略标记只显示一次,不会删除消息正文中的省略号,也不会改动已保存的历史记录。
450
478
 
@@ -460,7 +488,7 @@ Turn Preview 中每个已保存的思考项默认折叠,开头的 Markdown 标
460
488
 
461
489
  ## 常见问题
462
490
 
463
- 异常崩溃后,不再仅凭 Codex 日志缺少结束事件就把任务判为运行中:未加载的任务还需要确认有存活的写入进程。Agent Bot 确认会话恢复成功后才创建新的运行卡片;写锁冲突会停止自动恢复并显示占用卡片,其他尚未确认恢复成功的故障每 5 秒重试,在 1 分钟重试窗口耗尽后标记中断并通知用户,不会自动关闭外部进程。已经确认仍在执行的轮次继续监控,临时断连也不会被该恢复超时误判为空闲。
491
+ 异常崩溃后,不再仅凭 Codex 日志缺少结束事件就把任务判为运行中:未加载的任务还需要确认有存活的写入进程。Agent Bot 确认会话恢复成功后才显示运行状态;写锁冲突会停止自动恢复并显示占用卡片,其他尚未确认恢复成功的故障每 5 秒检查,在 1 分钟窗口耗尽后标记待核实并通知用户,不重发已提交的指令,也不会自动关闭外部进程。已经确认仍在执行的轮次继续监控,临时断连也不会被该恢复超时误判为空闲。
464
492
 
465
493
  - **机器人没有响应:** 运行 `agentbot server status`,并查看当天的 `~/.agent-bot/logs/agent-bot.YYYY-MM-DD.log`
466
494
  - **Node 崩溃后 Worker 被自动重启:** 查看 `~/.agent-bot/data/last-crash.json`、崩溃当天的 `~/.agent-bot/logs/worker.stderr.YYYY-MM-DD.log` 和 `~/.agent-bot/data/crash-reports/`
@@ -12,8 +12,6 @@ feishu:
12
12
  project: "[{agent}] [{project}] {taskname}"
13
13
  projectless: "[{agent}] {taskname}"
14
14
  dateFormat: "MM-dd"
15
- # Use "timeline" to temporarily restore the original thinking-card layout.
16
- thinkingCardLayout: "grouped"
17
15
 
18
16
  console:
19
17
  enabled: true
@@ -52,7 +50,7 @@ agents:
52
50
  - "--listen"
53
51
  - "stdio://"
54
52
  env: {}
55
- # Updated automatically by the Provider, Model, Thinking, and Permission settings.
53
+ # Configure explicitly here or through /settings; task settings stay task-local.
56
54
  defaults:
57
55
  # modelProvider: "openai"
58
56
  # model: "gpt-5"
package/dist/cli/help.js CHANGED
@@ -62,6 +62,7 @@ export function renderCliHelp(version, language = cliLanguage) {
62
62
  选项:
63
63
  --profile <目录> 使用独立的 Profile 目录
64
64
  --config <路径> 使用指定的配置文件
65
+ 全局配置:飞书 /settings 面板,或编辑此 YAML 文件
65
66
  --json 在支持时输出 JSON
66
67
  -h, --help 显示帮助
67
68
  -v, --version 显示版本
@@ -162,6 +163,7 @@ Task commands:
162
163
  Options:
163
164
  --profile <directory> Use an isolated profile directory
164
165
  --config <path> Use a specific config file
166
+ Global settings: Lark /settings panel, or edit this YAML file
165
167
  --json Print JSON when supported
166
168
  -h, --help Show help
167
169
  -v, --version Show version
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkG9B,CAAC;IACA,CAAC;IAED,OAAO,aAAa,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkG5B,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmG9B,CAAC;IACA,CAAC;IAED,OAAO,aAAa,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmG5B,CAAC;AACF,CAAC"}
@@ -3,6 +3,7 @@ import { setTimeout as delay } from "node:timers/promises";
3
3
  import { appendGeneratedImageMarkdown } from "../utils/generatedImageMarkdown.js";
4
4
  import { normalizeTaskTitle } from "../utils/taskTitle.js";
5
5
  import { isResponseContinuationError } from "../runtime/responseErrors.js";
6
+ import { TurnNotSubmittedError } from "../runtime/submissionErrors.js";
6
7
  import { AppServerRequestError } from "./AppServerConnection.js";
7
8
  import { workspaceSandboxFromConfig, workspaceSandboxFromResponse } from "./AppServerPermissions.js";
8
9
  import { formatCodexError, mapCodexNotification } from "./CodexEventMapper.js";
@@ -209,8 +210,16 @@ export class CodexRuntime {
209
210
  }
210
211
  async startTurnNow(sessionId, prompt, responseContinuation = false) {
211
212
  const session = this.requireSession(sessionId);
212
- const client = await this.client();
213
- await this.ensureSessionResumed(session, client);
213
+ let { client, sandboxPolicy } = await (async () => {
214
+ try {
215
+ const client = await this.client();
216
+ await this.ensureSessionResumed(session, client);
217
+ return { client, sandboxPolicy: await this.turnSandboxPolicy(session, client) };
218
+ }
219
+ catch (error) {
220
+ throw new TurnNotSubmittedError(error);
221
+ }
222
+ })();
214
223
  const start = async () => client.request("turn/start", {
215
224
  threadId: session.remoteSessionId,
216
225
  input: responseContinuation ? [] : codexUserInput(prompt),
@@ -225,7 +234,7 @@ export class CodexRuntime {
225
234
  } : {}),
226
235
  summary: "auto",
227
236
  approvalPolicy: session.permissionMode === "auto" ? "never" : "on-request",
228
- sandboxPolicy: await this.turnSandboxPolicy(session, client),
237
+ sandboxPolicy,
229
238
  }, SESSION_REQUEST_TIMEOUT_MS);
230
239
  let response;
231
240
  try {
@@ -237,6 +246,7 @@ export class CodexRuntime {
237
246
  this.logger.warn({ error, sessionId: session.localSessionId, cwd: session.cwd }, "App Server rejected the task working directory; refreshing the current thread before retrying.");
238
247
  await this.resumeAppServerSession(session, client);
239
248
  session.needsResume = false;
249
+ sandboxPolicy = await this.turnSandboxPolicy(session, client);
240
250
  response = await start();
241
251
  }
242
252
  if (session.activeTurnId !== response.turn.id) {
@@ -1500,7 +1510,7 @@ export class CodexRuntime {
1500
1510
  session.activeTurnStartedAt = undefined;
1501
1511
  session.messagePhases.clear();
1502
1512
  this.emit({
1503
- type: "turn_failed",
1513
+ type: "turn_status_unknown",
1504
1514
  sessionId: session.localSessionId,
1505
1515
  turnId: activeTurnId,
1506
1516
  message: "The App Server no longer reports this execution in the thread history.",
@@ -1699,7 +1709,7 @@ export class CodexRuntime {
1699
1709
  session.activeTurnStartedAt = undefined;
1700
1710
  session.generatedImagePaths = [];
1701
1711
  this.emit({
1702
- type: "turn_failed",
1712
+ type: intentionalRelease ? "turn_cancelled" : "turn_status_unknown",
1703
1713
  sessionId: session.localSessionId,
1704
1714
  turnId,
1705
1715
  message: intentionalRelease