Parent: #2132
Blocked by: #2177.
Outcome
Move interaction, touch, gesture, and find route implementations behind the accepted interaction facade so the remaining handler files perform routing only.
Exact production scope
Move these remaining files into src/daemon/interaction/internal/ (the prerequisite owns the other eight shared files):
-
src/daemon/handlers/find.ts
-
src/daemon/handlers/find-match-ranking.ts
-
src/daemon/handlers/find-match-resolution.ts
-
src/daemon/handlers/find-target-capture.ts
-
src/daemon/handlers/interaction.ts
-
src/daemon/handlers/interaction-android-escape.ts
-
src/daemon/handlers/interaction-gesture.ts
-
src/daemon/handlers/interaction-gesture-response.ts
-
src/daemon/handlers/interaction-ios-tap-outcome.ts
-
src/daemon/handlers/interaction-targeting.ts
-
src/daemon/handlers/interaction-touch.ts
-
src/daemon/handlers/interaction-touch-android-freshness.ts
-
src/daemon/handlers/interaction-touch-android-readiness.ts
-
src/daemon/handlers/interaction-touch-direct-ios-eligibility.ts
-
src/daemon/handlers/interaction-touch-direct-ios.ts
-
src/daemon/handlers/interaction-touch-fill.ts
-
src/daemon/handlers/interaction-touch-payload.ts
-
src/daemon/handlers/interaction-touch-policy.ts
-
src/daemon/handlers/interaction-touch-prepare.ts
-
src/daemon/handlers/interaction-touch-press-admission.ts
-
src/daemon/handlers/interaction-touch-press.ts
-
src/daemon/handlers/interaction-touch-reference-frame.ts
-
src/daemon/handlers/interaction-touch-response.ts
-
src/daemon/handlers/interaction-touch-runtime.ts
-
src/daemon/handlers/interaction-touch-targets.ts
-
Extend src/daemon/interaction/index.ts with only handleInteractionCommands, handleFindCommands, and their named narrow inputs.
-
Update src/daemon/request-handler-chain.ts to lazy-load the public interaction facade for both interaction and find routes. Preserve the lazy closure and route-owner metadata.
-
Delete the old production paths, old broad handler parameter types, and superseded fixtures; no compatibility re-exports.
-
Update scripts/layering/architecture-ownership.ts, route-owner declarations, and structural tests so only the facade is externally importable.
Commands covered: tap, longpress, hover, fill, gesture, swipe, type, get, is, and find.
Authority contract
Use the prerequisite's named interaction operations. Current leaf reads include device, surface, appBundleId, trace, snapshot, lease, and screenRecording; do not widen them. Ref-frame expiration, snapshot publication/freshness, deferred outcomes, action recording, script publication, Android readiness, runtime binding, and platform cleanup stay with existing owners/capabilities.
Exact external capabilities remain InspectDeviceRuntimeFacts, BindDeviceRuntime, AndroidObservationAdapter, and optional PlatformResourceCleanup, plus the existing request context function. Do not introduce an interactor-shaped capability bag.
Behavior and structural proof
Move the matching src/daemon/handlers/__tests__/interaction-*.test.ts, find-*.test.ts, find.test.ts, and their named fixture modules one-to-one with source. Move interaction.test.ts only after splitting its remaining aggregation into owner tests. Preserve and run route-level characterization for direct iOS eligibility, Android freshness/readiness, ref authorization, press/touch/fill payloads, gesture/swipe, type, get/is, find ranking/single-bind, settled observations, deferred outcomes, response construction, and target evidence.
Plant both forbidden deep-import directions, old-path regrowth, and an eager-load regression in the request-handler closure. The planted failures must name the invariant.
Shrink and validation
Minimal request handlers should be route selection and argument projection only. Report gross and move-adjusted production LOC; the child must shrink after discounting moves and remove superseded tests/baseline slack. Run focused route suites, ADR 0011 guarantee/coverage tests, R7/session-state tests, pnpm check:layering, fallow audit, and pnpm check:affected --run after staging.
No replay engine move, no silent script rewriting, no behavior/error/wire change, and no generic package extraction.
Parent: #2132
Blocked by: #2177.
Outcome
Move interaction, touch, gesture, and find route implementations behind the accepted interaction facade so the remaining handler files perform routing only.
Exact production scope
Move these remaining files into
src/daemon/interaction/internal/(the prerequisite owns the other eight shared files):src/daemon/handlers/find.tssrc/daemon/handlers/find-match-ranking.tssrc/daemon/handlers/find-match-resolution.tssrc/daemon/handlers/find-target-capture.tssrc/daemon/handlers/interaction.tssrc/daemon/handlers/interaction-android-escape.tssrc/daemon/handlers/interaction-gesture.tssrc/daemon/handlers/interaction-gesture-response.tssrc/daemon/handlers/interaction-ios-tap-outcome.tssrc/daemon/handlers/interaction-targeting.tssrc/daemon/handlers/interaction-touch.tssrc/daemon/handlers/interaction-touch-android-freshness.tssrc/daemon/handlers/interaction-touch-android-readiness.tssrc/daemon/handlers/interaction-touch-direct-ios-eligibility.tssrc/daemon/handlers/interaction-touch-direct-ios.tssrc/daemon/handlers/interaction-touch-fill.tssrc/daemon/handlers/interaction-touch-payload.tssrc/daemon/handlers/interaction-touch-policy.tssrc/daemon/handlers/interaction-touch-prepare.tssrc/daemon/handlers/interaction-touch-press-admission.tssrc/daemon/handlers/interaction-touch-press.tssrc/daemon/handlers/interaction-touch-reference-frame.tssrc/daemon/handlers/interaction-touch-response.tssrc/daemon/handlers/interaction-touch-runtime.tssrc/daemon/handlers/interaction-touch-targets.tsExtend
src/daemon/interaction/index.tswith onlyhandleInteractionCommands,handleFindCommands, and their named narrow inputs.Update
src/daemon/request-handler-chain.tsto lazy-load the public interaction facade for bothinteractionandfindroutes. Preserve the lazy closure and route-owner metadata.Delete the old production paths, old broad handler parameter types, and superseded fixtures; no compatibility re-exports.
Update
scripts/layering/architecture-ownership.ts, route-owner declarations, and structural tests so only the facade is externally importable.Commands covered:
tap,longpress,hover,fill,gesture,swipe,type,get,is, andfind.Authority contract
Use the prerequisite's named interaction operations. Current leaf reads include
device,surface,appBundleId,trace,snapshot,lease, andscreenRecording; do not widen them. Ref-frame expiration, snapshot publication/freshness, deferred outcomes, action recording, script publication, Android readiness, runtime binding, and platform cleanup stay with existing owners/capabilities.Exact external capabilities remain
InspectDeviceRuntimeFacts,BindDeviceRuntime,AndroidObservationAdapter, and optionalPlatformResourceCleanup, plus the existing request context function. Do not introduce an interactor-shaped capability bag.Behavior and structural proof
Move the matching
src/daemon/handlers/__tests__/interaction-*.test.ts,find-*.test.ts,find.test.ts, and their named fixture modules one-to-one with source. Moveinteraction.test.tsonly after splitting its remaining aggregation into owner tests. Preserve and run route-level characterization for direct iOS eligibility, Android freshness/readiness, ref authorization, press/touch/fill payloads, gesture/swipe, type, get/is, find ranking/single-bind, settled observations, deferred outcomes, response construction, and target evidence.Plant both forbidden deep-import directions, old-path regrowth, and an eager-load regression in the request-handler closure. The planted failures must name the invariant.
Shrink and validation
Minimal request handlers should be route selection and argument projection only. Report gross and move-adjusted production LOC; the child must shrink after discounting moves and remove superseded tests/baseline slack. Run focused route suites, ADR 0011 guarantee/coverage tests, R7/session-state tests,
pnpm check:layering, fallow audit, andpnpm check:affected --runafter staging.No replay engine move, no silent script rewriting, no behavior/error/wire change, and no generic package extraction.