@midscene/core 0.9.1 → 0.9.2-beta-20250114083542.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.
@@ -0,0 +1,36 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __publicField = (obj, key, value) => {
28
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
29
+ return value;
30
+ };
31
+
32
+
33
+
34
+
35
+
36
+ exports.__commonJS = __commonJS; exports.__toESM = __toESM; exports.__publicField = __publicField;
@@ -0,0 +1,115 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/env.ts
2
+ var MIDSCENE_OPENAI_INIT_CONFIG_JSON = "MIDSCENE_OPENAI_INIT_CONFIG_JSON";
3
+ var MIDSCENE_MODEL_NAME = "MIDSCENE_MODEL_NAME";
4
+ var MIDSCENE_LANGSMITH_DEBUG = "MIDSCENE_LANGSMITH_DEBUG";
5
+ var MIDSCENE_DEBUG_AI_PROFILE = "MIDSCENE_DEBUG_AI_PROFILE";
6
+ var MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG = "MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG";
7
+ var MIDSCENE_DEBUG_MODE = "MIDSCENE_DEBUG_MODE";
8
+ var MIDSCENE_OPENAI_SOCKS_PROXY = "MIDSCENE_OPENAI_SOCKS_PROXY";
9
+ var OPENAI_API_KEY = "OPENAI_API_KEY";
10
+ var OPENAI_BASE_URL = "OPENAI_BASE_URL";
11
+ var OPENAI_MAX_TOKENS = "OPENAI_MAX_TOKENS";
12
+ var MIDSCENE_MODEL_TEXT_ONLY = "MIDSCENE_MODEL_TEXT_ONLY";
13
+ var MIDSCENE_CACHE = "MIDSCENE_CACHE";
14
+ var MIDSCENE_USE_VLM_UI_TARS = "MIDSCENE_USE_VLM_UI_TARS";
15
+ var MATCH_BY_POSITION = "MATCH_BY_POSITION";
16
+ var MIDSCENE_API_TYPE = "MIDSCENE-API-TYPE";
17
+ var MIDSCENE_REPORT_TAG_NAME = "MIDSCENE_REPORT_TAG_NAME";
18
+ var MIDSCENE_USE_AZURE_OPENAI = "MIDSCENE_USE_AZURE_OPENAI";
19
+ var MIDSCENE_AZURE_OPENAI_SCOPE = "MIDSCENE_AZURE_OPENAI_SCOPE";
20
+ var MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON = "MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON";
21
+ var AZURE_OPENAI_ENDPOINT = "AZURE_OPENAI_ENDPOINT";
22
+ var AZURE_OPENAI_KEY = "AZURE_OPENAI_KEY";
23
+ var AZURE_OPENAI_API_VERSION = "AZURE_OPENAI_API_VERSION";
24
+ var AZURE_OPENAI_DEPLOYMENT = "AZURE_OPENAI_DEPLOYMENT";
25
+ var MIDSCENE_USE_ANTHROPIC_SDK = "MIDSCENE_USE_ANTHROPIC_SDK";
26
+ var ANTHROPIC_API_KEY = "ANTHROPIC_API_KEY";
27
+ var OPENAI_USE_AZURE = "OPENAI_USE_AZURE";
28
+ var allConfigFromEnv = () => {
29
+ return {
30
+ [MIDSCENE_OPENAI_INIT_CONFIG_JSON]: process.env[MIDSCENE_OPENAI_INIT_CONFIG_JSON] || void 0,
31
+ [MIDSCENE_MODEL_NAME]: process.env[MIDSCENE_MODEL_NAME] || void 0,
32
+ [MIDSCENE_DEBUG_MODE]: process.env[MIDSCENE_DEBUG_MODE] || void 0,
33
+ [MIDSCENE_LANGSMITH_DEBUG]: process.env[MIDSCENE_LANGSMITH_DEBUG] || void 0,
34
+ [MIDSCENE_DEBUG_AI_PROFILE]: process.env[MIDSCENE_DEBUG_AI_PROFILE] || void 0,
35
+ [MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG]: process.env[MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG] || void 0,
36
+ [OPENAI_API_KEY]: process.env[OPENAI_API_KEY] || void 0,
37
+ [OPENAI_BASE_URL]: process.env[OPENAI_BASE_URL] || void 0,
38
+ [MIDSCENE_MODEL_TEXT_ONLY]: process.env[MIDSCENE_MODEL_TEXT_ONLY] || void 0,
39
+ [OPENAI_MAX_TOKENS]: process.env[OPENAI_MAX_TOKENS] || void 0,
40
+ [OPENAI_USE_AZURE]: process.env[OPENAI_USE_AZURE] || void 0,
41
+ [MIDSCENE_CACHE]: process.env[MIDSCENE_CACHE] || void 0,
42
+ [MATCH_BY_POSITION]: process.env[MATCH_BY_POSITION] || void 0,
43
+ [MIDSCENE_REPORT_TAG_NAME]: process.env[MIDSCENE_REPORT_TAG_NAME] || void 0,
44
+ [MIDSCENE_OPENAI_SOCKS_PROXY]: process.env[MIDSCENE_OPENAI_SOCKS_PROXY] || void 0,
45
+ [MIDSCENE_USE_AZURE_OPENAI]: process.env[MIDSCENE_USE_AZURE_OPENAI] || void 0,
46
+ [MIDSCENE_AZURE_OPENAI_SCOPE]: process.env[MIDSCENE_AZURE_OPENAI_SCOPE] || void 0,
47
+ [MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON]: process.env[MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON] || void 0,
48
+ [MIDSCENE_USE_ANTHROPIC_SDK]: process.env[MIDSCENE_USE_ANTHROPIC_SDK] || void 0,
49
+ [MIDSCENE_USE_VLM_UI_TARS]: process.env[MIDSCENE_USE_VLM_UI_TARS] || void 0,
50
+ [ANTHROPIC_API_KEY]: process.env[ANTHROPIC_API_KEY] || void 0,
51
+ [AZURE_OPENAI_ENDPOINT]: process.env[AZURE_OPENAI_ENDPOINT] || void 0,
52
+ [AZURE_OPENAI_KEY]: process.env[AZURE_OPENAI_KEY] || void 0,
53
+ [AZURE_OPENAI_API_VERSION]: process.env[AZURE_OPENAI_API_VERSION] || void 0,
54
+ [AZURE_OPENAI_DEPLOYMENT]: process.env[AZURE_OPENAI_DEPLOYMENT] || void 0
55
+ };
56
+ };
57
+ var userConfig = {};
58
+ var getAIConfig = (configKey) => {
59
+ if (typeof userConfig[configKey] !== "undefined") {
60
+ return userConfig[configKey];
61
+ }
62
+ return allConfigFromEnv()[configKey];
63
+ };
64
+ var getAIConfigInJson = (configKey) => {
65
+ const config = getAIConfig(configKey);
66
+ try {
67
+ return config ? JSON.parse(config) : void 0;
68
+ } catch (error) {
69
+ throw new Error(
70
+ `Failed to parse json config: ${configKey}. ${error.message}`,
71
+ {
72
+ cause: error
73
+ }
74
+ );
75
+ }
76
+ };
77
+ var allAIConfig = () => {
78
+ return { ...allConfigFromEnv(), ...userConfig };
79
+ };
80
+ var overrideAIConfig = (newConfig, extendMode) => {
81
+ userConfig = extendMode ? { ...userConfig, ...newConfig } : { ...newConfig };
82
+ };
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+ exports.MIDSCENE_OPENAI_INIT_CONFIG_JSON = MIDSCENE_OPENAI_INIT_CONFIG_JSON; exports.MIDSCENE_MODEL_NAME = MIDSCENE_MODEL_NAME; exports.MIDSCENE_LANGSMITH_DEBUG = MIDSCENE_LANGSMITH_DEBUG; exports.MIDSCENE_DEBUG_AI_PROFILE = MIDSCENE_DEBUG_AI_PROFILE; exports.MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG = MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG; exports.MIDSCENE_DEBUG_MODE = MIDSCENE_DEBUG_MODE; exports.MIDSCENE_OPENAI_SOCKS_PROXY = MIDSCENE_OPENAI_SOCKS_PROXY; exports.OPENAI_API_KEY = OPENAI_API_KEY; exports.OPENAI_BASE_URL = OPENAI_BASE_URL; exports.OPENAI_MAX_TOKENS = OPENAI_MAX_TOKENS; exports.MIDSCENE_MODEL_TEXT_ONLY = MIDSCENE_MODEL_TEXT_ONLY; exports.MIDSCENE_CACHE = MIDSCENE_CACHE; exports.MIDSCENE_USE_VLM_UI_TARS = MIDSCENE_USE_VLM_UI_TARS; exports.MATCH_BY_POSITION = MATCH_BY_POSITION; exports.MIDSCENE_API_TYPE = MIDSCENE_API_TYPE; exports.MIDSCENE_REPORT_TAG_NAME = MIDSCENE_REPORT_TAG_NAME; exports.MIDSCENE_USE_AZURE_OPENAI = MIDSCENE_USE_AZURE_OPENAI; exports.MIDSCENE_AZURE_OPENAI_SCOPE = MIDSCENE_AZURE_OPENAI_SCOPE; exports.MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON = MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON; exports.AZURE_OPENAI_ENDPOINT = AZURE_OPENAI_ENDPOINT; exports.AZURE_OPENAI_KEY = AZURE_OPENAI_KEY; exports.AZURE_OPENAI_API_VERSION = AZURE_OPENAI_API_VERSION; exports.AZURE_OPENAI_DEPLOYMENT = AZURE_OPENAI_DEPLOYMENT; exports.MIDSCENE_USE_ANTHROPIC_SDK = MIDSCENE_USE_ANTHROPIC_SDK; exports.ANTHROPIC_API_KEY = ANTHROPIC_API_KEY; exports.OPENAI_USE_AZURE = OPENAI_USE_AZURE; exports.getAIConfig = getAIConfig; exports.getAIConfigInJson = getAIConfigInJson; exports.allAIConfig = allAIConfig; exports.overrideAIConfig = overrideAIConfig;