@tradejs/core 2.0.20 → 3.0.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.
- package/dist/aiEndpoints.d.mts +10 -0
- package/dist/aiEndpoints.d.ts +10 -0
- package/dist/aiEndpoints.js +159 -0
- package/dist/aiEndpoints.mjs +12 -0
- package/dist/aiLanguages.d.mts +11 -0
- package/dist/aiLanguages.d.ts +11 -0
- package/dist/aiLanguages.js +71 -0
- package/dist/aiLanguages.mjs +43 -0
- package/dist/aiModels.d.mts +12 -0
- package/dist/aiModels.d.ts +12 -0
- package/dist/aiModels.js +272 -0
- package/dist/aiModels.mjs +162 -0
- package/dist/{chunk-Q3OFPRVV.mjs → chunk-QRRQA4TU.mjs} +5993 -5989
- package/dist/chunk-XQ3YBULV.mjs +132 -0
- package/dist/data.mjs +3 -3
- package/dist/grid.mjs +3 -3
- package/dist/indicators.js +5951 -5947
- package/dist/indicators.mjs +2 -2
- package/dist/strategies.js +5951 -5947
- package/dist/strategies.mjs +5 -5
- package/package.json +17 -2
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type AiEndpointOption = {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
|
5
|
+
declare const AI_CUSTOM_ENDPOINT_VALUE = "__custom__";
|
|
6
|
+
declare const AI_ENDPOINT_OPTIONS: AiEndpointOption[];
|
|
7
|
+
declare const normalizeAiEndpoint: (value: unknown) => string;
|
|
8
|
+
declare const isKnownAiEndpoint: (value: unknown) => value is string;
|
|
9
|
+
|
|
10
|
+
export { AI_CUSTOM_ENDPOINT_VALUE, AI_ENDPOINT_OPTIONS, type AiEndpointOption, isKnownAiEndpoint, normalizeAiEndpoint };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type AiEndpointOption = {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
|
5
|
+
declare const AI_CUSTOM_ENDPOINT_VALUE = "__custom__";
|
|
6
|
+
declare const AI_ENDPOINT_OPTIONS: AiEndpointOption[];
|
|
7
|
+
declare const normalizeAiEndpoint: (value: unknown) => string;
|
|
8
|
+
declare const isKnownAiEndpoint: (value: unknown) => value is string;
|
|
9
|
+
|
|
10
|
+
export { AI_CUSTOM_ENDPOINT_VALUE, AI_ENDPOINT_OPTIONS, type AiEndpointOption, isKnownAiEndpoint, normalizeAiEndpoint };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/aiEndpoints.ts
|
|
21
|
+
var aiEndpoints_exports = {};
|
|
22
|
+
__export(aiEndpoints_exports, {
|
|
23
|
+
AI_CUSTOM_ENDPOINT_VALUE: () => AI_CUSTOM_ENDPOINT_VALUE,
|
|
24
|
+
AI_ENDPOINT_OPTIONS: () => AI_ENDPOINT_OPTIONS,
|
|
25
|
+
isKnownAiEndpoint: () => isKnownAiEndpoint,
|
|
26
|
+
normalizeAiEndpoint: () => normalizeAiEndpoint
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(aiEndpoints_exports);
|
|
29
|
+
var AI_CUSTOM_ENDPOINT_VALUE = "__custom__";
|
|
30
|
+
var AI_ENDPOINT_OPTIONS = [
|
|
31
|
+
{
|
|
32
|
+
label: "OpenAI",
|
|
33
|
+
value: "https://api.openai.com/v1"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: "Claude",
|
|
37
|
+
value: "https://api.anthropic.com/v1"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: "OpenRouter",
|
|
41
|
+
value: "https://openrouter.ai/api/v1"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: "Gemini",
|
|
45
|
+
value: "https://generativelanguage.googleapis.com/v1beta/openai"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: "Together AI",
|
|
49
|
+
value: "https://api.together.xyz/v1"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: "Groq",
|
|
53
|
+
value: "https://api.groq.com/openai/v1"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
label: "DeepInfra",
|
|
57
|
+
value: "https://api.deepinfra.com/v1/openai"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: "xAI",
|
|
61
|
+
value: "https://api.x.ai/v1"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: "Qwen (DashScope Intl)",
|
|
65
|
+
value: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: "Qwen (DashScope CN)",
|
|
69
|
+
value: "https://dashscope.aliyuncs.com/compatible-mode/v1"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
label: "Qwen (DashScope US)",
|
|
73
|
+
value: "https://dashscope-us.aliyuncs.com/compatible-mode/v1"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
label: "Perplexity",
|
|
77
|
+
value: "https://api.perplexity.ai"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
label: "Fireworks",
|
|
81
|
+
value: "https://api.fireworks.ai/inference/v1"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
label: "SambaNova",
|
|
85
|
+
value: "https://api.sambanova.ai/v1"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
label: "Hyperbolic",
|
|
89
|
+
value: "https://api.hyperbolic.xyz/v1"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
label: "Kimi",
|
|
93
|
+
value: "https://api.moonshot.ai/v1"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
label: "ProxyAPI",
|
|
97
|
+
value: "https://openai.api.proxyapi.ru/v1"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: "Custom",
|
|
101
|
+
value: AI_CUSTOM_ENDPOINT_VALUE
|
|
102
|
+
}
|
|
103
|
+
];
|
|
104
|
+
var KNOWN_AI_ENDPOINTS = new Set(
|
|
105
|
+
AI_ENDPOINT_OPTIONS.map((option) => option.value).filter(
|
|
106
|
+
(value) => value !== AI_CUSTOM_ENDPOINT_VALUE
|
|
107
|
+
)
|
|
108
|
+
);
|
|
109
|
+
var normalizeUrl = (value) => value.replace(/\/+$/, "");
|
|
110
|
+
var isIpv4Address = (value) => /^(?:\d{1,3}\.){3}\d{1,3}$/.test(value.trim());
|
|
111
|
+
var parseIpv4Address = (value) => value.trim().split(".").map((part) => Number(part));
|
|
112
|
+
var isPrivateIpv4Address = (value) => {
|
|
113
|
+
if (!isIpv4Address(value)) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
const [a, b, c, d] = parseIpv4Address(value);
|
|
117
|
+
if ([a, b, c, d].some(
|
|
118
|
+
(part) => !Number.isInteger(part) || part < 0 || part > 255
|
|
119
|
+
)) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
return a === 10 || a === 127 || a === 0 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168;
|
|
123
|
+
};
|
|
124
|
+
var isPrivateHostname = (hostname) => {
|
|
125
|
+
const normalized = hostname.trim().toLowerCase();
|
|
126
|
+
if (!normalized) {
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
return normalized === "localhost" || normalized.endsWith(".localhost") || normalized.endsWith(".local") || normalized.endsWith(".internal") || normalized.endsWith(".lan") || normalized === "::1" || normalized === "[::1]" || isPrivateIpv4Address(normalized);
|
|
130
|
+
};
|
|
131
|
+
var isValidAiEndpointUrl = (value) => {
|
|
132
|
+
try {
|
|
133
|
+
const url = new URL(value);
|
|
134
|
+
return url.protocol === "https:" && !isPrivateHostname(url.hostname);
|
|
135
|
+
} catch {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
var normalizeAiEndpoint = (value) => {
|
|
140
|
+
if (typeof value !== "string") {
|
|
141
|
+
return "";
|
|
142
|
+
}
|
|
143
|
+
const trimmed = normalizeUrl(value.trim());
|
|
144
|
+
if (!trimmed) {
|
|
145
|
+
return "";
|
|
146
|
+
}
|
|
147
|
+
if (KNOWN_AI_ENDPOINTS.has(trimmed)) {
|
|
148
|
+
return trimmed;
|
|
149
|
+
}
|
|
150
|
+
return isValidAiEndpointUrl(trimmed) ? trimmed : "";
|
|
151
|
+
};
|
|
152
|
+
var isKnownAiEndpoint = (value) => KNOWN_AI_ENDPOINTS.has(normalizeAiEndpoint(value));
|
|
153
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
154
|
+
0 && (module.exports = {
|
|
155
|
+
AI_CUSTOM_ENDPOINT_VALUE,
|
|
156
|
+
AI_ENDPOINT_OPTIONS,
|
|
157
|
+
isKnownAiEndpoint,
|
|
158
|
+
normalizeAiEndpoint
|
|
159
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type AiResponseLanguageOption = {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
promptName: string;
|
|
5
|
+
};
|
|
6
|
+
declare const AI_RESPONSE_LANGUAGE_OPTIONS: AiResponseLanguageOption[];
|
|
7
|
+
declare const DEFAULT_AI_RESPONSE_LANGUAGE: string;
|
|
8
|
+
declare const normalizeAiResponseLanguage: (value: unknown) => string;
|
|
9
|
+
declare const getAiResponseLanguagePromptName: (value: unknown) => string;
|
|
10
|
+
|
|
11
|
+
export { AI_RESPONSE_LANGUAGE_OPTIONS, type AiResponseLanguageOption, DEFAULT_AI_RESPONSE_LANGUAGE, getAiResponseLanguagePromptName, normalizeAiResponseLanguage };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type AiResponseLanguageOption = {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
promptName: string;
|
|
5
|
+
};
|
|
6
|
+
declare const AI_RESPONSE_LANGUAGE_OPTIONS: AiResponseLanguageOption[];
|
|
7
|
+
declare const DEFAULT_AI_RESPONSE_LANGUAGE: string;
|
|
8
|
+
declare const normalizeAiResponseLanguage: (value: unknown) => string;
|
|
9
|
+
declare const getAiResponseLanguagePromptName: (value: unknown) => string;
|
|
10
|
+
|
|
11
|
+
export { AI_RESPONSE_LANGUAGE_OPTIONS, type AiResponseLanguageOption, DEFAULT_AI_RESPONSE_LANGUAGE, getAiResponseLanguagePromptName, normalizeAiResponseLanguage };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/aiLanguages.ts
|
|
21
|
+
var aiLanguages_exports = {};
|
|
22
|
+
__export(aiLanguages_exports, {
|
|
23
|
+
AI_RESPONSE_LANGUAGE_OPTIONS: () => AI_RESPONSE_LANGUAGE_OPTIONS,
|
|
24
|
+
DEFAULT_AI_RESPONSE_LANGUAGE: () => DEFAULT_AI_RESPONSE_LANGUAGE,
|
|
25
|
+
getAiResponseLanguagePromptName: () => getAiResponseLanguagePromptName,
|
|
26
|
+
normalizeAiResponseLanguage: () => normalizeAiResponseLanguage
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(aiLanguages_exports);
|
|
29
|
+
var AI_RESPONSE_LANGUAGE_OPTIONS = [
|
|
30
|
+
{ label: "English", value: "en", promptName: "English" },
|
|
31
|
+
{ label: "Chinese", value: "zh", promptName: "Chinese" },
|
|
32
|
+
{ label: "Hindi", value: "hi", promptName: "Hindi" },
|
|
33
|
+
{ label: "Spanish", value: "es", promptName: "Spanish" },
|
|
34
|
+
{ label: "French", value: "fr", promptName: "French" },
|
|
35
|
+
{ label: "Arabic", value: "ar", promptName: "Arabic" },
|
|
36
|
+
{ label: "Bengali", value: "bn", promptName: "Bengali" },
|
|
37
|
+
{ label: "Portuguese", value: "pt", promptName: "Portuguese" },
|
|
38
|
+
{ label: "Russian", value: "ru", promptName: "Russian" },
|
|
39
|
+
{ label: "Urdu", value: "ur", promptName: "Urdu" },
|
|
40
|
+
{ label: "Indonesian", value: "id", promptName: "Indonesian" },
|
|
41
|
+
{ label: "German", value: "de", promptName: "German" },
|
|
42
|
+
{ label: "Japanese", value: "ja", promptName: "Japanese" },
|
|
43
|
+
{ label: "Swahili", value: "sw", promptName: "Swahili" },
|
|
44
|
+
{ label: "Marathi", value: "mr", promptName: "Marathi" },
|
|
45
|
+
{ label: "Telugu", value: "te", promptName: "Telugu" },
|
|
46
|
+
{ label: "Turkish", value: "tr", promptName: "Turkish" },
|
|
47
|
+
{ label: "Tamil", value: "ta", promptName: "Tamil" },
|
|
48
|
+
{ label: "Vietnamese", value: "vi", promptName: "Vietnamese" },
|
|
49
|
+
{ label: "Korean", value: "ko", promptName: "Korean" }
|
|
50
|
+
];
|
|
51
|
+
var KNOWN_AI_RESPONSE_LANGUAGES = new Set(
|
|
52
|
+
AI_RESPONSE_LANGUAGE_OPTIONS.map((option) => option.value)
|
|
53
|
+
);
|
|
54
|
+
var DEFAULT_AI_RESPONSE_LANGUAGE = AI_RESPONSE_LANGUAGE_OPTIONS[0].value;
|
|
55
|
+
var normalizeAiResponseLanguage = (value) => {
|
|
56
|
+
if (typeof value !== "string") {
|
|
57
|
+
return DEFAULT_AI_RESPONSE_LANGUAGE;
|
|
58
|
+
}
|
|
59
|
+
const trimmed = value.trim().toLowerCase();
|
|
60
|
+
return KNOWN_AI_RESPONSE_LANGUAGES.has(trimmed) ? trimmed : DEFAULT_AI_RESPONSE_LANGUAGE;
|
|
61
|
+
};
|
|
62
|
+
var getAiResponseLanguagePromptName = (value) => AI_RESPONSE_LANGUAGE_OPTIONS.find(
|
|
63
|
+
(option) => option.value === normalizeAiResponseLanguage(value)
|
|
64
|
+
)?.promptName ?? AI_RESPONSE_LANGUAGE_OPTIONS[0].promptName;
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
AI_RESPONSE_LANGUAGE_OPTIONS,
|
|
68
|
+
DEFAULT_AI_RESPONSE_LANGUAGE,
|
|
69
|
+
getAiResponseLanguagePromptName,
|
|
70
|
+
normalizeAiResponseLanguage
|
|
71
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// src/aiLanguages.ts
|
|
2
|
+
var AI_RESPONSE_LANGUAGE_OPTIONS = [
|
|
3
|
+
{ label: "English", value: "en", promptName: "English" },
|
|
4
|
+
{ label: "Chinese", value: "zh", promptName: "Chinese" },
|
|
5
|
+
{ label: "Hindi", value: "hi", promptName: "Hindi" },
|
|
6
|
+
{ label: "Spanish", value: "es", promptName: "Spanish" },
|
|
7
|
+
{ label: "French", value: "fr", promptName: "French" },
|
|
8
|
+
{ label: "Arabic", value: "ar", promptName: "Arabic" },
|
|
9
|
+
{ label: "Bengali", value: "bn", promptName: "Bengali" },
|
|
10
|
+
{ label: "Portuguese", value: "pt", promptName: "Portuguese" },
|
|
11
|
+
{ label: "Russian", value: "ru", promptName: "Russian" },
|
|
12
|
+
{ label: "Urdu", value: "ur", promptName: "Urdu" },
|
|
13
|
+
{ label: "Indonesian", value: "id", promptName: "Indonesian" },
|
|
14
|
+
{ label: "German", value: "de", promptName: "German" },
|
|
15
|
+
{ label: "Japanese", value: "ja", promptName: "Japanese" },
|
|
16
|
+
{ label: "Swahili", value: "sw", promptName: "Swahili" },
|
|
17
|
+
{ label: "Marathi", value: "mr", promptName: "Marathi" },
|
|
18
|
+
{ label: "Telugu", value: "te", promptName: "Telugu" },
|
|
19
|
+
{ label: "Turkish", value: "tr", promptName: "Turkish" },
|
|
20
|
+
{ label: "Tamil", value: "ta", promptName: "Tamil" },
|
|
21
|
+
{ label: "Vietnamese", value: "vi", promptName: "Vietnamese" },
|
|
22
|
+
{ label: "Korean", value: "ko", promptName: "Korean" }
|
|
23
|
+
];
|
|
24
|
+
var KNOWN_AI_RESPONSE_LANGUAGES = new Set(
|
|
25
|
+
AI_RESPONSE_LANGUAGE_OPTIONS.map((option) => option.value)
|
|
26
|
+
);
|
|
27
|
+
var DEFAULT_AI_RESPONSE_LANGUAGE = AI_RESPONSE_LANGUAGE_OPTIONS[0].value;
|
|
28
|
+
var normalizeAiResponseLanguage = (value) => {
|
|
29
|
+
if (typeof value !== "string") {
|
|
30
|
+
return DEFAULT_AI_RESPONSE_LANGUAGE;
|
|
31
|
+
}
|
|
32
|
+
const trimmed = value.trim().toLowerCase();
|
|
33
|
+
return KNOWN_AI_RESPONSE_LANGUAGES.has(trimmed) ? trimmed : DEFAULT_AI_RESPONSE_LANGUAGE;
|
|
34
|
+
};
|
|
35
|
+
var getAiResponseLanguagePromptName = (value) => AI_RESPONSE_LANGUAGE_OPTIONS.find(
|
|
36
|
+
(option) => option.value === normalizeAiResponseLanguage(value)
|
|
37
|
+
)?.promptName ?? AI_RESPONSE_LANGUAGE_OPTIONS[0].promptName;
|
|
38
|
+
export {
|
|
39
|
+
AI_RESPONSE_LANGUAGE_OPTIONS,
|
|
40
|
+
DEFAULT_AI_RESPONSE_LANGUAGE,
|
|
41
|
+
getAiResponseLanguagePromptName,
|
|
42
|
+
normalizeAiResponseLanguage
|
|
43
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type AiModelOption = {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
|
5
|
+
declare const AI_CUSTOM_MODEL_VALUE = "__custom_model__";
|
|
6
|
+
declare const getAiModelOptionsForEndpoint: (endpoint: string) => AiModelOption[];
|
|
7
|
+
declare const getDefaultAiModelForEndpoint: (endpoint: string) => string;
|
|
8
|
+
declare const normalizeAiModel: (value: unknown, endpoint: string) => string;
|
|
9
|
+
declare const isKnownAiModelForEndpoint: (value: unknown, endpoint: string) => value is string;
|
|
10
|
+
declare const hasPresetAiModelsForEndpoint: (endpoint: string) => boolean;
|
|
11
|
+
|
|
12
|
+
export { AI_CUSTOM_MODEL_VALUE, type AiModelOption, getAiModelOptionsForEndpoint, getDefaultAiModelForEndpoint, hasPresetAiModelsForEndpoint, isKnownAiModelForEndpoint, normalizeAiModel };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type AiModelOption = {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
|
5
|
+
declare const AI_CUSTOM_MODEL_VALUE = "__custom_model__";
|
|
6
|
+
declare const getAiModelOptionsForEndpoint: (endpoint: string) => AiModelOption[];
|
|
7
|
+
declare const getDefaultAiModelForEndpoint: (endpoint: string) => string;
|
|
8
|
+
declare const normalizeAiModel: (value: unknown, endpoint: string) => string;
|
|
9
|
+
declare const isKnownAiModelForEndpoint: (value: unknown, endpoint: string) => value is string;
|
|
10
|
+
declare const hasPresetAiModelsForEndpoint: (endpoint: string) => boolean;
|
|
11
|
+
|
|
12
|
+
export { AI_CUSTOM_MODEL_VALUE, type AiModelOption, getAiModelOptionsForEndpoint, getDefaultAiModelForEndpoint, hasPresetAiModelsForEndpoint, isKnownAiModelForEndpoint, normalizeAiModel };
|
package/dist/aiModels.js
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/aiModels.ts
|
|
21
|
+
var aiModels_exports = {};
|
|
22
|
+
__export(aiModels_exports, {
|
|
23
|
+
AI_CUSTOM_MODEL_VALUE: () => AI_CUSTOM_MODEL_VALUE,
|
|
24
|
+
getAiModelOptionsForEndpoint: () => getAiModelOptionsForEndpoint,
|
|
25
|
+
getDefaultAiModelForEndpoint: () => getDefaultAiModelForEndpoint,
|
|
26
|
+
hasPresetAiModelsForEndpoint: () => hasPresetAiModelsForEndpoint,
|
|
27
|
+
isKnownAiModelForEndpoint: () => isKnownAiModelForEndpoint,
|
|
28
|
+
normalizeAiModel: () => normalizeAiModel
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(aiModels_exports);
|
|
31
|
+
|
|
32
|
+
// src/aiEndpoints.ts
|
|
33
|
+
var AI_CUSTOM_ENDPOINT_VALUE = "__custom__";
|
|
34
|
+
var AI_ENDPOINT_OPTIONS = [
|
|
35
|
+
{
|
|
36
|
+
label: "OpenAI",
|
|
37
|
+
value: "https://api.openai.com/v1"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: "Claude",
|
|
41
|
+
value: "https://api.anthropic.com/v1"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: "OpenRouter",
|
|
45
|
+
value: "https://openrouter.ai/api/v1"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: "Gemini",
|
|
49
|
+
value: "https://generativelanguage.googleapis.com/v1beta/openai"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: "Together AI",
|
|
53
|
+
value: "https://api.together.xyz/v1"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
label: "Groq",
|
|
57
|
+
value: "https://api.groq.com/openai/v1"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: "DeepInfra",
|
|
61
|
+
value: "https://api.deepinfra.com/v1/openai"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: "xAI",
|
|
65
|
+
value: "https://api.x.ai/v1"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: "Qwen (DashScope Intl)",
|
|
69
|
+
value: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
label: "Qwen (DashScope CN)",
|
|
73
|
+
value: "https://dashscope.aliyuncs.com/compatible-mode/v1"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
label: "Qwen (DashScope US)",
|
|
77
|
+
value: "https://dashscope-us.aliyuncs.com/compatible-mode/v1"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
label: "Perplexity",
|
|
81
|
+
value: "https://api.perplexity.ai"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
label: "Fireworks",
|
|
85
|
+
value: "https://api.fireworks.ai/inference/v1"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
label: "SambaNova",
|
|
89
|
+
value: "https://api.sambanova.ai/v1"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
label: "Hyperbolic",
|
|
93
|
+
value: "https://api.hyperbolic.xyz/v1"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
label: "Kimi",
|
|
97
|
+
value: "https://api.moonshot.ai/v1"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: "ProxyAPI",
|
|
101
|
+
value: "https://openai.api.proxyapi.ru/v1"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
label: "Custom",
|
|
105
|
+
value: AI_CUSTOM_ENDPOINT_VALUE
|
|
106
|
+
}
|
|
107
|
+
];
|
|
108
|
+
var KNOWN_AI_ENDPOINTS = new Set(
|
|
109
|
+
AI_ENDPOINT_OPTIONS.map((option) => option.value).filter(
|
|
110
|
+
(value) => value !== AI_CUSTOM_ENDPOINT_VALUE
|
|
111
|
+
)
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
// src/aiModels.ts
|
|
115
|
+
var AI_CUSTOM_MODEL_VALUE = "__custom_model__";
|
|
116
|
+
var OPENAI_ENDPOINT = "https://api.openai.com/v1";
|
|
117
|
+
var ANTHROPIC_ENDPOINT = "https://api.anthropic.com/v1";
|
|
118
|
+
var OPENROUTER_ENDPOINT = "https://openrouter.ai/api/v1";
|
|
119
|
+
var GEMINI_ENDPOINT = "https://generativelanguage.googleapis.com/v1beta/openai";
|
|
120
|
+
var TOGETHER_ENDPOINT = "https://api.together.xyz/v1";
|
|
121
|
+
var GROQ_ENDPOINT = "https://api.groq.com/openai/v1";
|
|
122
|
+
var XAI_ENDPOINT = "https://api.x.ai/v1";
|
|
123
|
+
var QWEN_INTL_ENDPOINT = "https://dashscope-intl.aliyuncs.com/compatible-mode/v1";
|
|
124
|
+
var QWEN_CN_ENDPOINT = "https://dashscope.aliyuncs.com/compatible-mode/v1";
|
|
125
|
+
var QWEN_US_ENDPOINT = "https://dashscope-us.aliyuncs.com/compatible-mode/v1";
|
|
126
|
+
var PERPLEXITY_ENDPOINT = "https://api.perplexity.ai";
|
|
127
|
+
var KIMI_ENDPOINT = "https://api.moonshot.ai/v1";
|
|
128
|
+
var PROXY_API_ENDPOINT = "https://openai.api.proxyapi.ru/v1";
|
|
129
|
+
var AI_MODEL_OPTIONS_BY_ENDPOINT = {
|
|
130
|
+
[OPENAI_ENDPOINT]: [
|
|
131
|
+
{ label: "GPT-5 mini", value: "gpt-5-mini" },
|
|
132
|
+
{ label: "GPT-5", value: "gpt-5" },
|
|
133
|
+
{ label: "GPT-5.2", value: "gpt-5.2" },
|
|
134
|
+
{ label: "GPT-4.1", value: "gpt-4.1" },
|
|
135
|
+
{ label: "GPT-4o", value: "gpt-4o" }
|
|
136
|
+
],
|
|
137
|
+
[ANTHROPIC_ENDPOINT]: [
|
|
138
|
+
{ label: "Claude Sonnet 4", value: "claude-sonnet-4-20250514" },
|
|
139
|
+
{ label: "Claude Opus 4.1", value: "claude-opus-4-1-20250805" },
|
|
140
|
+
{ label: "Claude Opus 4", value: "claude-opus-4-20250514" },
|
|
141
|
+
{ label: "Claude 3.7 Sonnet", value: "claude-3-7-sonnet-20250219" },
|
|
142
|
+
{ label: "Claude 3.5 Haiku", value: "claude-3-5-haiku-20241022" }
|
|
143
|
+
],
|
|
144
|
+
[OPENROUTER_ENDPOINT]: [
|
|
145
|
+
{ label: "OpenAI GPT-5", value: "openai/gpt-5" },
|
|
146
|
+
{ label: "Anthropic Claude Sonnet 4", value: "anthropic/claude-sonnet-4" },
|
|
147
|
+
{ label: "Google Gemini 2.5 Pro", value: "google/gemini-2.5-pro" },
|
|
148
|
+
{ label: "OpenAI GPT-5 mini", value: "openai/gpt-5-mini" },
|
|
149
|
+
{
|
|
150
|
+
label: "DeepSeek V3.1",
|
|
151
|
+
value: "deepseek/deepseek-chat-v3.1"
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
[GEMINI_ENDPOINT]: [
|
|
155
|
+
{ label: "Gemini 2.5 Pro", value: "gemini-2.5-pro" },
|
|
156
|
+
{ label: "Gemini 2.5 Flash", value: "gemini-2.5-flash" },
|
|
157
|
+
{ label: "Gemini 2.5 Flash-Lite", value: "gemini-2.5-flash-lite" },
|
|
158
|
+
{ label: "Gemini 2.0 Flash", value: "gemini-2.0-flash" },
|
|
159
|
+
{ label: "Gemini 2.0 Flash-Lite", value: "gemini-2.0-flash-lite" }
|
|
160
|
+
],
|
|
161
|
+
[TOGETHER_ENDPOINT]: [
|
|
162
|
+
{ label: "DeepSeek V3.1", value: "deepseek-ai/DeepSeek-V3.1" },
|
|
163
|
+
{
|
|
164
|
+
label: "Qwen3 Coder 480B",
|
|
165
|
+
value: "Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
label: "Llama 4 Maverick",
|
|
169
|
+
value: "meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8"
|
|
170
|
+
},
|
|
171
|
+
{ label: "DeepSeek V3", value: "deepseek-ai/DeepSeek-V3" },
|
|
172
|
+
{
|
|
173
|
+
label: "Llama 3.3 70B Turbo",
|
|
174
|
+
value: "meta-llama/Llama-3.3-70B-Instruct-Turbo"
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
[GROQ_ENDPOINT]: [
|
|
178
|
+
{ label: "GPT-OSS 120B", value: "openai/gpt-oss-120b" },
|
|
179
|
+
{
|
|
180
|
+
label: "Llama 4 Scout",
|
|
181
|
+
value: "meta-llama/llama-4-scout-17b-16e-instruct"
|
|
182
|
+
},
|
|
183
|
+
{ label: "Qwen3 32B", value: "qwen/qwen3-32b" },
|
|
184
|
+
{ label: "Llama 3.3 70B", value: "llama-3.3-70b-versatile" },
|
|
185
|
+
{ label: "Llama 3.1 8B Instant", value: "llama-3.1-8b-instant" }
|
|
186
|
+
],
|
|
187
|
+
[XAI_ENDPOINT]: [
|
|
188
|
+
{ label: "Grok 4 Fast Reasoning", value: "grok-4-fast-reasoning" },
|
|
189
|
+
{ label: "Grok 4 Fast Non-Reasoning", value: "grok-4-fast-non-reasoning" },
|
|
190
|
+
{ label: "Grok Code Fast 1", value: "grok-code-fast-1" },
|
|
191
|
+
{ label: "Grok 4", value: "grok-4-0709" },
|
|
192
|
+
{ label: "Grok 3 Mini", value: "grok-3-mini" }
|
|
193
|
+
],
|
|
194
|
+
[QWEN_INTL_ENDPOINT]: [
|
|
195
|
+
{ label: "Qwen Plus Latest", value: "qwen-plus-latest" },
|
|
196
|
+
{ label: "Qwen Turbo Latest", value: "qwen-turbo-latest" },
|
|
197
|
+
{ label: "Qwen Max Latest", value: "qwen-max-latest" },
|
|
198
|
+
{ label: "Qwen3 Coder Plus", value: "qwen3-coder-plus" },
|
|
199
|
+
{ label: "Qwen3 Coder Next", value: "qwen3-coder-next" }
|
|
200
|
+
],
|
|
201
|
+
[QWEN_CN_ENDPOINT]: [
|
|
202
|
+
{ label: "Qwen Plus Latest", value: "qwen-plus-latest" },
|
|
203
|
+
{ label: "Qwen Turbo Latest", value: "qwen-turbo-latest" },
|
|
204
|
+
{ label: "Qwen Max Latest", value: "qwen-max-latest" },
|
|
205
|
+
{ label: "Qwen3 Coder Plus", value: "qwen3-coder-plus" },
|
|
206
|
+
{ label: "Qwen3 Coder Next", value: "qwen3-coder-next" }
|
|
207
|
+
],
|
|
208
|
+
[QWEN_US_ENDPOINT]: [
|
|
209
|
+
{ label: "Qwen Plus Latest", value: "qwen-plus-latest" },
|
|
210
|
+
{ label: "Qwen Turbo Latest", value: "qwen-turbo-latest" },
|
|
211
|
+
{ label: "Qwen Max Latest", value: "qwen-max-latest" },
|
|
212
|
+
{ label: "Qwen3 Coder Plus", value: "qwen3-coder-plus" },
|
|
213
|
+
{ label: "Qwen3 Coder Next", value: "qwen3-coder-next" }
|
|
214
|
+
],
|
|
215
|
+
[PERPLEXITY_ENDPOINT]: [
|
|
216
|
+
{ label: "Sonar Pro", value: "sonar-pro" },
|
|
217
|
+
{ label: "Sonar", value: "sonar" },
|
|
218
|
+
{ label: "Sonar Reasoning Pro", value: "sonar-reasoning-pro" },
|
|
219
|
+
{ label: "Sonar Deep Research", value: "sonar-deep-research" }
|
|
220
|
+
],
|
|
221
|
+
[KIMI_ENDPOINT]: [
|
|
222
|
+
{ label: "Kimi K2.5", value: "kimi-k2.5" },
|
|
223
|
+
{ label: "Kimi K2 Thinking", value: "kimi-k2-thinking" },
|
|
224
|
+
{ label: "Kimi K2 Turbo Preview", value: "kimi-k2-turbo-preview" },
|
|
225
|
+
{ label: "Kimi K2 0905 Preview", value: "kimi-k2-0905-preview" },
|
|
226
|
+
{ label: "Kimi K2", value: "kimi-k2" }
|
|
227
|
+
],
|
|
228
|
+
[PROXY_API_ENDPOINT]: [
|
|
229
|
+
{
|
|
230
|
+
label: "Anthropic Claude Sonnet 4",
|
|
231
|
+
value: "anthropic/claude-sonnet-4-20250514"
|
|
232
|
+
},
|
|
233
|
+
{ label: "Gemini 2.5 Flash", value: "gemini/gemini-2.5-flash" },
|
|
234
|
+
{ label: "OpenAI GPT-5 mini", value: "openai/gpt-5-mini" },
|
|
235
|
+
{ label: "OpenAI GPT-4o", value: "openai/gpt-4o" },
|
|
236
|
+
{
|
|
237
|
+
label: "OpenRouter DeepSeek Chat V3.1",
|
|
238
|
+
value: "openrouter/deepseek/deepseek-chat-v3.1"
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
};
|
|
242
|
+
var DEFAULT_AI_MODEL_BY_ENDPOINT = Object.fromEntries(
|
|
243
|
+
Object.entries(AI_MODEL_OPTIONS_BY_ENDPOINT).map(([endpoint, options]) => [
|
|
244
|
+
endpoint,
|
|
245
|
+
options[0]?.value ?? ""
|
|
246
|
+
])
|
|
247
|
+
);
|
|
248
|
+
var normalizeModel = (value) => value.trim();
|
|
249
|
+
var getAiModelOptionsForEndpoint = (endpoint) => AI_MODEL_OPTIONS_BY_ENDPOINT[endpoint] ?? [];
|
|
250
|
+
var getDefaultAiModelForEndpoint = (endpoint) => DEFAULT_AI_MODEL_BY_ENDPOINT[endpoint] ?? "";
|
|
251
|
+
var normalizeAiModel = (value, endpoint) => {
|
|
252
|
+
if (typeof value === "string") {
|
|
253
|
+
const trimmed = normalizeModel(value);
|
|
254
|
+
if (trimmed) {
|
|
255
|
+
return trimmed;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return getDefaultAiModelForEndpoint(endpoint);
|
|
259
|
+
};
|
|
260
|
+
var isKnownAiModelForEndpoint = (value, endpoint) => getAiModelOptionsForEndpoint(endpoint).some(
|
|
261
|
+
(option) => option.value === normalizeAiModel(value, endpoint)
|
|
262
|
+
);
|
|
263
|
+
var hasPresetAiModelsForEndpoint = (endpoint) => getAiModelOptionsForEndpoint(endpoint).length > 0 && endpoint !== AI_CUSTOM_ENDPOINT_VALUE;
|
|
264
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
265
|
+
0 && (module.exports = {
|
|
266
|
+
AI_CUSTOM_MODEL_VALUE,
|
|
267
|
+
getAiModelOptionsForEndpoint,
|
|
268
|
+
getDefaultAiModelForEndpoint,
|
|
269
|
+
hasPresetAiModelsForEndpoint,
|
|
270
|
+
isKnownAiModelForEndpoint,
|
|
271
|
+
normalizeAiModel
|
|
272
|
+
});
|