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
Problem
src/daemon/handlers/interaction.tsis 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.tssrc/daemon/handlers/interaction-snapshot.tssrc/daemon/handlers/interaction-flags.tssrc/daemon/handlers/interaction.tsas command-level orchestration.Acceptance criteria
@refbehavior remains unchanged.selectorChainmetadata.src/daemon.ts.Validation
pnpm typecheckpnpm test:unitpnpm test:smoke