* Add formatting conventions * Add a fmt lint check * rely on defaults --------- Co-authored-by: Julius Marminge <[email protected]>
1.2 KiB
1.2 KiB
Plan: Decompose CodexAppServerManager
Summary
Split CodexAppServerManager into smaller modules with clear responsibilities.
Motivation
apps/desktop/src/codexAppServerManager.tsis large and mixes:- Process lifecycle
- JSON-RPC parsing/routing
- Session state transitions
- Event emission
- This increases regression risk and slows changes.
Scope
- Desktop provider internals only.
- Keep external behavior/API stable.
Proposed Changes
- Extract modules:
codex/processLifecycle.tscodex/jsonrpcRouter.tscodex/sessionState.tscodex/parsing.ts
- Keep
CodexAppServerManageras thin orchestrator/facade. - Move pure helpers (
classifyCodexStderrLine, route parsing) into unit-testable files. - Add targeted unit tests for:
- Message classification
- Request/notification/response routing
- Session state transitions
Risks
- Reordering event handling can change behavior.
- Must preserve pending request timeout/cancellation semantics.
Validation
- Existing tests pass.
- Add module-level tests for parsing and transition logic.
Done Criteria
- Main manager file materially smaller and orchestration-focused.
- Core protocol/state logic covered by focused tests.