@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 +14 -415
- package/dist/es/index.mjs.map +1 -1
- package/dist/lib/index.js +13 -417
- package/dist/lib/index.js.map +1 -1
- package/package.json +9 -9
package/dist/lib/index.js
CHANGED
|
@@ -2451,232 +2451,6 @@ var __webpack_modules__ = {
|
|
|
2451
2451
|
]
|
|
2452
2452
|
};
|
|
2453
2453
|
},
|
|
2454
|
-
"../../node_modules/.pnpm/dotenv@16.4.5/node_modules/dotenv/lib/main.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
2455
|
-
const fs = __webpack_require__("fs");
|
|
2456
|
-
const path = __webpack_require__("path");
|
|
2457
|
-
const os = __webpack_require__("os");
|
|
2458
|
-
const crypto = __webpack_require__("crypto");
|
|
2459
|
-
const packageJson = __webpack_require__("../../node_modules/.pnpm/dotenv@16.4.5/node_modules/dotenv/package.json");
|
|
2460
|
-
const version = packageJson.version;
|
|
2461
|
-
const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
2462
|
-
function parse(src) {
|
|
2463
|
-
const obj = {};
|
|
2464
|
-
let lines = src.toString();
|
|
2465
|
-
lines = lines.replace(/\r\n?/mg, '\n');
|
|
2466
|
-
let match;
|
|
2467
|
-
while(null != (match = LINE.exec(lines))){
|
|
2468
|
-
const key = match[1];
|
|
2469
|
-
let value = match[2] || '';
|
|
2470
|
-
value = value.trim();
|
|
2471
|
-
const maybeQuote = value[0];
|
|
2472
|
-
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, '$2');
|
|
2473
|
-
if ('"' === maybeQuote) {
|
|
2474
|
-
value = value.replace(/\\n/g, '\n');
|
|
2475
|
-
value = value.replace(/\\r/g, '\r');
|
|
2476
|
-
}
|
|
2477
|
-
obj[key] = value;
|
|
2478
|
-
}
|
|
2479
|
-
return obj;
|
|
2480
|
-
}
|
|
2481
|
-
function _parseVault(options) {
|
|
2482
|
-
const vaultPath = _vaultPath(options);
|
|
2483
|
-
const result = DotenvModule.configDotenv({
|
|
2484
|
-
path: vaultPath
|
|
2485
|
-
});
|
|
2486
|
-
if (!result.parsed) {
|
|
2487
|
-
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
2488
|
-
err.code = 'MISSING_DATA';
|
|
2489
|
-
throw err;
|
|
2490
|
-
}
|
|
2491
|
-
const keys = _dotenvKey(options).split(',');
|
|
2492
|
-
const length = keys.length;
|
|
2493
|
-
let decrypted;
|
|
2494
|
-
for(let i = 0; i < length; i++)try {
|
|
2495
|
-
const key = keys[i].trim();
|
|
2496
|
-
const attrs = _instructions(result, key);
|
|
2497
|
-
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
2498
|
-
break;
|
|
2499
|
-
} catch (error) {
|
|
2500
|
-
if (i + 1 >= length) throw error;
|
|
2501
|
-
}
|
|
2502
|
-
return DotenvModule.parse(decrypted);
|
|
2503
|
-
}
|
|
2504
|
-
function _log(message) {
|
|
2505
|
-
console.log(`[dotenv@${version}][INFO] ${message}`);
|
|
2506
|
-
}
|
|
2507
|
-
function _warn(message) {
|
|
2508
|
-
console.log(`[dotenv@${version}][WARN] ${message}`);
|
|
2509
|
-
}
|
|
2510
|
-
function _debug(message) {
|
|
2511
|
-
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
2512
|
-
}
|
|
2513
|
-
function _dotenvKey(options) {
|
|
2514
|
-
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) return options.DOTENV_KEY;
|
|
2515
|
-
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) return process.env.DOTENV_KEY;
|
|
2516
|
-
return '';
|
|
2517
|
-
}
|
|
2518
|
-
function _instructions(result, dotenvKey) {
|
|
2519
|
-
let uri;
|
|
2520
|
-
try {
|
|
2521
|
-
uri = new URL(dotenvKey);
|
|
2522
|
-
} catch (error) {
|
|
2523
|
-
if ('ERR_INVALID_URL' === error.code) {
|
|
2524
|
-
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');
|
|
2525
|
-
err.code = 'INVALID_DOTENV_KEY';
|
|
2526
|
-
throw err;
|
|
2527
|
-
}
|
|
2528
|
-
throw error;
|
|
2529
|
-
}
|
|
2530
|
-
const key = uri.password;
|
|
2531
|
-
if (!key) {
|
|
2532
|
-
const err = new Error('INVALID_DOTENV_KEY: Missing key part');
|
|
2533
|
-
err.code = 'INVALID_DOTENV_KEY';
|
|
2534
|
-
throw err;
|
|
2535
|
-
}
|
|
2536
|
-
const environment = uri.searchParams.get('environment');
|
|
2537
|
-
if (!environment) {
|
|
2538
|
-
const err = new Error('INVALID_DOTENV_KEY: Missing environment part');
|
|
2539
|
-
err.code = 'INVALID_DOTENV_KEY';
|
|
2540
|
-
throw err;
|
|
2541
|
-
}
|
|
2542
|
-
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
|
|
2543
|
-
const ciphertext = result.parsed[environmentKey];
|
|
2544
|
-
if (!ciphertext) {
|
|
2545
|
-
const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
|
|
2546
|
-
err.code = 'NOT_FOUND_DOTENV_ENVIRONMENT';
|
|
2547
|
-
throw err;
|
|
2548
|
-
}
|
|
2549
|
-
return {
|
|
2550
|
-
ciphertext,
|
|
2551
|
-
key
|
|
2552
|
-
};
|
|
2553
|
-
}
|
|
2554
|
-
function _vaultPath(options) {
|
|
2555
|
-
let possibleVaultPath = null;
|
|
2556
|
-
if (options && options.path && options.path.length > 0) if (Array.isArray(options.path)) {
|
|
2557
|
-
for (const filepath of options.path)if (fs.existsSync(filepath)) possibleVaultPath = filepath.endsWith('.vault') ? filepath : `${filepath}.vault`;
|
|
2558
|
-
} else possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`;
|
|
2559
|
-
else possibleVaultPath = path.resolve(process.cwd(), '.env.vault');
|
|
2560
|
-
if (fs.existsSync(possibleVaultPath)) return possibleVaultPath;
|
|
2561
|
-
return null;
|
|
2562
|
-
}
|
|
2563
|
-
function _resolveHome(envPath) {
|
|
2564
|
-
return '~' === envPath[0] ? path.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
2565
|
-
}
|
|
2566
|
-
function _configVault(options) {
|
|
2567
|
-
_log('Loading env from encrypted .env.vault');
|
|
2568
|
-
const parsed = DotenvModule._parseVault(options);
|
|
2569
|
-
let processEnv = process.env;
|
|
2570
|
-
if (options && null != options.processEnv) processEnv = options.processEnv;
|
|
2571
|
-
DotenvModule.populate(processEnv, parsed, options);
|
|
2572
|
-
return {
|
|
2573
|
-
parsed
|
|
2574
|
-
};
|
|
2575
|
-
}
|
|
2576
|
-
function configDotenv(options) {
|
|
2577
|
-
const dotenvPath = path.resolve(process.cwd(), '.env');
|
|
2578
|
-
let encoding = 'utf8';
|
|
2579
|
-
const debug = Boolean(options && options.debug);
|
|
2580
|
-
if (options && options.encoding) encoding = options.encoding;
|
|
2581
|
-
else if (debug) _debug('No encoding is specified. UTF-8 is used by default');
|
|
2582
|
-
let optionPaths = [
|
|
2583
|
-
dotenvPath
|
|
2584
|
-
];
|
|
2585
|
-
if (options && options.path) if (Array.isArray(options.path)) {
|
|
2586
|
-
optionPaths = [];
|
|
2587
|
-
for (const filepath of options.path)optionPaths.push(_resolveHome(filepath));
|
|
2588
|
-
} else optionPaths = [
|
|
2589
|
-
_resolveHome(options.path)
|
|
2590
|
-
];
|
|
2591
|
-
let lastError;
|
|
2592
|
-
const parsedAll = {};
|
|
2593
|
-
for (const path of optionPaths)try {
|
|
2594
|
-
const parsed = DotenvModule.parse(fs.readFileSync(path, {
|
|
2595
|
-
encoding
|
|
2596
|
-
}));
|
|
2597
|
-
DotenvModule.populate(parsedAll, parsed, options);
|
|
2598
|
-
} catch (e1) {
|
|
2599
|
-
if (debug) _debug(`Failed to load ${path} ${e1.message}`);
|
|
2600
|
-
lastError = e1;
|
|
2601
|
-
}
|
|
2602
|
-
let processEnv = process.env;
|
|
2603
|
-
if (options && null != options.processEnv) processEnv = options.processEnv;
|
|
2604
|
-
DotenvModule.populate(processEnv, parsedAll, options);
|
|
2605
|
-
if (lastError) return {
|
|
2606
|
-
parsed: parsedAll,
|
|
2607
|
-
error: lastError
|
|
2608
|
-
};
|
|
2609
|
-
return {
|
|
2610
|
-
parsed: parsedAll
|
|
2611
|
-
};
|
|
2612
|
-
}
|
|
2613
|
-
function config(options) {
|
|
2614
|
-
if (0 === _dotenvKey(options).length) return DotenvModule.configDotenv(options);
|
|
2615
|
-
const vaultPath = _vaultPath(options);
|
|
2616
|
-
if (!vaultPath) {
|
|
2617
|
-
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
|
|
2618
|
-
return DotenvModule.configDotenv(options);
|
|
2619
|
-
}
|
|
2620
|
-
return DotenvModule._configVault(options);
|
|
2621
|
-
}
|
|
2622
|
-
function decrypt(encrypted, keyStr) {
|
|
2623
|
-
const key = Buffer.from(keyStr.slice(-64), 'hex');
|
|
2624
|
-
let ciphertext = Buffer.from(encrypted, 'base64');
|
|
2625
|
-
const nonce = ciphertext.subarray(0, 12);
|
|
2626
|
-
const authTag = ciphertext.subarray(-16);
|
|
2627
|
-
ciphertext = ciphertext.subarray(12, -16);
|
|
2628
|
-
try {
|
|
2629
|
-
const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce);
|
|
2630
|
-
aesgcm.setAuthTag(authTag);
|
|
2631
|
-
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
|
|
2632
|
-
} catch (error) {
|
|
2633
|
-
const isRange = error instanceof RangeError;
|
|
2634
|
-
const invalidKeyLength = 'Invalid key length' === error.message;
|
|
2635
|
-
const decryptionFailed = 'Unsupported state or unable to authenticate data' === error.message;
|
|
2636
|
-
if (isRange || invalidKeyLength) {
|
|
2637
|
-
const err = new Error('INVALID_DOTENV_KEY: It must be 64 characters long (or more)');
|
|
2638
|
-
err.code = 'INVALID_DOTENV_KEY';
|
|
2639
|
-
throw err;
|
|
2640
|
-
}
|
|
2641
|
-
if (decryptionFailed) {
|
|
2642
|
-
const err = new Error('DECRYPTION_FAILED: Please check your DOTENV_KEY');
|
|
2643
|
-
err.code = 'DECRYPTION_FAILED';
|
|
2644
|
-
throw err;
|
|
2645
|
-
}
|
|
2646
|
-
throw error;
|
|
2647
|
-
}
|
|
2648
|
-
}
|
|
2649
|
-
function populate(processEnv, parsed, options = {}) {
|
|
2650
|
-
const debug = Boolean(options && options.debug);
|
|
2651
|
-
const override = Boolean(options && options.override);
|
|
2652
|
-
if ('object' != typeof parsed) {
|
|
2653
|
-
const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate');
|
|
2654
|
-
err.code = 'OBJECT_REQUIRED';
|
|
2655
|
-
throw err;
|
|
2656
|
-
}
|
|
2657
|
-
for (const key of Object.keys(parsed))if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
2658
|
-
if (true === override) processEnv[key] = parsed[key];
|
|
2659
|
-
if (debug) true === override ? _debug(`"${key}" is already defined and WAS overwritten`) : _debug(`"${key}" is already defined and was NOT overwritten`);
|
|
2660
|
-
} else processEnv[key] = parsed[key];
|
|
2661
|
-
}
|
|
2662
|
-
const DotenvModule = {
|
|
2663
|
-
configDotenv,
|
|
2664
|
-
_configVault,
|
|
2665
|
-
_parseVault,
|
|
2666
|
-
config,
|
|
2667
|
-
decrypt,
|
|
2668
|
-
parse,
|
|
2669
|
-
populate
|
|
2670
|
-
};
|
|
2671
|
-
module.exports.configDotenv = DotenvModule.configDotenv;
|
|
2672
|
-
module.exports._configVault = DotenvModule._configVault;
|
|
2673
|
-
module.exports._parseVault = DotenvModule._parseVault;
|
|
2674
|
-
module.exports.config = DotenvModule.config;
|
|
2675
|
-
module.exports.decrypt = DotenvModule.decrypt;
|
|
2676
|
-
module.exports.parse = DotenvModule.parse;
|
|
2677
|
-
module.exports.populate = DotenvModule.populate;
|
|
2678
|
-
module.exports = DotenvModule;
|
|
2679
|
-
},
|
|
2680
2454
|
"../../node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js" (module) {
|
|
2681
2455
|
"use strict";
|
|
2682
2456
|
module.exports = function() {
|
|
@@ -4813,9 +4587,7 @@ defineYamlBatchTest(test, testOptions);
|
|
|
4813
4587
|
"use strict";
|
|
4814
4588
|
var core_ = __webpack_require__("@midscene/core");
|
|
4815
4589
|
const cli_namespaceObject = require("@midscene/shared/cli");
|
|
4816
|
-
var package_namespaceObject = {
|
|
4817
|
-
rE: "1.14.0"
|
|
4818
|
-
};
|
|
4590
|
+
var package_namespaceObject = JSON.parse('{"rE":"1.14.1-beta-20261008033312.0"}');
|
|
4819
4591
|
var external_node_fs_ = __webpack_require__("node:fs");
|
|
4820
4592
|
var external_node_fs_namespaceObject = /*#__PURE__*/ __webpack_require__.t(external_node_fs_, 2);
|
|
4821
4593
|
var external_node_path_ = __webpack_require__("node:path");
|
|
@@ -10439,7 +10211,8 @@ Github: https://github.com/web-infra-dev/midscene
|
|
|
10439
10211
|
Usage:
|
|
10440
10212
|
$0 [options] <path-to-yaml-script-file-or-directory>
|
|
10441
10213
|
$0 [options] --files <yaml-file1> <yaml-file2 ...>
|
|
10442
|
-
$0 [options] --config <path-to-config-yaml-file
|
|
10214
|
+
$0 [options] --config <path-to-config-yaml-file>
|
|
10215
|
+
$0 model verify Check model connectivity and Midscene compatibility`).options({
|
|
10443
10216
|
files: {
|
|
10444
10217
|
type: 'array',
|
|
10445
10218
|
string: true,
|
|
@@ -10497,7 +10270,7 @@ Usage:
|
|
|
10497
10270
|
type: 'boolean',
|
|
10498
10271
|
description: 'Whether to dismiss the HarmonyOS keyboard after text input'
|
|
10499
10272
|
}
|
|
10500
|
-
}).version('version', 'Show version number', "1.14.0").help().epilogue(`For complete list of configuration options, please visit:
|
|
10273
|
+
}).version('version', 'Show version number', "1.14.1-beta-20261008033312.0").help().epilogue(`For complete list of configuration options, please visit:
|
|
10501
10274
|
• Web options: https://midscenejs.com/automate-with-scripts-in-yaml#the-web-part
|
|
10502
10275
|
• Android options: https://midscenejs.com/automate-with-scripts-in-yaml#the-android-part
|
|
10503
10276
|
• HarmonyOS options: https://midscenejs.com/automate-with-scripts-in-yaml#the-harmony-part
|
|
@@ -12747,188 +12520,19 @@ Native cases/steps Test projects use the midscene-test command.`).wrap(yargs().t
|
|
|
12747
12520
|
globalConfig: pickYamlTargetConfig(options)
|
|
12748
12521
|
};
|
|
12749
12522
|
}
|
|
12750
|
-
|
|
12751
|
-
var main_default = /*#__PURE__*/ __webpack_require__.n(main);
|
|
12752
|
-
function loadDotenvConfig(options = {}) {
|
|
12753
|
-
const dotEnvConfigFile = (0, external_node_path_.join)(options.cwd ?? process.cwd(), '.env');
|
|
12754
|
-
if (!(0, external_node_fs_.existsSync)(dotEnvConfigFile)) return;
|
|
12755
|
-
options.log?.(` Env file: ${dotEnvConfigFile}`);
|
|
12756
|
-
main_default().config({
|
|
12757
|
-
path: dotEnvConfigFile,
|
|
12758
|
-
debug: options.dotenvDebug,
|
|
12759
|
-
override: options.dotenvOverride
|
|
12760
|
-
});
|
|
12761
|
-
}
|
|
12523
|
+
const model_command_namespaceObject = require("@midscene/test/internal/model-command");
|
|
12762
12524
|
var framework = __webpack_require__("./src/framework/index.ts");
|
|
12763
|
-
const
|
|
12764
|
-
|
|
12765
|
-
|
|
12766
|
-
|
|
12767
|
-
|
|
12768
|
-
const MODEL_COMMAND_USAGE = `Usage:
|
|
12769
|
-
midscene model verify
|
|
12770
|
-
midscene model eval
|
|
12771
|
-
`;
|
|
12772
|
-
function assertNoModelVerifyOptions(args) {
|
|
12773
|
-
for (const arg of args)throw new Error(`Unknown option for midscene model verify: ${arg}`);
|
|
12774
|
-
}
|
|
12775
|
-
function shellSingleQuote(value) {
|
|
12776
|
-
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
12777
|
-
}
|
|
12778
|
-
function buildChatCompletionsUrl(baseURL) {
|
|
12779
|
-
const normalizedBaseURL = (baseURL || DEFAULT_OPENAI_BASE_URL).replace(/\/+$/, '');
|
|
12780
|
-
if (normalizedBaseURL.endsWith('/chat/completions')) return normalizedBaseURL;
|
|
12781
|
-
return `${normalizedBaseURL}/chat/completions`;
|
|
12782
|
-
}
|
|
12783
|
-
function buildCurlCommand(modelConfig) {
|
|
12784
|
-
const payload = {
|
|
12785
|
-
model: modelConfig.modelName,
|
|
12786
|
-
messages: [
|
|
12787
|
-
{
|
|
12788
|
-
role: 'user',
|
|
12789
|
-
content: 'What is 1+1?'
|
|
12790
|
-
}
|
|
12791
|
-
]
|
|
12792
|
-
};
|
|
12793
|
-
return [
|
|
12794
|
-
`curl -X POST ${shellSingleQuote(buildChatCompletionsUrl(modelConfig.openaiBaseURL))} \\`,
|
|
12795
|
-
` -H ${shellSingleQuote(`Authorization: Bearer ${modelConfig.openaiApiKey || ''}`)} \\`,
|
|
12796
|
-
` -H ${shellSingleQuote('Content-Type: application/json')} \\`,
|
|
12797
|
-
` -d ${shellSingleQuote(JSON.stringify(payload, null, 2))}`
|
|
12798
|
-
].join('\n');
|
|
12799
|
-
}
|
|
12800
|
-
function buildCurlDedupKey(modelConfig) {
|
|
12801
|
-
return JSON.stringify({
|
|
12802
|
-
baseURL: modelConfig.openaiBaseURL || DEFAULT_OPENAI_BASE_URL,
|
|
12803
|
-
apiKey: modelConfig.openaiApiKey || '',
|
|
12804
|
-
modelName: modelConfig.modelName
|
|
12805
|
-
});
|
|
12806
|
-
}
|
|
12807
|
-
function buildModelVerifyCurlCommands(configs) {
|
|
12808
|
-
const commandMap = new Map();
|
|
12809
|
-
for (const item of configs){
|
|
12810
|
-
const key = buildCurlDedupKey(item.modelConfig);
|
|
12811
|
-
const existing = commandMap.get(key);
|
|
12812
|
-
if (existing) {
|
|
12813
|
-
existing.intents.push(item.intent);
|
|
12814
|
-
continue;
|
|
12815
|
-
}
|
|
12816
|
-
commandMap.set(key, {
|
|
12817
|
-
intents: [
|
|
12818
|
-
item.intent
|
|
12819
|
-
],
|
|
12820
|
-
curl: buildCurlCommand(item.modelConfig),
|
|
12821
|
-
usesDefaultBaseURL: !item.modelConfig.openaiBaseURL
|
|
12822
|
-
});
|
|
12823
|
-
}
|
|
12824
|
-
return [
|
|
12825
|
-
...commandMap.values()
|
|
12826
|
-
];
|
|
12827
|
-
}
|
|
12828
|
-
function formatModelVerifyFailureOutput(message, curlCommands) {
|
|
12829
|
-
const details = message?.trim() || 'No failure details were generated.';
|
|
12830
|
-
const curlSection = curlCommands.map((item)=>{
|
|
12831
|
-
const baseUrlNote = item.usesDefaultBaseURL ? ' (base URL not configured; using OpenAI SDK default)' : '';
|
|
12832
|
-
return source_default().gray(`# ${item.intents.join(', ')}${baseUrlNote}\n${item.curl}`);
|
|
12833
|
-
}).join('\n\n');
|
|
12834
|
-
return [
|
|
12835
|
-
source_default().red.bold('❌ Model verify failed with messages:'),
|
|
12836
|
-
MODEL_VERIFY_SEPARATOR,
|
|
12837
|
-
'',
|
|
12838
|
-
details,
|
|
12839
|
-
'',
|
|
12840
|
-
MODEL_VERIFY_SEPARATOR,
|
|
12841
|
-
'Generated curl requests for basic API connectivity:',
|
|
12842
|
-
'If the error is a basic connectivity issue, use these requests to test the base URL, API key, and model name directly.',
|
|
12843
|
-
'These commands contain your API key. Do not share them publicly.',
|
|
12844
|
-
'',
|
|
12845
|
-
curlSection
|
|
12846
|
-
].join('\n');
|
|
12847
|
-
}
|
|
12848
|
-
function getDefaultDeps(io) {
|
|
12849
|
-
return {
|
|
12850
|
-
loadDotenv: ()=>{
|
|
12851
|
-
loadDotenvConfig({
|
|
12525
|
+
const runModelCommand = (rawArgs, deps, io = {
|
|
12526
|
+
stdout: console.log,
|
|
12527
|
+
stderr: console.error
|
|
12528
|
+
})=>(0, model_command_namespaceObject.runModelCommand)(rawArgs, {
|
|
12529
|
+
loadDotenv: ()=>(0, model_command_namespaceObject.loadDotenvConfig)({
|
|
12852
12530
|
dotenvDebug: true,
|
|
12853
12531
|
dotenvOverride: true,
|
|
12854
12532
|
log: io.stdout
|
|
12855
|
-
})
|
|
12856
|
-
},
|
|
12857
|
-
getModelConfig: (intent)=>env_namespaceObject.globalModelConfigManager.getModelConfig(intent),
|
|
12858
|
-
verifyModel: core_.runConnectivityTest
|
|
12859
|
-
};
|
|
12860
|
-
}
|
|
12861
|
-
async function runModelVerifyCommand(args, deps, io) {
|
|
12862
|
-
try {
|
|
12863
|
-
if (args.includes('--help') || args.includes('-h')) {
|
|
12864
|
-
io.stdout(MODEL_COMMAND_USAGE);
|
|
12865
|
-
return 0;
|
|
12866
|
-
}
|
|
12867
|
-
assertNoModelVerifyOptions(args);
|
|
12868
|
-
io.stdout('Model verify started. This usually takes about 5 seconds.\n');
|
|
12869
|
-
deps.loadDotenv();
|
|
12870
|
-
io.stdout('');
|
|
12871
|
-
const defaultModelConfig = deps.getModelConfig('default');
|
|
12872
|
-
const planningModelConfig = deps.getModelConfig('planning');
|
|
12873
|
-
const insightModelConfig = deps.getModelConfig('insight');
|
|
12874
|
-
const curlCommands = buildModelVerifyCurlCommands([
|
|
12875
|
-
{
|
|
12876
|
-
intent: 'default',
|
|
12877
|
-
modelConfig: defaultModelConfig
|
|
12878
|
-
},
|
|
12879
|
-
{
|
|
12880
|
-
intent: 'planning',
|
|
12881
|
-
modelConfig: planningModelConfig
|
|
12882
|
-
},
|
|
12883
|
-
{
|
|
12884
|
-
intent: 'insight',
|
|
12885
|
-
modelConfig: insightModelConfig
|
|
12886
|
-
}
|
|
12887
|
-
]);
|
|
12888
|
-
const result = await deps.verifyModel({
|
|
12889
|
-
defaultModelConfig,
|
|
12890
|
-
planningModelConfig,
|
|
12891
|
-
insightModelConfig
|
|
12892
|
-
});
|
|
12893
|
-
if (result.passed) {
|
|
12894
|
-
io.stdout('✅ Model verify passed.');
|
|
12895
|
-
return 0;
|
|
12896
|
-
}
|
|
12897
|
-
io.stderr(formatModelVerifyFailureOutput(result.message, curlCommands));
|
|
12898
|
-
return 1;
|
|
12899
|
-
} catch (error) {
|
|
12900
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
12901
|
-
io.stderr([
|
|
12902
|
-
MODEL_VERIFY_SEPARATOR,
|
|
12903
|
-
'❌ Model verify failed with messages:',
|
|
12904
|
-
'',
|
|
12905
|
-
message,
|
|
12906
|
-
MODEL_VERIFY_SEPARATOR
|
|
12907
|
-
].join('\n'));
|
|
12908
|
-
return 1;
|
|
12909
|
-
}
|
|
12910
|
-
}
|
|
12911
|
-
async function runModelCommand(rawArgs, deps, io = {
|
|
12912
|
-
stdout: console.log,
|
|
12913
|
-
stderr: console.error
|
|
12914
|
-
}) {
|
|
12915
|
-
const [, action, ...restArgs] = rawArgs;
|
|
12916
|
-
const mergedDeps = {
|
|
12917
|
-
...getDefaultDeps(io),
|
|
12533
|
+
}),
|
|
12918
12534
|
...deps
|
|
12919
|
-
};
|
|
12920
|
-
if (!action || '--help' === action || '-h' === action) {
|
|
12921
|
-
io.stdout(MODEL_COMMAND_USAGE);
|
|
12922
|
-
return 0;
|
|
12923
|
-
}
|
|
12924
|
-
if ('verify' === action) return runModelVerifyCommand(restArgs, mergedDeps, io);
|
|
12925
|
-
if ('eval' === action) {
|
|
12926
|
-
io.stderr('midscene model eval is not implemented yet. It is reserved for future model evaluation suites.');
|
|
12927
|
-
return 1;
|
|
12928
|
-
}
|
|
12929
|
-
io.stderr(`Unknown midscene model command: ${action}\n\n${MODEL_COMMAND_USAGE}`);
|
|
12930
|
-
return 1;
|
|
12931
|
-
}
|
|
12535
|
+
}, io, 'midscene');
|
|
12932
12536
|
const test_runner_namespaceObject = require("@midscene/core/internal/test-runner");
|
|
12933
12537
|
const probeWorkflowFormat = (file)=>{
|
|
12934
12538
|
try {
|
|
@@ -13036,7 +12640,7 @@ Native cases/steps Test projects use the midscene-test command.`).wrap(yargs().t
|
|
|
13036
12640
|
] : [],
|
|
13037
12641
|
...config.files
|
|
13038
12642
|
]);
|
|
13039
|
-
loadDotenvConfig({
|
|
12643
|
+
(0, model_command_namespaceObject.loadDotenvConfig)({
|
|
13040
12644
|
dotenvDebug: config.dotenvDebug,
|
|
13041
12645
|
dotenvOverride: config.dotenvOverride,
|
|
13042
12646
|
log: console.log
|
|
@@ -13067,10 +12671,6 @@ Native cases/steps Test projects use the midscene-test command.`).wrap(yargs().t
|
|
|
13067
12671
|
"use strict";
|
|
13068
12672
|
module.exports = require("assert");
|
|
13069
12673
|
},
|
|
13070
|
-
crypto (module) {
|
|
13071
|
-
"use strict";
|
|
13072
|
-
module.exports = require("crypto");
|
|
13073
|
-
},
|
|
13074
12674
|
fs (module) {
|
|
13075
12675
|
"use strict";
|
|
13076
12676
|
module.exports = require("fs");
|
|
@@ -16384,10 +15984,6 @@ Native cases/steps Test projects use the midscene-test command.`).wrap(yargs().t
|
|
|
16384
15984
|
YError: e1
|
|
16385
15985
|
};
|
|
16386
15986
|
module.exports = ue;
|
|
16387
|
-
},
|
|
16388
|
-
"../../node_modules/.pnpm/dotenv@16.4.5/node_modules/dotenv/package.json" (module) {
|
|
16389
|
-
"use strict";
|
|
16390
|
-
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}}');
|
|
16391
15987
|
}
|
|
16392
15988
|
};
|
|
16393
15989
|
var __webpack_module_cache__ = {};
|