@midscene/cli 1.8.11 → 1.9.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.
@@ -2911,6 +2911,7 @@ async function createYamlPlayer(file, script, options) {
2911
2911
  void 0 !== webTarget,
2912
2912
  void 0 !== clonedYamlScript.android,
2913
2913
  void 0 !== clonedYamlScript.ios,
2914
+ void 0 !== clonedYamlScript.harmony,
2914
2915
  void 0 !== clonedYamlScript.computer,
2915
2916
  void 0 !== clonedYamlScript.interface
2916
2917
  ].filter(Boolean).length;
@@ -2919,10 +2920,11 @@ async function createYamlPlayer(file, script, options) {
2919
2920
  void 0 !== webTarget ? 'web' : null,
2920
2921
  void 0 !== clonedYamlScript.android ? 'android' : null,
2921
2922
  void 0 !== clonedYamlScript.ios ? 'ios' : null,
2923
+ void 0 !== clonedYamlScript.harmony ? 'harmony' : null,
2922
2924
  void 0 !== clonedYamlScript.computer ? 'computer' : null,
2923
2925
  void 0 !== clonedYamlScript.interface ? 'interface' : null
2924
2926
  ].filter(Boolean);
2925
- throw new Error(`Only one target type can be specified, but found multiple: ${specifiedTargets.join(', ')}. Please specify only one of: web, android, ios, computer, or interface.`);
2927
+ throw new Error(`Only one target type can be specified, but found multiple: ${specifiedTargets.join(', ')}. Please specify only one of: web, android, ios, harmony, computer, or interface.`);
2926
2928
  }
2927
2929
  if (void 0 !== webTarget) {
2928
2930
  if (void 0 !== clonedYamlScript.target) console.warn("target is deprecated, please use web instead. See https://midscenejs.com/automate-with-scripts-in-yaml for more information. Sorry for the inconvenience.");
@@ -3027,6 +3029,23 @@ async function createYamlPlayer(file, script, options) {
3027
3029
  freeFn
3028
3030
  };
3029
3031
  }
3032
+ if (void 0 !== clonedYamlScript.harmony) {
3033
+ const harmonyTarget = clonedYamlScript.harmony;
3034
+ const { agentFromHdcDevice } = await import("@midscene/harmony");
3035
+ const agent = await agentFromHdcDevice(harmonyTarget?.deviceId, {
3036
+ ...harmonyTarget,
3037
+ ...buildAgentOptions(clonedYamlScript.agent, preference.reportFileName, fileName)
3038
+ });
3039
+ if (harmonyTarget?.launch) await agent.launch(harmonyTarget.launch);
3040
+ freeFn.push({
3041
+ name: 'destroy_harmony_agent',
3042
+ fn: ()=>agent.destroy()
3043
+ });
3044
+ return {
3045
+ agent,
3046
+ freeFn
3047
+ };
3048
+ }
3030
3049
  if (void 0 !== clonedYamlScript.computer) {
3031
3050
  const computerTarget = clonedYamlScript.computer;
3032
3051
  const { agentForComputer } = await import("@midscene/computer");
@@ -3069,7 +3088,7 @@ async function createYamlPlayer(file, script, options) {
3069
3088
  freeFn
3070
3089
  };
3071
3090
  }
3072
- throw new Error('No valid interface configuration found in the yaml script, should be either "web", "android", "ios", "computer", or "interface"');
3091
+ throw new Error('No valid interface configuration found in the yaml script, should be either "web", "android", "ios", "harmony", "computer", or "interface"');
3073
3092
  }, void 0, file);
3074
3093
  return player;
3075
3094
  }