| 131 | } |
| 132 | |
| 133 | private loadAll(): void { |
| 134 | const { fs, assistantsDir } = this.deps |
| 135 | this.cache.clear() |
| 136 | |
| 137 | const files = fs.listFiles(assistantsDir, '.md') |
| 138 | for (const file of files) { |
| 139 | try { |
| 140 | const filePath = fs.joinPath(assistantsDir, file) |
| 141 | const content = fs.readFile(filePath) |
| 142 | const config = parseAssistantFile(content, filePath) |
| 143 | if (config) { |
| 144 | this.cache.set(config.id, config) |
| 145 | } else { |
| 146 | this.deps.logger?.warn('AssistantManager', `Failed to parse: ${file}`) |
| 147 | } |
| 148 | } catch (error) { |
| 149 | this.deps.logger?.warn('AssistantManager', `Failed to load: ${file}`, { error: String(error) }) |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | // ==================== Query ==================== |
| 155 | |