feat(awooop): surface km review draft dedupe
All checks were successful
Code Review / ai-code-review (push) Successful in 10s
Type Sync Check / check-type-sync (push) Successful in 33s
CD Pipeline / tests (push) Successful in 3m57s
CD Pipeline / build-and-deploy (push) Successful in 4m47s
CD Pipeline / post-deploy-checks (push) Successful in 2m3s

This commit is contained in:
Your Name
2026-05-19 23:27:33 +08:00
parent 9c122a4a37
commit 855716b5b8
7 changed files with 313 additions and 1 deletions

View File

@@ -103,6 +103,8 @@ class DispatchItem(BaseModel):
lead_agent: str | None = None
support_agents: list[str] = Field(default_factory=list)
human_owner: str | None = None
kb_draft_entry_id: str | None = None
worker_status: str | None = None
class GovernanceQueueResponse(BaseModel):

View File

@@ -422,6 +422,8 @@ async def _query_dispatch_table(
lead_agent=_extract_lead_agent(decision_ctx),
support_agents=_extract_support_agents(decision_ctx),
human_owner=_extract_human_owner(decision_ctx),
kb_draft_entry_id=_extract_kb_draft_entry_id(decision_ctx),
worker_status=_extract_worker_status(decision_ctx),
))
return GovernanceQueueResponse(
@@ -532,6 +534,31 @@ def _extract_human_owner(decision_ctx: dict) -> str | None:
return val[:120] if isinstance(val, str) and val else None
def _extract_kb_draft_entry_id(decision_ctx: dict) -> str | None:
"""Expose Hermes KM review draft id for Work Items owner review."""
workflow = decision_ctx.get("workflow")
if isinstance(workflow, dict):
val = workflow.get("kb_draft_entry_id")
if isinstance(val, str) and val:
return val[:120]
worker_result = decision_ctx.get("worker_result")
if isinstance(worker_result, dict):
val = worker_result.get("km_draft_entry_id")
if isinstance(val, str) and val:
return val[:120]
return None
def _extract_worker_status(decision_ctx: dict) -> str | None:
worker_result = decision_ctx.get("worker_result")
if not isinstance(worker_result, dict):
return None
val = worker_result.get("status")
return val[:80] if isinstance(val, str) and val else None
# =============================================================================
# Endpoint 3: summary
# =============================================================================