@keyou007/agent-bot 0.1.14-alpha.0 → 0.1.14-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +82 -55
- package/README.zh.md +82 -55
- package/config.example.yaml +5 -1
- package/dist/cli/AutostartManager.js +431 -0
- package/dist/cli/AutostartManager.js.map +1 -0
- package/dist/cli/FeishuAppConfiguration.js +17 -13
- package/dist/cli/FeishuAppConfiguration.js.map +1 -1
- package/dist/cli/Initializer.js +35 -0
- package/dist/cli/Initializer.js.map +1 -1
- package/dist/cli/SelfUpdateRunner.js +552 -0
- package/dist/cli/SelfUpdateRunner.js.map +1 -0
- package/dist/cli/SelfUpdater.js +431 -0
- package/dist/cli/SelfUpdater.js.map +1 -0
- package/dist/cli/autostartOutput.js +63 -0
- package/dist/cli/autostartOutput.js.map +1 -0
- package/dist/cli/controlProtocol.js.map +1 -1
- package/dist/cli/help.js +92 -18
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/taskGroupOptions.js +14 -11
- package/dist/cli/taskGroupOptions.js.map +1 -1
- package/dist/cli/taskListOutput.js +3 -0
- package/dist/cli/taskListOutput.js.map +1 -1
- package/dist/cli/taskTarget.js +99 -0
- package/dist/cli/taskTarget.js.map +1 -0
- package/dist/cli.js +643 -58
- package/dist/cli.js.map +1 -1
- package/dist/codex/CodexRuntime.js +16 -5
- package/dist/codex/CodexRuntime.js.map +1 -1
- package/dist/commands/CommandRouter.js +20 -1
- package/dist/commands/CommandRouter.js.map +1 -1
- package/dist/config/loadConfig.js +2 -0
- package/dist/config/loadConfig.js.map +1 -1
- package/dist/config/schema.js +2 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/console/ConsoleTurnPresenter.js +2 -0
- package/dist/console/ConsoleTurnPresenter.js.map +1 -1
- package/dist/feishu/CardRenderer.js +584 -16
- package/dist/feishu/CardRenderer.js.map +1 -1
- package/dist/feishu/FeishuConnector.js +29 -8
- package/dist/feishu/FeishuConnector.js.map +1 -1
- package/dist/feishu/FeishuMarkdown.js +25 -1
- package/dist/feishu/FeishuMarkdown.js.map +1 -1
- package/dist/feishu/FeishuMessageClient.js +43 -0
- package/dist/feishu/FeishuMessageClient.js.map +1 -1
- package/dist/feishu/FeishuTurnPresenter.js +29 -1
- package/dist/feishu/FeishuTurnPresenter.js.map +1 -1
- package/dist/feishu/ownerAccess.js +7 -0
- package/dist/feishu/ownerAccess.js.map +1 -0
- package/dist/index.js +148 -19
- package/dist/index.js.map +1 -1
- package/dist/presentation/OutboundRouter.js +19 -1
- package/dist/presentation/OutboundRouter.js.map +1 -1
- package/dist/proxy/ProxySessionController.js +1444 -66
- package/dist/proxy/ProxySessionController.js.map +1 -1
- package/dist/startup/StartupNotifier.js +65 -16
- package/dist/startup/StartupNotifier.js.map +1 -1
- package/dist/startup/startFeishu.js +2 -2
- package/dist/startup/startFeishu.js.map +1 -1
- package/dist/state/StateStore.js +268 -67
- package/dist/state/StateStore.js.map +1 -1
- package/dist/state/migrations.js +26 -0
- package/dist/state/migrations.js.map +1 -1
- package/dist/supervision/SafeRestartNotifier.js +17 -16
- package/dist/supervision/SafeRestartNotifier.js.map +1 -1
- package/dist/supervision/SafeRestartScheduler.js +12 -7
- package/dist/supervision/SafeRestartScheduler.js.map +1 -1
- package/dist/supervision/replacementSupervisor.js +45 -4
- package/dist/supervision/replacementSupervisor.js.map +1 -1
- package/dist/supervisor.js +30 -18
- package/dist/supervisor.js.map +1 -1
- package/docs/technical-reference.md +33 -10
- package/docs/technical-reference.zh.md +33 -10
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
- package/skills/agent-bot/SKILL.md +107 -182
- package/src/cli/AutostartManager.ts +579 -0
- package/src/cli/FeishuAppConfiguration.ts +22 -7
- package/src/cli/Initializer.ts +57 -0
- package/src/cli/SelfUpdateRunner.ts +817 -0
- package/src/cli/SelfUpdater.ts +688 -0
- package/src/cli/autostartOutput.ts +75 -0
- package/src/cli/controlProtocol.ts +111 -1
- package/src/cli/help.ts +92 -18
- package/src/cli/taskGroupOptions.ts +27 -17
- package/src/cli/taskListOutput.ts +10 -0
- package/src/cli/taskTarget.ts +168 -0
- package/src/cli.ts +781 -65
- package/src/codex/CodexRuntime.ts +17 -5
- package/src/commands/CommandRouter.ts +19 -1
- package/src/commands/commandTypes.ts +3 -0
- package/src/config/loadConfig.ts +2 -0
- package/src/config/schema.ts +2 -0
- package/src/console/ConsoleTurnPresenter.ts +4 -1
- package/src/feishu/CardRenderer.ts +716 -16
- package/src/feishu/FeishuConnector.ts +44 -10
- package/src/feishu/FeishuMarkdown.ts +27 -1
- package/src/feishu/FeishuMessageClient.ts +58 -0
- package/src/feishu/FeishuTurnPresenter.ts +35 -2
- package/src/feishu/ownerAccess.ts +7 -0
- package/src/feishu/types.ts +7 -0
- package/src/index.ts +192 -22
- package/src/presentation/OutboundRouter.ts +28 -3
- package/src/proxy/ProxySessionController.ts +1707 -70
- package/src/runtime/types.ts +1 -0
- package/src/startup/StartupNotifier.ts +67 -17
- package/src/startup/startFeishu.ts +5 -3
- package/src/state/StateStore.ts +413 -65
- package/src/state/migrations.ts +26 -0
- package/src/supervision/SafeRestartNotifier.ts +17 -17
- package/src/supervision/SafeRestartScheduler.ts +13 -6
- package/src/supervision/replacementSupervisor.ts +50 -4
- package/src/supervisor.ts +35 -16
|
@@ -60,6 +60,8 @@ Relative `storage.sqlitePath` and `logging.path` values resolve against the dire
|
|
|
60
60
|
|
|
61
61
|
Early in initialization, `agentbot init` checks the supported Codex and TraeX CLIs in parallel and reports each installed version. Codex is compared with the latest stable `@openai/codex` package, while TraeX is compared with its Alpha channel. Missing or outdated Agents are gathered into one numbered list containing their exact install or upgrade commands. An interactive user can enter comma- or space-separated action numbers, `all`, or an empty answer to skip maintenance. Selected commands run sequentially with inherited stdio; skipped and failed actions are recorded and initialization continues. In a non-interactive terminal, commands are printed for manual use. With `--json`, progress and prompts use stderr and the final `agents` array records detection and assistance results. Codex upgrades first use `codex update` and fall back to the current npm package command when an older updater fails.
|
|
62
62
|
|
|
63
|
+
The first fresh interactive `init` and every explicit `--reset` also ask how group messages should be handled. Selecting all group messages writes `feishu.respondToAllGroupMessages: true` and makes `im:message.group_msg` part of the configuration audit. Selecting explicit @ mentions writes `false` and excludes that permission from authorization links, polling, and missing-feature warnings. A non-interactive first initialization or reset selects mention-only mode. Later initialization runs preserve the configured value without prompting.
|
|
64
|
+
|
|
63
65
|
After version and maintenance checks, a first fresh interactive `init` and every explicit `--reset` build the Profile's Agent configuration from the supported Agents that were actually detected with an installed version. Missing Codex or TraeX entries are not selectable. When multiple Agents are available, the user may select one or more by number or standard name; `all` or an empty answer selects all. Unselected Agent definitions are removed from the new configuration through a comment-preserving atomic YAML update. One selected Agent becomes the default automatically. When multiple Agents are selected, a second prompt chooses `defaults.agent` by number or standard name. Later upgrades and refreshes preserve both the configured Agent list and default without showing either selector, including custom Agents already present in the Profile. A non-interactive first initialization or reset configures every detected installed Agent and keeps the template default when selected, otherwise the first detected Agent. An existing Profile without a valid configured default fails with an instruction to set `defaults.agent` in `config.yaml`. JSON output reports the final names in `configuredAgents`, adds `configured` to each supported-Agent inspection, and returns `defaultAgent.name` plus `defaultAgent.status` (`selected` or `existing`).
|
|
64
66
|
|
|
65
67
|
`agentbot init` copies the packaged `config.example.yaml` and `.env.example` when their target files do not exist, creates the data and log directories, and restricts `.env` permissions where the platform supports POSIX modes.
|
|
@@ -84,10 +86,10 @@ When complete credentials are absent, initialization uses Feishu one-click regis
|
|
|
84
86
|
|
|
85
87
|
Missing app configuration is handled in two stages:
|
|
86
88
|
|
|
87
|
-
1. Core configuration is requested and polled until it becomes available.
|
|
89
|
+
1. Core configuration is requested and polled until it becomes available. When all-group-message mode was selected, the manually configured `im:message.group_msg` scope is included and may be explicitly skipped with `Y`; mention-only mode excludes it entirely.
|
|
88
90
|
2. Remaining optional configuration is requested. The CLI prints its QR code followed by the authorization URL, then immediately polls for up to five minutes. An interactive terminal offers only `Y` to skip optional authorization and continue; otherwise the user completes authorization in the browser while polling continues.
|
|
89
91
|
|
|
90
|
-
Configuration supported by the one-click launcher is encoded in its `addons` manifest.
|
|
92
|
+
Configuration supported by the one-click launcher is encoded in its `addons` manifest. When all-group-message mode is selected, the core `im:message.group_msg` scope is excluded from that manifest because Feishu does not add it through one-click configuration. Instead, the CLI prints a QR code and this app-specific, pre-filtered Developer Console URL:
|
|
91
93
|
|
|
92
94
|
```text
|
|
93
95
|
https://open.feishu.cn/app/<appId>/auth?q=im%3Amessage.group_msg&op_from=openapi&token_type=tenant
|
|
@@ -105,6 +107,8 @@ After Feishu initialization succeeds, the CLI releases the initialization lock a
|
|
|
105
107
|
|
|
106
108
|
After the Server starts or a safe restart is successfully scheduled, `init` sends a Card 2.0 welcome card directly to `feishu.userOpenId`. The card uploads the packaged `assets/agent-bot-logo.png`, is always rendered in Chinese regardless of the CLI locale, and reports the installed version, default Agent, and configured Agents. When a safe restart is pending, the card says that the refreshed version takes effect after that restart instead of claiming it is already active. A Profile receipt at `<profile>/data/initialization.json` records the last successfully initialized package version so the card can distinguish first setup, version upgrade, and same-version refresh. Welcome delivery is reported in the JSON `welcome` object. A missing user Open ID or delivery failure produces an explicit warning without undoing completed configuration or stopping an already-ready Server; `--skip-feishu` records a skipped welcome.
|
|
107
109
|
|
|
110
|
+
`agentbot server autostart enable|status|disable` manages a Profile-specific operating-system registration. Windows first creates an `ONLOGON` Task Scheduler entry and falls back to a hidden per-user Startup-folder script when task creation is denied, macOS writes a `RunAtLoad` LaunchAgent, and Linux enables a systemd user unit. The registered command starts the Supervisor directly through `<profile>/autostart/supervisor-bootstrap.mjs`; the bootstrap stores only the Node executable, installed Supervisor path, Profile path, config path, and safe executable search path, clears inherited Feishu credential variables, and then lets the selected Profile load its own `.env`. LaunchAgent `KeepAlive` and systemd `Restart` are disabled because the Supervisor already owns Worker recovery and `server stop` must remain stopped until the next login or boot. Linux `--linger` runs `loginctl enable-linger` so the user unit can start before login; disabling Agent Bot autostart deliberately leaves this user-wide setting unchanged. Disabling autostart never stops the currently running Server. Status reports both OS registration/loading state and live Agent Bot readiness. Unsupported operating systems can inspect status but cannot enable registration.
|
|
111
|
+
|
|
108
112
|
## Feishu App Requirements
|
|
109
113
|
|
|
110
114
|
Core configuration required for basic messaging:
|
|
@@ -112,7 +116,7 @@ Core configuration required for basic messaging:
|
|
|
112
116
|
- Bot capability
|
|
113
117
|
- Persistent-connection event delivery
|
|
114
118
|
- `im.message.receive_v1`
|
|
115
|
-
- `im:message.group_msg` for all user messages in groups containing the bot
|
|
119
|
+
- `im:message.group_msg` for all user messages in groups containing the bot, only when all-group-message mode is selected
|
|
116
120
|
- Tenant permission for private messages
|
|
117
121
|
- `im:message:send_as_bot` or a broader equivalent
|
|
118
122
|
- `application:application:self_manage` so initialization can inspect the published version
|
|
@@ -140,7 +144,9 @@ feishu:
|
|
|
140
144
|
appId: "${FEISHU_APP_ID}"
|
|
141
145
|
appSecret: "${FEISHU_APP_SECRET}"
|
|
142
146
|
userOpenId: "${FEISHU_USER_OPEN_ID}"
|
|
147
|
+
respondToOwnerOnly: true
|
|
143
148
|
respondToAllGroupMessages: true
|
|
149
|
+
thinkingCardLayout: "grouped"
|
|
144
150
|
|
|
145
151
|
console:
|
|
146
152
|
enabled: true
|
|
@@ -172,9 +178,15 @@ logging:
|
|
|
172
178
|
path: "./logs/agent-bot.log"
|
|
173
179
|
```
|
|
174
180
|
|
|
175
|
-
`feishu.
|
|
181
|
+
`feishu.respondToOwnerOnly` defaults to `true`. It compares each message sender and card-action operator Open ID with `feishu.userOpenId`, ignoring non-owner input before durable event claims, reactions, downloads, commands, or Agent work. Set it to `false` to allow other users. If it is enabled without a configured owner Open ID, all Feishu messages and card actions are ignored; configure `FEISHU_USER_OPEN_ID` or temporarily disable the restriction to bootstrap from a private message.
|
|
182
|
+
|
|
183
|
+
`feishu.respondToAllGroupMessages` defaults to `true` in the template, while first initialization and `init --reset` write the user's selected mode. Set it to `false` to ignore owner group messages unless they mention the current bot. The worker resolves the bot's Open ID at startup so mentioning another member does not trigger it. Owner private messages are unaffected. Initialization requests all-user group-message delivery only when this value is `true`; changing a mention-only Profile to `true` later requires rerunning `agentbot init` to add the permission.
|
|
184
|
+
|
|
185
|
+
`/mute` and `/mute on` persist mention-only response mode for the current base group; `/mute off` disables it. The group timeline and every topic share this state. While muted, messages that do not mention the current bot are ignored before event claims, reactions, activity tracking, image downloads, command parsing, or Agent calls. The command that disables mute must itself mention the bot. Private chats do not support `/mute`.
|
|
186
|
+
|
|
187
|
+
`feishu.thinkingCardLayout` defaults to `grouped`. The grouped renderer keeps Commentary and user steering messages visible, uses Commentary as the only execution-group boundary, uses only the latest native reasoning as each group title, and keeps every tool available inside the group. Command panels remove PowerShell launchers and POSIX command-string launchers such as `/bin/zsh -lc`, `/bin/bash -c`, and `/usr/bin/env sh -c` from both their titles and expanded command text without changing the command that is executed. Execution-group status is intentionally non-failing: while any child tool is running the group uses the running treatment, otherwise it settles to the neutral treatment; failed tools retain their own failure icon inside the group. Every execution panel is rendered with a collapsed default and a stable `element_id`; Agent Bot never changes the expanded flag based on tool status, user steering, or later Commentary, allowing the Feishu client to retain a user's manual expansion across full-card updates. Grouped pagination first renders complete tool panels, then fills pages from the newest end according to the rendered UTF-8 JSON size and component count. The activity area is limited to 24KB and 160 components, leaving headroom under Feishu's recommended 30KB card size and 200-component hard limit for the header, plan, files, and actions. Execution groups above eight tools are split into stable subpanels, but every tool keeps its expandable command, result, and image content. History pages are measured separately with complete native reasoning included. Set the option to `timeline` to use the unchanged original renderer and its 40-activity pages while the grouped layout is being refined.
|
|
176
188
|
|
|
177
|
-
`agentbot server start` requires both Feishu credentials. The worker starts the SDK's persistent connection without inspecting SDK logs or private connection state, then sends startup status cards as an outbound readiness check. Each startup card includes the Agent Bot version read from the installed package metadata. Every startup sends a card to every known private chat, regardless of recent activity, plus each non-topic group active during the minute before this Worker started. After a safe restart, it also sends to every
|
|
189
|
+
`agentbot server start` requires both Feishu credentials. The worker starts the SDK's persistent connection without inspecting SDK logs or private connection state, then sends startup status cards as an outbound readiness check. Each startup card includes the Agent Bot version read from the installed package metadata. Every startup sends a card to every known private chat, regardless of recent activity, plus each non-topic group active during the minute before this Worker started. After a safe restart, it also sends to every conversation enrolled in that restart's notification set regardless of activity age. Topic routes retain their originating message anchor across the replacement Supervisor and receive the startup card as a reply in the original topic instead of creating a new root topic in the parent group. Safe-restart progress cards have a narrower audience: only conversations that explicitly requested the current restart receive and update them; recently active chats are not enrolled automatically. If the database has no eligible chat yet, it sends the startup card to `feishu.userOpenId` using an `open_id` private message. When startup notification targets exist, at least one card must be delivered before the server reports ready; individual target failures remain isolated. If neither a known chat nor `feishu.userOpenId` is available, startup continues without the outbound check. With `respondToOwnerOnly: false`, the first subsequent private message can persist the missing user Open ID for later startup notifications and CLI-created groups; the default owner-only mode requires the owner Open ID to be configured first. Missing credentials still fail startup with an initialization hint. `agentbot console` is the explicit local-only path and does not require Feishu credentials.
|
|
178
190
|
|
|
179
191
|
At least one agent must be configured. `defaults.agent` must name a configured agent.
|
|
180
192
|
|
|
@@ -229,7 +241,7 @@ The new group's welcome message reports the persisted fork settings: Provider, m
|
|
|
229
241
|
- Exact slash command names take priority. Otherwise, a unique command-name prefix or registered compound-command initialism is expanded before argument parsing; ambiguous matches are rejected with their candidate commands. Registered initialisms are `fg` for `forkgroup`, `ng` for `newgroup`, and `ns` for `nosteer`.
|
|
230
242
|
- Unknown slash commands are rejected and never forwarded as Prompts.
|
|
231
243
|
|
|
232
|
-
Each turn owns one progress card. Normal updates are throttled to one every two seconds; critical updates have a 500 ms minimum gap. On completion, Agent Bot updates the progress card to a terminal state before sending a separate final Markdown message.
|
|
244
|
+
Each turn owns one progress card. Normal updates are throttled to one every two seconds; critical updates have a 500 ms minimum gap. On completion, Agent Bot updates the progress card to a terminal state before sending a separate final Markdown message. Grouped thinking cards derive execution groups only while rendering; the persisted chronological activity stream remains layout-independent, so changing layouts or restarting a Worker does not discard reasoning or tool history.
|
|
233
245
|
|
|
234
246
|
Successfully completed progress cards include a `Reset` action with its compact effect warning directly below the action. `/turns` places the same effect warning at the top, then presents the current task's completed-turn snapshots in reverse chronological order, 10 per page. Each `turn_started` event persists the previous completed turn as its parent. Existing tasks are backfilled from snapshot timestamps and `session_reset_to_turn` audits, so the first turn after a historical Reset points to the selected turn instead of the time-adjacent abandoned branch. The renderer computes lanes across the complete history before slicing a page, then displays true continuations and merges in the graph column, indented content in the second column, and state or action in the third. The current conversation point is marked instead of showing an action; every other turn has a `Reset` action. Pagination and successful Reset actions update the same card, remain bound to the task that opened it, and move the current marker to the selected turn. The success text identifies the target with its Prompt summary, completion time, and Turn ID. Agent Bot records the App Server thread that originally owned each turn, forks that thread through the selected turn, and replaces the current task's remote thread binding without changing its local task ID, title, Agent, project directory, execution settings, or chat routing. Existing snapshots after the selected turn are not deleted, so the card shows retained turns from the old path together with turns later completed on the new branch. Reset is rejected while the current task is active, and it never reverts local file changes.
|
|
235
247
|
|
|
@@ -243,7 +255,7 @@ Incoming rich-text images are downloaded into the inbound image cache and passed
|
|
|
243
255
|
|
|
244
256
|
Each task entry exposes `NewGroup` and `ForkGroup` callbacks. The callback payload keeps the selected task ID and source context, while the Lark operator `open_id` is used to invite the user to the new group. `NewGroup` resolves the selected task's project and execution settings; `ForkGroup` resolves its latest available completed turn.
|
|
245
257
|
|
|
246
|
-
|
|
258
|
+
Every `agentbot task` operation accepts `--task <task>` and retains the legacy leading positional task reference. Inside an Agent Bot-started Agent, omitting both resolves the current task from the Codex or TraeX App Server Thread ID. Outside Agent Bot, an explicit task remains required. The CLI exposes group operations through `agentbot task newgroup [task] [title] [--agent <name>] [--dir <cwd> | --nodir]` and `agentbot task forkgroup [task] [title]`. Both commands require a running Server and send the stable local task ID over the Profile's local control endpoint. Since a CLI process has no Lark operator, the Server invites `feishu.userOpenId`, which initialization stores as `FEISHU_USER_OPEN_ID`. New-group creation inherits the selected task's Agent and execution settings by default. `--agent <standard-name>` selects another configured runtime while retaining the source project shape; execution settings are omitted so that runtime applies its own defaults. ForkGroup uses the source task's latest available completed turn and leaves an active source turn running. Both control responses include the new chat, group context, source task, and created task; `--json` prints that structure without localization.
|
|
247
259
|
|
|
248
260
|
## App Server Provider Settings
|
|
249
261
|
|
|
@@ -271,10 +283,15 @@ SQLite stores:
|
|
|
271
283
|
- Local and App Server task/thread identifiers
|
|
272
284
|
- Model, reasoning effort, and permission mode
|
|
273
285
|
- Queued Prompts
|
|
286
|
+
- Accepted/running turn attempts, including the original route, Prompt, images, and message anchor
|
|
274
287
|
- Progress snapshots and message bindings
|
|
275
288
|
- Final-message delivery records
|
|
276
289
|
|
|
277
|
-
On startup, Agent Bot
|
|
290
|
+
On every Worker startup, Agent Bot scans nonterminal turn attempts before releasing persisted Prompt queues. Only attempts with activity during the preceding five minutes are eligible; runtime events and a one-minute heartbeat refresh the durable activity timestamp while a turn remains active. Older unfinished attempts are marked interrupted without a recovery notification or continuation. Eligible recovery first notifies the original private chat, group, or topic. A remotely completed turn is synchronized and only its pending final delivery is resumed. A remotely active turn is reattached to a new progress card and polled until terminal. A stale App Server turn or an interrupted ACP process is continued in the same task and workspace with a new turn and a new progress card; the continuation Prompt tells the Agent to inspect existing effects before repeating work. Recovery retries remain durable across repeated restarts.
|
|
291
|
+
|
|
292
|
+
When a turn ends with a transient LLM-service failure, Agent Bot automatically starts up to three additional turns in the same task. Rate limits, temporary overload, upstream 5xx responses, timeouts, and interrupted provider streams are retryable. Authentication, quota exhaustion, context limits, invalid requests, unsupported models, permissions, policy failures, and tool errors are terminal immediately. Every retry gets a fresh progress card and a Prompt that warns the Agent to inspect existing effects before repeating work. The retry count and pending message bindings are persisted; original and steering-message reactions remain pending and follow the newest retry turn until it succeeds or exhausts the retry budget.
|
|
293
|
+
|
|
294
|
+
Agent Bot also reconciles when turn identifiers change, terminal notifications arrive, or control requests fail. Stale persisted `inProgress` turns are not considered active unless the App Server thread itself reports an active status.
|
|
278
295
|
|
|
279
296
|
The final-delivery ledger prevents duplicate successful replies. App Server requests use finite timeouts so a stalled request cannot permanently occupy a message route. Session lifecycle requests allow 60 seconds because compatible third-party Agents may need more than 30 seconds for `thread/start`; control requests remain shorter.
|
|
280
297
|
|
|
@@ -301,7 +318,7 @@ A safe restart waits for:
|
|
|
301
318
|
|
|
302
319
|
The Feishu `/restart` command uses this safe path by default; `/restart --force` restarts immediately and may interrupt active work. The command rejects every other argument. New messages reset the quiet timer. CLI `--immediate` and `--force` also skip these checks. Exit code `75` identifies an intentional worker restart.
|
|
303
320
|
|
|
304
|
-
A pending safe-restart schedule accumulates the exact notification route of every conversation that triggers it. Every inbound user message, including slash commands, marks its base private or group conversation active.
|
|
321
|
+
A pending safe-restart schedule accumulates the exact notification route of every conversation that triggers it. Every inbound user message, including slash commands, marks its base private or group conversation active. Each enrolled route receives its own status card and final restarting acknowledgement and remains enrolled until the schedule ends. Repeated routes are deduplicated; when a topic route was first discovered without a message anchor, a later anchored trigger upgrades it. Topic requests retain the originating message ID and use a thread reply so restart updates cannot fall back to the group body. Each route also retains the reason supplied by that conversation, so a later request elsewhere cannot overwrite an earlier card with an unrelated reason. Before replacement, Agent Bot passes every complete route, including topic message anchors, through the replacement Supervisor and uses the same route for the post-restart startup card. The Supervisor retains the routes until the Worker has remained stable for 60 seconds, so an early crash-driven relaunch does not lose required recipients.
|
|
305
322
|
|
|
306
323
|
Use `agentbot server restart --task <task>` when a CLI request belongs to a specific task. Task numbers, full IDs, and unambiguous ID prefixes are resolved before the control request is sent. Without `--task`, the Server infers the safe-restart status route only when all running tasks belong to one conversation; it rejects an ambiguous request spanning multiple running conversations. A CLI restart with no running task has no conversation owner for its waiting status.
|
|
307
324
|
|
|
@@ -320,7 +337,7 @@ Model, reasoning effort, permission mode, and project shape are inherited where
|
|
|
320
337
|
|
|
321
338
|
## Managed System Skill
|
|
322
339
|
|
|
323
|
-
|
|
340
|
+
Every successful `agentbot init` installs or refreshes the packaged Agent Bot skill in the shared agent skill directory. The same managed installation can also be controlled explicitly:
|
|
324
341
|
|
|
325
342
|
```powershell
|
|
326
343
|
agentbot skills install
|
|
@@ -366,6 +383,12 @@ The npm Trusted Publisher is configured for:
|
|
|
366
383
|
|
|
367
384
|
The publish workflow uses GitHub OIDC instead of a long-lived npm token and publishes from a GitHub-hosted Node.js 24 runner.
|
|
368
385
|
|
|
386
|
+
### Installed-package self-update
|
|
387
|
+
|
|
388
|
+
`agentbot update` accepts only a real global npm installation whose package directory matches `npm root --global`. It refuses source checkouts, npm links, symlinked global packages, and other package-manager layouts. A prerelease installation follows npm's `alpha` tag by default; a stable installation follows `latest`. `--alpha`, `--stable`, and `--version` override selection, while a downgrade additionally requires `--allow-downgrade`.
|
|
389
|
+
|
|
390
|
+
Before touching the active installation, the CLI downloads the exact npm tarball, installs it under the active Profile's `updates` directory, validates package identity plus CLI version/help, copies the complete current package, and creates an npm rollback tarball. If the service is running, the existing safe-restart scheduler waits for active tasks, final delivery, and the quiet window. A standalone copied runner then waits for the Worker and Supervisor to exit, backs up the SQLite database together with its WAL/SHM files, installs the already-validated tarball globally, validates the installed files again, and runs the updated CLI's non-interactive `init --skip-feishu --json` before starting the service. This refreshes Profile files and the managed Skill without starting a duplicate Server or waiting for Lark authorization. Failed installation, initialization, or activation restores the database and reinstalls the old tarball; if that rollback cannot restore a runnable service, the runner starts the complete package backup directly. The operation's `update.log`, `result.json`, package backup, and database backup remain under the Profile for diagnosis.
|
|
391
|
+
|
|
369
392
|
## Development And Source Installation
|
|
370
393
|
|
|
371
394
|
```powershell
|
|
@@ -60,6 +60,8 @@ CLI 通过 Node.js 国际化能力读取系统 Locale。以 `zh` 开头的 Local
|
|
|
60
60
|
|
|
61
61
|
初始化开始阶段,`agentbot init` 会并行检查目前支持的 Codex 和 TraeX CLI,并显示各自已安装的版本。Codex 与最新稳定版 `@openai/codex` 比较,TraeX 与 Alpha 通道比较。未安装或版本较旧的 Agent 会汇总到一个编号列表,并显示准确的安装或升级命令。交互式用户可以输入用逗号或空格分隔的操作编号、输入 `all`,或直接回车跳过维护;所选命令按顺序执行并继承终端输入输出,跳过或失败的操作都会记录结果,初始化继续。非交互式终端只显示供手动执行的命令。使用 `--json` 时,进度与询问写入 stderr,最终 `agents` 数组记录检测和辅助执行结果。Codex 升级会先执行 `codex update`,旧版 updater 失败时回退到当前 npm 包安装命令。
|
|
62
62
|
|
|
63
|
+
第一次全新交互式 `init` 和每次显式 `--reset` 还会询问群消息响应方式。选择接收所有群消息会写入 `feishu.respondToAllGroupMessages: true`,并把 `im:message.group_msg` 纳入配置审计;选择明确 @ 机器人会写入 `false`,该权限不会出现在授权链接、轮询或缺失功能警告中。第一次非交互式初始化或 reset 默认选择仅 @ 响应。后续初始化保留已有配置,不再询问。
|
|
64
|
+
|
|
63
65
|
版本与维护检查完成后,第一次全新交互式 `init` 和每次显式 `--reset` 都会根据实际检测到安装版本的受支持 Agent 生成 Profile 的 Agent 配置;仍未安装的 Codex 或 TraeX 不会进入候选列表。检测到多个 Agent 时,用户可以通过编号或标准名选择一个或多个,输入 `all` 或直接回车选择全部。未选择的 Agent 定义会通过保留注释的 YAML 原子更新从新配置中移除。只选择一个 Agent 时自动将其设为默认值;选择多个时再显示一次默认 Agent 选择,可输入编号或标准名写入 `defaults.agent`。后续升级和同版本刷新直接保留已配置 Agent 列表与默认值,不再显示这两类选择器,已有自定义 Agent 也会保留。第一次非交互式初始化或 reset 会配置所有检测到且已安装的 Agent;模板默认值在所选列表中时继续使用,否则选择第一个检测结果。已有 Profile 没有有效默认值时会失败,并提示在 `config.yaml` 中设置 `defaults.agent`。JSON 输出通过 `configuredAgents` 报告最终列表,在每个受支持 Agent 的检测结果中增加 `configured`,并通过 `defaultAgent.name` 和 `defaultAgent.status`(`selected` 或 `existing`)报告默认值。
|
|
64
66
|
|
|
65
67
|
目标文件不存在时,`agentbot init` 会复制随包提供的 `config.example.yaml` 和 `.env.example`,创建数据和日志目录,并在平台支持时把 `.env` 权限限制为 POSIX `0600`。
|
|
@@ -84,10 +86,10 @@ CLI 通过 Node.js 国际化能力读取系统 Locale。以 `zh` 开头的 Local
|
|
|
84
86
|
|
|
85
87
|
缺失配置分两阶段处理:
|
|
86
88
|
|
|
87
|
-
1.
|
|
89
|
+
1. 请求核心配置并轮询,直到基础能力生效。选择接收所有群消息时会包含需要手动配置的 `im:message.group_msg`,并允许输入 `Y` 显式跳过;仅 @ 响应模式会完全排除该权限
|
|
88
90
|
2. 请求其余可选配置。CLI 会先显示二维码,随后显示授权链接,然后立即开始最多 5 分钟的轮询。交互式终端只提供 `Y` 选项,用于跳过可选授权并继续;否则用户直接在浏览器中完成授权,轮询会持续进行
|
|
89
91
|
|
|
90
|
-
一键配置支持的内容会编码到 launcher 的 `addons`
|
|
92
|
+
一键配置支持的内容会编码到 launcher 的 `addons` 清单中。选择接收所有群消息时,核心权限 `im:message.group_msg` 不会放入该清单,因为飞书无法通过一键配置新增它。CLI 会改为显示二维码,以及当前应用已筛选该权限的开发者后台直达链接:
|
|
91
93
|
|
|
92
94
|
```text
|
|
93
95
|
https://open.feishu.cn/app/<appId>/auth?q=im%3Amessage.group_msg&op_from=openapi&token_type=tenant
|
|
@@ -105,6 +107,8 @@ https://open.feishu.cn/app/<appId>/auth?q=im%3Amessage.group_msg&op_from=openapi
|
|
|
105
107
|
|
|
106
108
|
Server 成功启动或安全重启成功安排后,`init` 会直接向 `feishu.userOpenId` 发送 Card 2.0 私聊欢迎卡。无论 CLI 使用什么系统语言,欢迎卡都固定显示中文;卡片会上传随包提供的 `assets/agent-bot-logo.png`,并显示当前安装版本、默认 Agent 和已配置 Agent。如果安全重启仍在等待,卡片会明确说明刷新后的版本将在重启完成后生效,而不会声称新版已经接管。`<profile>/data/initialization.json` 会记录上次成功初始化的包版本,用于区分首次初始化、版本升级和同版本配置刷新。JSON 输出通过 `welcome` 对象报告发送结果。缺少用户 Open ID 或卡片发送失败时会明确警告,但不会撤销已完成的配置,也不会停止已经就绪的 Server;`--skip-feishu` 会记录欢迎卡已跳过。
|
|
107
109
|
|
|
110
|
+
`agentbot server autostart enable|status|disable` 管理每个 Profile 独立的操作系统启动项。Windows 会先创建 `ONLOGON` 任务计划;如果系统拒绝创建任务,则自动回退到隐藏窗口启动的当前用户启动文件夹脚本。macOS 写入 `RunAtLoad` LaunchAgent,Linux 启用 systemd 用户单元。启动项通过 `<profile>/autostart/supervisor-bootstrap.mjs` 直接启动 Supervisor;bootstrap 只保存 Node 可执行文件、已安装 Supervisor、Profile、配置文件路径和安全的可执行文件搜索路径,会清除继承的飞书凭据变量,再由目标 Profile 自己的 `.env` 加载密钥。LaunchAgent 的 `KeepAlive` 和 systemd 的 `Restart` 均保持关闭,因为 Worker 恢复已经由 Supervisor 负责,同时必须保证 `server stop` 后直到下次登录或开机前不会被立刻拉起。Linux 的 `--linger` 会执行 `loginctl enable-linger`,让用户单元可在登录前启动;禁用 Agent Bot 自启动时不会关闭这个用户级全局设置。禁用自启动也不会停止当前 Server。状态命令会同时显示操作系统注册/加载状态和 Agent Bot 实际就绪状态。不支持的平台可以查看状态,但不能启用启动项。
|
|
111
|
+
|
|
108
112
|
## 飞书应用要求
|
|
109
113
|
|
|
110
114
|
基础消息能力依赖以下核心配置:
|
|
@@ -112,7 +116,7 @@ Server 成功启动或安全重启成功安排后,`init` 会直接向 `feishu.
|
|
|
112
116
|
- 机器人能力
|
|
113
117
|
- 长连接事件接收
|
|
114
118
|
- `im.message.receive_v1`
|
|
115
|
-
- `im:message.group_msg
|
|
119
|
+
- `im:message.group_msg`,仅在选择接收所有群消息时申请,用于接收机器人所在群内的全部用户消息
|
|
116
120
|
- 接收私聊消息所需的租户权限
|
|
117
121
|
- `im:message:send_as_bot` 或覆盖它的更大权限
|
|
118
122
|
- `application:application:self_manage`,供初始化检查已发布版本
|
|
@@ -140,7 +144,9 @@ feishu:
|
|
|
140
144
|
appId: "${FEISHU_APP_ID}"
|
|
141
145
|
appSecret: "${FEISHU_APP_SECRET}"
|
|
142
146
|
userOpenId: "${FEISHU_USER_OPEN_ID}"
|
|
147
|
+
respondToOwnerOnly: true
|
|
143
148
|
respondToAllGroupMessages: true
|
|
149
|
+
thinkingCardLayout: "grouped"
|
|
144
150
|
|
|
145
151
|
console:
|
|
146
152
|
enabled: true
|
|
@@ -172,9 +178,15 @@ logging:
|
|
|
172
178
|
path: "./logs/agent-bot.log"
|
|
173
179
|
```
|
|
174
180
|
|
|
175
|
-
`feishu.
|
|
181
|
+
`feishu.respondToOwnerOnly` 默认为 `true`。每条消息的发送者及卡片操作人的 Open ID 都会与 `feishu.userOpenId` 比较;非拥有者输入会在持久化事件、添加 reaction、下载图片、执行命令或启动 Agent 前被忽略。设为 `false` 可允许其他用户。开启后若未配置拥有者 Open ID,所有飞书消息和卡片操作都会被忽略;需先配置 `FEISHU_USER_OPEN_ID`,或临时关闭限制后通过私聊完成补全。
|
|
182
|
+
|
|
183
|
+
`feishu.respondToAllGroupMessages` 在模板中默认为 `true`,第一次初始化和 `init --reset` 会按用户选择写入实际值。设为 `false` 后,拥有者未 @ 当前机器人的群消息也会被忽略;Worker 启动时会解析机器人的 Open ID,因此 @ 其他成员不会误触发。拥有者私聊不受影响。初始化只在该值为 `true` 时申请接收全部群消息的权限;仅 @ 响应的 Profile 后续改为 `true` 时,需要重新运行 `agentbot init` 补充权限。
|
|
184
|
+
|
|
185
|
+
`/mute` 或 `/mute on` 会为当前基础群聊持久化仅 @ 响应模式,`/mute off` 会关闭。群正文及其所有话题共享该状态;静音期间未 @ 当前机器人的消息会在事件去重、reaction、活跃时间、图片下载、命令解析和 Agent 调用之前被忽略。关闭静音的命令本身也必须 @ 机器人。私聊不支持 `/mute`。
|
|
186
|
+
|
|
187
|
+
`feishu.thinkingCardLayout` 默认为 `grouped`。分组渲染器保持 Commentary 和用户追加消息可见,只把 Commentary 作为执行组边界;每个执行组只用最新原生思考作为标题,展开后仍可查看组内全部工具。命令面板会从标题和展开后的命令正文中去掉 PowerShell 启动器,以及 `/bin/zsh -lc`、`/bin/bash -c`、`/usr/bin/env sh -c` 等 POSIX 命令字符串启动器,但不会修改实际执行的命令。执行组状态不会聚合为失败:存在运行中工具时使用运行中样式,否则回到中性样式;失败工具仍在组内保留自己的失败图标。所有执行面板都以折叠状态作为默认值,并使用稳定的 `element_id`;Agent Bot 不再根据工具状态、用户追加或后续 Commentary 改写展开属性,让飞书客户端能够在整卡更新时保留用户手动展开的状态。分组分页会先完整渲染工具面板,再根据生成内容的 UTF-8 JSON 大小和组件数量从最新端向前装页。活动区上限为 24KB 和 160 个组件,为飞书建议的 30KB 卡片大小及 200 个组件硬限制预留标题、计划、文件变更和操作按钮空间。超过 8 个工具的单个执行组会拆成标识稳定的子面板,但每个工具都继续保留可展开的命令、结果和图片内容。历史页会包含完整原生思考并独立测量。新版布局完善期间,可将该配置设为 `timeline` 使用保持不变的原版渲染器及其每页 40 条活动规则。
|
|
176
188
|
|
|
177
|
-
`agentbot server start` 要求同时配置飞书 `appId` 和 `appSecret`。Worker 启动 SDK 长连接时不读取 SDK 日志或私有连接状态,随后通过发送启动状态卡片检查出站能力。每张启动卡片都会显示从已安装包元数据读取的 Agent Bot 版本。每次启动都会向所有已知私聊发送卡片,不受最近活跃时间影响;同时向本次 Worker 启动前 1
|
|
189
|
+
`agentbot server start` 要求同时配置飞书 `appId` 和 `appSecret`。Worker 启动 SDK 长连接时不读取 SDK 日志或私有连接状态,随后通过发送启动状态卡片检查出站能力。每张启动卡片都会显示从已安装包元数据读取的 Agent Bot 版本。每次启动都会向所有已知私聊发送卡片,不受最近活跃时间影响;同时向本次 Worker 启动前 1 分钟内活跃的非话题群聊发送卡片。安全重启后,还会向所有已加入本次重启通知范围的会话发送,不受活跃时间限制;话题路由及其原始消息锚点会完整经过替换 Supervisor,启动卡以回复形式返回原话题,不会在父群创建新的根话题。安全重启进度卡的范围更窄:只有明确触发本次安全重启的会话会收到并持续更新,最近活跃会话不会被自动加入。数据库里尚无符合条件的会话时,启动卡改用 `feishu.userOpenId`,按 `open_id` 私聊发送。存在启动通知目标时,至少一张卡片发送成功后 Server 才报告就绪,单个目标发送失败仍相互隔离。如果既没有已知会话,也没有 `feishu.userOpenId`,启动会跳过出站检查并继续;仅当 `respondToOwnerOnly: false` 时,之后收到的第一条私聊消息可以补全用户 Open ID,供后续启动通知和 CLI 建群使用。默认的仅拥有者模式要求先配置拥有者 Open ID。缺少凭据时仍会启动失败并提示先初始化。`agentbot console` 是明确的纯本地入口,不需要飞书凭据。
|
|
178
190
|
|
|
179
191
|
必须至少配置一个 Agent,`defaults.agent` 必须指向已配置的 Agent。
|
|
180
192
|
|
|
@@ -229,7 +241,7 @@ Agent Bot 会在每个 `thread/fork` 请求中默认发送实验性的 `excludeT
|
|
|
229
241
|
- 完整斜杠命令名优先;否则在解析参数前展开唯一的命令名前缀或已登记的复合命令首字母缩写,匹配多个命令时会拒绝并列出候选命令。当前缩写为 `fg` → `forkgroup`、`ng` → `newgroup`、`ns` → `nosteer`
|
|
230
242
|
- 未知斜杠命令会被拒绝,不会作为 Prompt 转发
|
|
231
243
|
|
|
232
|
-
每个 turn 只有一张进度卡。普通更新最多每两秒一次,关键更新最短间隔 500 毫秒。完成时先把进度卡更新为终态,再单独发送 Markdown
|
|
244
|
+
每个 turn 只有一张进度卡。普通更新最多每两秒一次,关键更新最短间隔 500 毫秒。完成时先把进度卡更新为终态,再单独发送 Markdown 最终回答。分组思考卡片只在渲染时派生执行组,持久化的时间线活动不依赖布局,因此切换布局或 Worker 重启都不会丢失思考和工具历史。
|
|
233
245
|
|
|
234
246
|
成功完成的思考卡片包含 `Reset` 操作,其作用提示紧跟在按钮下方。`/turns` 卡片把相同的作用提示放在最上方,然后按时间倒序显示当前任务的已完成 turn,每页 10 条。每次 `turn_started` 都会把前一个已完成 turn 保存为父节点;现有任务会结合快照时间和 `session_reset_to_turn` 审计记录回填,因此历史 Reset 后的第一轮会指向所选 turn,而不是时间上相邻的废弃路径。渲染器先基于完整历史计算 lane,再切分页面,从而跨分页正确显示延续和合并;内容缩进到第二列,状态或操作位于第三列。当前对话位置显示“当前”标记,其余 turn 提供 `Reset` 按钮。翻页和成功的 Reset 都会更新同一张卡片、保持与打开卡片时的任务绑定,并把“当前”标记移动到所选 turn;成功提示会用 Prompt 摘要、完成时间和 Turn ID 标明目标轮次。Agent Bot 会持久化每个 turn 原本所属的 App Server thread,从所选 turn fork,并替换当前任务的远端 thread 绑定;本地任务 ID、标题、Agent、项目目录、运行设置和聊天路由保持不变。所选 turn 之后已经完成的快照不会被删除,因此卡片会同时显示旧路径保留的轮次和 Reset 后新分支产生的轮次。当前任务仍在执行时会拒绝 Reset,本地文件修改也不会被回退。
|
|
235
247
|
|
|
@@ -243,7 +255,7 @@ Agent Bot 会在每个 `thread/fork` 请求中默认发送实验性的 `excludeT
|
|
|
243
255
|
|
|
244
256
|
每个任务条目都提供 `NewGroup` 和 `ForkGroup` 回调。回调数据保留所选任务 ID 与来源上下文,并使用飞书操作者的 `open_id` 邀请用户进入新群。`NewGroup` 解析所选任务的项目和执行设置;`ForkGroup` 解析该任务最新可用的已完成 turn。
|
|
245
257
|
|
|
246
|
-
CLI 通过 `agentbot task newgroup
|
|
258
|
+
所有 `agentbot task` 操作都支持 `--task <任务>`,并继续兼容原有的首个位置任务参数。在 Agent Bot 启动的 Agent 中,两者均省略时会通过 Codex 或 TraeX 的 App Server Thread ID 自动解析当前任务;在 Agent Bot 外执行时仍必须显式指定任务。CLI 通过 `agentbot task newgroup [任务] [标题] [--agent <标准名>] [--dir <目录> | --nodir]` 和 `agentbot task forkgroup [任务] [标题]` 提供相同的指定任务操作。两个命令都要求 Server 正在运行,并通过当前 Profile 的本地控制端点发送稳定的本地任务 ID。CLI 进程没有飞书操作者,因此 Server 会邀请 `feishu.userOpenId`,该值由初始化保存为 `FEISHU_USER_OPEN_ID`。NewGroup 默认继承指定任务的 Agent 和执行设置;`--agent <标准名>` 可选择另一个已配置的 Runtime,同时继续继承来源项目形态,并省略执行设置以采用目标 Runtime 自己的默认值。ForkGroup 使用来源任务最新可用的已完成 turn,并让来源任务的活动 turn 继续执行。两类控制响应都包含新群、群上下文、来源任务和新任务;`--json` 会输出不做本地化的结构化结果。
|
|
247
259
|
|
|
248
260
|
## App Server Provider 设置
|
|
249
261
|
|
|
@@ -271,10 +283,15 @@ SQLite 保存:
|
|
|
271
283
|
- 本地任务标识与 App Server task/thread 标识
|
|
272
284
|
- 模型、思考强度和权限模式
|
|
273
285
|
- 排队 Prompt
|
|
286
|
+
- 已接受/运行中的 turn 执行记录,包括原会话路由、Prompt、图片和消息锚点
|
|
274
287
|
- 进度快照和消息绑定
|
|
275
288
|
- 最终消息投递记录
|
|
276
289
|
|
|
277
|
-
启动时,Agent Bot
|
|
290
|
+
每次 Worker 启动时,Agent Bot 都会先扫描未终结的 turn 执行记录,再放行持久化的 Prompt 队列。只有前 5 分钟内仍有活动的执行才具备恢复资格;turn 运行期间的运行时事件和每分钟心跳会刷新持久化的活动时间。更早的未完成执行会被标记为已中断,不发送恢复通知,也不创建续跑 turn。符合条件的恢复会先通知原私聊、群聊或话题;远端已完成的 turn 只同步状态并继续未完成的最终消息投递;远端仍活动的 turn 会换用新的进度卡并持续轮询到终态;已失效的 App Server turn 或被中断的 ACP 进程会在同一任务和工作目录中创建新的续跑 turn,续跑 Prompt 会要求 Agent 先检查已有副作用,避免重复操作。恢复状态在连续多次重启之间保持持久化。
|
|
291
|
+
|
|
292
|
+
当 turn 因临时 LLM 服务错误失败时,Agent Bot 会在同一任务中自动再创建最多 3 个 turn。限流、临时过载、上游 5xx、超时和模型服务流中断可以重试;认证失败、额度耗尽、上下文超限、无效请求、不支持的模型、权限或策略错误以及工具错误会立即终止。每次重试使用新的思考卡片,重试 Prompt 会要求 Agent 先检查已有副作用再继续,避免重复操作。重试次数和待处理消息绑定会持久化;原始消息及追加消息的 Reaction 会保持处理中,并跟随最新的重试 turn,直到成功或耗尽重试次数。
|
|
293
|
+
|
|
294
|
+
Turn 标识变化、收到终态通知或控制请求失败时也会重新校准。除非 App Server thread 自身报告活动状态,否则持久化的陈旧 `inProgress` turn 不会被视为仍在运行。
|
|
278
295
|
|
|
279
296
|
最终消息投递账本用于避免重复发送成功回答。App Server 请求使用有限超时,避免阻塞的请求永久占用消息路由。会话生命周期请求允许 60 秒,因为兼容的第三方 Agent 完成 `thread/start` 可能需要超过 30 秒;控制请求仍使用更短的超时。
|
|
280
297
|
|
|
@@ -301,7 +318,7 @@ Supervisor、Worker、替换 Supervisor 和 Console Worker 默认启用 Node fat
|
|
|
301
318
|
|
|
302
319
|
飞书 `/restart` 命令默认使用这条安全重启路径;`/restart --force` 会立即重启,并可能中断正在执行的任务。该命令拒绝其他所有参数。新消息会重置静默计时,CLI 的 `--immediate` 和 `--force` 也会跳过这些检查。退出码 `75` 表示主动 worker 重启。
|
|
303
320
|
|
|
304
|
-
|
|
321
|
+
待执行的安全重启计划会收集每一个触发它的精确会话路由。收到任何用户消息时,包括斜杠命令,都会把所属基础私聊或群聊标为活跃。每个已加入的会话都会收到各自的状态卡片和真正开始重启前的提示,并一直保留到本次计划结束。同一路由会去重;如果话题路由最初缺少消息锚点,后续带锚点的触发会补全它。话题请求会保留原消息 ID,并通过话题回复发送,避免重启状态落到群主会话。每条路由还会保留该会话自己的重启原因,其他会话的后续请求不会用无关原因覆盖旧卡片。替换进程前,Agent Bot 会把包含话题消息锚点在内的完整路由经替换 Supervisor 传给 Worker,并用同一路由发送重启后的启动卡。Supervisor 会保留这些路由,直到 Worker 连续稳定运行 60 秒,避免启动阶段异常退出并重新拉起时丢失必发会话。
|
|
305
322
|
|
|
306
323
|
当 CLI 重启属于某个具体任务时,使用 `agentbot server restart --task <任务>`。任务序号、完整 ID 和不冲突的 ID 前缀会在发送控制请求前解析。未传 `--task` 时,只有所有运行中任务都属于同一个会话,Server 才会自动推断安全重启状态的发送目标;如果同时有多个运行中的会话,请求会被拒绝。没有运行中任务的本地 CLI 重启没有等待状态所属会话。
|
|
307
324
|
|
|
@@ -320,7 +337,7 @@ Supervisor、Worker、替换 Supervisor 和 Console Worker 默认启用 Node fat
|
|
|
320
337
|
|
|
321
338
|
## 受管系统 Skill
|
|
322
339
|
|
|
323
|
-
|
|
340
|
+
每次 `agentbot init` 成功时,都会把随包提供的 Agent Bot Skill 安装或刷新到共享 Agent Skill 目录。也可以通过以下命令显式管理这份受管安装:
|
|
324
341
|
|
|
325
342
|
```powershell
|
|
326
343
|
agentbot skills install
|
|
@@ -366,6 +383,12 @@ npm Trusted Publisher 配置为:
|
|
|
366
383
|
|
|
367
384
|
发布 workflow 使用 GitHub OIDC,不保存长期 npm token,并从 GitHub 托管的 Node.js 24 runner 发布。
|
|
368
385
|
|
|
386
|
+
### npm 安装包自更新
|
|
387
|
+
|
|
388
|
+
`agentbot update` 只接受包目录与 `npm root --global` 一致的真实 npm 全局安装。源码 checkout、npm link、使用符号链接的全局包以及其他包管理器布局都会被拒绝。预发布版本默认跟随 npm 的 `alpha` 标签,稳定版默认跟随 `latest`;可用 `--alpha`、`--stable` 或 `--version` 显式选择,降级还必须传入 `--allow-downgrade`。
|
|
389
|
+
|
|
390
|
+
修改当前安装前,CLI 会下载精确版本的 npm tarball,在当前 Profile 的 `updates` 目录中独立安装候选包,验证包身份以及 CLI 的版本和帮助输出,并同时保存当前包的完整副本与 npm 回滚 tarball。服务运行时会复用安全重启调度,等待活动任务、最终结果投递和静默窗口。随后,复制到安装目录外的独立执行器等待 Worker 和 Supervisor 退出,备份 SQLite 主文件及 WAL/SHM 文件,再安装已经验证的 tarball、复验全局安装,并在启动服务前调用新版本 CLI 的非交互式 `init --skip-feishu --json`。这个步骤会补齐 Profile 文件并刷新受管 Skill,但不会重复启动 Server,也不会在后台等待飞书授权。安装、初始化或启动失败时会恢复数据库并重新安装旧 tarball;如果 npm 回滚仍不能恢复可用服务,则直接从完整包备份启动旧版。`update.log`、`result.json`、包备份和数据库备份都会保留在 Profile 中用于排查。
|
|
391
|
+
|
|
369
392
|
## 开发与源码安装
|
|
370
393
|
|
|
371
394
|
```powershell
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keyou007/agent-bot",
|
|
3
|
-
"version": "0.1.14-alpha.
|
|
3
|
+
"version": "0.1.14-alpha.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@keyou007/agent-bot",
|
|
9
|
-
"version": "0.1.14-alpha.
|
|
9
|
+
"version": "0.1.14-alpha.2",
|
|
10
10
|
"license": "GPL-3.0-only",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@agentclientprotocol/sdk": "1.2.1",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keyou007/agent-bot",
|
|
3
|
-
"version": "0.1.14-alpha.
|
|
3
|
+
"version": "0.1.14-alpha.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Use Codex, TraeX, and compatible coding agents from Lark/Feishu.",
|
|
6
6
|
"license": "GPL-3.0-only",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/keyou/agent-bot.git"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://github.
|
|
11
|
+
"homepage": "https://keyou.github.io/agent-bot/",
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/keyou/agent-bot/issues"
|
|
14
14
|
},
|