Kairo-Jinkendo/backend/steering/strategies/next_action/registry.py
Lars fc956d4ceb
All checks were successful
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Successful in 1m23s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 12s
AP1.1: Method Registry — product_milestone_driven + Methode wählbar
Zweite Built-in-Methode mit meilensteinorientierter NextAction-Strategie, API und UI-Auswahl pro Vorhaben; AP0.10d Validation-Vorlagen.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-05 17:24:17 +02:00

36 lines
841 B
Python

"""NextAction strategy registry — AP1.1."""
from __future__ import annotations
from typing import Any, Protocol
from tenant_context import TenantContext
_STRATEGIES: dict[str, "NextActionStrategy"] = {}
class NextActionStrategy(Protocol):
key: str
def evaluate(
self,
ctx: TenantContext,
*,
initiative_id: str | None = None,
limit: int = 10,
) -> list[dict[str, Any]]: ...
def register_next_action_strategy(strategy: NextActionStrategy) -> None:
if strategy.key in _STRATEGIES:
raise ValueError(f"NextAction strategy already registered: {strategy.key}")
_STRATEGIES[strategy.key] = strategy
def get_next_action_strategy(key: str) -> NextActionStrategy | None:
return _STRATEGIES.get(key)
def clear_strategies_for_tests() -> None:
_STRATEGIES.clear()