# Changelog

All notable changes to the Mojentic Rust implementation will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.4.0] - 2026-05-11

### Added

- `max_tool_iterations` field on `CompletionConfig` (default `10`) — bounds recursive tool-calling in both `generate` and `generate_stream`; returns `MojenticError::MaxToolIterationsExceeded` when the limit is reached. Previously both paths could recurse without bound on repeated tool-call responses.
- Integration test exercising the OpenAI tool-calling HTTP round-trip (assistant tool-call → tool result → final response), backed by a shared fixture set used across all four mojentic ports.

### Changed

- `SimpleRecursiveAgent` completion detection requires a strict whole-string match for `DONE`/`FAIL` (case-insensitive, trimmed); responses that merely contain those words as substrings no longer trigger completion.

### Fixed

- `AsyncDispatcher::wait_for_empty_queue` could return while agent handlers were still in flight; it now waits for both the queue to drain and all in-flight handlers to complete.
- Asynchronous event-handler errors and panics in `SimpleRecursiveAgent` were swallowed, leaving `solve` to hang until its timeout; handler errors now surface via `MojenticError::HandlerError`.

## [1.3.0] - 2026-04-11

### Changed

- `TokenizerGateway::encode()` now returns `Vec<u32>` instead of `Vec<usize>` (aligns with tiktoken-rs 0.11 API)
- `TokenizerGateway::decode()` now accepts `&[u32]` instead of `&[usize]`
- `WebSearchTool` uses regex-based HTML parsing instead of `scraper` crate for lighter dependencies
- Updated `reqwest` from 0.12 to 0.13
- Updated `schemars` from 0.8 to 1.0
- Updated `thiserror` from 1.0 to 2.0
- Updated `tiktoken-rs` from 0.5 to 0.11

### Removed

- `dotenv` dependency (was unused)
- `scraper` dependency (replaced with regex-based parsing in `WebSearchTool`)
- `urlencoding` dependency (replaced with `percent-encoding`)

## [1.2.0] - 2026-02-05

### Added

- `ReasoningEffort` enum (`Low`, `Medium`, `High`) for controlling model thinking depth
- `reasoning_effort` field on `CompletionConfig` for reasoning effort control
  - Ollama gateway: maps to `think: true` parameter for extended thinking
  - OpenAI gateway: maps to `reasoning_effort` API parameter for reasoning models
- `thinking` field on `LlmGatewayResponse` for model reasoning traces (populated by Ollama)

## [1.1.0] - 2026-02-05

### Added

- API endpoint support flags on `ModelCapabilities`: `supports_chat_api`, `supports_completions_api`, `supports_responses_api`
  - Indicates which OpenAI API endpoints each model supports (Chat, Completions, Responses)
  - Populated for all registered models based on endpoint audit data
- New models: `babbage-002`, `davinci-002`, `gpt-5.1-codex-mini`, `codex-mini-latest`

### Fixed

- `gpt-3.5-turbo-instruct` models now correctly flagged as completions-only (not chat-capable)

## [1.0.1] - 2026-02-01

### Added

- `ChatSession::send_stream()` method for streaming responses with automatic conversation history management
  - Returns `Pin<Box<dyn Stream<Item = Result<String>>>>` yielding chunks in real-time
  - Automatically records user message and assembled assistant response in conversation history
  - Supports tool calling through broker's recursive streaming
  - Respects context window limits

## [1.0.0] - 2025-11-27

### 🎉 First Stable Release

This release marks the first stable version of Mojentic for Rust, released simultaneously across all four language implementations (Python, Elixir, Rust, and TypeScript) with full feature parity.

### Highlights

- **Complete LLM Integration Layer**: Broker, OpenAI + Ollama gateways, structured output, tool calling, streaming with recursive tool execution, image analysis, tokenizer, embeddings
- **Full Tracer System**: Event recording, correlation tracking, event filtering, broker/tool integration
- **Complete Agent System**: Base agents, async agents, event system, dispatcher, router, aggregators, iterative solver, recursive agent, ReAct pattern, shared working memory
- **Comprehensive Tool Suite**: DateResolver, File tools (8 tools), Task manager, Tell user, Ask user, Web search, Current datetime, Tool wrapper (broker as tool)
- **24 Examples**: Full example suite demonstrating all major features
- **Type Safety**: Compile-time guarantees with Rust's type system

### Added

#### Layer 1: LLM Integration
- `LlmBroker` - Main interface for LLM interactions with recursive tool calling
- `LlmGateway` trait - Abstract interface for LLM providers
- `OllamaGateway` - Full Ollama implementation with async streaming
- `OpenAiGateway` - OpenAI gateway implementation
- `ChatSession` - Conversational session management
- `TokenizerGateway` - Token counting with tiktoken-rs
- `EmbeddingsGateway` - Vector embeddings support
- Async streaming with `Pin<Box<dyn Stream>>`

#### Layer 2: Tracer System
- `TracerSystem` - Event recording with thread-safe access
- `EventStore` - Event persistence and querying
- `TracerEvent` variants for LLM calls, responses, and tools
- Correlation ID tracking with `Arc` sharing

#### Layer 3: Agent System
- `BaseLlmAgent` - LLM-enabled agent foundation
- `AsyncLlmAgent` - Async agent with tokio runtime
- `AsyncAggregatorAgent` - Result aggregation
- `IterativeProblemSolver` - Multi-step reasoning
- `SimpleRecursiveAgent` - Self-recursive processing
- `AsyncDispatcher` - Event routing
- `Router` - Event-to-agent routing
- `SharedWorkingMemory` - Agent context sharing with `RwLock`
- ReAct pattern implementation

#### Tools
- `DateResolverTool` - Natural language date parsing
- `CurrentDatetimeTool` - Current time access
- `ToolWrapper` - Agent as tool delegation
- File tools: Read, Write, List, Exists, Delete, Move, Copy, Append
- `TaskManagerTool` - Ephemeral task management
- `TellUserTool` / `AskUserTool` - User interaction
- `WebSearchTool` - Organic web search

#### Infrastructure
- 365 tests passing
- Zero clippy warnings
- rustdoc + mdBook documentation
- cargo-deny security auditing
- Comprehensive error types with `thiserror`
