feat: add versioned research templates and alpha variants

This commit is contained in:
yuxuanhui
2026-09-08 21:29:21 +08:00
parent b604e6050e
commit f89ae211d2
55 changed files with 5650 additions and 435 deletions
+51
View File
@@ -385,3 +385,54 @@ class TemplateInput(Base):
field_ids: Mapped[list] = mapped_column(JSON)
field_types: Mapped[dict] = mapped_column(JSON)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=now)
class CatalogResource(Base):
"""Read-only upstream metadata snapshots; local annotations live separately."""
__tablename__ = "catalog_resources"
key: Mapped[str] = mapped_column(String(250), primary_key=True)
kind: Mapped[str] = mapped_column(String(30), index=True)
content: Mapped[dict] = mapped_column(JSON)
fetched_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=now)
class OperatorNote(Base):
__tablename__ = "operator_notes"
name: Mapped[str] = mapped_column(String(200), primary_key=True)
note: Mapped[str] = mapped_column(Text, default="")
favorite: Mapped[bool] = mapped_column(Boolean, default=False)
version: Mapped[int] = mapped_column(Integer, default=1)
class ResearchAsset(Base):
"""Stable identity for typed templates, feature plans, views and workflow definitions."""
__tablename__ = "research_assets"
id: Mapped[str] = mapped_column(String(36), primary_key=True)
kind: Mapped[str] = mapped_column(String(30), index=True)
name: Mapped[str] = mapped_column(String(200))
version: Mapped[int] = mapped_column(Integer, default=1)
archived: Mapped[bool] = mapped_column(Boolean, default=False)
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=now)
class ResearchRevision(Base):
__tablename__ = "research_revisions"
asset_id: Mapped[str] = mapped_column(ForeignKey("research_assets.id"), primary_key=True)
version: Mapped[int] = mapped_column(Integer, primary_key=True)
content: Mapped[dict] = mapped_column(JSON)
provenance: Mapped[dict] = mapped_column(JSON, default=dict)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=now)
class ResearchExperiment(Base):
"""Immutable generated candidates; never masquerade as platform Alpha records."""
__tablename__ = "research_experiments"
id: Mapped[str] = mapped_column(String(36), primary_key=True)
name: Mapped[str] = mapped_column(String(200))
kind: Mapped[str] = mapped_column(String(30), index=True)
hypothesis: Mapped[str] = mapped_column(Text)
inputs: Mapped[list] = mapped_column(JSON)
parents: Mapped[list] = mapped_column(JSON)
candidates: Mapped[list] = mapped_column(JSON)
evidence: Mapped[dict] = mapped_column(JSON)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=now)