feat(agent): complete closed-loop runtime and pricing fallback

This commit is contained in:
qzl
2026-03-05 15:34:37 +08:00
parent b02a322bf3
commit b486e78ff3
67 changed files with 3832 additions and 7 deletions
@@ -0,0 +1,29 @@
from __future__ import annotations
from pathlib import Path
def test_session_has_state_snapshot_and_status_contract() -> None:
model_path = (
Path(__file__).resolve().parents[3] / "src" / "models" / "agent_chat_session.py"
)
content = model_path.read_text(encoding="utf-8")
assert "state_snapshot" in content
assert "AgentChatSessionStatus" in content
def test_message_has_token_cost_and_metadata_contract() -> None:
model_path = (
Path(__file__).resolve().parents[3] / "src" / "models" / "agent_chat_message.py"
)
content = model_path.read_text(encoding="utf-8")
assert "input_tokens" in content
assert "output_tokens" in content
assert "cost" in content
assert '"metadata"' in content
versions_dir = Path(__file__).resolve().parents[3] / "alembic" / "versions"
migration_file = versions_dir / "20260305_agent_runtime_closed_loop_contract.py"
assert migration_file.exists()