세션 계약과 메모리 경계 보강

This commit is contained in:
Yun Chan 2026-06-28 23:52:18 +09:00
parent 391639c1de
commit 2bb052f624
12 changed files with 836 additions and 116 deletions

View file

@ -14,26 +14,9 @@ from . import db, session_persistence
from .deps import Principal
from .runtime_policy import require_runtime_fallback_allowed, runtime_fallback_allowed
from .services import guardrail, orchestrator, state_machine
from .stage_contract import stage_label
from .store import InProcSession, TurnRecord, store
_STAGE_LABELS = {
"RAPPORT": "라포",
"EXPLORE": "탐색",
"INTERVENE": "개입",
"CLOSE": "정리",
"rapport": "라포",
"explore": "탐색",
"intervene": "개입",
"close": "정리",
}
def stage_label(stage: object) -> str:
"""Stage enum과 문자열 값을 같은 한글 라벨로 정규화한다."""
name = getattr(stage, "name", "")
raw = str(getattr(stage, "value", stage))
return _STAGE_LABELS.get(name) or _STAGE_LABELS.get(raw) or raw
class SessionAccessError(str, Enum):
NOT_FOUND = "not_found"