feat(runtime): add planner reflection history with rationale and thinking
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:
2026-07-15 12:43:22 +08:00
parent 96e403ee47
commit a5aeb8889c
26 changed files with 903 additions and 25 deletions
@@ -1694,6 +1694,8 @@ class SQLAlchemyCloudRepository:
tool_name: str,
arguments_json: str,
now: datetime,
rationale: str | None = None,
thinking: str | None = None,
) -> int:
with self._sessions.begin() as session:
current_max = session.scalars(
@@ -1714,6 +1716,8 @@ class SQLAlchemyCloudRepository:
tool_name=tool_name,
arguments_json=arguments_json,
created_at=_iso(now),
rationale=rationale,
thinking=thinking,
)
)
session.flush()
@@ -1766,6 +1770,8 @@ class SQLAlchemyCloudRepository:
tool_name=row.tool_name,
arguments_json=row.arguments_json,
created_at=_parse_dt(row.created_at), # type: ignore[arg-type]
rationale=row.rationale,
thinking=row.thinking,
)
for row in rows
]