Kairo-Jinkendo/backend/steering/kernel/evaluate.py

67 lines
1.8 KiB
Python
Raw Normal View History

"""Steering Kernel Spine — single entry point v0.1."""
from __future__ import annotations
from steering.kernel.attention import evaluate_attention
from steering.kernel.binding import resolve_steering_binding
from steering.kernel.horizon import resolve_horizon
from steering.kernel.lifecycle import resolve_lifecycle_context
from steering.kernel.models import SteeringEvaluation
from steering.kernel.next_work import evaluate_next_work
from tenant_context import TenantContext
def evaluate_steering(
ctx: TenantContext,
*,
initiative_id: str,
next_work_limit: int = 10,
attention_limit: int = 20,
) -> SteeringEvaluation:
"""
Herzmaschine — ein Wahrheitsmodell pro Vorhaben.
Alle Initiative-Steuerung (Snapshot, Cockpit, API) muss hier durch.
"""
if next_work_limit < 1:
next_work_limit = 1
if attention_limit < 1:
attention_limit = 1
binding = resolve_steering_binding(ctx, initiative_id)
lifecycle = resolve_lifecycle_context(
ctx, initiative_id=initiative_id, binding=binding
)
horizon = resolve_horizon(
ctx,
initiative_id=initiative_id,
primary_method_key=binding.primary_method_key,
composition_modifier=binding.composition_modifier,
)
next_work = evaluate_next_work(
ctx,
initiative_id=initiative_id,
binding=binding,
horizon=horizon,
limit=next_work_limit,
)
attention = evaluate_attention(
ctx,
initiative_id=initiative_id,
binding=binding,
horizon=horizon,
next_work=next_work,
limit=attention_limit,
)
return SteeringEvaluation(
initiative_id=initiative_id,
binding=binding,
horizon=horizon,
lifecycle=lifecycle,
next_work=next_work,
attention=attention,
)