- Add activeTerminalSessions count to ExtensionState type
- Add ProcessManager query in ClineProvider.getState() to count running sessions
- Add TerminalSquare icon indicator in TaskHeader showing session count
- Show indicator only when there are active sessions (green icon + count)
- Add i18n translations for terminal session tooltip
- Update ExtensionStateContext test with new property
- Add proper UI cases for write_stdin showing session ID and input chars
- Add terminate_session rendering with termination status
- Add list_sessions rendering with sessions table
- Add i18n translations for all stdin operations
- Add writeStdin method to RooTerminalProcess interface
- Add abstract writeStdin to BaseTerminalProcess
- Implement writeStdin in ExecaTerminalProcess using stdin pipe
- Implement writeStdin in TerminalProcess using terminal.sendText
- Change ExecaTerminalProcess from stdin: 'ignore' to stdin: 'pipe'
- Update WriteStdinTool to use unified process.writeStdin() method
This enables write_stdin tool to work with both VSCode terminals and
Execa terminals, providing consistent interactive terminal support.
- Add terminate_session tool to kill running terminal sessions
- Add list_sessions tool to view active terminal sessions
- Add listSessions and terminateSession methods to ProcessManager
- Create native tool schemas for both tools
- Create tool handlers (TerminateSessionTool, ListSessionsTool)
- Add routing in presentAssistantMessage.ts
- Add parsing support in NativeToolCallParser.ts
- Add 8 new tests for ProcessManager methods (23 total tests)
These tools complement write_stdin to provide complete terminal session management:
- execute_command starts a process (returns session_id if still running)
- write_stdin sends input to running processes
- list_sessions shows all active sessions
- terminate_session kills a running session
This commit implements the interactive terminal feature from the terminal
integration specification (plans/extract-terminal-integration.md).
Changes:
- Add write_stdin to toolNames in packages/types/src/tool.ts
- Create write_stdin native tool schema in src/core/prompts/tools/native-tools/
- Create WriteStdinTool handler in src/core/tools/
- Add ProcessManager to track running processes by session_id
- Modify ExecuteCommandTool to register processes when still running
- Add write_stdin to tool routing in presentAssistantMessage.ts
- Add write_stdin to NativeToolCallParser for streaming support
- Add tests for ProcessManager
The write_stdin tool enables the LLM to:
- Send input to running terminal processes (y/n prompts, passwords)
- Send control characters like Ctrl+C (\x03)
- Poll for new output from long-running processes
When execute_command starts a process that's still running after the
yield time, it registers the process with ProcessManager and returns
a session_id. The LLM can then use write_stdin with that session_id
to interact with the process.
When using search mode, the UI now shows the search pattern and match count
instead of the misleading byte range (0 B - totalSize).
- Added searchPattern and matchCount fields to ClineSayTool type
- Updated ReadCommandOutputTool to return match count from search operations
- Updated ChatRow to display 'search: "pattern" • N matches' for search mode
- Update RooTerminalCallbacks.onCompleted type to allow async callbacks (void | Promise<void>)
- Track onCompleted completion with a promise and await it before using persistedResult
- This fixes a race condition where exitDetails could be set before the async finalize() completes
- Fix test callback to not return assignment value
- OutputInterceptor.finalize() now awaits stream flush before returning
This ensures artifact files are fully written before the artifact_id
is advertised to the LLM, preventing partial reads.
- Remove strict mode from read_command_output native tool schema
With strict: true, OpenAI requires all params in 'required', forcing
the LLM to provide explicit null values for optional params. This
created verbose tool calls. Now optional params can be omitted entirely.
- Update tests to handle async finalize() method
Replace fs.readFile with chunked streaming in searchInArtifact() to keep
memory usage bounded for large command outputs. Instead of loading the
entire file into memory, reads in 64KB chunks and processes lines as
they are encountered.
This addresses the concern that loading 100MB+ build logs into memory
defeats the purpose of the persisted output feature.
- OutputInterceptor: Buffer ALL chunks before spilling to disk to preserve
full content losslessly. Previously, the rolling tail buffer could drop
middle content before the spill decision was made.
- read_command_output schema: Include all properties in 'required' array
for OpenAI strict mode compliance. With strict: true, all properties
must be listed in required (optional ones use null union types).
- Replace single buffer with separate headBuffer and tailBuffer
- Each buffer gets 50% of the preview budget
- Head captures beginning of output, tail keeps rolling end
- Middle content is dropped when output exceeds threshold
- Preview shows: head + [omission indicator] + tail
- Add tests for head/tail split behavior
This approach ensures the LLM sees both:
- The beginning (command startup, environment info, early errors)
- The end (final results, exit codes, error summaries)
These settings were redundant with terminalOutputPreviewSize which controls
the preview shown to the LLM. The line/char limits were for UI truncation
which is now handled with hardcoded defaults (500 lines, 50K chars) since
they don't need to be user-configurable.
- Remove settings from packages/types schemas
- Remove DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT constant
- Update compressTerminalOutput() to use hardcoded limits
- Update ExecuteCommandTool to not pass limit parameters
- Update ClineProvider state handling
- Update webview context and settings
- Update tests to not use removed settings
Show read progress in chat when read_command_output tool is used:
- Display 'Roo read command output (0 B - 100 KB of 263.3 KB)'
- Shows the specific byte range being read each call
- Uses same visual style as read_file tool
- Add 'tool' to ClineSay types
- Add readCommandOutput to ClineSayTool with readStart/readEnd/totalBytes
- Remove unused barrel file (src/integrations/terminal/index.ts) to fix knip check
- Fix Windows path test in OutputInterceptor.test.ts by using path.normalize()
- Add missing translations for terminal.outputPreviewSize settings to all 17 locales
- Read terminalOutputPreviewSize from providerState instead of hardcoded default
- Fix native tool schema to only require artifact_id (optional params no longer required)
- Fix Buffer allocation for line numbers using chunked 64KB reads to avoid memory blowup
Implements a new tool that allows the LLM to retrieve full command output
when execute_command produces output exceeding the preview threshold.
Key components:
- ReadCommandOutputTool: Reads persisted output with search/pagination
- OutputInterceptor: Intercepts and persists large command outputs to disk
- Terminal settings UI: Configuration for output interception behavior
- Type definitions for output interception settings
The tool supports:
- Reading full output beyond the truncated preview
- Search/filtering with regex patterns (like grep)
- Pagination through large outputs using offset/limit
Includes comprehensive tests for ReadCommandOutputTool and OutputInterceptor.
* feat(condense): add smart code folding with tree-sitter signatures
At context condensation time, use tree-sitter to generate folded code
signatures (function definitions, class declarations) for files read
during the conversation. Each file is included as its own <system-reminder>
block in the condensed summary, preserving structural awareness without
consuming excessive tokens.
- Add getFilesReadByRoo() method to FileContextTracker
- Create generateFoldedFileContext() using tree-sitter parsing
- Update summarizeConversation() to accept array of file sections
- Each file gets its own content block in the summary message
- Add comprehensive test coverage (12 tests)
* fix: skip tree-sitter error strings in folded file context
- Add isTreeSitterErrorString helper to detect error messages
- Skip files that return error strings instead of embedding them
- Add test for error string handling
* refactor: move generateFoldedFileContext() inside summarizeConversation()
- Update summarizeConversation() to accept filesReadByRoo, cwd, rooIgnoreController instead of pre-generated sections
- Move folded file context generation inside summarizeConversation() (lines 319-339)
- Update ContextManagementOptions type and manageContext() to pass new parameters
- Remove generateFoldedFileContext from Task.ts imports - folding now handled internally
- Update all tests to use new parameter signature
- Reduces Task.ts complexity by moving folding logic to summarization module
* fix: prioritize most recently read files in folded context
Files are now sorted by roo_read_date descending before folded context
generation, so if the character budget runs out, the most relevant
(recently read) files are included and older files are skipped.
* refactor: improve code quality in condense module
- Convert summarizeConversation to use options object instead of 11 positional params
- Extract duplicated getFilesReadByRoo error handling into helper method
- Remove unnecessary re-export of generateFoldedFileContext
- Update all test files to use new options object pattern
* fix: address roomote feedback - batch error logging and early budget exit
---------
Co-authored-by: Roo Code <roomote@roocode.com>
Co-authored-by: daniel-lxs <ricciodaniel98@gmail.com>
fix: prevent false validation error for local Ollama models
The validation logic was checking against an empty router models object
that was initialized but never populated for Ollama. This caused false
validation errors even when models existed locally.
Now only validates against router models if they actually contain data,
preventing the false error when using local Ollama models.
Fixes ROO-581
Co-authored-by: Roo Code <roomote@roocode.com>