Summary
The open refactor in PR #268 left src/daemon/handlers/session-open-prepare.ts as the most abstraction-heavy part of the session handler split.
The current shape still uses:
PreparedOpenCommand
{ response } | { prepared } discriminated-union returns
prepareResolvedOpenCommand(...) as an intermediate step before completeOpenCommand(...)
That keeps the module readable, but it also adds indirection and parameter threading that do not appear to buy much now.
Goal
Reduce session-open-prepare.ts by collapsing the intermediate prepared-command layer.
A likely direction is:
- let
prepareExistingOpenCommand(...) and prepareNewOpenCommand(...) complete the open flow directly, or
- otherwise remove the
PreparedOpenCommand return object and keep the shared logic in a smaller helper that returns only the concrete values still needed
Scope
In scope:
src/daemon/handlers/session-open-prepare.ts
src/daemon/handlers/session-open.ts
src/daemon/handlers/session-open-surface.ts if needed
Out of scope:
- changing CLI behavior
- changing runtime-hint semantics
- changing macOS surface behavior
Notes
This should be treated as structural cleanup, not a behavior change.
The intent is to keep the module split from PR #268, but remove the remaining abstraction overhead in the open path.
Summary
The
openrefactor in PR #268 leftsrc/daemon/handlers/session-open-prepare.tsas the most abstraction-heavy part of the session handler split.The current shape still uses:
PreparedOpenCommand{ response } | { prepared }discriminated-union returnsprepareResolvedOpenCommand(...)as an intermediate step beforecompleteOpenCommand(...)That keeps the module readable, but it also adds indirection and parameter threading that do not appear to buy much now.
Goal
Reduce
session-open-prepare.tsby collapsing the intermediate prepared-command layer.A likely direction is:
prepareExistingOpenCommand(...)andprepareNewOpenCommand(...)complete the open flow directly, orPreparedOpenCommandreturn object and keep the shared logic in a smaller helper that returns only the concrete values still neededScope
In scope:
src/daemon/handlers/session-open-prepare.tssrc/daemon/handlers/session-open.tssrc/daemon/handlers/session-open-surface.tsif neededOut of scope:
Notes
This should be treated as structural cleanup, not a behavior change.
The intent is to keep the module split from PR #268, but remove the remaining abstraction overhead in the
openpath.