feat(tui): add /context inventory and /drop to remove attached files#3450
Open
Sayt-0 wants to merge 1 commit into
Open
feat(tui): add /context inventory and /drop to remove attached files#3450Sayt-0 wants to merge 1 commit into
Sayt-0 wants to merge 1 commit into
Conversation
List attached files and prompt files with per-item token estimates in a new /context dialog, and allow dropping attachments from the session (d key in the dialog, or /drop <path>). Adds Session.RemoveAttachedFile and resolves the current agent's add_prompt_files entries through the same lookup rules as the turn-start hook. Closes #3435
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3435
Summary
Adds an Aider-style context inventory to the TUI: a
/contextdialog listing every file currently entering the session context (attachments and prompt files) with per-item token estimates, plus the ability to drop attachments, interactively or via/drop <path>.Issue expectations mapping
/contextdialog with "Attached files" and "Prompt files (agent config)" sections,~N tokensper file (size/4, the same rule of thumb as the session truncation budget), plus a totals lined/x/delete/backspaceon the selected entry, or/drop <path>directly;/dropwithout argument opens the dialogSession.AttachedFilesSession.RemoveAttachedFile(absPath) bool, mutex-guarded, next toAddAttachedFile@refcompletion consistent (editor.go)@completion lists workspace files (session-independent); re-mentioning a dropped file re-attaches it through the existing send pathFlow
Notes
add_prompt_fileshook), so dropping one is refused with an info toast.promptfiles.PathsFromEnv), exposed through an optional runtime capability; remote runtimes simply omit the section.missing(no token estimate).SessionStore.UpdateSessionso resumed sessions do not resurrect them.Testing
Session.RemoveAttachedFile(3 cases) and the context dialog (8 cases: entry building, empty state, sections/token rendering, navigation bounds, drop semantics, prompt-file refusal, selection clamping, close).go build ./...andgolangci-lint run: clean.go test ./...: green exceptTestURLSource_Read_RejectsLocalAddresses(pkg/config), which fails identically onmainin this environment (network-dependent, unrelated to this change).