Three PRD gaps closed in one coherent batch — all were cosmetic or
scaffold-shaped, now real files:
Phase 39 (PRD:57):
+ config/providers.toml — provider registry (name/base_url/auth/
default_model) for ollama, ollama_cloud, openrouter. Commented
stubs for gemini + claude pending adapter work. Secrets stay in
/etc/lakehouse/secrets.toml or env, NEVER inline.
Phase 41 (PRD:115):
+ crates/vectord/src/activation.rs — ActivationTracker with the
PRD-named single-flight guard ("refuse new activation if one is
pending/running"). Per-profile granularity — activating A doesn't
block B. 5 tests cover the full state machine. Handler body stays
in service.rs for now; tracker usage integration is a follow-up.
Phase 41 (PRD:113):
+ crates/shared/src/profiles/ with 4 submodules:
* execution.rs — `pub use crate::types::ModelProfile as
ExecutionProfile` (backward-compat rename per PRD)
* retrieval.rs — top_k, rerank_top_k, freshness cutoff,
playbook boost, sensitivity-gate enforcement
* memory.rs — playbook boost ceiling, history cap, doc
staleness, auto-retire-on-failure
* observer.rs — failure cluster size, alert cooldown, ring
size, langfuse forwarding
All fields `#[serde(default)]` so existing ModelProfile files
load unchanged.
Still open from the same phases:
- Gemini + Claude provider adapters (Phase 40 — 100-200 LOC each)
- Full activate_profile handler extraction into activation.rs
(Phase 41 — module-structure refactor)
- Catalogd CRUD endpoints for retrieval/memory/observer profiles
(Phase 41 — exists at list level, no create/update/delete yet)
- truth/ repo-root directory for file-backed rules (Phase 42 —
TOML loader + schema)
- crates/validator crate (Phase 43 — full greenfield)
Workspace warnings still at 0. 5 new tests, all green.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
53 lines
2.1 KiB
Rust
53 lines
2.1 KiB
Rust
//! RetrievalProfile — what + how the agent reaches into memory.
|
|
//!
|
|
//! Phase 41 decomposition: the old ModelProfile bundled "what dataset
|
|
//! can I read" (bound_datasets) AND "how do I rank results"
|
|
//! (hnsw_config) with the model tag. Retrieval concerns split out here
|
|
//! so a profile can swap its retrieval strategy without re-activating
|
|
//! the model.
|
|
//!
|
|
//! Fields chosen for what's actually varied per-workload today:
|
|
//! - `top_k` / `rerank_top_k` — how many hits to fetch + rerank
|
|
//! - `freshness_cutoff_days` — Phase 45 doc-drift uses this
|
|
//! - `boost_playbook_memory` — Phase 19 meta-index feedback
|
|
//! - `enforce_sensitivity_gates` — Phase 13 access-control integration
|
|
//!
|
|
//! All fields are `#[serde(default)]` so loading a profile file that
|
|
//! predates Phase 41 works without migration.
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct RetrievalProfile {
|
|
/// Unique id — slug form, separate namespace from ExecutionProfile.
|
|
pub id: String,
|
|
/// Free-text operator description.
|
|
#[serde(default)]
|
|
pub description: String,
|
|
/// Default top-K for /vectors/search + /vectors/hybrid.
|
|
#[serde(default = "default_top_k")]
|
|
pub top_k: u32,
|
|
/// How many of the top-K to pass through the reranker. 0 disables
|
|
/// reranking for this profile.
|
|
#[serde(default = "default_rerank_top_k")]
|
|
pub rerank_top_k: u32,
|
|
/// Don't consider playbooks / docs older than this (days). 0 or
|
|
/// absent = no freshness filter.
|
|
#[serde(default)]
|
|
pub freshness_cutoff_days: u32,
|
|
/// Phase 19: boost workers/results by playbook_memory similarity.
|
|
#[serde(default)]
|
|
pub boost_playbook_memory: bool,
|
|
/// Phase 13: apply access-control masking on sensitive columns.
|
|
/// Default on — safety-first.
|
|
#[serde(default = "default_true")]
|
|
pub enforce_sensitivity_gates: bool,
|
|
pub created_at: chrono::DateTime<chrono::Utc>,
|
|
#[serde(default)]
|
|
pub created_by: String,
|
|
}
|
|
|
|
fn default_top_k() -> u32 { 10 }
|
|
fn default_rerank_top_k() -> u32 { 5 }
|
|
fn default_true() -> bool { true }
|