refactor(replay): route Maestro through a backend registry seam

Merged
TH
2mo ago
+454-64

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) and test discovery resolve their backend by id;
  • request device binding, client-side source bundling, and replay export use the backend's inspectSource / 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 --run green on head 4b853ce: 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 invoke port); 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.