feat(toolbox): F1 拆书 teardown 落库成项目 rules
- teardown_spec.writes=["rules"](只声明 tier,入库仍经白名单 gate,不变量 #3) - toolbox_registry teardown entry 加 ingest=IngestSpec(table="rules") - routers/toolbox.py 通用 ingest dispatcher 加 _ingest_rules: BookTeardownResult(themes/archetypes/structure/hooks) 拍平为可读 rules 条目, 落项目级(无 continuity 预检,仿 _ingest_outline 无 409) - schemas/toolbox.py 加 TeardownIngestView + ToolIngestRequest.teardown - 单测:teardown ingest→rules 真落行 + 预览(generate)不写库 后端门禁绿:ruff/format/mypy clean · alembic no drift · pytest 644 passed
This commit is contained in:
@@ -105,12 +105,22 @@ class OutlineSceneIngestView(BaseModel):
|
||||
hook: str = ""
|
||||
|
||||
|
||||
class TeardownIngestView(BaseModel):
|
||||
"""拆书入库产物(贴 ww_agents.BookTeardownResult;落 rules 表)。F1。"""
|
||||
|
||||
themes: list[str] = Field(default_factory=list, description="核心主题/立意清单")
|
||||
archetypes: list[str] = Field(default_factory=list, description="人物原型/角色模板清单")
|
||||
structure: str = Field(default="", description="叙事结构概述")
|
||||
hooks: list[str] = Field(default_factory=list, description="抓人钩子/爽点套路清单")
|
||||
|
||||
|
||||
class ToolIngestRequest(BaseModel):
|
||||
"""通用入库请求:待持久化的产物 + 冲突确认。
|
||||
|
||||
仅声明了 `ingest` 的工具可用。按入库表取用对应字段:
|
||||
- world_entities(金手指/词条)→ `world_entities`(贴 WorldEntityCardView:type/name/rules);
|
||||
- outline(细纲)→ `chapter_no` + `scenes`(贴 OutlineSceneIngestView)。
|
||||
- outline(细纲)→ `chapter_no` + `scenes`(贴 OutlineSceneIngestView);
|
||||
- rules(拆书)→ `teardown`(贴 TeardownIngestView:themes/archetypes/structure/hooks)。
|
||||
`acknowledge_conflicts`:作者已查看并接受 continuity 预检冲突时置 true 放行(仿 accept gate)。
|
||||
"""
|
||||
|
||||
@@ -123,6 +133,9 @@ class ToolIngestRequest(BaseModel):
|
||||
scenes: list[OutlineSceneIngestView] = Field(
|
||||
default_factory=list, description="outline 入库的场景行(细纲)"
|
||||
)
|
||||
teardown: TeardownIngestView | None = Field(
|
||||
default=None, description="rules 入库的拆书结论(F1;拍平为可读规则条目)"
|
||||
)
|
||||
acknowledge_conflicts: bool = Field(
|
||||
default=False, description="作者已知悉并接受 continuity 冲突 → 放行入库"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user