From 73c25761f6b879d78ebd8ecddac35881848831db Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Sun, 29 Mar 2026 17:51:22 +0900 Subject: enable image attachments to the chat --- .rules/changelog/2026-03/29/01.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .rules/changelog/2026-03/29/01.md (limited to '.rules/changelog/2026-03/29/01.md') diff --git a/.rules/changelog/2026-03/29/01.md b/.rules/changelog/2026-03/29/01.md new file mode 100644 index 0000000..7a0c13f --- /dev/null +++ b/.rules/changelog/2026-03/29/01.md @@ -0,0 +1,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. -- cgit v1.2.3