Some checks failed
Deploy Development / deploy (push) Successful in 48s
Test Suite / pytest-backend (push) Failing after 3m33s
Test Suite / k6 /api/health Baseline (push) Has been skipped
Test Suite / playwright-smoke (push) Has been skipped
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
evaluate_steering() vereinheitlicht Horizon, Next Work und Attention; Snapshot und Signal Engine delegieren dorthin; slot_map deklarativ fuer sequential_dependency und generic_operating. Co-authored-by: Cursor <cursoragent@cursor.com>
53 lines
1.7 KiB
Python
53 lines
1.7 KiB
Python
"""Resolve primary method and composition modifier."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from services import steering_context as sc_service
|
|
from services.work_cycle import get_active_work_cycle
|
|
from steering.kernel.models import SteeringBinding
|
|
from steering.methods.registry import get_method
|
|
from steering.strategies.next_action.default_strategy import default_strategy
|
|
from tenant_context import TenantContext
|
|
|
|
_AGILE_KEY = "agile_iteration"
|
|
|
|
|
|
def resolve_primary_method_key(ctx: TenantContext, initiative_id: str) -> str:
|
|
row = sc_service.get_steering_context(
|
|
tenant_id=ctx.tenant_id, initiative_id=initiative_id
|
|
)
|
|
if row:
|
|
return row["method_key"]
|
|
return "generic_operating"
|
|
|
|
|
|
def _primary_composes_with_agile(primary_method_key: str) -> bool:
|
|
agile = get_method(_AGILE_KEY)
|
|
if not agile:
|
|
return False
|
|
return primary_method_key in agile.composes_with
|
|
|
|
|
|
def resolve_steering_binding(ctx: TenantContext, initiative_id: str) -> SteeringBinding:
|
|
primary_key = resolve_primary_method_key(ctx, initiative_id)
|
|
primary = get_method(primary_key)
|
|
primary_strategy = (
|
|
primary.next_action_strategy_key if primary else default_strategy.key
|
|
)
|
|
|
|
composition: str | None = None
|
|
strategy_key = primary_strategy
|
|
|
|
active_cycle = get_active_work_cycle(
|
|
tenant_id=ctx.tenant_id, initiative_id=initiative_id
|
|
)
|
|
if active_cycle and _primary_composes_with_agile(primary_key):
|
|
composition = _AGILE_KEY
|
|
strategy_key = _AGILE_KEY
|
|
|
|
return SteeringBinding(
|
|
primary_method_key=primary_key,
|
|
composition_modifier=composition,
|
|
next_work_strategy_key=strategy_key,
|
|
)
|