refactor: Enforce strict typed JsonSchema for all MCP tools
This commit is contained in:
1 parent
686fea683d
commit
2d3aaed289
31 files changed
+2892
-308
No files matched your search
@@ -0,0 +1,56 @@
|
||||
import re
|
||||
|
||||
with open("server/src/main.rs", "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
|
||||
reconcile_worker_old = """async fn reconcile_worker(state: Arc<MemoryState>) {
|
||||
loop {
|
||||
sleep(Duration::from_secs(5)).await;
|
||||
let pattern = format!("{}/delta_*.json", state.base_dir.display());
|
||||
let has_local = {
|
||||
let session = state.session_graph.read().unwrap();
|
||||
!session.entities.is_empty() || !session.relations.is_empty()
|
||||
};
|
||||
let has_files = glob::glob(&pattern).map(|p| p.count() > 0).unwrap_or(false);
|
||||
if has_local || has_files {
|
||||
state.apply_sync_write(|_master| {}).await;
|
||||
let state_clone = state.clone();
|
||||
let _ = tokio::task::spawn_blocking(move || {
|
||||
state_clone.rebuild_index();
|
||||
}).await;
|
||||
}
|
||||
|
||||
}
|
||||
}"""
|
||||
|
||||
reconcile_worker_new = """async fn reconcile_worker(state: Arc<MemoryState>) {
|
||||
loop {
|
||||
sleep(Duration::from_secs(5)).await;
|
||||
|
||||
let has_local = {
|
||||
let session = state.session_graph.read().unwrap();
|
||||
!session.entities.is_empty() || !session.relations.is_empty()
|
||||
};
|
||||
|
||||
let base_dir = state.base_dir.clone();
|
||||
let has_files = tokio::task::spawn_blocking(move || {
|
||||
let pattern = format!("{}/delta_*.json", base_dir.display());
|
||||
glob::glob(&pattern).map(|p| p.count() > 0).unwrap_or(false)
|
||||
})
|
||||
.await
|
||||
.unwrap_or(false);
|
||||
|
||||
if has_local || has_files {
|
||||
state.apply_sync_write(|_master| {}).await;
|
||||
let state_clone = state.clone();
|
||||
let _ = tokio::task::spawn_blocking(move || {
|
||||
state_clone.rebuild_index();
|
||||
}).await;
|
||||
}
|
||||
}
|
||||
}"""
|
||||
|
||||
content = content.replace(reconcile_worker_old, reconcile_worker_new)
|
||||
|
||||
with open("server/src/main.rs", "w", encoding="utf-8") as f:
|
||||
f.write(content)
|
||||
Reference in new issue
Block a user