From 81fd4e5157c9615ca97afd5aac12b8123fa8b66b Mon Sep 17 00:00:00 2001 From: Wenzheng Jiang Date: Mon, 30 Mar 2026 09:17:17 +0900 Subject: [PATCH] feat(miyo): add remote vault folder path override for remote servers (#2334) When using a Miyo remote server, the vault may be mounted at a different path on the remote machine. This adds an optional "Remote Vault Folder" setting that overrides the folder path sent to Miyo when a custom server URL is configured. Co-authored-by: Claude Sonnet 4.6 --- src/miyo/miyoUtils.ts | 15 ++++++++++++--- src/search/findRelevantNotes.ts | 2 +- src/search/indexBackend/MiyoIndexBackend.ts | 2 +- src/search/miyo/MiyoSemanticRetriever.ts | 2 +- .../v2/components/CopilotPlusSettings.tsx | 13 ++++++++++++- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/miyo/miyoUtils.ts b/src/miyo/miyoUtils.ts index 4f6d13c0..be60491e 100644 --- a/src/miyo/miyoUtils.ts +++ b/src/miyo/miyoUtils.ts @@ -36,12 +36,21 @@ export function shouldUseMiyo(settings: CopilotSettings): boolean { } /** - * Resolve the current vault folder path sent to Miyo as `folder_path`. + * Resolve the folder path sent to Miyo as `folder_path`. + * + * When a remote server URL is configured and the user has set a remote vault folder, + * that override is used — the remote machine's folder path may differ from the local + * vault path. Falls back to the local vault filesystem path, then vault name. * * @param app - Obsidian application instance. - * @returns Current vault filesystem path when available, otherwise vault name. + * @param settings - Current Copilot settings. + * @returns Remote vault folder override when applicable, otherwise local vault path. */ -export function getMiyoFolderPath(app: App): string { +export function getMiyoFolderPath(app: App, settings: CopilotSettings): string { + const remoteVaultFolder = (settings.miyoRemoteVaultPath || "").trim(); + if (remoteVaultFolder && getMiyoCustomUrl(settings)) { + return remoteVaultFolder; + } const vaultPath = getVaultBasePath(app); if (vaultPath) { return vaultPath; diff --git a/src/search/findRelevantNotes.ts b/src/search/findRelevantNotes.ts index 8bac26ea..a2b43c30 100644 --- a/src/search/findRelevantNotes.ts +++ b/src/search/findRelevantNotes.ts @@ -129,7 +129,7 @@ async function calculateSimilarityScoreFromMiyo(filePath: string): Promise { onChange={(value) => updateSetting("miyoServerUrl", value)} /> + {(settings.miyoServerUrl || "").trim() && ( + updateSetting("miyoRemoteVaultPath", value)} + placeholder="e.g. /Users/you/Documents/vault" + /> + )} + {
Folder path sent to Miyo:{" "} - {getMiyoFolderPath(app)} + {getMiyoFolderPath(app, settings)}
)}