refactor(plugins): make the plugin framework provider-independent

TH
1h ago
+1452-421

Summary

Makes @agent-device/plugins independent of concrete providers. Composition supplies reserved provider IDs and WebDriver factory-result adaptation through a required policy; daemon loading, CLI connections and installation share it. The released { webDriver: options } format and agent-device/plugins/webdriver types remain supported.

Plugin-to-provider graph edges fall from 2 to 0. One shared walk (package-isolation.ts) enforces R83 test-kit isolation and R85 plugin independence: manifest reach (direct and transitive), imports including Vitest mock literals and import-bound aliases, relative escapes and reference cycles.

Known conservative contract: the Vitest mock-site reader has no scope engine. An imported vi/vitest alias or namespace counts everywhere in the file, as the global vi already does. For these recognized literal calls, a shadowing local is conservatively counted. Receivers copied, destructured or reached through globalThis/require/dynamic import are not followed.

Validation

Rebased onto origin/main 4c1c786968; head 89825a5449612b43c6a0f59cd1dbb704a95d13c2; 29 files. pnpm 11.17.0, AGENT_DEVICE_VITEST_MAX_WORKERS=1, shared gate lock held throughout.

pnpm check:affected --run --head 89825a5449: exit 0, exactCommit=true, clean tree. 36 passed, 25 skipped, 2 deduplicated. Vitest: 1,871 files, 15,761 tests passed, 1 skipped. Planted static, type-only, dynamic and shadowed-alias provider imports each fail R11 and R85; a kernel import passes. A fresh read-only review found no blockers.

CI owns native, device, provider-integration and coverage checks. No live device validation. All 23 check contexts completed on 89825a5449: 21 passed and 2 expected skips, including successful iOS, macOS, Android and Linux smoke tests, coverage and integration. The earlier iOS Smoke failure belonged to old head 1a1c94f662; no separate native fix was made.