@hfyjq/crannia 1.1.1 → 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 -7523
  39. package/core/allowlist.py +2 -3
  40. package/core/approval.py +36 -26
  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 +15 -15
  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 +3 -3
  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 +37 -28
  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 +369 -77
  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 -1762
  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 +32 -7
  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
@@ -536,25 +536,17 @@ def _http_get_once(url: str, timeout: int = 15, max_bytes=None):
536
536
  def _same_site(a: str, b: str) -> bool:
537
537
  """两个 URL 是不是同一个站(scheme + 端口 + host,host 忽略 `www.` 前缀)。
538
538
 
539
- 判据:protocol 相同、port 相同、剥掉 `www.` 后 hostname 完全相等。
539
+ 判据与实现都在 `core.egress_gate.same_site`(唯一一处)——
540
+ `web_request` 用的是同一个函数,两处各写一份必然漂。
541
+
540
542
  跨 host 的跳转不跟随,而是交回模型
541
543
  —— 模型要重新调一次 `web_fetch`,于是重新走一遍判定。
542
544
 
543
545
  忽略 `www.` 是有代价的取舍:多跟一跳同名站(`example.com` → `www.example.com`
544
546
  很常见),换掉的是大量正常抓取被退回给模型。
545
547
  """
546
- from urllib.parse import urlsplit
547
-
548
- pa, pb = urlsplit(a), urlsplit(b)
549
-
550
- def norm(p):
551
- host = (p.hostname or "").lower()
552
- if host.startswith("www."):
553
- host = host[4:]
554
- port = p.port or (443 if p.scheme == "https" else 80)
555
- return (p.scheme.lower(), host, port)
556
-
557
- return norm(pa) == norm(pb)
548
+ from core.egress_gate import same_site
549
+ return same_site(a, b)
558
550
 
559
551
 
560
552
  #: 单次抓取的内容上限。年报这类文件常见几十 MB(英文版尤其大),
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@hfyjq/crannia",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "Crannia application code pack for automatic updates",
5
- "license": "MIT",
5
+ "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/hfyjq/Crannia.git"
@@ -11,37 +11,29 @@
11
11
  "access": "public"
12
12
  },
13
13
  "crannia": {
14
- "version": "1.1.1",
14
+ "version": "1.2.0",
15
15
  "channel": "stable",
16
- "published_at": "2026-11-22T07:50:57Z",
17
- "release_notes_url": "https://github.com/hfyjq/Crannia/releases/tag/v1.1.1",
16
+ "published_at": "2026-11-28T16:54:08Z",
17
+ "release_notes_url": "https://github.com/hfyjq/Crannia/releases/tag/v1.2.0",
18
18
  "minimum_client_version": null,
19
19
  "mandatory": false,
20
20
  "changelog": {},
21
21
  "artifacts": {
22
22
  "windows-exe": {
23
- "url": "https://gitcode.com/KanocRain/crannia-release/releases/download/v1.1.1/crannia-1.1.1-win-x64.exe",
24
- "sha256": "c8a71066a8d3f0049ff1f93945fc05305414f29b9f7dc56d516bed379e7ab6d9",
25
- "size_bytes": 268383754,
26
- "urls": [
27
- "https://gitcode.com/KanocRain/crannia-release/releases/download/v1.1.1/crannia-1.1.1-win-x64.exe",
28
- "https://github.com/hfyjq/Crannia/releases/download/v1.1.1/crannia-1.1.1-win-x64.exe"
29
- ]
23
+ "url": "https://github.com/hfyjq/Crannia/releases/download/v1.2.0/crannia-1.2.0-win-x64.exe",
24
+ "sha256": "ead2d4e1e33dce2bd75ad159c3cb4f5a8f7fb59bf4cbc6b7a0a794cd4a2cc9ec",
25
+ "size_bytes": 268220335
30
26
  },
31
27
  "codepack": {
32
- "app_version": "1.1.1",
33
- "runtime": "81c9471a1aed5e0ec6716c5447082df39b68aa3c06332dc32d44d0682dd716f6",
34
- "shell_sha256": "1d074d15a82ce4ff31f5d3cf28773d2e0f0e2f592345c584327cad7c2e80b42d",
35
- "shell_sig": "6e22c3fef60a8d0ae55741e5049c50571b8f33925380740d14bc0123d6437c78"
28
+ "app_version": "1.2.0",
29
+ "runtime": "bcce5f46b9fe05ab0d72c75dae96e8dc30fed50163629cfa8ec88160245d528a",
30
+ "shell_sha256": "1d7c703d2a4be4f2e67b0c0ff9e72d703ea9731b9828943b5f81237018337266",
31
+ "shell_sig": "a718700e0a3607882d239c1d30911ac35c2c5e71119fe69784f6f6f10ebe0092"
36
32
  },
37
33
  "tui": {
38
- "url": "https://gitcode.com/KanocRain/crannia-release/releases/download/v1.1.1/crannia-tui-1.1.1-code.zip",
39
- "sha256": "5dd5fd9f72c2578d7ba79215d019793938e46cfbc3aa7e1d2b9a6280ba481df8",
40
- "size_bytes": 5062691,
41
- "urls": [
42
- "https://gitcode.com/KanocRain/crannia-release/releases/download/v1.1.1/crannia-tui-1.1.1-code.zip",
43
- "https://github.com/hfyjq/Crannia/releases/download/v1.1.1/crannia-tui-1.1.1-code.zip"
44
- ]
34
+ "url": "https://github.com/hfyjq/Crannia/releases/download/v1.2.0/crannia-tui-1.2.0-code.zip",
35
+ "sha256": "22db9d849398013a09f819981d90aa9b3921aba9976404ab7be089b8db3cb6e3",
36
+ "size_bytes": 7539293
45
37
  }
46
38
  }
47
39
  }
@@ -57,8 +57,8 @@ def _create_with_retry(client, kwargs):
57
57
  else int(rstate.get("retry") or 0)
58
58
  llm_retry.note(_session_key(), n, kind=kind,
59
59
  text=headline(e, kind=kind), phase=action)
60
- print(f"[llm] {kind or 'unknown'} —— {delay}ms 后重试"
61
- f"({action} {n})")
60
+ print(f"[llm] {kind or 'unknown'} -- retrying in {delay}ms"
61
+ f" ({action} {n})")
62
62
  #: 可打断 —— 用户按了打断就立刻把原异常抛回。
63
63
  if not llm_retry.wait(_session_key(), delay):
64
64
  raise
@@ -113,8 +113,8 @@ def _to_anthropic_content(content):
113
113
  if block is not None:
114
114
  out.append(block)
115
115
  else:
116
- print(f"[anthropic] 认不出的 content 块 type={kind!r} —— "
117
- f"换成一个可见的说明(不静默丢)")
116
+ print(f"[anthropic] unrecognized content block type={kind!r} -- "
117
+ f"replaced with a visible note")
118
118
  out.append({"type": "text",
119
119
  "text": f"[这块内容({kind})Anthropic 这条线不支持]"})
120
120
  # 空列表上游会 400(content 不能是空数组),补一个空文本块。
@@ -134,13 +134,13 @@ def _image_block(part: dict) -> Optional[dict]:
134
134
 
135
135
  url = (part.get("image_url") or {}).get("url") or ""
136
136
  if not url.startswith("data:"):
137
- print(f"[anthropic] 图片块不是一个 data: URL({url[:40]!r})—— "
138
- f"Anthropic 那条路只收内嵌的字节,这一块被丢掉了")
137
+ print(f"[anthropic] image block is not a data: URL ({url[:40]!r}) -- "
138
+ f"dropped")
139
139
  return None
140
140
  head, _, payload = url.partition(",")
141
141
  media = head[5:].split(";")[0].strip().lower() or "image/png"
142
142
  if not payload:
143
- print("[anthropic] 图片块的 data: URL 里没有 payload —— 丢掉了")
143
+ print("[anthropic] image data: URL has no payload -- dropped")
144
144
  return None
145
145
  # 重编码成 base64 一次(`data:` 里本来就是 base64,但别假设 ——
146
146
  # 一个 `;base64,` 都没有的 data URL 是百分号编码的)。
@@ -171,8 +171,7 @@ def _image_block_media(block) -> list:
171
171
  getattr(src, "media_type", "image/png"), src.data),
172
172
  "name": "image",
173
173
  }]
174
- print("[media] 忽略非 base64 的 image 块"
175
- "(url 来源不下载,绕开出网闸)")
174
+ print("[media] ignoring non-base64 image block")
176
175
  return []
177
176
 
178
177
 
@@ -288,8 +287,8 @@ class AnthropicProvider(BaseProvider):
288
287
  self.supports_vision = bool(supports_vision)
289
288
  # 这条路没有音频部件 —— 永远 False,声明了也要出声。
290
289
  if supports_audio:
291
- print("[anthropic] config 声明了 supports_audio,但这条线没有音频部件 "
292
- "—— 仍按不支持处理(语音会以可见说明的形式交给模型)")
290
+ print("[anthropic] config declares supports_audio but this path has no audio parts "
291
+ "-- treating as unsupported")
293
292
  self.supports_audio = False
294
293
  self._temperature = temperature
295
294
  self._max_tokens = max_tokens
@@ -359,11 +358,11 @@ class AnthropicProvider(BaseProvider):
359
358
  return
360
359
  self._window_claim_warned = True
361
360
  print(
362
- f"[window] prompt={prompt_tokens:,} 已超过声明窗口 "
363
- f"{self._context_window:,} —— 声明值错了"
364
- f"(来源={self._window_source},model={self._model})。"
365
- f"压缩闸门按声明值算({int(self._context_window * 0.85):,}),"
366
- f"会永远够不着。"
361
+ f"[window] prompt={prompt_tokens:,} exceeds declared window "
362
+ f"{self._context_window:,} -- declared value is wrong"
363
+ f" (source={self._window_source}, model={self._model})."
364
+ f" compression gate uses the declared value"
365
+ f" ({int(self._context_window * 0.85):,})"
367
366
  )
368
367
 
369
368
  # ------------------------------------------------------------------
@@ -435,23 +434,21 @@ class AnthropicProvider(BaseProvider):
435
434
  budget = 0
436
435
  if self._thinking_budget > 0 and not self._tier_supersede_warned:
437
436
  self._tier_supersede_warned = True
438
- print(f"[thinking] 投入档这一档是「不思考」—— config.yaml 的 "
439
- f"anthropic.thinking_budget={self._thinking_budget} 被它取代"
440
- f"(档位是唯一来源)")
437
+ print(f"[thinking] effort tier disables thinking -- config.yaml "
438
+ f"anthropic.thinking_budget={self._thinking_budget} superseded")
441
439
  if budget <= 0:
442
440
  return {}
443
441
  if budget < _MIN_THINKING_BUDGET:
444
- print(f"[thinking] 预算 {budget} 低于 Anthropic 的下限 "
445
- f"{_MIN_THINKING_BUDGET} —— 按 {_MIN_THINKING_BUDGET} 发")
442
+ print(f"[thinking] budget {budget} below Anthropic minimum "
443
+ f"{_MIN_THINKING_BUDGET} -- sending {_MIN_THINKING_BUDGET}")
446
444
  budget = _MIN_THINKING_BUDGET
447
445
  if budget >= self._max_tokens:
448
446
  if self._max_tokens <= _MIN_THINKING_BUDGET:
449
- print(f"[thinking] max_tokens={self._max_tokens} 容不下思考预算 "
450
- f"(要 >{_MIN_THINKING_BUDGET})—— 这一次**不带思考**"
451
- f"(硬发会被上游 400,整轮都没了)")
447
+ print(f"[thinking] max_tokens={self._max_tokens} cannot fit thinking budget "
448
+ f"(needs >{_MIN_THINKING_BUDGET}) -- omitting thinking this time")
452
449
  return {}
453
- print(f"[thinking] 预算 {budget} >= max_tokens {self._max_tokens} "
454
- f"—— 夹到 {self._max_tokens - 1}(上游硬约束)")
450
+ print(f"[thinking] budget {budget} >= max_tokens {self._max_tokens} "
451
+ f"-- clamped to {self._max_tokens - 1}")
455
452
  budget = self._max_tokens - 1
456
453
  return {"thinking": {"type": "enabled", "budget_tokens": budget}}
457
454
 
@@ -464,6 +461,9 @@ class AnthropicProvider(BaseProvider):
464
461
  temperature: "float | None" = None,
465
462
  ) -> ChatResponse:
466
463
  """向 Claude 发一条同步消息。"""
464
+ from core import model_profiles as _profiles
465
+ messages = _profiles.sanitize_for_wire(
466
+ messages, self._provider_name, self._model)
467
467
  system_prompt, api_messages = self._to_anthropic_messages(
468
468
  messages, system=system
469
469
  )
@@ -569,6 +569,9 @@ class AnthropicProvider(BaseProvider):
569
569
  temperature: "float | None" = None,
570
570
  ) -> AsyncIterator[StreamChunk]:
571
571
  """流式接收 Claude 的回复。"""
572
+ from core import model_profiles as _profiles
573
+ messages = _profiles.sanitize_for_wire(
574
+ messages, self._provider_name, self._model)
572
575
  system_prompt, api_messages = self._to_anthropic_messages(
573
576
  messages, system=system
574
577
  )
@@ -619,8 +622,8 @@ class AnthropicProvider(BaseProvider):
619
622
  else int(rstate.get("retry") or 0)
620
623
  llm_retry.note(_session_key(), n, kind=kind,
621
624
  text=headline(e, kind=kind), phase=action)
622
- print(f"[llm] {kind or 'unknown'} —— {delay}ms 后重试"
623
- f"({action} {n})")
625
+ print(f"[llm] {kind or 'unknown'} -- retrying in {delay}ms"
626
+ f" ({action} {n})")
624
627
  #: 可打断(同 OpenAI 兼容那条)。
625
628
  if not await llm_retry.wait_async(_session_key(), delay):
626
629
  llm_retry.clear(_session_key())
@@ -629,8 +632,8 @@ class AnthropicProvider(BaseProvider):
629
632
  continue
630
633
  #: 与 OpenAI 兼容那条同一条诊断口径 —— 错误类别跟着 chunk 走
631
634
  #: (用户面 `core/llm_errors.explain` 要用),并且出声。
632
- print(f"[llm] 流式失败({type(e).__name__}: {str(e)[:200]})"
633
- f" —— model={self._model}")
635
+ print(f"[llm] stream failed ({type(e).__name__}: {str(e)[:200]})"
636
+ f" -- model={self._model}")
634
637
  llm_retry.fail(_session_key(), kind=kind,
635
638
  text=headline(e, kind=kind))
636
639
  yield StreamChunk(
@@ -727,9 +730,8 @@ class AnthropicProvider(BaseProvider):
727
730
  args = json.loads(raw_args)
728
731
  except (json.JSONDecodeError, TypeError) as exc:
729
732
  args = {}
730
- print(f"[anthropic] 历史里 '{name}' 的 arguments 不是合法 "
731
- f"JSON({type(exc).__name__}: {exc})—— 按无参回填"
732
- f"(历史本身不动)")
733
+ print(f"[anthropic] arguments for '{name}' in history are not valid "
734
+ f"JSON ({type(exc).__name__}: {exc}) -- backfilled with no args")
733
735
  tool_blocks.append({
734
736
  "type": "tool_use",
735
737
  "id": tc.get("id", ""),
package/providers/base.py CHANGED
@@ -163,7 +163,7 @@ def _load_cost_table() -> tuple[dict, dict]:
163
163
  if isinstance(row, dict):
164
164
  lookup[(str(prov), str(name))] = row
165
165
  except Exception as exc: # noqa: BLE001 —— 见上:坏掉只是"一律未定价"
166
- print(f"[cost] 价格表读不了(一律按未定价处理):{type(exc).__name__}: {exc}")
166
+ print(f"[cost] failed to read price table (treating all as unpriced): {type(exc).__name__}: {exc}")
167
167
  table, lookup = {}, {}
168
168
  _cost_table, _cost_lookup = table, lookup
169
169
  return table, lookup
@@ -291,20 +291,20 @@ def record_token_usage(prompt: int, completion: int,
291
291
  calls = _token_counter["api_calls"]
292
292
  if not _cache_probe_done and cache_hit is not None:
293
293
  _cache_probe_done = True
294
- print(f"[cache] 上游报了缓存字段:本次命中 {cache_hit} / 输入 {prompt}"
295
- f" —— 命中率指标可用")
294
+ print(f"[cache] upstream reported cache fields: this hit {cache_hit} / input {prompt}"
295
+ f" -- hit-rate metric available")
296
296
  if calls % _CACHE_REPORT_EVERY == 0:
297
297
  _rp = _token_counter["cache_reported_prompt_tokens"]
298
298
  if _rp > 0:
299
299
  _ht = _token_counter["cache_hit_tokens"]
300
- print(f"[cache] 第 {calls} 次调用 · 本次输入 {prompt:,} · 累计命中 "
300
+ print(f"[cache] call #{calls} · this input {prompt:,} · cumulative hit "
301
301
  f"{_ht:,}/{_rp:,} = {_ht / _rp:.1%}"
302
- f"({_token_counter['cache_reported_calls']}/{calls} 次上游报了)")
302
+ f" ({_token_counter['cache_reported_calls']}/{calls} calls reported)")
303
303
  else:
304
- print(f"[cache] 第 {calls} 次调用 · 本次输入 {prompt:,} · 上游一次都没报缓存字段"
305
- "(prompt_tokens_details.cached_tokens / prompt_cache_hit_tokens /"
306
- " cache_read_input_tokens 三个都没有)"
307
- " ⇒ 这个 provider 量不到命中率,**不是命中 0**")
304
+ print(f"[cache] call #{calls} · this input {prompt:,} · upstream never reported cache fields"
305
+ " (none of prompt_tokens_details.cached_tokens / prompt_cache_hit_tokens /"
306
+ " cache_read_input_tokens)"
307
+ " -> this provider cannot measure hit rate, NOT a hit of 0")
308
308
 
309
309
  if _token_counter_started == 0.0:
310
310
  _token_counter_started = time.time()
@@ -746,10 +746,10 @@ def log_context_overflow(model: str, err: object, *, where: str = "") -> None:
746
746
  与 `[cache]` / `[calibrator]` 同款,走 `print`,只到 stdout
747
747
  (落盘属于另一层的工作,不在这里顺手做)。
748
748
  """
749
- print(f"[overflow] 上游报「请求超长」(model={model}"
750
- f"{', ' + where if where else ''})—— "
751
- f"**重试 / 换 key 对它无效**(不是权限也不是限流),需要压缩或裁剪。"
752
- f" 原文: {str(err)[:300]}")
749
+ print(f"[overflow] upstream reports request too long (model={model}"
750
+ f"{', ' + where if where else ''}) -- "
751
+ f"retry / switch key will not help, need compression or trimming."
752
+ f" raw: {str(err)[:300]}")
753
753
 
754
754
 
755
755
  def _reply_side_tokens(m: dict, count_tokens) -> int:
@@ -0,0 +1,294 @@
1
+ {
2
+ "schema": 2,
3
+ "fetched": "2026-11-24",
4
+ "source": "official provider docs, see 电脑接管-性能考察-2026-11-24.md 12/13/16",
5
+ "note": "缓存与回收策略。16 家 provider 全部列出(含端配置里没有单独卡片、归到「其他」那几类),未查实的数字一律不填、在 note 里写明缺口,不按相似厂商推断。端配置的「其他」卡映射到 openai 目录,所以走 openai 那行;但它的上游可能是任意中转,缓存是否命中要用 usage 读数验证,读不到就写「没量到」。模型级覆盖优先于 provider 行,config.yaml 的显式声明优先于整张表。",
6
+ "_default": {
7
+ "strategy": "unknown",
8
+ "cache_mode": "unknown",
9
+ "cache_format": "none",
10
+ "explicit_enabled": false,
11
+ "eviction": "batch",
12
+ "batch_every": 25,
13
+ "keep_images": 3,
14
+ "max_inline_images": 12,
15
+ "min_prefix_tokens": 0,
16
+ "max_breakpoints": 0,
17
+ "ttl_seconds": 0,
18
+ "lookback_blocks": 0,
19
+ "tools_must_be_stable": false,
20
+ "note": "没有单独策略的供应商按现状做批量淘汰(最近 3 张图受保护、25 次观察边界、12 张硬上限),不加任何标记。保守之处:缺关掉客户端淘汰的能力位,那一族模型可能有害。"
21
+ },
22
+ "anthropic": {
23
+ "strategy": "explicit_blocks",
24
+ "cache_mode": "explicit",
25
+ "cache_format": "anthropic",
26
+ "explicit_enabled": false,
27
+ "eviction": "batch",
28
+ "batch_every": 25,
29
+ "keep_images": 3,
30
+ "max_inline_images": 12,
31
+ "min_prefix_tokens": 1024,
32
+ "min_prefix_by_model": {
33
+ "claude-fable-5": 512,
34
+ "claude-mythos-5": 512,
35
+ "claude-opus-5-5": 512,
36
+ "claude-sonnet-5-5": 512,
37
+ "claude-haiku-5-5": 512,
38
+ "claude-mythos-preview": 2048,
39
+ "claude-opus-4-7": 2048,
40
+ "claude-opus-4-6": 4096,
41
+ "claude-opus-4-5": 4096,
42
+ "claude-haiku-4-5": 4096,
43
+ "claude-opus-4-8": 1024,
44
+ "claude-sonnet-5": 1024,
45
+ "claude-sonnet-4-6": 1024,
46
+ "claude-sonnet-4-5": 1024
47
+ },
48
+ "max_breakpoints": 4,
49
+ "ttl_seconds": 300,
50
+ "lookback_blocks": 20,
51
+ "tools_must_be_stable": true,
52
+ "note": "缓存层级 tools → system → messages,改一层则该层及之后全失效。最小前缀按模型分四档,逐条列在 min_prefix_by_model,匹配不到的用 min_prefix_tokens 兜底、不猜。ttl 300 是默认 ephemeral,另有付费 1 小时档未启用。thinking 块不能单独打点。"
53
+ },
54
+ "openai": {
55
+ "strategy": "implicit",
56
+ "cache_mode": "implicit",
57
+ "cache_format": "openai_native",
58
+ "explicit_enabled": false,
59
+ "eviction": "batch",
60
+ "batch_every": 25,
61
+ "keep_images": 3,
62
+ "max_inline_images": 12,
63
+ "min_prefix_tokens": 2048,
64
+ "max_breakpoints": 4,
65
+ "ttl_seconds": 1800,
66
+ "lookback_blocks": 50,
67
+ "tools_must_be_stable": true,
68
+ "note": "支持的模型默认开缓存。旧模型隐式、最小 2048 token;新代际可用 prompt_cache_options 切显式、最小 1024 token,这里保守取 2048。字段是 prompt_cache_key / prompt_cache_breakpoint / prompt_cache_options,不是 cache_control。工具定义参与缓存,改了就断。ttl 1800 是新代际默认值,老模型另有 in_memory / 24h 两档。端配置的「其他」卡也走这一行,但上游可能不是 OpenAI,命中必须看 usage。"
69
+ },
70
+ "azure": {
71
+ "strategy": "implicit",
72
+ "cache_mode": "implicit",
73
+ "cache_format": "openai_native",
74
+ "explicit_enabled": false,
75
+ "eviction": "batch",
76
+ "batch_every": 25,
77
+ "keep_images": 3,
78
+ "max_inline_images": 12,
79
+ "min_prefix_tokens": 1024,
80
+ "max_breakpoints": 3,
81
+ "ttl_seconds": 1800,
82
+ "lookback_blocks": 50,
83
+ "tools_must_be_stable": true,
84
+ "note": "与 OpenAI 同族但数字不同:最小 1024 token 且开头 1024 必须逐字相同;隐式模式下最新消息占一个写入槽,所以显式断点只剩 3 个。新代际可用 prompt_cache_options 切显式。工具定义明确参与缓存。"
85
+ },
86
+ "deepseek": {
87
+ "strategy": "implicit",
88
+ "cache_mode": "implicit",
89
+ "cache_format": "none",
90
+ "explicit_enabled": false,
91
+ "eviction": "batch",
92
+ "batch_every": 25,
93
+ "keep_images": 3,
94
+ "max_inline_images": 12,
95
+ "min_prefix_tokens": 0,
96
+ "max_breakpoints": 0,
97
+ "ttl_seconds": 0,
98
+ "lookback_blocks": 0,
99
+ "tools_must_be_stable": false,
100
+ "note": "自动前缀缓存、无开关,wire 不加任何标记。官方没有给统一的最小可缓存 token 数,第三方那个很小的存储单位证据不足,所以不填数字、不拿它做闸门。缓存命中与未命中价差很大,分高峰与非高峰。"
101
+ },
102
+ "qwen": {
103
+ "strategy": "explicit_blocks",
104
+ "cache_mode": "mutually_exclusive",
105
+ "cache_format": "alibaba",
106
+ "explicit_enabled": false,
107
+ "eviction": "batch",
108
+ "batch_every": 25,
109
+ "keep_images": 3,
110
+ "max_inline_images": 12,
111
+ "min_prefix_tokens": 1024,
112
+ "max_breakpoints": 4,
113
+ "ttl_seconds": 300,
114
+ "lookback_blocks": 20,
115
+ "tools_must_be_stable": true,
116
+ "note": "隐式恒开且关不掉,显式要标记,两者在同一个请求里互斥。先 explicit_enabled=false 走隐式零风险,等 wire 测试证明兼容层能透传块键再开。显式规则:最小 1024 token、最多 4 个 ephemeral 标记、5 分钟命中刷新、从后向前只回溯 20 个 content 块。工具定义不能独立打点,且 tools 的顺序、字段顺序、字段结构必须逐次一致。并行 tool 调用建议合并成一条消息的多个 content 块。"
117
+ },
118
+ "zhipu": {
119
+ "strategy": "implicit",
120
+ "cache_mode": "implicit",
121
+ "cache_format": "none",
122
+ "explicit_enabled": false,
123
+ "eviction": "batch",
124
+ "batch_every": 25,
125
+ "keep_images": 3,
126
+ "max_inline_images": 12,
127
+ "min_prefix_tokens": 512,
128
+ "max_breakpoints": 0,
129
+ "ttl_seconds": 0,
130
+ "lookback_blocks": 0,
131
+ "tools_must_be_stable": false,
132
+ "note": "自动缓存、无需配置,重复前缀建议 500 token 以上;公开文档的部署说明给 GLM 的隐式最小前缀是 512,取 512。TTL 未公开,不依赖缓存时效,只靠批量淘汰降低断前缀频率。"
133
+ },
134
+ "moonshot": {
135
+ "strategy": "implicit",
136
+ "cache_mode": "implicit",
137
+ "cache_format": "none",
138
+ "explicit_enabled": false,
139
+ "eviction": "batch",
140
+ "batch_every": 25,
141
+ "keep_images": 3,
142
+ "max_inline_images": 12,
143
+ "min_prefix_tokens": 0,
144
+ "max_breakpoints": 0,
145
+ "ttl_seconds": 300,
146
+ "lookback_blocks": 0,
147
+ "tools_must_be_stable": false,
148
+ "note": "只有隐式。默认 5 分钟档,另有 1 小时档且首次写入后锁定。显式断点会被拒(HTTP 400),所以 max_breakpoints=0,不要尝试打点。工具定义明确列入可缓存内容。最小可缓存长度只说「小于一个完整 block 无法写入」,block 大小未公开,所以不填数字。"
149
+ },
150
+ "gemini": {
151
+ "strategy": "implicit",
152
+ "cache_mode": "implicit",
153
+ "cache_format": "cached_content",
154
+ "explicit_enabled": false,
155
+ "eviction": "batch",
156
+ "batch_every": 25,
157
+ "keep_images": 3,
158
+ "max_inline_images": 12,
159
+ "min_prefix_tokens": 4096,
160
+ "max_breakpoints": 1,
161
+ "ttl_seconds": 3600,
162
+ "lookback_blocks": 0,
163
+ "tools_must_be_stable": true,
164
+ "note": "2.5 及更新模型隐式缓存默认开、没有关闭开关。显式缓存用单个 cached_content 引用(每请求一个),Beta 能力且部分新代际不支持,所以 explicit_enabled=false。最小前缀:2.5 那代 2048,3.x 及以后 4096,取更保守的 4096。TTL 默认 1 小时。工具定义参与缓存。图像按固定分块计 token,没有长边硬上限。"
165
+ },
166
+ "grok": {
167
+ "strategy": "routing_key",
168
+ "cache_mode": "implicit",
169
+ "cache_format": "routing_only",
170
+ "explicit_enabled": false,
171
+ "eviction": "batch",
172
+ "batch_every": 25,
173
+ "keep_images": 3,
174
+ "max_inline_images": 12,
175
+ "min_prefix_tokens": 0,
176
+ "max_breakpoints": 0,
177
+ "ttl_seconds": 0,
178
+ "lookback_blocks": 0,
179
+ "tools_must_be_stable": false,
180
+ "note": "自动缓存、不可关闭,官方明确说命中不保证(可能被挤出、可能路由到不同服务器)。只提供把请求路由到同一服务器的键(会话头或请求体字段),没有断点概念。最小 token、TTL、工具定义是否参与都没找到官方口径,一律不填。"
181
+ },
182
+ "minimax": {
183
+ "strategy": "implicit",
184
+ "cache_mode": "implicit",
185
+ "cache_format": "none",
186
+ "explicit_enabled": false,
187
+ "eviction": "batch",
188
+ "batch_every": 25,
189
+ "keep_images": 3,
190
+ "max_inline_images": 12,
191
+ "min_prefix_tokens": 0,
192
+ "max_breakpoints": 0,
193
+ "ttl_seconds": 0,
194
+ "lookback_blocks": 0,
195
+ "tools_must_be_stable": false,
196
+ "note": "官方写全自动缓存、无需配置;兼容接口的参数表里没有缓存标记字段。最小 token、TTL 未公开,不填数字。"
197
+ },
198
+ "hunyuan": {
199
+ "strategy": "routing_key",
200
+ "cache_mode": "implicit",
201
+ "cache_format": "routing_only",
202
+ "explicit_enabled": false,
203
+ "eviction": "batch",
204
+ "batch_every": 25,
205
+ "keep_images": 3,
206
+ "max_inline_images": 12,
207
+ "min_prefix_tokens": 0,
208
+ "max_breakpoints": 0,
209
+ "ttl_seconds": 0,
210
+ "lookback_blocks": 0,
211
+ "tools_must_be_stable": false,
212
+ "note": "隐式 KV Cache,没有显式缓存对象。有两个用于复用缓存的标识:请求体里的缓存键与会话头。TTL 机制存在但官方没给秒数;最小可缓存长度、能否关闭都没找到口径。接入指南提到系统提示词与工具定义的排列会影响命中,但没有独立标记。"
213
+ },
214
+ "volcengine": {
215
+ "strategy": "unknown",
216
+ "cache_mode": "unknown",
217
+ "cache_format": "none",
218
+ "explicit_enabled": false,
219
+ "eviction": "batch",
220
+ "batch_every": 25,
221
+ "keep_images": 3,
222
+ "max_inline_images": 12,
223
+ "min_prefix_tokens": 0,
224
+ "max_breakpoints": 0,
225
+ "ttl_seconds": 0,
226
+ "lookback_blocks": 0,
227
+ "tools_must_be_stable": false,
228
+ "note": "官方按模型区分隐式与显式缓存,另有旧版上下文缓存接口(待下线,且不支持 tools)。最小 token、TTL、显式标记字段名都没找到公开数字,所以不猜策略,落 unknown。命中与否只能用 usage 读数判断。"
229
+ },
230
+ "siliconflow": {
231
+ "strategy": "unknown",
232
+ "cache_mode": "unknown",
233
+ "cache_format": "none",
234
+ "explicit_enabled": false,
235
+ "eviction": "batch",
236
+ "batch_every": 25,
237
+ "keep_images": 3,
238
+ "max_inline_images": 12,
239
+ "min_prefix_tokens": 0,
240
+ "max_breakpoints": 0,
241
+ "ttl_seconds": 0,
242
+ "lookback_blocks": 0,
243
+ "tools_must_be_stable": false,
244
+ "note": "聚合平台,按缓存命中计费,说明隐式缓存存在。但没有公开是否透传上游的缓存标记,也没有最小 token、TTL 口径,所以落 unknown,不加任何标记。图像尺寸随底层模型差异很大,图预算表里单独写。"
245
+ },
246
+ "openrouter": {
247
+ "strategy": "routing_key",
248
+ "cache_mode": "implicit",
249
+ "cache_format": "none",
250
+ "explicit_enabled": false,
251
+ "eviction": "batch",
252
+ "batch_every": 25,
253
+ "keep_images": 3,
254
+ "max_inline_images": 12,
255
+ "min_prefix_tokens": 0,
256
+ "max_breakpoints": 0,
257
+ "ttl_seconds": 0,
258
+ "lookback_blocks": 0,
259
+ "tools_must_be_stable": false,
260
+ "note": "聚合平台,规则随底层模型。有会话键做粘性路由,空闲 60 分钟过期;会把某家的缓存标记翻译成另一家的形状,但 TTL 不翻译。最小 token 与 TTL 全部随底层,这里不填数字、不加标记。"
261
+ },
262
+ "ollama": {
263
+ "strategy": "implicit",
264
+ "cache_mode": "implicit",
265
+ "cache_format": "none",
266
+ "explicit_enabled": false,
267
+ "eviction": "batch",
268
+ "batch_every": 25,
269
+ "keep_images": 3,
270
+ "max_inline_images": 12,
271
+ "min_prefix_tokens": 0,
272
+ "max_breakpoints": 0,
273
+ "ttl_seconds": 0,
274
+ "lookback_blocks": 0,
275
+ "tools_must_be_stable": false,
276
+ "note": "本地运行时,服务端自动做前缀缓存,但没有可打的标记;兼容接口明确不支持缓存块。上下文窗口默认值有两套公开说法(固定 4096,或按显存给更大),本表不改窗口决议,只说明这里没有缓存策略可调。"
277
+ },
278
+ "lmstudio": {
279
+ "strategy": "implicit",
280
+ "cache_mode": "implicit",
281
+ "cache_format": "none",
282
+ "explicit_enabled": false,
283
+ "eviction": "batch",
284
+ "batch_every": 25,
285
+ "keep_images": 3,
286
+ "max_inline_images": 12,
287
+ "min_prefix_tokens": 0,
288
+ "max_breakpoints": 0,
289
+ "ttl_seconds": 0,
290
+ "lookback_blocks": 0,
291
+ "tools_must_be_stable": false,
292
+ "note": "本地运行时,token 缓存默认开且总在响应里报数,用上一次响应 id 复用。最小 token、TTL 未公开,不填数字、不打标记。图像输入默认长边 2048,可在设置里改,图预算表里按这个默认值写。"
293
+ }
294
+ }