summaryrefslogtreecommitdiffhomepage
path: root/.rules/changelog/2026-03
diff options
context:
space:
mode:
Diffstat (limited to '.rules/changelog/2026-03')
-rw-r--r--.rules/changelog/2026-03/29/01.md21
-rw-r--r--.rules/changelog/2026-03/29/02.md24
2 files changed, 45 insertions, 0 deletions
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.
diff --git a/.rules/changelog/2026-03/29/02.md b/.rules/changelog/2026-03/29/02.md
new file mode 100644
index 0000000..5dc23b5
--- /dev/null
+++ b/.rules/changelog/2026-03/29/02.md
@@ -0,0 +1,24 @@
+# Image Attachment Feature — Part 2: Frontend UI
+
+## Files Modified
+
+### `src/chat-view.ts`
+- Added imports for `setCurrentAttachments`, `clearCurrentAttachments`, and `ImageAttachment` from `./image-attachments`
+- Added `PendingAttachment` interface (holds `File`, data URL, MIME type)
+- Added class fields: `pendingAttachments`, `attachmentStrip`, `attachButton`, `fileInput`
+- **`onOpen()`**: Added attachment preview strip (full-width, hidden when empty), attach button with `image-plus` icon (hidden when `save_image` tool is disabled), hidden `<input type="file">` with image MIME filter and `multiple` support
+- **`handleSend()`**: Converts pending attachments to `ImageAttachment[]`, sets module-level attachments, prepends LLM context note instructing the AI to use `save_image`, shows original text in UI while sending augmented content in message history. Allows sending with images and no text.
+- **`onClose()`**: Clears pending attachments and module-level attachments, nulls new DOM refs
+- **Clear Chat handler**: Also clears pending and module-level attachments
+- **Catch block**: Calls `clearCurrentAttachments()` on error/abort to prevent stale attachment leak
+- **`setStreamingState()`**: Disables attach button during streaming
+- **`updateAttachButtonVisibility()`**: New method that hides/shows the attach button based on whether `save_image` tool is enabled; called on open and when tools modal closes
+- Added `handleFileSelection()`, `readFileAsDataUrl()`, `renderAttachmentStrip()` methods for file picking and thumbnail strip UI with per-thumbnail remove buttons
+
+### `styles.css`
+- Updated `.ai-pulse-input-row` with `flex-wrap: wrap` and `align-items: flex-end` for strip-above-controls layout
+- Added `.ai-pulse-attach-btn` (icon button with hover/disabled states)
+- Added `.ai-pulse-attachment-strip` (horizontal scrollable thumbnail row, full width)
+- Added `.ai-pulse-attachment-thumb` (48x48 thumbnail container with border)
+- Added `.ai-pulse-attachment-thumb img` (cover-fit image)
+- Added `.ai-pulse-attachment-remove` (circular × button, positioned top-right of thumb, red on hover)