feat(runtime): add planner reflection history with rationale and thinking
Tests / Test failed: 2, passed: 849
Tests / Test failed: 2, passed: 849
- ToolCallDecision captures thinking blocks and pre-tool text output
- AnthropicToolCallingClient supports optional extended thinking (budget_tokens + beta header)
- PlannedStep carries rationale and thinking from each LLM decision
- WorldEvent replaces scene_summary with rationale/thinking/page fields (backward-compatible)
- AI planner system prompt instructs reflection before each tool call
- _history_summary() emits compact {page, rationale, action, success} dicts
- Cloud DB migration 0011 adds nullable rationale/thinking columns to planner_decision_log
- OpenAI client extracts reasoning_content into thinking field
This commit is contained in:
+11
-1
@@ -60,6 +60,8 @@ class AIPlanner(Planner):
|
||||
description=f"AI planner: {decision.tool_name}({decision.arguments})",
|
||||
args=dict(decision.arguments),
|
||||
prompt=decision.user_prompt or user_prompt,
|
||||
rationale=decision.text_output,
|
||||
thinking=decision.thinking,
|
||||
)
|
||||
]
|
||||
|
||||
@@ -72,4 +74,12 @@ class AIPlanner(Planner):
|
||||
def _history_summary(world: "WorldState | None") -> list[dict[str, Any]]:
|
||||
if world is None:
|
||||
return []
|
||||
return [event.to_dict() for event in world.history]
|
||||
return [
|
||||
{
|
||||
"page": event.page,
|
||||
"action": event.action,
|
||||
"rationale": event.rationale,
|
||||
"success": event.success,
|
||||
}
|
||||
for event in world.history
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user