@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
@@ -32,11 +32,11 @@ from . import clipboard
32
32
  from . import events as E
33
33
  from .backend import Backend, BackendError
34
34
  from .client import EventStream
35
- from .commands import parse_command, short_path
35
+ from .commands import model_command, parse_command, short_path, targets_full_access
36
36
  from .i18n import t
37
- from .ui import (ApprovalPanel, BtwPanel, Composer, HeaderBar, StatusBar,
38
- StatusLine, SuggestBar, TaskDetail, ToolCard, Transcript,
39
- UpdateHint, retry_label, services_label)
37
+ from .ui import (ApprovalPanel, BtwPanel, Composer, HeaderBar, ModelEditPanel,
38
+ StatusBar, StatusLine, SuggestBar, TaskDetail, ToolCard,
39
+ Transcript, UpdateHint, retry_label, services_label)
40
40
 
41
41
  def _fmt_pct(v: float) -> str:
42
42
  """百分比:保留一位小数,整数就省掉 `.0`。
@@ -154,15 +154,29 @@ class CranniaApp(App):
154
154
  self._btw_orphan = False
155
155
  #: 这一轮是 `/recap`:回答按「recap/回顾:」那一行渲染。
156
156
  self._recap_pending = False
157
+ #: 本轮已经打过「记忆已更新」那一行了(存 `_turn_t0`)。
158
+ #: 抽取与巩固两条事件说的是同一件事,叠两行像出了两次问题。
159
+ self._memory_note_seen = 0.0
157
160
  #: 状态栏左半的档位。`show(busy=...)` 每轮都要重画右侧提示,
158
161
  #: 档位不能跟着清空 —— 它们不是这轮的属性。
159
162
  self._mode = ""
163
+ #: 模式的**键**(`manual` / `auto` / `plan` / `full_access`)。
164
+ #: 显示用中文名(`_mode`),判定必须用键 —— 英文界面里名字是英文。
165
+ self._mode_key = ""
160
166
  self._effort = ""
167
+ #: 等安全提示回答的那条 `/mode …`(非空 = 面板正占着那个槽)。
168
+ self._safety_cmd = ""
169
+ #: 本次运行里选过「开启,且不再询问」。不落盘:它是这一次运行的让步,
170
+ #: 重启之后重新问一次(完全权限的确认不该变成永久静音)。
171
+ self._safety_skip = False
161
172
  #: 底栏那格后台服务读数:文案 + 要不要染黄(关着 = 黄)。
162
173
  #: 由 `/api/status` 的 `background_services` / `channels_running` /
163
174
  #: `cron_jobs` 算出来,不在这边猜。
164
175
  self._services = ""
165
176
  self._services_warn = False
177
+ #: 接管开着没有。真相源在后端(`/api/computer-use/status`),
178
+ #: 这里只是每 5 秒同步一次的影子 —— 不许拿它当判据。
179
+ self._takeover = False
166
180
  #: 顶栏那行模型标签("model(配置名)")—— 轮末刷新时比对用。
167
181
  self._model_label = ""
168
182
  #: 顶栏那行档位 —— 与上面同理,变了才重画抬头。
@@ -223,6 +237,7 @@ class CranniaApp(App):
223
237
  yield StatusLine(id="status")
224
238
  yield SuggestBar("", id="suggest")
225
239
  yield TaskDetail(id="task-detail")
240
+ yield ModelEditPanel(id="model-edit")
226
241
  yield ApprovalPanel(id="approval")
227
242
  yield UpdateHint(id="update-hint")
228
243
  yield BtwPanel(id="btw-panel")
@@ -277,8 +292,14 @@ class CranniaApp(App):
277
292
  # 配置名只是给用户区分"哪一套 key"的,和模型名重复时纯属噪声。
278
293
  label = f"{model}({name})" if name and name.lower() not in model.lower() else model
279
294
  self._model_label = label
280
- self._mode = str(status.get("mode_name") or "").strip()
281
- self._effort = str(status.get("effort_name") or "").strip()
295
+ # 会话已冻结的那一档优先:`mode_name` / `effort_name` 是设置里写着的
296
+ # 默认值,用户 `/mode` `/effort` 换过之后它不会变(「标签在说谎」)。
297
+ self._mode = str(status.get("mode_session_name")
298
+ or status.get("mode_name") or "").strip()
299
+ self._mode_key = str(status.get("mode_session")
300
+ or status.get("mode_configured") or "")
301
+ self._effort = str(status.get("effort_session_name")
302
+ or status.get("effort_name") or "").strip()
282
303
  self.query_one(HeaderBar).show(
283
304
  title="Crannia",
284
305
  version=str(status.get("version") or "").strip(),
@@ -416,6 +437,16 @@ class CranniaApp(App):
416
437
  self._add_recap(text)
417
438
  return
418
439
 
440
+ if ev.type in (E.MEMORY_SAVED, E.MEMORY_ORGANIZED):
441
+ # 后台记忆动过(写了几条 / 巩固改了几条)—— 同一句回执,一轮最多一行。
442
+ self._add_memory_note()
443
+ return
444
+
445
+ if ev.type == E.ICE_CANARY:
446
+ # 出站金丝雀被拦下:安全事实,红标一行(与「自动审查拦截」同一种标)。
447
+ self._add_ice_canary()
448
+ return
449
+
419
450
  if ev.type == E.ERROR:
420
451
  msg = ev.s("message") or ev.s("error") or t("未知错误")
421
452
  stage = ev.s("stage")
@@ -560,6 +591,10 @@ class CranniaApp(App):
560
591
  if self._btw_active:
561
592
  self._approval_deferred = True
562
593
  return
594
+ # 安全提示也占着输入框那个槽 —— 压到它答完再弹(同一套延后机制)。
595
+ if self._safety_cmd:
596
+ self._approval_deferred = True
597
+ return
563
598
  # 审批要占输入框那个槽;底栏详细页先收起来,别叠在一起。
564
599
  if self._nav:
565
600
  self._close_nav()
@@ -601,6 +636,11 @@ class CranniaApp(App):
601
636
  composer.focus()
602
637
 
603
638
  def on_approval_panel_answer(self, event: ApprovalPanel.Answer) -> None:
639
+ # 安全提示复用同一张面板,但回答归本地 —— 不许发到后端
640
+ # (它没有对应的 `request_id`,发出去只会被当成一次不存在的审批)。
641
+ if self._safety_cmd:
642
+ self._resolve_safety_notice(event.choice)
643
+ return
604
644
  self._submit_approval(choice=event.choice, text=event.text)
605
645
 
606
646
  def _submit_approval(self, *, choice: str = "", text: str = "") -> None:
@@ -647,16 +687,33 @@ class CranniaApp(App):
647
687
  status = self.backend.get_json("/api/status")
648
688
  except Exception: # noqa: BLE001
649
689
  return
650
- self.call_from_thread(self._apply_status, status or {})
651
-
652
- def _apply_status(self, status: dict) -> None:
653
- mode = str(status.get("mode_name") or "").strip()
654
- effort = str(status.get("effort_name") or "").strip()
690
+ # 接管状态是另一个端点(唯一真相源在那儿)。读不到就当"没开"——
691
+ # 它只影响底栏那一格,不影响任何授权判定。
692
+ takeover = False
693
+ try:
694
+ cu = self.backend.get_json("/api/computer-use/status") or {}
695
+ takeover = bool(cu.get("enabled"))
696
+ except Exception: # noqa: BLE001
697
+ takeover = False
698
+ self.call_from_thread(self._apply_status, status or {}, takeover)
699
+
700
+ def _apply_status(self, status: dict, takeover: bool = False) -> None:
701
+ mode = str(status.get("mode_session_name")
702
+ or status.get("mode_name") or "").strip()
703
+ self._mode_key = str(status.get("mode_session")
704
+ or status.get("mode_configured") or "")
705
+ effort = str(status.get("effort_session_name")
706
+ or status.get("effort_name") or "").strip()
655
707
  services, warn = services_label(status)
656
708
  services_changed = (services, warn) != (self._services,
657
709
  self._services_warn)
658
710
  self._services, self._services_warn = services, warn
659
- if mode != self._mode or effort != self._effort or services_changed:
711
+ takeover_changed = takeover != self._takeover
712
+ self._takeover = takeover
713
+ if takeover_changed:
714
+ self._set_takeover_title()
715
+ if (mode != self._mode or effort != self._effort or services_changed
716
+ or takeover_changed):
660
717
  self._mode, self._effort = mode, effort
661
718
  self._statusbar(busy=self._busy)
662
719
  # 顶栏的模型与档位也一样:在 GUI 里换了,这里不跟就是一直报旧值。
@@ -702,6 +759,9 @@ class CranniaApp(App):
702
759
  审批挂着的时候不响应 —— 那时"停下来"的语义是模糊的(停的是工具
703
760
  还是那轮对话?),而后端的中断只保证"下一次调模型之前停下"。
704
761
  """
762
+ if self.query_one(ModelEditPanel).is_open:
763
+ self._close_model_edit()
764
+ return
705
765
  if self._btw_active:
706
766
  self._close_btw()
707
767
  return
@@ -776,6 +836,32 @@ class CranniaApp(App):
776
836
  line.append((text or "").strip() or t("(没有内容)"))
777
837
  self.query_one(Transcript).add(line, classes="note")
778
838
 
839
+ def _add_memory_note(self) -> None:
840
+ """后台记忆动过 —— 单独一行,橙色。
841
+
842
+ 一轮最多一行:`memory.saved`(写了几条)与 `memory.organized`
843
+ (巩固改了几条)说的是同一件事,各打一行会读成"出了两次问题"。
844
+ """
845
+ if self._memory_note_seen and self._memory_note_seen == self._turn_t0:
846
+ return
847
+ self._memory_note_seen = self._turn_t0
848
+ line = Text()
849
+ line.append(t("【记忆】"), style="#ff9800")
850
+ line.append(t("记忆已更新") + " · " + time.strftime("%H:%M"),
851
+ style="#ff9800")
852
+ self.query_one(Transcript).add(line, classes="note")
853
+
854
+ def _add_ice_canary(self) -> None:
855
+ """出站金丝雀被拦下 —— 红标一行,与「自动审查拦截」同一种标。
856
+
857
+ 判据:安全事实必须看得见(旧 WebUI 那一份走的是同一条:
858
+ `[ICE] 金丝雀触发 —— 已阻断`)。它是阻断,不是提示,所以点也染红。
859
+ """
860
+ line = Text()
861
+ line.append("● ", style="red")
862
+ line.append(t("【ICE】金丝雀触发-已阻断"), style="red")
863
+ self.query_one(Transcript).add(line, classes="note")
864
+
779
865
  def _note(self, text: str) -> None:
780
866
  self.query_one(Transcript).add(Text(text), classes="note")
781
867
 
@@ -814,6 +900,14 @@ class CranniaApp(App):
814
900
  if action == "desktop":
815
901
  self._note(t("这条命令在桌面端使用:TUI 不重画切换后的对话。"))
816
902
  return
903
+ if action == "chat":
904
+ _kind, _ref = model_command(payload)
905
+ if _kind == "set":
906
+ if self._busy:
907
+ self._note(t("不可使用,上一轮回答尚未完成。"))
908
+ return
909
+ self._open_model_edit(_ref)
910
+ return
817
911
  if action == "chat" and payload.lower().startswith("/btw"):
818
912
  # 题外话走一个独立窗口:不进转写区、也不占它的位置。
819
913
  # 跑着的时候不开 —— 那一问会被排到后面,窗口会在等别人的活。
@@ -829,9 +923,116 @@ class CranniaApp(App):
829
923
  self._recap_pending = True
830
924
  # 本地的 `/exit` `/cls` `/new` 上面就返回了;走到这里的是要交给后端的
831
925
  # 文本(普通消息,或者 `/skill` `/effort` 这类框架命令)。
926
+ #
927
+ # 切「完全权限」要先过一次安全提示(与 GUI 的 `SafetyNotice` 同义)。
928
+ # 只拦发送、不另实现切换 —— 命令本身仍由后端的 `_cmd_mode` 执行,
929
+ # 两条路不许有两套语义。
930
+ if (action == "chat" and targets_full_access(payload)
931
+ and not self._safety_skip and self._mode_key != "full_access"):
932
+ self._safety_cmd = payload
933
+ self._show_safety_notice()
934
+ return
832
935
  self._send(payload, new=self._pending_new, images=images)
833
936
  self._pending_new = False
834
937
 
938
+ def _show_safety_notice(self) -> None:
939
+ """切「完全权限」前的那一屏 —— 形状与审批面板一致,警告同 GUI。
940
+
941
+ 默认落在「取消」上(回车不会误开);数字键选、回车确认,
942
+ 与审批表同一套键位。
943
+ """
944
+ from .approval import Option, Prompt
945
+
946
+ body = (t("安全提示") + "\n\n"
947
+ + t("您正在将框架运行模式切换至") + " " + t("完全权限")
948
+ + t(",此模式下 agent 将获得最大权限能力。 agent 的行动将不再询问您,"
949
+ "仅有部分硬性边界生效。 请注意,您仍然是您的生产安全第一负责人。"))
950
+ prompt = Prompt(
951
+ request_id="local-full-access",
952
+ kind="safety",
953
+ body=body,
954
+ options=(Option("1", t("启用")),
955
+ Option("2", t("启用,且不再询问")),
956
+ Option("3", t("取消"))),
957
+ default_key="3",
958
+ )
959
+ self.query_one(ApprovalPanel).show_prompt(prompt)
960
+
961
+ def _resolve_safety_notice(self, choice: str) -> None:
962
+ """安全提示的回答:1 开 / 2 开且本次不再问 / 3 取消。"""
963
+ cmd = self._safety_cmd
964
+ self._safety_cmd = ""
965
+ self.query_one(ApprovalPanel).clear()
966
+ composer = self.query_one("#composer", Composer)
967
+ composer.display = True
968
+ if not composer.disabled:
969
+ composer.focus()
970
+ if not cmd or choice == "3":
971
+ self._note(t("已取消切换到完全权限"))
972
+ if cmd:
973
+ # 放回输入框 —— 取消不是"把你的命令吃掉",改完还能再发。
974
+ composer.text = cmd
975
+ composer.move_cursor(composer.document.end)
976
+ return
977
+ if choice == "2":
978
+ self._safety_skip = True
979
+ self._send(cmd, new=self._pending_new, images=[])
980
+ self._pending_new = False
981
+ if self._approval_deferred:
982
+ self._approval_deferred = False
983
+ self._approval_requested()
984
+
985
+ # -- 模型配置编辑(`/model set`)-------------------------------
986
+
987
+ def _open_model_edit(self, ref: str) -> None:
988
+ """解析条目并弹出编辑面板。
989
+
990
+ 密钥只从面板收:命令正文会进聊天记录,打错一个字就不再是命令。
991
+ """
992
+ ref = (ref or "").strip()
993
+ if not ref:
994
+ self._note(t("使用 /model set <编号|配置名|id> 修改现有配置。"))
995
+ return
996
+ try:
997
+ payload = self.backend.get_json("/api/model-configs")
998
+ except Exception as exc: # noqa: BLE001
999
+ self._note(t("读取模型配置失败:%s") % type(exc).__name__)
1000
+ return
1001
+ from . import profile
1002
+
1003
+ entries = profile._entries_from_cards(payload)
1004
+ hit, why = profile._resolve(entries, ref)
1005
+ if hit is None:
1006
+ self._note(why or t("没有找到此配置"))
1007
+ return
1008
+ self.query_one("#composer", Composer).display = False
1009
+ self.query_one(ModelEditPanel).show(hit)
1010
+
1011
+ def _close_model_edit(self) -> None:
1012
+ self.query_one(ModelEditPanel).clear()
1013
+ composer = self.query_one("#composer", Composer)
1014
+ composer.display = True
1015
+ composer.focus()
1016
+
1017
+ def on_model_edit_panel_submitted(self, event) -> None:
1018
+ panel = self.query_one(ModelEditPanel)
1019
+ body = {"id": event.entry_id}
1020
+ body.update(event.values)
1021
+ try:
1022
+ code, text = self.backend.post_json(
1023
+ "/api/model-configs/update", body)
1024
+ data = json.loads(text or "{}")
1025
+ except Exception as exc: # noqa: BLE001
1026
+ panel.fail(type(exc).__name__)
1027
+ return
1028
+ if code == 200 and isinstance(data, dict) and data.get("ok"):
1029
+ panel.finish()
1030
+ else:
1031
+ panel.fail(str((data or {}).get("error") or t("后端无应答")))
1032
+
1033
+ def on_model_edit_panel_closed(self, event) -> None:
1034
+ self._close_model_edit()
1035
+
835
1036
  def on_composer_complete(self, event: Composer.Complete) -> None:
836
1037
  """Tab:选择下移一格(与 ↓ 等价,给不习惯用方向键的人)。"""
837
1038
  self._move_suggest(1)
@@ -938,11 +1139,27 @@ class CranniaApp(App):
938
1139
  if not alive:
939
1140
  self._close_nav()
940
1141
  return
941
- self.query_one(StatusBar).show_tasks(bg=len(bg), sub=len(sub),
942
- focus=self._pill if self._nav else "")
1142
+ self._refresh_task_cell()
943
1143
  if self._nav == "detail":
944
1144
  self._show_detail()
945
1145
 
1146
+ def _refresh_task_cell(self) -> None:
1147
+ """重画底栏中间那两格(后台 / 子代理)—— 唯一一处。"""
1148
+ bg = len(self._tasks.get("background") or [])
1149
+ sub = len(self._tasks.get("subagents") or [])
1150
+ self.query_one(StatusBar).show_tasks(
1151
+ bg=bg, sub=sub, focus=self._pill if self._nav else "")
1152
+
1153
+ def _set_takeover_title(self) -> None:
1154
+ """接管开着时,在输入框边框左上角写黄色的「【接管中】」。
1155
+
1156
+ 放这里而不是底栏:底栏那三格在窄终端里会被挤掉(80 列时正好贴边),
1157
+ 而输入框的边框本来就空着 —— 它出现本身就是"正在接管"。
1158
+ """
1159
+ composer = self.query_one_optional("#composer", Composer)
1160
+ if composer is not None:
1161
+ composer.border_title = t("【接管中】") if self._takeover else ""
1162
+
946
1163
  def on_composer_nav(self, event: Composer.Nav) -> None:
947
1164
  act, arg = event.action, event.arg
948
1165
  bg = len(self._tasks.get("background") or [])
@@ -954,7 +1171,8 @@ class CranniaApp(App):
954
1171
  self._nav = "pills"
955
1172
  self._pill = "bg" if bg else "sub"
956
1173
  composer.nav = "pills"
957
- self.query_one(StatusBar).show_tasks(bg=bg, sub=sub, focus=self._pill)
1174
+ self.query_one(StatusBar).show_tasks(
1175
+ bg=bg, sub=sub, focus=self._pill)
958
1176
  return
959
1177
  if act == "switch":
960
1178
  if not self._nav:
@@ -962,7 +1180,8 @@ class CranniaApp(App):
962
1180
  self._pill = "sub" if self._pill == "bg" else "bg"
963
1181
  if not (sub if self._pill == "sub" else bg):
964
1182
  self._pill = "bg" if self._pill == "sub" else "sub"
965
- self.query_one(StatusBar).show_tasks(bg=bg, sub=sub, focus=self._pill)
1183
+ self.query_one(StatusBar).show_tasks(
1184
+ bg=bg, sub=sub, focus=self._pill)
966
1185
  return
967
1186
  if act == "leave" or act == "close":
968
1187
  self._close_nav()
@@ -1148,8 +1367,12 @@ class CranniaApp(App):
1148
1367
 
1149
1368
  def _statusbar(self, *, busy: bool) -> None:
1150
1369
  pct = "—" if self._ctx_pct is None else f"{_fmt_pct(self._ctx_pct)}%"
1370
+ # 「完全权限」在底栏只写「完全」—— 四个字那一格太宽,而这一格是常驻的。
1371
+ mode = self._mode
1372
+ if mode == "完全权限":
1373
+ mode = t("完全")
1151
1374
  self.query_one(StatusBar).show(
1152
- mode=self._mode, effort=self._effort, busy=busy,
1375
+ mode=mode, effort=self._effort, busy=busy,
1153
1376
  ctx=t("上下文:") + f"{pct}/{_fmt_pct(self._ctx_thr)}%",
1154
1377
  ctx_armed=self._ctx_armed,
1155
1378
  services=self._services, services_warn=self._services_warn)
@@ -68,6 +68,23 @@ Transcript .tool {
68
68
  /* 审批面板:平时藏着,出现时**占的正是输入框那个槽** ——
69
69
  * 同样的位置、同样的圆角边框,读起来是"这里暂时换了个用途",
70
70
  * 而不是"弹了个窗"。选中态的标记(▌)画在内容里,颜色跟随文本。 */
71
+ /* `/model set` 的编辑面板:占输入框那个槽的小框。 */
72
+ ModelEditPanel {
73
+ display: none;
74
+ height: auto;
75
+ margin: 0 1;
76
+ padding: 0 1;
77
+ border: round $primary;
78
+ }
79
+
80
+ ModelEditPanel:focus {
81
+ border: round $accent;
82
+ }
83
+
84
+ ModelEditPanel #model-edit-body {
85
+ width: 100%;
86
+ }
87
+
71
88
  ApprovalPanel {
72
89
  display: none;
73
90
  height: auto;
@@ -116,6 +133,10 @@ BtwPanel #btw-text {
116
133
  height: auto;
117
134
  margin: 0 1;
118
135
  border: round $primary;
136
+ /* 接管开着时 `App` 会在边框左上角写「【接管中】」—— 黄色,
137
+ * 与底栏原先那格同义。它只出现、不改输入行为。 */
138
+ border-title-color: yellow;
139
+ border-title-align: left;
119
140
  }
120
141
 
121
142
  #composer:focus {
@@ -1,19 +1,29 @@
1
1
  """剪贴板里的图:取一张,转成 data URL。
2
2
 
3
3
  为什么要有子进程:终端应用拿不到剪贴板的位图 —— 剪贴板是操作系统那一层的,
4
- 不是终端的。`Get-Clipboard -Format Image` 是系统自带、不用装依赖的那条路;
5
- 一次冷启动约 0.4 秒,所以只在按键时才调,不轮询。
4
+ 不是终端的。
5
+
6
+ - Windows:`Get-Clipboard -Format Image`。系统自带,不用装依赖;
7
+ 一次冷启动约 0.4 秒,所以只在按键时才调,不轮询。
8
+ - Linux:Wayland 用 `wl-paste`,X11 用 `xclip`。两个都不预装,所以
9
+ 找不到时必须说清装哪个包 —— 只说"读不到"的话,用户会去查权限。
10
+
11
+ 两条路都只认 `image/png`:与 Windows 那条(`ImageFormat::Png`)保持同一种载荷,
12
+ 上层不必按平台分叉。
6
13
  """
7
14
 
8
15
  from __future__ import annotations
9
16
 
17
+ import base64
18
+ import os
19
+ import shutil
10
20
  import subprocess
11
21
  import sys
12
22
 
13
23
  from .i18n import t
14
24
 
15
- #: 取图并转 base64 的脚本。一次调用做完全部转换 —— 不落临时文件:落盘要么
16
- #: 留在用户目录里,要么还得负责删,两个都是尾巴。
25
+ #: 取图并转 base64 的脚本(Windows)。一次调用做完全部转换 —— 不落临时文件:
26
+ #: 落盘要么留在用户目录里,要么还得负责删,两个都是尾巴。
17
27
  _SCRIPT = (
18
28
  "$i = Get-Clipboard -Format Image; "
19
29
  "if ($null -eq $i) { exit 3 }; "
@@ -25,19 +35,21 @@ _SCRIPT = (
25
35
  #: 脚本用这个退出码说"剪贴板里没有图"。它不是错误。
26
36
  _NO_IMAGE = 3
27
37
 
38
+ #: Linux 工具在"剪贴板里没有图"时的说法(大小写不敏感)。这也不算失败:
39
+ #: 用户按了贴图键、而剪贴板里是文字,与"工具坏了"是两件事。
40
+ _NO_IMAGE_HINTS = ("no suitable type", "not available",
41
+ "nothing is copied", "no selection owner")
42
+
28
43
 
29
44
  class ClipboardError(RuntimeError):
30
- """读剪贴板失败:没有 powershell、超时、或者脚本自己报错。"""
45
+ """读剪贴板失败:没有工具、超时、或者工具自己报错。"""
31
46
 
32
47
 
33
- def read_image() -> str | None:
34
- """剪贴板里的图 → `data:image/png;base64,…`;没有图返回 None。
48
+ def _win_read() -> str | None:
49
+ """Windows:PowerShell 取图。
35
50
 
36
51
  `-Sta` 不能省:.NET 的 `Clipboard` 要求 STA 线程,MTA 下直接抛异常。
37
52
  """
38
- if sys.platform != "win32":
39
- raise ClipboardError(t("剪贴板图片读取仅在windows下支持"))
40
-
41
53
  flags = getattr(subprocess, "CREATE_NO_WINDOW", 0)
42
54
  try:
43
55
  proc = subprocess.run(
@@ -60,3 +72,59 @@ def read_image() -> str | None:
60
72
 
61
73
  b64 = proc.stdout.decode("ascii", "ignore").strip()
62
74
  return f"data:image/png;base64,{b64}" if b64 else None
75
+
76
+
77
+ def _linux_cmd() -> list[str] | None:
78
+ """按会话类型挑一个能用的工具;都没有返回 None。
79
+
80
+ `--no-newline` 不能省:`wl-paste` 默认在输出末尾补一个换行,而这里拿的是
81
+ PNG 二进制 —— 多一个字节就少一截 IEND,base64 之后是一张打不开的图。
82
+ """
83
+ wayland = ["wl-paste", "--no-newline", "--type", "image/png"]
84
+ x11 = ["xclip", "-selection", "clipboard", "-t", "image/png", "-o"]
85
+ if os.environ.get("WAYLAND_DISPLAY") and shutil.which("wl-paste"):
86
+ return wayland
87
+ if os.environ.get("DISPLAY") and shutil.which("xclip"):
88
+ return x11
89
+ # 会话变量没有、工具却在(比如剪贴板经由 XWayland):两种都试一次,
90
+ # 顺序只是偏好,不代表会话类型。
91
+ if shutil.which("wl-paste"):
92
+ return wayland
93
+ if shutil.which("xclip"):
94
+ return x11
95
+ return None
96
+
97
+
98
+ def _linux_read() -> str | None:
99
+ cmd = _linux_cmd()
100
+ if cmd is None:
101
+ raise ClipboardError(
102
+ t("没装剪贴板工具:Wayland 装 wl-clipboard,X11 装 xclip"))
103
+ try:
104
+ proc = subprocess.run(cmd, capture_output=True, timeout=20, check=False)
105
+ except FileNotFoundError as exc: # which 与 exec 之间的窗口
106
+ raise ClipboardError(t("未找到 %s") % cmd[0]) from exc
107
+ except subprocess.TimeoutExpired as exc:
108
+ raise ClipboardError(t("剪贴板读取超时(20 秒)")) from exc
109
+
110
+ if proc.returncode != 0:
111
+ stderr = proc.stderr.decode("utf-8", "replace").strip()
112
+ low = stderr.lower()
113
+ # stderr 为空也按"没有图"处理:wl-paste 在没有选区时不吭声就退出 1。
114
+ # 真出错(权限、协议)会带文字,走下面那条。
115
+ if not stderr or any(h in low for h in _NO_IMAGE_HINTS):
116
+ return None
117
+ raise ClipboardError(stderr.splitlines()[-1])
118
+
119
+ if not proc.stdout:
120
+ return None
121
+ return "data:image/png;base64," + base64.b64encode(proc.stdout).decode("ascii")
122
+
123
+
124
+ def read_image() -> str | None:
125
+ """剪贴板里的图 → `data:image/png;base64,…`;没有图返回 None。"""
126
+ if sys.platform == "win32":
127
+ return _win_read()
128
+ if sys.platform.startswith("linux"):
129
+ return _linux_read()
130
+ raise ClipboardError(t("剪贴板图片读取仅在 Windows 和 Linux 下支持"))
@@ -17,6 +17,43 @@ from rich.cells import cell_len
17
17
  #: 补全里不列(见 `app._SUGGEST_HIDDEN`),手打也会在这里被拦下。
18
18
  _DESKTOP_ONLY = ("/resume", "/rewind")
19
19
 
20
+ #: `/mode` 的这两个词都指向「完全权限」(中文名与英文键,`core.modes.mode_of`
21
+ #: 两条都认)。TUI 在发出去之前要认出来:切到完全权限得先过一次安全提示。
22
+ _FULL_ACCESS = ("full_access", "完全权限")
23
+
24
+
25
+ def targets_full_access(text: str) -> bool:
26
+ """这一行是不是「把模式切到完全权限」。
27
+
28
+ 只认 `/mode <词>` 这一种形状 —— 正文里出现这个词不算
29
+ (`/btw 完全权限是什么` 是提问,不是切换)。
30
+ """
31
+ parts = (text or "").strip().split(maxsplit=1)
32
+ # 命令名大小写敏感 —— 与后端那一层的匹配同一口径。这里放宽的话,
33
+ # 会出现「先提示一次,然后命令没被当成命令执行」。
34
+ if len(parts) != 2 or parts[0] != "/mode":
35
+ return False
36
+ return parts[1].strip() in _FULL_ACCESS
37
+
38
+
39
+ def model_command(text: str) -> tuple[str, str]:
40
+ """`/model` 的子命令:`("status"|"more"|"set"|"switch"|"", 参数)`。
41
+
42
+ TUI 只拦 `set`(它要弹掩码编辑面板,后端没有输入口);
43
+ 其余原样交给后端 `_cmd_model`,两处不各写一套语义。
44
+ """
45
+ parts = (text or "").strip().split(maxsplit=2)
46
+ if not parts or parts[0] != "/model":
47
+ return "", ""
48
+ if len(parts) == 1:
49
+ return "status", ""
50
+ sub = parts[1]
51
+ if sub == "more":
52
+ return "more", ""
53
+ if sub == "set":
54
+ return "set", (parts[2].strip() if len(parts) > 2 else "")
55
+ return "switch", text.strip().split(maxsplit=1)[1]
56
+
20
57
 
21
58
  def parse_command(text: str) -> tuple[str, str]:
22
59
  """把一行输入分成"本地动作"和"要发出去的话"。
@@ -30,6 +30,12 @@ STEER_DELIVERED = "steer.delivered"
30
30
  LLM_RETRY = "llm.retry"
31
31
  LLM_RETRY_OK = "llm.retry_ok"
32
32
  RECAP = "recap"
33
+ #: 后台记忆动过(抽取写入 / 巩固改动)。两条说的是同一件事:
34
+ #: 用户要知道的是"记忆更新过",不是"哪一道工序"。
35
+ MEMORY_SAVED = "memory.saved"
36
+ MEMORY_ORGANIZED = "memory.organized"
37
+ #: ICE 出站金丝雀被拦下(安全事实)。只在 TUI 画红标 —— GUI 那边不做。
38
+ ICE_CANARY = "ice.canary"
33
39
 
34
40
 
35
41
  @dataclass(frozen=True)