coderouter-cli 1.8.1__py3-none-any.whl → 1.8.2__py3-none-any.whl

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.
@@ -176,47 +176,59 @@ rules:
176
176
  # 「Claude Code 代替として最高」「local champ」と評価されている。
177
177
  #
178
178
  # ただし v1.8.0 までで `claude_code_suitability: ok` を declare していた
179
- # のは note 記事の伝聞ベースの先回り宣言で、v1.8.1 (2026-04-26)
180
- # 実機検証 (M3 Max 32GB / Ollama 0.21.2) で次の課題が判明:
181
- # - num_ctx declare 32768 しても Ollama 側で silent に縮められる
182
- # (canary echo-back probe 失敗)
179
+ # のは note 記事の伝聞ベースの先回り宣言で、v1.8.1 v1.8.2
180
+ # (2026-04-26) の実機検証 (M3 Max 64GB / Ollama 0.21.2) で:
181
+ # - num_ctx streaming NEEDS_TUNING v1.8.2 thinking モデル
182
+ # probe バジェット拡大により偽陽性と判明 (doctor 側の課題)
183
183
  # - tool_calls probe が native tool_calls / 修復可能 JSON のいずれも
184
- # 返さず NEEDS_TUNING
185
- # - streaming probe finish_reason='length' で 0 chars 打ち切り
186
- # これらは Ollama 経由特有の問題で、HF / vLLM 直接ロードなら違う可能性。
187
- # 確証ない以上、`claude_code_suitability` は撤回し `tools` 宣言だけ残す。
184
+ # 返さない真の課題が残る (Qwen3.6 系の Ollama 経由 tool 仕様未成熟)
185
+ # tool_calls 不全が解消されるまで `claude_code_suitability` は撤回。
188
186
  # 実機で動いたユーザーは `~/.coderouter/model-capabilities.yaml` で
189
187
  # `claude_code_suitability: ok` を上書きできる。
190
188
  # ------------------------------------------------------------------
191
189
 
190
+ # v1.8.2: thinking: true は doctor probe (num_ctx / streaming) が reasoning
191
+ # トークン消費分の max_tokens 余裕を確保するためのヒント。Qwen3 系は
192
+ # /think モードで thinking トークンを吐く設計なので true 宣言。
192
193
  - match: "qwen3.6:*"
193
194
  kind: openai_compat
194
195
  capabilities:
195
196
  tools: true
197
+ thinking: true
196
198
 
197
199
  - match: "qwen/qwen3.6-*"
198
200
  kind: openai_compat
199
201
  capabilities:
200
202
  tools: true
203
+ thinking: true
201
204
 
202
205
  # ------------------------------------------------------------------
203
- # Gemma 4 family (v1.7-B 追加)
206
+ # Gemma 4 family (v1.7-B 追加、v1.8.2 で thinking: true 宣言)
204
207
  #
205
208
  # Google 公式 Gemma 4。Ollama 公式 tag は gemma4:e2b / e4b / 26b / 31b、
206
209
  # 全 variant が tools+vision+thinking 対応、E2B/E4B は audio もサポート。
207
210
  # MoE (26b は active 3.8B / total 25.2B)。note 記事で「日常・バランスの
208
211
  # 王者」と評価。Claude Haiku 互換性に近い簡潔な応答スタイル。
212
+ #
213
+ # v1.8.2 (2026-04-26): 実機検証 (M3 Max 64GB / Ollama 0.21.2 / gemma4:26b)
214
+ # で `reasoning` フィールドにかなりの量のトークンを吐く thinking モデル
215
+ # と確認。doctor probe の max_tokens=32 / 128 が thinking トークンに
216
+ # 食い切られて偽陽性 NEEDS_TUNING を出していた。registry で
217
+ # `thinking: true` を宣言すると doctor が probe バジェットを 1024 まで
218
+ # 引き上げて偽陽性を回避する。
209
219
  # ------------------------------------------------------------------
210
220
 
211
221
  - match: "gemma4:*"
212
222
  kind: openai_compat
213
223
  capabilities:
214
224
  tools: true
225
+ thinking: true
215
226
 
216
227
  - match: "google/gemma-4*"
217
228
  kind: openai_compat
218
229
  capabilities:
219
230
  tools: true
231
+ thinking: true
220
232
 
221
233
  # ------------------------------------------------------------------
222
234
  # GLM family (Z.AI / Zhipu AI、v1.7-B 追加)
coderouter/doctor.py CHANGED
@@ -433,6 +433,31 @@ _STREAMING_PROBE_USER_PROMPT = (
433
433
  # truncated". "1\n2\n...\n30" is ~80 chars; 40 chars covers the halfway
434
434
  # mark (1..20) which is already obviously-truncated territory.
435
435
  _STREAMING_PROBE_MIN_EXPECTED_CHARS = 40
436
+
437
+ # v1.8.2: probe response budgets.
438
+ #
439
+ # Both num_ctx and streaming probes ask the model for a *short* answer
440
+ # (the canary token / "1..30"). The original budgets (32 / 128 tokens)
441
+ # assumed a non-thinking model that emits the answer immediately. On a
442
+ # thinking model — Gemma 4 26B, Qwen3.6, gpt-oss, deepseek-r1 — the
443
+ # upstream burns the entire budget on a hidden ``reasoning`` field
444
+ # *before* emitting any visible ``content``, producing a false-positive
445
+ # NEEDS_TUNING (canary missing / 0 chars streamed). Bumping the budget
446
+ # is the cleanest fix: non-thinking models stop early at their natural
447
+ # stop token (no waste), thinking models get headroom for the reasoning
448
+ # trace plus the actual answer.
449
+ #
450
+ # Numbers picked from the v1.8.1 reality-check session
451
+ # (docs/articles/note-v1-8-1-reality-check.md):
452
+ # * Gemma 4 26B reasoning prefix observed at ~150-300 tokens before
453
+ # content starts → 1024 covers reasoning + 30-line count comfortably.
454
+ # * Non-thinking baseline kept conservative-but-non-tight (256/512) to
455
+ # absorb stylistic preambles ("Sure, the answer is...") without
456
+ # burning extra cloud quota when the operator probes a paid endpoint.
457
+ _NUM_CTX_PROBE_MAX_TOKENS_DEFAULT = 256
458
+ _NUM_CTX_PROBE_MAX_TOKENS_THINKING = 1024
459
+ _STREAMING_PROBE_MAX_TOKENS_DEFAULT = 512
460
+ _STREAMING_PROBE_MAX_TOKENS_THINKING = 1024
436
461
  # Default ``num_predict`` suggested in the emitted patch. -1 would be
437
462
  # optimal (uncapped) but "4096" communicates intent more clearly to
438
463
  # operators unfamiliar with Ollama's sentinel value, and covers Claude
@@ -475,6 +500,42 @@ def _declared_num_ctx(provider: ProviderConfig) -> int | None:
475
500
  return val if isinstance(val, int) else None
476
501
 
477
502
 
503
+ def _is_reasoning_model(
504
+ provider: ProviderConfig, resolved: ResolvedCapabilities
505
+ ) -> bool:
506
+ """v1.8.2: True iff the model is known to emit a hidden reasoning trace.
507
+
508
+ Thinking models (Gemma 4, Qwen3-with-/think, gpt-oss, deepseek-r1,
509
+ Claude Sonnet 4.5+ in extended-thinking mode) burn output tokens on a
510
+ ``reasoning`` field before any visible ``content`` is produced. The
511
+ num_ctx / streaming probes use small response budgets that get fully
512
+ consumed by the reasoning prefix, producing a false-positive
513
+ NEEDS_TUNING. Callers use this to choose a generous probe budget.
514
+
515
+ Three signals fire:
516
+ * provider declared ``capabilities.thinking: true`` in providers.yaml
517
+ * provider declared ``capabilities.reasoning_passthrough: true``
518
+ (the operator opted in to passing the raw reasoning to the client,
519
+ which is only meaningful for models that emit it)
520
+ * registry resolved ``thinking: true`` for this (kind, model) pair
521
+
522
+ Conservative bias — when both provider declaration and registry are
523
+ silent, treat as non-reasoning. The probe still completes for thinking
524
+ models in that case (they just hit ``finish_reason='length'`` like
525
+ they did pre-v1.8.2), but at least the new generous default budget
526
+ (256 / 512) gives more headroom than the old 32 / 128.
527
+ """
528
+ if provider.capabilities.thinking is True:
529
+ return True
530
+ if provider.capabilities.reasoning_passthrough is True:
531
+ return True
532
+ if resolved.thinking is True:
533
+ return True
534
+ if resolved.reasoning_passthrough is True:
535
+ return True
536
+ return False
537
+
538
+
478
539
  _PROBE_BASIC_USER_PROMPT = "Reply with exactly the single word: PONG"
479
540
  _PROBE_TOOLS_USER_PROMPT = (
480
541
  "You have one tool named `echo`. Call it with the argument "
@@ -617,7 +678,9 @@ def _extract_openai_assistant_choice(
617
678
  return msg if isinstance(msg, dict) else None
618
679
 
619
680
 
620
- async def _probe_num_ctx(provider: ProviderConfig) -> ProbeResult:
681
+ async def _probe_num_ctx(
682
+ provider: ProviderConfig, resolved: ResolvedCapabilities
683
+ ) -> ProbeResult:
621
684
  """v1.0-B Probe — direct detection of Ollama ``num_ctx`` truncation.
622
685
 
623
686
  Addresses plan.md §9.4 symptom #1 (空応答 / 意味不明応答). Prior to
@@ -683,11 +746,21 @@ async def _probe_num_ctx(provider: ProviderConfig) -> ProbeResult:
683
746
  # whatever ``options.num_ctx`` the operator has declared. Request
684
747
  # fields win over extra_body, matching the adapter's merge order.
685
748
  body: dict[str, Any] = dict(provider.extra_body)
749
+ # v1.8.2: thinking models burn output tokens on a hidden ``reasoning``
750
+ # trace before emitting any ``content``. The pre-v1.8.2 default of 32
751
+ # was tight for any preamble at all; on Gemma 4 26B it caused
752
+ # ``finish_reason='length'`` with content="" before the canary could
753
+ # surface, producing a false-positive NEEDS_TUNING.
754
+ max_tokens = (
755
+ _NUM_CTX_PROBE_MAX_TOKENS_THINKING
756
+ if _is_reasoning_model(provider, resolved)
757
+ else _NUM_CTX_PROBE_MAX_TOKENS_DEFAULT
758
+ )
686
759
  body.update(
687
760
  {
688
761
  "model": provider.model,
689
762
  "messages": [{"role": "user", "content": user_prompt}],
690
- "max_tokens": 32,
763
+ "max_tokens": max_tokens,
691
764
  "temperature": 0,
692
765
  }
693
766
  )
@@ -799,7 +872,9 @@ async def _probe_num_ctx(provider: ProviderConfig) -> ProbeResult:
799
872
  )
800
873
 
801
874
 
802
- async def _probe_streaming(provider: ProviderConfig) -> ProbeResult:
875
+ async def _probe_streaming(
876
+ provider: ProviderConfig, resolved: ResolvedCapabilities
877
+ ) -> ProbeResult:
803
878
  """v1.0-C Probe — streaming completion path integrity.
804
879
 
805
880
  Addresses plan.md §9.4 symptom #1 from the **output** side. The v1.0-B
@@ -868,11 +943,18 @@ async def _probe_streaming(provider: ProviderConfig) -> ProbeResult:
868
943
  # probing. Top-level probe fields win on collision, matching adapter
869
944
  # merge order.
870
945
  body: dict[str, Any] = dict(provider.extra_body)
946
+ # v1.8.2: same thinking-model rationale as num_ctx probe — give
947
+ # reasoning a budget so the visible content has a chance to surface.
948
+ max_tokens = (
949
+ _STREAMING_PROBE_MAX_TOKENS_THINKING
950
+ if _is_reasoning_model(provider, resolved)
951
+ else _STREAMING_PROBE_MAX_TOKENS_DEFAULT
952
+ )
871
953
  body.update(
872
954
  {
873
955
  "model": provider.model,
874
956
  "messages": [{"role": "user", "content": _STREAMING_PROBE_USER_PROMPT}],
875
- "max_tokens": 128,
957
+ "max_tokens": max_tokens,
876
958
  "temperature": 0,
877
959
  "stream": True,
878
960
  }
@@ -1506,11 +1588,11 @@ async def check_model(
1506
1588
  # declaration probes (tool_calls / thinking / reasoning-leak) should
1507
1589
  # dominate the report — streaming is the output-side sibling of
1508
1590
  # num_ctx and its NEEDS_TUNING verdict is orthogonal to the others.
1509
- report.results.append(await _probe_num_ctx(provider))
1591
+ report.results.append(await _probe_num_ctx(provider, resolved))
1510
1592
  report.results.append(await _probe_tool_calls(provider, resolved))
1511
1593
  report.results.append(await _probe_thinking(provider, resolved))
1512
1594
  report.results.append(await _probe_reasoning_leak(provider, resolved))
1513
- report.results.append(await _probe_streaming(provider))
1595
+ report.results.append(await _probe_streaming(provider, resolved))
1514
1596
  return report
1515
1597
 
1516
1598
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: coderouter-cli
3
- Version: 1.8.1
3
+ Version: 1.8.2
4
4
  Summary: Local-first, free-first, fallback-built-in LLM router. Claude Code / OpenAI compatible.
5
5
  Project-URL: Homepage, https://github.com/zephel01/CodeRouter
6
6
  Project-URL: Repository, https://github.com/zephel01/CodeRouter
@@ -2,7 +2,7 @@ coderouter/__init__.py,sha256=ghdjPrLtnRzY8fyQ4CJZI1UJKADyNTLtA3G7se8H7Ns,696
2
2
  coderouter/__main__.py,sha256=-LCgxJnvgUV240HjQKv7ly-mn2NuKHpC4nCpvTHjeSU,130
3
3
  coderouter/cli.py,sha256=vI1-dv10t4-xG6Zpt7zi_3U8xGgq54Qa8XIMUYpfOV8,19859
4
4
  coderouter/cli_stats.py,sha256=ae20xUr_hjX09Ms3fBZGZsUS52o44JC57EpbWLBOCO0,27750
5
- coderouter/doctor.py,sha256=Uf4R1t2-50hRx6UpV9UBe_UeiJ2UYBg7e7zkPUHegWE,64217
5
+ coderouter/doctor.py,sha256=atYOr73LLI3lKHjhFDY0lea41_0jolfiY2zb15La_O8,68116
6
6
  coderouter/doctor_apply.py,sha256=r_J6xbu5-HivofPNriw4_vjNYs_VRs7GsGTS0oMEX10,24209
7
7
  coderouter/env_security.py,sha256=FEBZnXfJ0xE39kmMMn39zk0W_DRRnmcB_REmP9f4xWo,14796
8
8
  coderouter/errors.py,sha256=Xmq67lheyw8iv3Ox39jh2c4tvNI5RcUR4QkoxVDN6l4,1130
@@ -19,7 +19,7 @@ coderouter/config/env_file.py,sha256=CoMK27fuAXm-NtoLzXb8yN2E-wDFjHQuFwiIlmgTBQw
19
19
  coderouter/config/loader.py,sha256=FUEe8m4Tnmj_aul0vSctD8vKvNW-oLRoMRbTpSKqSmc,4077
20
20
  coderouter/config/schemas.py,sha256=NMWKstAzDKc6DT7qKr-GKlUFrsfE4HtEG7zkz9Pnq78,21597
21
21
  coderouter/data/__init__.py,sha256=uNyfD9jaCvTWsBAWtaw1Fr25OSxzv3psGMfBjT1z0Cc,328
22
- coderouter/data/model-capabilities.yaml,sha256=8g11ysbjEwt9Rc9Q9o4VCA0de2RmnH-mJEbnsueET_A,13949
22
+ coderouter/data/model-capabilities.yaml,sha256=9f9CDIoWBJYtppMRh1BOS8FzRKzICV4uT-uANovGmzs,14718
23
23
  coderouter/ingress/__init__.py,sha256=WQsCH2CGJCAhy0mS6GSEdeYZRkkQu2OHDsP4CJWTLug,155
24
24
  coderouter/ingress/anthropic_routes.py,sha256=vuylsn7klFN-Dz3cBS7LrhnnSRGr6agipgMrr9gxq7k,8261
25
25
  coderouter/ingress/app.py,sha256=b9s6NpBGckaTQJCaw-6MZaY7Eq3rxgtX_cCkgWq-0Ig,6620
@@ -37,8 +37,8 @@ coderouter/translation/__init__.py,sha256=PYXN7XVEwpG1uC8RLy6fvnGbzEZhhrEuUapH8I
37
37
  coderouter/translation/anthropic.py,sha256=JpvIWNXHUPVqOGvps7o_6ZADhXuJuvpU7RdMqQFtwwM,6421
38
38
  coderouter/translation/convert.py,sha256=-qyzFzmmr9hhQV6_Sg75kJnvCZvHe3n7vRdaZtk_JqQ,47269
39
39
  coderouter/translation/tool_repair.py,sha256=fyxDb4kWHytO5JWq5y0i4tinJUtWqhMCkyfoCf5BjeM,8314
40
- coderouter_cli-1.8.1.dist-info/METADATA,sha256=sb0tldZ1vqseJCuO-oExjVXwnmOslwQt9MN9Rh5PVS8,44136
41
- coderouter_cli-1.8.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
42
- coderouter_cli-1.8.1.dist-info/entry_points.txt,sha256=-dnLfD1YZ2WjH2zSdNCvlO65wYltM9bsHt9Fhg3yGss,51
43
- coderouter_cli-1.8.1.dist-info/licenses/LICENSE,sha256=wkEzoR86jFw33jvfOHjULqmkGEfxTFMgMaJnpR8mPRw,1065
44
- coderouter_cli-1.8.1.dist-info/RECORD,,
40
+ coderouter_cli-1.8.2.dist-info/METADATA,sha256=MBkIOwnySR2wfw-JhBtGFipk_MqbV8J_4aAqWZ65A7g,44136
41
+ coderouter_cli-1.8.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
42
+ coderouter_cli-1.8.2.dist-info/entry_points.txt,sha256=-dnLfD1YZ2WjH2zSdNCvlO65wYltM9bsHt9Fhg3yGss,51
43
+ coderouter_cli-1.8.2.dist-info/licenses/LICENSE,sha256=wkEzoR86jFw33jvfOHjULqmkGEfxTFMgMaJnpR8mPRw,1065
44
+ coderouter_cli-1.8.2.dist-info/RECORD,,