refactor: give reasoning decisions their own module

providers.py had been holding two jobs: the registry of what each
provider looks like, and the decisions made from those declarations.
Adding response-side judgement would have made it the module for
everything about reasoning, so the decisions move to thinking.py and
the registry keeps only profiles and their lookup.

Moving a module breaks any deep-path import of what moved, so the six
public symbols are promoted to the package root at the same time. The
top level is this library's stated API surface; giving downstream a
stable name to import is what makes the next reorganisation harmless.
observe_thinking stays unexported — downstream reads the verdict off
LLMResponse, and exporting it would be a permanent promise for nothing.
This commit is contained in:
2026-08-25 23:48:45 -04:00
parent e90bb3d6a4
commit 7622eb0402
9 changed files with 286 additions and 234 deletions
+25
View File
@@ -49,3 +49,28 @@ def test_telemetry_status_exported():
assert "TelemetryStatus" in polygateway.__all__
assert polygateway.TelemetryStatus is not None
assert "TelemetryStatusProvider" not in polygateway.__all__
def test_thinking_public_surface_exported():
"""issue #16/#17: 推理决策搬进 `polygateway.thinking` 后,公共符号必须走顶层。
搬模块本身会断掉 `from polygateway.providers import ThinkingCapability` 这类
深路径 import。给下游一个稳定引用点,是以后再重组不再破坏下游的前提——本库
的约定是「顶层导出即公共 API 面」。
`observe_thinking` / `reconcile_thinking` **不**导出: 它们是 transport 内部
的裁定与对账,下游读 `LLMResponse.thinking_observation` 即可,导出即多一份
永久承诺。
"""
for name in (
"ThinkingCapability",
"ThinkingObservation",
"ThinkingUnsupportedError",
"get_capability",
"register_capability",
"resolve_thinking",
):
assert hasattr(polygateway, name), name
assert name in polygateway.__all__, name
assert "observe_thinking" not in polygateway.__all__
assert "reconcile_thinking" not in polygateway.__all__