@midscene/shared 1.12.9-beta-20260917073745.0 → 1.12.9

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.
@@ -5,7 +5,7 @@ import { assert } from "../utils.mjs";
5
5
  import { maskConfig, parseJson } from "./helper.mjs";
6
6
  import { initDebugConfig } from "./init-debug.mjs";
7
7
  const MODEL_CONFIG_DOC_URL = 'https://midscenejs.com/model-common-config.html';
8
- const getCurrentVersion = ()=>"1.12.9-beta-20260917073745.0";
8
+ const getCurrentVersion = ()=>"1.12.9";
9
9
  const getInvalidModelFamilyMessage = (modelFamily)=>`Invalid MIDSCENE_MODEL_FAMILY value: ${modelFamily}. Current version v${getCurrentVersion()} accepts the following model families: ${MODEL_FAMILY_VALUES.join(', ')}. You can also visit ${MODEL_CONFIG_DOC_URL} for the latest configuration information.`;
10
10
  const KEYS_MAP = {
11
11
  insight: INSIGHT_MODEL_CONFIG_KEYS,
@@ -99,7 +99,13 @@ const parseOpenaiSdkConfig = ({ keys, provider, useLegacyLogic = false })=>{
99
99
  modelDescription,
100
100
  intent: '-',
101
101
  slot: '-',
102
- timeout: provider[keys.timeout] ? Number(provider[keys.timeout]) : void 0,
102
+ timeout: (()=>{
103
+ const value = provider[keys.timeout];
104
+ if (void 0 === value) return;
105
+ const timeout = Number(value);
106
+ if ('' === value.trim() || !Number.isFinite(timeout) || timeout < 0) throw new Error(`${keys.timeout} must be a finite number greater than or equal to 0, got ${JSON.stringify(value)}`);
107
+ return timeout;
108
+ })(),
103
109
  temperature,
104
110
  retryCount: (()=>{
105
111
  if (!provider[keys.retryCount]) return 1;
@@ -37,7 +37,7 @@ const external_utils_js_namespaceObject = require("../utils.js");
37
37
  const external_helper_js_namespaceObject = require("./helper.js");
38
38
  const external_init_debug_js_namespaceObject = require("./init-debug.js");
39
39
  const MODEL_CONFIG_DOC_URL = 'https://midscenejs.com/model-common-config.html';
40
- const getCurrentVersion = ()=>"1.12.9-beta-20260917073745.0";
40
+ const getCurrentVersion = ()=>"1.12.9";
41
41
  const getInvalidModelFamilyMessage = (modelFamily)=>`Invalid MIDSCENE_MODEL_FAMILY value: ${modelFamily}. Current version v${getCurrentVersion()} accepts the following model families: ${external_types_js_namespaceObject.MODEL_FAMILY_VALUES.join(', ')}. You can also visit ${MODEL_CONFIG_DOC_URL} for the latest configuration information.`;
42
42
  const KEYS_MAP = {
43
43
  insight: external_constants_js_namespaceObject.INSIGHT_MODEL_CONFIG_KEYS,
@@ -131,7 +131,13 @@ const parseOpenaiSdkConfig = ({ keys, provider, useLegacyLogic = false })=>{
131
131
  modelDescription,
132
132
  intent: '-',
133
133
  slot: '-',
134
- timeout: provider[keys.timeout] ? Number(provider[keys.timeout]) : void 0,
134
+ timeout: (()=>{
135
+ const value = provider[keys.timeout];
136
+ if (void 0 === value) return;
137
+ const timeout = Number(value);
138
+ if ('' === value.trim() || !Number.isFinite(timeout) || timeout < 0) throw new Error(`${keys.timeout} must be a finite number greater than or equal to 0, got ${JSON.stringify(value)}`);
139
+ return timeout;
140
+ })(),
135
141
  temperature,
136
142
  retryCount: (()=>{
137
143
  if (!provider[keys.retryCount]) return 1;
@@ -258,8 +258,11 @@ export interface IModelConfig {
258
258
  */
259
259
  extraBody?: Record<string, unknown>;
260
260
  /**
261
- * Timeout for API calls in milliseconds.
262
- * If not set, uses OpenAI SDK default (10 minutes).
261
+ * Midscene hard timeout per model request in milliseconds, including body reads.
262
+ * Must be finite and non-negative. Defaults to 180000 (180 seconds).
263
+ * Each retry gets a fresh timeout; retry delays are excluded.
264
+ * Set to 0 to disable only the Midscene hard timeout.
265
+ * SDK and network timeouts may still apply; callers can cancel via AbortSignal.
263
266
  */
264
267
  timeout?: number;
265
268
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/shared",
3
- "version": "1.12.9-beta-20260917073745.0",
3
+ "version": "1.12.9",
4
4
  "repository": "https://github.com/web-infra-dev/midscene",
5
5
  "homepage": "https://midscenejs.com/",
6
6
  "types": "./dist/types/index.d.ts",
@@ -252,9 +252,19 @@ export const parseOpenaiSdkConfig = ({
252
252
  modelDescription,
253
253
  intent: '-' as any,
254
254
  slot: '-' as any,
255
- timeout: provider[keys.timeout]
256
- ? Number(provider[keys.timeout])
257
- : undefined,
255
+ timeout: (() => {
256
+ const value = provider[keys.timeout];
257
+ if (value === undefined) {
258
+ return undefined;
259
+ }
260
+ const timeout = Number(value);
261
+ if (value.trim() === '' || !Number.isFinite(timeout) || timeout < 0) {
262
+ throw new Error(
263
+ `${keys.timeout} must be a finite number greater than or equal to 0, got ${JSON.stringify(value)}`,
264
+ );
265
+ }
266
+ return timeout;
267
+ })(),
258
268
  temperature,
259
269
  retryCount: (() => {
260
270
  if (!provider[keys.retryCount]) return 1;
package/src/env/types.ts CHANGED
@@ -501,8 +501,11 @@ export interface IModelConfig {
501
501
  */
502
502
  extraBody?: Record<string, unknown>;
503
503
  /**
504
- * Timeout for API calls in milliseconds.
505
- * If not set, uses OpenAI SDK default (10 minutes).
504
+ * Midscene hard timeout per model request in milliseconds, including body reads.
505
+ * Must be finite and non-negative. Defaults to 180000 (180 seconds).
506
+ * Each retry gets a fresh timeout; retry delays are excluded.
507
+ * Set to 0 to disable only the Midscene hard timeout.
508
+ * SDK and network timeouts may still apply; callers can cancel via AbortSignal.
506
509
  */
507
510
  timeout?: number;
508
511
  /**