feat(maf): complete resilient roundtable workflow
This commit is contained in:
1 parent
bd4131b4e2
commit
21c4c898e7
23 files changed
+4810
-312
No files matched your search
@@ -127,11 +127,35 @@ def _format_prior_turns(turns: list[dict[str, Any]], max_per_turn: int) -> str:
|
||||
def _format_fact_ledger(ledger: dict[str, Any], max_chars: int) -> str:
|
||||
parts: list[str] = []
|
||||
|
||||
candidates = ledger.get("candidate_facts")
|
||||
if candidates and isinstance(candidates, list):
|
||||
# Phase-3: candidate facts are UNVERIFIED seat claims — label them
|
||||
# explicitly so downstream seats / the finalizer never treat them as
|
||||
# established conclusions.
|
||||
parts.append("未经核验的席位主张(不能作为结论):")
|
||||
for c in candidates[:20]:
|
||||
if isinstance(c, dict):
|
||||
parts.append(f" - {c.get('text', c)}")
|
||||
else:
|
||||
parts.append(f" - {c}")
|
||||
|
||||
facts = ledger.get("confirmed_facts")
|
||||
if facts and isinstance(facts, list):
|
||||
parts.append("已确认事实:")
|
||||
parts.append("已确认事实(经交叉审查核验):")
|
||||
for f in facts[:20]:
|
||||
parts.append(f" - {f}")
|
||||
if isinstance(f, dict):
|
||||
parts.append(f" - {f.get('text', f)}")
|
||||
else:
|
||||
parts.append(f" - {f}")
|
||||
|
||||
evidence = ledger.get("evidence")
|
||||
if evidence and isinstance(evidence, list):
|
||||
parts.append("证据引用:")
|
||||
for e in evidence[:10]:
|
||||
if isinstance(e, dict):
|
||||
parts.append(f" - {e.get('ref') or e.get('text') or e}")
|
||||
else:
|
||||
parts.append(f" - {e}")
|
||||
|
||||
tool_results = ledger.get("tool_results")
|
||||
if tool_results and isinstance(tool_results, list):
|
||||
@@ -142,6 +166,21 @@ def _format_fact_ledger(ledger: dict[str, Any], max_chars: int) -> str:
|
||||
else:
|
||||
parts.append(f" - {tr}")
|
||||
|
||||
proposed = ledger.get("proposed_actions")
|
||||
if proposed and isinstance(proposed, list):
|
||||
parts.append("建议动作(未执行):")
|
||||
for p in proposed[:8]:
|
||||
parts.append(f" - {p}")
|
||||
|
||||
executed = ledger.get("executed_actions")
|
||||
if executed and isinstance(executed, list):
|
||||
parts.append("已执行外部写入:")
|
||||
for e in executed[:8]:
|
||||
if isinstance(e, dict):
|
||||
parts.append(f" - {e.get('tool_name', '?')} ({e.get('action_id', '')})")
|
||||
else:
|
||||
parts.append(f" - {e}")
|
||||
|
||||
conflicts = ledger.get("conflicts")
|
||||
if conflicts and isinstance(conflicts, list):
|
||||
parts.append("未解决冲突:")
|
||||
@@ -154,6 +193,12 @@ def _format_fact_ledger(ledger: dict[str, Any], max_chars: int) -> str:
|
||||
for p in pending[:5]:
|
||||
parts.append(f" - {p}")
|
||||
|
||||
failed = ledger.get("failed_or_unknown_actions")
|
||||
if failed and isinstance(failed, list):
|
||||
parts.append("失败或状态不确定的动作:")
|
||||
for f in failed[:5]:
|
||||
parts.append(f" - {f}")
|
||||
|
||||
result = "\n".join(parts)
|
||||
if len(result) > max_chars:
|
||||
result = result[:max_chars]
|
||||
|
||||
Reference in new issue
Block a user