Kairo-Jinkendo/backend/steering/kernel/models.py
Lars 20636f88d2
All checks were successful
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Successful in 4m11s
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 15s
feat(steering): Kernel v0.3 mit Read-Model- und Proposal-Registry (K-Ext-1, P6)
Erweitert evaluate_steering um read_models und proposals, migriert epic_rollup auf Registry, liefert sprint_commit-Vorschlaege und UI auf Plan-Sprint.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 11:27:06 +02:00

86 lines
2.7 KiB
Python

"""Steering Kernel Spine — data models v0.1.1."""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any, Literal
@dataclass(frozen=True)
class HorizonMarker:
"""Aktiver Steuerungs-Horizont (Q1)."""
kind: Literal["gate", "work_cycle", "none"]
gate_roadmap_item_id: str | None = None
gate_title: str | None = None
work_cycle_id: str | None = None
work_cycle_title: str | None = None
def to_dict(self) -> dict[str, Any]:
return {
"kind": self.kind,
"gate_roadmap_item_id": self.gate_roadmap_item_id,
"gate_title": self.gate_title,
"work_cycle_id": self.work_cycle_id,
"work_cycle_title": self.work_cycle_title,
}
@dataclass(frozen=True)
class SteeringBinding:
"""Aufgelöste Methode: Primary + optional Composition."""
primary_method_key: str
composition_modifier: str | None
next_work_strategy_key: str
@dataclass(frozen=True)
class LifecycleContext:
"""Deklarativer Lifecycle-Vertrag + persistierter Pointer."""
current_state: str
current_state_label: str
slot_map: dict[str, str]
active_slots: tuple[str, ...]
operational_slots: tuple[str, ...]
def to_dict(self) -> dict[str, Any]:
return {
"current_state": self.current_state,
"current_state_label": self.current_state_label,
"slot_map": dict(self.slot_map),
"active_slots": list(self.active_slots),
"operational_slots": list(self.operational_slots),
}
@dataclass
class SteeringEvaluation:
"""Ergebnis von evaluate_steering — ein Wahrheitsmodell pro Vorhaben."""
initiative_id: str
binding: SteeringBinding
horizon: HorizonMarker
lifecycle: LifecycleContext
next_work: list[dict[str, Any]] = field(default_factory=list)
attention: list[dict[str, Any]] = field(default_factory=list)
read_models: dict[str, Any] = field(default_factory=dict)
proposals: dict[str, Any] = field(default_factory=dict)
data_source: str = "steering_kernel_v0.3"
def to_dict(self) -> dict[str, Any]:
return {
"initiative_id": self.initiative_id,
"primary_method_key": self.binding.primary_method_key,
"composition_modifier": self.binding.composition_modifier,
"next_work_strategy_key": self.binding.next_work_strategy_key,
"horizon": self.horizon.to_dict(),
"lifecycle": self.lifecycle.to_dict(),
"next_work": self.next_work,
"attention": self.attention,
"read_models": self.read_models,
"proposals": self.proposals,
"data_source": self.data_source,
}