tidaldb/applications/forage/engine/src/labels.rs
jordan f4cfd6c81f feat: complete M8 replication primitives + forage enhancements + docs
Milestone 8 (phases 1-4):
- Shard-aware WAL segment naming, BatchHeader v2, ShardRouter
- Transport trait, InProcessTransport, WalShipper, FollowerDb
- HLC, PNCounter, LWWRegister, CrdtSignalState, ReconciliationEngine
- Session replication bridge with SeqNo/HWM, idempotency store

Forage application:
- Multi-source discovery engine with MAB exploration
- Embedding-based label system, server handlers, UI refresh

Other:
- QUICKSTART.md, README.md, milestone-8 planning docs
- Hard negative union semantics, RLHF export enhancements
- Recovery benchmark and visibility test expansions
- Split 8 oversized source files per CODING_GUIDELINES §9

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 13:17:19 -07:00

45 lines
1.5 KiB
Rust

/// How an item arrived in the user's feed.
#[derive(Debug, Clone, serde::Serialize)]
#[serde(rename_all = "snake_case")]
pub enum ItemLabel {
Match,
Exploring,
Trending,
Resurfaced,
/// Semantic intersection of the user's two strongest interest categories.
///
/// Injected at most once per feed call. The category names (`cat_a`, `cat_b`)
/// are the two categories with the highest scores in the user's preference
/// vector. Serialises as `{"bridge": {"cat_a": "...", "cat_b": "..."}}`.
Bridge {
cat_a: String,
cat_b: String,
},
}
/// A single item returned by the feed, with label and score attached.
#[derive(Debug, Clone, serde::Serialize)]
pub struct ForageItem {
pub id: u64,
pub title: String,
pub source: String,
pub category: String,
pub reading_time_min: u32,
pub description: String,
pub label: ItemLabel,
pub score: f32,
pub url: String,
/// Specific subtopics (e.g. `["modal jazz", "music theory"]`).
/// Empty for seed items or items not yet enriched by the discovery agent.
pub tags: Vec<String>,
/// Named entities (e.g. `["John Coltrane", "Blue Note"]`).
/// Empty for seed items or items not yet enriched.
pub entities: Vec<String>,
/// Content type classification (e.g. `"analysis"`, `"tutorial"`).
/// Empty string when not enriched.
pub content_type: String,
/// Claude's 2-sentence summary of the article.
/// Empty string when not enriched.
pub summary: String,
}