Add in-session cancelled command and agent prompt history managers#313
Draft
Add in-session cancelled command and agent prompt history managers#313
Conversation
- Add SessionHistoryManager struct to history.rs for in-session, transient history (no file I/O). Supports push(), is_empty(), and the full fuzzy-search API (shared FuzzyHistorySearch internals). - Add FuzzyCancelledCommandSearch and FuzzyAgentPromptSearch ContentMode variants. - Add cancelled_command_history and agent_prompt_history fields to App. - Ctrl+C on non-empty buffer now saves the buffer to cancelled_command_history before exiting. Ctrl+C on an empty buffer (with saved history) opens the FuzzyCancelledCommandSearch fuzzy picker instead of exiting. - Shift+Enter on an empty buffer (when AI is configured and agent history exists) opens FuzzyAgentPromptSearch instead of starting AI mode immediately. - start_ai_mode() records the prompt in agent_prompt_history before launching. - Full keyboard navigation (Up/Down/PageUp/PageDown/Enter/Shift+Enter/Tab/Esc) and mouse hover/click support for both new modes. - Extract fuzzy history rendering into a shared render_fuzzy_history_results() free function; move ts_to_timeago_string_5chars() to module level. - Add 3 new unit tests for SessionHistoryManager. Co-authored-by: HalFrgrd <4559349+HalFrgrd@users.noreply.github.com> Agent-Logs-Url: https://github.com/HalFrgrd/flyline/sessions/7117513e-e128-4df3-8422-63d00f4d2ae9
Copilot
AI
changed the title
[WIP] Add history managers for agent mode buffers
Add in-session cancelled command and agent prompt history managers
Mar 20, 2026
HalFrgrd
requested changes
Mar 24, 2026
Owner
HalFrgrd
left a comment
There was a problem hiding this comment.
I only want one content mode to handle all three different history managers. Figure out the best way to make this happen. This will make the code change small
Don't create a new history session manager class. Reuse the current history manager. Give it a constructor called empty to generate empty ones.
…uctor Per reviewer feedback: - Remove SessionHistoryManager; add HistoryManager::empty(), push(), is_empty() so the same struct handles both file-backed and in-session-only history - Collapse FuzzyHistorySearch / FuzzyCancelledCommandSearch / FuzzyAgentPromptSearch into a single ContentMode::FuzzyHistorySearch(FuzzyHistorySource) variant - Add FuzzyHistorySource enum (BashHistory / CancelledCommands / AgentPrompts) with a label() helper - Add ContentMode::fuzzy_source() and App::history_manager_for() helpers to eliminate repeated dispatch matches across key handlers, mouse handlers, and the accept method Co-authored-by: HalFrgrd <4559349+HalFrgrd@users.noreply.github.com> Agent-Logs-Url: https://github.com/HalFrgrd/flyline/sessions/2e957992-e36d-4fae-bf62-c94fe26462ef
Contributor
Author
Done in fd83cbc.
|
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.
Users had no way to recall commands they Ctrl+C'd or prompts previously sent to agent mode within a session.
New behavior
cancelled_command_historybefore exiting (existing exit behavior preserved)start_ai_mode()— pushes current buffer toagent_prompt_historybefore spawning the AI subprocessImplementation
src/history.rsAdded
HistoryManager::empty()constructor to create lightweight in-session-only managers (no file I/O; entries are lost on session exit). Also addedpush()andis_empty()methods toHistoryManager.src/app/mod.rsFuzzyHistorySourceenum (BashHistory,CancelledCommands,AgentPrompts) with alabel()helperContentMode::FuzzyHistorySearchto carry aFuzzyHistorySource, replacing the need for separate mode variants — a single content mode handles all three history managerscancelled_command_historyandagent_prompt_historyfields onApp(typed asHistoryManager, initialized withHistoryManager::empty())ContentMode::fuzzy_source()andApp::history_manager_for(source)helpers to eliminate repeated dispatch matches across key handlers, mouse handlers, and the accept methodrender_fuzzy_history_results()free function shared by all three history sources; movedts_to_timeago_string_5chars()to module level accordinglyOriginal prompt
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.