"""update_trust — 신뢰축 이동 (1파일 = 1함수, FunctionTool). session.state의 숨은 값만 움직인다. 영속 커밋은 포켓 종료 시 services/pocket.py → services/state.py 경로가 담당 (이중 갱신 금지). """ from google.adk.tools import ToolContext from engine.services.state import AXIS_DELTA def update_trust(direction: str, tool_context: ToolContext) -> dict: """유저 발화 태도 판정에 따라 신뢰축을 민다. Args: direction: "trust" | "doubt" | "neutral" """ if direction == "trust": tool_context.state["hidden_trust"] = tool_context.state.get("hidden_trust", 0) + AXIS_DELTA elif direction == "doubt": tool_context.state["hidden_doubt"] = tool_context.state.get("hidden_doubt", 0) + AXIS_DELTA elif direction != "neutral": return {"status": "error", "message": f"unknown direction: {direction}"} turns = tool_context.state.get("pocket_axis_calls", 0) + 1 tool_context.state["pocket_axis_calls"] = turns return {"status": "ok", "direction": direction}