package skill import "time" // SkillVersion is one immutable snapshot of a Skill at the moment it // was saved. The skill_versions table is append-only; pruning is by // retention policy in PruneOldVersions. // // Why: edit history with rollback (v3) and the admin pin gate (v3 Phase 4) // both need a stable snapshot of the skill at a known version. The Snapshot // field carries the FULL Skill struct so a later restore or pin produces // the exact agent definition that was saved — system_prompt, tools, // schedule, every field — not a synthesized partial snapshot. // // What: identity (UUID per snapshot) + skill ref + version-string copy + // the full Skill payload + audit fields (saved_by, saved_at, edit_summary). // // Test: see skill_version_test.go for round-trip, list ordering, prune // retention, and version-by-number disambiguation coverage. type SkillVersion struct { ID string // UUID per snapshot (NOT the skill's ID) SkillID string // FK to skills.id (conceptually; not enforced by GORM) Version string // Skill.Version at save time (semver) Snapshot Skill // full Skill struct embedded; serialised as JSON SavedBy string // caller member ID (or "" for builtin loader / pre-v3) SavedAt time.Time // wall-clock save time EditSummary string // optional human-readable note ("changed model tier", "...") }