All checks were successful
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 4m13s
Test Suite / lint-backend (push) Successful in 3s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 19s
Test Suite / playwright-smoke (push) Successful in 12s
Methodenuebergreifende Provider auf Kernel v0.3; verbindliche Coding Rules fuer Agenten in ADP und .cursor/rules. Co-authored-by: Cursor <cursoragent@cursor.com>
63 lines
2.0 KiB
Python
63 lines
2.0 KiB
Python
"""Core attention contributors — blockers, blocked actions."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from steering.attention.context import AttentionEvalContext
|
|
from steering.attention.contributors.registry import (
|
|
AttentionContributor,
|
|
register_attention_contributor,
|
|
)
|
|
|
|
|
|
def _open_blockers(ctx: AttentionEvalContext) -> list[dict]:
|
|
items: list[dict] = []
|
|
for blocker in ctx.blockers:
|
|
if blocker.get("status") not in ("open", "in_progress"):
|
|
continue
|
|
items.append(
|
|
{
|
|
"kind": "open_blocker",
|
|
"severity": "warning",
|
|
"title": blocker.get("title") or "Blocker",
|
|
"summary": "Offener Blocker im Vorhaben",
|
|
"scope_type": "blocker",
|
|
"scope_id": str(blocker["id"]),
|
|
"initiative_id": ctx.initiative_id,
|
|
"action_id": (
|
|
str(blocker["action_id"]) if blocker.get("action_id") else None
|
|
),
|
|
"blocker_id": str(blocker["id"]),
|
|
"reason_code": "path_blocked",
|
|
}
|
|
)
|
|
return items
|
|
|
|
|
|
def _blocked_actions(ctx: AttentionEvalContext) -> list[dict]:
|
|
items: list[dict] = []
|
|
for action in ctx.actions:
|
|
if action.get("status") != "blocked":
|
|
continue
|
|
items.append(
|
|
{
|
|
"kind": "blocked_action",
|
|
"severity": "critical",
|
|
"title": action.get("title") or "Arbeitspaket",
|
|
"summary": "Maßnahme ist blockiert",
|
|
"scope_type": "action",
|
|
"scope_id": str(action["id"]),
|
|
"initiative_id": ctx.initiative_id,
|
|
"action_id": str(action["id"]),
|
|
"reason_code": "path_blocked",
|
|
}
|
|
)
|
|
return items
|
|
|
|
|
|
register_attention_contributor(
|
|
AttentionContributor(key="open_blockers", contribute=_open_blockers)
|
|
)
|
|
register_attention_contributor(
|
|
AttentionContributor(key="blocked_actions", contribute=_blocked_actions)
|
|
)
|