refactor: decompose SessionManager into focused services (ARC-3)#1704
Merged
OneStepAt4time merged 3 commits intodevelopfrom Apr 12, 2026
Merged
refactor: decompose SessionManager into focused services (ARC-3)#1704OneStepAt4time merged 3 commits intodevelopfrom
OneStepAt4time merged 3 commits intodevelopfrom
Conversation
Extract two focused service classes from the 1,747-line SessionManager: - SessionTranscripts: JSONL reading, caching, pagination, summaries (313 lines) Owns parsedEntriesCache, getCachedEntries, readMessages, readMessagesForMonitor, readTranscript, readTranscriptCursor, getSummary - SessionDiscovery: discovery polling, session map sync, filesystem scan (321 lines) Owns pollTimers, discoveryTimeouts, startDiscoveryPolling, stopDiscoveryPolling, syncSessionMap, maybeDiscoverFromFilesystem, cleanSessionMapForWindow, purgeStaleSessionMapEntries SessionManager retains lifecycle (create/kill), persistence (load/save/encrypt), terminal interaction (send/escape/interrupt), and health monitoring. Delegates to extracted services via composition with dependency injection. session.ts reduced from 1,747 to 1,321 lines (24% reduction). Public API unchanged — all consumers see the same SessionManager interface. Closes #1696
- session.ts: use Object.create(null) for sessions dictionary to eliminate prototype chain (fixes CodeQL js/prototype-polluting-assignment in session-transcripts.ts lines 48-49) - tmux-polling-395.test.ts: access discovery methods/properties through sm.discovery instead of sm directly after ARC-3 extraction (fixes CI test failures on ubuntu)
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.
Summary
Decomposes the 1,747-line SessionManager monolith into focused service classes via internal composition. Public API remains unchanged.
Extracted services
What stays in SessionManager (1,321 lines)
Approach
Quality gate
px tsc --noEmit\ — passes
pm run build\ — passes
pm test\ — 159 passed, 2 skipped (2,814 tests)
Aegis version
Developed with: v0.5.0-alpha
Closes #1696