feat(api)!: memory single chain — async MemoryService, strict eval closure

Route all memory ingest/retrieve/enrichment/compaction through async MemoryService.
Remove legacy sync memory implementations (ingest/retrieve/compaction); Celery and
memoir Phase2 call asyncio.run into MemoryService-backed helpers.

Memoir Phase1 batch ingest uses MemoryService.ingest_transcripts_batch; drop chapters.
evidence_bundle_json mirror (Alembic 0015). Evaluation uses snapshot/link-only bundles;
raise EvidenceClosureMissing instead of partial/fallback lineage tiers.

Split memoir state into NarrativeCoverageState and InterviewControlState; delete the
_interview_meta_store adapter layer. Remove rolling-query and recent-fact fallback
settings from config and evidence assembly.

Update judges, docs, tests, and PlaygroundPage alignment.

Made-with: Cursor
This commit is contained in:
Kevin
2026-04-30 14:11:46 +08:00
parent ac436b87a2
commit 71fbd39e32
53 changed files with 953 additions and 2448 deletions

View File

@@ -35,8 +35,6 @@ class Chapter(Base):
is_new = Column(Boolean, default=True)
is_active = Column(Boolean, default=True)
source_segments = Column(JSON, nullable=True)
# 物化当前 canonical 对应的证据闭包segment / story / memory ids供评测与审计见 memoir/chapter_evidence_snapshot
evidence_bundle_json = Column(JSON, nullable=True)
# Phase C指向当前生效的 chapter_evidence_snapshots 行(版本链可审计)
current_evidence_snapshot_id = Column(
String,
@@ -295,6 +293,9 @@ class MemoirState(Base):
current_stage = Column(String, default="childhood")
covered_stages = Column(JSON, default=list)
slots = Column(JSON, nullable=False)
known_facts_json = Column(JSON, nullable=True)
persona_threads_json = Column(JSON, nullable=True)
recent_questions_json = Column(JSON, nullable=True)
updated_at = Column(DateTime(timezone=True), default=utc_now, onupdate=utc_now)
user = relationship("User", back_populates="memoir_state")