@web-auto/webauto 0.1.17 → 0.1.18
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.
|
@@ -919,8 +919,8 @@ import path5 from "node:path";
|
|
|
919
919
|
import { promises as fs3 } from "node:fs";
|
|
920
920
|
var DEFAULT_HOST = "127.0.0.1";
|
|
921
921
|
var DEFAULT_PORT = 7716;
|
|
922
|
-
var DEFAULT_SNAPSHOT_TIMEOUT_MS =
|
|
923
|
-
var DEFAULT_ACTION_TIMEOUT_MS =
|
|
922
|
+
var DEFAULT_SNAPSHOT_TIMEOUT_MS = 35e3;
|
|
923
|
+
var DEFAULT_ACTION_TIMEOUT_MS = 3e4;
|
|
924
924
|
var DEFAULT_WAIT_PROBE_TIMEOUT_MS = 3e3;
|
|
925
925
|
function normalizePathForPlatform(raw, platform = process.platform) {
|
|
926
926
|
const input = String(raw || "").trim();
|
|
@@ -18,6 +18,8 @@ const readEnvPositiveInt = (name, fallback) => {
|
|
|
18
18
|
const DEFAULT_HTTP_TIMEOUT_MS = readEnvPositiveInt('WEBAUTO_UI_CLI_HTTP_TIMEOUT_MS', 25_000);
|
|
19
19
|
const DEFAULT_HTTP_RETRIES = readEnvPositiveInt('WEBAUTO_UI_CLI_HTTP_RETRIES', 1);
|
|
20
20
|
const DEFAULT_START_HEALTH_TIMEOUT_MS = readEnvPositiveInt('WEBAUTO_UI_CLI_START_HEALTH_TIMEOUT_MS', 8_000);
|
|
21
|
+
const DEFAULT_STATUS_TIMEOUT_MS = readEnvPositiveInt('WEBAUTO_UI_CLI_STATUS_TIMEOUT_MS', 45_000);
|
|
22
|
+
const DEFAULT_ACTION_HTTP_TIMEOUT_MS = readEnvPositiveInt('WEBAUTO_UI_CLI_ACTION_HTTP_TIMEOUT_MS', 40_000);
|
|
21
23
|
|
|
22
24
|
function normalizePathForPlatform(raw, platform = process.platform) {
|
|
23
25
|
const input = String(raw || '').trim();
|
|
@@ -221,10 +223,10 @@ function printOutput(payload) {
|
|
|
221
223
|
}
|
|
222
224
|
|
|
223
225
|
async function sendAction(endpoint, payload) {
|
|
224
|
-
const
|
|
226
|
+
const actionBudgetMs = payload?.action === 'wait'
|
|
225
227
|
? parseIntSafe(payload?.timeoutMs, 15_000) + 5_000
|
|
226
|
-
:
|
|
227
|
-
const timeoutMs = Math.max(DEFAULT_HTTP_TIMEOUT_MS,
|
|
228
|
+
: DEFAULT_ACTION_HTTP_TIMEOUT_MS;
|
|
229
|
+
const timeoutMs = Math.max(DEFAULT_HTTP_TIMEOUT_MS, actionBudgetMs);
|
|
228
230
|
const retries = payload?.action === 'wait' ? 0 : DEFAULT_HTTP_RETRIES;
|
|
229
231
|
return requestJson(endpoint, '/action', {
|
|
230
232
|
method: 'POST',
|
|
@@ -679,9 +681,10 @@ async function main() {
|
|
|
679
681
|
}
|
|
680
682
|
|
|
681
683
|
if (cmd === 'status' || cmd === 'snapshot') {
|
|
682
|
-
const pathName = cmd === 'snapshot' ? '/snapshot' : '/
|
|
684
|
+
const pathName = cmd === 'snapshot' ? '/snapshot' : '/health';
|
|
685
|
+
const statusTimeoutMs = parseIntSafe(args.timeout, DEFAULT_STATUS_TIMEOUT_MS);
|
|
683
686
|
const ret = await requestJson(endpoint, pathName, {
|
|
684
|
-
timeoutMs:
|
|
687
|
+
timeoutMs: statusTimeoutMs,
|
|
685
688
|
retries: DEFAULT_HTTP_RETRIES,
|
|
686
689
|
});
|
|
687
690
|
if (!ret.ok) throw new Error(ret.json?.error || `http_${ret.status}`);
|