Skip to content

Simplify session open preparation flow #278

Description

@thymikee

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions