refactor(client): remove managed daemon lifecycle

Merged
TH
6h ago
+368-263

Summary

For #3759 section 2, library clients attach to an existing daemon and no longer start, replace or retire it after timeouts. Remove daemonLifecycle: 'managed' and start the daemon explicitly:

import { createAgentDeviceClient, ensureDaemon } from 'agent-device';

await ensureDaemon({ stateDir });
const client = createAgentDeviceClient({ stateDir });

This includes client.replay.run() and client.replay.test(). Use startAgentDevice({ stateDir }) to own an in-process daemon. CLI/MCP ensuring and their private one-shot replay/test startup and cleanup remain supported.

Scope: 35 files, including migration docs, examples, regressions and a changeset. Remote health-recovery budgets and cancellation are preserved. Review fixes cover explicit startup, state-directory migration, cancellation-context identity and RPC race coverage. The final three-file documentation correction clarifies library replay startup and cancellation.

Validation

Head: 3a1ff5fa4ddef9e26553be6a99fe5c2133293f1d.

  • Full format and lint/typecheck passed.
  • Exact check:affected --run --head <SHA>: 42 passed, 25 skipped; exactCommit=true, checkoutChanged=false.
  • At runtime head a882478, full pnpm check passed 41 checks with 25 skipped, wire compatibility against v0.21.38 passed, and all 16 hosted checks were nonfailing.
  • Independent source reviews at d4c9997 and 28e37ef found no actionable regressions. The final documentation delta was cold-read against #3759; runtime tests and another full gate were unnecessary for that delta.

Hosted checks at the new head remain required. No new live-device result or merge clearance is claimed.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.