refactor: one name per decision in the state and its log

- the Research Manager's plan and the Portfolio Manager's decision live only in investment_plan and final_trade_decision; the debate states no longer copy them as judge_decision
- the saved state log writes the Trader's plan as trader_investment_plan, its state key
- the report tree, the final display and the live CLI read the decisions from those fields
This commit is contained in:
Yijia-Xiao
2026-09-24 19:38:41 +00:00
parent 1d20780095
commit cf960d6382
16 changed files with 46 additions and 43 deletions
+6 -6
View File
@@ -404,8 +404,8 @@ def display_complete_report(final_state):
research.append(("Bull Researcher", debate["bull_history"]))
if debate.get("bear_history"):
research.append(("Bear Researcher", debate["bear_history"]))
if debate.get("judge_decision"):
research.append(("Research Manager", debate["judge_decision"]))
if final_state.get("investment_plan"):
research.append(("Research Manager", final_state["investment_plan"]))
if research:
console.print(Panel("[bold]II. Research Team Decision[/bold]", border_style="magenta"))
for title, content in research:
@@ -431,10 +431,10 @@ def display_complete_report(final_state):
for title, content in risk_reports:
console.print(Panel(Markdown(content), title=title, border_style="blue", padding=(1, 2)))
# V. Portfolio Manager Decision
if risk.get("judge_decision"):
console.print(Panel("[bold]V. Portfolio Manager Decision[/bold]", border_style="green"))
console.print(Panel(Markdown(risk["judge_decision"]), title="Portfolio Manager", border_style="blue", padding=(1, 2)))
# V. Portfolio Manager Decision
if final_state.get("final_trade_decision"):
console.print(Panel("[bold]V. Portfolio Manager Decision[/bold]", border_style="green"))
console.print(Panel(Markdown(final_state["final_trade_decision"]), title="Portfolio Manager", border_style="blue", padding=(1, 2)))
def update_research_team_status(status):
+2 -2
View File
@@ -253,7 +253,7 @@ def run_analysis(checkpoint: bool | None = None, portfolio=None):
debate_state = chunk["investment_debate_state"]
bull_hist = debate_state.get("bull_history", "").strip()
bear_hist = debate_state.get("bear_history", "").strip()
judge = debate_state.get("judge_decision", "").strip()
judge = (chunk.get("investment_plan") or "").strip()
# Only update status when there's actual content
if bull_hist or bear_hist:
@@ -288,7 +288,7 @@ def run_analysis(checkpoint: bool | None = None, portfolio=None):
agg_hist = risk_state.get("aggressive_history", "").strip()
con_hist = risk_state.get("conservative_history", "").strip()
neu_hist = risk_state.get("neutral_history", "").strip()
judge = risk_state.get("judge_decision", "").strip()
judge = (chunk.get("final_trade_decision") or "").strip()
if agg_hist:
if message_buffer.agent_status.get("Aggressive Analyst") != "completed":