Commit Graph

65 Commits

Author SHA1 Message Date
Daniel Edrisian
a10146c26d Clippy fix 2025-08-19 18:26:59 -07:00
Daniel Edrisian
a5df629f69 tui: preserve image placeholders in history on submit
- Add parsing of paste to attach real files already merged
- Keep submitted image placeholders visible in history via new_user_prompt_with_images
- Plumb placeholder strings through BottomPane -> ChatWidget on submit
- Keep agent input free of placeholders (send images as LocalImage)
2025-08-19 18:26:59 -07:00
Daniel Edrisian
2273d18302 tui: attach real image file on drag/drop
- Parse shell-escaped paths via shlex and unescape backslashes
- Recognize and percent-decode file:// URLs
- Prefer existing .png/.jpg/.jpeg file paths over clipboard bitmap
- Keep ~/ expansion and quoting handling
- Fix composer tests to pass placeholder_text to ChatComposer::new
2025-08-19 18:26:59 -07:00
Daniel Edrisian
6439e0f944 Merge branch 'main' into copy_images 2025-08-19 16:58:22 -07:00
Kazuhiro Sera
16f11a89d8 Fix #2429 Tweak the cursor position after tab completion (#2442)
This pull request resolves #2429; I was also feeling that this is not
great dev experience, so we should fix.
2025-08-19 09:34:52 -07:00
ae
096bca2fa2 fix: exclude sysprompt etc from context left % (#2446)
- Prevents the % left indicator from immediately decrementing to ~97%.
- Tested by prompting "hi" and noting it only decremented to 99%. And by
adding a bunch of debug logs and observing numbers.
2025-08-19 08:20:32 -07:00
Jeremy Rose
7a80d3c96c replace /prompts with a rotating placeholder (#2314) 2025-08-15 19:37:10 -07:00
Jeremy Rose
fd2b059504 text elements in textarea for pasted content (#2302)
This improves handling of pasted content in the textarea. It's no longer
possible to partially delete a placeholder (e.g. by ^W or ^D), nor is it
possible to place the cursor inside a placeholder. Also, we now render
placeholders in a different color to make them more clearly
differentiated.


https://github.com/user-attachments/assets/2051b3c3-963d-4781-a610-3afee522ae29
2025-08-14 20:58:51 +00:00
aibrahim-oai
cbf972007a use modifier dim instead of gray and .dim (#2273)
gray color doesn't work very well with white terminals. `.dim` doesn't
have an effect for some reason.

after:
<img width="1080" height="149" alt="image"
src="https://github.com/user-attachments/assets/26c0f8bb-550d-4d71-bd06-11b3189bc1d7"
/>

Before
<img width="1077" height="186" alt="image"
src="https://github.com/user-attachments/assets/b1fba0c7-bc4d-4da1-9754-6c0a105e8cd1"
/>
2025-08-13 22:50:50 +00:00
ae
a48372ce5d feat: add a /mention slash command (#2114)
- To help people discover @mentions.
- Command just places a @ in the composer.
- #2115 then improves the behavior of @mentions with empty queries.
2025-08-11 14:15:41 -07:00
ae
a191945ed6 fix: token usage display and context calculation (#2117)
- I had a recent conversation where the one-liner showed using 11M
tokens! But looking into it 10M were cached. So I looked into it and I
think we had a regression here. ->
- Use blended total tokens for chat composer usage display
- Compute remaining context using tokens_in_context_window helper

------
https://chatgpt.com/codex/tasks/task_i_68981a16c0a4832cbf416017390930e5
2025-08-11 07:19:15 -07:00
pap
194dc82c93 remove unecessary changes 2025-08-09 16:42:34 +01:00
pap
e93ca9fa11 remove code 2025-08-09 16:36:57 +01:00
pap
b45b547f8a fix img insertion cursor 2025-08-09 16:10:56 +01:00
pap
a392e7027c use single source of truth attached_images 2025-08-09 16:07:03 +01:00
pap
d2623c1af8 leverage existing pasting erasure from cmd+v large content 2025-08-09 15:54:27 +01:00
pap
b778ec91d8 less code changes 2025-08-09 15:44:36 +01:00
pap
98e0bafbed fix tests and reduce boilerplate code 2025-08-09 15:33:56 +01:00
pap
eb45697bcc fix clippy, old commands use and remove event printing 2025-08-09 15:08:16 +01:00
pap
669387a034 Merge branch 'main' into copy_images 2025-08-09 14:51:14 +01:00
Ed Bayes
09adbf9132 remove composer bg (#1944)
passes local tests
2025-08-07 10:04:49 -07:00
pakrym-oai
c87fb83d81 Calculate remaining context based on last token usage (#1940)
We should only take last request size (in tokens) into account
2025-08-07 05:17:18 -07:00
Ed Bayes
1e4bf81653 Update copy (#1935)
Updated copy

---------

Co-authored-by: pap-openai <pap@openai.com>
2025-08-07 03:29:33 -07:00
Ed Bayes
eb80614a7c Tint chat composer background (#1921)
## Summary
- give the chat composer a subtle custom background and apply it across
the full area drawn

<img width="1008" height="718" alt="composer-bg"
src="https://github.com/user-attachments/assets/4b0f7f69-722a-438a-b4e9-0165ae8865a6"
/>

- update turn interrupted to be more human readable
<img width="648" height="170" alt="CleanShot 2025-08-06 at 22 44 47@2x"
src="https://github.com/user-attachments/assets/8d35e53a-bbfa-48e7-8612-c280a54e01dd"
/>

## Testing
- `cargo test --all-features` *(fails: `let` expressions in
`core/src/client.rs` require newer rustc)*
- `just fix` *(fails: `let` expressions in `core/src/client.rs` require
newer rustc)*

------
https://chatgpt.com/codex/tasks/task_i_68941f32c1008322bbcc39ee1d29a526
2025-08-07 00:46:45 -07:00
aibrahim-oai
04b40ac179 Move used tokens next to the hints (#1930)
Before:

<img width="341" height="58" alt="image"
src="https://github.com/user-attachments/assets/3b209e42-1157-4f7b-8385-825c865969e8"
/>

After:

<img width="490" height="53" alt="image"
src="https://github.com/user-attachments/assets/5d99b9bc-6ac2-4748-b62c-c0c3217622c2"
/>
2025-08-07 00:45:47 -07:00
easong-openai
4e29c4afe4 Add a UI hint when you press @ (#1903)
This will make @ more discoverable (even though it is currently not
super useful, IMO it should be used to bring files into context from
outside CWD)

---------

Co-authored-by: Gabriel Peal <gpeal@users.noreply.github.com>
2025-08-07 07:41:48 +00:00
pap-openai
8a980399c5 fix cursor file name insert (#1896)
Cursor wasn't moving when inserting a file, resulting in being not at
the end of the filename when inserting the file.
This fixes it by moving the cursor to the end of the file + one trailing
space.


Example screenshot after selecting a file when typing `@`
<img width="823" height="268" alt="image"
src="https://github.com/user-attachments/assets/ec6e3741-e1ba-4752-89d2-11f14a2bd69f"
/>
2025-08-06 16:58:06 -07:00
Charlie Weems
ffe24991b7 Initial implementation of /init (#1822)
Basic /init command that appends an instruction to create AGENTS.md to
the conversation history.
2025-08-06 09:10:23 -07:00
Jeremy Rose
d62b703a21 custom textarea (#1794)
This replaces tui-textarea with a custom textarea component.

Key differences:
1. wrapped lines
2. better unicode handling
3. uses the native terminal cursor

This should perhaps be spun out into its own separate crate at some
point, but for now it's convenient to have it in-tree.
2025-08-03 11:31:35 -07:00
pap
c03e8fc860 code cleaning 2025-08-01 19:56:32 +01:00
pap
c9b80cd456 re-use command name instead of slashcommand as we removed at_command 2025-08-01 19:45:40 +01:00
pap
cd078bb9d1 fix behaviour and tests 2025-08-01 19:42:16 +01:00
pap
ac5705c0ed removing at_command 2025-08-01 19:33:58 +01:00
pap
62d85e069e Merge branch 'main' into copy_images 2025-08-01 18:24:49 +01:00
easong-openai
575590e4c2 Detect kitty terminals (#1748)
We want to detect kitty terminals so we can preferentially upgrade their UX without degrading older terminals.
2025-08-01 00:30:44 +00:00
Jeremy Rose
d86270696e streamline ui (#1733)
Simplify and improve many UI elements.
* Remove all-around borders in most places. These interact badly with
terminal resizing and look heavy. Prefer left-side-only borders.
* Make the viewport adjust to the size of its contents.
* <kbd>/</kbd> and <kbd>@</kbd> autocomplete boxes appear below the
prompt, instead of above it.
* Restyle the keyboard shortcut hints & move them to the left.
* Restyle the approval dialog.
* Use synchronized rendering to avoid flashing during rerenders.


https://github.com/user-attachments/assets/96f044af-283b-411c-b7fc-5e6b8a433c20

<img width="1117" height="858" alt="Screenshot 2025-07-30 at 5 29 20 PM"
src="https://github.com/user-attachments/assets/0cc0af77-8396-429b-b6ee-9feaaccdbee7"
/>
2025-07-31 00:43:21 -07:00
pap-openai
defeafb279 add keyboard enhancements to support shift_return (#1743)
For terminal that supports [keyboard
enhancements](https://docs.rs/libcrossterm/latest/crossterm/enum.KeyboardEnhancementFlags.html),
adds the enhancements (enabling [kitty keyboard
protocol](https://sw.kovidgoyal.net/kitty/keyboard-protocol/)) to
support shift+enter listener.

Those users (users with terminals listed on
[KPP](https://sw.kovidgoyal.net/kitty/keyboard-protocol/)) should be
able to press shift+return for new line

---------

Co-authored-by: easong-openai <easong@openai.com>
2025-07-31 03:23:56 +00:00
Jeremy Rose
f2134f6633 resizable viewport (#1732)
Proof of concept for a resizable viewport.

The general approach here is to duplicate the `Terminal` struct from
ratatui, but with our own logic. This is a "light fork" in that we are
still using all the base ratatui functions (`Buffer`, `Widget` and so
on), but we're doing our own bookkeeping at the top level to determine
where to draw everything.

This approach could use improvement—e.g, when the window is resized to a
smaller size, if the UI wraps, we don't correctly clear out the
artifacts from wrapping. This is possible with a little work (i.e.
tracking what parts of our UI would have been wrapped), but this
behavior is at least at par with the existing behavior.


https://github.com/user-attachments/assets/4eb17689-09fd-4daa-8315-c7ebc654986d


cc @joshka who might have Thoughts™
2025-07-31 00:06:55 +00:00
pap
33d03c97a4 fmt 2025-07-29 23:19:40 +01:00
Jeremy Rose
fc85f4812f feat: map ^U to kill-line-to-head (#1711)
see
[discussion](https://github.com/rhysd/tui-textarea/issues/51#issuecomment-3021191712),
it's surprising that ^U behaves this way. IMO the undo/redo
functionality in tui-textarea isn't good enough to be worth preserving,
but if we do bring it back it should probably be on C-z / C-S-z / C-y.
2025-07-29 09:40:26 -07:00
pap
04b15ab5a2 fix a few comments/imports 2025-07-28 00:05:08 +01:00
pap
5bf8829465 creating helper function for cursor / removing duplicate code 2025-07-27 23:41:46 +01:00
pap
038484753e if @file is an image selected, then we attach the image (png, jpg) 2025-07-27 23:36:24 +01:00
pap
d58b5f9e91 rename at_image to at_clipboard_image 2025-07-27 23:26:32 +01:00
pap
68f1ceabdc fixing at_command that trigger file search at the same time. add default files for @file command to prompt user what they can search 2025-07-27 23:23:36 +01:00
pap
778857ac14 FileSearchPopup becomes an at_command 2025-07-27 22:35:11 +01:00
pap
a56b327428 add "@ command" 2025-07-27 22:24:12 +01:00
pap
d6d1df4b1f delete images in prompt with backspace 2025-07-27 21:37:09 +01:00
easong-openai
af90cbc0b8 Remove tab focus switching (#1694)
Previously pressing tab would switch TUI focus to the history scrollbox - no longer necessary.
2025-07-27 20:50:38 +01:00
easong-openai
58bed77ba7 Remove tab focus switching (#1694)
Previously pressing tab would switch TUI focus to the history scrollbox - no longer necessary.
2025-07-27 11:04:09 -07:00