@mmmbuto/nexuscli 0.9.7004-termux → 0.10.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/CHANGELOG.md +84 -0
- package/README.md +89 -158
- package/bin/nexuscli.js +12 -0
- package/frontend/dist/assets/{index-D8XkscmI.js → index-Bztt9hew.js} +1704 -1704
- package/frontend/dist/assets/{index-CoLEGBO4.css → index-Dj7jz2fy.css} +1 -1
- package/frontend/dist/index.html +2 -2
- package/frontend/dist/sw.js +1 -1
- package/lib/cli/api.js +19 -1
- package/lib/cli/config.js +27 -5
- package/lib/cli/engines.js +84 -202
- package/lib/cli/init.js +56 -2
- package/lib/cli/model.js +17 -7
- package/lib/cli/start.js +37 -24
- package/lib/cli/stop.js +12 -41
- package/lib/cli/update.js +28 -0
- package/lib/cli/workspaces.js +4 -0
- package/lib/config/manager.js +112 -8
- package/lib/config/models.js +388 -192
- package/lib/server/db/migrations/001_ultra_light_schema.sql +1 -1
- package/lib/server/db/migrations/006_runtime_lane_tracking.sql +79 -0
- package/lib/server/lib/getPty.js +51 -0
- package/lib/server/lib/pty-adapter.js +101 -57
- package/lib/server/lib/pty-provider.js +63 -0
- package/lib/server/lib/pty-utils-loader.js +136 -0
- package/lib/server/middleware/auth.js +27 -4
- package/lib/server/models/Conversation.js +7 -3
- package/lib/server/models/Message.js +29 -5
- package/lib/server/routes/chat.js +27 -4
- package/lib/server/routes/codex.js +35 -8
- package/lib/server/routes/config.js +9 -1
- package/lib/server/routes/gemini.js +24 -5
- package/lib/server/routes/jobs.js +15 -156
- package/lib/server/routes/models.js +12 -10
- package/lib/server/routes/qwen.js +26 -7
- package/lib/server/routes/runtimes.js +68 -0
- package/lib/server/server.js +3 -0
- package/lib/server/services/claude-wrapper.js +60 -62
- package/lib/server/services/cli-loader.js +1 -1
- package/lib/server/services/codex-wrapper.js +79 -10
- package/lib/server/services/gemini-wrapper.js +9 -4
- package/lib/server/services/job-runner.js +156 -0
- package/lib/server/services/qwen-wrapper.js +26 -11
- package/lib/server/services/runtime-manager.js +467 -0
- package/lib/server/services/session-importer.js +6 -1
- package/lib/server/services/session-manager.js +56 -14
- package/lib/server/services/workspace-manager.js +121 -0
- package/lib/server/tests/integration.test.js +12 -0
- package/lib/server/tests/runtime-manager.test.js +46 -0
- package/lib/server/tests/runtime-persistence.test.js +97 -0
- package/lib/setup/postinstall-pty-check.js +183 -0
- package/lib/setup/postinstall.js +60 -41
- package/lib/utils/restart-warning.js +18 -0
- package/lib/utils/server.js +88 -0
- package/lib/utils/termux.js +1 -1
- package/lib/utils/update-check.js +153 -0
- package/lib/utils/update-runner.js +62 -0
- package/package.json +6 -5
package/lib/config/models.js
CHANGED
|
@@ -1,218 +1,414 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared model catalog for NexusCLI
|
|
3
|
-
*
|
|
2
|
+
* Shared model catalog for NexusCLI.
|
|
3
|
+
* The catalog is engine/lane aware, while keeping a compatibility
|
|
4
|
+
* shape for legacy routes and UI consumers.
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
'claude'
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
7
|
+
const ENGINE_ENDPOINTS = {
|
|
8
|
+
claude: '/api/v1/chat',
|
|
9
|
+
codex: '/api/v1/codex',
|
|
10
|
+
gemini: '/api/v1/gemini',
|
|
11
|
+
qwen: '/api/v1/qwen',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const CATALOG = {
|
|
15
|
+
claude: {
|
|
16
|
+
id: 'claude',
|
|
17
|
+
name: 'Claude Code',
|
|
18
|
+
icon: 'Terminal',
|
|
19
|
+
endpoint: ENGINE_ENDPOINTS.claude,
|
|
20
|
+
thinkModes: ['think', 'no-think'],
|
|
21
|
+
defaultThinkMode: 'think',
|
|
22
|
+
lanes: {
|
|
23
|
+
native: {
|
|
24
|
+
runtimeId: 'claude-native',
|
|
25
|
+
label: 'Native',
|
|
26
|
+
models: [
|
|
27
|
+
{
|
|
28
|
+
id: 'sonnet',
|
|
29
|
+
name: 'sonnet',
|
|
30
|
+
label: 'Claude Sonnet 4.6',
|
|
31
|
+
description: 'Latest balanced Claude coding model',
|
|
32
|
+
providerId: 'anthropic',
|
|
33
|
+
default: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 'opus',
|
|
37
|
+
name: 'opus',
|
|
38
|
+
label: 'Claude Opus 4.6',
|
|
39
|
+
description: 'Highest capability Claude model',
|
|
40
|
+
providerId: 'anthropic',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'haiku',
|
|
44
|
+
name: 'haiku',
|
|
45
|
+
label: 'Claude Haiku 4.5',
|
|
46
|
+
description: 'Fast Claude lane',
|
|
47
|
+
providerId: 'anthropic',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
custom: {
|
|
52
|
+
runtimeId: 'claude-custom',
|
|
53
|
+
label: 'Custom',
|
|
54
|
+
models: [
|
|
55
|
+
{
|
|
56
|
+
id: 'deepseek-reasoner',
|
|
57
|
+
name: 'deepseek-reasoner',
|
|
58
|
+
label: 'DeepSeek Reasoner',
|
|
59
|
+
description: 'Claude CLI via DeepSeek Anthropic-compatible API',
|
|
60
|
+
providerId: 'deepseek',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'deepseek-chat',
|
|
64
|
+
name: 'deepseek-chat',
|
|
65
|
+
label: 'DeepSeek Chat',
|
|
66
|
+
description: 'Fast DeepSeek chat over Claude CLI',
|
|
67
|
+
providerId: 'deepseek',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 'glm-4.7',
|
|
71
|
+
name: 'glm-4.7',
|
|
72
|
+
label: 'GLM 4.7',
|
|
73
|
+
description: 'Z.ai Anthropic-compatible model',
|
|
74
|
+
providerId: 'zai',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 'glm-5',
|
|
78
|
+
name: 'glm-5',
|
|
79
|
+
label: 'GLM 5',
|
|
80
|
+
description: 'Z.ai latest custom runtime',
|
|
81
|
+
providerId: 'zai',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: 'qwen3.5-plus',
|
|
85
|
+
name: 'qwen3.5-plus',
|
|
86
|
+
label: 'Qwen 3.5 Plus',
|
|
87
|
+
description: 'Alibaba custom provider over Claude CLI',
|
|
88
|
+
providerId: 'alibaba',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: 'qwen3-max-2026-01-23',
|
|
92
|
+
name: 'qwen3-max-2026-01-23',
|
|
93
|
+
label: 'Qwen 3 Max',
|
|
94
|
+
description: 'Alibaba custom provider over Claude CLI',
|
|
95
|
+
providerId: 'alibaba',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: 'kimi-k2.5',
|
|
99
|
+
name: 'kimi-k2.5',
|
|
100
|
+
label: 'Kimi K2.5',
|
|
101
|
+
description: 'Moonshot-compatible custom lane',
|
|
102
|
+
providerId: 'alibaba',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'MiniMax-M2.7',
|
|
106
|
+
name: 'MiniMax-M2.7',
|
|
107
|
+
label: 'MiniMax M2.7',
|
|
108
|
+
description: 'MiniMax custom lane over Claude CLI',
|
|
109
|
+
providerId: 'minimax',
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
},
|
|
72
113
|
},
|
|
114
|
+
},
|
|
73
115
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
'
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
116
|
+
codex: {
|
|
117
|
+
id: 'codex',
|
|
118
|
+
name: 'Codex',
|
|
119
|
+
icon: 'Code2',
|
|
120
|
+
endpoint: ENGINE_ENDPOINTS.codex,
|
|
121
|
+
lanes: {
|
|
122
|
+
native: {
|
|
123
|
+
runtimeId: 'codex-native',
|
|
124
|
+
label: 'Native',
|
|
125
|
+
models: [
|
|
126
|
+
{
|
|
127
|
+
id: 'gpt-5.4',
|
|
128
|
+
name: 'gpt-5.4',
|
|
129
|
+
label: 'GPT-5.4',
|
|
130
|
+
description: 'Latest flagship reasoning model',
|
|
131
|
+
providerId: 'openai',
|
|
132
|
+
reasoningEfforts: ['low', 'medium', 'high', 'xhigh'],
|
|
133
|
+
defaultReasoning: 'high',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: 'gpt-5.3-codex',
|
|
137
|
+
name: 'gpt-5.3-codex',
|
|
138
|
+
label: 'GPT-5.3 Codex',
|
|
139
|
+
description: 'Current codex-specialized model',
|
|
140
|
+
providerId: 'openai',
|
|
141
|
+
reasoningEfforts: ['low', 'medium', 'high', 'xhigh'],
|
|
142
|
+
defaultReasoning: 'high',
|
|
143
|
+
default: true,
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: 'gpt-5.2-codex',
|
|
147
|
+
name: 'gpt-5.2-codex',
|
|
148
|
+
label: 'GPT-5.2 Codex',
|
|
149
|
+
description: 'Stable codex model',
|
|
150
|
+
providerId: 'openai',
|
|
151
|
+
reasoningEfforts: ['low', 'medium', 'high', 'xhigh'],
|
|
152
|
+
defaultReasoning: 'high',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
id: 'gpt-5.1-codex-max',
|
|
156
|
+
name: 'gpt-5.1-codex-max',
|
|
157
|
+
label: 'GPT-5.1 Codex Max',
|
|
158
|
+
description: 'Deep codex reasoning',
|
|
159
|
+
providerId: 'openai',
|
|
160
|
+
reasoningEfforts: ['low', 'medium', 'high', 'xhigh'],
|
|
161
|
+
defaultReasoning: 'high',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: 'codex-mini-latest',
|
|
165
|
+
name: 'codex-mini-latest',
|
|
166
|
+
label: 'Codex Mini Latest',
|
|
167
|
+
description: 'Fast latest codex lane',
|
|
168
|
+
providerId: 'openai',
|
|
169
|
+
reasoningEfforts: ['medium', 'high'],
|
|
170
|
+
defaultReasoning: 'medium',
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
custom: {
|
|
175
|
+
runtimeId: 'codex-custom',
|
|
176
|
+
label: 'Custom',
|
|
177
|
+
models: [
|
|
178
|
+
{
|
|
179
|
+
id: 'qwen3-coder-plus',
|
|
180
|
+
name: 'qwen3-coder-plus',
|
|
181
|
+
label: 'Qwen 3 Coder Plus',
|
|
182
|
+
description: 'Custom coding provider via codex-lts',
|
|
183
|
+
providerId: 'alibaba',
|
|
184
|
+
reasoningEfforts: ['medium', 'high'],
|
|
185
|
+
defaultReasoning: 'high',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
id: 'qwen3-coder-next',
|
|
189
|
+
name: 'qwen3-coder-next',
|
|
190
|
+
label: 'Qwen 3 Coder Next',
|
|
191
|
+
description: 'Custom coding provider via codex-lts',
|
|
192
|
+
providerId: 'alibaba',
|
|
193
|
+
reasoningEfforts: ['medium', 'high'],
|
|
194
|
+
defaultReasoning: 'high',
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
id: 'qwen3.5-plus',
|
|
198
|
+
name: 'qwen3.5-plus',
|
|
199
|
+
label: 'Qwen 3.5 Plus',
|
|
200
|
+
description: 'Custom provider lane via codex-lts',
|
|
201
|
+
providerId: 'alibaba',
|
|
202
|
+
reasoningEfforts: ['medium', 'high'],
|
|
203
|
+
defaultReasoning: 'high',
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
id: 'glm-5',
|
|
207
|
+
name: 'glm-5',
|
|
208
|
+
label: 'GLM 5',
|
|
209
|
+
description: 'Z.ai custom lane via codex-lts',
|
|
210
|
+
providerId: 'zai',
|
|
211
|
+
reasoningEfforts: ['medium', 'high'],
|
|
212
|
+
defaultReasoning: 'high',
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
id: 'deepseek-ai/DeepSeek-V3.2-TEE',
|
|
216
|
+
name: 'deepseek-ai/DeepSeek-V3.2-TEE',
|
|
217
|
+
label: 'DeepSeek V3.2 TEE',
|
|
218
|
+
description: 'Chutes custom runtime via codex-lts',
|
|
219
|
+
providerId: 'chutes',
|
|
220
|
+
reasoningEfforts: ['medium', 'high'],
|
|
221
|
+
defaultReasoning: 'high',
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
},
|
|
139
225
|
},
|
|
226
|
+
},
|
|
140
227
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
'
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
228
|
+
gemini: {
|
|
229
|
+
id: 'gemini',
|
|
230
|
+
name: 'Gemini',
|
|
231
|
+
icon: 'Sparkles',
|
|
232
|
+
endpoint: ENGINE_ENDPOINTS.gemini,
|
|
233
|
+
lanes: {
|
|
234
|
+
native: {
|
|
235
|
+
runtimeId: 'gemini-native',
|
|
236
|
+
label: 'Native',
|
|
237
|
+
models: [
|
|
238
|
+
{
|
|
239
|
+
id: 'gemini-3-pro-preview',
|
|
240
|
+
name: 'gemini-3-pro-preview',
|
|
241
|
+
label: 'Gemini 3 Pro',
|
|
242
|
+
description: 'Current Gemini 3 pro line',
|
|
243
|
+
providerId: 'google',
|
|
244
|
+
default: true,
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
id: 'gemini-3-flash-preview',
|
|
248
|
+
name: 'gemini-3-flash-preview',
|
|
249
|
+
label: 'Gemini 3 Flash',
|
|
250
|
+
description: 'Current Gemini 3 flash line',
|
|
251
|
+
providerId: 'google',
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
id: 'gemini-2.5-pro',
|
|
255
|
+
name: 'gemini-2.5-pro',
|
|
256
|
+
label: 'Gemini 2.5 Pro',
|
|
257
|
+
description: 'Stable Gemini 2.5 pro',
|
|
258
|
+
providerId: 'google',
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
id: 'gemini-2.5-flash',
|
|
262
|
+
name: 'gemini-2.5-flash',
|
|
263
|
+
label: 'Gemini 2.5 Flash',
|
|
264
|
+
description: 'Stable Gemini 2.5 flash',
|
|
265
|
+
providerId: 'google',
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
},
|
|
269
|
+
custom: {
|
|
270
|
+
runtimeId: 'gemini-custom',
|
|
271
|
+
label: 'Custom',
|
|
272
|
+
models: [],
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
|
|
277
|
+
qwen: {
|
|
278
|
+
id: 'qwen',
|
|
279
|
+
name: 'Qwen Code',
|
|
280
|
+
icon: 'Cpu',
|
|
281
|
+
endpoint: ENGINE_ENDPOINTS.qwen,
|
|
282
|
+
lanes: {
|
|
283
|
+
native: {
|
|
284
|
+
runtimeId: 'qwen-native',
|
|
285
|
+
label: 'Native',
|
|
286
|
+
models: [
|
|
287
|
+
{
|
|
288
|
+
id: 'qwen3-coder-plus',
|
|
289
|
+
name: 'qwen3-coder-plus',
|
|
290
|
+
label: 'Qwen 3 Coder Plus',
|
|
291
|
+
description: 'Primary Qwen coding model',
|
|
292
|
+
providerId: 'qwen',
|
|
293
|
+
default: true,
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
id: 'qwen3-coder-next',
|
|
297
|
+
name: 'qwen3-coder-next',
|
|
298
|
+
label: 'Qwen 3 Coder Next',
|
|
299
|
+
description: 'Latest Qwen coding lane',
|
|
300
|
+
providerId: 'qwen',
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
id: 'qwen3.5-plus',
|
|
304
|
+
name: 'qwen3.5-plus',
|
|
305
|
+
label: 'Qwen 3.5 Plus',
|
|
306
|
+
description: 'Higher-capability Qwen lane',
|
|
307
|
+
providerId: 'qwen',
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
id: 'qwen3-max',
|
|
311
|
+
name: 'qwen3-max',
|
|
312
|
+
label: 'Qwen 3 Max',
|
|
313
|
+
description: 'Largest Qwen lane',
|
|
314
|
+
providerId: 'qwen',
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
},
|
|
318
|
+
custom: {
|
|
319
|
+
runtimeId: 'qwen-custom',
|
|
320
|
+
label: 'Custom',
|
|
321
|
+
models: [
|
|
322
|
+
{
|
|
323
|
+
id: 'glm-4.7',
|
|
324
|
+
name: 'glm-4.7',
|
|
325
|
+
label: 'GLM 4.7',
|
|
326
|
+
description: 'Provider-side custom lane supported by Qwen Code',
|
|
327
|
+
providerId: 'zai',
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
id: 'kimi-k2.5',
|
|
331
|
+
name: 'kimi-k2.5',
|
|
332
|
+
label: 'Kimi K2.5',
|
|
333
|
+
description: 'Provider-side custom lane supported by Qwen Code',
|
|
334
|
+
providerId: 'kimi',
|
|
335
|
+
},
|
|
336
|
+
],
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
function flattenEngineModels(engineId, engine) {
|
|
343
|
+
return Object.entries(engine.lanes || {}).flatMap(([laneId, lane]) =>
|
|
344
|
+
(lane.models || []).map((model) => ({
|
|
345
|
+
...model,
|
|
346
|
+
lane: laneId,
|
|
347
|
+
laneLabel: lane.label || laneId,
|
|
348
|
+
runtimeId: model.runtimeId || lane.runtimeId,
|
|
349
|
+
category: engineId,
|
|
350
|
+
engine: engineId,
|
|
351
|
+
endpoint: engine.endpoint,
|
|
352
|
+
custom: laneId === 'custom',
|
|
353
|
+
}))
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function getCatalog() {
|
|
358
|
+
return JSON.parse(JSON.stringify(CATALOG));
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
function getCliTools() {
|
|
362
|
+
const catalog = getCatalog();
|
|
363
|
+
const tools = {};
|
|
364
|
+
|
|
365
|
+
for (const [engineId, engine] of Object.entries(catalog)) {
|
|
366
|
+
tools[engineId] = {
|
|
367
|
+
id: engineId,
|
|
368
|
+
name: engine.name,
|
|
369
|
+
icon: engine.icon,
|
|
175
370
|
enabled: true,
|
|
176
|
-
endpoint:
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
id: 'vision-model',
|
|
188
|
-
name: 'vision-model',
|
|
189
|
-
label: 'Qwen Vision',
|
|
190
|
-
description: '👁️ Vision-capable model',
|
|
191
|
-
category: 'qwen'
|
|
192
|
-
}
|
|
193
|
-
]
|
|
194
|
-
}
|
|
195
|
-
};
|
|
371
|
+
endpoint: engine.endpoint,
|
|
372
|
+
thinkModes: engine.thinkModes || [],
|
|
373
|
+
defaultThinkMode: engine.defaultThinkMode,
|
|
374
|
+
lanes: engine.lanes,
|
|
375
|
+
models: flattenEngineModels(engineId, engine),
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return tools;
|
|
196
380
|
}
|
|
197
381
|
|
|
198
382
|
function getAllModels() {
|
|
199
|
-
return Object.values(getCliTools()).flatMap(cli => cli.models || []);
|
|
383
|
+
return Object.values(getCliTools()).flatMap((cli) => cli.models || []);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function getModelById(modelId) {
|
|
387
|
+
if (!modelId) return null;
|
|
388
|
+
return getAllModels().find((model) => model.id === modelId) || null;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function getEngineForModel(modelId) {
|
|
392
|
+
return getModelById(modelId)?.engine || null;
|
|
200
393
|
}
|
|
201
394
|
|
|
202
395
|
function isValidModelId(modelId) {
|
|
203
|
-
|
|
204
|
-
return getAllModels().some(m => m.id === modelId);
|
|
396
|
+
return Boolean(getModelById(modelId));
|
|
205
397
|
}
|
|
206
398
|
|
|
207
399
|
function getDefaultModelId() {
|
|
208
400
|
const models = getAllModels();
|
|
209
|
-
const withDefault = models.find(m => m.default);
|
|
401
|
+
const withDefault = models.find((m) => m.default);
|
|
210
402
|
return withDefault ? withDefault.id : (models[0]?.id || null);
|
|
211
403
|
}
|
|
212
404
|
|
|
213
405
|
module.exports = {
|
|
406
|
+
ENGINE_ENDPOINTS,
|
|
407
|
+
getCatalog,
|
|
214
408
|
getCliTools,
|
|
215
409
|
getAllModels,
|
|
410
|
+
getModelById,
|
|
411
|
+
getEngineForModel,
|
|
216
412
|
isValidModelId,
|
|
217
|
-
getDefaultModelId
|
|
413
|
+
getDefaultModelId,
|
|
218
414
|
};
|