feat(harness): add local session repository

This commit is contained in:
User
2026-07-16 17:11:22 +02:00
parent 8296937bc0
commit 8f364ec564
8 changed files with 464 additions and 8 deletions
+8 -7
View File
@@ -1,6 +1,7 @@
import json
import os
import shutil
import uuid
from datetime import UTC, datetime
from pathlib import Path
@@ -8,7 +9,6 @@ import yake
from tht.config import DatabaseConfig
from tht.session.models import SessionManifest
from tht.textutil import slugify
MANIFEST = "session_manifest.yaml"
MAX_SLUG_CHARS = 40
@@ -88,12 +88,13 @@ def render_question_md(question: str, assumptions: list[str] | None = None) -> s
def _new_id(question: str, sessions_root: Path, stamp: str) -> str:
base = f"{stamp}-{slugify(question)[:MAX_SLUG_CHARS].rstrip('-')}"
candidate, n = base, 1
while (sessions_root / candidate).exists():
n += 1
candidate = f"{base}-{n}"
return candidate
"""Create an opaque UUIDv4 session identifier.
``question``, ``sessions_root`` and ``stamp`` remain accepted temporarily so
existing workflow callers do not need to change as the repository boundary
is introduced.
"""
return str(uuid.uuid4())
def create_session(