@oniroproject/core 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -83,7 +83,9 @@ declare class OniroError extends Error {
83
83
  declare class SdkNotInstalledError extends OniroError {
84
84
  readonly api: string;
85
85
  readonly expectedPath: string;
86
- constructor(api: string, expectedPath: string);
86
+ readonly version?: string | undefined;
87
+ /** `version` is the release that ships `api` (e.g. `6.0` for API 20), when one is known. */
88
+ constructor(api: string, expectedPath: string, version?: string | undefined);
87
89
  }
88
90
  declare class CmdToolsNotInstalledError extends OniroError {
89
91
  readonly expectedPath: string;
@@ -240,6 +242,15 @@ declare function getHdcPath(config: ConfigProvider): string;
240
242
  */
241
243
  declare function getHvigorwPath(config: ConfigProvider, projectDir: string, platform?: NodeJS.Platform): string;
242
244
 
245
+ /**
246
+ * The OpenHarmony SDK an OpenHarmony project builds against is missing, as a typed
247
+ * error naming the release to install, or null when it is installed or the project
248
+ * declares no numeric `compileSdkVersion`. hvigor looks for
249
+ * `<sdk home>/<compileSdkVersion>`, the home being `OHOS_BASE_SDK_HOME` or the
250
+ * project's `local.properties` `sdk.dir`, and otherwise fails late with
251
+ * `00308018 SDK path does not exist` / "SDK license agreement is not accepted".
252
+ */
253
+ declare function findMissingProjectSdk(config: ConfigProvider, projectRoot: string): SdkNotInstalledError | null;
243
254
  /**
244
255
  * Detect the SDK API a project targets by reading `build-profile.json5`.
245
256
  * Returns the `compileSdkVersion` of the first declared product, or undefined
@@ -461,11 +472,28 @@ declare function installCmdTools(opts: InstallCmdToolsOptions): Promise<void>;
461
472
  interface CmdToolsStatus {
462
473
  installed: boolean;
463
474
  status: string;
475
+ /** Install directory (the configured `cmdToolsPath`). */
476
+ path: string;
477
+ /** Which SDK flavour the tools ship; see {@link detectCmdToolsFlavour}. Set when installed. */
478
+ flavour?: CmdToolsFlavour;
479
+ /** The hdc binary commands use, and whether it exists. */
480
+ hdc: {
481
+ path: string;
482
+ exists: boolean;
483
+ };
464
484
  }
485
+ type CmdToolsFlavour = 'HarmonyOS' | 'OpenHarmony';
486
+ /**
487
+ * The flavour of a command-line tools install: `HarmonyOS` when it bundles the
488
+ * HarmonyOS SDK (`sdk/default/hms`, as the Huawei developer-portal download
489
+ * does), otherwise `OpenHarmony`. codelinter only fully checks projects of its
490
+ * own flavour (`runtimeOS` in build-profile.json5).
491
+ */
492
+ declare function detectCmdToolsFlavour(cmdToolsPath: string): CmdToolsFlavour;
465
493
  /**
466
- * Reports whether ohpm is present at the configured path, and if so its version.
467
- * Prefers reading `version.txt` (`# Version: x.y.z`) before falling back to executing
468
- * the binary with `-v`.
494
+ * Reports whether ohpm is present at the configured path, and if so its version,
495
+ * flavour, and the hdc binary in use. Prefers reading `version.txt`
496
+ * (`# Version: x.y.z`) before falling back to executing the binary with `-v`.
469
497
  */
470
498
  declare function getCmdToolsStatus(config: ConfigProvider): CmdToolsStatus;
471
499
  declare function isCmdToolsInstalled(config: ConfigProvider): boolean;
@@ -543,6 +571,14 @@ interface GenerateSigningConfigsOptions {
543
571
  * existing `allowed-acls` is left alone.
544
572
  */
545
573
  acls?: string[];
574
+ /**
575
+ * Privileges to write into the profile's `app-privilege-capabilities`, e.g.
576
+ * `AllowAppUsePrivilegeExtension` for an app that declares a privileged extension
577
+ * ability (else install fails with 9568344 "not allow use privilege extension"),
578
+ * `AllowAppMultiProcess` or `AllowAppDesktopIconHide`. When omitted, the
579
+ * template's value is left alone.
580
+ */
581
+ appPrivilegeCapabilities?: string[];
546
582
  /**
547
583
  * Keystore passwords written into the profile sign step and the build-profile
548
584
  * signingConfigs. Defaults to `'123456'` (the SDK's bundled OpenHarmony.p12
@@ -637,6 +673,26 @@ interface StartEmulatorOptions {
637
673
  */
638
674
  declare function startEmulator(opts: StartEmulatorOptions): Promise<void>;
639
675
  declare function stopEmulator(logger?: Logger): Promise<void>;
676
+ interface EmulatorStatus {
677
+ installed: boolean;
678
+ /** The configured emulator directory. */
679
+ dir: string;
680
+ /** Whether an emulator QEMU process is alive. */
681
+ running: boolean;
682
+ /** The hdc address checked for `connected`. */
683
+ address: string;
684
+ /** hdc lists `address` as a Connected target. */
685
+ connected: boolean;
686
+ }
687
+ /**
688
+ * Report on the Oniro emulator without starting it: installed, running, and whether
689
+ * hdc sees it at `address` (default `127.0.0.1:55555`). Other emulators, such as
690
+ * DevEco Studio's HarmonyOS emulator, are not covered: they appear in `listDevices`.
691
+ */
692
+ declare function getEmulatorStatus(config: ConfigProvider, opts?: {
693
+ address?: string;
694
+ logger?: Logger;
695
+ }): Promise<EmulatorStatus>;
640
696
 
641
697
  /**
642
698
  * True when `command` must be routed through `cmd.exe` to run at all —
@@ -736,11 +792,33 @@ interface RunProcessOptions {
736
792
  * (e.g. missing binary), timeout, or abort.
737
793
  */
738
794
  declare function runProcess(opts: RunProcessOptions): Promise<HdcExecResult>;
795
+ /**
796
+ * The device to address: an explicit serial wins, then the `ONIRO_DEVICE_SERIAL` /
797
+ * `DEVICE_SERIAL` env vars. `auto`, or nothing at all, leaves the choice to hdc,
798
+ * which only works while a single target is connected.
799
+ */
800
+ declare function resolveDeviceSerial(explicit?: string, env?: NodeJS.ProcessEnv): string | undefined;
801
+ /** `['-t', <serial>]` for the device {@link resolveDeviceSerial} picks, or `[]` to let hdc choose. */
802
+ declare function hdcTargetArgs(explicit?: string): string[];
803
+ /** The `-t <serial>` prefix for `hdc <args...>`, following {@link HdcExecOptions.deviceSerial}'s rules. */
804
+ declare function hdcTargetArgsFor(args: readonly string[], explicit?: string): string[];
805
+ /**
806
+ * The `[Fail]…` line hdc printed instead of running the command, or null. hdc
807
+ * exits 0 even then: `[Fail]ExecuteCommand need connect-key?` (several targets
808
+ * and no `-t`), `[Fail]Not match target founded` (unknown serial), a failed file
809
+ * transfer. Only the first line of output counts, so device-side output further
810
+ * down that happens to contain the marker is left alone. Pure/testable.
811
+ */
812
+ declare function hdcClientFailure(output: string): string | null;
739
813
  interface HdcExecOptions {
740
814
  config: ConfigProvider;
741
815
  /** Args passed to hdc verbatim, e.g. `['shell','aa','start','-a',ability,'-b',bundle]`. */
742
816
  args: readonly string[];
743
- /** Device serial; when set, prepends `['-t', serial]`. */
817
+ /**
818
+ * Device serial; prepends `['-t', serial]`. When unset, `ONIRO_DEVICE_SERIAL`
819
+ * applies (see {@link resolveDeviceSerial}), except for hdc server commands
820
+ * such as `list targets` and `tconn`.
821
+ */
744
822
  deviceSerial?: string;
745
823
  /** Default 60_000. */
746
824
  timeoutMs?: number;
@@ -750,7 +828,8 @@ interface HdcExecOptions {
750
828
  }
751
829
  /**
752
830
  * Run `hdc [-t <serial>] <args...>`. Resolves with `{ code, stdout, stderr }`
753
- * for any exit code; use {@link ensureOk} to throw on non-zero.
831
+ * for any exit code; use {@link ensureOk} to throw on non-zero. A `[Fail]` line
832
+ * from hdc itself is reported as exit code 1 (see {@link hdcClientFailure}).
754
833
  */
755
834
  declare function hdcExec(opts: HdcExecOptions): Promise<HdcExecResult>;
756
835
  interface HdcShellOptions extends Omit<HdcExecOptions, 'args'> {
@@ -828,28 +907,62 @@ interface ParamOptions {
828
907
  timeoutMs?: number;
829
908
  logger?: Logger;
830
909
  }
831
- /** Read a system property via `hdc shell param get <key>`. Returns the trimmed value. */
910
+ /** Read a system property via `hdc shell param get <key>`. Returns the trimmed value; throws when it is unset. */
832
911
  declare function paramGet(config: ConfigProvider, key: string, opts?: ParamOptions): Promise<string>;
912
+ /**
913
+ * Split the output of {@link paramGetMany}'s single shell call back into one value
914
+ * per key; unset properties come back undefined. Pure/testable.
915
+ */
916
+ declare function parseParamValues(keys: readonly string[], stdout: string): Record<string, string | undefined>;
917
+ /** Read several system properties in one `hdc shell` round trip. Unset properties come back undefined. */
918
+ declare function paramGetMany(config: ConfigProvider, keys: readonly string[], opts?: ParamOptions): Promise<Record<string, string | undefined>>;
833
919
  /**
834
920
  * Set a system property via `hdc shell param set <key> <value>`. The canonical
835
921
  * reboot path is `paramSet(config, 'ohos.startup.powerctrl', 'reboot')`.
836
922
  */
837
923
  declare function paramSet(config: ConfigProvider, key: string, value: string, opts?: ParamOptions): Promise<void>;
838
924
 
925
+ /**
926
+ * A host path in the form hdc understands: absolute, with native separators and,
927
+ * on Windows, no 8.3 short names. hdc treats a forward-slash Windows path such as
928
+ * `C:/Users/me/x.txt` as relative and joins it onto the current directory. The
929
+ * last component may not exist yet (a `recv` destination).
930
+ */
931
+ declare function normaliseLocalPath(local: string): string;
932
+ /**
933
+ * Reject a device path that a Windows shell already rewrote into a host path:
934
+ * Git Bash turns `/data/local/tmp/x` into `C:/Program Files/Git/data/local/tmp/x`
935
+ * before the CLI sees it. Device paths never start with a drive letter.
936
+ */
937
+ declare function assertDevicePath(remote: string): void;
938
+ /** Where `hdc shell` sees an app's el2 sandbox; the app itself sees it as `/data/storage/el2/base`. */
939
+ declare function appSandboxDir(bundle: string): string;
839
940
  interface SendFileOptions {
840
941
  config: ConfigProvider;
841
942
  /** Local source path. */
842
943
  local: string;
843
- /** Remote destination path on the device. */
944
+ /**
945
+ * Remote destination path on the device. With `bundle`, a relative path is
946
+ * resolved inside that app's sandbox (`files/x` is the app's application-level
947
+ * filesDir, `haps/entry/files/x` the entry module's).
948
+ */
844
949
  remote: string;
950
+ /**
951
+ * Push into this app's sandbox and give the file to the app's user afterwards:
952
+ * hdc writes files as root, which the app cannot read until they are chowned.
953
+ */
954
+ bundle?: string;
845
955
  deviceSerial?: string;
846
956
  timeoutMs?: number;
847
957
  abortSignal?: AbortSignal;
848
958
  onOutput?: OutputSink;
849
959
  logger?: Logger;
850
960
  }
851
- /** Push a local file to the device via `hdc file send <local> <remote>`. */
852
- declare function sendFile(opts: SendFileOptions): Promise<void>;
961
+ /**
962
+ * Push a local file to the device via `hdc file send <local> <remote>`. Returns
963
+ * the device path the file was written to.
964
+ */
965
+ declare function sendFile(opts: SendFileOptions): Promise<string>;
853
966
  interface RecvFileOptions {
854
967
  config: ConfigProvider;
855
968
  /** Remote source path on the device. */
@@ -1390,8 +1503,10 @@ interface InstallAppOptions {
1390
1503
  config: ConfigProvider;
1391
1504
  projectDir: string;
1392
1505
  /**
1393
- * Explicit path (absolute, or relative to projectDir) to the signed `.hap`.
1394
- * Falls back to the `hapPath` config key, then to the well-known default.
1506
+ * Explicit path (absolute, or relative to projectDir) to the `.hap`. Falls back
1507
+ * to the `hapPath` config key, then to the well-known signed entry HAP, then to
1508
+ * the HAPs the build produced (signed first, else unsigned). A `*-signed.hap`
1509
+ * that does not exist falls back to its `*-unsigned.hap` sibling.
1395
1510
  */
1396
1511
  hapPath?: string;
1397
1512
  deviceSerial?: string;
@@ -1406,7 +1521,50 @@ interface InstallAppResult {
1406
1521
  /** Combined stdout+stderr from the install, trimmed. */
1407
1522
  output: string;
1408
1523
  }
1524
+ /**
1525
+ * The bundle manager's rejection in `hdc install` output, or null when the
1526
+ * install went through. hdc exits 0 either way: success prints `msg:install
1527
+ * bundle successfully.`, a rejection `msg:error: failed to install bundle.`
1528
+ * with a `code:95xxxxx`. Pure/testable.
1529
+ */
1530
+ declare function detectInstallFailure(output: string): string | null;
1531
+ /** The HAP an install is about to push, and how it was chosen. */
1532
+ interface InstallCandidate {
1533
+ path: string;
1534
+ /** True when no signed HAP was found and this unsigned one was taken instead. */
1535
+ fallback?: boolean;
1536
+ }
1537
+ /** Whether a HAP is an `*-unsigned.hap`, by its file name as hvigor writes it. */
1538
+ declare function isUnsignedHap(hapPath: string): boolean;
1539
+ /**
1540
+ * The bundle manager's reason from rejected `hdc install` output, e.g. `code
1541
+ * 9568320: no signature file`, else the output's first line. Pure/testable.
1542
+ */
1543
+ declare function installFailureReason(output: string): string;
1544
+ /**
1545
+ * The message for a target that rejected an unsigned HAP: what was tried, the
1546
+ * bundle manager's reason, and, when the reason is the missing signature, how to
1547
+ * sign for the target. Pure/testable.
1548
+ */
1549
+ declare function unsignedHapRejection(output: string, hap: InstallCandidate): string;
1550
+ /**
1551
+ * Throw when hdc or the bundle manager rejected an install: a typed
1552
+ * {@link CommandFailedError}, or, when the bundle manager turned down an unsigned
1553
+ * `hap`, an {@link OniroError} explaining {@link unsignedHapRejection why}.
1554
+ */
1555
+ declare function ensureInstallOk(result: HdcExecResult, command: string, hap?: InstallCandidate): HdcExecResult;
1556
+ /**
1557
+ * An existing HAP at `hapPath`, or, when that is a `*-signed.hap` that does not
1558
+ * exist, its `*-unsigned.hap` sibling. Undefined when neither exists.
1559
+ */
1560
+ declare function existingHapOrUnsigned(hapPath: string): InstallCandidate | undefined;
1409
1561
  declare function installApp(opts: InstallAppOptions): Promise<InstallAppResult>;
1562
+ /**
1563
+ * Whether `bm dump -n <bundle>` finds the bundle on the device. A missing bundle
1564
+ * prints `error: failed to get information…`; an installed one, `<bundle>:` and
1565
+ * its JSON.
1566
+ */
1567
+ declare function isBundleInstalled(opts: BundleOptions): Promise<boolean>;
1410
1568
  interface LaunchAppOptions {
1411
1569
  config: ConfigProvider;
1412
1570
  /** Project mode: resolve bundle + main ability from the project. Required unless `bundleName` is given. */
@@ -1452,6 +1610,7 @@ interface RunningProcess {
1452
1610
  declare function listRunningProcesses(config: ConfigProvider, options?: {
1453
1611
  targetProcessName?: string;
1454
1612
  timeoutMs?: number;
1613
+ deviceSerial?: string;
1455
1614
  logger?: Logger;
1456
1615
  }): Promise<RunningProcess[] | string>;
1457
1616
  declare function findAppProcessId(config: ConfigProvider, projectDir: string, logger?: Logger): Promise<string>;
@@ -1495,6 +1654,7 @@ interface HilogEntry {
1495
1654
  interface SetHilogLevelOptions {
1496
1655
  config: ConfigProvider;
1497
1656
  level: HilogLevel;
1657
+ deviceSerial?: string;
1498
1658
  logger?: Logger;
1499
1659
  }
1500
1660
  /**
@@ -1509,7 +1669,7 @@ interface StreamHilogOptions {
1509
1669
  processId?: string;
1510
1670
  /** Filter by hilog domain, e.g. '0xD003900' (passed as `-D <domain>`). */
1511
1671
  domain?: string | number;
1512
- /** Address a specific device (`-t <serial>`). */
1672
+ /** Address a specific device (`-t <serial>`); defaults to `ONIRO_DEVICE_SERIAL`. */
1513
1673
  deviceSerial?: string;
1514
1674
  }
1515
1675
  /**
@@ -1561,6 +1721,38 @@ interface WatchLogOptions {
1561
1721
  }
1562
1722
  /** Collect all hilog entries matching `pattern` for `durationMs`. Deduped by default. */
1563
1723
  declare function watchLog(opts: WatchLogOptions): Promise<HilogEntry[]>;
1724
+ interface CaptureLogOptions {
1725
+ config: ConfigProvider;
1726
+ /** File the hilog lines are appended to. */
1727
+ file: string;
1728
+ /** Stop after this long. Default: run until `abortSignal` fires. */
1729
+ durationMs?: number;
1730
+ /** Keep only the lines this matches. Default: every line. */
1731
+ pattern?: RegExp;
1732
+ /** Clear the device's log buffer first (`hilog -r`), so the file covers only this session. */
1733
+ clear?: boolean;
1734
+ domain?: string | number;
1735
+ deviceSerial?: string;
1736
+ abortSignal?: AbortSignal;
1737
+ logger?: Logger;
1738
+ }
1739
+ interface CaptureLogResult {
1740
+ file: string;
1741
+ /** Lines written to `file`. */
1742
+ lines: number;
1743
+ /** How many times the stream dropped and was respawned. */
1744
+ reconnects: number;
1745
+ }
1746
+ /**
1747
+ * Stream hilog into `file` until `durationMs` passes or `abortSignal` fires. The
1748
+ * device's log buffer is small (256 KB per type by default) and chatty components
1749
+ * such as ArkWeb wrap it within seconds, so a dump taken at the end of a session
1750
+ * loses its start; a capture running throughout does not. Each chunk is written
1751
+ * synchronously, so killing the process keeps what was captured. The stream is
1752
+ * respawned when it drops (a reboot, a lost connection). Resolves at the deadline
1753
+ * or on abort.
1754
+ */
1755
+ declare function captureLog(opts: CaptureLogOptions): Promise<CaptureLogResult>;
1564
1756
  interface DumpLogOptions {
1565
1757
  config: ConfigProvider;
1566
1758
  /** Cap the result to the last N lines (device-side `tail -n`). */
@@ -1643,9 +1835,23 @@ interface DiscoverHapsOptions {
1643
1835
  * by build module name (parsed from the HAP filename). Skips `node_modules` /
1644
1836
  * `oh_modules` / `.git`. Ported from the proven MCP `findHaps`, extended with
1645
1837
  * per-module grouping so multi-module projects can install the right HAP.
1646
- * Empty object when nothing is built.
1838
+ * Each list is newest first, so a fresh build wins over HAPs committed to the
1839
+ * repository. Empty object when nothing is built.
1647
1840
  */
1648
1841
  declare function discoverHaps(opts: DiscoverHapsOptions): Promise<Record<string, ModuleHaps>>;
1842
+ interface PickedHap {
1843
+ module: string;
1844
+ path: string;
1845
+ /** False for an `*-unsigned.hap`, which targets that verify signatures reject. */
1846
+ signed: boolean;
1847
+ }
1848
+ /**
1849
+ * The HAP to install from {@link discoverHaps} output: a module's newest signed
1850
+ * HAP, else its newest unsigned one. Without `module`, the single module that
1851
+ * has a signed HAP, else the single one that has any HAP. Null when nothing is
1852
+ * built; throws when several modules qualify and none was named.
1853
+ */
1854
+ declare function pickHap(haps: Record<string, ModuleHaps>, module?: string): PickedHap | null;
1649
1855
 
1650
1856
  interface RunOhpmOptions {
1651
1857
  config: ConfigProvider;
@@ -1683,23 +1889,52 @@ declare function ensureOhModules(opts: {
1683
1889
  interface CodelinterFinding {
1684
1890
  file: string;
1685
1891
  line: number;
1892
+ /** Column, when the report gives one. */
1893
+ column?: number;
1894
+ /** `error`, `warning`, `suggestion` or `info` (codelinter's `warn` reads as `warning`). */
1686
1895
  severity: string;
1687
1896
  /** Rule code/id when present in the output, else ''. */
1688
1897
  code: string;
1689
1898
  message: string;
1690
1899
  }
1691
- interface CodelinterResult {
1692
- /** codelinter process exit code. */
1693
- code: number;
1900
+ /** codelinter's own totals, from its `-Defects: N; Errors: N; Warns: N; Suggestions: N;` line. */
1901
+ interface CodelinterSummary {
1902
+ defects: number;
1903
+ errors: number;
1904
+ warnings: number;
1905
+ suggestions: number;
1906
+ }
1907
+ interface CodelinterReport {
1694
1908
  findings: CodelinterFinding[];
1695
- /** Combined stdout+stderr, for callers that want the raw report. */
1909
+ /** The totals codelinter printed (all zero for "No defects found"), or null when it printed none. */
1910
+ summary: CodelinterSummary | null;
1911
+ /**
1912
+ * codelinter's remarks about the run itself rather than the code, e.g. "The type of
1913
+ * command line tools does not match that of the project".
1914
+ */
1915
+ notices: string[];
1916
+ /** True when codelinter warned that the report may be incomplete. */
1917
+ incomplete: boolean;
1918
+ }
1919
+ interface CodelinterResult extends CodelinterReport {
1920
+ /** codelinter process exit code: 1 whenever it found any defect, warnings included. */
1921
+ code: number;
1922
+ /** Combined stdout+stderr, with colour codes and progress-bar redraws removed. */
1696
1923
  raw: string;
1697
1924
  }
1698
1925
  /**
1699
- * Best-effort parser for codelinter output lines of the shape
1700
- * `<file>:<line>[:<col>]: <severity>: <message> [<rule-code>]`. Lines that don't
1701
- * match are ignored. Exported as a pure function so it is unit-testable.
1926
+ * codelinter output as plain lines: colour codes stripped, and of each line redrawn
1927
+ * with `\r` (its progress bar) only the final state kept.
1702
1928
  */
1929
+ declare function cleanCodelinterOutput(output: string): string;
1930
+ /**
1931
+ * Parse a codelinter report. Pure/testable. Understands the table codelinter prints
1932
+ * (a `<file>(<count>)` header followed by `<line>:<col> <severity> <message> <rule>`
1933
+ * rows, then a `-Defects: …` summary) and the one-line
1934
+ * `<file>:<line>[:<col>]: <severity>: <message> [<rule>]` shape. Other lines are ignored.
1935
+ */
1936
+ declare function parseCodelinterReport(output: string): CodelinterReport;
1937
+ /** The findings of a codelinter report; see {@link parseCodelinterReport}. */
1703
1938
  declare function parseCodelinterFindings(output: string): CodelinterFinding[];
1704
1939
  interface RunCodelinterOptions {
1705
1940
  config: ConfigProvider;
@@ -1710,9 +1945,14 @@ interface RunCodelinterOptions {
1710
1945
  abortSignal?: AbortSignal;
1711
1946
  logger?: Logger;
1712
1947
  }
1713
- /** Run the OpenHarmony codelinter and return parsed findings + the raw report. */
1948
+ /** Run the OpenHarmony codelinter and return the parsed report + the cleaned raw output. */
1714
1949
  declare function runCodelinter(opts: RunCodelinterOptions): Promise<CodelinterResult>;
1715
1950
 
1951
+ /**
1952
+ * A hint for build output whose cause the compiler errors do not name, or
1953
+ * undefined. Pure/testable.
1954
+ */
1955
+ declare function diagnoseBuildFailure(output: string): string | undefined;
1716
1956
  interface BuildHapOptions {
1717
1957
  config: ConfigProvider;
1718
1958
  projectDir: string;
@@ -1835,6 +2075,7 @@ interface PrepareSigningOptions {
1835
2075
  apl?: Apl;
1836
2076
  appFeature?: AppFeature;
1837
2077
  acls?: string[];
2078
+ appPrivilegeCapabilities?: string[];
1838
2079
  passwords?: SigningPasswords;
1839
2080
  logger?: Logger;
1840
2081
  }
@@ -1881,10 +2122,20 @@ interface DeviceFullInfo {
1881
2122
  model?: string;
1882
2123
  manufacturer?: string;
1883
2124
  brand?: string;
2125
+ /** `HarmonyOS` when the device reports a HarmonyOS distribution, else `OpenHarmony` (Oniro included). */
2126
+ osFamily?: 'HarmonyOS' | 'OpenHarmony';
2127
+ /** Distribution name (`const.product.os.dist.name`): `HarmonyOS`; unset on OpenHarmony. */
2128
+ osDistName?: string;
2129
+ /** Distribution version (`const.product.os.dist.version`), e.g. `6.1.0` on HarmonyOS. */
2130
+ osDistVersion?: string;
1884
2131
  osFullName?: string;
1885
2132
  osReleaseType?: string;
1886
2133
  sdkApiVersion?: string;
1887
2134
  buildVersion?: string;
2135
+ /** CPU ABIs (`const.product.cpu.abilist`), e.g. `arm64-v8a` or `x86_64`: native libraries must match. */
2136
+ abi?: string;
2137
+ /** `phone`, `tablet`, `wearable`, `default`, … */
2138
+ deviceType?: string;
1888
2139
  display: {
1889
2140
  width: number;
1890
2141
  height: number;
@@ -1896,7 +2147,7 @@ interface GetDeviceInfoOptions {
1896
2147
  timeoutMs?: number;
1897
2148
  logger?: Logger;
1898
2149
  }
1899
- /** Collate device properties (`param get` × N) and the display resolution. */
2150
+ /** Collate device properties (one `param get` round trip) and the display resolution. */
1900
2151
  declare function getDeviceInfo(opts: GetDeviceInfoOptions): Promise<DeviceFullInfo>;
1901
2152
 
1902
2153
  interface HapAssetDiff {
@@ -2274,4 +2525,4 @@ declare function harmonyOsAutoSign(opts: HarmonyOsAutoSignOptions): Promise<Harm
2274
2525
 
2275
2526
  declare const VERSION: string;
2276
2527
 
2277
- export { ALL_SDKS, APL_VALUES, APP_FEATURE_VALUES, type AbilityInfo, type AgcAuthInfo, AgcError, type Apl, type AppFeature, type ApplyChangesOptions, type ApplyChangesResult, type BuildHapOptions, type BuildHapResult, type BundleOptions, CancelledError, type CaptureBurstOptions, ChecksumMismatchError, CmdToolsNotInstalledError, type CmdToolsStatus, type CmdWrapper, type CodelinterFinding, type CodelinterResult, CommandFailedError, type ConfigKey, type ConfigProvider, type CreateScaffoldOptions, type CreateScaffoldResult, type DeveloperAgreementStatus, type DeviceFullInfo, type DeviceInfo, type DiscoverHapsOptions, type DisplaySize, type DisplaySizeOptions, type DownloadOptions, type DumpLayoutOptions, type DumpLayoutResult, type DumpLogOptions, type ExtractZipOptions, type FlatLayoutNode, type GenerateSigningConfigsOptions, type GestureUitestOptions, type GetDeviceInfoOptions, HARMONYOS_SDK_VERSIONS, HUAWEI_SITES, type HapAssetDiff, type HarmonyOsAutoSignOptions, type HarmonyOsSdk, type HarmonyOsSession, type HarmonyOsSessionOptions, type HarmonyOsSigningResult, type HdcExecOptions, type HdcExecResult, type HdcShellOptions, type HidumperOptions, type HilogEntry, type HilogLevel, type HuaweiSite, type HuaweiSiteCode, type HuaweiTeam, type HuaweiUserInfo, INSTALL_TMP_DIRNAME, type InputType, type InstallAppOptions, type InstallAppResult, type InstallCmdToolsOptions, type InstallEmulatorOptions, type InstallMethod, type InstallSdkOptions, type InstallTempDir, type InstallTempDirOptions, InsufficientSpaceError, type KeyboardState, type LaunchAppOptions, type LayoutNode, type LayoutSelector, type LocateTargetOptions, type LocatedTarget, type Logger, type ModuleHaps, OHOS_URL_BASE, type OniroContext, OniroError, type OsFolder, type OutputSink, type ParamOptions, type PerformInputOptions, type PerformInputResult, type PickTargetFailure, type PrepareSigningOptions, type PrepareSigningResult, type ProgressReporter, type ProgressUpdate, type ProjectModule, type Prompter, type ProvisionProfileInfo, type RawLayoutNode, type RawTouchEvent, type RebootDecision, type RebootOptions, type RecvFileOptions, type RunCodelinterOptions, type RunHvigorwOptions, type RunHvigorwResult, type RunOhpmOptions, type RunProcessOptions, type RunningProcess, type RuntimeOs, SIGNING_ERRORS, type ScreenDump, type Screenshot, type ScreenshotOptions, type SdkArchiveInfo, type SdkInfo, SdkNotInstalledError, type SdkRelease, type SendFileOptions, type SendGestureOptions, type SendInputOptions, type SendRawTouchOptions, type SetHilogLevelOptions, type SigningKind, type SigningMaterialPaths, type SigningPasswords, type StartEmulatorOptions, type StoredSession, type StreamHilogOptions, TMP_DIR_HINT, TargetNotFoundError, type TemplateOption, type TokenStore, type UiInputType, UnsupportedPlatformError, VERSION, type WaitForBootOptions, type WaitForBundleOptions, type WaitForConditionOptions, type WaitForLogOptions, type WaitForTargetOptions, type WatchLogOptions, type Waypoint, applyChanges, assertLayoutSelector, attemptHdcConnection, buildCmdWrapper, buildGestureCommands, buildGestureUitestCommand, buildHap, buildHvigorwArgs, buildInputCommand, buildRawTouchCommand, captureBurst, consoleLogger, createHarmonyOsSession, createInstallTempDir, createMaterial, createScaffold, createTempWorkDir, createTokenStore, decideInstallMethod, decideReboot, decryptPwd, dedupEntries, defaultContext, defaultPaths, describeLayoutNode, detectAaStartFailure, detectProjectSdkVersion, detectRuntimeOs, detectSigningConfigNames, diffEntryNames, diffHapAssets, discoverHaps, downloadAndInstallSdk, downloadFile, dumpLayout, dumpLog, dumpRenderService, dumpScreen, dumpWindow, encryptPwd, ensureFreeSpace, ensureOhModules, ensureOk, ensureRemoteOk, escapeCmdArgument, escapeCmdCommand, extractTarball, extractZipWithProgress, findAppProcessId, findCmdToolsSourceDir, findCoveredNodes, findHarmonyOsSdk, findKeyboardWindow, findLayoutNodes, findRunningProcess, flattenLayout, forceStop, formatBytes, generateSigningConfigs, getBundleName, getCmdToolsBin, getCmdToolsDownloadUrl, getCmdToolsPath, getCmdToolsStatus, getDeviceInfo, getDisplaySize, getEmulatorDir, getFreeSpaceBytes, getHdcPath, getHvigorwPath, getImeBundles, getInstalledSdks, getKey, getMainAbility, getOhosBaseSdkHome, getOhpmPath, getOsFolder, getSdkFilename, getSdkRootDir, getSupportedSdksForUi, harmonyOsAutoSign, harmonyOsSdkLabelForApi, hdcExec, hideKeyboard, installApp, installCmdTools, installEmulator, isCmdToolsInstalled, isEmulatorInstalled, isOutOfSpaceError, isRamBackedPath, isValidBundleName, isValidProjectName, killProcessTree, launchApp, listAbilities, listDevices, listModules, listRunningProcesses, listTemplates, locateTarget, needsCmdWrapper, nonInteractivePrompter, noopLogger, noopProgress, paramGet, paramSet, parseBounds, parseCodelinterFindings, parseDeviceList, parseHilogLine, parseImeBundles, parseMainAbilityFromBmDump, parseRemoteExit, performInput, pickSigningKind, pickTarget, prepareSigning, pruneLayout, readJson5File, readJsonFile, readProvisionProfile, reboot, recvFile, removeCmdTools, removeEmulator, removeSdk, removeTempWorkDir, requireHarmonyOsSdk, resolveKeyEvent, resolveTmpRoot, runCodelinter, runHvigorw, runOhpm, runProcess, scopedLogger, selectDevice, sendFile, sendGesture, sendInput, sendRawTouch, setHilogLevel, shell, shellChecked, spawnCompat, startEmulator, staticConfig, stopEmulator, streamHilog, takeScreenshot, toLongPath, toSpaceError, uninstallApp, validateTemplateLayout, verifySha256, waitForBoot, waitForBundle, waitForCondition, waitForLog, waitForTarget, watchLog, waypointsToRawEvents, withoutWindow, writeJson5File, writeJsonFile };
2528
+ export { ALL_SDKS, APL_VALUES, APP_FEATURE_VALUES, type AbilityInfo, type AgcAuthInfo, AgcError, type Apl, type AppFeature, type ApplyChangesOptions, type ApplyChangesResult, type BuildHapOptions, type BuildHapResult, type BundleOptions, CancelledError, type CaptureBurstOptions, type CaptureLogOptions, type CaptureLogResult, ChecksumMismatchError, type CmdToolsFlavour, CmdToolsNotInstalledError, type CmdToolsStatus, type CmdWrapper, type CodelinterFinding, type CodelinterReport, type CodelinterResult, type CodelinterSummary, CommandFailedError, type ConfigKey, type ConfigProvider, type CreateScaffoldOptions, type CreateScaffoldResult, type DeveloperAgreementStatus, type DeviceFullInfo, type DeviceInfo, type DiscoverHapsOptions, type DisplaySize, type DisplaySizeOptions, type DownloadOptions, type DumpLayoutOptions, type DumpLayoutResult, type DumpLogOptions, type EmulatorStatus, type ExtractZipOptions, type FlatLayoutNode, type GenerateSigningConfigsOptions, type GestureUitestOptions, type GetDeviceInfoOptions, HARMONYOS_SDK_VERSIONS, HUAWEI_SITES, type HapAssetDiff, type HarmonyOsAutoSignOptions, type HarmonyOsSdk, type HarmonyOsSession, type HarmonyOsSessionOptions, type HarmonyOsSigningResult, type HdcExecOptions, type HdcExecResult, type HdcShellOptions, type HidumperOptions, type HilogEntry, type HilogLevel, type HuaweiSite, type HuaweiSiteCode, type HuaweiTeam, type HuaweiUserInfo, INSTALL_TMP_DIRNAME, type InputType, type InstallAppOptions, type InstallAppResult, type InstallCandidate, type InstallCmdToolsOptions, type InstallEmulatorOptions, type InstallMethod, type InstallSdkOptions, type InstallTempDir, type InstallTempDirOptions, InsufficientSpaceError, type KeyboardState, type LaunchAppOptions, type LayoutNode, type LayoutSelector, type LocateTargetOptions, type LocatedTarget, type Logger, type ModuleHaps, OHOS_URL_BASE, type OniroContext, OniroError, type OsFolder, type OutputSink, type ParamOptions, type PerformInputOptions, type PerformInputResult, type PickTargetFailure, type PickedHap, type PrepareSigningOptions, type PrepareSigningResult, type ProgressReporter, type ProgressUpdate, type ProjectModule, type Prompter, type ProvisionProfileInfo, type RawLayoutNode, type RawTouchEvent, type RebootDecision, type RebootOptions, type RecvFileOptions, type RunCodelinterOptions, type RunHvigorwOptions, type RunHvigorwResult, type RunOhpmOptions, type RunProcessOptions, type RunningProcess, type RuntimeOs, SIGNING_ERRORS, type ScreenDump, type Screenshot, type ScreenshotOptions, type SdkArchiveInfo, type SdkInfo, SdkNotInstalledError, type SdkRelease, type SendFileOptions, type SendGestureOptions, type SendInputOptions, type SendRawTouchOptions, type SetHilogLevelOptions, type SigningKind, type SigningMaterialPaths, type SigningPasswords, type StartEmulatorOptions, type StoredSession, type StreamHilogOptions, TMP_DIR_HINT, TargetNotFoundError, type TemplateOption, type TokenStore, type UiInputType, UnsupportedPlatformError, VERSION, type WaitForBootOptions, type WaitForBundleOptions, type WaitForConditionOptions, type WaitForLogOptions, type WaitForTargetOptions, type WatchLogOptions, type Waypoint, appSandboxDir, applyChanges, assertDevicePath, assertLayoutSelector, attemptHdcConnection, buildCmdWrapper, buildGestureCommands, buildGestureUitestCommand, buildHap, buildHvigorwArgs, buildInputCommand, buildRawTouchCommand, captureBurst, captureLog, cleanCodelinterOutput, consoleLogger, createHarmonyOsSession, createInstallTempDir, createMaterial, createScaffold, createTempWorkDir, createTokenStore, decideInstallMethod, decideReboot, decryptPwd, dedupEntries, defaultContext, defaultPaths, describeLayoutNode, detectAaStartFailure, detectCmdToolsFlavour, detectInstallFailure, detectProjectSdkVersion, detectRuntimeOs, detectSigningConfigNames, diagnoseBuildFailure, diffEntryNames, diffHapAssets, discoverHaps, downloadAndInstallSdk, downloadFile, dumpLayout, dumpLog, dumpRenderService, dumpScreen, dumpWindow, encryptPwd, ensureFreeSpace, ensureInstallOk, ensureOhModules, ensureOk, ensureRemoteOk, escapeCmdArgument, escapeCmdCommand, existingHapOrUnsigned, extractTarball, extractZipWithProgress, findAppProcessId, findCmdToolsSourceDir, findCoveredNodes, findHarmonyOsSdk, findKeyboardWindow, findLayoutNodes, findMissingProjectSdk, findRunningProcess, flattenLayout, forceStop, formatBytes, generateSigningConfigs, getBundleName, getCmdToolsBin, getCmdToolsDownloadUrl, getCmdToolsPath, getCmdToolsStatus, getDeviceInfo, getDisplaySize, getEmulatorDir, getEmulatorStatus, getFreeSpaceBytes, getHdcPath, getHvigorwPath, getImeBundles, getInstalledSdks, getKey, getMainAbility, getOhosBaseSdkHome, getOhpmPath, getOsFolder, getSdkFilename, getSdkRootDir, getSupportedSdksForUi, harmonyOsAutoSign, harmonyOsSdkLabelForApi, hdcClientFailure, hdcExec, hdcTargetArgs, hdcTargetArgsFor, hideKeyboard, installApp, installCmdTools, installEmulator, installFailureReason, isBundleInstalled, isCmdToolsInstalled, isEmulatorInstalled, isOutOfSpaceError, isRamBackedPath, isUnsignedHap, isValidBundleName, isValidProjectName, killProcessTree, launchApp, listAbilities, listDevices, listModules, listRunningProcesses, listTemplates, locateTarget, needsCmdWrapper, nonInteractivePrompter, noopLogger, noopProgress, normaliseLocalPath, paramGet, paramGetMany, paramSet, parseBounds, parseCodelinterFindings, parseCodelinterReport, parseDeviceList, parseHilogLine, parseImeBundles, parseMainAbilityFromBmDump, parseParamValues, parseRemoteExit, performInput, pickHap, pickSigningKind, pickTarget, prepareSigning, pruneLayout, readJson5File, readJsonFile, readProvisionProfile, reboot, recvFile, removeCmdTools, removeEmulator, removeSdk, removeTempWorkDir, requireHarmonyOsSdk, resolveDeviceSerial, resolveKeyEvent, resolveTmpRoot, runCodelinter, runHvigorw, runOhpm, runProcess, scopedLogger, selectDevice, sendFile, sendGesture, sendInput, sendRawTouch, setHilogLevel, shell, shellChecked, spawnCompat, startEmulator, staticConfig, stopEmulator, streamHilog, takeScreenshot, toLongPath, toSpaceError, uninstallApp, unsignedHapRejection, validateTemplateLayout, verifySha256, waitForBoot, waitForBundle, waitForCondition, waitForLog, waitForTarget, watchLog, waypointsToRawEvents, withoutWindow, writeJson5File, writeJsonFile };