@midscene/cli 1.14.0 → 1.14.1-beta-20261008033312.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/es/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*! For license information please see index.mjs.LICENSE.txt */
2
- import { ReportMergingTool, createReportCliCommands, runConnectivityTest } from "@midscene/core";
2
+ import { ReportMergingTool, createReportCliCommands } from "@midscene/core";
3
3
  import { runToolsCLI } from "@midscene/shared/cli";
4
4
  import { basename, dirname as external_node_path_dirname, extname, join, posix, relative as external_node_path_relative, resolve as external_node_path_resolve, sep as external_node_path_sep, win32 } from "node:path";
5
5
  import { interpolateEnvVars, midsceneYamlTargetKeys, parseYamlScript as yaml_parseYamlScript, resolveWebTarget } from "@midscene/core/yaml";
@@ -12,6 +12,7 @@ import { StringDecoder } from "node:string_decoder";
12
12
  import { fileURLToPath as external_url_fileURLToPath } from "url";
13
13
  import node_process, { cwd as external_node_process_cwd } from "node:process";
14
14
  import lodash_merge from "lodash.merge";
15
+ import { loadDotenvConfig, runModelCommand } from "@midscene/test/internal/model-command";
15
16
  import { createHash } from "node:crypto";
16
17
  import { getMidsceneRunSubDir } from "@midscene/shared/common";
17
18
  import { buildChromeArgs, buildDownloadBehavior, defaultViewportHeight, defaultViewportWidth } from "@midscene/web/puppeteer-agent-launcher";
@@ -20,10 +21,8 @@ import { createYamlPlayer as yaml_runtime_createYamlPlayer } from "@midscene/tes
20
21
  import { stripVTControlCharacters } from "node:util";
21
22
  import { createRequire } from "node:module";
22
23
  import { serializeError } from "@midscene/shared/agent-tools/error-formatter";
23
- import { globalModelConfigManager } from "@midscene/shared/env";
24
24
  import { classifyWorkflowDocumentFormat } from "@midscene/core/internal/test-runner";
25
25
  import * as __rspack_external_assert from "assert";
26
- import * as __rspack_external_crypto from "crypto";
27
26
  import * as __rspack_external_fs from "fs";
28
27
  import * as __rspack_external_os from "os";
29
28
  import * as __rspack_external_path from "path";
@@ -2475,232 +2474,6 @@ var __webpack_modules__ = {
2475
2474
  ]
2476
2475
  };
2477
2476
  },
2478
- "../../node_modules/.pnpm/dotenv@16.4.5/node_modules/dotenv/lib/main.js" (module, __unused_rspack_exports, __webpack_require__) {
2479
- const fs = __webpack_require__("fs");
2480
- const path = __webpack_require__("path");
2481
- const os = __webpack_require__("os");
2482
- const crypto = __webpack_require__("crypto");
2483
- const packageJson = __webpack_require__("../../node_modules/.pnpm/dotenv@16.4.5/node_modules/dotenv/package.json");
2484
- const version = packageJson.version;
2485
- const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
2486
- function parse(src) {
2487
- const obj = {};
2488
- let lines = src.toString();
2489
- lines = lines.replace(/\r\n?/mg, '\n');
2490
- let match;
2491
- while(null != (match = LINE.exec(lines))){
2492
- const key = match[1];
2493
- let value = match[2] || '';
2494
- value = value.trim();
2495
- const maybeQuote = value[0];
2496
- value = value.replace(/^(['"`])([\s\S]*)\1$/mg, '$2');
2497
- if ('"' === maybeQuote) {
2498
- value = value.replace(/\\n/g, '\n');
2499
- value = value.replace(/\\r/g, '\r');
2500
- }
2501
- obj[key] = value;
2502
- }
2503
- return obj;
2504
- }
2505
- function _parseVault(options) {
2506
- const vaultPath = _vaultPath(options);
2507
- const result = DotenvModule.configDotenv({
2508
- path: vaultPath
2509
- });
2510
- if (!result.parsed) {
2511
- const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
2512
- err.code = 'MISSING_DATA';
2513
- throw err;
2514
- }
2515
- const keys = _dotenvKey(options).split(',');
2516
- const length = keys.length;
2517
- let decrypted;
2518
- for(let i = 0; i < length; i++)try {
2519
- const key = keys[i].trim();
2520
- const attrs = _instructions(result, key);
2521
- decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
2522
- break;
2523
- } catch (error) {
2524
- if (i + 1 >= length) throw error;
2525
- }
2526
- return DotenvModule.parse(decrypted);
2527
- }
2528
- function _log(message) {
2529
- console.log(`[dotenv@${version}][INFO] ${message}`);
2530
- }
2531
- function _warn(message) {
2532
- console.log(`[dotenv@${version}][WARN] ${message}`);
2533
- }
2534
- function _debug(message) {
2535
- console.log(`[dotenv@${version}][DEBUG] ${message}`);
2536
- }
2537
- function _dotenvKey(options) {
2538
- if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) return options.DOTENV_KEY;
2539
- if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) return process.env.DOTENV_KEY;
2540
- return '';
2541
- }
2542
- function _instructions(result, dotenvKey) {
2543
- let uri;
2544
- try {
2545
- uri = new URL(dotenvKey);
2546
- } catch (error) {
2547
- if ('ERR_INVALID_URL' === error.code) {
2548
- const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development');
2549
- err.code = 'INVALID_DOTENV_KEY';
2550
- throw err;
2551
- }
2552
- throw error;
2553
- }
2554
- const key = uri.password;
2555
- if (!key) {
2556
- const err = new Error('INVALID_DOTENV_KEY: Missing key part');
2557
- err.code = 'INVALID_DOTENV_KEY';
2558
- throw err;
2559
- }
2560
- const environment = uri.searchParams.get('environment');
2561
- if (!environment) {
2562
- const err = new Error('INVALID_DOTENV_KEY: Missing environment part');
2563
- err.code = 'INVALID_DOTENV_KEY';
2564
- throw err;
2565
- }
2566
- const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
2567
- const ciphertext = result.parsed[environmentKey];
2568
- if (!ciphertext) {
2569
- const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
2570
- err.code = 'NOT_FOUND_DOTENV_ENVIRONMENT';
2571
- throw err;
2572
- }
2573
- return {
2574
- ciphertext,
2575
- key
2576
- };
2577
- }
2578
- function _vaultPath(options) {
2579
- let possibleVaultPath = null;
2580
- if (options && options.path && options.path.length > 0) if (Array.isArray(options.path)) {
2581
- for (const filepath of options.path)if (fs.existsSync(filepath)) possibleVaultPath = filepath.endsWith('.vault') ? filepath : `${filepath}.vault`;
2582
- } else possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`;
2583
- else possibleVaultPath = path.resolve(process.cwd(), '.env.vault');
2584
- if (fs.existsSync(possibleVaultPath)) return possibleVaultPath;
2585
- return null;
2586
- }
2587
- function _resolveHome(envPath) {
2588
- return '~' === envPath[0] ? path.join(os.homedir(), envPath.slice(1)) : envPath;
2589
- }
2590
- function _configVault(options) {
2591
- _log('Loading env from encrypted .env.vault');
2592
- const parsed = DotenvModule._parseVault(options);
2593
- let processEnv = process.env;
2594
- if (options && null != options.processEnv) processEnv = options.processEnv;
2595
- DotenvModule.populate(processEnv, parsed, options);
2596
- return {
2597
- parsed
2598
- };
2599
- }
2600
- function configDotenv(options) {
2601
- const dotenvPath = path.resolve(process.cwd(), '.env');
2602
- let encoding = 'utf8';
2603
- const debug = Boolean(options && options.debug);
2604
- if (options && options.encoding) encoding = options.encoding;
2605
- else if (debug) _debug('No encoding is specified. UTF-8 is used by default');
2606
- let optionPaths = [
2607
- dotenvPath
2608
- ];
2609
- if (options && options.path) if (Array.isArray(options.path)) {
2610
- optionPaths = [];
2611
- for (const filepath of options.path)optionPaths.push(_resolveHome(filepath));
2612
- } else optionPaths = [
2613
- _resolveHome(options.path)
2614
- ];
2615
- let lastError;
2616
- const parsedAll = {};
2617
- for (const path of optionPaths)try {
2618
- const parsed = DotenvModule.parse(fs.readFileSync(path, {
2619
- encoding
2620
- }));
2621
- DotenvModule.populate(parsedAll, parsed, options);
2622
- } catch (e1) {
2623
- if (debug) _debug(`Failed to load ${path} ${e1.message}`);
2624
- lastError = e1;
2625
- }
2626
- let processEnv = process.env;
2627
- if (options && null != options.processEnv) processEnv = options.processEnv;
2628
- DotenvModule.populate(processEnv, parsedAll, options);
2629
- if (lastError) return {
2630
- parsed: parsedAll,
2631
- error: lastError
2632
- };
2633
- return {
2634
- parsed: parsedAll
2635
- };
2636
- }
2637
- function config(options) {
2638
- if (0 === _dotenvKey(options).length) return DotenvModule.configDotenv(options);
2639
- const vaultPath = _vaultPath(options);
2640
- if (!vaultPath) {
2641
- _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
2642
- return DotenvModule.configDotenv(options);
2643
- }
2644
- return DotenvModule._configVault(options);
2645
- }
2646
- function decrypt(encrypted, keyStr) {
2647
- const key = Buffer.from(keyStr.slice(-64), 'hex');
2648
- let ciphertext = Buffer.from(encrypted, 'base64');
2649
- const nonce = ciphertext.subarray(0, 12);
2650
- const authTag = ciphertext.subarray(-16);
2651
- ciphertext = ciphertext.subarray(12, -16);
2652
- try {
2653
- const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce);
2654
- aesgcm.setAuthTag(authTag);
2655
- return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
2656
- } catch (error) {
2657
- const isRange = error instanceof RangeError;
2658
- const invalidKeyLength = 'Invalid key length' === error.message;
2659
- const decryptionFailed = 'Unsupported state or unable to authenticate data' === error.message;
2660
- if (isRange || invalidKeyLength) {
2661
- const err = new Error('INVALID_DOTENV_KEY: It must be 64 characters long (or more)');
2662
- err.code = 'INVALID_DOTENV_KEY';
2663
- throw err;
2664
- }
2665
- if (decryptionFailed) {
2666
- const err = new Error('DECRYPTION_FAILED: Please check your DOTENV_KEY');
2667
- err.code = 'DECRYPTION_FAILED';
2668
- throw err;
2669
- }
2670
- throw error;
2671
- }
2672
- }
2673
- function populate(processEnv, parsed, options = {}) {
2674
- const debug = Boolean(options && options.debug);
2675
- const override = Boolean(options && options.override);
2676
- if ('object' != typeof parsed) {
2677
- const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate');
2678
- err.code = 'OBJECT_REQUIRED';
2679
- throw err;
2680
- }
2681
- for (const key of Object.keys(parsed))if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
2682
- if (true === override) processEnv[key] = parsed[key];
2683
- if (debug) true === override ? _debug(`"${key}" is already defined and WAS overwritten`) : _debug(`"${key}" is already defined and was NOT overwritten`);
2684
- } else processEnv[key] = parsed[key];
2685
- }
2686
- const DotenvModule = {
2687
- configDotenv,
2688
- _configVault,
2689
- _parseVault,
2690
- config,
2691
- decrypt,
2692
- parse,
2693
- populate
2694
- };
2695
- module.exports.configDotenv = DotenvModule.configDotenv;
2696
- module.exports._configVault = DotenvModule._configVault;
2697
- module.exports._parseVault = DotenvModule._parseVault;
2698
- module.exports.config = DotenvModule.config;
2699
- module.exports.decrypt = DotenvModule.decrypt;
2700
- module.exports.parse = DotenvModule.parse;
2701
- module.exports.populate = DotenvModule.populate;
2702
- module.exports = DotenvModule;
2703
- },
2704
2477
  "../../node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js" (module) {
2705
2478
  module.exports = function() {
2706
2479
  return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[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\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
@@ -3023,9 +2796,7 @@ var __webpack_modules__ = {
3023
2796
  module.exports = (string, columns, options)=>String(string).normalize().replace(/\r\n/g, '\n').split('\n').map((line)=>exec(line, columns, options)).join('\n');
3024
2797
  },
3025
2798
  "./src/index.ts" (__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
3026
- var package_namespaceObject = {
3027
- rE: "1.14.0"
3028
- };
2799
+ var package_namespaceObject = JSON.parse('{"rE":"1.14.1-beta-20261008033312.0"}');
3029
2800
  var brace_expansion = __webpack_require__("../../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js");
3030
2801
  const MAX_PATTERN_LENGTH = 65536;
3031
2802
  const assertValidPattern = (pattern)=>{
@@ -8638,7 +8409,8 @@ Github: https://github.com/web-infra-dev/midscene
8638
8409
  Usage:
8639
8410
  $0 [options] <path-to-yaml-script-file-or-directory>
8640
8411
  $0 [options] --files <yaml-file1> <yaml-file2 ...>
8641
- $0 [options] --config <path-to-config-yaml-file>`).options({
8412
+ $0 [options] --config <path-to-config-yaml-file>
8413
+ $0 model verify Check model connectivity and Midscene compatibility`).options({
8642
8414
  files: {
8643
8415
  type: 'array',
8644
8416
  string: true,
@@ -8696,7 +8468,7 @@ Usage:
8696
8468
  type: 'boolean',
8697
8469
  description: 'Whether to dismiss the HarmonyOS keyboard after text input'
8698
8470
  }
8699
- }).version('version', 'Show version number', "1.14.0").help().epilogue(`For complete list of configuration options, please visit:
8471
+ }).version('version', 'Show version number', "1.14.1-beta-20261008033312.0").help().epilogue(`For complete list of configuration options, please visit:
8700
8472
  • Web options: https://midscenejs.com/automate-with-scripts-in-yaml#the-web-part
8701
8473
  • Android options: https://midscenejs.com/automate-with-scripts-in-yaml#the-android-part
8702
8474
  • HarmonyOS options: https://midscenejs.com/automate-with-scripts-in-yaml#the-harmony-part
@@ -10943,18 +10715,6 @@ Native cases/steps Test projects use the midscene-test command.`).wrap(yargs().t
10943
10715
  globalConfig: pickYamlTargetConfig(options)
10944
10716
  };
10945
10717
  }
10946
- var main = __webpack_require__("../../node_modules/.pnpm/dotenv@16.4.5/node_modules/dotenv/lib/main.js");
10947
- var main_default = /*#__PURE__*/ __webpack_require__.n(main);
10948
- function loadDotenvConfig(options = {}) {
10949
- const dotEnvConfigFile = join(options.cwd ?? process.cwd(), '.env');
10950
- if (!(0, __rspack_external_node_fs_5ea92f0c.existsSync)(dotEnvConfigFile)) return;
10951
- options.log?.(` Env file: ${dotEnvConfigFile}`);
10952
- main_default().config({
10953
- path: dotEnvConfigFile,
10954
- debug: options.dotenvDebug,
10955
- override: options.dotenvOverride
10956
- });
10957
- }
10958
10718
  const warnRetryReport = getDebug('execution-summary', {
10959
10719
  console: true
10960
10720
  });
@@ -12723,172 +12483,17 @@ defineYamlBatchTest(test, testOptions);
12723
12483
  const success = printExecutionSummary(results, summaryPath);
12724
12484
  return success ? exitCode : 1;
12725
12485
  }
12726
- const DEFAULT_OPENAI_BASE_URL = 'https://api.openai.com/v1';
12727
- const MODEL_VERIFY_SEPARATOR = '────────────────────────────────────────';
12728
- const MODEL_COMMAND_USAGE = `Usage:
12729
- midscene model verify
12730
- midscene model eval
12731
- `;
12732
- function assertNoModelVerifyOptions(args) {
12733
- for (const arg of args)throw new Error(`Unknown option for midscene model verify: ${arg}`);
12734
- }
12735
- function shellSingleQuote(value) {
12736
- return `'${value.replace(/'/g, "'\\''")}'`;
12737
- }
12738
- function buildChatCompletionsUrl(baseURL) {
12739
- const normalizedBaseURL = (baseURL || DEFAULT_OPENAI_BASE_URL).replace(/\/+$/, '');
12740
- if (normalizedBaseURL.endsWith('/chat/completions')) return normalizedBaseURL;
12741
- return `${normalizedBaseURL}/chat/completions`;
12742
- }
12743
- function buildCurlCommand(modelConfig) {
12744
- const payload = {
12745
- model: modelConfig.modelName,
12746
- messages: [
12747
- {
12748
- role: 'user',
12749
- content: 'What is 1+1?'
12750
- }
12751
- ]
12752
- };
12753
- return [
12754
- `curl -X POST ${shellSingleQuote(buildChatCompletionsUrl(modelConfig.openaiBaseURL))} \\`,
12755
- ` -H ${shellSingleQuote(`Authorization: Bearer ${modelConfig.openaiApiKey || ''}`)} \\`,
12756
- ` -H ${shellSingleQuote('Content-Type: application/json')} \\`,
12757
- ` -d ${shellSingleQuote(JSON.stringify(payload, null, 2))}`
12758
- ].join('\n');
12759
- }
12760
- function buildCurlDedupKey(modelConfig) {
12761
- return JSON.stringify({
12762
- baseURL: modelConfig.openaiBaseURL || DEFAULT_OPENAI_BASE_URL,
12763
- apiKey: modelConfig.openaiApiKey || '',
12764
- modelName: modelConfig.modelName
12765
- });
12766
- }
12767
- function buildModelVerifyCurlCommands(configs) {
12768
- const commandMap = new Map();
12769
- for (const item of configs){
12770
- const key = buildCurlDedupKey(item.modelConfig);
12771
- const existing = commandMap.get(key);
12772
- if (existing) {
12773
- existing.intents.push(item.intent);
12774
- continue;
12775
- }
12776
- commandMap.set(key, {
12777
- intents: [
12778
- item.intent
12779
- ],
12780
- curl: buildCurlCommand(item.modelConfig),
12781
- usesDefaultBaseURL: !item.modelConfig.openaiBaseURL
12782
- });
12783
- }
12784
- return [
12785
- ...commandMap.values()
12786
- ];
12787
- }
12788
- function formatModelVerifyFailureOutput(message, curlCommands) {
12789
- const details = message?.trim() || 'No failure details were generated.';
12790
- const curlSection = curlCommands.map((item)=>{
12791
- const baseUrlNote = item.usesDefaultBaseURL ? ' (base URL not configured; using OpenAI SDK default)' : '';
12792
- return source_default().gray(`# ${item.intents.join(', ')}${baseUrlNote}\n${item.curl}`);
12793
- }).join('\n\n');
12794
- return [
12795
- source_default().red.bold('❌ Model verify failed with messages:'),
12796
- MODEL_VERIFY_SEPARATOR,
12797
- '',
12798
- details,
12799
- '',
12800
- MODEL_VERIFY_SEPARATOR,
12801
- 'Generated curl requests for basic API connectivity:',
12802
- 'If the error is a basic connectivity issue, use these requests to test the base URL, API key, and model name directly.',
12803
- 'These commands contain your API key. Do not share them publicly.',
12804
- '',
12805
- curlSection
12806
- ].join('\n');
12807
- }
12808
- function getDefaultDeps(io) {
12809
- return {
12810
- loadDotenv: ()=>{
12811
- loadDotenvConfig({
12486
+ const model_command_runModelCommand = (rawArgs, deps, io = {
12487
+ stdout: console.log,
12488
+ stderr: console.error
12489
+ })=>runModelCommand(rawArgs, {
12490
+ loadDotenv: ()=>loadDotenvConfig({
12812
12491
  dotenvDebug: true,
12813
12492
  dotenvOverride: true,
12814
12493
  log: io.stdout
12815
- });
12816
- },
12817
- getModelConfig: (intent)=>globalModelConfigManager.getModelConfig(intent),
12818
- verifyModel: runConnectivityTest
12819
- };
12820
- }
12821
- async function runModelVerifyCommand(args, deps, io) {
12822
- try {
12823
- if (args.includes('--help') || args.includes('-h')) {
12824
- io.stdout(MODEL_COMMAND_USAGE);
12825
- return 0;
12826
- }
12827
- assertNoModelVerifyOptions(args);
12828
- io.stdout('Model verify started. This usually takes about 5 seconds.\n');
12829
- deps.loadDotenv();
12830
- io.stdout('');
12831
- const defaultModelConfig = deps.getModelConfig('default');
12832
- const planningModelConfig = deps.getModelConfig('planning');
12833
- const insightModelConfig = deps.getModelConfig('insight');
12834
- const curlCommands = buildModelVerifyCurlCommands([
12835
- {
12836
- intent: 'default',
12837
- modelConfig: defaultModelConfig
12838
- },
12839
- {
12840
- intent: 'planning',
12841
- modelConfig: planningModelConfig
12842
- },
12843
- {
12844
- intent: 'insight',
12845
- modelConfig: insightModelConfig
12846
- }
12847
- ]);
12848
- const result = await deps.verifyModel({
12849
- defaultModelConfig,
12850
- planningModelConfig,
12851
- insightModelConfig
12852
- });
12853
- if (result.passed) {
12854
- io.stdout('✅ Model verify passed.');
12855
- return 0;
12856
- }
12857
- io.stderr(formatModelVerifyFailureOutput(result.message, curlCommands));
12858
- return 1;
12859
- } catch (error) {
12860
- const message = error instanceof Error ? error.message : String(error);
12861
- io.stderr([
12862
- MODEL_VERIFY_SEPARATOR,
12863
- '❌ Model verify failed with messages:',
12864
- '',
12865
- message,
12866
- MODEL_VERIFY_SEPARATOR
12867
- ].join('\n'));
12868
- return 1;
12869
- }
12870
- }
12871
- async function runModelCommand(rawArgs, deps, io = {
12872
- stdout: console.log,
12873
- stderr: console.error
12874
- }) {
12875
- const [, action, ...restArgs] = rawArgs;
12876
- const mergedDeps = {
12877
- ...getDefaultDeps(io),
12494
+ }),
12878
12495
  ...deps
12879
- };
12880
- if (!action || '--help' === action || '-h' === action) {
12881
- io.stdout(MODEL_COMMAND_USAGE);
12882
- return 0;
12883
- }
12884
- if ('verify' === action) return runModelVerifyCommand(restArgs, mergedDeps, io);
12885
- if ('eval' === action) {
12886
- io.stderr('midscene model eval is not implemented yet. It is reserved for future model evaluation suites.');
12887
- return 1;
12888
- }
12889
- io.stderr(`Unknown midscene model command: ${action}\n\n${MODEL_COMMAND_USAGE}`);
12890
- return 1;
12891
- }
12496
+ }, io, 'midscene');
12892
12497
  const probeWorkflowFormat = (file)=>{
12893
12498
  try {
12894
12499
  const content = (0, __rspack_external_node_fs_5ea92f0c.readFileSync)(file, 'utf8').replace(/\$\{[^}\r\n]*\}/g, 'MIDSCENE_ENV');
@@ -12937,7 +12542,7 @@ defineYamlBatchTest(test, testOptions);
12937
12542
  extraCommands: createReportCliCommands()
12938
12543
  });
12939
12544
  if ('model' === firstArg) {
12940
- const exitCode = await runModelCommand(rawArgs);
12545
+ const exitCode = await model_command_runModelCommand(rawArgs);
12941
12546
  process.exit(exitCode);
12942
12547
  return;
12943
12548
  }
@@ -13013,9 +12618,6 @@ defineYamlBatchTest(test, testOptions);
13013
12618
  assert (module) {
13014
12619
  module.exports = __rspack_external_assert;
13015
12620
  },
13016
- crypto (module) {
13017
- module.exports = __rspack_external_crypto;
13018
- },
13019
12621
  fs (module) {
13020
12622
  module.exports = __rspack_external_fs;
13021
12623
  },
@@ -16300,9 +15902,6 @@ defineYamlBatchTest(test, testOptions);
16300
15902
  YError: e1
16301
15903
  };
16302
15904
  module.exports = ue;
16303
- },
16304
- "../../node_modules/.pnpm/dotenv@16.4.5/node_modules/dotenv/package.json" (module) {
16305
- module.exports = JSON.parse('{"name":"dotenv","version":"16.4.5","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","lint-readme":"standard-markdown","pretest":"npm run lint && npm run dts-check","test":"tap tests/*.js --100 -Rspec","test:coverage":"tap --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@definitelytyped/dtslint":"^0.0.133","@types/node":"^18.11.3","decache":"^4.6.1","sinon":"^14.0.1","standard":"^17.0.0","standard-markdown":"^7.1.0","standard-version":"^9.5.0","tap":"^16.3.0","tar":"^6.1.11","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}');
16306
15905
  }
16307
15906
  };
16308
15907
  var __webpack_module_cache__ = {};