Commit Graph

49 Commits

Author SHA1 Message Date
fegger b7b3a185a0 Add automatic folder creation for file operations and improve chat session handling
Implement `ensureFolderExists` in `ToolExecutor` to create parent directories when creating, moving, or renaming notes.
Update `ChatView` to properly persist agent mode and derive session titles from the first user message. Fix error
handling in tool execution to return structured failures instead of null, and include failure details in follow-up
messages.
2026-05-21 20:35:05 +02:00
fegger d330b94816 Add stop button to cancel in-flight requests
Swap the Send button for a Stop button while a response is streaming, letting users abort the current operation cleanly.
Cancelled requests now display "Stopped." instead of an error message.

Also includes two smaller fixes: preserve the original assistant text and full tool_calls array when executing write
tools for follow-up context, and add 'research' to agentic modes.
2026-05-21 18:30:43 +02:00
fegger 3d9be7dfdb Simplify tool call nudging and refine action detection
Replace the 3-attempt retry loop with a single nudge when the model
explicitly mentioned taking action. Remove misleading nudges for models
that never expressed intent, which wasted round-trips and confused
responses. Also streamline the userWantsVaultOps phrase list to remove
weak triggers like "ok", "yes", and "please", and add fallback content
for empty responses.
2026-05-21 17:45:00 +02:00
fegger c2c2d51da5 Add recursive tool call handling with depth limit
This commit adds support for multi-turn tool calling by making processToolCalls
recursive. Previously, follow-up LLM responses that included additional tool
calls would drop those calls and present the text response instead.

Key changes:
- processToolCalls now accepts a depth parameter (default 0)
- Recurses when follow-up responses contain more tool_calls, up to MAX_TOOL_CALL_DEPTH
- Adds MAX_TOOL_CALL_DEPTH constant set to 5 to prevent infinite loops
- Clears pending actions only after processing is complete or before recursing
- Fixes new-chat container flex layout in styles.css to wrap and start from left

I need to write a clean git commit message for this diff. Let me analyze what changed:

1. In `main.js` and `src/chat-view.ts`:
   - `processToolCalls` now has a `depth` parameter with default `0`
   - Added `MAX_TOOL_CALL_DEPTH = 5` constant
   - Added depth check at start of `processToolCalls`
   - When follow-up LLM calls return more tool calls, it now recursively calls `processToolCalls` instead of ignoring
     them
   - `clearPendingActions()` moved around to be called at appropriate times
   - Some variable renames from `finalResponse` to `followUpContent` for clarity

2. In `styles.css`:
   - `.ollama-new-chat-container` changed from `justify-content: flex-end` to `flex-wrap: wrap; justify-content:
     flex-start`

The main feature is recursive/multi-turn tool calling with a depth limit. The CSS change seems like a minor UI fix
included in the same commit.

Subject line ideas:
- "Add recursive tool call handling with depth limit" (47 chars) - good
- "Support multi-turn tool calls with depth limit" (46 chars) - good
- "Add recursive tool calls and depth limit" (41 chars) - good
- "Implement recursive tool calling with depth limit" (47 chars) - good

Wait, I also need to mention the CSS change? It's minor but part of the commit. However, usually the subject should
capture the main change. If there are multiple unrelated changes, sometimes people mention them, but here the CSS change
seems minor enough that it could be in the body or omitted if not important. Actually looking at the diff, the CSS
change is just adjusting flex properties. It might be related to UI changes needed for the tool call flow, or it could
be an unrelated fix piggybacking.

Actually, the prompt says "write a short clear commit message that summarizes the changes." If I can express it in the
subject line, don't include body. But this seems like a significant enough change that a body might help explain the
"why" and key details.

Let me think about the body. The key points:
- Makes `processToolCalls` recursive to handle follow-up tool calls
- Adds `MAX_TOOL_CALL_DEPTH` (5) to prevent infinite recursion
- Previously, follow-up responses containing tool_calls would drop them
- Also fixes new-chat container layout

Subject: Add recursive tool call handling with depth limit (47 chars)

Body:
Support multi-turn tool calling by recursing in processToolCalls when
follow-up LLM responses contain additional tool_calls. Previously these
were ignored and the text response was shown instead.

Add MAX_TOOL_CALL_DEPTH constant set to 5 to prevent infinite loops.
Clear pending actions at the appropriate recursion boundaries.

Fix new-chat container flex layout to wrap and align left.

Wait, I should check if "Add recursive tool call handling with depth limit" is clear enough. Yes.

Let me count chars:
"Add recursive tool call handling with depth limit"
A-d-d- -r-e-c-u-r-s-i-v-e- -t-o-o-l- -c-a-l-l- -h-a-n-d-l-i-n-g- -w-i-t-h- -d-e-p-t-h- -l-i-m-i-t
3+1+9+1+4+1+4+1+9+1+4+1+5+1+5 = let's just count: "Add" (3) + " " (1) + "recursive" (9) + " " (1) + "tool" (4) + " " (1)
+ "call" (4) + " " (1) + "handling" (8) + " " (1) + "with" (4) + " " (1) + "depth" (5) + " " (1) + "limit" (5) =
3+1+9+1+4+1+4+1+8+1+4+1+5+1+5 = 48 chars. Good.

Actually, looking more carefully at the code:
- The depth check is added
- Recursion is added
- clearPendingActions is moved
- The CSS change is there

Is the body useful? Yes, it explains the behavioral change and why. But maybe I can keep it shorter.

Actually, looking at the instructions again: "If you can accurately express the change in just the subject line, don't
include anything in the message body."

Hmm. This is a fairly complex change. But the subject line "Add recursive tool call handling with depth limit" does
accurately express the main change. The CSS change is minor. However, there are enough details (the depth limit of 5,
the recursion aspect, the fact that it handles follow-up tool calls) that a brief body might be useful to someone
looking at the commit log.

But the instructions also say "Only use the body when it is providing *useful* information" and "Don't repeat
information from the subject line in the message body."

If I use the subject line I proposed, what useful info could the body add?
- The depth limit value (5)
- That it affects follow-up LLM responses
- The CSS fix

Actually, I think a body is appropriate here because the change is not entirely captured by just knowing it's
"recursive" - the fact that it previously dropped tool calls on follow-up is useful context (the "why").

Let me draft:

Add recursive tool call handling with depth limit

When follow-up LLM responses contain additional tool_calls, recurse in
processToolCalls instead of ignoring them. Add MAX_TOOL_CALL_DEPTH
constant set to 5 to prevent infinite loops. Move clearPendingActions
to appropriate recursion boundaries. Fix new-chat container flex layout
to wrap and align left.

Wait, I should check line wrapping. Max 72 chars.

Line 1: "Add recursive tool call handling with depth limit"
Line 2: (blank)
Line 3: "When follow-up LLM responses contain additional tool_calls, recurse in"
Line 4: "processToolCalls instead of ignoring them. Add MAX_TOOL_CALL_DEPTH"
Line 5: "constant set to 5 to prevent infinite loops. Move clearPendingActions"
Line 6: "to appropriate recursion boundaries. Fix new-chat container flex layout"
Line 7: "to wrap and align left."

Let me check lengths:
Line 3: "When follow-up LLM responses contain additional tool_calls, recurse in" = 70 chars. Good.
Line 4: "processToolCalls instead of ignoring them. Add MAX_TOOL_CALL_DEPTH" = 67 chars. Good.
Line 5: "constant set to 5 to prevent infinite loops. Move clearPendingActions" = 69 chars. Good.
Line 6: "to appropriate recursion boundaries. Fix new-chat container flex layout" = 69 chars. Good.
Line 7: "to wrap and align left." = 23 chars. Good.

Actually, should I mention processToolCalls specifically? It's a detail but useful.

Alternative body:
Support multi-turn tool calling by recursing when follow-up responses
contain additional tool_calls. Previously these were discarded and the
text response was shown instead. Add MAX_TOOL_CALL_DEPTH constant set
to 5. Also fix new-chat container flex layout.

Length check:
"Support multi-turn tool calling by recursing when follow-up responses" = 67
"contain additional tool_calls. Previously these were discarded and the" = 70
"text response was shown instead. Add MAX_TOOL_CALL_DEPTH constant set" = 69
"to 5. Also fix new-chat container flex layout." = 46

I think this is clearer. But does it repeat the subject? The subject says "Add recursive tool call handling" and the
body says "Support multi-turn tool calling by recursing..." - that's similar but explains the mechanism, not repeating
per se.

Actually, I could also make the subject slightly different to be more specific:
"Add multi-turn tool call recursion with depth limit"

Then body:
When follow-up LLM responses contain additional tool_calls, recurse in
processToolCalls rather than discarding them. Add MAX_TOOL_CALL_DEPTH
constant set to 5. Move clearPendingActions to correct boundaries.
Also fix new-chat container flex layout.

Hmm. "Add multi-turn tool call recursion with depth limit" is 49 chars. Good.

Actually, looking at the diff again, the most important thing is that `processToolCalls` now recurses. Let me make sure
I capture that.

Another option: The commit could be split conceptually, but since it's one diff, we summarize all changes.

Final decision:

Subject: Add recursive tool call handling with depth limit

Body:
When follow-up LLM responses contain additional tool_calls, recurse in
processToolCalls instead of ignoring them. Add MAX_TOOL_CALL_DEPTH
constant set to 5 to prevent infinite loops. Move clearPendingActions
to appropriate recursion boundaries. Fix new-chat container flex layout
to wrap and align left.

Wait, I want to make sure I don't exceed 72 chars per line in the body.

Line 1: When follow-up LLM responses contain additional tool_calls, recurse in
Count: W(1)h(2)e(3)n(4) (5)f(6)o(7)l(8)l(9)o(10)w(11)-(12)u(13)p(14) (15)L(16)L(17)M(18)
(19)r(20)e(21)s(22)p(23)o(24)n(25)s(26)e(27)s(28) (29)c(30)o(31)n(32)t(33)a(34)i(35)n(36)
(37)a(38)d(39)d(40)i(41)t(42)i(43)o(44)n(45)a(46)l(47) (48)t(49)o(50)o(51)l(52)_(53)c(54)a(55)l(56)l(57)s(58),(59)
(60)r(61)e(62)c(63)u(64)r(65)s(66)e(67) (68)i(69)n(70) = 70 chars. OK.

Line 2: processToolCalls instead of ignoring them. Add MAX_TOOL_CALL_DEPTH
p(1)r(2)o(3)c(4)e(5)s(6)s(7)T(8)o(9)o(10)l(11)C(12)a(13)l(14)l(15)s(16) (17)i(18)n(19)s(20)t(21)e(22)a(23)d(24)
(25)o(26)f(27) (28)i(29)g(30)n(31)o(32)r(33)i(34)n(35)g(36) (37)t(38)h(39)e(40)m(41).(42) (43)A(44)d(45)d(46)
(47)M(48)A(49)X(50)_(51)T(52)O(53)O(54)L(55)_(56)C(57)A(58)L(59)L(60)_(61)D(62)E(63)P(64)T(65)H(66) = 66 chars. OK.

Line 3: constant set to 5 to prevent infinite loops. Move clearPendingActions
c(1)o(2)n(3)s(4)t(5)a(6)n(7)t(8) (9)s(10)e(11)t(12) (13)t(14)o(15) (16)5(17) (18)t(19)o(20)
(21)p(22)r(23)e(24)v(25)e(26)n(27)t(28) (29)i(30)n(31)f(32)i(33)n(34)i(35)t(36)e(37) (38)l(39)o(40)o(41)p(42)s(43).(44)
(45)M(46)o(47)v(48)e(49)
(50)c(51)l(52)e(53)a(54)r(55)P(56)e(57)n(58)d(59)i(60)n(61)g(62)A(63)c(64)t(65)i(66)o(67)n(68)s(69) = 69 chars. OK.

Line 4: to appropriate recursion boundaries. Fix new-chat container flex layout
t(1)o(2) (3)a(4)p(5)p(6)r(7)o(8)p(9)r(10)i(11)a(12)t(13)e(14) (15)r(16)e(17)c(18)u(19)r(20)s(21)i(22)o(23)n(24)
(25)b(26)o(27)u(28)n(29)d(30)a(31)r(32)i(33)e(34)s(35).(36) (37)F(38)i(39)x(40)
(41)n(42)e(43)w(44)-(45)c(46)h(47)a(48)t(49) (50)c(51)o(52)n(53)t(54)a(55)i(56)n(57)e(58)r(59) (60)f(61)l(62)e(63)x(64)
(65)l(66)a(67)y(68)o(69)u(70)t(71) = 71 chars. OK.

Line 5: to wrap and align left.
t(1)o(2) (3)w(4)r(5)a(6)p(7) (8)a(9)n(10)d(11) (12)a(13)l(14)i(15)g(16)n(17) (18)l(19)e(20)f(21)t(22).(23) = 23 chars.
OK.

This looks good. But I should double check: does the body provide useful info not in the subject? Yes, it explains the
specific behavior change (recursing instead of ignoring), the constant name and value, and the CSS fix.

Actually, should I include the CSS fix in the body? It's part of the diff. If I omit it, the
2026-05-21 17:08:45 +02:00
fegger 624df32c37 Add model change callback and improve chat UI robustness
- Persist selected model to settings when changed via dropdown
- Reorder chat controls: model selector before mode selector, new chat before delete
- Add null guards for modelSelectorEl during async populate
- Fix streaming state and empty response handling in tool nudge loop
- Expand vault operation keyword detection
- Enable text selection in chat messages
- Include original error message in chat error display
2026-05-21 16:47:08 +02:00
fegger f6edc321e3 Add Ollama model selector dropdown and improve automatic tool detection
- Add `listModels()`, `setModel()`, and `getModel()` methods to `OllamaClient`
- Populate model dropdown in chat view from `/api/tags` endpoint
- Synchronize model selection across main and agent clients
- Detect user intent for vault operations from message content
- Expand action phrase matching for `shouldAutoRunReadTools()`
- Streamline retry logic and suppress "Let me..." text with actual tool calls
- Improve fallback search query generation by removing more filler words
2026-05-21 16:31:15 +02:00
fegger 51208e2031 Restructure chat input layout and fix activity indicator sizing
Move send button after activity indicator in DOM order and reposition
elements via CSS. Set textarea rows to 3, increase min/max heights,
add flex-shrink to activity dot to prevent squishing, and fix
activity indicator padding and white-space handling.
2026-05-21 15:18:49 +02:00
fegger 99a644ba96 Strengthen tool-calling discipline with retries and automatic fallback
Expand CRITICAL RULE instructions across edit, organize, and research agent
modes to explicitly prohibit planning language, reasoning, apologies, and
permission-seeking. Replace generic follow-up text with empty content when
tool calls are emitted.

Add a retry loop (up to 3 attempts) that suppresses text-only responses
and re-prompts the model to emit tool_calls immediately. If the model
still fails to call tools after retries, fall back to automatically
generated read tool calls based on the user's message intent.
2026-05-21 15:09:40 +02:00
fegger 949e7d77ff Add activity indicator for chat operations
Shows a pulsing dot with status text during workflow execution, LLM
thinking, and tool use. Disables the input and send button while active
to prevent duplicate submissions. Also restructures the chat layout to
use flexbox with the input container locked at the bottom.
2026-05-21 10:48:07 +02:00
fegger db96858222 Add automatic read tool execution for non-action assistant responses
Replace manual intent phrase matching with dedicated helpers that detect
when the assistant wants to use tools but didn't emit tool calls. When
detected, automatically build and execute read-only tool calls based on
the user's original message instead of nudging the model again.

This reduces back-and-forth latency for organize and research modes by
directly querying vault stats, tags, and files when the assistant
expresses intent like "let me read" or "I will check" but fails to
actually call tools.

Includes tests for the new auto-run behavior in organize mode.
2026-05-21 10:39:22 +02:00
fegger e7b753014c Add chat session history with dropdown UI
Implement persistent chat history using a new ChatHistoryManager class.
Sessions are saved on view close, restored on open, and selectable via a
dropdown in the chat header. Includes delete and clear-all commands,
with automatic title generation from the first user message.
2026-05-21 10:36:55 +02:00
fegger 5c2078aebb Strengthen tool-calling discipline and add auto-nudge fallback
Tighten system prompts across edit, organize, and research modes to
prohibit "Let me..." / "I will..." prefatory text and require immediate
tool_call emission. Remove stale instructions referencing deleted tools.
Improve search_vault_files description for LLM clarity. Add runtime
auto-nudge: if a tool-capable mode emits no tool_calls but language
suggests intent to act, re-prompt the model to emit the required calls.
2026-05-21 10:23:53 +02:00
fegger af9f0d165a Add list_vault_tags and get_vault_stats tools to all agent modes
Extend the tool registry to support vault-wide tag listing and statistical
overview tools, adding them to READ, EDIT, ORGANIZE, and RESEARCH agent
modes. Includes implementations for tag aggregation, folder structure
reporting, and metadataCache integration in VaultIndexer.
2026-05-21 10:08:05 +02:00
fegger 5350df92dd Add in-app debug log panel and rich vault search
- Add listener/history API to Logger for live log streaming
- Add toggle button and styled log panel to chat view
- Enhance ToolExecutor to use VaultIndexer for rich search results
- Instruct all agent modes to emit tool calls immediately instead of describing intent
2026-05-21 09:37:46 +02:00
fegger 68ac64cc02 Refactor conversation state to use dynamic system prompts
Move system prompt management from ChatView into ConversationStateManager,
ensuring the system prompt stays synchronized with the current agent mode.
Replace hardcoded default prompts with a shared constant and add setSystemPrompt
to support live updates when switching modes. Clean up minor formatting issues.
2026-05-21 09:09:55 +02:00
fegger 96f201bf3f Add dual-model support with separate chat and agent models
Split the single model setting into `chatModel` and `agentModel` to allow
using different LLMs for conversational modes (Ask, Research) versus
agentic modes (Edit, Organize, Workflow, auto-organizer). Defaults are
`deepseek-v4-flash` for chat and `glm-5.1` for agents.

Includes backward compatibility migration from legacy `model` field,
updated settings UI, per-mode tool filtering via new `agent-modes.ts`
configs, and vault search scoring improvements (exact phrase, recency,
filename bonuses).
2026-05-21 09:00:11 +02:00
fegger ae747a4470 Update README with new features and fix streaming state cleanup
Expand documentation for agent modes, workflows, auto-organizer, structured memory, tool telemetry, and enhanced context
sources. Set `isThinking` to false when finalizing assistant messages to ensure UI state resets correctly.
2026-05-20 23:25:07 +02:00
fegger f1afba70ff Add structured memory injection and telemetry tracking
- Introduce buildMessagesWithMemory() to prepend memory context as a system
  message before LLM calls
- Record LLM call telemetry (tokens, duration) for follow-up requests in
  both streaming and non-streaming paths
- Add telemetry coverage for tool execution (success/failure, args,
  duration)
- Update tool-executor tests to verify telemetry integration with
  TelemetryManager
2026-05-20 22:46:42 +02:00
fegger f98afcd6b0 Add tool telemetry tracking for LLM calls and vault searches
Introduces TelemetryManager to record tool calls, LLM token usage
(prompt_eval_count, eval_count), and vault search queries with timing.
Wires telemetry through ChatView, ToolExecutor, and OllamaClient with
configurable limits and enable/disable toggle.
2026-05-20 22:32:15 +02:00
fegger fbb744ba6b Add structured memory system for persistent agent context
Implements `StructuredMemoryManager` to track conversation summaries,
user preferences, and learned facts across sessions. Includes:
- Configurable storage limits with automatic enforcement
- Heuristic extraction of preferences and facts from messages
- Memory context injection into system prompts
- Full test coverage for all manager operations
2026-05-20 22:18:33 +02:00
fegger 2db7c34920 Add configurable agent modes with per-mode tool filtering
Introduces `ask`, `edit`, `organize`, `research`, and `workflow` modes.
Each mode defines its own system prompt, allowed tools, and preview
requirements. The active mode can be switched via a dropdown in the
chat UI and defaults can be set in plugin settings. Mode selection
affects which tools are exposed to the LLM and whether write actions
require user preview before execution.
2026-05-20 21:49:41 +02:00
fegger 106abfa718 Integrate Obsidian metadataCache across extraction and tooling
Replaces regex-based parsing of frontmatter and headings with
Obsidian's metadataCache where available, falling back to regex
when the cache is unavailable. Propagates App dependency through
constructors to enable cache access.

Key changes:
- ContentExtractor accepts optional cache for frontmatter/headings
- ToolExecutor uses cache for section replacement and frontmatter
- NoteContextBuilder resolves titles/tags from cache
- VaultVectorStore passes cache through indexing pipeline
- AutoTagger checks cache for existing tags instead of content
- Mock updated with metadataCache stubs for tests
2026-05-20 20:36:47 +02:00
fegger 3abacb5d6e Add NoteContextBuilder for enhanced chat context gathering
Introduces NoteContextBuilder to extract explicit wikilink mentions,
detect scope intent, and gather contextual note data including
backlinks, outlinks, and related notes. Integrates into ChatView
and adds comprehensive unit tests.

Also includes minor type fixes: removes unnecessary `as` cast in
action-preview-builder, fixes non-null assertion in tool-executor,
and cleans up unused import in auto-organizer. Simplifies auto-tag
command callback by removing redundant async/await.
2026-05-20 19:17:42 +02:00
fegger 64ee7763fe Add workflow command support to chat view
Integrate WorkflowEngine into ChatView to handle `/workflow` commands.
When a message starts with `/workflow`, the workflow engine generates
and executes a multi-step plan instead of the standard chat flow.
Results are formatted with step-by-step status and output display.

Includes workflow result formatting, assistant message updates, and
short-term context tracking. Tests verify command parsing and engine
invocation.
2026-05-20 18:58:21 +02:00
fegger 158d5f68e6 Add action preview builder for write tool confirmation
Introduces `ActionPreviewBuilder` to generate before/after previews for
destructive operations. Write tools are now deferred with apply/cancel
UI instead of executing immediately. Includes `ProposedAction` type,
CSS for diff views, and state management in `ChatView`.
2026-05-20 18:36:00 +02:00
fegger 95a6954b50 Add vault note management tools
Expand the tool executor with create_note, append_to_note, replace_note_section,
update_frontmatter, rename_note, move_note, delete_note, and insert_link tools.
Rename create_file to create_note for consistency and add helper methods for
common file operations. Update tests to cover the new tools and renamed
functionality.
2026-05-20 18:19:09 +02:00
fegger 8e338afeac feat: increase vault context limits and make them configurable
- Replace hardcoded 2000-char context limit with configurable maxContextLength
  setting (default: 8000 characters)
- Increase vaultSearchLimit default from 3 to 5 notes
- Add 'Max Context Length' setting to plugin settings UI
- Update README with new defaults
- Update chat-view tests for new setting
2026-05-20 01:20:49 +02:00
fegger f09e134948 fix: include tags in vault context sent to AI and update system prompt
- chat-view.ts: include 'Tags: ...' prefix in vault context when tags exist
- chat-view.ts: update system prompt to instruct AI to pay attention to tags
  when organizing or categorizing notes
2026-05-20 01:13:40 +02:00
fegger fae74ade95 feat: add semantic/RAG vault indexing with automatic background sync
- Add VaultVectorStore backed by ChromaDB for vector-based vault search
- Integrate existing ContentVectorizer/IndexingPipeline for embeddings
- Update VaultIndexer to prefer semantic search with keyword fallback
- Background indexing on plugin load + incremental sync via vault events
- Add vault index settings, commands, and UI controls
- Add tests for VaultVectorStore
- Update README with RAG setup instructions
2026-05-19 23:00:04 +02:00
fegger 6c438f7a4d fix: remove artificial MAX_STREAM_CHUNKS limit that cut off long responses
The plugin hard-capped streaming responses at 1000 chunks. For large
models like qwen2.5:32b generating detailed answers, this limit was
easily exceeded, causing the response to stop mid-sentence.

The Ollama stream already terminates naturally when the model sends the
final done signal, so the artificial chunk limit served no purpose.

- src/chat-view.ts: Remove chunkCount tracking and MAX_STREAM_CHUNKS
  constant. Let the stream run until Ollama signals completion.
2026-05-19 21:24:38 +02:00
fegger 70bf963f28 feat: add thinking indicator while model is generating
- src/types.ts: Add isThinking flag to ChatMessage to track transient
  'model is working' state.

- src/chat-view.ts: Set isThinking: true on the assistant placeholder
  message when user sends input. Clear it when the first stream chunk
  arrives or on error. Update render() to show a spinner + 'Thinking…'
  text while isThinking is active.

- styles.css: Add ollama-thinking-indicator class with a CSS spinner
  animation and muted italic text styling.
2026-05-19 21:21:47 +02:00
fegger 810676ff21 feat: add Ollama icon and modern chat UI styling
- src/chat-view.ts: Add getIcon() returning 'bot' for the view tab icon.
  Improve render() with role-specific CSS classes (user vs assistant) and
  message header structure for better styling hooks.

- src/main.ts: Add ribbon icon ('bot') in the left sidebar that opens the
  chat view with a single click.

- styles.css (new): Modern chat UI with message bubbles, distinct user and
  assistant themes using Obsidian CSS variables, sticky input bar, styled
  send button with accent color, and emoji role indicators.

- install.sh: Copy styles.css into the plugin directory and verify its
  presence during installation.

- README.md: Include styles.css in manual install instructions.

- __mocks__/obsidian.ts: Add addRibbonIcon() mock for test compatibility.

- tests/chat-view.test.ts: Add getIcon() assertion.
2026-05-19 21:18:56 +02:00
fegger 771db09d24 Refactor chat view and add conversation state management
Introduce ConversationStateManager to handle short, medium, and long-term
context for improved conversation flow. Update ChatView to use this manager
and refactor input handling to accept values directly for better testability.

Update OllamaClient with non-streaming chat support and improved error
handling for malformed chunks. Enhance vault indexer with caching, better
scoring, and stop word filtering. Refactor main plugin entry point and
semantic cache initialization for robustness.
2026-05-08 11:52:31 +02:00
fegger fff98d1a2e Merge branch 'modularize-indexing-pipeline' 2026-05-07 23:45:31 +02:00
fegger ae16396a7a Integrate semantic cache with ChromaDB URL 2026-05-07 22:47:32 +02:00
fegger 179a58b95b Add semantic cache support using ChromaDB 2026-05-07 22:47:01 +02:00
fegger b37aaeb4d4 Add semantic cache support using ChromaDB 2026-05-07 20:53:28 +02:00
fegger 4fabf1df98 Refactor lint config and retry logic 2026-05-07 14:44:59 +02:00
fegger 9823761e03 Implement stream cancellation in OllamaClient
Add `cancelStream` method to allow aborting active requests. Store the current `AbortController` on the client instance
and reset it when the stream completes or is cancelled. Update `ChatView` to call `cancelStream` on close.

Add comprehensive tests for stream cancellation scenarios, including aborting active requests, handling cancellation
when no stream is active, clearing the controller after normal completion, and allowing new streams after cancellation.
2026-05-07 12:11:01 +02:00
fegger 45993bea67 ```
Remove stream cancellation logic and refactor controller usage

Update coverage reports and tests to reflect changes
```
2026-05-07 00:59:17 +02:00
fegger 0920e0959e Refactor message handling and remove result limit in vault indexing 2026-05-06 22:45:03 +02:00
fegger 579e60f5d5 ```
Increase test coverage across multiple modules (91.2% statements, 82.85% branches, 82.35% functions, 93.1% lines)

Update abort controller handling in OllamaClient to properly clean up previous controllers

Remove unused imports and constants: MODEL_NAME_REGEX, MouseEvent, DEFAULT_SETTINGS, convertMarkdownToHtml

Refactor event handler naming to be more consistent
```
2026-05-06 22:30:29 +02:00
fegger ccb0603d0c Update streaming handling and improve model validation
Add MAX_STREAM_CHUNKS constant and update message handling to mark streaming as complete even without tool results.
Improve model name validation to support colons and add comprehensive test suite. Refactor VaultIndexer to simplify
constructor and remove unused methods. Fix path normalization in tool executor and remove unused safeWriteFile export.
Update error handling to remove redundant console suppressions.
2026-05-06 21:48:27 +02:00
fegger 0a0173363b Add MAX_STREAM_CHUNKS constant for streaming control
Improve path validation to detect parent directory traversal
Refactor VaultIndexer to use VaultLike interface
Enhance heading matching to support 1-6 level headings
Improve token stemming with length-based checks
Optimize context building for user messages
2026-05-06 19:58:26 +02:00
fegger d57ade0ba8 Update coverage reports and improve error handling 2026-05-06 19:28:40 +02:00
fegger 2968932d69 Add error handler and improve coverage 2026-05-06 18:24:24 +02:00
fegger fd49abcdb9 Refactor error handling, client, and tests for Ollama integration 2026-05-06 16:30:16 +02:00
fegger 59df2f6856 Refactor Ollama client and related components
Update error handling and improve streaming capabilities in the Ollama client and related components. Key changes
include:

- Simplify error types and improve error handling
- Refactor streaming logic to use async generators
- Update tool execution and vault indexing
- Improve utility functions and types
- Update test files to reflect changes
2026-05-05 17:09:16 +02:00
fegger f638b06a86 initial commit 2026-05-04 22:05:10 +02:00