refactor(maestro): shape the replay backend as a create(host) plugin
Merged
TH
2mo ago+595+595+012345678901234567890123456789-330-330-012345678901234567890123456789
Summary
Second half of the #3377 replay-backend prep. Builds on #3622 (merged); based on main. 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 asReplayBackendPlugin = { create(host) }(@agent-device/maestro/replay-backend), with an engine-free declaration (.../replay-backend-declaration). ReplayBackendHost(built inreplay-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.tsholds the declaration table, so the registry's eager closure (and every daemon route that loads it) does not grow. Both tables are mapped overReplayBackendId, so a declaration or plugin under another backend's id fails to type-check. help maestroreads its topic from the declaration, socli-helpno longer imports the engine.- Failure tests now drive the plugin through
getReplayBackend('maestro'); two warnings checks became unit tests. - Dropped the unused
./daemon-runtime-portexport. - Only the two replay-port files above name
@agent-device/maestroin production (scripts/fuzzstill 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: 36d06fa8dc (pnpm check:affected --run).
pnpm check:affected --base <layer-1 branch> --run: all runnable checks passed.pnpm check:quickand 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-differentialare CI-authoritative.
๐ค Generated with Claude Code