Part of #3276. Low priority.
Purpose
src/daemon.ts eagerly loads 621 of 1,435 reachable files before the first request. Two avoidable branches dominate (confirmed in built internal/daemon chunks):
request-binding.ts → replay-device-selection.ts pulls in all of maestro (7.3k LOC).
provider-device-runtimes.ts pulls in all of provider-webdriver (5.4k LOC).
Measured gain: ~10–15 ms of ~47 ms module load.
Required behavior
Make both branches load through dynamic import() at first use, or record why not (e.g. a typed reason from ADR 0027's eager-closure budget work, or an interaction-latency regression that outweighs boot).
Done when
- Both branches are lazy, with the eager-closure budget gate updated to reflect the new baseline and planted proof that re-importing them eagerly fails the budget check; or the issue records the concrete reason not to.
- Boot measurement before/after in the PR body (same host, multiple runs).
- First-request latency is not measurably worse when maestro/webdriver paths are exercised (report the command and measurement).
Constraints
- Dynamic imports must not break the daemon's build/chunking (check the built
internal/daemon chunks still resolve at runtime — the size workflow is not enough).
- No fallback shims: complete the lazy migration or don't start it.
- Follow
docs/agents/pull-requests.md (size budget, commit shape, validation).
Part of #3276. Low priority.
Purpose
src/daemon.tseagerly loads 621 of 1,435 reachable files before the first request. Two avoidable branches dominate (confirmed in builtinternal/daemonchunks):request-binding.ts → replay-device-selection.tspulls in all ofmaestro(7.3k LOC).provider-device-runtimes.tspulls in all ofprovider-webdriver(5.4k LOC).Measured gain: ~10–15 ms of ~47 ms module load.
Required behavior
Make both branches load through dynamic
import()at first use, or record why not (e.g. a typed reason from ADR 0027's eager-closure budget work, or an interaction-latency regression that outweighs boot).Done when
Constraints
internal/daemonchunks still resolve at runtime — the size workflow is not enough).docs/agents/pull-requests.md(size budget, commit shape, validation).