@hfyjq/crannia 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/LICENSE +201 -201
  2. package/NOTICE +48 -45
  3. package/README.md +1 -1
  4. package/THIRD-PARTY-FRONTEND.md +5266 -5266
  5. package/THIRD-PARTY-PYTHON-linux.md +174 -0
  6. package/THIRD-PARTY-PYTHON.md +176 -162
  7. package/THIRD-PARTY.md +323 -316
  8. package/apps/desktop/quotes.txt +56 -56
  9. package/bus/core.py +677 -671
  10. package/bus/loaders/channel_loader.py +64 -64
  11. package/bus/loaders/provider_loader.py +4 -7
  12. package/bus/loaders/skill_loader.py +46 -27
  13. package/bus/loaders/skill_md.py +9 -9
  14. package/bus/mcp_disabled.py +4 -6
  15. package/bus/quarantine.py +10 -13
  16. package/bus/registry.py +2315 -2284
  17. package/bus/skill_state.py +124 -124
  18. package/channels/cli_channel/handler.py +3 -3
  19. package/channels/cli_channel/manifest.yaml +5 -5
  20. package/channels/dingtalk_channel/handler.py +32 -32
  21. package/channels/dingtalk_channel/manifest.yaml +12 -12
  22. package/channels/feishu_channel/handler.py +33 -33
  23. package/channels/feishu_channel/manifest.yaml +12 -12
  24. package/channels/qq_bot_channel/__init__.py +1 -1
  25. package/channels/qq_bot_channel/handler.py +24 -24
  26. package/channels/qq_bot_channel/manifest.yaml +4 -4
  27. package/channels/telegram_channel/__init__.py +1 -1
  28. package/channels/telegram_channel/handler.py +21 -21
  29. package/channels/telegram_channel/manifest.yaml +4 -4
  30. package/channels/telegram_channel/media.py +231 -231
  31. package/channels/textfmt.py +58 -58
  32. package/channels/wechat_channel/__init__.py +1 -1
  33. package/channels/wechat_channel/converter.py +1 -1
  34. package/channels/wechat_channel/handler.py +8 -8
  35. package/channels/wechat_channel/manifest.yaml +5 -5
  36. package/channels/wechat_channel/media.py +178 -178
  37. package/core/activity.py +753 -709
  38. package/core/agent_loop.py +7673 -7522
  39. package/core/allowlist.py +2 -3
  40. package/core/approval.py +34 -24
  41. package/core/approval_timeout.py +256 -228
  42. package/core/artifacts.py +3 -3
  43. package/core/attachment_gc.py +21 -0
  44. package/core/auto_review.py +2 -2
  45. package/core/browser/cdp.py +5 -2
  46. package/core/browser/discover.py +55 -19
  47. package/core/browser/session.py +4 -4
  48. package/core/cache_break_detector.py +97 -0
  49. package/core/cache_breakpoints.py +103 -0
  50. package/core/cache_policies.py +255 -0
  51. package/core/cancellation.py +3 -3
  52. package/core/channel_configs.py +3 -3
  53. package/core/channel_turns.py +13 -13
  54. package/core/child_approval.py +2 -3
  55. package/core/code_intel.py +11 -11
  56. package/core/command_policy.py +13 -7
  57. package/core/computer/annotate.py +231 -11
  58. package/core/computer/capture.py +140 -1
  59. package/core/computer/guard.py +7 -4
  60. package/core/computer/input.py +452 -26
  61. package/core/computer/session.py +563 -381
  62. package/core/computer/tools.py +2170 -928
  63. package/core/computer/uia.py +100 -1
  64. package/core/computer/watch.py +1 -1
  65. package/core/computer/win32.py +302 -7
  66. package/core/config_requirements.py +205 -205
  67. package/core/cron/runner.py +4 -4
  68. package/core/daily_log.py +2 -2
  69. package/core/dedup.py +2 -2
  70. package/core/egress_channels.py +326 -0
  71. package/core/egress_gate.py +96 -8
  72. package/core/egress_preapproved.py +59 -3
  73. package/core/endpoint.py +141 -141
  74. package/core/events.py +17 -8
  75. package/core/extension.py +2 -2
  76. package/core/file_history.py +10 -10
  77. package/core/file_tools.py +3 -3
  78. package/core/github_config.py +1 -1
  79. package/core/group_digest.py +3 -4
  80. package/core/group_minutes.py +5 -5
  81. package/core/group_reply.py +24 -0
  82. package/core/groups.py +5 -9
  83. package/core/hooks.py +15 -15
  84. package/core/i18n.py +2 -2
  85. package/core/ice/canary.py +3 -3
  86. package/core/ice/net_heuristics.py +2 -2
  87. package/core/im_routing.py +2 -2
  88. package/core/image_input.py +183 -43
  89. package/core/inbound.py +3 -3
  90. package/core/jobs.py +6 -6
  91. package/core/last_good.py +150 -150
  92. package/core/leaf_md.py +3 -3
  93. package/core/llm_errors.py +36 -27
  94. package/core/mail_config.py +2 -2
  95. package/core/memory/compressor.py +8 -8
  96. package/core/memory/manager.py +30 -45
  97. package/core/memory/session_memory.py +1 -2
  98. package/core/memory/short_term.py +4 -4
  99. package/core/memory_extract.py +1 -1
  100. package/core/memory_organize.py +8 -8
  101. package/core/memory_store.py +7 -9
  102. package/core/memory_transfer.py +2 -2
  103. package/core/model_capabilities.py +2 -2
  104. package/core/model_configs.py +219 -68
  105. package/core/model_profiles.py +333 -0
  106. package/core/modes.py +12 -11
  107. package/core/net_proxy.py +3 -3
  108. package/core/pipeline/scheduler.py +48 -43
  109. package/core/pipeline/stage.py +3 -0
  110. package/core/pipeline/stages/agent_loop.py +36 -15
  111. package/core/pipeline/stages/group_reply.py +22 -20
  112. package/core/pipeline/stages/post_process.py +7 -7
  113. package/core/pipeline/stages/pre_process.py +360 -68
  114. package/core/prompt_assembler.py +13 -4
  115. package/core/recycle.py +227 -16
  116. package/core/response_language.py +1 -1
  117. package/core/retention.py +2 -2
  118. package/core/rg.py +4 -3
  119. package/core/security.py +26 -8
  120. package/core/services.py +8 -8
  121. package/core/session_model.py +3 -5
  122. package/core/session_pool.py +35 -5
  123. package/core/session_recap.py +40 -3
  124. package/core/session_workspace.py +2 -3
  125. package/core/settings_baseline.py +2 -2
  126. package/core/settings_transfer.py +25 -1
  127. package/core/shell.py +52 -20
  128. package/core/side_call.py +3 -3
  129. package/core/skill_config.py +164 -0
  130. package/core/skill_factory.py +2 -2
  131. package/core/skill_guidance.py +2 -4
  132. package/core/skill_index.py +3 -4
  133. package/core/skill_settings.py +1 -1
  134. package/core/skill_sources.py +7 -7
  135. package/core/ssh_config.py +129 -0
  136. package/core/state_registry.py +67 -5
  137. package/core/subagent.py +28 -5
  138. package/core/subagent_defs.py +3 -3
  139. package/core/summarizer.py +4 -5
  140. package/core/tasks_notify.py +6 -6
  141. package/core/tiers.py +2 -2
  142. package/core/todos.py +1 -1
  143. package/core/token_calibrator.py +1 -4
  144. package/core/tool_outcome.py +108 -108
  145. package/core/touched_files.py +1 -1
  146. package/core/trace.py +12 -3
  147. package/core/unlock.py +4 -4
  148. package/core/update_tui.py +184 -158
  149. package/core/updater.py +5 -3
  150. package/core/version.py +14 -14
  151. package/core/vision_budget.py +235 -0
  152. package/core/web_cache.py +152 -152
  153. package/core/web_request.py +474 -0
  154. package/core/window_estimate.py +1 -1
  155. package/core/workspace.py +56 -26
  156. package/crannia_tray.py +278 -278
  157. package/licenses/GPL-3.0.txt +619 -619
  158. package/licenses/LGPL-2.1.txt +502 -502
  159. package/licenses/LGPL-3.0.txt +165 -165
  160. package/licenses/MIT-chat-on-wechat.txt +18 -18
  161. package/licenses/MIT-deepseek-harness.txt +21 -21
  162. package/licenses/Molio-LICENSE.txt +44 -44
  163. package/locales/en.json +1876 -1755
  164. package/main.py +154 -154
  165. package/mcpx/client.py +12 -1
  166. package/mcpx/manager.py +530 -522
  167. package/mcpx/servers/web_search.py +5 -13
  168. package/package.json +15 -23
  169. package/providers/anthropic/client.py +35 -33
  170. package/providers/base.py +13 -13
  171. package/providers/cache_policies.json +294 -0
  172. package/providers/cost_table.json +3779 -3779
  173. package/providers/lmstudio/client.py +2 -2
  174. package/providers/model_capabilities.json +6665 -6665
  175. package/providers/model_profiles.json +629 -0
  176. package/providers/ollama/client.py +2 -2
  177. package/providers/openai_compat.py +37 -16
  178. package/providers/openrouter/client.py +2 -2
  179. package/providers/qwen/__init__.py +1 -1
  180. package/providers/qwen/client.py +2 -2
  181. package/providers/qwen/manifest.yaml +16 -16
  182. package/providers/rate_limiter.py +2 -2
  183. package/providers/siliconflow/client.py +2 -2
  184. package/providers/validation.py +171 -171
  185. package/providers/vision_profiles.json +89 -0
  186. package/providers/window_table.json +8909 -8909
  187. package/requirements.txt +59 -51
  188. package/sbom-linux-x64.json +4580 -0
  189. package/sbom.json +4600 -4413
  190. package/skills/diagram/SKILL.md +47 -0
  191. package/skills/diagram/__init__.py +1 -0
  192. package/skills/diagram/handler.py +294 -0
  193. package/skills/diagram/layout.py +174 -0
  194. package/skills/diagram/manifest.yaml +106 -0
  195. package/skills/diagram/mermaid.py +170 -0
  196. package/skills/diagram/svg.py +223 -0
  197. package/skills/entertainment/SKILL.md +35 -35
  198. package/skills/entertainment/__init__.py +1 -1
  199. package/skills/entertainment/handler.py +91 -91
  200. package/skills/entertainment/manifest.yaml +26 -26
  201. package/skills/file_parser/GUIDANCE.md +10 -10
  202. package/skills/file_parser/handler.py +33 -11
  203. package/skills/github/SKILL.md +32 -32
  204. package/skills/github/__init__.py +1 -1
  205. package/skills/mail_parser/SKILL.md +68 -68
  206. package/skills/mail_parser/__init__.py +1 -1
  207. package/skills/mail_parser/handler.py +1 -1
  208. package/skills/media_gen/GUIDANCE.md +19 -19
  209. package/skills/media_gen/SKILL.md +43 -43
  210. package/skills/media_gen/__init__.py +1 -1
  211. package/skills/media_gen/handler.py +1 -1
  212. package/skills/media_gen/manifest.yaml +93 -93
  213. package/skills/netops/SKILL.md +45 -0
  214. package/skills/netops/__init__.py +1 -0
  215. package/skills/netops/handler.py +418 -0
  216. package/skills/netops/manifest.yaml +118 -0
  217. package/skills/office_parser/_excel_io.py +3 -3
  218. package/skills/office_parser/handler.py +2 -2
  219. package/skills/office_parser/ppt_tools.py +1 -1
  220. package/skills/office_parser/pptx_export/console_encoding.py +27 -27
  221. package/skills/office_parser/pptx_export/resource_paths.py +88 -88
  222. package/skills/office_parser/pptx_export/svg_finalize/__init__.py +12 -12
  223. package/skills/office_parser/pptx_export/svg_finalize/crop_images.py +366 -366
  224. package/skills/office_parser/pptx_export/svg_finalize/embed_images.py +288 -288
  225. package/skills/office_parser/pptx_export/svg_finalize/fix_image_aspect.py +388 -388
  226. package/skills/office_parser/pptx_export/svg_finalize/flatten_tspan.py +818 -818
  227. package/skills/office_parser/pptx_export/svg_finalize/svg_rect_to_path.py +345 -345
  228. package/skills/office_parser/pptx_export/svg_to_pptx/__init__.py +14 -14
  229. package/skills/office_parser/pptx_export/svg_to_pptx/drawingml/__init__.py +1 -1
  230. package/skills/office_parser/pptx_export/svg_to_pptx/drawingml/context.py +186 -186
  231. package/skills/office_parser/pptx_export/svg_to_pptx/drawingml/converter.py +781 -781
  232. package/skills/office_parser/pptx_export/svg_to_pptx/drawingml/paths.py +429 -429
  233. package/skills/office_parser/pptx_export/svg_to_pptx/drawingml/utils.py +40 -21
  234. package/skills/office_parser/pptx_export/svg_to_pptx/pptx_package/__init__.py +1 -1
  235. package/skills/office_parser/pptx_export/svg_to_pptx/pptx_package/builder.py +1267 -1267
  236. package/skills/office_parser/pptx_export/svg_to_pptx/pptx_package/dimensions.py +155 -155
  237. package/skills/office_parser/pptx_export/svg_to_pptx/pptx_package/discovery.py +101 -101
  238. package/skills/office_parser/pptx_export/svg_to_pptx/pptx_package/narration.py +236 -236
  239. package/skills/office_parser/pptx_export/svg_to_pptx/pptx_package/notes.py +257 -257
  240. package/skills/office_parser/pptx_export/svg_to_pptx/pptx_package/slide_xml.py +136 -136
  241. package/skills/office_parser/pptx_export/svg_to_pptx/tspan_flattener.py +44 -44
  242. package/skills/office_parser/pptx_export/svg_to_pptx/use_expander.py +129 -129
  243. package/skills/office_parser/references/LICENSE-Office-Word-MCP-Server.txt +20 -20
  244. package/skills/office_parser/references/LICENSE-excel-mcp-server.txt +21 -21
  245. package/skills/office_parser/references/layout_library.md +816 -816
  246. package/skills/office_parser/references/ppt-master/LICENSE +21 -21
  247. package/skills/office_parser/references/ppt-master/references/executor-base.md +474 -474
  248. package/skills/office_parser/references/ppt-master/references/shared-standards.md +1002 -1002
  249. package/skills/office_parser/references/ppt-master/references/strategist.md +880 -880
  250. package/skills/office_parser/references/ppt-master/references/template-designer.md +402 -402
  251. package/skills/office_parser/references/ppt-master/references/visual-review.md +240 -240
  252. package/skills/office_parser/references/ppt-master/references/visual-styles/_index.md +106 -106
  253. package/skills/office_parser/references/ppt-master/references/visual-styles/blueprint.md +37 -37
  254. package/skills/office_parser/references/ppt-master/references/visual-styles/brutalist.md +38 -38
  255. package/skills/office_parser/references/ppt-master/references/visual-styles/chalkboard.md +36 -36
  256. package/skills/office_parser/references/ppt-master/references/visual-styles/dark-tech.md +37 -37
  257. package/skills/office_parser/references/ppt-master/references/visual-styles/data-journalism.md +36 -36
  258. package/skills/office_parser/references/ppt-master/references/visual-styles/editorial.md +38 -38
  259. package/skills/office_parser/references/ppt-master/references/visual-styles/glassmorphism.md +36 -36
  260. package/skills/office_parser/references/ppt-master/references/visual-styles/ink-notes.md +37 -37
  261. package/skills/office_parser/references/ppt-master/references/visual-styles/ink-wash.md +36 -36
  262. package/skills/office_parser/references/ppt-master/references/visual-styles/memphis.md +37 -37
  263. package/skills/office_parser/references/ppt-master/references/visual-styles/paper-cut.md +36 -36
  264. package/skills/office_parser/references/ppt-master/references/visual-styles/photo-editorial.md +38 -38
  265. package/skills/office_parser/references/ppt-master/references/visual-styles/pixel-art.md +36 -36
  266. package/skills/office_parser/references/ppt-master/references/visual-styles/sketch-notes.md +36 -36
  267. package/skills/office_parser/references/ppt-master/references/visual-styles/soft-rounded.md +37 -37
  268. package/skills/office_parser/references/ppt-master/references/visual-styles/swiss-minimal.md +38 -38
  269. package/skills/office_parser/references/ppt-master/references/visual-styles/vintage-poster.md +36 -36
  270. package/skills/office_parser/references/ppt-master/references/visual-styles/zine.md +37 -37
  271. package/skills/office_parser/references/spec_lock.md +235 -235
  272. package/skills/office_parser/soffice.py +68 -68
  273. package/skills/office_parser/word_tools.py +3 -3
  274. package/skills/ssh/SKILL.md +81 -0
  275. package/skills/ssh/__init__.py +1 -0
  276. package/skills/ssh/handler.py +609 -0
  277. package/skills/ssh/manifest.yaml +182 -0
  278. package/tui/crannia.cmd +134 -134
  279. package/tui/crannia.sh +82 -0
  280. package/tui/crannia_tui/__init__.py +1 -1
  281. package/tui/crannia_tui/app.py +240 -17
  282. package/tui/crannia_tui/app.tcss +21 -0
  283. package/tui/crannia_tui/clipboard.py +78 -10
  284. package/tui/crannia_tui/commands.py +37 -0
  285. package/tui/crannia_tui/events.py +6 -0
  286. package/tui/crannia_tui/i18n.py +164 -164
  287. package/tui/crannia_tui/locales/en.json +31 -6
  288. package/tui/crannia_tui/paths.py +4 -1
  289. package/tui/crannia_tui/profile.py +178 -169
  290. package/tui/crannia_tui/settings.py +134 -134
  291. package/tui/crannia_tui/setup.py +44 -5
  292. package/tui/crannia_tui/ui.py +156 -16
  293. package/tui/crannia_tui/update.py +393 -389
  294. package/vendor/ripgrep/COPYING.txt +3 -3
  295. package/vendor/ripgrep/LICENSE-MIT.txt +21 -21
  296. package/vendor/ripgrep/NOTICE-vscode-ripgrep.txt +13 -13
  297. package/vendor/ripgrep/README.md +30 -14
  298. package/vendor/ripgrep/UNLICENSE.txt +24 -24
  299. package/vendor/ripgrep/linux-x64/rg +0 -0
  300. package/vendor/ripgrep/package-source.json +15 -16
  301. package/web/__main__.py +12 -15
  302. package/web/server.py +8481 -8594
  303. package/web/static/img/channel-telegram.svg +1 -1
  304. package/web/static/img/channel-wechat.svg +1 -1
  305. package/web/templates/logs.html +49 -49
  306. package/web/templates/models.html +46 -46
@@ -99,7 +99,7 @@ def _acquire_turn_slot(session_key: str) -> None:
99
99
  事件发送失败不许影响排队本身(观测不能阻断操作)。
100
100
  """
101
101
  if not _turn_slots.acquire(blocking=False):
102
- print("[sched] %s 排队中(并发上限 %d)" % (session_key, _MAX_CONCURRENT_TURNS))
102
+ print("[sched] %s queued (concurrency limit %d)" % (session_key, _MAX_CONCURRENT_TURNS))
103
103
  try:
104
104
  from core.events import (EVT_TURN_QUEUED,
105
105
  TURN_QUEUED_MESSAGE, get_event_bus)
@@ -110,7 +110,7 @@ def _acquire_turn_slot(session_key: str) -> None:
110
110
  limit=_MAX_CONCURRENT_TURNS,
111
111
  message=TURN_QUEUED_MESSAGE)
112
112
  except Exception as exc: # noqa: BLE001
113
- print("[sched] turn.queued 事件发送失败:%s: %s" % (type(exc).__name__, exc))
113
+ print("[sched] failed to emit turn.queued event: %s: %s" % (type(exc).__name__, exc))
114
114
  _turn_slots.acquire()
115
115
 
116
116
 
@@ -221,8 +221,8 @@ def _context_state_payload(ctx, session_key: str) -> "dict | None":
221
221
  try:
222
222
  pool.note_memory_context(session_key, _mc)
223
223
  except Exception as e:
224
- print(f"[context] 记忆注入读数没记上({type(e).__name__}: {e})—— "
225
- f"面板里那一格会停在上一轮的值")
224
+ print(f"[context] memory-injection reading not recorded ({type(e).__name__}: {e}) - "
225
+ f"panel cell stays at last turn's value")
226
226
 
227
227
  usage = ctx.metadata.get("context_usage")
228
228
  if not isinstance(usage, dict):
@@ -327,6 +327,9 @@ _PENDING_STORES: tuple[tuple[str, str], ...] = (
327
327
  # 钩子要求人工确认(`PreToolUse` 的 `ask`)。自己一格。
328
328
  # 漏了这一行同样坏:聊天/回执里写着要确认,而浮窗永远不出现。
329
329
  ("hook_ask", "_pending_hook_ask"),
330
+ # SSH 主机密钥信任(TOFU)。自己一格(一格只许一个 kind 用)-
331
+ # 被审批物是指纹,不是目标的授权范围。漏了同样坏。
332
+ ("ssh_hostkey", "_pending_ssh_hostkey"),
330
333
  )
331
334
 
332
335
 
@@ -405,6 +408,8 @@ class PipelineScheduler:
405
408
  # 读者仍必须从载荷取 kind(`pend["kind"]`)—— 见
406
409
  # `_PENDING_STORES`。
407
410
  self._pending_egress: dict[str, dict] = {}
411
+ # SSH 主机密钥信任(TOFU)。自己一格(一格只许一个 kind 用)。
412
+ self._pending_ssh_hostkey: dict[str, dict] = {}
408
413
  self._pending_command: dict[str, dict] = {}
409
414
  # 兜底闸(不可逆、且自身没有审批发射点的工具)。
410
415
  self._pending_destructive: dict[str, dict] = {}
@@ -506,7 +511,7 @@ class PipelineScheduler:
506
511
  wm = get_workspace_manager()
507
512
  except Exception as exc:
508
513
  print(f"[pipeline] approval projection could not reach the workspace "
509
- f"manager ({type(exc).__name__}: {exc}) — this turn will ask again")
514
+ f"manager ({type(exc).__name__}: {exc}) - this turn will ask again")
510
515
  return
511
516
 
512
517
  if wm is None:
@@ -547,7 +552,7 @@ class PipelineScheduler:
547
552
  setattr(wm, name, value)
548
553
  except Exception as exc:
549
554
  print(f"[pipeline] projection of {name} failed "
550
- f"({type(exc).__name__}: {exc}) — this turn will ask again")
555
+ f"({type(exc).__name__}: {exc}) - this turn will ask again")
551
556
 
552
557
  # 按目标、按对话的放行。不并进上面的循环 —— 它不是标量赋值,而是
553
558
  # 整组替换(`set_target_session`),每个 kind 调一次。
@@ -586,7 +591,7 @@ class PipelineScheduler:
586
591
  wm.set_target_wildcard(kind, "*" in persisted)
587
592
  except Exception as exc:
588
593
  print(f"[pipeline] projection of target grants failed "
589
- f"({type(exc).__name__}: {exc}) — this turn will ask again")
594
+ f"({type(exc).__name__}: {exc}) - this turn will ask again")
590
595
 
591
596
  # ------------------------------------------------------------------
592
597
  def pending_approval(self, session_key: str) -> dict | None:
@@ -773,8 +778,8 @@ class PipelineScheduler:
773
778
  except Exception: # noqa: BLE001
774
779
  return
775
780
  if _AT.arm(session_key, loop, self._fire_approval_timeout):
776
- print("[approval-timeout] 有待审批 —— %d 秒后"
777
- "按「没有可问的通道」结算(`/clear` 或回答即撤)"
781
+ print("[approval-timeout] pending approval - in %d seconds; "
782
+ "settled as 'no channel to ask' (/clear or an answer cancels)"
778
783
  % _AT.seconds(session_key))
779
784
 
780
785
  def _fire_approval_timeout(self, session_key: str) -> None:
@@ -792,8 +797,8 @@ class PipelineScheduler:
792
797
  return # 已经答过了 / 撤了
793
798
  event = _AT.event_of(session_key)
794
799
  if event is None:
795
- print("[approval-timeout] 到点了,但没记住那条事件 —— "
796
- "**不做任何事**(回今天的行为:继续等)")
800
+ print("[approval-timeout] timer fired but event not remembered - "
801
+ "doing nothing (keep waiting)")
797
802
  return
798
803
  try:
799
804
  evt = copy.copy(event)
@@ -801,15 +806,15 @@ class PipelineScheduler:
801
806
  evt.extras["approval_timeout"] = True
802
807
  evt._stopped = False
803
808
  except Exception as exc: # noqa: BLE001
804
- print("[approval-timeout] 造超时事件失败(%s)—— 不做任何事"
809
+ print("[approval-timeout] failed to build timeout event (%s) - doing nothing"
805
810
  % type(exc).__name__)
806
811
  return
807
812
  try:
808
813
  asyncio.ensure_future(self.execute(evt))
809
- print("[approval-timeout] %s:到点,按「没有可问的通道」结算"
814
+ print("[approval-timeout] %s: timer fired, settled as 'no channel to ask'"
810
815
  % session_key)
811
816
  except Exception as exc: # noqa: BLE001
812
- print("[approval-timeout] 重入失败(%s)—— 不做任何事"
817
+ print("[approval-timeout] re-entry failed (%s) - doing nothing"
813
818
  % type(exc).__name__)
814
819
 
815
820
  # ------------------------------------------------------------------
@@ -943,10 +948,10 @@ class PipelineScheduler:
943
948
  from core import net_proxy as _np
944
949
  _changed = _np.apply_env_policy()
945
950
  if _changed:
946
- print("[proxy] 「%s」档已落到环境变量:%s"
951
+ print("[proxy] '%s' mode applied to env vars: %s"
947
952
  % (_np.mode(), ", ".join(_changed)))
948
953
  except Exception as _e: # noqa: BLE001
949
- print("[proxy] 环境变量口径没落下去(只认 env 的 SDK 会跟随系统):"
954
+ print("[proxy] env vars not applied (env-only SDKs follow system): "
950
955
  "%s: %s" % (type(_e).__name__, _e))
951
956
  #: 附件回收:后台线程 + 一天一次(`attachment_gc.maybe_prune_daily`)。
952
957
  #: 判据是"启动是唯一不会漏的入口"(同监听器自启动那一段),
@@ -959,12 +964,12 @@ class PipelineScheduler:
959
964
  try:
960
965
  st = maybe_prune_daily()
961
966
  if st and st.get("deleted"):
962
- print("[attachments] 回收 %d 个未被引用的附件(%d 字节)"
967
+ print("[attachments] reclaimed %d unreferenced attachments (%d bytes)"
963
968
  % (st["deleted"], st["freed"]))
964
969
  elif st and st.get("skipped"):
965
- print("[attachments] 本次未回收(%s)" % st["skipped"])
970
+ print("[attachments] nothing reclaimed this time (%s)" % st["skipped"])
966
971
  except Exception as exc: # noqa: BLE001
967
- print("[attachments] 回收失败(不影响框架):%s: %s"
972
+ print("[attachments] reclaim failed (does not affect the framework): %s: %s"
968
973
  % (type(exc).__name__, exc))
969
974
  #: 框架自己的运行目录(计划 / 工具结果 / 通道收件媒体 /
970
975
  #: 任务日志)原来谁都不收。挂在启动这一下 ——
@@ -973,13 +978,13 @@ class PipelineScheduler:
973
978
  from core.retention import prune_runtime_dirs
974
979
  prune_runtime_dirs()
975
980
  except Exception as exc: # noqa: BLE001
976
- print("[retention] 运行目录回收失败(不影响框架):%s: %s"
981
+ print("[retention] runtime dir reclaim failed (does not affect the framework): %s: %s"
977
982
  % (type(exc).__name__, exc))
978
983
 
979
984
  threading.Thread(target=_gc_bg, name="attachment-gc",
980
985
  daemon=True).start()
981
986
  except Exception as exc: # noqa: BLE001
982
- print("[attachments] 回收线程没起来(不影响框架):%s: %s"
987
+ print("[attachments] reclaim thread not started (does not affect the framework): %s: %s"
983
988
  % (type(exc).__name__, exc))
984
989
  try:
985
990
  from bus.registry import get_workspace_manager
@@ -987,7 +992,7 @@ class PipelineScheduler:
987
992
  if wm is not None:
988
993
  wm.autostart_watchers()
989
994
  except Exception as exc: # noqa: BLE001
990
- print("[scheduler] 监听器自启动失败(不影响框架启动):%s: %s"
995
+ print("[scheduler] listener autostart failed (does not affect framework startup): %s: %s"
991
996
  % (type(exc).__name__, exc))
992
997
 
993
998
  def _apply_configured_model(self) -> None:
@@ -1038,10 +1043,10 @@ class PipelineScheduler:
1038
1043
  mgr._provider = inst
1039
1044
  mgr.report_thresholds()
1040
1045
  except Exception as exc: # noqa: BLE001
1041
- print("[scheduler] 记忆层换模型失败(它仍用原窗口):%s: %s"
1046
+ print("[scheduler] memory layer model switch failed (still using old window): %s: %s"
1042
1047
  % (type(exc).__name__, exc))
1043
1048
  except Exception as exc: # noqa: BLE001
1044
- print("[scheduler] 模型配置装载失败,沿用 config.yaml 那个模型:%s: %s"
1049
+ print("[scheduler] model config load failed, using config.yaml model: %s: %s"
1045
1050
  % (type(exc).__name__, exc))
1046
1051
 
1047
1052
  @staticmethod
@@ -1078,7 +1083,7 @@ class PipelineScheduler:
1078
1083
  return None
1079
1084
  return _mc.instance_for(cid, fallback=None)
1080
1085
  except Exception as exc: # noqa: BLE001
1081
- print(f"[scheduler] 群主理人的模型解析失败,沿用进程那个:"
1086
+ print(f"[scheduler] group-host model resolution failed, using the process one: "
1082
1087
  f"{type(exc).__name__}: {exc}")
1083
1088
  return None
1084
1089
 
@@ -1121,12 +1126,12 @@ class PipelineScheduler:
1121
1126
  return "", self._provider
1122
1127
  inst = _mc.instance_for(cid, fallback=None)
1123
1128
  if inst is None:
1124
- print(f"[scheduler] 这一段冻的配置 '{cid}' 今天装不上 —— "
1125
- f"这一轮沿用原模型(且**不冻**,下一轮仍跟默认走)")
1129
+ print(f"[scheduler] frozen config '{cid}' unusable today - "
1130
+ f"using original model this turn (not freezing; next turn follows default)")
1126
1131
  return "", self._provider
1127
1132
  return cid, inst
1128
1133
  except Exception as exc: # noqa: BLE001
1129
- print("[scheduler] 这一段模型解析失败,沿用进程那个:%s: %s"
1134
+ print("[scheduler] model resolution failed for this conversation, using process one: %s: %s"
1130
1135
  % (type(exc).__name__, exc))
1131
1136
  return "", self._provider
1132
1137
 
@@ -1182,7 +1187,7 @@ class PipelineScheduler:
1182
1187
  decision = im_routing.route(
1183
1188
  event, self._last_activity, self._title_of, self._session_exists)
1184
1189
  except Exception as exc: # noqa: BLE001
1185
- print("[routing] 选址失败(这一条按默认键走):%s: %s"
1190
+ print("[routing] routing failed (falling back to default key): %s: %s"
1186
1191
  % (type(exc).__name__, exc))
1187
1192
  decision = None
1188
1193
  if decision is not None and decision.kind == "ask":
@@ -1224,7 +1229,7 @@ class PipelineScheduler:
1224
1229
  from core.computer import session as _cu
1225
1230
  _cu.disarm_for(session_key, "turn_end")
1226
1231
  except Exception as exc: # noqa: BLE001
1227
- print("[computer] 轮末关闭操作检测失败:%s: %s"
1232
+ print("[computer] turn-end close-operation detection failed: %s: %s"
1228
1233
  % (type(exc).__name__, exc))
1229
1234
  _turn_slots.release()
1230
1235
  finally:
@@ -1431,8 +1436,8 @@ class PipelineScheduler:
1431
1436
  from core.dedup import default as _dedup_default
1432
1437
  _dedup_default().release(**_ded)
1433
1438
  except Exception as exc: # noqa: BLE001
1434
- print(f"[dedup] 放位失败({type(exc).__name__}: {exc})"
1435
- f" —— 这条消息的重投可能被当成重复")
1439
+ print(f"[dedup] failed to claim slot ({type(exc).__name__}: {exc})"
1440
+ f" - a redelivery may be treated as duplicate")
1436
1441
 
1437
1442
  # 轮末收口:还在重试的清掉(否则 `/api/status` 每 5 秒
1438
1443
  # 把它读回来,网络恢复了红条也不消失);失败收尾的留着 ——
@@ -1441,8 +1446,8 @@ class PipelineScheduler:
1441
1446
  from core import llm_retry as _lr
1442
1447
  _lr.reset_if_retrying(session_key)
1443
1448
  except Exception as exc: # noqa: BLE001
1444
- print(f"[llm] 重试状态清理失败({type(exc).__name__}: {exc})"
1445
- f" —— 下一轮的横幅可能还挂着")
1449
+ print(f"[llm] retry-state cleanup failed ({type(exc).__name__}: {exc})"
1450
+ f" - next turn's banner may still show")
1446
1451
 
1447
1452
  # 轮末:把 `ctx` 上的载体收回按对话的真值表
1448
1453
  # 抽成方法是为了让测试能调用真的那份:测试若抄这 60 行
@@ -1460,9 +1465,9 @@ class PipelineScheduler:
1460
1465
  try:
1461
1466
  _ctx_state = _context_state_payload(ctx, session_key)
1462
1467
  except Exception as exc: # noqa: BLE001
1463
- print(f"[context] 状态读数失败 "
1464
- f"({type(exc).__name__}: {exc}) —— 这一轮没有"
1465
- f"上下文事件")
1468
+ print(f"[context] state reading failed "
1469
+ f"({type(exc).__name__}: {exc}) - no "
1470
+ f"context event this turn")
1466
1471
  _ctx_state = None
1467
1472
  if _ctx_state is not None:
1468
1473
  bus.emit(EVT_CONTEXT_STATE, session_key=session_key,
@@ -1490,7 +1495,7 @@ class PipelineScheduler:
1490
1495
  try:
1491
1496
  self._sync_approval_timer(session_key)
1492
1497
  except Exception as exc: # noqa: BLE001
1493
- print("[approval-timeout] 同步定时器失败(%s)—— 这一轮不受影响"
1498
+ print("[approval-timeout] failed to sync timer (%s) - this turn unaffected"
1494
1499
  % type(exc).__name__)
1495
1500
 
1496
1501
  # 回复头只加给 IM,而且只加在被改派过的轮次 —— 前端看得见
@@ -1600,8 +1605,8 @@ class PipelineScheduler:
1600
1605
  from core import steer as _steer_inbox
1601
1606
  _steer_left = _steer_inbox.drain(session_key)
1602
1607
  except Exception as exc: # noqa: BLE001
1603
- print(f"[steer] 轮末取空失败({type(exc).__name__}: {exc})"
1604
- f" —— 这一轮没有 steer_leftover")
1608
+ print(f"[steer] turn-end drain failed ({type(exc).__name__}: {exc})"
1609
+ f" - no steer_leftover this turn")
1605
1610
  # 两条出口都要有:`extras` 给 `/api/chat`,关键字参数给 SSE。
1606
1611
  try:
1607
1612
  event.extras["steer_leftover"] = _steer_left
@@ -1685,9 +1690,9 @@ class PipelineScheduler:
1685
1690
  try:
1686
1691
  _files = _touched_payload(session_key)
1687
1692
  except Exception as exc: # noqa: BLE001
1688
- print(f"[files] 改动清单发送失败 "
1689
- f"({type(exc).__name__}: {exc}) —— 这一轮没有"
1690
- f"改动文件事件")
1693
+ print(f"[files] failed to send changed-file list "
1694
+ f"({type(exc).__name__}: {exc}) - no "
1695
+ f"changed-file event this turn")
1691
1696
  _files = None
1692
1697
  if _files:
1693
1698
  bus.emit(EVT_FILES_CHANGED, session_key=session_key,
@@ -94,6 +94,9 @@ class StageContext:
94
94
  pending_hook_ask: dict = field(default_factory=dict)
95
95
  #: 出网审批(`web_fetch` / `send_email` 的目标)。
96
96
  pending_egress: dict = field(default_factory=dict)
97
+ #: SSH 主机密钥信任(TOFU)。自己一格(一格只许一个 kind 用)-
98
+ #: 被审批物是"这个指纹",不是目标的授权范围。
99
+ pending_ssh_hostkey: dict = field(default_factory=dict)
97
100
  #: 执行审批(`run_command`)。
98
101
  #: 命令的审批只有一种档位(没有「危险档」)——
99
102
  #: 所以这一格只装 `command` 一种 kind。但读者仍然取自载荷
@@ -84,7 +84,7 @@ class AgentLoopStage(Stage):
84
84
  from core import session_workspace
85
85
  session_workspace.pin(ctx.storage_id)
86
86
  except Exception as _ws_exc: # noqa: BLE001
87
- print(f"[workspace] 本轮工作目录钉不上(回默认):"
87
+ print(f"[workspace] cannot pin this turn's workspace dir (using default): "
88
88
  f"{type(_ws_exc).__name__}: {_ws_exc}")
89
89
 
90
90
  # 权限解禁:完全权限 + 设置里那个开关,本轮把剩下的阻力也拿掉
@@ -95,7 +95,7 @@ class AgentLoopStage(Stage):
95
95
  from core import unlock
96
96
  unlock.pin(ctx.session_id)
97
97
  except Exception as _ul_exc: # noqa: BLE001
98
- print(f"[unlock] 解禁状态钉不上(本轮按**不**解禁处理):"
98
+ print(f"[unlock] cannot pin unlock state (this turn treated as NOT unlocked): "
99
99
  f"{type(_ul_exc).__name__}: {_ul_exc}")
100
100
 
101
101
  # ── 这一轮的所有代价旋钮都来自投入档
@@ -115,8 +115,8 @@ class AgentLoopStage(Stage):
115
115
  # 免得有人改了却看不到变化(静默忽略一个用户改过的键,比拒绝更坏)。
116
116
  _cfg_cap = ctx.config.get("tool_result_max_chars")
117
117
  if _cfg_cap is not None and int(_cfg_cap) != tool_result_max_chars:
118
- print(f"[tier] config.yaml 的 tool_result_max_chars={_cfg_cap} **不再生效** —— "
119
- f"现在由档位给(档 {spec.level} 是 {tool_result_max_chars})")
118
+ print(f"[tier] config.yaml tool_result_max_chars={_cfg_cap} no longer takes effect - "
119
+ f"tier {spec.level} gives {tool_result_max_chars}")
120
120
 
121
121
  max_turns = spec.max_turns
122
122
  # 流式开关
@@ -146,7 +146,7 @@ class AgentLoopStage(Stage):
146
146
  ctx.messages = ctx.session_pool.maybe_trim_cold_window(
147
147
  session_key_of_ctx(ctx), ctx.messages)
148
148
  except Exception as _win_exc: # noqa: BLE001
149
- print(f"[memory] 冷闸滑窗检查失败(本轮不剪):"
149
+ print(f"[memory] cold-window trim check failed (not trimming this turn): "
150
150
  f"{type(_win_exc).__name__}: {_win_exc}")
151
151
 
152
152
  # 日期变化时往消息流补一条
@@ -165,9 +165,9 @@ class AgentLoopStage(Stage):
165
165
  if _date_note:
166
166
  ctx.messages.append({"role": "user", "content": _date_note,
167
167
  "kind": "date_change"})
168
- print(f"[date] 跨零点 —— 已往消息流补一条({ctx.session_id})")
168
+ print(f"[date] crossed midnight - appended one message ({ctx.session_id})")
169
169
  except Exception as _date_exc: # noqa: BLE001
170
- print(f"[date] 日期检查失败(本轮不补):"
170
+ print(f"[date] date check failed (no append this turn): "
171
171
  f"{type(_date_exc).__name__}: {_date_exc}")
172
172
 
173
173
  # 审批回答 = 把那次挂起调用的结果补上
@@ -223,7 +223,7 @@ class AgentLoopStage(Stage):
223
223
  _emit=make_emitter(ctx.events, session_key_of_ctx(ctx)),
224
224
  )
225
225
  except Exception as _rp_exc: # noqa: BLE001
226
- print(f"[approval] 重放失败(退回旧回执):"
226
+ print(f"[approval] replay failed (falling back to old receipt): "
227
227
  f"{type(_rp_exc).__name__}: {_rp_exc}")
228
228
  _replay_ok = False
229
229
  # 结算结论照发:卡片要说的是"用户做了什么决定",
@@ -256,7 +256,7 @@ class AgentLoopStage(Stage):
256
256
  try:
257
257
  compacted, done = pool.compact(session_key_of_ctx(ctx), _msgs)
258
258
  except Exception as _cexc: # noqa: BLE001
259
- print(f"[compact] 超长自救失败(压缩抛错):"
259
+ print(f"[compact] over-length rescue failed (compression raised): "
260
260
  f"{type(_cexc).__name__}: {_cexc}")
261
261
  return False
262
262
  if not done:
@@ -279,7 +279,7 @@ class AgentLoopStage(Stage):
279
279
  # 一行日志,说明这一轮走的是哪条路。
280
280
  # 没有它,两条路在日志里长得一模一样,"流式开着却看不到逐字输出"
281
281
  # 只能靠间接证据推断。一行能说清的事,不许留着不出声。
282
- print("[stream] 本轮走流式(settings.stream_output=true)")
282
+ print("[stream] this turn uses streaming (settings.stream_output=true)")
283
283
  # 走流式路径 —— 累积所有产出的状态,以最后一个作为结果
284
284
  final_state = None
285
285
  async for state in agent_loop_stream(
@@ -440,7 +440,7 @@ def _persist_replay(ctx) -> None:
440
440
  try:
441
441
  mm.repersist_messages(ctx.storage_id, ctx.messages)
442
442
  except Exception as exc: # noqa: BLE001
443
- print(f"[approval] 重放结果落库失败(下一轮会读回旧载荷):"
443
+ print(f"[approval] failed to persist replay result (next turn will read the old payload): "
444
444
  f"{type(exc).__name__}: {exc}")
445
445
 
446
446
 
@@ -485,8 +485,8 @@ def apply_llm_error_mark(ctx) -> bool:
485
485
  ctx.metadata["llm_error"] = True
486
486
  return True
487
487
  except Exception as exc: # noqa: BLE001
488
- print(f"[llm] 错误标记处理失败({type(exc).__name__}: {exc})"
489
- f" —— 这一轮按普通回复继续")
488
+ print(f"[llm] error-marker handling failed ({type(exc).__name__}: {exc})"
489
+ f" - continuing as a normal reply this turn")
490
490
  return False
491
491
 
492
492
 
@@ -503,7 +503,8 @@ def _note_pending_call(pend: dict, msgs: list, tool_msg_index: int) -> None:
503
503
  #: `scheduler._PENDING_STORES` 是同一个集合(后两张表分别用于结算与持久化)。
504
504
  _PENDING_STORE_ATTRS = (
505
505
  "pending_cross_zone", "pending_delete", "pending_delete_bulk",
506
- "pending_egress", "pending_command", "pending_destructive", "pending_plan",
506
+ "pending_egress", "pending_ssh_hostkey", "pending_command",
507
+ "pending_destructive", "pending_plan",
507
508
  # 提问面板(也由"没人会回答"的收尾逻辑覆盖)。
508
509
  "pending_ask",
509
510
  # 工作区之外写文件。
@@ -636,7 +637,7 @@ def _emit_neutralized(ctx, msgs: list, idxs: list) -> None:
636
637
  bus.emit(EVT_TOOL_NEUTRALIZED, session_key=key,
637
638
  tool=str(_name or ""))
638
639
  except Exception as exc: # noqa: BLE001 — 观测不许弄挂这一轮
639
- print(f"[approval] 中和事件发不出去({type(exc).__name__}: {exc})")
640
+ print(f"[approval] cannot emit neutralization event ({type(exc).__name__}: {exc})")
640
641
 
641
642
 
642
643
  def _check_cross_zone_pending(ctx: StageContext,
@@ -792,6 +793,26 @@ def _check_cross_zone_pending(ctx: StageContext,
792
793
  ctx.approval_ask_counts.get(kind, 0)) + 1
793
794
  _armed_idx = _i
794
795
  break
796
+ # SSH 主机密钥信任(TOFU)- 自己一格(一格只许一个 kind 用)。
797
+ # 载荷带 host_key_line(known_hosts 格式):结算器要原样存下来,
798
+ # 重放那次调用时连接才能过严格主机密钥校验。
799
+ if data.get("status") == "pending_ssh_hostkey_approval":
800
+ pend = ctx.pending_ssh_hostkey
801
+ pend["active"] = True
802
+ pend["stage"] = "ask"
803
+ pend["kind"] = "ssh_hostkey"
804
+ pend["subject"] = data.get("subject", "")
805
+ pend["host_key_line"] = data.get("host_key_line", "")
806
+ pend["fingerprint"] = data.get("fingerprint", "")
807
+ pend["detail"] = data.get("detail", "")
808
+ pend["body"] = data.get("body", "")
809
+ pend["request_id"] = new_request_id("ssh_hostkey")
810
+ _note_pending_call(pend, msgs, _i)
811
+ prompt = data.get("prompt", "")
812
+ if prompt and not _is_web(ctx):
813
+ ctx.response = prompt
814
+ _armed_idx = _i
815
+ break
795
816
  # Delete approval
796
817
  if data.get("status") == "pending_delete_approval":
797
818
  # 两个 kind 各有自己的格(`delete` / `delete_bulk`)。
@@ -42,22 +42,10 @@ def _log(msg: str) -> None:
42
42
  print("[group] " + msg)
43
43
 
44
44
 
45
- #: 上 wire 的字段白名单。 `kind` / `speaker` / `avatar` 是我们给界面看的,
46
- #: 不是给上游 API 的 —— 严格一点的 OpenAI 兼容端点会对未知消息字段报错。
47
- #: `tool_calls` / `tool_call_id` / `reasoning_content` 必须留(它们是协议/思考回传)。
48
- _WIRE_FIELDS = frozenset({
49
- "role", "content", "tool_calls", "tool_call_id", "name", "reasoning_content",
50
- })
51
-
52
-
53
45
  def _wire_messages(messages: list[dict]) -> list[dict]:
54
- """历史副本 → 只带协议字段(不把 `speaker` / `avatar` 发给上游)。"""
55
- out: list[dict] = []
56
- for m in messages or []:
57
- if not isinstance(m, dict):
58
- continue
59
- out.append({k: v for k, v in m.items() if k in _WIRE_FIELDS})
60
- return out
46
+ """历史副本 → 四家成员同形的协议形状(判据在 `group_reply.normalize_history`)。"""
47
+ from core import group_reply as _gr
48
+ return _gr.normalize_history(messages)
61
49
 
62
50
 
63
51
  @register_stage
@@ -171,6 +159,7 @@ class GroupReplyStage(Stage):
171
159
  from core.tiers import current_spec
172
160
  from core.prompt_assembler import assemble_system_prompt, model_name_of
173
161
  from core.events import make_emitter
162
+ from core import model_profiles as _profiles
174
163
 
175
164
  spec = current_spec(ctx.session_id)
176
165
  active = get_active_tool_names(ctx.session_id)
@@ -229,8 +218,12 @@ class GroupReplyStage(Stage):
229
218
  tool_result_max_chars=spec.tool_result_max_chars,
230
219
  max_turns=spec.max_turns,
231
220
  session_id=ctx.session_id,
232
- _tools=schemas,
233
- _tool_allowlist=frozenset(allowed),
221
+ _tools=(schemas if _profiles.accepts_tools(
222
+ str(getattr(item["provider"], "_provider_name", "") or ""),
223
+ model_name_of(item["provider"])) else []),
224
+ _tool_allowlist=(frozenset(allowed) if _profiles.accepts_tools(
225
+ str(getattr(item["provider"], "_provider_name", "") or ""),
226
+ model_name_of(item["provider"])) else frozenset()),
234
227
  _system=system,
235
228
  _emit=emit,
236
229
  thinking=spec.thinking,
@@ -338,6 +331,9 @@ class GroupReplyStage(Stage):
338
331
  "kind": "group_speaker",
339
332
  "speaker": r["name"],
340
333
  "avatar": r["avatar"],
334
+ # 记下是哪个模型说的:换模型后回看这段历史,
335
+ # 才知道 reasoning / 工具形状来自哪一家。
336
+ "model": str(r.get("model") or ""),
341
337
  }
342
338
  # 成员自己的产物挂在自己的回复上(没有就不设键 ——
343
339
  # 读不到 ≠ 空)。落库走 `extra_json`,刷新后照样在。
@@ -375,6 +371,7 @@ class GroupReplyStage(Stage):
375
371
  ② 自动接力 —— 下一位由一次小 LLM 调用决定;
376
372
  ③ `@点名` = 只让被点的人说(显式控制,不接力)。
377
373
  """
374
+ from core import model_profiles as _profiles
378
375
  from core import group_digest, group_reply
379
376
  from core.session_key import session_key_of_ctx
380
377
  from core.group_dispatch import ensure_provider
@@ -502,8 +499,12 @@ class GroupReplyStage(Stage):
502
499
  tool_result_max_chars=spec.tool_result_max_chars,
503
500
  max_turns=spec.max_turns,
504
501
  session_id=ctx.session_id,
505
- _tools=schemas,
506
- _tool_allowlist=frozenset(allowed),
502
+ _tools=(schemas if _profiles.accepts_tools(
503
+ str(getattr(prov, "_provider_name", "") or ""),
504
+ model_name_of(prov)) else []),
505
+ _tool_allowlist=(frozenset(allowed) if _profiles.accepts_tools(
506
+ str(getattr(prov, "_provider_name", "") or ""),
507
+ model_name_of(prov)) else frozenset()),
507
508
  _system=system,
508
509
  _emit=emit,
509
510
  thinking=spec.thinking,
@@ -566,7 +567,8 @@ class GroupReplyStage(Stage):
566
567
  msg = {"role": "assistant",
567
568
  "content": group_reply.member_reply_content(r["name"], r["content"]),
568
569
  "kind": "group_speaker", "speaker": r["name"],
569
- "avatar": r["avatar"]}
570
+ "avatar": r["avatar"],
571
+ "model": str(r.get("model") or "")}
570
572
  if r.get("artifacts"):
571
573
  msg["artifacts"] = r["artifacts"]
572
574
  ctx.messages.append(msg)
@@ -80,10 +80,10 @@ class PostProcessStage(Stage):
80
80
  if ctx.model_config_id:
81
81
  from core import session_model
82
82
  if session_model.freeze(session_key, ctx.model_config_id):
83
- print(f"[session_model] 这一段冻结在配置 "
84
- f"'{ctx.model_config_id}' 上 —— 之后改默认不再影响它")
83
+ print(f"[session_model] this conversation frozen to config "
84
+ f"'{ctx.model_config_id}' - later default changes won't affect it")
85
85
  except Exception as exc: # noqa: BLE001
86
- print(f"[session_model] 冻结失败(这一段会跟随默认):"
86
+ print(f"[session_model] freeze failed (this conversation follows the default): "
87
87
  f"{type(exc).__name__}: {exc}")
88
88
 
89
89
  if compressed is not None and compressed is not ctx.messages:
@@ -110,8 +110,8 @@ class PostProcessStage(Stage):
110
110
  from core.plan import note_compressed
111
111
  note_compressed(ctx.session_id)
112
112
  except Exception as exc: # noqa: BLE001
113
- print(f"[plan_reminder] 标记压缩失败({type(exc).__name__}: {exc})"
114
- f" —— 这一段对话不再重发计划模式提醒")
113
+ print(f"[plan_reminder] failed to mark compressed ({type(exc).__name__}: {exc})"
114
+ f" - this conversation won't resend the plan-mode reminder")
115
115
  # Keep pool cache in sync with potentially compressed messages
116
116
  if session_key in pool._loaded:
117
117
  sid = pool._loaded[session_key][0]
@@ -135,7 +135,7 @@ class PostProcessStage(Stage):
135
135
  ctx.metadata["dedup_done"] = True
136
136
  except Exception as exc: # noqa: BLE001
137
137
  # 不阻断对话,但不许静默:落不了账的后果是"重投时再答一遍"。
138
- print(f"[dedup] 落账失败({type(exc).__name__}: {exc})"
139
- f" —— 这条消息重投时可能再答一遍")
138
+ print(f"[dedup] failed to record ({type(exc).__name__}: {exc})"
139
+ f" - a redelivery of this message may be answered again")
140
140
 
141
141
  return ctx