Skip to content

Commit 102578e

Browse files
authored
Merge pull request #190 from bramses/ai-sdk-v6
AI Tool Calling with Privacy-First Human-in-the-Loop
2 parents 17c2aeb + 2cc2aa2 commit 102578e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4126
-2205
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
*.iml
66
.idea
77

8+
# nanocoder
9+
.nanocoder
10+
AGENTS.md
11+
agents.config.json
12+
813
# npm
914
node_modules
1015
npm-debug.log

CHANGELOG.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,126 @@
11
# ChatGPT MD Changelog
22

3+
## v3.0.0 (December 2025) - Privacy-First AI Tool Calling
4+
5+
### 🎯 Major Features
6+
7+
- **Privacy-First Tool Calling System**: AI assistants can now search your vault, read files, and search the web—with explicit human approval at every step
8+
- Three-layer approval architecture: approve execution → review results → approve sharing
9+
- No data reaches the LLM without your explicit consent
10+
- All tools disabled by default (opt-in feature)
11+
- **Vault Search Tool**: AI can discover relevant notes in your vault
12+
- Multi-word OR search (matches ANY query word)
13+
- Searches both filenames and file content
14+
- Interactive results review: you select which files to share
15+
- Automatically excludes current file from search results
16+
- **File Read Tool**: AI can request access to specific files
17+
- Granular file selection in approval modal
18+
- Full content reading with user consent
19+
- Batch reading support for multiple files
20+
- **Web Search Tool (Experimental)**: AI can search the web using privacy-focused Brave Search API
21+
- 1,000 free queries/month with Brave Search API
22+
- Review and filter web results before sharing
23+
- Custom search provider support for self-hosted solutions
24+
- Optional full page content fetching
25+
26+
### 🔒 Privacy & Control
27+
28+
- **Human-in-the-Loop Architecture**: Every tool call requires explicit user approval before execution and before data sharing
29+
- **Multi-Stage Approval Process**:
30+
1. Tool execution approval: see what the AI wants to do
31+
2. Results review: see what the tool found
32+
3. Selective sharing: choose exactly which results to share with AI
33+
- **Data Minimization**: Share only the specific results you approve—nothing more
34+
- **Full Transparency**: All tool requests displayed with clear descriptions of what will happen
35+
- **Audit Trail**: Debug mode logs all tool calls and decisions for troubleshooting
36+
- **Local Storage**: All API keys stored locally in Obsidian settings
37+
38+
### 🏗️ Technical Architecture
39+
40+
- **New Service Layer**:
41+
- `ToolService`: Orchestrates tool calling with approval workflow
42+
- `ToolRegistry`: Manages available tools and their configurations
43+
- `ToolExecutor`: Executes approved tools with security checks
44+
- `VaultTools`: Vault-specific tool implementations
45+
- `WebSearchService`: Web search integration with Brave Search API
46+
- `StreamingHandler`: Refactored streaming response processor
47+
- `Logger`: Comprehensive debug logging utility
48+
- **Type-Safe Tool System**: Complete TypeScript interfaces for tools, approvals, and results
49+
- **AI Service Refactoring**: All 6 AI services updated to support tool calling
50+
- OpenAI, Anthropic, Gemini, OpenRouter, Ollama, LM Studio
51+
- Consistent tool interface across all providers
52+
- Improved streaming response handling
53+
- Better error handling and user feedback
54+
55+
### 🎨 User Interface
56+
57+
- **ToolApprovalModal**: Interactive modal for approving tool execution requests
58+
- Shows tool name, parameters, and description
59+
- File selection UI for file_read tool
60+
- Clear approve/cancel actions
61+
- **SearchResultsApprovalModal**: Review and filter vault search results
62+
- Preview of found files with metadata
63+
- Multi-select interface for granular control
64+
- Shows file paths, names, and match counts
65+
- **WebSearchApprovalModal**: Review and filter web search results
66+
- Displays titles, URLs, and snippets
67+
- Multi-select interface for result filtering
68+
- Preview of web content before sharing
69+
70+
### ⚙️ Configuration & Settings
71+
72+
- **New Settings Section**: "Tool Calling" with comprehensive configuration options
73+
- Enable/disable tool calling (disabled by default)
74+
- Enable/disable web search
75+
- Brave Search API key configuration
76+
- Custom search provider support
77+
- Maximum web search results (1-10)
78+
- Debug mode for detailed logging
79+
- **Frontmatter Support**: Per-note tool calling configuration (coming soon)
80+
- **Provider Flexibility**: Use Brave Search (default) or custom search endpoints
81+
82+
### 📦 Under the Hood
83+
84+
- **40 Files Changed**: 3,632 insertions, 2,176 deletions
85+
- **Major Refactoring**: AI service implementations streamlined for tool support
86+
- **Enhanced Streaming**: Better real-time response processing with tool call handling
87+
- **Improved Error Handling**: Comprehensive error messages for tool failures
88+
- **Performance Optimizations**: Efficient vault search with configurable limits
89+
- **Code Quality**: Comprehensive TypeScript types for all tool-related functionality
90+
91+
### 🔧 Developer Experience
92+
93+
- **Debug Mode**: Detailed console logging for troubleshooting tool operations
94+
- **Extensible Architecture**: Easy to add new tools in the future
95+
- **Clear Interfaces**: Well-documented TypeScript interfaces for tool development
96+
- **Service Locator Pattern**: Consistent dependency injection for tool services
97+
98+
### 🚀 Future Roadmap
99+
100+
Potential future enhancements:
101+
102+
- Additional tools: calendar integration, task management, graph analysis
103+
- Configurable auto-approval rules for trusted tools
104+
- Tool usage analytics (local only, privacy-focused)
105+
- Batch file operations with granular control
106+
- Advanced search operators and filters
107+
108+
### 📚 Knowledge Management Benefits
109+
110+
- **Context-Aware AI**: AI can discover relevant information from your vault
111+
- **Research Augmentation**: Combine vault knowledge with web search results
112+
- **Note Discovery**: Find connections between notes you might have missed
113+
- **Enhanced Productivity**: AI with access to your knowledge base (with your permission)
114+
- **Privacy-Preserved**: Full control over what information AI sees
115+
116+
### 🎓 Use Cases
117+
118+
- **Research Assistant**: "Search my vault for notes about quantum computing and find recent papers on the topic"
119+
- **Knowledge Synthesis**: "Find all my meeting notes from Q3 and summarize the key decisions"
120+
- **Cross-Reference**: "Search for notes mentioning both machine learning and productivity"
121+
- **Web-Enhanced Writing**: "Search the web for the latest statistics on climate change and incorporate them"
122+
- **Information Retrieval**: "Find my notes on project X and tell me the current status"
123+
3124
## v2.8.1-beta (August 2025) - CORS-Free Streaming & Network Improvements
4125

5126
### 🚀 Major Network Improvements

CLAUDE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,25 @@ This file provides guidance to Claude Code when working with code in this reposi
66

77
ChatGPT MD is an Obsidian plugin that integrates multiple AI providers (OpenAI, OpenRouter, Anthropic, Gemini, Ollama, LM Studio) into Obsidian for seamless chat interactions within markdown notes. Users can have AI conversations directly in their notes, with support for note linking, streaming responses, and per-note configuration via frontmatter.
88

9+
## v3.0.0 Release - Privacy-First AI Tool Calling
10+
11+
**Latest Release**: v3.0.0 (December 2025)
12+
13+
Major new feature: **Privacy-first AI tool calling** with human-in-the-loop approval:
14+
- **Vault Search**: AI can search your notes (you approve which files to share)
15+
- **File Reading**: AI can request access to specific files (you select which ones)
16+
- **Web Search**: AI can search the web via Brave Search API (1,000 free queries/month)
17+
- **Three-Layer Approval**: Approve execution → Review results → Select what to share
18+
- **All tools disabled by default** (opt-in feature only)
19+
20+
See [`planning/code-review/`](planning/code-review/) for comprehensive code review and implementation guidance.
21+
922
## Quick Reference
1023

1124
**Entry point**: `src/main.ts``main.js`
1225

1326
**Common commands**:
27+
1428
```bash
1529
npm run dev # Development with watch mode
1630
npm run build # Production build with TypeScript checks
@@ -21,6 +35,7 @@ npm run lint:fix # Auto-fix linting issues
2135
## Architecture Overview
2236

2337
The plugin uses **Service Locator pattern** for dependency injection:
38+
2439
- `src/core/ServiceLocator.ts` - Central DI container
2540
- `src/core/CommandRegistry.ts` - Manages all Obsidian commands
2641
- AI services implement `IAiApiService` interface
@@ -30,6 +45,7 @@ The plugin uses **Service Locator pattern** for dependency injection:
3045
## Code Organization
3146

3247
Each directory has its own CLAUDE.md with detailed context that auto-loads when you work in that area:
48+
3349
- `src/core/` - Core infrastructure (ServiceLocator, CommandRegistry)
3450
- `src/Services/` - Service implementations
3551
- `src/Views/` - UI components
@@ -38,6 +54,7 @@ Each directory has its own CLAUDE.md with detailed context that auto-loads when
3854
## Cross-cutting Documentation
3955

4056
For topics that span multiple areas:
57+
4158
- **[docs/development.md](docs/development.md)** - Build process, tooling, esbuild setup
4259
- **[docs/message-flow.md](docs/message-flow.md)** - Complete flow from user input to AI response
4360

README.md

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,42 @@
44

55
![Chatting with links about vacation plans](images/chat-with-link.gif)
66

7-
## What's New in v2.8.0 🚀
8-
### 🆕 GPT-5 Model Support
9-
10-
- **Latest OpenAI Models**: Full support for OpenAI's newest GPT-5 family:
11-
- `gpt-5` - The flagship model with enhanced reasoning capabilities
12-
- `gpt-5-mini` - Optimized for speed and efficiency
13-
- `gpt-5-nano` - Ultra-lightweight for quick responses
14-
- `gpt-5-chat-latest` - Always-updated chat model
15-
- **Smart Token Management**: Enhanced handling of token limit responses for more reliable interactions
16-
- **Performance Optimizations**: Refined message service architecture and improved API integration
7+
## 🚀 What's New in v3.0.0: Privacy-First AI Tool Calling
8+
9+
**Your AI assistant can now search your vault, read files, and search the web—with explicit approval at every step.**
10+
11+
### Key Features
12+
13+
- **🔍 Vault Search**: AI discovers relevant notes in your vault (you approve which files to share)
14+
- **📄 File Reading**: AI can request access to specific files (you select which ones)
15+
- **🌐 Web Search**: AI searches the web via Brave Search API (1,000 free queries/month)
16+
- **✅ Three-Layer Approval System**:
17+
1. Approve what the AI wants to do
18+
2. Review what it found
19+
3. Select exactly which results to share
20+
- **🔒 Privacy-First Design**: No data reaches the AI without your explicit consent
21+
- **🎯 All Providers Supported**: OpenAI, Anthropic, Gemini, OpenRouter, Ollama, LM Studio
22+
- **⚙️ Disabled by Default**: Opt-in feature only—enable in Settings → Tool Calling
23+
24+
### Why This Matters
25+
26+
For privacy-conscious note-takers, this is a game-changer. You get the power of AI with full control over your data. Your vault stays yours.
27+
28+
### Getting Started with Tool Calling
29+
30+
1. **Install the beta**: Use [BRAT plugin](https://github.com/TfTHacker/obsidian42-brat) and select version **2.12.0-beta**
31+
2. **Enable in settings**: Go to Settings → ChatGPT MD → Tool Calling
32+
3. **Optional**: Add Brave Search API key for web search (1,000 free queries/month)
33+
4. **Start chatting**: Your AI will ask for approval when it wants to use tools
34+
35+
⚠️ **Beta Warning**: Test on a backup/test vault first. This is a beta release with active development.
36+
37+
### Use Cases
38+
39+
- **Research Assistant**: "Search my vault for notes about quantum computing and find recent papers"
40+
- **Knowledge Synthesis**: "Find all my Q3 meeting notes and summarize key decisions"
41+
- **Web-Enhanced Writing**: "Search the web for latest statistics and incorporate them"
42+
- **Note Discovery**: "Find connections between notes I might have missed"
1743

1844
## A simple and quick Start 🏁
1945
Get started in just a few simple steps:

0 commit comments

Comments
 (0)