From 5a44a97111d304945bbfc3da02d29a83191d816c Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Tue, 24 Mar 2026 13:44:52 +0900 Subject: Add initial ai tool system, and 2 tools to explore --- .rules/changelog/2026-03/24/06.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .rules/changelog/2026-03/24/06.md (limited to '.rules') diff --git a/.rules/changelog/2026-03/24/06.md b/.rules/changelog/2026-03/24/06.md new file mode 100644 index 0000000..ffe233c --- /dev/null +++ b/.rules/changelog/2026-03/24/06.md @@ -0,0 +1,21 @@ +# Changelog — 2026-03-24 (06) + +## Added: AI Tool System with Tool Modal and Vault Tools + +### New Files +- **`src/tools.ts`** — Tool registry with `OllamaToolDefinition` schema, `ToolEntry` interface, and two tool implementations: + - `search_files` — case-insensitive search of vault file paths (capped at 50 results) + - `read_file` — reads full text content of a file by vault path using `cachedRead()` + - Each tool has `friendlyName`, `summarize()`, and `summarizeResult()` for UI display +- **`src/tool-modal.ts`** — `ToolModal` with toggles for each registered tool, persisted via plugin settings + +### Modified Files +- **`src/settings.ts`** — Added `enabledTools: Record` to settings +- **`src/main.ts`** — Merges tool states on load to handle new tools added to registry +- **`src/ollama-client.ts`** — Extended `ChatMessage` with `tool` role, `tool_calls`, `tool_name`. `sendChatMessage` now supports optional tools with full agent loop (up to 10 iterations). `ToolCallEvent` includes `friendlyName`, `summary`, and `resultSummary` +- **`src/chat-view.ts`** — Added wrench button (highlights when tools active), opens tool modal, passes enabled tools to chat, displays tool calls inline with: + - Friendly name header with wrench icon + - One-line summary of what the tool did + - Result summary line (e.g. "3 results found") + - Collapsible `
` for JSON args and result preview +- **`styles.css`** — Styles for tools button (active indicator), tool call blocks (accent border, summary, collapsible details), tool modal description -- cgit v1.2.3