Kairo-Jinkendo/backend/steering/methods/registrations/_helpers.py
Lars 75a6a63665
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
feat(steering): Kernel Spine v0.1.1 als zentraler Initiative-Einstieg
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>
2026-07-26 16:08:58 +02:00

151 lines
4.0 KiB
Python

"""Shared registration helper for AP2.0 method stubs — AP2.3e / AP2.4."""
from __future__ import annotations
from typing import Literal
from steering.graph.profiles import (
FULFILLMENT,
GraphMethodProfile,
LIGHT,
STRICT,
)
from steering.lifecycle.states import STANDARD_LIFECYCLE_STEPS
from steering.methods.registry import MethodDefinition, get_method, register_method
_PRODUCT_LIKE_STEPS = (
"intake",
"method_selection",
"structure_setup",
"planning",
"action_selection",
"assignment",
"waiting",
"result_intake",
"validation",
"review",
"adaptation",
"closure",
)
_LIGHT_STEPS = (
"intake",
"structure_setup",
"action_selection",
"assignment",
"waiting",
"review",
"adaptation",
"closure",
)
SLICES_OM_STANDARD = frozenset(
{
"backlog",
"actions",
"roadmap",
"projects",
"blockers",
"evidence",
"decisions",
"reviews",
"steering_methods",
}
)
SLICES_PRODUCT = SLICES_OM_STANDARD | frozenset({"work_cycles"})
SLICES_QUEUE = frozenset({"backlog", "actions", "blockers", "steering_methods"})
SLICES_MATURITY = frozenset(
{
"actions",
"roadmap",
"blockers",
"evidence",
"decisions",
"reviews",
"recurring",
"steering_methods",
}
)
SLICES_RECURRING = frozenset(
{"actions", "roadmap", "recurring", "blockers", "steering_methods"}
)
SLICES_PROGRAM = SLICES_OM_STANDARD | frozenset({"work_cycles"})
SLICES_GENERIC = SLICES_OM_STANDARD
SLICES_AGILE = SLICES_PRODUCT
ELEM_NEXT = frozenset({"next_action_primary"})
def register_stub_method(
*,
key: str,
label: str,
description: str,
next_action_strategy_key: str = "default",
lifecycle_steps: tuple[str, ...] | None = None,
data_slices: frozenset[str] | None = None,
compatible_archetype_keys: frozenset[str] | Literal["*"] = "*",
steering_elements: frozenset[str] | None = None,
ui_features: frozenset[str] | None = None,
graph_profile: GraphMethodProfile = LIGHT,
method_role: Literal["primary", "modifier"] = "primary",
composes_with: frozenset[str] | None = None,
slot_map: tuple[tuple[str, str], ...] | None = None,
) -> None:
if get_method(key):
return
register_method(
MethodDefinition(
key=key,
version="0.1.0",
label=label,
description=description,
default_lifecycle_steps=lifecycle_steps or STANDARD_LIFECYCLE_STEPS,
next_action_strategy_key=next_action_strategy_key,
data_slices=data_slices or SLICES_GENERIC,
compatible_archetype_keys=compatible_archetype_keys,
steering_elements=steering_elements or ELEM_NEXT,
ui_features=ui_features or frozenset(),
graph_profile=graph_profile,
method_role=method_role,
composes_with=composes_with or frozenset(),
slot_map=slot_map or (),
)
)
def register_product_like_method(
*,
key: str,
label: str,
description: str,
next_action_strategy_key: str,
data_slices: frozenset[str] | None = None,
compatible_archetype_keys: frozenset[str] | Literal["*"] | None = None,
steering_elements: frozenset[str] | None = None,
ui_features: frozenset[str] | None = None,
graph_profile: GraphMethodProfile = STRICT,
) -> None:
register_stub_method(
key=key,
label=label,
description=description,
next_action_strategy_key=next_action_strategy_key,
lifecycle_steps=_PRODUCT_LIKE_STEPS,
data_slices=data_slices or SLICES_PRODUCT,
compatible_archetype_keys=compatible_archetype_keys
if compatible_archetype_keys is not None
else frozenset({"initiative.product"}),
steering_elements=steering_elements
or (ELEM_NEXT | frozenset({"gate_fulfillment", "work_cycle_scope"})),
ui_features=ui_features or frozenset(),
graph_profile=graph_profile,
)