Follow-up to #2562 adding support for backspace character compression.
Optimizes terminal output by handling backspace characters similar to
carriage returns, improving readability of progress spinners and other
terminal output that uses backspace for animation.
- Added processBackspaces function using efficient indexOf approach
- Added comprehensive test suite for backspace handling
- Integrated with terminal output compression pipeline
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Co-authored-by: Eric Wheeler <roo-code@z.ewheeler.org>
* rus
* sad
* fix lang
* Add ru to translate mode instructions
* Add ru to evals types
* Add link to READMEs
* Bring back smart quotes
* Add prompt caching translations
---------
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
* fix(terminal): Ensure correct handling of carriage returns for progress bars
This commit refines the tests for `TerminalProcess` to ensure the correct interpretation of terminal output containing carriage returns (`\\r`), which is essential for properly handling dynamic elements like progress bars (e.g., `tqdm`).
- Validated the `processCarriageReturns` method's behavior in simulating terminal line overwrites caused by `\\r`.
- Corrected the expectation in the `handles carriage returns in mixed content` test to accurately reflect the method's output (final line content + preserved escape sequences), confirming the logic works as intended for progress-bar-like updates.
- Fixed a minor Jest `toBe` syntax error in a related test case.
- Suppressed an expected `console.warn` in the non-shell-integration test for cleaner logs.
By ensuring `processCarriageReturns` is correctly tested, we increase confidence that the component responsible for pre-processing terminal output handles progress bars appropriately before the output is potentially used elsewhere (e.g., sent to an LLM).
* fix(test): Make TerminalProcess integration test reliable
This commit fixes the flaky test case `integrates with getUnretrievedOutput to handle progress bars` in `TerminalProcess.test.ts`.
The test previously failed intermittently due to:
1. Relying on a fixed `setTimeout` duration to wait for asynchronous stream processing, which created a race condition.
2. Incorrectly assuming that `await terminalProcess.run(...)` would return the final output directly via its resolved value.
The fix addresses these issues by:
- Removing the unreliable intermediate check based on `setTimeout`.
- Modifying the test to correctly obtain the final output by listening for the `completed` event emitted by `TerminalProcess`, which is the intended way to receive the result.
This ensures the test accurately reflects the behavior of `TerminalProcess` and is no longer prone to timing-related failures.
* Add changeset for terminal carriage return fix
* Implement terminal compress progress bar feature
This commit introduces a new feature to compress terminal output by processing carriage returns. The `processCarriageReturns` function has been integrated into the `Terminal` class to handle progress bar updates effectively, ensuring only the final state is displayed.
Additionally, the `terminalCompressProgressBar` setting has been added to the global settings schema, allowing users to enable or disable this feature.
Tests have been updated to validate the new functionality and ensure correct behavior in various scenarios.
A Benchmark is also added to test the performance.
Not that there is still no i18n support for this.
* Add i18n support for compressProgressBar setting in multiple languages
* Optimize processCarriageReturns function for performance and multi-byte character handling
This commit enhances the `processCarriageReturns` function by implementing in-place string operations to improve performance, especially with large outputs. Key features include:
- Line-by-line processing to maximize chunk handling.
- Use of string indexes and substring operations instead of arrays.
- Single-pass traversal of input for efficiency.
- Special handling for multi-byte characters to prevent corruption during overwrites.
Additionally, tests have been updated to validate the new functionality, ensuring correct behavior with various character sets, including emojis and non-ASCII text.
Highly Density CR case is added to Benchmark
* slight performance improvement by caching several variable
* Optimize multi-byte character handling in processCarriageReturns
Refactor the logic within the `processCarriageReturns` function to simplify the detection of partially overwritten multi-byte characters (e.g., emojis).
Removed redundant checks and clarified the conditions for identifying potential character corruption during carriage return processing. This improves code readability and maintainability while preserving the original functionality of replacing potentially corrupted characters with a space.
Also enforced consistent use of semicolons for improved code style.
* docs: standardize carriage return (\r) and line feed (\n) terminology
Improve code clarity by consistently adding escape sequence notation to all
references of carriage returns and line feeds throughout documentation and tests.
This makes the code more readable and avoids ambiguity when discussing these special characters.
* feat: Improve terminal output processing clarity and settings UI
- Add detailed comments to `processCarriageReturns` explaining line feed handling.
- Relocate `terminalCompressProgressBar` setting below `terminalOutputLineLimit` for better context in UI.
* Fix: Compress Progress Bar Setting Checkbox
---------
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
Add animated dots to progress indicator based on content length
Optimize when progress updates are shown (every 10 characters)
Move searchBlockCount calculation inside conditional blocks
Skip unnecessary ask operations when toolProgressStatus is empty
* OpenRouter Gemini caching
* Fix tests
* Remove unsupported models
* Clean up the task header a bit
* Update src/api/providers/openrouter.ts
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
* Remove model that doesn't seem to work
---------
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
* Update validate.ts
Allow ARNs from Bedrock Marketplace, which are different because models are deployed using SageMaker Inference behind the scenes.
* Update bedrock.ts
Allow ARNs from Bedrock Marketplace, which are different because models are deployed using SageMaker Inference behind the scenes.
The FakeAI object passed by the user must be exactly the same object
that is passed to FakeAIHandler via API configuration.
Unfortunatelly, as the VSCode global state is used as configuration
storage, we lose this property (VSCode global state creates copies of
the object). Also the class of the stored object is lost, so methods
of the object are unavailable.
Therefore, we store the original objects in global variable and
use ID field of FakeAI object to identify the original object.
* feat: support environment variables reference in mcp `env` config
* tests(src/utils/config): add test for `injectEnv`
* fix(injectEnv): use `env == null` and `??` check instead of `!env`, `||`
* refactor: remove unnecessary type declare
* chore!: simplify regexp, remove replacement for env vars with dots
* feat: initialize VS Code Language Model client in constructor
* feat: add VS Code LLM models and configuration
* feat: integrate VS Code LLM models into API configuration normalization
* Fix tests
---------
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
- Maintains editor view column state when closing and reopening files during diff operations, ensuring tabs stay opened in their original position.
- Prevents closing the original editor tab when opening the diff view, preserving pinned status when applying changes via write_to_file or apply_diff.
- Updates VSCode workspace launch flag from -n to -W for compatibility.
* fix: allow opening files without workspace root
The openFile function in open-file.ts was requiring a workspace root to be present,
which prevented opening global files (like MCP settings) when no workspace was open.
Modified the function to handle absolute paths without this requirement.
Previously, trying to open MCP settings in a new window without a workspace would
error with "Could not open file: No workspace root found". Now the function
properly handles both workspace-relative and absolute paths, allowing global
settings files to be accessed in any context.
Changes:
- Removed workspace root requirement in openFile
- Added fallback for relative paths when no workspace is present
* fix: update openFile function to use provided path without modification
---------
Co-authored-by: Roo Code <support@roo.vet>
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>