-
Notifications
You must be signed in to change notification settings - Fork 153
Conversation
wz9527
commented
Jun 3, 2026
Context for this PR:
This PR is a re-implementation of HarmonyOS platform support based on the latest main branch.
I previously submitted an initial version in #613, but that was based on an older main branch (roughly 89 commits behind). During that period, the main branch evolved
significantly with major refactors to core files like capabilities.ts, dispatch.ts, and cli-flags.ts, making a direct rebase impractical due to massive conflicts. I chose to
create a fresh branch from the latest main (6946c2f) and migrate the HarmonyOS support code file by file.
Both versions implement the same feature set, but this version:
- Targets the latest type system and architecture
- Fixes the incomplete keyboard action enum issue left in feat: add HarmonyOS platform support #613
- Adds install / reinstall support
- Adds fill text verification and push notification support
- Updates the help system with the help harmonyos topic
If maintainers previously reviewed #613, the core platform implementation logic (under platforms/harmonyos/) remains essentially unchanged — this is primarily an adaptation to the
latest interfaces and types. The old PR #613 can be closed.
thymikee
commented
Jun 3, 2026
Thanks for the contribution. This is a big piece of work, and directionally the approach looks right to me: HDC as the transport, uitest dumpLayout / uiInput for snapshot + input, aa for ability launch, and bm for app inventory/install all line up with the HarmonyOS/OpenHarmony docs I checked.
I found a few things that I think need fixing before we can land this:
-
pnpm check:quickcurrently fails on a duplicate import insrc/platforms/harmonyos/snapshot.ts(../../utils/snapshot.tsis imported twice). Typecheck passes, but lint blocks CI. -
recordis marked as supported for HarmonyOS insrc/core/capabilities.ts, but the daemon recording path is not wired for HarmonyOS. Inrecord-trace-recording.ts, non-iOS/macOS devices fall through tostartAndroidRecording, sorecord start --platform harmonyoswill try the Android/ADB path instead of the new HarmonyOS recording helpers. -
settings permission deny ... --platform harmonyoslooks wrong:setHarmonyPermissionparsesgrant|deny|reset, but both grant and deny currently executebm grant-permission. If deny is not supported yet, I think we should reject it explicitly instead of silently granting. -
The typed Node client normalization needs HarmonyOS fields. The daemon returns
bundleNamefor HarmonyOS install/reinstall, butnormalizeDeployResultonly readsbundleId/package, soapps.install()/apps.reinstall()loseappId.normalizeOpenDevicealso rejectsplatform: "harmonyos", soapps.open()loses device metadata for HarmonyOS sessions. -
There is a likely typo in the locked-screen fallback:
app-lifecycle.tsusesuitest ui-input swipe, while the rest of the implementation and the docs useuitest uiInput.
Validation I ran:
pnpm typecheckpassespnpm exec vitest run --project unit src/platforms/harmonyospasses: 6 files, 20 testspnpm check:quickfails on the duplicate import above
I also tried to validate locally. I have DevEco Studio installed on macOS/Apple Silicon; bundled hdc works outside the sandbox and reports Ver: 3.1.0e, but hdc list targets returns [Empty]. I can see the DevEco emulator binary, but I do not have a local HarmonyOS emulator image/device configured.
Could you share the exact steps you used to install/create a HarmonyOS emulator on macOS? A DevEco menu path is fine, but a CLI-friendly flow would be even better if one exists. That would help us verify this against a real emulator in addition to the physical-device testing you already did.
wz9527
commented
Jun 4, 2026
To use the HarmonyOS emulator, follow these steps:
Launch DevEco Studio My version is 6.0.2 Release
In the top-right corner of the IDE, click No Devices, then choose Device Manager.
In Device Manager, click New Emulator in the bottom-right corner and follow the wizard to create the emulator.
I need some time to review the other 4 bux.
- Fix duplicate import in snapshot.ts - Wire HarmonyOS recording into daemon recording path (start/stop) - Reject HarmonyOS permission deny with explicit UNSUPPORTED_OPERATION - Fix ui-input typo to uiInput in app-lifecycle.ts - Add harmonyos to Node client normalizers (normalizeOpenDevice, buildClientDevicePlatformFields) - Update remote config schema and CLI tests to include harmonyos platform
...tform gaps - capabilities: remove harmonyos support from logs and perf (not yet implemented) - dispatch-interactions: explicitly reject read command on HarmonyOS - client-shared: add harmonyos serial to device identifiers - session-open-surface: include serial for harmonyos open results - client-output: add harmonyos appstate output formatting - boot-diagnostics: add HDC_TRANSPORT_UNAVAILABLE for harmonyos and extend platform type - post-gesture-stabilization: include harmonyos in supported platforms - interaction-outcome-policy: include harmonyos in supported platforms - replay/script-utils: include harmonyos platform in script args - maestro/runtime-targets: correctly map harmonyos platform instead of falling back to ios - maestro/command-mapper: allow openLink on harmonyos with appId
- capabilities: remove harmonyos clipboard support because uitest uiInput has no getClipboard/setClipboard commands - test docs: fix settings dark-mode → settings appearance dark - test docs: fix fling → gesture fling with correct args
The perf handler was missing an isCommandSupportedOnDevice check, so it returned empty metrics instead of UNSUPPORTED_OPERATION for platforms where perf is not supported (e.g. harmonyos).
- Fix duplicate import in snapshot.ts - Wire HarmonyOS recording into daemon recording path (start/stop) - Reject HarmonyOS permission deny with explicit UNSUPPORTED_OPERATION - Fix ui-input typo to uiInput in app-lifecycle.ts - Add harmonyos to Node client normalizers (normalizeOpenDevice, buildClientDevicePlatformFields) - Update remote config schema and CLI tests to include harmonyos platform Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
4890f73 to
d66c8e0
Compare
thymikee
commented
Jun 10, 2026
Re-checking this PR today: it is currently blocked by merge conflicts (mergeStateStatus: DIRTY, mergeable: CONFLICTING) and there are no fresh checks reported for the current head. The earlier review feedback appears to have follow-up commits, but the branch needs a rebase onto current main before we can trust CI or finish review.
Please rebase, resolve conflicts, and rerun at least pnpm check:quick plus the focused HarmonyOS unit tests. After that I can re-review the remaining platform behavior against the current architecture.
Summary
Add HarmonyOS (OpenHarmony / HarmonyOS NEXT) platform support to agent-device, enabling CLI control of HarmonyOS physical devices and emulators via HDC (HarmonyOS Device
Connector).
What was implemented
Device connection and discovery
hdc -t <serial>)devicescommand lists connected HarmonyOS devicesApp lifecycle
apps: lists installed apps viabm dump -aandwukong appinfo, automatically resolves launchAbilityopen: 5-strategy launch chain (wukong → uitest → hdc aa start → EntryAbility → system default)close: stops app viaaa force-stopinstall/reinstall: installs HAP packages viahdc install / uninstallappstate: reads foreground app viaaa dump -lUI interactions
uitest uiInputcommandsstatus,dismiss, andenter; detects keyboard visibility via WindowManagerService dumpfillincludes verification and retry (reads back text via dumpLayout snapshot to confirm)uitest uiInput getClipboard / setClipboardSnapshot and screenshot
uitest dumpLayout, supportsinteractiveOnly,compact,depth,scope, andrawmodessnapshot_displaySystem functions
accept,dismiss, andwait; includes bilingual (EN/CN) button matching and auto-dismiss of system dialogshiloghidumperaa sendCLI and help
--platform harmonyosflag supportagent-device help harmonyoscomplete help topicKnown limitations
The following commands are not supported on HarmonyOS:
boot: device bootnetwork: network traffic capture (hilog lacks PID filtering, cannot implement reliably)pinch/rotate-gesture/transform-gesture: multi-touch gestures (uitest does not support)Test results
Tested on HarmonyOS NEXT physical device (22M0223824043030):