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>
This commit is contained in:
2025-10-09 20:17:41 +02:00
parent 33d11ae223
commit e57844e742
9 changed files with 581 additions and 7 deletions

View File

@@ -1298,6 +1298,20 @@ fn render_status(frame: &mut Frame<'_>, area: Rect, app: &ChatApp) {
));
}
// Add operating mode indicator
let operating_mode = app.get_mode();
let (op_mode_text, op_mode_color) = match operating_mode {
owlen_core::mode::Mode::Chat => (" 💬 CHAT", Color::Blue),
owlen_core::mode::Mode::Code => (" 💻 CODE", Color::Magenta),
};
spans.push(Span::styled(
op_mode_text,
Style::default()
.fg(Color::Black)
.bg(op_mode_color)
.add_modifier(Modifier::BOLD),
));
spans.push(Span::styled(" ", Style::default().fg(theme.text)));
spans.push(Span::styled(help_text, Style::default().fg(theme.info)));
@@ -1861,6 +1875,12 @@ fn render_help(frame: &mut Frame<'_>, app: &ChatApp) {
Line::from(" :w [name] → alias for :save"),
Line::from(" :load, :o, :open → browse and load saved sessions"),
Line::from(" :sessions, :ls → browse saved sessions"),
// New mode and tool commands added in phases 05
Line::from(" :code → switch to code mode (CLI: owlen --code)"),
Line::from(" :mode <chat|code> → change current mode explicitly"),
Line::from(" :tools → list tools available in the current mode"),
Line::from(" :agent status → show agent configuration and iteration info"),
Line::from(" :stop-agent → abort a running ReAct agent loop"),
],
4 => vec![
// Sessions