Add automatic folder creation for file operations and improve chat session handling

Implement `ensureFolderExists` in `ToolExecutor` to create parent directories when creating, moving, or renaming notes.
Update `ChatView` to properly persist agent mode and derive session titles from the first user message. Fix error
handling in tool execution to return structured failures instead of null, and include failure details in follow-up
messages.
This commit is contained in:
2026-05-21 20:35:05 +02:00
parent d330b94816
commit b7b3a185a0
6 changed files with 204 additions and 28 deletions
+10
View File
@@ -5,11 +5,13 @@ export class Vault {
getMarkdownFiles: () => any[];
read: (file: any) => Promise<string>;
create: (path: string, content: string) => Promise<any>;
createFolder: (path: string) => Promise<any>;
constructor() {
this.getMarkdownFiles = () => [];
this.read = async () => '';
this.create = async () => null;
this.createFolder = async () => null;
}
}
@@ -113,6 +115,14 @@ export interface TFile {
path: string;
}
export class TFolder {
path: string;
constructor(path: string = '') {
this.path = path;
}
}
// Plugin class (used by main.ts)
export class Plugin {
app: App;