openclacky 0.5.6 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +43 -0
- data/docs/ui2-architecture.md +124 -0
- data/lib/clacky/agent.rb +245 -340
- data/lib/clacky/agent_config.rb +1 -7
- data/lib/clacky/cli.rb +156 -397
- data/lib/clacky/client.rb +68 -36
- data/lib/clacky/gitignore_parser.rb +26 -12
- data/lib/clacky/model_pricing.rb +6 -2
- data/lib/clacky/session_manager.rb +6 -2
- data/lib/clacky/tools/glob.rb +65 -9
- data/lib/clacky/tools/grep.rb +4 -120
- data/lib/clacky/tools/run_project.rb +5 -0
- data/lib/clacky/tools/safe_shell.rb +49 -13
- data/lib/clacky/tools/shell.rb +1 -49
- data/lib/clacky/tools/web_fetch.rb +2 -2
- data/lib/clacky/tools/web_search.rb +38 -26
- data/lib/clacky/ui2/README.md +214 -0
- data/lib/clacky/ui2/components/base_component.rb +163 -0
- data/lib/clacky/ui2/components/common_component.rb +89 -0
- data/lib/clacky/ui2/components/inline_input.rb +187 -0
- data/lib/clacky/ui2/components/input_area.rb +1029 -0
- data/lib/clacky/ui2/components/message_component.rb +76 -0
- data/lib/clacky/ui2/components/output_area.rb +112 -0
- data/lib/clacky/ui2/components/todo_area.rb +137 -0
- data/lib/clacky/ui2/components/tool_component.rb +106 -0
- data/lib/clacky/ui2/components/welcome_banner.rb +93 -0
- data/lib/clacky/ui2/layout_manager.rb +331 -0
- data/lib/clacky/ui2/line_editor.rb +201 -0
- data/lib/clacky/ui2/screen_buffer.rb +238 -0
- data/lib/clacky/ui2/theme_manager.rb +68 -0
- data/lib/clacky/ui2/themes/base_theme.rb +99 -0
- data/lib/clacky/ui2/themes/hacker_theme.rb +56 -0
- data/lib/clacky/ui2/themes/minimal_theme.rb +50 -0
- data/lib/clacky/ui2/ui_controller.rb +720 -0
- data/lib/clacky/ui2/view_renderer.rb +160 -0
- data/lib/clacky/ui2.rb +37 -0
- data/lib/clacky/utils/file_ignore_helper.rb +126 -0
- data/lib/clacky/version.rb +1 -1
- data/lib/clacky.rb +1 -6
- metadata +38 -6
- data/lib/clacky/ui/banner.rb +0 -155
- data/lib/clacky/ui/enhanced_prompt.rb +0 -786
- data/lib/clacky/ui/formatter.rb +0 -209
- data/lib/clacky/ui/statusbar.rb +0 -96
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cf44c03777d71d011e78e17171352ea824da23fa3cc5bcb09c8ba985134ea28e
|
|
4
|
+
data.tar.gz: bafeeb81f93b770c2929c9a71a11fd8ed8f344251d284d10031023c41390f73b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8d4be2efc7721ec808722faa943d3fe99e4a074bebdaf710be79c8b55cfc1ef5f6757ddf33f5c37dc63ebe020bbd135f98b19d3be287121756d020b86fdd3e8f
|
|
7
|
+
data.tar.gz: cb451f53e1d1c589760c1bfccfd530faa9bfafa22d1b3e6aaca1a03813dd5bc524fb3c12037c3f0fd84cf18c8a76d71d6e6fc02421bd7e314cde8b0d783156b5
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,49 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.6.0] - 2026-01-28
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **New UI System (UI2)**: Complete component-based UI rewrite with modular architecture (InputArea, OutputArea, TodoArea, ToolComponent, ScreenBuffer, LayoutManager)
|
|
14
|
+
- **Slash Commands**: `/help`, `/clear`, `/exit` for quick actions
|
|
15
|
+
- **Prompt Caching**: Significantly improved performance and reduced API costs
|
|
16
|
+
- **Theme System**: Support for multiple UI themes (base, hacker, minimal)
|
|
17
|
+
- **Session Management**: Auto-keep last 10 sessions with datetime naming
|
|
18
|
+
|
|
19
|
+
### Improved
|
|
20
|
+
- Advanced inline input with Unicode support, multi-line handling, smooth scrolling, and rapid paste detection
|
|
21
|
+
- Better terminal resize handling and flicker-free rendering
|
|
22
|
+
- Work/idle status indicators with token cost display
|
|
23
|
+
- Enhanced tool execution feedback and multiple tool rejection handling
|
|
24
|
+
- Tool improvements: glob limits, grep performance, safe shell security, UTF-8 encoding fixes
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
- Input flickering, output scrolling, Ctrl+C behavior, image copying, base64 warnings, prompt cache issues
|
|
28
|
+
|
|
29
|
+
### Removed
|
|
30
|
+
- Legacy UI components (Banner, EnhancedPrompt, Formatter, StatusBar)
|
|
31
|
+
- Max cost/iteration limits for better flexibility
|
|
32
|
+
|
|
33
|
+
## [0.5.6] - 2026-01-18
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
- **Image Support**: Added support for image handling with cost tracking and display
|
|
37
|
+
- **Enhanced Input Controls**: Added Emacs-like Ctrl+A/E navigation for input fields
|
|
38
|
+
- **Session Management**: Added `/clear` command to clear session history
|
|
39
|
+
- **Edit Mode Switching**: New feature to switch between different edit modes
|
|
40
|
+
- **File Operations**: Support for reading from home directory (`~/`) and current directory (`.`)
|
|
41
|
+
- **Image Management**: Ctrl+D hotkey to delete images functionality
|
|
42
|
+
|
|
43
|
+
### Improved
|
|
44
|
+
- **Cost Tracking**: Display detailed cost information at every turn for better transparency
|
|
45
|
+
- **Performance**: Test suite speed optimizations and performance improvements
|
|
46
|
+
- **Token Efficiency**: Reduced token usage in grep operations for cost savings
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
- Fixed system Cmd+V copy functionality for multi-line text
|
|
50
|
+
- Fixed input flickering issues during text editing
|
|
51
|
+
- Removed unnecessary blank lines from image handling
|
|
52
|
+
|
|
10
53
|
## [0.5.4] - 2026-01-16
|
|
11
54
|
|
|
12
55
|
### Added
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# UI2 Architecture
|
|
2
|
+
|
|
3
|
+
## Core Principle
|
|
4
|
+
**Strict Layering**: UI layer must NOT directly access Agent layer. Use callbacks for communication.
|
|
5
|
+
|
|
6
|
+
## Component Hierarchy
|
|
7
|
+
```
|
|
8
|
+
UIController (single external interface)
|
|
9
|
+
├── LayoutManager (layout coordination)
|
|
10
|
+
│ ├── OutputArea (output display)
|
|
11
|
+
│ ├── InputArea (user input)
|
|
12
|
+
│ ├── TodoArea (task list)
|
|
13
|
+
│ └── InlineInput (confirmation prompt)
|
|
14
|
+
└── Callbacks (external communication)
|
|
15
|
+
├── on_input -> CLI handles input
|
|
16
|
+
├── on_interrupt -> CLI handles interruption
|
|
17
|
+
└── on_mode_toggle -> CLI handles mode change
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Data Flow
|
|
21
|
+
|
|
22
|
+
### Agent → UI: One-way calls
|
|
23
|
+
```ruby
|
|
24
|
+
# Agent calls UI to display
|
|
25
|
+
@ui&.show_tool_call(...)
|
|
26
|
+
@ui&.append_output(...)
|
|
27
|
+
@ui&.show_token_usage(...)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### UI → Agent: Via callbacks
|
|
31
|
+
```ruby
|
|
32
|
+
# ❌ Wrong: UI directly calls Agent
|
|
33
|
+
agent.run(input)
|
|
34
|
+
|
|
35
|
+
# ✅ Correct: Via callback
|
|
36
|
+
ui_controller.on_input { |input| agent.run(input) }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Common Mistakes
|
|
40
|
+
|
|
41
|
+
### ❌ Directly accessing Agent in UI components
|
|
42
|
+
```ruby
|
|
43
|
+
# Bad example
|
|
44
|
+
def toggle_mode
|
|
45
|
+
@agent.config.mode = "auto_approve" # ❌ Violates separation
|
|
46
|
+
end
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### ✅ Notify via callback
|
|
50
|
+
```ruby
|
|
51
|
+
# Good example
|
|
52
|
+
def toggle_mode
|
|
53
|
+
@mode_toggle_callback&.call("auto_approve") # ✅ Proper separation
|
|
54
|
+
end
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### ❌ Using puts for logging
|
|
58
|
+
```ruby
|
|
59
|
+
puts "Debug info" # ❌ Breaks UI rendering
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### ✅ Use UIController.log
|
|
63
|
+
```ruby
|
|
64
|
+
ui_controller.log("Debug info") # ✅ Displays in output area
|
|
65
|
+
ui_controller.log("Warning", level: :warning)
|
|
66
|
+
ui_controller.log("Error", level: :error)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Logging System
|
|
70
|
+
|
|
71
|
+
Use `ui_controller.log(message, level: :info)` to display debug information in the output area without breaking rendering.
|
|
72
|
+
|
|
73
|
+
**Available log levels:**
|
|
74
|
+
- `:debug` - Gray dimmed text
|
|
75
|
+
- `:info` - Normal text with info symbol
|
|
76
|
+
- `:warning` - Yellow warning text
|
|
77
|
+
- `:error` - Red error text
|
|
78
|
+
|
|
79
|
+
**Example:**
|
|
80
|
+
```ruby
|
|
81
|
+
# In UIController or components with access to UIController
|
|
82
|
+
@ui_controller.log("Tool execution started", level: :debug)
|
|
83
|
+
@ui_controller.log("Cache hit", level: :info)
|
|
84
|
+
@ui_controller.log("Retry attempt 3/10", level: :warning)
|
|
85
|
+
@ui_controller.log("Network failed", level: :error)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Rendering Flow
|
|
89
|
+
|
|
90
|
+
### Fixed Areas
|
|
91
|
+
- **InputArea**: Fixed at bottom (hidden when InlineInput is active via `paused?`)
|
|
92
|
+
- **TodoArea**: Fixed above InputArea
|
|
93
|
+
|
|
94
|
+
### Scrolling Area
|
|
95
|
+
- **OutputArea**: Natural scrolling, all content appended here
|
|
96
|
+
|
|
97
|
+
### Thread Safety
|
|
98
|
+
- All rendering protected by `@render_mutex`
|
|
99
|
+
- Never call render methods outside LayoutManager
|
|
100
|
+
|
|
101
|
+
## Key Methods
|
|
102
|
+
|
|
103
|
+
### Display Methods (Agent → UI)
|
|
104
|
+
- `append_output(content)` - Add content to output area
|
|
105
|
+
- `update_sessionbar(tasks:, cost:)` - Update session bar
|
|
106
|
+
- `show_token_usage(token_data)` - Display token statistics
|
|
107
|
+
- `show_tool_call(name, args)` - Display tool execution
|
|
108
|
+
- `request_confirmation(message)` - Blocking user confirmation
|
|
109
|
+
|
|
110
|
+
### Callback Registration (CLI sets these)
|
|
111
|
+
- `on_input { |text, images| ... }` - Handle user input
|
|
112
|
+
- `on_interrupt { |input_was_empty:| ... }` - Handle Ctrl+C
|
|
113
|
+
- `on_mode_toggle { |new_mode| ... }` - Handle Shift+Tab
|
|
114
|
+
|
|
115
|
+
### Logging (Use instead of puts)
|
|
116
|
+
- `log(message, level: :info)` - Display debug/info in output
|
|
117
|
+
|
|
118
|
+
## Best Practices
|
|
119
|
+
|
|
120
|
+
1. **Never bypass UIController** - All UI updates go through UIController
|
|
121
|
+
2. **Use callbacks for upward communication** - UI notifies CLI/Agent via callbacks
|
|
122
|
+
3. **Log via UIController** - Never use `puts` or `print` directly
|
|
123
|
+
4. **Check paused state** - Don't render InputArea when InlineInput is active
|
|
124
|
+
5. **Trust the render flow** - Let LayoutManager handle rendering coordination
|