refactor(replay): route Maestro through a backend registry seam
Merged
TH
2mo ago+454+454+012345678901234567890123456789-64-64-01234567890123456789
Summary
First step of #3377 (0.22 Maestro plugin extraction): prepare the seam without breaking behavior.
Every host call site that reached the Maestro engine directly now goes through one owning seam — a replay-backend registry in @agent-device/replay-port:
- daemon replay routing (
routeReplayBackend) andtestdiscovery resolve their backend by id; - request device binding, client-side source bundling, and
replay exportuse the backend'sinspectSource/collectSourceFiles/exportReplayScript; - the Maestro adapter cluster (
replay-maestro-backend.ts) sits behind the registry's single registration thunk — the extraction PR relocates that cluster into the plugin and registers it there, changing no caller; - backend vocabulary (
isReplayBackendId,unsupportedReplayBackendMessage) is owned once in the ad-script grammar instead of per-call-site'maestro'literals.
Behavior, wire shapes, help text, and error wording are unchanged; all engine loading stays behind function-scoped import()s, so the CLI/daemon startup-closure pins hold untouched. Touched files: 22.
Review follow-ups (4b853ce): native-only test --maestro suites never resolve a backend; a failed backend load is not memoized and stays retryable; parseReplayInput rejects through the shared guard too.
Refs #3377.
Validation
pnpm check:affected --rungreen on head4b853ce: format, lint, typecheck, layering, fallow (no new findings vs merge-base), di-seams, build, gate-manifest, depgraph, wire-compat, production-exports (60 baseline findings unchanged), maestro-conformance, vitest-related.- Focused suites on head: replay-runtime / replay-maestro / replay-suite / device-selection / CLI export / help+MCP surfaces / eager-closure budgets / cli-startup-import-closure / ad-script / new registry + discovery laziness tests — all green.
- No device-facing behavior changed (pure dispatch indirection behind the existing
invokeport); the ADR 0015 performance contract is untouched — the registry resolves once per process and adds no round trip. - Coverage and provider integration are CI-authoritative on this head.