2026-07-26 16:08:58 +02:00
|
|
|
"""Signal Engine — delegates initiative steering to Kernel Spine v0.1."""
|
2026-07-05 17:09:20 +02:00
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from typing import Any, Literal
|
|
|
|
|
|
2026-07-26 16:08:58 +02:00
|
|
|
from steering.kernel import evaluate_steering
|
2026-07-05 17:09:20 +02:00
|
|
|
from steering.signals import default_rules
|
2026-07-05 17:24:17 +02:00
|
|
|
from steering.strategies.next_action.default_strategy import default_strategy
|
|
|
|
|
from steering.strategies.next_action.registry import get_next_action_strategy
|
2026-07-05 17:09:20 +02:00
|
|
|
from tenant_context import TenantContext
|
|
|
|
|
|
|
|
|
|
SignalKind = Literal["attention", "next_action"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def evaluate(
|
|
|
|
|
ctx: TenantContext,
|
|
|
|
|
kind: SignalKind = "attention",
|
|
|
|
|
*,
|
|
|
|
|
limit: int = 10,
|
|
|
|
|
initiative_id: str | None = None,
|
|
|
|
|
) -> list[dict[str, Any]]:
|
2026-07-26 16:08:58 +02:00
|
|
|
if initiative_id:
|
|
|
|
|
evaluation = evaluate_steering(
|
|
|
|
|
ctx,
|
|
|
|
|
initiative_id=initiative_id,
|
|
|
|
|
next_work_limit=limit,
|
|
|
|
|
attention_limit=max(limit, 10),
|
|
|
|
|
)
|
|
|
|
|
if kind == "next_action":
|
|
|
|
|
return evaluation.next_work
|
|
|
|
|
return evaluation.attention
|
|
|
|
|
|
2026-07-05 17:09:20 +02:00
|
|
|
if kind == "attention":
|
|
|
|
|
return default_rules.get_attention_items(ctx)
|
2026-07-05 17:24:17 +02:00
|
|
|
|
2026-07-26 16:08:58 +02:00
|
|
|
strategy = get_next_action_strategy("default") or default_strategy
|
|
|
|
|
return strategy.evaluate(ctx, initiative_id=None, limit=limit)
|