Commit Graph

77 Commits

Author SHA1 Message Date
e94df2c48a feat(phases4,7,8): implement Agent/ReAct, Code Execution, and Prompt Server
Completes Phase 4 (Agentic Loop with ReAct), Phase 7 (Code Execution),
and Phase 8 (Prompt Server) as specified in the implementation plan.

**Phase 4: Agentic Loop with ReAct Pattern (agent.rs - 398 lines)**
- Complete AgentExecutor with reasoning loop
- LlmResponse enum: ToolCall, FinalAnswer, Reasoning
- ReAct parser supporting THOUGHT/ACTION/ACTION_INPUT/FINAL_ANSWER
- Tool discovery and execution integration
- AgentResult with iteration tracking and message history
- Integration with owlen-agent CLI binary and TUI

**Phase 7: Code Execution with Docker Sandboxing**

*Sandbox Module (sandbox.rs - 255 lines):*
- Docker-based execution using bollard
- Resource limits: 512MB memory, 50% CPU
- Network isolation (no network access)
- Timeout handling (30s default)
- Container auto-cleanup
- Support for Rust, Node.js, Python environments

*Tool Suite (tools.rs - 410 lines):*
- CompileProjectTool: Build projects with auto-detection
- RunTestsTool: Execute test suites with optional filters
- FormatCodeTool: Run formatters (rustfmt/prettier/black)
- LintCodeTool: Run linters (clippy/eslint/pylint)
- All tools support check-only and auto-fix modes

*MCP Server (lib.rs - 183 lines):*
- Full JSON-RPC protocol implementation
- Tool registry with dynamic dispatch
- Initialize/tools/list/tools/call support

**Phase 8: Prompt Server with YAML & Handlebars**

*Prompt Server (lib.rs - 405 lines):*
- YAML-based template storage in ~/.config/owlen/prompts/
- Handlebars 6.0 template engine integration
- PromptTemplate with metadata (name, version, mode, description)
- Four MCP tools:
  - get_prompt: Retrieve template by name
  - render_prompt: Render with Handlebars variables
  - list_prompts: List all available templates
  - reload_prompts: Hot-reload from disk

*Default Templates:*
- chat_mode_system.yaml: ReAct prompt for chat mode
- code_mode_system.yaml: ReAct prompt with code tools

**Configuration & Integration:**
- Added Agent module to owlen-core
- Updated owlen-agent binary to use new AgentExecutor API
- Updated TUI to integrate with agent result structure
- Added error handling for Agent variant

**Dependencies Added:**
- bollard 0.17 (Docker API)
- handlebars 6.0 (templating)
- serde_yaml 0.9 (YAML parsing)
- tempfile 3.0 (temporary directories)
- uuid 1.0 with v4 feature

**Tests:**
- mode_tool_filter.rs: Tool filtering by mode
- prompt_server.rs: Prompt management tests
- Sandbox tests (Docker-dependent, marked #[ignore])

All code compiles successfully and follows project conventions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 20:50:40 +02:00
cdf95002fc feat(phase9): implement WebSocket transport and failover system
Implements Phase 9: Remoting / Cloud Hybrid Deployment with complete
WebSocket transport support and comprehensive failover mechanisms.

**WebSocket Transport (remote_client.rs):**
- Added WebSocket support to RemoteMcpClient using tokio-tungstenite
- Full bidirectional JSON-RPC communication over WebSocket
- Connection establishment with error handling
- Text/binary message support with proper encoding
- Connection closure detection and error reporting

**Failover & Redundancy (failover.rs - 323 lines):**
- ServerHealth tracking: Healthy, Degraded, Down states
- ServerEntry with priority-based selection (lower = higher priority)
- FailoverMcpClient implementing McpClient trait
- Automatic retry with exponential backoff
- Circuit breaker pattern (5 consecutive failures triggers Down state)
- Background health checking with configurable intervals
- Graceful failover through server priority list

**Configuration:**
- FailoverConfig with tunable parameters:
  - max_retries: 3 (default)
  - base_retry_delay: 100ms with exponential backoff
  - health_check_interval: 30s
  - circuit_breaker_threshold: 5 failures

**Testing (phase9_remoting.rs - 9 tests, all passing):**
- Priority-based server selection
- Automatic failover to backup servers
- Retry mechanism with exponential backoff
- Health status tracking and transitions
- Background health checking
- Circuit breaker behavior
- Error handling for edge cases

**Dependencies:**
- tokio-tungstenite 0.21
- tungstenite 0.21

All tests pass successfully. Phase 9 specification fully implemented.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 20:43:21 +02:00
4c066bf2da refactor: remove owlen-code binary and code-client feature
Remove the separate owlen-code binary as code assistance functionality
is now integrated into the main application through the mode consolidation system.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-09 20:31:46 +02:00
e57844e742 feat(phase5): implement mode consolidation and tool availability system
Implements Phase 5 from the roadmap with complete mode-based tool filtering:

- Add Mode enum (Chat/Code) with FromStr trait implementation
- Extend Config with ModeConfig for per-mode tool availability
- Update ToolRegistry to enforce mode-based filtering
- Add --code/-c CLI argument to start in code mode
- Implement TUI commands: :mode, :code, :chat, :tools
- Add operating mode indicator to status line (💬/💻 badges)
- Create comprehensive documentation in docs/phase5-mode-system.md

Default configuration:
- Chat mode: only web_search allowed
- Code mode: all tools allowed (wildcard *)

All code compiles cleanly with cargo clippy passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-09 20:17:41 +02:00
33d11ae223 fix(agent): improve ReAct parser and tool schemas for better LLM compatibility
- Fix ACTION_INPUT regex to properly capture multiline JSON responses
  - Changed from stopping at first newline to capturing all remaining text
  - Resolves parsing errors when LLM generates formatted JSON with line breaks

- Enhance tool schemas with detailed descriptions and parameter specifications
  - Add comprehensive Message schema for generate_text tool
  - Clarify distinction between resources/get (file read) and resources/list (directory listing)
  - Include clear usage guidance in tool descriptions

- Set default model to llama3.2:latest instead of invalid "ollama"

- Add parse error debugging to help troubleshoot LLM response issues

The agent infrastructure now correctly handles multiline tool arguments and
provides better guidance to LLMs through improved tool schemas. Remaining
errors are due to LLM quality (model making poor tool choices or generating
malformed responses), not infrastructure bugs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-09 19:43:07 +02:00
05e90d3e2b feat(mcp): add LLM server crate and remote client integration
- Introduce `owlen-mcp-llm-server` crate with RPC handling, `generate_text` tool, model listing, and streaming notifications.
- Add `RpcNotification` struct and `MODELS_LIST` method to the MCP protocol.
- Update `owlen-core` to depend on `tokio-stream`.
- Adjust Ollama provider to omit empty `tools` field for compatibility.
- Enhance `RemoteMcpClient` to locate the renamed server binary, handle resource tools locally, and implement the `Provider` trait (model listing, chat, streaming, health check).
- Add new crate to workspace `Cargo.toml`.
2025-10-09 13:46:33 +02:00
fe414d49e6 Apply recent changes 2025-10-09 11:33:27 +02:00
d002d35bde feat(theme): add tool_output color to themes
- Added a `tool_output` color to the `Theme` struct.
- Updated all built-in themes to include the new color.
- Modified the TUI to use the `tool_output` color for rendering tool output.
2025-10-06 22:18:17 +02:00
c9c3d17db0 feat(theme): add tool_output color to themes
- Added a `tool_output` color to the `Theme` struct.
- Updated all built-in themes to include the new color.
- Modified the TUI to use the `tool_output` color for rendering tool output.
2025-10-06 21:59:08 +02:00
a909455f97 feat(theme): add tool_output color to themes
- Added a `tool_output` color to the `Theme` struct.
- Updated all built-in themes to include the new color.
- Modified the TUI to use the `tool_output` color for rendering tool output.
2025-10-06 21:43:31 +02:00
67381b02db feat(mcp): add MCP client abstraction and feature flag
Introduce the foundation for the Multi-Client Provider (MCP) architecture.

This phase includes:
- A new `McpClient` trait to abstract tool execution.
- A `LocalMcpClient` that executes tools in-process for backward compatibility ("legacy mode").
- A placeholder `RemoteMcpClient` for future development.
- An `McpMode` enum in the configuration (`mcp.mode`) to toggle between `legacy` and `enabled` modes, defaulting to `legacy`.
- Refactoring of `SessionController` to use the `McpClient` abstraction, decoupling it from the tool registry.

This lays the groundwork for routing tool calls to a remote MCP server in subsequent phases.
2025-10-06 20:03:01 +02:00
235f84fa19 Integrate core functionality for tools, MCP, and enhanced session management
Adds consent management for tool execution, input validation, sandboxed process execution, and MCP server integration. Updates session management to support tool use, conversation persistence, and streaming responses.

Major additions:
- Database migrations for conversations and secure storage
- Encryption and credential management infrastructure
- Extensible tool system with code execution and web search
- Consent management and validation systems
- Sandboxed process execution
- MCP server integration

Infrastructure changes:
- Module registration and workspace dependencies
- ToolCall type and tool-related Message methods
- Privacy, security, and tool configuration structures
- Database-backed conversation persistence
- Tool call tracking in conversations

Provider and UI updates:
- Ollama provider updates for tool support and new Role types
- TUI chat and code app updates for async initialization
- CLI updates for new SessionController API
- Configuration documentation updates
- CHANGELOG updates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 18:36:42 +02:00
9c777c8429 Add extensible tool system with code execution and web search
Introduces a tool registry architecture with sandboxed code execution, web search capabilities, and consent-based permission management. Enables safe, pluggable LLM tool integration with schema validation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 18:32:07 +02:00
0b17a0f4c8 Add encryption and credential management infrastructure
Implements AES-256-GCM encrypted storage and keyring-based credential management for securely handling API keys and sensitive data. Supports secure local storage and OS-native keychain integration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 18:31:51 +02:00
2eabe55fe6 Add database migrations for conversations and secure storage
Introduces SQL schema for persistent conversation storage and encrypted secure items, supporting the new storage architecture for managing chat history and sensitive credentials.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 18:31:26 +02:00
4d7ad2c330 Refactor codebase for consistency and readability
- Standardize array and vector formatting for clarity.
- Adjust spacing and indentation in examples and TUI code.
- Ensure proper newline usage across files (e.g., LICENSE, TOML files, etc.).
- Simplify `.to_string()` and `.ok()` calls for brevity.
2025-10-05 02:31:53 +02:00
13af046eff Introduce pre-commit hooks and update contribution guidelines
- Add `.pre-commit-config.yaml` with hooks for formatting, linting, and general file checks.
- Update `CONTRIBUTING.md` to include pre-commit setup instructions and emphasize automated checks during commits.
- Provide detailed steps for installing and running pre-commit hooks.
2025-10-05 02:30:19 +02:00
5b202fed4f Add comprehensive documentation and examples for Owlen architecture and usage
- Include detailed architecture overview in `docs/architecture.md`.
- Add `docs/configuration.md`, detailing configuration file structure and settings.
- Provide a step-by-step provider implementation guide in `docs/provider-implementation.md`.
- Add frequently asked questions (FAQ) document in `docs/faq.md`.
- Create `docs/migration-guide.md` for future breaking changes and version upgrades.
- Introduce new examples in `examples/` showcasing basic chat, custom providers, and theming.
- Add a changelog (`CHANGELOG.md`) for tracking significant changes.
- Provide contribution guidelines (`CONTRIBUTING.md`) and a Code of Conduct (`CODE_OF_CONDUCT.md`).
2025-10-05 02:23:32 +02:00
979347bf53 Merge pull request 'Update Woodpecker CI: fix typo in cross-compilation target name' (#29) from dev into main
Reviewed-on: #29
2025-10-03 07:58:19 +02:00
76b55ccff5 Update Woodpecker CI: fix typo in cross-compilation target name
All checks were successful
ci/someci/tag/woodpecker/1 Pipeline was successful
ci/someci/tag/woodpecker/2 Pipeline was successful
ci/someci/tag/woodpecker/3 Pipeline was successful
ci/someci/tag/woodpecker/4 Pipeline was successful
ci/someci/tag/woodpecker/5 Pipeline was successful
ci/someci/tag/woodpecker/6 Pipeline was successful
ci/someci/tag/woodpecker/7 Pipeline was successful
v0.1.10
2025-10-03 07:57:53 +02:00
f0e162d551 Merge pull request 'Add built-in theme support with various pre-defined themes' (#28) from theming into main
Reviewed-on: #28
2025-10-03 07:48:18 +02:00
6c4571804f Merge branch 'main' into theming 2025-10-03 07:48:10 +02:00
a0cdcfdf6c Merge pull request 'Update .gitignore: add .agents/, .env files, and refine .env.example handling' (#27) from dev into main
Reviewed-on: #27
2025-10-03 07:44:46 +02:00
96e2482782 Add built-in theme support with various pre-defined themes
Some checks failed
ci/someci/tag/woodpecker/5 Pipeline is pending
ci/someci/tag/woodpecker/6 Pipeline is pending
ci/someci/tag/woodpecker/7 Pipeline is pending
ci/someci/tag/woodpecker/1 Pipeline failed
ci/someci/tag/woodpecker/2 Pipeline failed
ci/someci/tag/woodpecker/3 Pipeline failed
ci/someci/tag/woodpecker/4 Pipeline failed
- Introduce multiple built-in themes (`default_dark`, `default_light`, `gruvbox`, `dracula`, `solarized`, `midnight-ocean`, `rose-pine`, `monokai`, `material-dark`, `material-light`).
- Implement theming system with customizable color schemes for all UI components in the TUI.
- Include documentation for themes in `themes/README.md`.
- Add fallback mechanisms for default themes in case of parsing errors.
- Support custom themes with overrides via configuration.
v0.1.9
2025-10-03 07:44:11 +02:00
6a3f44f911 Update .gitignore: add .agents/, .env files, and refine .env.example handling 2025-10-03 05:55:32 +02:00
e0e5a2a83d Merge pull request 'dev' (#26) from dev into main
Reviewed-on: #26
2025-10-02 15:28:25 +02:00
23e86591d1 Update README: add installation instructions for Linux and macOS using Cargo 2025-10-02 15:27:27 +02:00
b60a317788 Update README: document command autocompletion and bump version to 0.1.8 2025-10-02 03:11:51 +02:00
2788e8b7e2 Update Woodpecker CI: fix typo in target name and add zip package installation step 2025-10-02 03:07:44 +02:00
7c186882dc Merge pull request 'dev' (#25) from dev into main
Reviewed-on: #25
2025-10-02 03:00:29 +02:00
bdda669d4d Bump version to 0.1.8 in PKGBUILD, Cargo.toml, and README
Some checks failed
ci/someci/tag/woodpecker/1 Pipeline was successful
ci/someci/tag/woodpecker/2 Pipeline was successful
ci/someci/tag/woodpecker/3 Pipeline was successful
ci/someci/tag/woodpecker/4 Pipeline was successful
ci/someci/tag/woodpecker/5 Pipeline was successful
ci/someci/tag/woodpecker/6 Pipeline was successful
ci/someci/tag/woodpecker/7 Pipeline failed
v0.1.8
2025-10-02 03:00:00 +02:00
108070db4b Update Woodpecker CI: improve cross-compilation setup and refine build steps 2025-10-02 02:58:13 +02:00
08ba04e99f Add command suggestions and enhancements to Command mode
- Introduce `command_suggestions` feature for autocompletion in Command mode.
- Implement `render_command_suggestions` to display filtered suggestions in a popup.
- Enable navigation through suggestions using Up/Down keys and Tab for completion.
- Add dynamic filtering of suggestions based on input buffer.
- Improve input handling, ensuring suggestion state resets appropriately when exiting Command mode.
2025-10-02 02:48:36 +02:00
e58032deae Merge pull request 'dev' (#24) from dev into main
Reviewed-on: #24
2025-10-02 02:11:06 +02:00
5c59539120 Bump version to 0.1.7 in PKGBUILD, Cargo.toml, and README
Some checks failed
ci/someci/tag/woodpecker/1 Pipeline was successful
ci/someci/tag/woodpecker/2 Pipeline was successful
ci/someci/tag/woodpecker/3 Pipeline failed
ci/someci/tag/woodpecker/4 Pipeline failed
ci/someci/tag/woodpecker/5 Pipeline failed
ci/someci/tag/woodpecker/6 Pipeline failed
ci/someci/tag/woodpecker/7 Pipeline failed
v0.1.7
2025-10-02 02:09:26 +02:00
c725bb1ce6 Add tabbed help UI with enhanced navigation
- Refactor `render_help` to display tabbed UI for help topics.
- Introduce `help_tab_index` to manage selected tab state.
- Allow navigation between help tabs using Tab, h/l, and number keys (1-5).
- Enhance visual design of help sections using styled tabs and categorized content.
- Update input handling to reset tab state upon exit from help mode.
2025-10-02 02:07:23 +02:00
c4a6bb1c0f Merge pull request 'dev' (#23) from dev into main
Some checks failed
ci/someci/tag/woodpecker/1 Pipeline was successful
ci/someci/tag/woodpecker/2 Pipeline was successful
ci/someci/tag/woodpecker/3 Pipeline failed
ci/someci/tag/woodpecker/4 Pipeline failed
ci/someci/tag/woodpecker/5 Pipeline failed
ci/someci/tag/woodpecker/6 Pipeline failed
ci/someci/tag/woodpecker/7 Pipeline failed
Reviewed-on: #23
v0.1.6
2025-10-02 01:38:22 +02:00
dcbfe6ef06 Update README: bump version to 0.1.5 in Alpha Status section 2025-10-02 01:37:44 +02:00
e468658d63 Bump version to 0.1.5 in Cargo.toml 2025-10-02 01:37:15 +02:00
2ad801f0c1 Remove release workflow: delete .gitea/workflows/release.yml 2025-10-02 01:36:59 +02:00
1bfc6e5956 Merge pull request 'Add session persistence and browser functionality' (#22) from dev into main
Reviewed-on: #22
2025-10-02 01:35:31 +02:00
6b8774f0aa Add session persistence and browser functionality
Some checks failed
Release / Build aarch64-unknown-linux-gnu (push) Has been cancelled
Release / Build aarch64-unknown-linux-musl (push) Has been cancelled
Release / Build armv7-unknown-linux-gnueabihf (push) Has been cancelled
Release / Build armv7-unknown-linux-musleabihf (push) Has been cancelled
Release / Build x86_64-unknown-linux-gnu (push) Has been cancelled
Release / Build x86_64-unknown-linux-musl (push) Has been cancelled
Release / Build aarch64-apple-darwin (push) Has been cancelled
Release / Build x86_64-apple-darwin (push) Has been cancelled
Release / Build aarch64-pc-windows-msvc (push) Has been cancelled
Release / Build x86_64-pc-windows-msvc (push) Has been cancelled
Release / Create Release (push) Has been cancelled
- Implement `StorageManager` for saving, loading, and managing sessions.
- Introduce platform-specific session directories for persistence.
- Add session browser UI for listing, loading, and deleting saved sessions.
- Enable AI-generated descriptions for session summaries.
- Update configurations to support storage settings and description generation.
- Extend README and tests to document and validate new functionality.
2025-10-02 01:33:49 +02:00
ec6876727f Update PKGBUILD: bump version to 0.1.4, adjust maintainer details, refine build steps, and improve compatibility settings 2025-10-01 23:59:46 +02:00
e3eb4d7a04 Update PKGBUILD: add sha256 checksum for source archive 2025-10-01 20:52:10 +02:00
7234021014 Add Windows support to builds and enhance multi-platform configuration
Some checks failed
ci/someci/tag/woodpecker/1 Pipeline was successful
ci/someci/tag/woodpecker/2 Pipeline was successful
ci/someci/tag/woodpecker/3 Pipeline failed
ci/someci/tag/woodpecker/4 Pipeline failed
ci/someci/tag/woodpecker/5 Pipeline failed
ci/someci/tag/woodpecker/6 Pipeline failed
ci/someci/tag/woodpecker/7 Pipeline failed
- Introduce `.cargo/config.toml` with platform-specific linker and flags.
- Update Woodpecker CI to include Windows target, adjust build and packaging steps.
- Modify `Cargo.toml` to use `reqwest` with `rustls-tls` for TLS support.
v0.1.3 v0.1.4
2025-10-01 20:46:27 +02:00
662d5bd919 Remove Gitea release workflow: deprecate unused configuration and scripts.
Some checks failed
ci/someci/tag/woodpecker/1 Pipeline was successful
ci/someci/tag/woodpecker/2 Pipeline failed
ci/someci/tag/woodpecker/3 Pipeline failed
ci/someci/tag/woodpecker/4 Pipeline failed
ci/someci/tag/woodpecker/5 Pipeline failed
ci/someci/tag/woodpecker/6 Pipeline failed
v0.1.1 v0.1.2
2025-10-01 20:10:13 +02:00
263b629257 Add Woodpecker CI and PKGBUILD 2025-10-01 20:08:13 +02:00
ff90b20baa Merge pull request 'Add PKGBUILD and release workflow for package distribution' (#21) from dev into main
Reviewed-on: #21
2025-10-01 20:04:35 +02:00
1ad6cb8b3f Add PKGBUILD and release workflow for package distribution
Some checks failed
Release / Build aarch64-unknown-linux-gnu (push) Has been cancelled
Release / Build aarch64-unknown-linux-musl (push) Has been cancelled
Release / Build armv7-unknown-linux-gnueabihf (push) Has been cancelled
Release / Build armv7-unknown-linux-musleabihf (push) Has been cancelled
Release / Build x86_64-unknown-linux-gnu (push) Has been cancelled
Release / Build x86_64-unknown-linux-musl (push) Has been cancelled
Release / Build aarch64-apple-darwin (push) Has been cancelled
Release / Build x86_64-apple-darwin (push) Has been cancelled
Release / Build aarch64-pc-windows-msvc (push) Has been cancelled
Release / Build x86_64-pc-windows-msvc (push) Has been cancelled
Release / Create Release (push) Has been cancelled
v0.1.0
2025-10-01 20:01:54 +02:00
380a5cd20e Update LICENSE: switch from MIT to GNU AGPL v3 2025-09-30 03:38:52 +02:00