M6:缘契、人格与世界——契约版本链、铸魂分灵、河图境界与三界分流
- 缘契域 domains/yuanqi:covenants(当前版)+ covenant_events(不可变历史);提议—问心—铭契—撤回全链;边界变更立即生效;多维关系并存,服务层拒绝 affinity/好感度单一键;浪漫维度成人资格标记位 - 道体铸魂与分灵 domains/jingsheng/soul.py:soul_forgings 确认流(锚点变更 pending→confirmed 应用并签发新魂籍版本,确认前人物锚点不变);分灵创建新人物(继承资料与谱系 lineage 链、不继承原身份,魂籍从 v1 起) - 河图域 domains/hetu:persistent_worlds 境界 + world_entities/world_relations 境界作用域重建 + 世谱挂接;境界正史视图(scope=persistent_world 归真集合);canonize 后置推进正史计数 - 三界分流:reality→息壤提取(不变);persistent_world→境界实录+正史推进;simulation→只记试演实录;factual_records 增 scope 列——境界/幻境实录与真界本相隔离 - 正影打通:引文 target_type=memory 时被引记忆 superseded → 返回 successor_memory_id 提示,不静默替换 - 前端:人物详情页缘契面板(提议维度选择/铭契/撤回/事件史)+ 世界页重建(境界目录/实体/正史概览)+ covenants/worlds api 库 - 退役:旧 personality/drive/evolution/world 模块、服务、端点、仓储、schema、前端五页与组件样式;迁移 007 退役九张旧表与 characters.current_personality_version_id - 验收(test_m6_domains 六用例):多维无单一好感度/铭契版本链/事件不可抹除/撤回立即生效/边界即时/铸魂确认流+魂籍版本/分灵谱系/境界正史不进真界(实录 scope 隔离+真界候选=0)/引文正影后继 - 四套件:后端 379、前端 199、BFF 4、神识 5 包全绿(2 个预存环境失败不变);迁移 007 净库+±1 干净
This commit is contained in:
1 parent
684261f4b4
commit
7e23d6fa84
108 files changed
+2600
-9732
No files matched your search
@@ -754,10 +754,25 @@ async def canonize(
|
||||
record_id = record.id
|
||||
await session.commit()
|
||||
|
||||
# 息壤:归真产生记忆候选证据(M3)——后台任务,不阻塞归真返回
|
||||
from app.domains.xirang import service as xirang_service
|
||||
# 归真后置按三界分流(core-domains.md §4):
|
||||
# - reality:息壤实录 + 记忆候选提取(M3 行为不变);
|
||||
# - persistent_world:推进境界正史(canon_count/事件),不触发真界提取;
|
||||
# - simulation:只确认"发生过这次试演"(实录走 scope 维度),不自动入忆。
|
||||
if scope == "reality":
|
||||
from app.domains.xirang import service as xirang_service
|
||||
|
||||
await xirang_service.on_canonized(record_id)
|
||||
await xirang_service.on_canonized(record_id)
|
||||
elif scope == "persistent_world":
|
||||
from app.domains.hetu import service as hetu_service
|
||||
from app.domains.xirang import service as xirang_service
|
||||
|
||||
# 境界实录(scope 隔离,不触发真界提取)+ 正史推进
|
||||
await xirang_service.record_factual_scoped(record_id)
|
||||
await hetu_service.on_world_canonized(world_id or "")
|
||||
else:
|
||||
from app.domains.xirang import service as xirang_service
|
||||
|
||||
await xirang_service.record_factual_scoped(record_id)
|
||||
|
||||
await one_qi.emit(
|
||||
"tree.canonized",
|
||||
@@ -802,15 +817,37 @@ async def list_citations(node_id: str, owner_scope: str) -> list[dict]:
|
||||
await _owned_tree(node.tree_id, owner_scope)
|
||||
async with AsyncSessionLocal() as session:
|
||||
own = await _node_citations(session, node_id)
|
||||
# 正影提示:同 source 存在更高版本时标记,不静默替换(PRD §7.2)
|
||||
# 正影提示(引文↔引文):同 source 存在更高版本时标记,不静默替换(PRD §7.2)
|
||||
versions: dict[str, int] = {}
|
||||
all_rows = (
|
||||
await session.execute(select(Citation).where(Citation.source_id != ""))
|
||||
).scalars().all()
|
||||
for c in all_rows:
|
||||
versions[c.source_id] = max(versions.get(c.source_id, 0), c.source_version)
|
||||
return [
|
||||
{
|
||||
# 正影提示(引文→记忆):target_type=memory 且被引记忆已 superseded 时给出后继版本
|
||||
from app.models.xirang import Memory
|
||||
|
||||
memory_ids = {
|
||||
c.source_id for c in own if c.target_type == "memory" and c.source_id
|
||||
}
|
||||
successors: dict[str, str] = {}
|
||||
if memory_ids:
|
||||
rows = (
|
||||
await session.execute(
|
||||
select(Memory).where(Memory.id.in_(memory_ids))
|
||||
)
|
||||
).scalars().all()
|
||||
superseded = {m.id for m in rows if m.status == "superseded"}
|
||||
if superseded:
|
||||
newer = (
|
||||
await session.execute(
|
||||
select(Memory).where(Memory.prev_version_id.in_(superseded))
|
||||
)
|
||||
).scalars().all()
|
||||
successors = {m.prev_version_id: m.id for m in newer}
|
||||
out = []
|
||||
for c in own:
|
||||
entry = {
|
||||
"id": c.id,
|
||||
"node_id": c.node_id,
|
||||
"target_type": c.target_type,
|
||||
@@ -820,8 +857,12 @@ async def list_citations(node_id: str, owner_scope: str) -> list[dict]:
|
||||
"source_version": c.source_version,
|
||||
"newer_version_available": versions.get(c.source_id, 0) > c.source_version,
|
||||
}
|
||||
for c in own
|
||||
]
|
||||
successor = successors.get(c.source_id)
|
||||
if successor:
|
||||
entry["memory_superseded"] = True
|
||||
entry["successor_memory_id"] = successor
|
||||
out.append(entry)
|
||||
return out
|
||||
|
||||
|
||||
# ── 移栽 ──────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user