Commit ace339a
feat: extract TUI layer into standalone clemitui crate (#101)
* feat: extract TUI layer into standalone clemitui crate (#100)
Extract formatting, logging, and text buffering into a reusable
clemitui crate that can be used by any ACP-compatible AI agent.
Changes:
- Create crates/clemitui/ with format.rs, logging.rs, text_buffer.rs
- Refactor clemini to re-export from clemitui, keeping genai-rs wrappers
- Update CLAUDE.md with workspace structure documentation
- Fix -p mode hang by explicitly dropping events_guard before await
The new crate takes primitive types (strings, durations, token counts)
instead of genai-rs types, enabling reuse without model-specific deps.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: disambiguate doc link for format module
Use `mod@format` to distinguish from the built-in `format!` macro.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: address review feedback
- Remove unused agent-client-protocol dependency from clemitui
- Update issue #100 to track extraction phases
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore(clemitui): remove unused tokio and tracing dependencies
These dependencies were never used in clemitui:
- tokio: logging.rs uses std::sync::RwLock, not tokio::sync
- tracing: no warn!/info!/debug! macros used anywhere
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(clemitui): address audit findings
API improvements:
- Make SKIN and render_markdown_nowrap pub(crate) - internal only
- Check LOGGING_DISABLED flag in log_event()/log_event_line()
- Add enable_logging() for test state reset
Test improvements:
- Add boundary tests for string truncation (79/80/81 chars)
- Add edge cases for estimate_tokens (null, empty, large)
- Strengthen render_markdown_nowrap test (verify ANSI codes)
- Add plain text and header tests for markdown rendering
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(tests): make test_edit_error_recovery deterministic
The test was flaky because:
1. Model behavior varied (different case handling approaches)
2. Validator interpretation of "appropriate" was subjective
Fix:
- Add deterministic check: verify file contains "Goodbye" (edit happened)
- Use lenient semantic check: "Did model attempt the edit?" (not "was
case handling appropriate?")
This separates "did it work" (deterministic) from "did it communicate"
(lenient), eliminating the subjective judgment that caused flakiness.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: remove outdated clemitui dependency comment
The comment referenced agent-client-protocol which was removed.
The Design note below already explains the genai-rs separation.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent 94c9688 commit ace339a
11 files changed
Lines changed: 1126 additions & 841 deletions
File tree
- crates/clemitui
- src
- src
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
37 | 49 | | |
38 | 50 | | |
39 | 51 | | |
| |||
45 | 57 | | |
46 | 58 | | |
47 | 59 | | |
48 | | - | |
49 | | - | |
| 60 | + | |
| 61 | + | |
50 | 62 | | |
51 | 63 | | |
52 | 64 | | |
53 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
54 | 70 | | |
55 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
56 | 88 | | |
57 | 89 | | |
58 | 90 | | |
| |||
162 | 194 | | |
163 | 195 | | |
164 | 196 | | |
| 197 | + | |
| 198 | + | |
165 | 199 | | |
166 | 200 | | |
167 | 201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
| |||
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
11 | 17 | | |
12 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
0 commit comments