feat: implement dual-transport WAL architecture with permanent background leader and lightweight stubs

This commit is contained in:
Riz Ashraf committed 2026-09-08 09:07:56 +01:00
1 parent a2febd1b00
commit e4ff476b6d
16 files changed
+1910 -52

No files matched your search

+364
View File
@@ -0,0 +1,364 @@
use rust_mcp_sdk::macros;
use serde::{Deserialize, Serialize};
#[macros::mcp_tool(name = "create_entities", description = "Create multiple new entities")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct CreateEntitiesTool {
pub entities: Vec<serde_json::Value>,
}
#[macros::mcp_tool(
name = "create_relations",
description = "Create multiple new relations"
)]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct CreateRelationsTool {
pub relations: Vec<serde_json::Value>,
}
#[macros::mcp_tool(
name = "add_observations",
description = "Add observations to entities"
)]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct AddObservationsTool {
pub observations: Vec<serde_json::Value>,
}
#[macros::mcp_tool(
name = "delete_entities",
description = "Delete entities and relations"
)]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct DeleteEntitiesTool {
#[serde(rename = "entityNames")]
pub entity_names: Vec<String>,
}
#[macros::mcp_tool(name = "delete_observations", description = "Delete observations")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct DeleteObservationsTool {
pub deletions: Vec<serde_json::Value>,
}
#[macros::mcp_tool(name = "delete_relations", description = "Delete relations")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct DeleteRelationsTool {
pub relations: Vec<serde_json::Value>,
}
#[macros::mcp_tool(name = "read_graph", description = "Read the entire knowledge graph")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct ReadGraphTool {
pub namespace: Option<String>,
}
#[macros::mcp_tool(name = "search_nodes", description = "Search for nodes")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct SearchNodesTool {
pub query: String,
pub namespace: Option<String>,
}
#[macros::mcp_tool(name = "open_nodes", description = "Open specific nodes")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct OpenNodesTool {
pub names: Vec<String>,
}
#[macros::mcp_tool(name = "log_code_change", description = "Log a code change")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct LogCodeChangeTool {
#[serde(rename = "filePath")]
pub file_path: String,
pub description: String,
pub git_commit: Option<String>,
pub git_branch: Option<String>,
}
#[macros::mcp_tool(name = "query_recent_changes", description = "Query the audit ledger")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct QueryRecentChangesTool {}
#[macros::mcp_tool(name = "visualize_graph", description = "Generate Mermaid diagram")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct VisualizeGraphTool {
pub query: Option<String>,
pub namespace: Option<String>,
}
#[macros::mcp_tool(name = "add_sticky_note", description = "Add a sticky note")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct AddStickyNoteTool {
pub content: String,
}
#[macros::mcp_tool(name = "read_sticky_notes", description = "Read sticky notes")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct ReadStickyNotesTool {}
#[macros::mcp_tool(name = "condense_entity", description = "Condense observations")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct CondenseEntityTool {
#[serde(rename = "entityName")]
pub entity_name: String,
pub summarized_observations: Vec<String>,
}
#[macros::mcp_tool(name = "add_task", description = "Add a task")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct AddTaskTool {
pub title: String,
pub description: String,
}
#[macros::mcp_tool(name = "update_task_status", description = "Update task status")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct UpdateTaskStatusTool {
pub id: String,
pub status: String,
}
#[macros::mcp_tool(name = "list_active_tasks", description = "List active tasks")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct ListActiveTasksTool {}
#[macros::mcp_tool(name = "store_snippet", description = "Store code snippet")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct StoreSnippetTool {
pub name: String,
pub language: String,
pub code: String,
pub description: String,
}
#[macros::mcp_tool(name = "search_snippets", description = "Search snippets")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct SearchSnippetsTool {
pub query: String,
}
#[macros::mcp_tool(name = "delete_snippet", description = "Delete snippet")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct DeleteSnippetTool {
pub name: String,
}
#[macros::mcp_tool(
name = "log_decision",
description = "Log architectural decision record"
)]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct LogDecisionTool {
pub title: String,
pub context: String,
pub decision: String,
pub consequence: String,
}
#[macros::mcp_tool(name = "query_decisions", description = "Query decision records")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct QueryDecisionsTool {
pub query: Option<String>,
}
#[macros::mcp_tool(
name = "merge_entities",
description = "Merge source entity into target entity"
)]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct MergeEntitiesTool {
#[serde(rename = "sourceEntity")]
pub source_entity: String,
#[serde(rename = "targetEntity")]
pub target_entity: String,
}
#[macros::mcp_tool(name = "find_orphans", description = "Find entities with no relations")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct FindOrphansTool {}
#[macros::mcp_tool(
name = "learn_preference",
description = "Store an AI behavioral preference"
)]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct LearnPreferenceTool {
pub key: String,
pub value: String,
}
#[macros::mcp_tool(
name = "read_preferences",
description = "Read all learned behavioral preferences"
)]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct ReadPreferencesTool {}
#[macros::mcp_tool(name = "log_error_fix", description = "Log an error fix")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct LogErrorFixTool {
pub signature: String,
pub solution: String,
pub git_commit: Option<String>,
pub git_branch: Option<String>,
}
#[macros::mcp_tool(name = "search_error_fixes", description = "Search error fixes")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct SearchErrorFixesTool {
pub query: String,
}
#[macros::mcp_tool(name = "pin_file", description = "Pin a file to working set")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct PinFileTool {
pub namespace: String,
pub file_path: String,
}
#[macros::mcp_tool(name = "unpin_file", description = "Unpin a file")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct UnpinFileTool {
pub namespace: String,
pub file_path: String,
}
#[macros::mcp_tool(name = "list_pinned_files", description = "List pinned files")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct ListPinnedFilesTool {
pub namespace: Option<String>,
}
#[macros::mcp_tool(name = "add_session_summary", description = "Add a session summary")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct AddSessionSummaryTool {
pub summary: String,
pub namespace: String,
}
#[macros::mcp_tool(name = "get_project_timeline", description = "Get project timeline")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct GetProjectTimelineTool {
pub namespace: Option<String>,
}
#[macros::mcp_tool(
name = "leave_handoff_memo",
description = "Leave memo for next session"
)]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct LeaveHandoffMemoTool {
pub content: String,
pub namespace: String,
}
#[macros::mcp_tool(name = "read_handoff_memos", description = "Read pending memos")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct ReadHandoffMemosTool {
pub namespace: Option<String>,
}
#[macros::mcp_tool(name = "clear_handoff_memos", description = "Clear read memos")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct ClearHandoffMemosTool {
pub ids: Vec<String>,
}
#[macros::mcp_tool(name = "update_env_fingerprint", description = "Update env versions")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct UpdateEnvFingerprintTool {
pub namespace: String,
pub tool_versions: std::collections::HashMap<String, String>,
}
#[macros::mcp_tool(name = "read_env_fingerprint", description = "Read env footprint")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct ReadEnvFingerprintTool {
pub namespace: String,
}
#[macros::mcp_tool(name = "log_env_requirement", description = "Log env var requirement")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct LogEnvRequirementTool {
pub namespace: String,
pub key: String,
pub description: String,
pub is_secret: bool,
}
#[macros::mcp_tool(name = "add_milestone", description = "Add project milestone")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct AddMilestoneTool {
pub title: String,
pub namespace: String,
}
#[macros::mcp_tool(name = "update_milestone", description = "Update milestone status")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct UpdateMilestoneTool {
pub id: String,
pub status: String,
}
#[macros::mcp_tool(name = "list_milestones", description = "List milestones")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct ListMilestonesTool {
pub namespace: Option<String>,
}
#[macros::mcp_tool(
name = "generate_standup_report",
description = "Generate a standup report"
)]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct GenerateStandupReportTool {
pub namespace: String,
pub hours_lookback: u64,
}
#[macros::mcp_tool(name = "register_environment", description = "Register an environment")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct RegisterEnvironmentTool {
pub namespace: String,
pub name: String,
pub url: String,
pub description: String,
pub requires_vpn: bool,
}
#[macros::mcp_tool(
name = "get_environment_details",
description = "Get environment details"
)]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct GetEnvironmentDetailsTool {
pub namespace: String,
}
#[macros::mcp_tool(
name = "add_pr_checklist_item",
description = "Add a PR checklist item"
)]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct AddPrChecklistItemTool {
pub namespace: String,
pub description: String,
}
#[macros::mcp_tool(name = "get_pr_checklist", description = "Get the PR checklist")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct GetPrChecklistTool {
pub namespace: String,
}
#[macros::mcp_tool(name = "clear_pr_checklist", description = "Clear the PR checklist")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct ClearPrChecklistTool {
pub namespace: String,
}
#[macros::mcp_tool(name = "log_tech_debt", description = "Log tech debt")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct LogTechDebtTool {
pub namespace: String,
pub description: String,
pub ideal_solution: String,
pub git_commit: Option<String>,
pub git_branch: Option<String>,
}
#[macros::mcp_tool(name = "resolve_tech_debt", description = "Resolve tech debt")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct ResolveTechDebtTool {
pub id: String,
}
#[macros::mcp_tool(name = "list_tech_debt", description = "List tech debt")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct ListTechDebtTool {
pub namespace: String,
pub include_resolved: bool,
}
#[macros::mcp_tool(name = "save_context_workspace", description = "Save current context")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct SaveContextWorkspaceTool {
pub namespace: String,
pub name: String,
pub pinned_files: Vec<String>,
pub active_task_ids: Vec<String>,
}
#[macros::mcp_tool(name = "load_context_workspace", description = "Load context")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct LoadContextWorkspaceTool {
pub namespace: String,
pub name: String,
}
#[macros::mcp_tool(name = "list_context_workspaces", description = "List contexts")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct ListContextWorkspacesTool {
pub namespace: String,
}
#[macros::mcp_tool(name = "omni_search", description = "Search across all memory vaults")]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct OmniSearchTool {
pub query: String,
pub namespace: Option<String>,
}
#[macros::mcp_tool(
name = "get_project_health",
description = "Get project health metrics"
)]
#[derive(Debug, Deserialize, Serialize, macros::JsonSchema)]
pub struct GetProjectHealthTool {
pub namespace: String,
}