@godscene/shared 1.7.11
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/README.md +9 -0
- package/dist/es/baseDB.mjs +109 -0
- package/dist/es/cli/cli-args.mjs +95 -0
- package/dist/es/cli/cli-error.mjs +24 -0
- package/dist/es/cli/cli-runner.mjs +122 -0
- package/dist/es/cli/index.mjs +4 -0
- package/dist/es/common.mjs +37 -0
- package/dist/es/constants/example-code.mjs +227 -0
- package/dist/es/constants/index.mjs +124 -0
- package/dist/es/env/basic.mjs +6 -0
- package/dist/es/env/constants.mjs +110 -0
- package/dist/es/env/global-config-manager.mjs +94 -0
- package/dist/es/env/helper.mjs +43 -0
- package/dist/es/env/index.mjs +5 -0
- package/dist/es/env/init-debug.mjs +18 -0
- package/dist/es/env/model-config-manager.mjs +79 -0
- package/dist/es/env/parse-model-config.mjs +165 -0
- package/dist/es/env/types.mjs +232 -0
- package/dist/es/env/utils.mjs +18 -0
- package/dist/es/extractor/constants.mjs +2 -0
- package/dist/es/extractor/cs_postmessage.mjs +61 -0
- package/dist/es/extractor/customLocator.mjs +641 -0
- package/dist/es/extractor/debug.mjs +6 -0
- package/dist/es/extractor/dom-util.mjs +96 -0
- package/dist/es/extractor/index.mjs +5 -0
- package/dist/es/extractor/locator.mjs +250 -0
- package/dist/es/extractor/tree.mjs +78 -0
- package/dist/es/extractor/util.mjs +245 -0
- package/dist/es/extractor/web-extractor.mjs +393 -0
- package/dist/es/img/box-select.mjs +824 -0
- package/dist/es/img/canvas-fallback.mjs +238 -0
- package/dist/es/img/get-photon.mjs +45 -0
- package/dist/es/img/get-sharp.mjs +11 -0
- package/dist/es/img/index.mjs +4 -0
- package/dist/es/img/info.mjs +35 -0
- package/dist/es/img/transform.mjs +275 -0
- package/dist/es/index.mjs +2 -0
- package/dist/es/key-alias-utils.mjs +19 -0
- package/dist/es/logger.mjs +64 -0
- package/dist/es/mcp/base-server.mjs +282 -0
- package/dist/es/mcp/base-tools.mjs +159 -0
- package/dist/es/mcp/chrome-path.mjs +35 -0
- package/dist/es/mcp/cli-report-session.mjs +78 -0
- package/dist/es/mcp/error-formatter.mjs +19 -0
- package/dist/es/mcp/index.mjs +9 -0
- package/dist/es/mcp/init-arg-utils.mjs +38 -0
- package/dist/es/mcp/inject-report-html-plugin.mjs +53 -0
- package/dist/es/mcp/launcher-helper.mjs +52 -0
- package/dist/es/mcp/tool-generator.mjs +419 -0
- package/dist/es/mcp/types.mjs +3 -0
- package/dist/es/node/fs.mjs +44 -0
- package/dist/es/node/index.mjs +2 -0
- package/dist/es/node/port.mjs +24 -0
- package/dist/es/polyfills/async-hooks.mjs +2 -0
- package/dist/es/polyfills/index.mjs +1 -0
- package/dist/es/types/index.mjs +3 -0
- package/dist/es/us-keyboard-layout.mjs +1414 -0
- package/dist/es/us-keyboard-layout.mjs.LICENSE.txt +5 -0
- package/dist/es/utils.mjs +72 -0
- package/dist/es/zod-schema-utils.mjs +54 -0
- package/dist/lib/baseDB.js +149 -0
- package/dist/lib/cli/cli-args.js +138 -0
- package/dist/lib/cli/cli-error.js +61 -0
- package/dist/lib/cli/cli-runner.js +181 -0
- package/dist/lib/cli/index.js +53 -0
- package/dist/lib/common.js +93 -0
- package/dist/lib/constants/example-code.js +264 -0
- package/dist/lib/constants/index.js +221 -0
- package/dist/lib/env/basic.js +40 -0
- package/dist/lib/env/constants.js +153 -0
- package/dist/lib/env/global-config-manager.js +128 -0
- package/dist/lib/env/helper.js +80 -0
- package/dist/lib/env/index.js +90 -0
- package/dist/lib/env/init-debug.js +52 -0
- package/dist/lib/env/model-config-manager.js +113 -0
- package/dist/lib/env/parse-model-config.js +211 -0
- package/dist/lib/env/types.js +572 -0
- package/dist/lib/env/utils.js +61 -0
- package/dist/lib/extractor/constants.js +42 -0
- package/dist/lib/extractor/cs_postmessage.js +98 -0
- package/dist/lib/extractor/customLocator.js +693 -0
- package/dist/lib/extractor/debug.js +12 -0
- package/dist/lib/extractor/dom-util.js +157 -0
- package/dist/lib/extractor/index.js +87 -0
- package/dist/lib/extractor/locator.js +296 -0
- package/dist/lib/extractor/tree.js +124 -0
- package/dist/lib/extractor/util.js +336 -0
- package/dist/lib/extractor/web-extractor.js +442 -0
- package/dist/lib/img/box-select.js +875 -0
- package/dist/lib/img/canvas-fallback.js +305 -0
- package/dist/lib/img/get-photon.js +82 -0
- package/dist/lib/img/get-sharp.js +45 -0
- package/dist/lib/img/index.js +95 -0
- package/dist/lib/img/info.js +92 -0
- package/dist/lib/img/transform.js +364 -0
- package/dist/lib/index.js +36 -0
- package/dist/lib/key-alias-utils.js +62 -0
- package/dist/lib/logger.js +114 -0
- package/dist/lib/mcp/base-server.js +332 -0
- package/dist/lib/mcp/base-tools.js +193 -0
- package/dist/lib/mcp/chrome-path.js +72 -0
- package/dist/lib/mcp/cli-report-session.js +121 -0
- package/dist/lib/mcp/error-formatter.js +53 -0
- package/dist/lib/mcp/index.js +114 -0
- package/dist/lib/mcp/init-arg-utils.js +78 -0
- package/dist/lib/mcp/inject-report-html-plugin.js +98 -0
- package/dist/lib/mcp/launcher-helper.js +86 -0
- package/dist/lib/mcp/tool-generator.js +456 -0
- package/dist/lib/mcp/types.js +40 -0
- package/dist/lib/node/fs.js +97 -0
- package/dist/lib/node/index.js +65 -0
- package/dist/lib/node/port.js +61 -0
- package/dist/lib/polyfills/async-hooks.js +36 -0
- package/dist/lib/polyfills/index.js +58 -0
- package/dist/lib/types/index.js +37 -0
- package/dist/lib/us-keyboard-layout.js +1457 -0
- package/dist/lib/us-keyboard-layout.js.LICENSE.txt +5 -0
- package/dist/lib/utils.js +148 -0
- package/dist/lib/zod-schema-utils.js +97 -0
- package/dist/types/baseDB.d.ts +25 -0
- package/dist/types/cli/cli-args.d.ts +8 -0
- package/dist/types/cli/cli-error.d.ts +5 -0
- package/dist/types/cli/cli-runner.d.ts +19 -0
- package/dist/types/cli/index.d.ts +4 -0
- package/dist/types/common.d.ts +12 -0
- package/dist/types/constants/example-code.d.ts +2 -0
- package/dist/types/constants/index.d.ts +61 -0
- package/dist/types/env/basic.d.ts +6 -0
- package/dist/types/env/constants.d.ts +50 -0
- package/dist/types/env/global-config-manager.d.ts +32 -0
- package/dist/types/env/helper.d.ts +4 -0
- package/dist/types/env/index.d.ts +4 -0
- package/dist/types/env/init-debug.d.ts +1 -0
- package/dist/types/env/model-config-manager.d.ts +25 -0
- package/dist/types/env/parse-model-config.d.ts +31 -0
- package/dist/types/env/types.d.ts +339 -0
- package/dist/types/env/utils.d.ts +7 -0
- package/dist/types/extractor/constants.d.ts +1 -0
- package/dist/types/extractor/cs_postmessage.d.ts +2 -0
- package/dist/types/extractor/customLocator.d.ts +69 -0
- package/dist/types/extractor/debug.d.ts +1 -0
- package/dist/types/extractor/dom-util.d.ts +57 -0
- package/dist/types/extractor/index.d.ts +33 -0
- package/dist/types/extractor/locator.d.ts +9 -0
- package/dist/types/extractor/tree.d.ts +6 -0
- package/dist/types/extractor/util.d.ts +47 -0
- package/dist/types/extractor/web-extractor.d.ts +24 -0
- package/dist/types/img/box-select.d.ts +26 -0
- package/dist/types/img/canvas-fallback.d.ts +105 -0
- package/dist/types/img/get-photon.d.ts +19 -0
- package/dist/types/img/get-sharp.d.ts +3 -0
- package/dist/types/img/index.d.ts +3 -0
- package/dist/types/img/info.d.ts +34 -0
- package/dist/types/img/transform.d.ts +98 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/key-alias-utils.d.ts +9 -0
- package/dist/types/logger.d.ts +5 -0
- package/dist/types/mcp/base-server.d.ts +93 -0
- package/dist/types/mcp/base-tools.d.ts +148 -0
- package/dist/types/mcp/chrome-path.d.ts +2 -0
- package/dist/types/mcp/cli-report-session.d.ts +12 -0
- package/dist/types/mcp/error-formatter.d.ts +12 -0
- package/dist/types/mcp/index.d.ts +9 -0
- package/dist/types/mcp/init-arg-utils.d.ts +13 -0
- package/dist/types/mcp/inject-report-html-plugin.d.ts +18 -0
- package/dist/types/mcp/launcher-helper.d.ts +94 -0
- package/dist/types/mcp/tool-generator.d.ts +10 -0
- package/dist/types/mcp/types.d.ts +113 -0
- package/dist/types/node/fs.d.ts +15 -0
- package/dist/types/node/index.d.ts +2 -0
- package/dist/types/node/port.d.ts +8 -0
- package/dist/types/polyfills/async-hooks.d.ts +6 -0
- package/dist/types/polyfills/index.d.ts +4 -0
- package/dist/types/types/index.d.ts +36 -0
- package/dist/types/us-keyboard-layout.d.ts +32 -0
- package/dist/types/utils.d.ts +34 -0
- package/dist/types/zod-schema-utils.d.ts +23 -0
- package/package.json +125 -0
- package/src/baseDB.ts +158 -0
- package/src/cli/cli-args.ts +173 -0
- package/src/cli/cli-error.ts +24 -0
- package/src/cli/cli-runner.ts +230 -0
- package/src/cli/index.ts +4 -0
- package/src/common.ts +67 -0
- package/src/constants/example-code.ts +227 -0
- package/src/constants/index.ts +139 -0
- package/src/env/basic.ts +12 -0
- package/src/env/constants.ts +303 -0
- package/src/env/global-config-manager.ts +191 -0
- package/src/env/helper.ts +58 -0
- package/src/env/index.ts +4 -0
- package/src/env/init-debug.ts +34 -0
- package/src/env/model-config-manager.ts +149 -0
- package/src/env/parse-model-config.ts +357 -0
- package/src/env/types.ts +583 -0
- package/src/env/utils.ts +39 -0
- package/src/extractor/constants.ts +5 -0
- package/src/extractor/cs_postmessage.ts +136 -0
- package/src/extractor/customLocator.ts +1245 -0
- package/src/extractor/debug.ts +10 -0
- package/src/extractor/dom-util.ts +231 -0
- package/src/extractor/index.ts +50 -0
- package/src/extractor/locator.ts +469 -0
- package/src/extractor/tree.ts +179 -0
- package/src/extractor/util.ts +482 -0
- package/src/extractor/web-extractor.ts +617 -0
- package/src/img/box-select.ts +588 -0
- package/src/img/canvas-fallback.ts +393 -0
- package/src/img/get-photon.ts +108 -0
- package/src/img/get-sharp.ts +18 -0
- package/src/img/index.ts +27 -0
- package/src/img/info.ts +102 -0
- package/src/img/transform.ts +553 -0
- package/src/index.ts +1 -0
- package/src/key-alias-utils.ts +23 -0
- package/src/logger.ts +96 -0
- package/src/mcp/base-server.ts +500 -0
- package/src/mcp/base-tools.ts +391 -0
- package/src/mcp/chrome-path.ts +48 -0
- package/src/mcp/cli-report-session.ts +130 -0
- package/src/mcp/error-formatter.ts +52 -0
- package/src/mcp/index.ts +9 -0
- package/src/mcp/init-arg-utils.ts +105 -0
- package/src/mcp/inject-report-html-plugin.ts +119 -0
- package/src/mcp/launcher-helper.ts +200 -0
- package/src/mcp/tool-generator.ts +658 -0
- package/src/mcp/types.ts +131 -0
- package/src/node/fs.ts +84 -0
- package/src/node/index.ts +2 -0
- package/src/node/port.ts +37 -0
- package/src/polyfills/async-hooks.ts +6 -0
- package/src/polyfills/index.ts +4 -0
- package/src/types/index.ts +54 -0
- package/src/us-keyboard-layout.ts +723 -0
- package/src/utils.ts +149 -0
- package/src/zod-schema-utils.ts +133 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
INSIGHT_MODEL_CONFIG_KEYS: ()=>INSIGHT_MODEL_CONFIG_KEYS,
|
|
28
|
+
DEFAULT_MODEL_CONFIG_KEYS_LEGACY: ()=>DEFAULT_MODEL_CONFIG_KEYS_LEGACY,
|
|
29
|
+
DEFAULT_MODEL_CONFIG_KEYS: ()=>DEFAULT_MODEL_CONFIG_KEYS,
|
|
30
|
+
PLANNING_MODEL_CONFIG_KEYS: ()=>PLANNING_MODEL_CONFIG_KEYS
|
|
31
|
+
});
|
|
32
|
+
const external_types_js_namespaceObject = require("./types.js");
|
|
33
|
+
const INSIGHT_MODEL_CONFIG_KEYS = {
|
|
34
|
+
modelName: external_types_js_namespaceObject.MIDSCENE_INSIGHT_MODEL_NAME,
|
|
35
|
+
socksProxy: external_types_js_namespaceObject.MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY,
|
|
36
|
+
httpProxy: external_types_js_namespaceObject.MIDSCENE_INSIGHT_MODEL_HTTP_PROXY,
|
|
37
|
+
openaiBaseURL: external_types_js_namespaceObject.MIDSCENE_INSIGHT_MODEL_BASE_URL,
|
|
38
|
+
openaiApiKey: external_types_js_namespaceObject.MIDSCENE_INSIGHT_MODEL_API_KEY,
|
|
39
|
+
openaiExtraConfig: external_types_js_namespaceObject.MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON,
|
|
40
|
+
extraBody: external_types_js_namespaceObject.MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON,
|
|
41
|
+
modelFamily: external_types_js_namespaceObject.MIDSCENE_INSIGHT_MODEL_FAMILY,
|
|
42
|
+
timeout: external_types_js_namespaceObject.MIDSCENE_INSIGHT_MODEL_TIMEOUT,
|
|
43
|
+
temperature: external_types_js_namespaceObject.MIDSCENE_INSIGHT_MODEL_TEMPERATURE,
|
|
44
|
+
retryCount: external_types_js_namespaceObject.MIDSCENE_INSIGHT_MODEL_RETRY_COUNT,
|
|
45
|
+
retryInterval: external_types_js_namespaceObject.MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL,
|
|
46
|
+
reasoningEffort: external_types_js_namespaceObject.MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT,
|
|
47
|
+
reasoningEnabled: external_types_js_namespaceObject.MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED,
|
|
48
|
+
reasoningBudget: external_types_js_namespaceObject.MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET,
|
|
49
|
+
yht_domain: external_types_js_namespaceObject.YHT_DOMAIN,
|
|
50
|
+
yht_access_token: external_types_js_namespaceObject.YHT_ACCESS_TOKEN,
|
|
51
|
+
yht_model: external_types_js_namespaceObject.YHT_MODEL,
|
|
52
|
+
yht_base_url: external_types_js_namespaceObject.YHT_BASE_URL,
|
|
53
|
+
yht_chat_type: external_types_js_namespaceObject.YHT_CHAT_TYPE,
|
|
54
|
+
yht_model_category: external_types_js_namespaceObject.YHT_MODEL_CATEGORY,
|
|
55
|
+
yht_stream: external_types_js_namespaceObject.YHT_STREAM,
|
|
56
|
+
yht_temperature: external_types_js_namespaceObject.YHT_TEMPERATURE,
|
|
57
|
+
yht_top_p: external_types_js_namespaceObject.YHT_TOP_P,
|
|
58
|
+
yht_trace_id: external_types_js_namespaceObject.YHT_TRACE_ID
|
|
59
|
+
};
|
|
60
|
+
const PLANNING_MODEL_CONFIG_KEYS = {
|
|
61
|
+
modelName: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_NAME,
|
|
62
|
+
socksProxy: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_SOCKS_PROXY,
|
|
63
|
+
httpProxy: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_HTTP_PROXY,
|
|
64
|
+
openaiBaseURL: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_BASE_URL,
|
|
65
|
+
openaiApiKey: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_API_KEY,
|
|
66
|
+
openaiExtraConfig: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON,
|
|
67
|
+
extraBody: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON,
|
|
68
|
+
modelFamily: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_FAMILY,
|
|
69
|
+
timeout: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_TIMEOUT,
|
|
70
|
+
temperature: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_TEMPERATURE,
|
|
71
|
+
retryCount: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_RETRY_COUNT,
|
|
72
|
+
retryInterval: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL,
|
|
73
|
+
reasoningEffort: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_REASONING_EFFORT,
|
|
74
|
+
reasoningEnabled: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_REASONING_ENABLED,
|
|
75
|
+
reasoningBudget: external_types_js_namespaceObject.MIDSCENE_PLANNING_MODEL_REASONING_BUDGET,
|
|
76
|
+
yht_domain: external_types_js_namespaceObject.YHT_DOMAIN,
|
|
77
|
+
yht_access_token: external_types_js_namespaceObject.YHT_ACCESS_TOKEN,
|
|
78
|
+
yht_model: external_types_js_namespaceObject.YHT_MODEL,
|
|
79
|
+
yht_base_url: external_types_js_namespaceObject.YHT_BASE_URL,
|
|
80
|
+
yht_chat_type: external_types_js_namespaceObject.YHT_CHAT_TYPE,
|
|
81
|
+
yht_model_category: external_types_js_namespaceObject.YHT_MODEL_CATEGORY,
|
|
82
|
+
yht_stream: external_types_js_namespaceObject.YHT_STREAM,
|
|
83
|
+
yht_temperature: external_types_js_namespaceObject.YHT_TEMPERATURE,
|
|
84
|
+
yht_top_p: external_types_js_namespaceObject.YHT_TOP_P,
|
|
85
|
+
yht_trace_id: external_types_js_namespaceObject.YHT_TRACE_ID
|
|
86
|
+
};
|
|
87
|
+
const DEFAULT_MODEL_CONFIG_KEYS = {
|
|
88
|
+
modelName: external_types_js_namespaceObject.MIDSCENE_MODEL_NAME,
|
|
89
|
+
socksProxy: external_types_js_namespaceObject.MIDSCENE_MODEL_SOCKS_PROXY,
|
|
90
|
+
httpProxy: external_types_js_namespaceObject.MIDSCENE_MODEL_HTTP_PROXY,
|
|
91
|
+
openaiBaseURL: external_types_js_namespaceObject.MIDSCENE_MODEL_BASE_URL,
|
|
92
|
+
openaiApiKey: external_types_js_namespaceObject.MIDSCENE_MODEL_API_KEY,
|
|
93
|
+
openaiExtraConfig: external_types_js_namespaceObject.MIDSCENE_MODEL_INIT_CONFIG_JSON,
|
|
94
|
+
extraBody: external_types_js_namespaceObject.MIDSCENE_MODEL_EXTRA_BODY_JSON,
|
|
95
|
+
modelFamily: external_types_js_namespaceObject.MIDSCENE_MODEL_FAMILY,
|
|
96
|
+
timeout: external_types_js_namespaceObject.MIDSCENE_MODEL_TIMEOUT,
|
|
97
|
+
temperature: external_types_js_namespaceObject.MIDSCENE_MODEL_TEMPERATURE,
|
|
98
|
+
retryCount: external_types_js_namespaceObject.MIDSCENE_MODEL_RETRY_COUNT,
|
|
99
|
+
retryInterval: external_types_js_namespaceObject.MIDSCENE_MODEL_RETRY_INTERVAL,
|
|
100
|
+
reasoningEffort: external_types_js_namespaceObject.MIDSCENE_MODEL_REASONING_EFFORT,
|
|
101
|
+
reasoningEnabled: external_types_js_namespaceObject.MIDSCENE_MODEL_REASONING_ENABLED,
|
|
102
|
+
reasoningBudget: external_types_js_namespaceObject.MIDSCENE_MODEL_REASONING_BUDGET,
|
|
103
|
+
yht_domain: external_types_js_namespaceObject.YHT_DOMAIN,
|
|
104
|
+
yht_access_token: external_types_js_namespaceObject.YHT_ACCESS_TOKEN,
|
|
105
|
+
yht_model: external_types_js_namespaceObject.YHT_MODEL,
|
|
106
|
+
yht_base_url: external_types_js_namespaceObject.YHT_BASE_URL,
|
|
107
|
+
yht_chat_type: external_types_js_namespaceObject.YHT_CHAT_TYPE,
|
|
108
|
+
yht_model_category: external_types_js_namespaceObject.YHT_MODEL_CATEGORY,
|
|
109
|
+
yht_stream: external_types_js_namespaceObject.YHT_STREAM,
|
|
110
|
+
yht_temperature: external_types_js_namespaceObject.YHT_TEMPERATURE,
|
|
111
|
+
yht_top_p: external_types_js_namespaceObject.YHT_TOP_P,
|
|
112
|
+
yht_trace_id: external_types_js_namespaceObject.YHT_TRACE_ID
|
|
113
|
+
};
|
|
114
|
+
const DEFAULT_MODEL_CONFIG_KEYS_LEGACY = {
|
|
115
|
+
modelName: external_types_js_namespaceObject.MIDSCENE_MODEL_NAME,
|
|
116
|
+
socksProxy: external_types_js_namespaceObject.MIDSCENE_OPENAI_SOCKS_PROXY,
|
|
117
|
+
httpProxy: external_types_js_namespaceObject.MIDSCENE_OPENAI_HTTP_PROXY,
|
|
118
|
+
openaiBaseURL: external_types_js_namespaceObject.OPENAI_BASE_URL,
|
|
119
|
+
openaiApiKey: external_types_js_namespaceObject.OPENAI_API_KEY,
|
|
120
|
+
openaiExtraConfig: external_types_js_namespaceObject.MIDSCENE_OPENAI_INIT_CONFIG_JSON,
|
|
121
|
+
extraBody: external_types_js_namespaceObject.MIDSCENE_MODEL_EXTRA_BODY_JSON,
|
|
122
|
+
modelFamily: 'DEFAULT_MODEL_CONFIG_KEYS has no modelFamily key',
|
|
123
|
+
timeout: external_types_js_namespaceObject.MIDSCENE_MODEL_TIMEOUT,
|
|
124
|
+
temperature: external_types_js_namespaceObject.MIDSCENE_MODEL_TEMPERATURE,
|
|
125
|
+
retryCount: external_types_js_namespaceObject.MIDSCENE_MODEL_RETRY_COUNT,
|
|
126
|
+
retryInterval: external_types_js_namespaceObject.MIDSCENE_MODEL_RETRY_INTERVAL,
|
|
127
|
+
reasoningEffort: external_types_js_namespaceObject.MIDSCENE_MODEL_REASONING_EFFORT,
|
|
128
|
+
reasoningEnabled: external_types_js_namespaceObject.MIDSCENE_MODEL_REASONING_ENABLED,
|
|
129
|
+
reasoningBudget: external_types_js_namespaceObject.MIDSCENE_MODEL_REASONING_BUDGET,
|
|
130
|
+
yht_domain: external_types_js_namespaceObject.YHT_DOMAIN,
|
|
131
|
+
yht_access_token: external_types_js_namespaceObject.YHT_ACCESS_TOKEN,
|
|
132
|
+
yht_model: external_types_js_namespaceObject.YHT_MODEL,
|
|
133
|
+
yht_base_url: external_types_js_namespaceObject.YHT_BASE_URL,
|
|
134
|
+
yht_chat_type: external_types_js_namespaceObject.YHT_CHAT_TYPE,
|
|
135
|
+
yht_model_category: external_types_js_namespaceObject.YHT_MODEL_CATEGORY,
|
|
136
|
+
yht_stream: external_types_js_namespaceObject.YHT_STREAM,
|
|
137
|
+
yht_temperature: external_types_js_namespaceObject.YHT_TEMPERATURE,
|
|
138
|
+
yht_top_p: external_types_js_namespaceObject.YHT_TOP_P,
|
|
139
|
+
yht_trace_id: external_types_js_namespaceObject.YHT_TRACE_ID
|
|
140
|
+
};
|
|
141
|
+
exports.DEFAULT_MODEL_CONFIG_KEYS = __webpack_exports__.DEFAULT_MODEL_CONFIG_KEYS;
|
|
142
|
+
exports.DEFAULT_MODEL_CONFIG_KEYS_LEGACY = __webpack_exports__.DEFAULT_MODEL_CONFIG_KEYS_LEGACY;
|
|
143
|
+
exports.INSIGHT_MODEL_CONFIG_KEYS = __webpack_exports__.INSIGHT_MODEL_CONFIG_KEYS;
|
|
144
|
+
exports.PLANNING_MODEL_CONFIG_KEYS = __webpack_exports__.PLANNING_MODEL_CONFIG_KEYS;
|
|
145
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
146
|
+
"DEFAULT_MODEL_CONFIG_KEYS",
|
|
147
|
+
"DEFAULT_MODEL_CONFIG_KEYS_LEGACY",
|
|
148
|
+
"INSIGHT_MODEL_CONFIG_KEYS",
|
|
149
|
+
"PLANNING_MODEL_CONFIG_KEYS"
|
|
150
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
151
|
+
Object.defineProperty(exports, '__esModule', {
|
|
152
|
+
value: true
|
|
153
|
+
});
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
GlobalConfigManager: ()=>GlobalConfigManager
|
|
28
|
+
});
|
|
29
|
+
const external_init_debug_js_namespaceObject = require("./init-debug.js");
|
|
30
|
+
const external_types_js_namespaceObject = require("./types.js");
|
|
31
|
+
function _define_property(obj, key, value) {
|
|
32
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
33
|
+
value: value,
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true,
|
|
36
|
+
writable: true
|
|
37
|
+
});
|
|
38
|
+
else obj[key] = value;
|
|
39
|
+
return obj;
|
|
40
|
+
}
|
|
41
|
+
class GlobalConfigManager {
|
|
42
|
+
getAllEnvConfig() {
|
|
43
|
+
const envConfig = external_types_js_namespaceObject.ALL_ENV_KEYS.reduce((p, name)=>{
|
|
44
|
+
p[name] = process.env[name];
|
|
45
|
+
return p;
|
|
46
|
+
}, Object.create(null));
|
|
47
|
+
if (!this.override) return envConfig;
|
|
48
|
+
{
|
|
49
|
+
const { newConfig, extendMode } = this.override;
|
|
50
|
+
if (extendMode) return {
|
|
51
|
+
...envConfig,
|
|
52
|
+
...newConfig
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
...newConfig
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
getEnvConfigValue(key) {
|
|
60
|
+
const allConfig = this.getAllEnvConfig();
|
|
61
|
+
if (key === external_types_js_namespaceObject.MATCH_BY_POSITION) throw new Error('MATCH_BY_POSITION is discarded, use MIDSCENE_MODEL_FAMILY instead');
|
|
62
|
+
if (!external_types_js_namespaceObject.STRING_ENV_KEYS.includes(key)) throw new Error(`getEnvConfigValue with key ${key} is not supported.`);
|
|
63
|
+
const value = allConfig[key];
|
|
64
|
+
this.keysHaveBeenRead[key] = true;
|
|
65
|
+
if ('string' == typeof value) return value.trim();
|
|
66
|
+
return value;
|
|
67
|
+
}
|
|
68
|
+
getEnvConfigInBoolean(key) {
|
|
69
|
+
const allConfig = this.getAllEnvConfig();
|
|
70
|
+
if (!external_types_js_namespaceObject.BOOLEAN_ENV_KEYS.includes(key)) throw new Error(`getEnvConfigInBoolean with key ${key} is not supported`);
|
|
71
|
+
const value = allConfig[key];
|
|
72
|
+
this.keysHaveBeenRead[key] = true;
|
|
73
|
+
if (!value) return false;
|
|
74
|
+
if (/^(true|1)$/i.test(value)) return true;
|
|
75
|
+
if (/^(false|0)$/i.test(value)) return false;
|
|
76
|
+
return !!value.trim();
|
|
77
|
+
}
|
|
78
|
+
getEnvConfigValueAsNumber(key) {
|
|
79
|
+
if (!external_types_js_namespaceObject.STRING_ENV_KEYS.includes(key) && !external_types_js_namespaceObject.NUMBER_ENV_KEYS.includes(key)) throw new Error(`getEnvConfigValueAsNumber with key ${key} is not supported.`);
|
|
80
|
+
const allConfig = this.getAllEnvConfig();
|
|
81
|
+
const value = allConfig[key];
|
|
82
|
+
this.keysHaveBeenRead[key] = true;
|
|
83
|
+
if ('string' != typeof value) return;
|
|
84
|
+
const trimmed = value.trim();
|
|
85
|
+
if (!trimmed) return;
|
|
86
|
+
const numValue = Number(trimmed);
|
|
87
|
+
return Number.isNaN(numValue) ? void 0 : numValue;
|
|
88
|
+
}
|
|
89
|
+
registerModelConfigManager(globalModelConfigManager) {
|
|
90
|
+
this.globalModelConfigManager = globalModelConfigManager;
|
|
91
|
+
}
|
|
92
|
+
overrideAIConfig(newConfig, extendMode = false) {
|
|
93
|
+
for(const key in newConfig){
|
|
94
|
+
if (![
|
|
95
|
+
...external_types_js_namespaceObject.GLOBAL_ENV_KEYS,
|
|
96
|
+
...external_types_js_namespaceObject.MODEL_ENV_KEYS
|
|
97
|
+
].includes(key)) throw new Error(`Failed to override AI config, invalid key: ${key}`);
|
|
98
|
+
const value = newConfig[key];
|
|
99
|
+
if ('string' != typeof value) throw new Error(`Failed to override AI config, value for key ${key} must be a string, but got with type ${typeof value}`);
|
|
100
|
+
if (this.keysHaveBeenRead[key]) console.warn(`Warning: try to override AI config with key ${key} ,but it has been read.`);
|
|
101
|
+
}
|
|
102
|
+
const savedNewConfig = extendMode ? {
|
|
103
|
+
...this.override?.newConfig,
|
|
104
|
+
...newConfig
|
|
105
|
+
} : newConfig;
|
|
106
|
+
this.override = {
|
|
107
|
+
newConfig: {
|
|
108
|
+
...savedNewConfig
|
|
109
|
+
},
|
|
110
|
+
extendMode
|
|
111
|
+
};
|
|
112
|
+
if (!this.globalModelConfigManager) throw new Error('globalModelConfigManager is not registered, which should not happen');
|
|
113
|
+
this.globalModelConfigManager.clearModelConfigMap();
|
|
114
|
+
}
|
|
115
|
+
constructor(){
|
|
116
|
+
_define_property(this, "override", void 0);
|
|
117
|
+
_define_property(this, "keysHaveBeenRead", {});
|
|
118
|
+
_define_property(this, "globalModelConfigManager", void 0);
|
|
119
|
+
(0, external_init_debug_js_namespaceObject.initDebugConfig)();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.GlobalConfigManager = __webpack_exports__.GlobalConfigManager;
|
|
123
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
124
|
+
"GlobalConfigManager"
|
|
125
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
126
|
+
Object.defineProperty(exports, '__esModule', {
|
|
127
|
+
value: true
|
|
128
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
maskConfig: ()=>maskConfig,
|
|
28
|
+
parseJson: ()=>parseJson
|
|
29
|
+
});
|
|
30
|
+
const maskKey = (key, maskChar = '*')=>{
|
|
31
|
+
if ('string' != typeof key || 0 === key.length) return key;
|
|
32
|
+
const prefixLen = 3;
|
|
33
|
+
const suffixLen = 3;
|
|
34
|
+
const keepLength = prefixLen + suffixLen;
|
|
35
|
+
if (key.length <= keepLength) return key;
|
|
36
|
+
const prefix = key.substring(0, prefixLen);
|
|
37
|
+
const suffix = key.substring(key.length - suffixLen);
|
|
38
|
+
const maskLength = key.length - keepLength;
|
|
39
|
+
const mask = maskChar.repeat(maskLength);
|
|
40
|
+
return `${prefix}${mask}${suffix}`;
|
|
41
|
+
};
|
|
42
|
+
const maskConfig = (config)=>Object.fromEntries(Object.entries(config).map(([key, value])=>{
|
|
43
|
+
if (!value) return [
|
|
44
|
+
key,
|
|
45
|
+
value
|
|
46
|
+
];
|
|
47
|
+
if ('string' == typeof value && /key/i.test(key)) return [
|
|
48
|
+
key,
|
|
49
|
+
maskKey(value)
|
|
50
|
+
];
|
|
51
|
+
if ('object' == typeof value) {
|
|
52
|
+
const valueStr = JSON.stringify(value);
|
|
53
|
+
if (/key/i.test(valueStr)) return [
|
|
54
|
+
key,
|
|
55
|
+
maskKey(valueStr)
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
return [
|
|
59
|
+
key,
|
|
60
|
+
value
|
|
61
|
+
];
|
|
62
|
+
}));
|
|
63
|
+
const parseJson = (key, value)=>{
|
|
64
|
+
if (value) try {
|
|
65
|
+
return JSON.parse(value);
|
|
66
|
+
} catch (e) {
|
|
67
|
+
throw new Error(`Failed to parse ${key} as a JSON. ${e.message}`, {
|
|
68
|
+
cause: e
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
exports.maskConfig = __webpack_exports__.maskConfig;
|
|
73
|
+
exports.parseJson = __webpack_exports__.parseJson;
|
|
74
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
75
|
+
"maskConfig",
|
|
76
|
+
"parseJson"
|
|
77
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
78
|
+
Object.defineProperty(exports, '__esModule', {
|
|
79
|
+
value: true
|
|
80
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"./global-config-manager" (module) {
|
|
4
|
+
module.exports = require("./global-config-manager.js");
|
|
5
|
+
},
|
|
6
|
+
"./model-config-manager" (module) {
|
|
7
|
+
module.exports = require("./model-config-manager.js");
|
|
8
|
+
},
|
|
9
|
+
"./types" (module) {
|
|
10
|
+
module.exports = require("./types.js");
|
|
11
|
+
},
|
|
12
|
+
"./utils" (module) {
|
|
13
|
+
module.exports = require("./utils.js");
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var __webpack_module_cache__ = {};
|
|
17
|
+
function __webpack_require__(moduleId) {
|
|
18
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
19
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
20
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
21
|
+
exports: {}
|
|
22
|
+
};
|
|
23
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
24
|
+
return module.exports;
|
|
25
|
+
}
|
|
26
|
+
(()=>{
|
|
27
|
+
__webpack_require__.n = (module)=>{
|
|
28
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
29
|
+
__webpack_require__.d(getter, {
|
|
30
|
+
a: getter
|
|
31
|
+
});
|
|
32
|
+
return getter;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
(()=>{
|
|
36
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
37
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: definition[key]
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
})();
|
|
43
|
+
(()=>{
|
|
44
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
45
|
+
})();
|
|
46
|
+
(()=>{
|
|
47
|
+
__webpack_require__.r = (exports1)=>{
|
|
48
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
49
|
+
value: 'Module'
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
52
|
+
value: true
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
})();
|
|
56
|
+
var __webpack_exports__ = {};
|
|
57
|
+
(()=>{
|
|
58
|
+
__webpack_require__.r(__webpack_exports__);
|
|
59
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
60
|
+
GlobalConfigManager: ()=>_global_config_manager__rspack_import_3.GlobalConfigManager,
|
|
61
|
+
ModelConfigManager: ()=>_model_config_manager__rspack_import_2.ModelConfigManager
|
|
62
|
+
});
|
|
63
|
+
var _utils__rspack_import_0 = __webpack_require__("./utils");
|
|
64
|
+
var __rspack_reexport = {};
|
|
65
|
+
for(const __rspack_import_key in _utils__rspack_import_0)if ([
|
|
66
|
+
"ModelConfigManager",
|
|
67
|
+
"GlobalConfigManager",
|
|
68
|
+
"default"
|
|
69
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_utils__rspack_import_0[__rspack_import_key];
|
|
70
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
71
|
+
var _types__rspack_import_1 = __webpack_require__("./types");
|
|
72
|
+
var __rspack_reexport = {};
|
|
73
|
+
for(const __rspack_import_key in _types__rspack_import_1)if ([
|
|
74
|
+
"ModelConfigManager",
|
|
75
|
+
"GlobalConfigManager",
|
|
76
|
+
"default"
|
|
77
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_types__rspack_import_1[__rspack_import_key];
|
|
78
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
79
|
+
var _model_config_manager__rspack_import_2 = __webpack_require__("./model-config-manager");
|
|
80
|
+
var _global_config_manager__rspack_import_3 = __webpack_require__("./global-config-manager");
|
|
81
|
+
})();
|
|
82
|
+
exports.GlobalConfigManager = __webpack_exports__.GlobalConfigManager;
|
|
83
|
+
exports.ModelConfigManager = __webpack_exports__.ModelConfigManager;
|
|
84
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
85
|
+
"GlobalConfigManager",
|
|
86
|
+
"ModelConfigManager"
|
|
87
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
88
|
+
Object.defineProperty(exports, '__esModule', {
|
|
89
|
+
value: true
|
|
90
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
initDebugConfig: ()=>initDebugConfig
|
|
28
|
+
});
|
|
29
|
+
const external_logger_js_namespaceObject = require("../logger.js");
|
|
30
|
+
const external_basic_js_namespaceObject = require("./basic.js");
|
|
31
|
+
const external_types_js_namespaceObject = require("./types.js");
|
|
32
|
+
const initDebugConfig = ()=>{
|
|
33
|
+
const shouldPrintTiming = (0, external_basic_js_namespaceObject.getBasicEnvValue)(external_types_js_namespaceObject.MIDSCENE_DEBUG_MODEL_PROFILE);
|
|
34
|
+
let debugConfig = '';
|
|
35
|
+
if (shouldPrintTiming) {
|
|
36
|
+
console.warn('MIDSCENE_DEBUG_MODEL_PROFILE is deprecated, use DEBUG=midscene:ai:profile instead');
|
|
37
|
+
debugConfig = 'ai:profile';
|
|
38
|
+
}
|
|
39
|
+
const shouldPrintModelResponse = (0, external_basic_js_namespaceObject.getBasicEnvValue)(external_types_js_namespaceObject.MIDSCENE_DEBUG_MODEL_RESPONSE);
|
|
40
|
+
if (shouldPrintModelResponse) {
|
|
41
|
+
console.warn('MIDSCENE_DEBUG_MODEL_RESPONSE is deprecated, use DEBUG=midscene:ai:response instead');
|
|
42
|
+
debugConfig = debugConfig ? 'ai:*' : 'ai:call';
|
|
43
|
+
}
|
|
44
|
+
if (debugConfig) (0, external_logger_js_namespaceObject.enableDebug)(debugConfig);
|
|
45
|
+
};
|
|
46
|
+
exports.initDebugConfig = __webpack_exports__.initDebugConfig;
|
|
47
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
48
|
+
"initDebugConfig"
|
|
49
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
50
|
+
Object.defineProperty(exports, '__esModule', {
|
|
51
|
+
value: true
|
|
52
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
ModelConfigManager: ()=>ModelConfigManager
|
|
28
|
+
});
|
|
29
|
+
const external_parse_model_config_js_namespaceObject = require("./parse-model-config.js");
|
|
30
|
+
function _define_property(obj, key, value) {
|
|
31
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
32
|
+
value: value,
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
writable: true
|
|
36
|
+
});
|
|
37
|
+
else obj[key] = value;
|
|
38
|
+
return obj;
|
|
39
|
+
}
|
|
40
|
+
class ModelConfigManager {
|
|
41
|
+
initialize() {
|
|
42
|
+
if (this.isInitialized) return;
|
|
43
|
+
let configMap;
|
|
44
|
+
if (this.modelConfig) {
|
|
45
|
+
this.isolatedMode = true;
|
|
46
|
+
configMap = this.normalizeModelConfig(this.modelConfig);
|
|
47
|
+
} else configMap = this.globalConfigManager?.getAllEnvConfig() || {};
|
|
48
|
+
const defaultConfig = (0, external_parse_model_config_js_namespaceObject.decideModelConfigFromIntentConfig)('default', configMap);
|
|
49
|
+
if (!defaultConfig) throw new Error('Model configuration is incomplete: model name (MIDSCENE_MODEL_NAME) is required. See https://midscenejs.com/model-strategy.html');
|
|
50
|
+
const insightConfig = (0, external_parse_model_config_js_namespaceObject.decideModelConfigFromIntentConfig)('insight', configMap);
|
|
51
|
+
const planningConfig = (0, external_parse_model_config_js_namespaceObject.decideModelConfigFromIntentConfig)('planning', configMap);
|
|
52
|
+
this.modelConfigMap = {
|
|
53
|
+
default: {
|
|
54
|
+
...defaultConfig,
|
|
55
|
+
createOpenAIClient: this.createOpenAIClientFn
|
|
56
|
+
},
|
|
57
|
+
insight: {
|
|
58
|
+
...insightConfig || defaultConfig,
|
|
59
|
+
createOpenAIClient: this.createOpenAIClientFn
|
|
60
|
+
},
|
|
61
|
+
planning: {
|
|
62
|
+
...planningConfig || defaultConfig,
|
|
63
|
+
createOpenAIClient: this.createOpenAIClientFn
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
this.isInitialized = true;
|
|
67
|
+
}
|
|
68
|
+
normalizeModelConfig(config) {
|
|
69
|
+
return Object.entries(config).reduce((acc, [key, value])=>{
|
|
70
|
+
if (null == value) return acc;
|
|
71
|
+
acc[key] = String(value);
|
|
72
|
+
return acc;
|
|
73
|
+
}, Object.create(null));
|
|
74
|
+
}
|
|
75
|
+
clearModelConfigMap() {
|
|
76
|
+
if (this.isolatedMode) throw new Error('ModelConfigManager work in isolated mode, so clearModelConfigMap should not be called');
|
|
77
|
+
this.isInitialized = false;
|
|
78
|
+
}
|
|
79
|
+
getModelConfig(intent) {
|
|
80
|
+
if (!this.isInitialized) this.initialize();
|
|
81
|
+
if (!this.modelConfigMap) throw new Error('modelConfigMap is not initialized, which should not happen');
|
|
82
|
+
return this.modelConfigMap[intent];
|
|
83
|
+
}
|
|
84
|
+
getUploadTestServerUrl() {
|
|
85
|
+
const { openaiExtraConfig } = this.getModelConfig('default');
|
|
86
|
+
const serverUrl = openaiExtraConfig?.REPORT_SERVER_URL;
|
|
87
|
+
return serverUrl;
|
|
88
|
+
}
|
|
89
|
+
registerGlobalConfigManager(globalConfigManager) {
|
|
90
|
+
this.globalConfigManager = globalConfigManager;
|
|
91
|
+
}
|
|
92
|
+
throwErrorIfNonVLModel() {
|
|
93
|
+
const modelConfig = this.getModelConfig('default');
|
|
94
|
+
if (!modelConfig.modelFamily) throw new Error('MIDSCENE_MODEL_FAMILY is not set to a visual language model (VL model), the element localization can not be achieved. Check your model configuration. See https://midscenejs.com/model-strategy.html');
|
|
95
|
+
}
|
|
96
|
+
constructor(modelConfig, createOpenAIClientFn){
|
|
97
|
+
_define_property(this, "modelConfigMap", void 0);
|
|
98
|
+
_define_property(this, "isInitialized", false);
|
|
99
|
+
_define_property(this, "isolatedMode", false);
|
|
100
|
+
_define_property(this, "globalConfigManager", void 0);
|
|
101
|
+
_define_property(this, "modelConfig", void 0);
|
|
102
|
+
_define_property(this, "createOpenAIClientFn", void 0);
|
|
103
|
+
this.modelConfig = modelConfig;
|
|
104
|
+
this.createOpenAIClientFn = createOpenAIClientFn;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.ModelConfigManager = __webpack_exports__.ModelConfigManager;
|
|
108
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
109
|
+
"ModelConfigManager"
|
|
110
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
111
|
+
Object.defineProperty(exports, '__esModule', {
|
|
112
|
+
value: true
|
|
113
|
+
});
|