Include ranked suggestions in daily triage digest (STATE-WP-0061).
Expose State Hub ranked_suggestions from /state/summary in the daily_triage_digest resolver so WSJF triage can prioritize gated needs.
This commit is contained in:
parent
d7d7c966fa
commit
6e3e7e6176
2 changed files with 34 additions and 0 deletions
|
|
@ -513,11 +513,19 @@ def _daily_triage_digest(params: dict[str, Any]) -> str:
|
|||
max_workstreams = int(params.get("max_workstreams", 12))
|
||||
max_next_steps = int(params.get("max_next_steps", 8))
|
||||
open_workstreams = _open_workstream_digest(summary, workplan_index, max_workstreams)
|
||||
ranked_suggestions = summary.get("ranked_suggestions") or []
|
||||
if not isinstance(ranked_suggestions, list):
|
||||
ranked_suggestions = []
|
||||
|
||||
digest = {
|
||||
"generated_at": summary.get("generated_at"),
|
||||
"totals": summary.get("totals", {}),
|
||||
"open_workstreams": open_workstreams,
|
||||
"next_steps": [_safe_next_step(item) for item in next_steps[:max_next_steps]],
|
||||
"ranked_suggestions": [
|
||||
_safe_ranked_suggestion(item)
|
||||
for item in ranked_suggestions[: int(params.get("max_suggestions", 10))]
|
||||
],
|
||||
"inbox": {
|
||||
"unread_count": len(inbox),
|
||||
"samples": [_safe_inbox_item(item) for item in inbox[:3]],
|
||||
|
|
@ -619,6 +627,19 @@ def _safe_next_step(item: dict[str, Any]) -> dict[str, Any]:
|
|||
}
|
||||
|
||||
|
||||
def _safe_ranked_suggestion(item: dict[str, Any]) -> dict[str, Any]:
|
||||
return {
|
||||
"id": item.get("id"),
|
||||
"title": _short_text(item.get("title", ""), 120),
|
||||
"stage": item.get("stage"),
|
||||
"domain_slug": item.get("domain_slug"),
|
||||
"origin_ref": item.get("origin_ref"),
|
||||
"relevance": item.get("relevance"),
|
||||
"wsjf": item.get("wsjf"),
|
||||
"last_requested_at": item.get("last_requested_at"),
|
||||
}
|
||||
|
||||
|
||||
def _safe_inbox_item(item: dict[str, Any]) -> dict[str, Any]:
|
||||
return {
|
||||
"id": item.get("id"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue