feat: support mounted vault workspaces

This commit is contained in:
lucaronin
2026-05-11 16:37:06 +02:00
parent 5c05347690
commit 07edfac400
176 changed files with 8868 additions and 1535 deletions

View File

@@ -10,6 +10,8 @@ pub struct AgentStreamRequest {
pub message: String,
pub system_prompt: Option<String>,
pub vault_path: String,
#[serde(default)]
pub vault_paths: Vec<String>,
pub permission_mode: AiAgentPermissionMode,
}
@@ -65,6 +67,28 @@ pub(crate) fn mcp_server_path_string() -> Result<String, String> {
.to_string())
}
pub(crate) fn active_vault_paths(primary_vault_path: &str, vault_paths: &[String]) -> Vec<String> {
let mut paths = Vec::new();
push_unique_vault_path(&mut paths, primary_vault_path);
for path in vault_paths {
push_unique_vault_path(&mut paths, path);
}
paths
}
pub(crate) fn active_vault_paths_json(primary_vault_path: &str, vault_paths: &[String]) -> String {
serde_json::to_string(&active_vault_paths(primary_vault_path, vault_paths))
.unwrap_or_else(|_| format!("[{}]", serde_json::json!(primary_vault_path)))
}
fn push_unique_vault_path(paths: &mut Vec<String>, path: &str) {
let trimmed = path.trim();
if trimmed.is_empty() || paths.iter().any(|existing| existing == trimmed) {
return;
}
paths.push(trimmed.to_string());
}
pub(crate) fn version_for_binary(binary: &Path) -> Option<String> {
let target = command_target_avoiding_windows_cmd_shim(binary).ok()?;
let mut command = crate::hidden_command(&target.program);