Skip to content

Refactor interaction handler into focused targeting/snapshot modules #156

@thymikee

Description

@thymikee

Problem

src/daemon/handlers/interaction.ts is currently ~830 LOC and carries multiple concerns: command routing, selector resolution, @ref handling, coordinate parsing, snapshot capture, and interaction recording.

Goal

Refactor interaction handler into focused internal modules while preserving interaction command behavior and replay selector-chain recording.

Proposed split

  • src/daemon/handlers/interaction-targeting.ts
    • coordinate target parsing + @ref target resolution + rect normalization
  • src/daemon/handlers/interaction-snapshot.ts
    • session snapshot capture and related helpers
  • src/daemon/handlers/interaction-flags.ts
    • ref snapshot flag guard + validation helpers
  • Keep src/daemon/handlers/interaction.ts as command-level orchestration.

Acceptance criteria

  • Selector + @ref behavior remains unchanged.
  • Recorded actions still contain expected selectorChain metadata.
  • No command routing moved into src/daemon.ts.
  • New files target <=300 LOC when practical.
  • Existing interaction and replay-heal tests pass unchanged.

Validation

  • pnpm typecheck
  • pnpm test:unit
  • pnpm test:smoke

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions