96 lines
3.0 KiB
Protocol Buffer
96 lines
3.0 KiB
Protocol Buffer
syntax = "proto3";
|
||
|
||
package zhiyi.consolidate;
|
||
|
||
option go_package = "github.com/xiaoxue/memoryweave/proto/consolidate";
|
||
|
||
// ─── Consolidation Service ──────────────────────────────────
|
||
// Go daemon → Rust sidecar 的 IPC 协议
|
||
// 传输: Unix Socket + Protobuf + length-prefixed framing
|
||
|
||
service Consolidation {
|
||
// 执行深度整合(5 步全流程)
|
||
rpc Run (ConsolidationRequest) returns (ConsolidationResponse);
|
||
}
|
||
|
||
// ─── 请求 ───────────────────────────────────────────────────
|
||
|
||
message ConsolidationRequest {
|
||
string task = 1; // "full" | "cluster_only" | "prune_only"
|
||
string lancedb_path = 2; // LanceDB 数据目录
|
||
string sqlite_path = 3; // SQLite 图谱路径
|
||
string llm_endpoint = 4; // LLM API 端点
|
||
string llm_model = 5; // LLM 模型名
|
||
int32 llm_budget = 6; // 本次可用 LLM 次数
|
||
double epsilon = 7; // DBSCAN 邻域半径 (默认 0.5)
|
||
int32 min_points = 8; // DBSCAN 最小点数 (默认 3)
|
||
}
|
||
|
||
// ─── 响应 ───────────────────────────────────────────────────
|
||
|
||
message ConsolidationResponse {
|
||
string status = 1; // "ok" | "partial_failure"
|
||
string report_json = 2; // ConsolidationReport JSON
|
||
string failure_step = 3; // 失败步骤
|
||
string error_detail = 4; // 错误详情
|
||
}
|
||
|
||
// ─── 报告结构(内嵌 JSON)────────────────────────────────
|
||
|
||
// 对应 report.rs 的 ConsolidationReport
|
||
message Report {
|
||
string timestamp = 1;
|
||
double duration_secs = 2;
|
||
|
||
// Step 1: 聚类
|
||
int32 clusters_found = 3;
|
||
int32 noise_points = 4;
|
||
int32 duplicate_pairs = 5;
|
||
|
||
// Step 2: 修剪
|
||
PruneStats pruned = 6;
|
||
|
||
// Step 3: 衰减
|
||
map<string, double> decay_rates = 7;
|
||
map<string, double> r_squared_values = 8;
|
||
|
||
// Step 4: 质量回溯
|
||
double quality_score = 9;
|
||
int32 low_info_count = 10;
|
||
int32 hallucinations = 11;
|
||
|
||
// Step 5: 仪表盘
|
||
DashboardSnapshot dashboard = 12;
|
||
|
||
// 退化检测
|
||
repeated DegradationAlert degradation = 13;
|
||
}
|
||
|
||
message PruneStats {
|
||
int32 isolated_nodes_removed = 1;
|
||
int32 low_weight_edges_removed = 2;
|
||
int32 redundant_edges_merged = 3;
|
||
int32 nodes_before = 4;
|
||
int32 nodes_after = 5;
|
||
int32 edges_before = 6;
|
||
int32 edges_after = 7;
|
||
}
|
||
|
||
message DashboardSnapshot {
|
||
double recall_useful_rate = 1;
|
||
double recall_hit_rate = 2;
|
||
double gap_closure_rate = 3;
|
||
double cascade_propagation_rate = 4;
|
||
double deprecation_rate = 5;
|
||
double distill_loss_rate = 6;
|
||
double auto_resolve_rate = 7;
|
||
}
|
||
|
||
message DegradationAlert {
|
||
string metric = 1;
|
||
double current_value = 2;
|
||
double previous_value = 3;
|
||
string severity = 4; // "warning" | "critical"
|
||
string message = 5;
|
||
}
|