Просмотр исходного кода

feat(onboarding): 接入包下发对话行为配置,与平台容器对齐

- build-onboarding-bundle: manifest.config 增加 display.busy_input_mode=interrupt
- install.py merge_config:未显式设置时写入,不覆盖用户已有选择
- 提示词 A2.5 增加对话行为对齐自查项
- 本地打包验证:manifest 含该配置、无凭据泄漏

注意:新包尚未发布到 s3,线上仍为旧 manifest(待确认后再发布)

Co-Authored-By: Claude Code <noreply@anthropic.com>
Huccct 17 часов назад
Родитель
Сommit
36db47d9bd

+ 6 - 0
cloud/onboarding/install.py

@@ -72,6 +72,12 @@ def merge_config(config: dict, patch: dict) -> dict:
     # which would leave the App channel silently offline. Other platforms are untouched.
     if config['platforms']['matrix'].get('enabled') is False:
         del config['platforms']['matrix']['enabled']
+    # 对话行为(2026-12-03):把忙时输入策略显式写成与平台容器一致的值。
+    # 公共配置项(display.busy_input_mode,合法值 interrupt/queue/steer),不是源码修改;
+    # 显式写入是为了让「本机接入」不依赖各机器上有没有被改过,行为与线上容器对齐。
+    display = config.setdefault('display', {})
+    if isinstance(display, dict) and not display.get('busy_input_mode'):
+        display['busy_input_mode'] = (patch.get('display') or {}).get('busy_input_mode', 'interrupt')
     return config
 
 

+ 1 - 0
cloud/onboarding/prompt.js

@@ -78,6 +78,7 @@ function _buildSelfHostedInstruction(agentId, name, matrix, password, token, own
     '  改完运行 `hermes hooks test`(或 `hermes config check`),确认不再出现「命令不存在 / exit 9009」类错误。',
     '- **agent 不得改安全配置**:如果工具拒绝写 `config.yaml`(「security-sensitive configuration」),说明该运行时禁止 agent 自改配置——**停止并如实回报需要手工执行的改动**,不要绕道建目录联接或改权限。',
     '- 上报所需:在 `.env` 补 `MATRIX_ACCESS_TOKEN`(用上面的 MATRIX_USER_ID/MATRIX_PASSWORD 登录一次 `/_matrix/client/v3/login` 取得)与 `HERMES_STATE_DB`(本机 `state.db` 绝对路径)。',
+    '- **对话行为对齐**:安装器会把 `display.busy_input_mode` 写成 `interrupt`(与平台容器一致:任务进行中再发消息会打断当前任务并立即处理新消息)。安装后核对:`config.yaml` 的 `display.busy_input_mode` 有值;若用户原本显式设过别的值,安装器不覆盖,此时如实回报其当前值。',
     '',
     'A4. 启动约 30-60 秒后做只读自检(macOS / Linux)或等价的自检(Windows 用同一段逻辑),把输出原样回报:',
     '```sh', 'PY="$(command -v python3 || command -v python || true)"; "$PY" -B - <<\'FMODE_CHECK_PY\'',

+ 7 - 0
docs/00-tracking/操作追踪.md

@@ -10488,3 +10488,10 @@ Call log:
   - 实测(19170119836 身份,localhost):设置页入口+有效期显示 OK;Enter 发送后输入框清空并收到回复 OK
   - 验证:构建通过;全量单测 **2252 SUCCESS**(3 个失败仍为未触碰的 SafeArea 已知偶发项);新增 8 条单测(网关识别 3 + 通知插入 2 + 倒计时 4 中的部分)
   - **同期发现(Hermes 侧,非 App)**:`busy_input_mode: interrupt` 下用户连发消息打断任务,出现「↪ Redirected current run」后会话租约未释放(`state.db.session_turn_leases` 过期无用条目),期间新消息只写日志不回复,直到下一步清理才恢复(实测 ALIVE 正常回复)。平台容器同样配置,但任务被限制得小、打断少;需单独评估缓解手段(不属 App 代码范围)
+
+- 2026-12-03 16:50:00+08:00:**接入即对齐线上:对话行为配置随接入包下发(用户要求「通过提示词链接时进行优化配置,效果与线上容器一致」)**
+  - 查证:平台容器与本地容器**用的是同一个 Hermes**,打断行为由公共配置 `display.busy_input_mode` 决定(合法值 interrupt/queue/steer)。2026-11-13 已对平台容器做行为实测:interrupt 生效、0.7 秒打断——所以两边默认本来就一致,线上正常。
+  - 落地:①`scripts/build-onboarding-bundle.py` 的 manifest.config 增加 `display.busy_input_mode = interrupt` ②`cloud/onboarding/install.py::merge_config` 在用户未显式设置时写入该值(**不覆盖用户已选**),与 hooks/plugins 同一合并机制 ③提示词 A2.5 增加「对话行为对齐」自查项 ④本机打包验证:新 manifest 含该配置,`containsCredentials:false`
+  - 本期边界:**不改 Hermes 源码**(铁律)。若后续真需要 queue/steer,只改 manifest.config 一处并重新发包即可。
+  - 关于「打断后卡住」:本机租约已自行清理、实测恢复正常;接入后的行为与线上一致,若复现再按 Hermes 日志单独定位(判定:`session_turn_leases` 是否有未过期租约)
+  - 注意:新包(sha 3665ad5…)**尚未发布到 s3**——需要 `publish-onboarding-bundle.mjs` 的账本流程;当前线上仍是 1.0.1 旧 manifest。发布前需用户确认。

+ 4 - 1
scripts/build-onboarding-bundle.py

@@ -91,7 +91,10 @@ def main():
     }
     manifest = {'version': VERSION, 'image': 'fmode/agent-node:0.21.3',
                 'files': {k: hashlib.sha256(v).hexdigest() for k, v in files.items()},
-                'config': {'plugins': PLUGINS, 'hooks': hooks}}
+                # display.busy_input_mode 与平台容器一致(2026-11-13 实测 interrupt),
+                # 让本机接入的对话行为(打断/排队)与线上容器对齐,见 install.py merge_config。
+                'config': {'plugins': PLUGINS, 'hooks': hooks,
+                           'display': {'busy_input_mode': 'interrupt'}}}
     output = ROOT / args.out
     package = output / 'package'
     package.mkdir(parents=True, exist_ok=True)

+ 1 - 0
src/app/core/gateway-notice.spec.ts

@@ -45,3 +45,4 @@ describe('withGatewayNotices', () => {
     expect(withGatewayNotices(rows, [], (r) => r.at)).toEqual(rows);
   });
 });
+