-
Notifications
You must be signed in to change notification settings - Fork 100
feat: add persistent shell sessions for local and remote execution #438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kajogo777
wants to merge
12
commits into
main
Choose a base branch
from
feat/persistent-shell-sessions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Implements persistent shell sessions that maintain state (environment variables, working directory, aliases) across multiple command executions. Key features: - LocalShellSession: PTY-based local shell using portable-pty - RemoteShellSession: SSH-based remote shell using russh with PTY allocation - ShellSessionManager: Central manager for session lifecycle - Marker-based command completion detection - ANSI escape code stripping and output cleaning Implementation details: - ShellSession trait for unified local/remote interface - Default session auto-creation for seamless persistent behavior - Session timeout and max session limits - Comprehensive test coverage (36 unit tests) Files: - libs/shared/src/shell_session/ - Core session implementation - SSH integration tests disabled (require external container)
- Add execute_streaming method to ShellSession trait with OutputChunk/OutputReceiver types - Implement streaming for LocalShellSession and RemoteShellSession - Add execute_in_session_streaming to ShellSessionManager - Integrate streaming into MCP execute_in_persistent_session with notify_progress - Falls back to non-streaming execution on error - Add 2 streaming tests (basic and multiline) - Total: 251 tests passing
- Apply clean_shell_output to streaming chunks (not just final output) - Track last_streamed_len to stream only new cleaned content - Improve is_prompt_line detection for user@host patterns - Remove control characters (\r, backspace) in clean_shell_output - Update streaming tests to verify clean output - Both local and remote sessions now stream clean output
- Only stream content up to the last newline character - Prevents partial line updates that cause visual flicker - Applied to both local and remote session streaming
…sistent-shell-sessions
- Replace custom strip_ansi_codes implementations with console crate - Remove strip-ansi-escapes dependency, use console (same as TUI) - Remove redundant wrapper functions and tests - Use console::strip_ansi_codes() directly in shell session modules
…sistent-shell-sessions
…sistent-shell-sessions
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.
Summary
Implements persistent shell sessions that maintain state (environment variables, working directory, aliases) across multiple command executions.
Key Features
portable-ptyrusshwith PTY allocationImplementation Details
ShellSessiontrait for unified local/remote interfaceFiles Changed
libs/shared/src/shell_session/- Core session implementationTesting