@midscene/shared 0.28.8 → 0.28.9-beta-20250916162508.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.
@@ -81,6 +81,10 @@ class ModelConfigManager {
81
81
  registerGlobalConfigManager(globalConfigManager) {
82
82
  this.globalConfigManager = globalConfigManager;
83
83
  }
84
+ warnIfNonVLModel(intent = 'grounding') {
85
+ const modelConfig = this.getModelConfig(intent);
86
+ if (!modelConfig.vlMode) console.warn('No visual language model (VL model) detected for the current scenario. Element localization may be inaccurate. Please verify your model configuration. Learn more: https://midscenejs.com/choose-a-model');
87
+ }
84
88
  constructor(modelConfigFn){
85
89
  _define_property(this, "modelConfigMap", void 0);
86
90
  _define_property(this, "isolatedMode", false);
package/dist/es/utils.mjs CHANGED
@@ -1,10 +1,11 @@
1
1
  import { sha256 } from "js-sha256";
2
+ import { v4 } from "uuid";
2
3
  var _process_versions;
3
4
  const ifInBrowser = 'undefined' != typeof window;
4
5
  const ifInWorker = 'undefined' != typeof WorkerGlobalScope;
5
6
  const ifInNode = 'undefined' != typeof process && (null == (_process_versions = process.versions) ? void 0 : _process_versions.node);
6
7
  function uuid() {
7
- return Math.random().toString(36).substring(2, 15);
8
+ return v4();
8
9
  }
9
10
  const hashMap = {};
10
11
  function generateHashId(rect, content = '') {
@@ -109,6 +109,10 @@ class ModelConfigManager {
109
109
  registerGlobalConfigManager(globalConfigManager) {
110
110
  this.globalConfigManager = globalConfigManager;
111
111
  }
112
+ warnIfNonVLModel(intent = 'grounding') {
113
+ const modelConfig = this.getModelConfig(intent);
114
+ if (!modelConfig.vlMode) console.warn('No visual language model (VL model) detected for the current scenario. Element localization may be inaccurate. Please verify your model configuration. Learn more: https://midscenejs.com/choose-a-model');
115
+ }
112
116
  constructor(modelConfigFn){
113
117
  _define_property(this, "modelConfigMap", void 0);
114
118
  _define_property(this, "isolatedMode", false);
package/dist/lib/utils.js CHANGED
@@ -39,12 +39,13 @@ __webpack_require__.d(__webpack_exports__, {
39
39
  getGlobalScope: ()=>getGlobalScope
40
40
  });
41
41
  const external_js_sha256_namespaceObject = require("js-sha256");
42
+ const external_uuid_namespaceObject = require("uuid");
42
43
  var _process_versions;
43
44
  const ifInBrowser = 'undefined' != typeof window;
44
45
  const ifInWorker = 'undefined' != typeof WorkerGlobalScope;
45
46
  const ifInNode = 'undefined' != typeof process && (null == (_process_versions = process.versions) ? void 0 : _process_versions.node);
46
47
  function uuid() {
47
- return Math.random().toString(36).substring(2, 15);
48
+ return (0, external_uuid_namespaceObject.v4)();
48
49
  }
49
50
  const hashMap = {};
50
51
  function generateHashId(rect, content = '') {
@@ -20,4 +20,5 @@ export declare class ModelConfigManager {
20
20
  getModelConfig(intent: TIntent): IModelConfig;
21
21
  getUploadTestServerUrl(): string | undefined;
22
22
  registerGlobalConfigManager(globalConfigManager: GlobalConfigManager): void;
23
+ warnIfNonVLModel(intent?: TIntent): void;
23
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/shared",
3
- "version": "0.28.8",
3
+ "version": "0.28.9-beta-20250916162508.0",
4
4
  "repository": "https://github.com/web-infra-dev/midscene",
5
5
  "homepage": "https://midscenejs.com/",
6
6
  "types": "./dist/types/index.d.ts",
@@ -74,7 +74,8 @@
74
74
  "debug": "4.4.0",
75
75
  "jimp": "0.22.12",
76
76
  "js-sha256": "0.11.0",
77
- "sharp": "^0.34.3"
77
+ "sharp": "^0.34.3",
78
+ "uuid": "11.1.0"
78
79
  },
79
80
  "devDependencies": {
80
81
  "@rslib/core": "^0.11.2",
@@ -132,4 +132,14 @@ export class ModelConfigManager {
132
132
  registerGlobalConfigManager(globalConfigManager: GlobalConfigManager) {
133
133
  this.globalConfigManager = globalConfigManager;
134
134
  }
135
+
136
+ warnIfNonVLModel(intent: TIntent = 'grounding') {
137
+ const modelConfig = this.getModelConfig(intent);
138
+
139
+ if (!modelConfig.vlMode) {
140
+ console.warn(
141
+ 'No visual language model (VL model) detected for the current scenario. Element localization may be inaccurate. Please verify your model configuration. Learn more: https://midscenejs.com/choose-a-model',
142
+ );
143
+ }
144
+ }
135
145
  }
package/src/utils.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { sha256 } from 'js-sha256';
2
+ import { v4 as generateUUID } from 'uuid';
2
3
 
3
4
  declare const WorkerGlobalScope: any;
4
5
 
@@ -8,7 +9,7 @@ export const ifInNode =
8
9
  typeof process !== 'undefined' && process.versions?.node;
9
10
 
10
11
  export function uuid(): string {
11
- return Math.random().toString(36).substring(2, 15);
12
+ return generateUUID();
12
13
  }
13
14
 
14
15
  const hashMap: Record<string, string> = {}; // id - combined