38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
|
|
"""Next work evaluation (Schlitz 5) — routes to registered strategies only."""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from typing import Any
|
||
|
|
|
||
|
|
from steering.kernel.models import HorizonMarker, SteeringBinding
|
||
|
|
from steering.strategies.next_action.default_strategy import default_strategy
|
||
|
|
from steering.strategies.next_action.registry import get_next_action_strategy
|
||
|
|
from tenant_context import TenantContext
|
||
|
|
|
||
|
|
|
||
|
|
def evaluate_next_work(
|
||
|
|
ctx: TenantContext,
|
||
|
|
*,
|
||
|
|
initiative_id: str,
|
||
|
|
binding: SteeringBinding,
|
||
|
|
horizon: HorizonMarker,
|
||
|
|
limit: int,
|
||
|
|
) -> list[dict[str, Any]]:
|
||
|
|
"""Invoke the bound next-work strategy (primary or composition)."""
|
||
|
|
if limit < 1:
|
||
|
|
limit = 1
|
||
|
|
|
||
|
|
strategy = get_next_action_strategy(binding.next_work_strategy_key) or default_strategy
|
||
|
|
candidates = strategy.evaluate(
|
||
|
|
ctx, initiative_id=initiative_id, limit=limit
|
||
|
|
)
|
||
|
|
|
||
|
|
for item in candidates:
|
||
|
|
item.setdefault("data_source", "steering_kernel")
|
||
|
|
if horizon.gate_roadmap_item_id:
|
||
|
|
item.setdefault("horizon_gate_id", horizon.gate_roadmap_item_id)
|
||
|
|
if horizon.work_cycle_id:
|
||
|
|
item.setdefault("horizon_work_cycle_id", horizon.work_cycle_id)
|
||
|
|
|
||
|
|
return candidates[:limit]
|