AP2.4: Steuerungselement-Registry und Methoden-Vertrag.
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Failing after 3m17s
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
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Failing after 3m17s
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
MethodDefinition traegt steering_elements/ui_features/graph_profile; operating-context und FE-Registry ohne Archetyp-Ifs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
ac475ab92c
commit
d3bf3c36e0
25 files changed
+837
-118
No files matched your search
@@ -1,4 +1,4 @@
|
||||
"""Steering API — methods, profiles and context (AP1.1 / AP2.0)."""
|
||||
"""Steering API — methods, profiles and context (AP1.1 / AP2.0 / AP2.4)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -7,11 +7,16 @@ from typing import Optional
|
||||
from capabilities import require_capability
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query
|
||||
from pydantic import BaseModel, Field
|
||||
from entity_archetypes.registry import resolve_default_method_key, resolve_ui_profile
|
||||
from method_profiles.registry import list_method_profiles
|
||||
from services import initiatives as initiative_service
|
||||
from services import steering_context as sc_service
|
||||
from steering.context import get_steering_context_dto
|
||||
from steering.methods.registry import list_methods
|
||||
from steering.methods.registry import (
|
||||
list_compatible_methods,
|
||||
list_methods,
|
||||
method_to_dict,
|
||||
)
|
||||
from tenant_context import TenantContext
|
||||
|
||||
router = APIRouter(prefix="/api/steering", tags=["steering"])
|
||||
@@ -23,20 +28,34 @@ class SteeringContextUpdateRequest(BaseModel):
|
||||
clear_method_profile: bool = False
|
||||
|
||||
|
||||
def _om_capabilities_for_archetype(archetype_key: str | None) -> frozenset[str] | None:
|
||||
if not archetype_key:
|
||||
return None
|
||||
profile = resolve_ui_profile(archetype_key)
|
||||
caps = profile.get("omCapabilities") or profile.get("dataSlices") or []
|
||||
return frozenset(caps)
|
||||
|
||||
|
||||
@router.get("/methods")
|
||||
def list_steering_methods(
|
||||
archetype_key: Optional[str] = Query(default=None),
|
||||
ctx: TenantContext = Depends(require_capability("kairo.initiative.read")),
|
||||
):
|
||||
_ = ctx
|
||||
om_caps = _om_capabilities_for_archetype(archetype_key)
|
||||
if archetype_key:
|
||||
methods = list_compatible_methods(archetype_key, om_capabilities=om_caps)
|
||||
default_key = resolve_default_method_key(archetype_key)
|
||||
else:
|
||||
methods = list_methods()
|
||||
default_key = None
|
||||
|
||||
return [
|
||||
{
|
||||
"key": m.key,
|
||||
"version": m.version,
|
||||
"label": m.label,
|
||||
"description": m.description,
|
||||
"next_action_strategy_key": m.next_action_strategy_key,
|
||||
**method_to_dict(m),
|
||||
"is_default": m.key == default_key if default_key else False,
|
||||
}
|
||||
for m in list_methods()
|
||||
for m in methods
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user