feat: add health-aware P2C selector as default
Score is success-rate EWMA over (1 + inflight) with a 0.05 exploration floor so quarantined sources can prove recovery; EWMA climb doubles as slow-start. New optional OutcomeAwareSelector port feeds attempt outcomes.
This commit is contained in:
@@ -181,6 +181,18 @@ class SourceSelector(Protocol):
|
||||
) -> list[SourceConfig]: ...
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class OutcomeAwareSelector(Protocol):
|
||||
"""可选选源器扩展(M2.5 设计 §3.2): 消费尝试结果以维护健康视图。
|
||||
|
||||
RetryMW 构造时 isinstance 判定一次;非本 Protocol 的选源器不受影响。
|
||||
喂数口径: 真实成功 ok=True;Transient/SourceDead/429 ok=False;
|
||||
ResultInvalid 与"网关健康拒坏请求"不喂(坏结果 ≠ 坏服务)。
|
||||
"""
|
||||
|
||||
def record_outcome(self, source_name: str, ok: bool) -> None: ...
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class StructuredOutputStrategy(Protocol):
|
||||
"""结构化输出策略(D7/D14): 请求侧叠加 + 响应侧解析。"""
|
||||
|
||||
Reference in New Issue
Block a user