[PR #2577] Session management and prompt handling improvements #10362

Closed
opened 2026-02-16 18:14:59 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/2577

State: closed
Merged: Yes


Overview

This PR refactors the session management system to improve code organization and maintainability.

Key Changes

🏗️ Architecture Improvements

  • Split monolithic session/index.ts: Separated concerns by extracting compaction and revert logic into dedicated modules
  • New session/compaction.ts: Dedicated session compaction functionality (120 lines)
  • New session/revert.ts: Session revert capabilities (105 lines)

📝 Prompt System Enhancement

  • Enhanced session/prompt.ts: Major refactoring with improved prompt handling logic
  • Updated session/message-v2.ts: Better message processing capabilities

🔧 Integration Updates

  • Modified cli/cmd/run.ts: Updated run command integration
  • Updated server/server.ts: Enhanced server functionality
  • Improved tool/task.ts: Better task handling
  • Enhanced test coverage: Updated session/fileRegex.test.ts

Impact

  • Reduced session/index.ts from 1,678 lines to a more manageable size
  • Improved code modularity and testability
  • Better separation of concerns across session management components
  • Enhanced maintainability of the codebase

Files Changed

9 files modified with +1,755 additions and -1,682 deletions

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/2577 **State:** closed **Merged:** Yes --- ## Overview This PR refactors the session management system to improve code organization and maintainability. ## Key Changes ### 🏗️ Architecture Improvements - **Split monolithic session/index.ts**: Separated concerns by extracting compaction and revert logic into dedicated modules - **New session/compaction.ts**: Dedicated session compaction functionality (120 lines) - **New session/revert.ts**: Session revert capabilities (105 lines) ### 📝 Prompt System Enhancement - **Enhanced session/prompt.ts**: Major refactoring with improved prompt handling logic - **Updated session/message-v2.ts**: Better message processing capabilities ### 🔧 Integration Updates - **Modified cli/cmd/run.ts**: Updated run command integration - **Updated server/server.ts**: Enhanced server functionality - **Improved tool/task.ts**: Better task handling - **Enhanced test coverage**: Updated session/fileRegex.test.ts ## Impact - Reduced session/index.ts from 1,678 lines to a more manageable size - Improved code modularity and testability - Better separation of concerns across session management components - Enhanced maintainability of the codebase ## Files Changed 9 files modified with +1,755 additions and -1,682 deletions
yindo added the pull-request label 2026-02-16 18:14:59 -05:00
yindo closed this issue 2026-02-16 18:14:59 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10362