1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# Changelog — 2026-03-29 — 01
## Image Attachment Backend (Part 1)
### New Files
- **`src/image-attachments.ts`** — Module-level storage for pending image attachments (`ImageAttachment` interface, `setCurrentAttachments`, `getCurrentAttachments`, `clearCurrentAttachments`, `hasCurrentAttachments`).
- **`src/context/tools/save-image.json`** — Tool context JSON for the `save_image` tool (id, label, description, friendlyName, requiresApproval, Ollama function definition with `file_path` parameter).
### Modified Files
- **`src/tools.ts`**
- Added imports for `save-image.json` and `image-attachments` module.
- Added `mimeToExtension()` helper mapping MIME types to file extensions.
- Added `executeSaveImage()` — saves attached images to vault, handles single/multi naming, creates parent folders, clears attachments after save.
- Added `save_image` entry to `TOOL_REGISTRY` with `approvalMessage`, `summarize`, `summarizeResult`, and `execute` callbacks.
- **`src/ollama-client.ts`**
- Added import for `hasCurrentAttachments` from `image-attachments`.
- Added `"save_image"` case to `preValidateTool` switch.
- Added `preValidateSaveImage()` — validates `file_path` is provided and attachments exist before prompting user approval.
|