Kairo-Jinkendo/backend/steering/methods/registrations/_helpers.py

71 lines
1.5 KiB
Python
Raw Normal View History

"""Shared registration helper for AP2.0 method stubs."""
from __future__ import annotations
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",
)
def register_stub_method(
*,
key: str,
label: str,
description: str,
next_action_strategy_key: str = "default",
lifecycle_steps: tuple[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,
)
)
def register_product_like_method(
*,
key: str,
label: str,
description: str,
next_action_strategy_key: str,
) -> None:
register_stub_method(
key=key,
label=label,
description=description,
next_action_strategy_key=next_action_strategy_key,
lifecycle_steps=_PRODUCT_LIKE_STEPS,
)