refactor(maestro): shape the replay backend as a create(host) plugin

TH
1h ago
+607-314

Summary

Second half of the #3377 replay-backend prep. Stacks on #3622 (base is its branch; retarget to main once it merges). Behavior, wire shapes, help text and error wording are unchanged; the backend still resolves once per process (ADR 0015).

  • The Maestro adapter moved from replay-port into packages/maestro/src/replay-backend/ and ships as ReplayBackendPlugin = { declaration, create(host) } (@agent-device/maestro/replay-backend), with an engine-free declaration (.../replay-backend-declaration).
  • ReplayBackendHost (built in replay-backend-host.ts) is the only way the adapter reaches process state or daemon policy: trace append, builtin vars, script-source read, target-device resolution, request signal, and the divergence-failure builder from #3622.
  • The registry loads the plugin through a function-scoped import and calls create(host) once. replay-backend-declarations.ts holds the declaration table, so the registry's eager closure does not grow.
  • help maestro reads its topic from the declaration, so cli-help no longer imports the engine.
  • Failure tests now drive the plugin through getReplayBackend('maestro'); two warnings checks became unit tests.
  • Dropped the unused ./daemon-runtime-port export.
  • Only the two replay-port files above name @agent-device/maestro in production (scripts/fuzz still does).

32 files touched. Sign-off needed: the APPROVED_OVER_CEILING row for replay-maestro-backend.ts names thymikee as owner, so it needs his approval.

Refs #3377.

Validation

Tested SHA: a12c6ab513.

  • pnpm check:affected --base <layer-1 branch> --run: all runnable checks passed.
  • pnpm check:quick and focused vitest (replay-port, maestro, daemon sessions, CLI help/MCP, startup closure, closure budgets) passed.
  • Diff against the layer-1 branch: +607/āˆ’314. A -M90% stat shows more because several moved files are 80–91% similar after the host rewrite.
  • Coverage, provider integration and maestro-differential are CI-authoritative.

šŸ¤– Generated with Claude Code