openfox 1.6.19 → 1.6.21
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/{auto-compaction-A657A2UQ.js → auto-compaction-U75EINMB.js} +4 -4
- package/dist/{chat-handler-2NXHPPMS.js → chat-handler-JEMPI5UF.js} +6 -6
- package/dist/{chunk-IN5EP4ZB.js → chunk-6NPMZFMP.js} +2 -2
- package/dist/{chunk-KCJC3VBS.js → chunk-AU33PQAB.js} +2 -2
- package/dist/{chunk-QY7BMXWT.js → chunk-B7E3BICY.js} +6 -2
- package/dist/{chunk-OVLFEBRR.js → chunk-FX4SUY2S.js} +27 -373
- package/dist/{chunk-N2V2K5QV.js → chunk-HWOYZ245.js} +6 -6
- package/dist/{chunk-6TWWJIFP.js → chunk-HZP2V5Z6.js} +63 -15
- package/dist/{chunk-7IOZFJBW.js → chunk-RN2O6JK7.js} +15 -2
- package/dist/{chunk-AE7FYMCR.js → chunk-SJVEX2NR.js} +45 -27
- package/dist/{chunk-KOUMYBYM.js → chunk-WINI5HX7.js} +54 -3
- package/dist/{chunk-ZDNXCVW4.js → chunk-XRGMFOVG.js} +11 -5
- package/dist/chunk-XYD5JXRM.js +483 -0
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{config-67AX6CNS.js → config-SWDAJMQ3.js} +5 -5
- package/dist/{orchestrator-VWMGHSCG.js → orchestrator-T2IPRZ7B.js} +5 -5
- package/dist/package.json +1 -1
- package/dist/{processor-7TH3ATDK.js → processor-VKFEOK46.js} +2 -2
- package/dist/{protocol-I7rn7Msg.d.ts → protocol-BYM6rZvW.d.ts} +12 -0
- package/dist/{provider-DKGBQHUS.js → provider-CDM4LQAC.js} +9 -8
- package/dist/{serve-CJKXYYIA.js → serve-X3PKC27B.js} +11 -11
- package/dist/server/index.d.ts +24 -1
- package/dist/server/index.js +9 -9
- package/dist/{settings-NCLN4JDZ.js → settings-3K6P2JN6.js} +4 -2
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.js +1 -1
- package/dist/{tools-F7RWE4YI.js → tools-4ODVFMW7.js} +4 -4
- package/dist/{vision-fallback-ADYRFFD4.js → vision-fallback-VXGCQKLA.js} +2 -2
- package/dist/web/assets/{index-CcnXf371.css → index-B9-lT3Kc.css} +1 -1
- package/dist/web/assets/index-DHP3d5Cl.js +151 -0
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-55N6FAAZ.js +0 -117
- package/dist/web/assets/index-CLd1Kqv-.js +0 -151
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
import {
|
|
2
|
+
logger
|
|
3
|
+
} from "./chunk-PNBH3RAX.js";
|
|
4
|
+
|
|
5
|
+
// src/server/llm/backend.ts
|
|
6
|
+
var BACKEND_CAPABILITIES = {
|
|
7
|
+
vllm: {
|
|
8
|
+
supportsReasoningField: true,
|
|
9
|
+
supportsChatTemplateKwargs: true,
|
|
10
|
+
supportsTopK: true
|
|
11
|
+
},
|
|
12
|
+
sglang: {
|
|
13
|
+
supportsReasoningField: true,
|
|
14
|
+
supportsChatTemplateKwargs: true,
|
|
15
|
+
supportsTopK: true
|
|
16
|
+
},
|
|
17
|
+
ollama: {
|
|
18
|
+
supportsReasoningField: false,
|
|
19
|
+
supportsChatTemplateKwargs: false,
|
|
20
|
+
supportsTopK: false
|
|
21
|
+
},
|
|
22
|
+
llamacpp: {
|
|
23
|
+
supportsReasoningField: false,
|
|
24
|
+
supportsChatTemplateKwargs: false,
|
|
25
|
+
supportsTopK: true
|
|
26
|
+
},
|
|
27
|
+
"opencode-go": {
|
|
28
|
+
supportsReasoningField: false,
|
|
29
|
+
supportsChatTemplateKwargs: false,
|
|
30
|
+
supportsTopK: true
|
|
31
|
+
},
|
|
32
|
+
unknown: {
|
|
33
|
+
// Assume vLLM-like for unknown backends
|
|
34
|
+
supportsReasoningField: true,
|
|
35
|
+
supportsChatTemplateKwargs: true,
|
|
36
|
+
supportsTopK: true
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
function getBackendCapabilities(backend) {
|
|
40
|
+
return BACKEND_CAPABILITIES[backend];
|
|
41
|
+
}
|
|
42
|
+
async function detectBackend(baseUrl, explicitBackend, silent = false) {
|
|
43
|
+
if (explicitBackend && explicitBackend !== "unknown") {
|
|
44
|
+
if (silent) {
|
|
45
|
+
logger.debug("Using explicit backend", { backend: explicitBackend });
|
|
46
|
+
} else {
|
|
47
|
+
logger.info("Using explicit backend", { backend: explicitBackend });
|
|
48
|
+
}
|
|
49
|
+
return explicitBackend;
|
|
50
|
+
}
|
|
51
|
+
const probeUrl = baseUrl.replace(/\/v1\/?$/, "");
|
|
52
|
+
try {
|
|
53
|
+
if (await probeOllama(probeUrl)) {
|
|
54
|
+
if (silent) {
|
|
55
|
+
logger.debug("Detected Ollama backend", { url: probeUrl });
|
|
56
|
+
} else {
|
|
57
|
+
logger.info("Detected Ollama backend", { url: probeUrl });
|
|
58
|
+
}
|
|
59
|
+
return "ollama";
|
|
60
|
+
}
|
|
61
|
+
if (await probeLlamaCpp(probeUrl)) {
|
|
62
|
+
if (silent) {
|
|
63
|
+
logger.debug("Detected llama.cpp backend", { url: probeUrl });
|
|
64
|
+
} else {
|
|
65
|
+
logger.info("Detected llama.cpp backend", { url: probeUrl });
|
|
66
|
+
}
|
|
67
|
+
return "llamacpp";
|
|
68
|
+
}
|
|
69
|
+
if (await probeSGLang(probeUrl)) {
|
|
70
|
+
if (silent) {
|
|
71
|
+
logger.debug("Detected SGLang backend", { url: probeUrl });
|
|
72
|
+
} else {
|
|
73
|
+
logger.info("Detected SGLang backend", { url: probeUrl });
|
|
74
|
+
}
|
|
75
|
+
return "sglang";
|
|
76
|
+
}
|
|
77
|
+
if (await probeOpenAI(baseUrl)) {
|
|
78
|
+
if (silent) {
|
|
79
|
+
logger.debug("Detected vLLM backend (OpenAI-compatible)", { url: baseUrl });
|
|
80
|
+
} else {
|
|
81
|
+
logger.info("Detected vLLM backend (OpenAI-compatible)", { url: baseUrl });
|
|
82
|
+
}
|
|
83
|
+
return "vllm";
|
|
84
|
+
}
|
|
85
|
+
if (silent) {
|
|
86
|
+
logger.debug("Could not detect backend, using unknown", { url: baseUrl });
|
|
87
|
+
} else {
|
|
88
|
+
logger.warn("Could not detect backend, using unknown", { url: baseUrl });
|
|
89
|
+
}
|
|
90
|
+
return "unknown";
|
|
91
|
+
} catch (error) {
|
|
92
|
+
if (silent) {
|
|
93
|
+
logger.debug("Backend detection failed", {
|
|
94
|
+
url: baseUrl,
|
|
95
|
+
error: error instanceof Error ? error.message : String(error)
|
|
96
|
+
});
|
|
97
|
+
} else {
|
|
98
|
+
logger.warn("Backend detection failed", {
|
|
99
|
+
url: baseUrl,
|
|
100
|
+
error: error instanceof Error ? error.message : String(error)
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return "unknown";
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async function probeOllama(baseUrl) {
|
|
107
|
+
try {
|
|
108
|
+
const response = await fetch(`${baseUrl}/api/tags`, {
|
|
109
|
+
signal: AbortSignal.timeout(5e3)
|
|
110
|
+
});
|
|
111
|
+
return response.ok;
|
|
112
|
+
} catch {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async function probeLlamaCpp(baseUrl) {
|
|
117
|
+
try {
|
|
118
|
+
const response = await fetch(`${baseUrl}/health`, {
|
|
119
|
+
signal: AbortSignal.timeout(5e3)
|
|
120
|
+
});
|
|
121
|
+
if (!response.ok) return false;
|
|
122
|
+
const data = await response.json();
|
|
123
|
+
return "slots_idle" in data || "slots_processing" in data;
|
|
124
|
+
} catch {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async function probeSGLang(baseUrl) {
|
|
129
|
+
try {
|
|
130
|
+
const response = await fetch(`${baseUrl}/get_model_info`, {
|
|
131
|
+
signal: AbortSignal.timeout(5e3)
|
|
132
|
+
});
|
|
133
|
+
return response.ok;
|
|
134
|
+
} catch {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async function probeOpenAI(baseUrl) {
|
|
139
|
+
try {
|
|
140
|
+
const url = baseUrl.includes("/v1") ? baseUrl : `${baseUrl}/v1`;
|
|
141
|
+
const response = await fetch(`${url}/models`, {
|
|
142
|
+
signal: AbortSignal.timeout(5e3)
|
|
143
|
+
});
|
|
144
|
+
return response.ok;
|
|
145
|
+
} catch {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function getBackendDisplayName(backend) {
|
|
150
|
+
switch (backend) {
|
|
151
|
+
case "vllm":
|
|
152
|
+
return "vLLM";
|
|
153
|
+
case "sglang":
|
|
154
|
+
return "SGLang";
|
|
155
|
+
case "ollama":
|
|
156
|
+
return "Ollama";
|
|
157
|
+
case "llamacpp":
|
|
158
|
+
return "llama.cpp";
|
|
159
|
+
case "opencode-go":
|
|
160
|
+
return "OpenCode Go";
|
|
161
|
+
case "unknown":
|
|
162
|
+
return "Unknown";
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// src/server/llm/profiles.ts
|
|
167
|
+
var DEFAULT_PROFILE = {
|
|
168
|
+
name: "default",
|
|
169
|
+
temperature: 0.7,
|
|
170
|
+
topP: 0.9,
|
|
171
|
+
supportsReasoning: false,
|
|
172
|
+
reasoningAsContent: false,
|
|
173
|
+
defaultMaxTokens: 4096,
|
|
174
|
+
supportsVision: true
|
|
175
|
+
};
|
|
176
|
+
var MOCK_PROFILE = {
|
|
177
|
+
name: "mock",
|
|
178
|
+
temperature: 0.7,
|
|
179
|
+
topP: 0.9,
|
|
180
|
+
supportsReasoning: false,
|
|
181
|
+
reasoningAsContent: false,
|
|
182
|
+
defaultMaxTokens: 1024,
|
|
183
|
+
supportsVision: false
|
|
184
|
+
};
|
|
185
|
+
var MODEL_PROFILES = [
|
|
186
|
+
{
|
|
187
|
+
pattern: "mistral",
|
|
188
|
+
profile: {
|
|
189
|
+
name: "Mistral",
|
|
190
|
+
temperature: 0.7,
|
|
191
|
+
topP: 0.9,
|
|
192
|
+
supportsReasoning: false,
|
|
193
|
+
reasoningAsContent: false,
|
|
194
|
+
defaultMaxTokens: 16384,
|
|
195
|
+
supportsVision: false
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
pattern: "qwen3-coder-next",
|
|
200
|
+
profile: {
|
|
201
|
+
name: "Qwen3-Coder-Next",
|
|
202
|
+
// Per Qwen docs: "temperature=1.0, top_p=0.95, top_k=40"
|
|
203
|
+
temperature: 1,
|
|
204
|
+
topP: 0.95,
|
|
205
|
+
topK: 40,
|
|
206
|
+
// "This model supports only non-thinking mode and does not generate <think></think> blocks"
|
|
207
|
+
supportsReasoning: false,
|
|
208
|
+
reasoningAsContent: false,
|
|
209
|
+
defaultMaxTokens: 16384,
|
|
210
|
+
supportsVision: false
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
pattern: "qwen3",
|
|
215
|
+
profile: {
|
|
216
|
+
name: "Qwen3",
|
|
217
|
+
temperature: 0.7,
|
|
218
|
+
topP: 0.9,
|
|
219
|
+
supportsReasoning: true,
|
|
220
|
+
reasoningAsContent: false,
|
|
221
|
+
defaultMaxTokens: 16384,
|
|
222
|
+
supportsVision: false
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
pattern: "qwen3-vl",
|
|
227
|
+
profile: {
|
|
228
|
+
name: "Qwen3-VL",
|
|
229
|
+
temperature: 0.7,
|
|
230
|
+
topP: 0.9,
|
|
231
|
+
supportsReasoning: true,
|
|
232
|
+
reasoningAsContent: false,
|
|
233
|
+
defaultMaxTokens: 16384,
|
|
234
|
+
supportsVision: true
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
pattern: "deepseek",
|
|
239
|
+
profile: {
|
|
240
|
+
name: "DeepSeek",
|
|
241
|
+
temperature: 0.6,
|
|
242
|
+
topP: 0.95,
|
|
243
|
+
supportsReasoning: true,
|
|
244
|
+
reasoningAsContent: false,
|
|
245
|
+
defaultMaxTokens: 16384,
|
|
246
|
+
supportsVision: false
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
pattern: "minimax-m2.5",
|
|
251
|
+
profile: {
|
|
252
|
+
name: "MiniMax-M2.5",
|
|
253
|
+
temperature: 1,
|
|
254
|
+
topP: 0.95,
|
|
255
|
+
topK: 40,
|
|
256
|
+
supportsReasoning: true,
|
|
257
|
+
reasoningAsContent: false,
|
|
258
|
+
defaultMaxTokens: 16384,
|
|
259
|
+
supportsVision: false
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
pattern: "minimax-m2.7",
|
|
264
|
+
profile: {
|
|
265
|
+
name: "MiniMax-M2.7",
|
|
266
|
+
temperature: 1,
|
|
267
|
+
topP: 0.95,
|
|
268
|
+
topK: 40,
|
|
269
|
+
supportsReasoning: true,
|
|
270
|
+
reasoningAsContent: false,
|
|
271
|
+
defaultMaxTokens: 16384,
|
|
272
|
+
supportsVision: false
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
pattern: "minimax",
|
|
277
|
+
profile: {
|
|
278
|
+
name: "MiniMax",
|
|
279
|
+
temperature: 1,
|
|
280
|
+
topP: 0.95,
|
|
281
|
+
topK: 40,
|
|
282
|
+
supportsReasoning: true,
|
|
283
|
+
reasoningAsContent: false,
|
|
284
|
+
defaultMaxTokens: 16384,
|
|
285
|
+
supportsVision: false
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
pattern: "minimax-m3",
|
|
290
|
+
profile: {
|
|
291
|
+
name: "MiniMax-M3",
|
|
292
|
+
temperature: 1,
|
|
293
|
+
topP: 0.95,
|
|
294
|
+
topK: 40,
|
|
295
|
+
supportsReasoning: true,
|
|
296
|
+
reasoningAsContent: false,
|
|
297
|
+
defaultMaxTokens: 16384,
|
|
298
|
+
supportsVision: true
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
pattern: "llava",
|
|
303
|
+
profile: {
|
|
304
|
+
name: "LLaVA",
|
|
305
|
+
temperature: 0.7,
|
|
306
|
+
topP: 0.9,
|
|
307
|
+
supportsReasoning: false,
|
|
308
|
+
reasoningAsContent: false,
|
|
309
|
+
defaultMaxTokens: 16384,
|
|
310
|
+
supportsVision: true
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
pattern: "llama",
|
|
315
|
+
profile: {
|
|
316
|
+
name: "Llama",
|
|
317
|
+
temperature: 0.7,
|
|
318
|
+
topP: 0.9,
|
|
319
|
+
supportsReasoning: false,
|
|
320
|
+
reasoningAsContent: false,
|
|
321
|
+
defaultMaxTokens: 16384,
|
|
322
|
+
supportsVision: false
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
pattern: "claude",
|
|
327
|
+
profile: {
|
|
328
|
+
name: "Claude",
|
|
329
|
+
temperature: 0.7,
|
|
330
|
+
topP: 0.9,
|
|
331
|
+
supportsReasoning: true,
|
|
332
|
+
reasoningAsContent: false,
|
|
333
|
+
defaultMaxTokens: 16384,
|
|
334
|
+
supportsVision: false
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
pattern: "gemma-4",
|
|
339
|
+
profile: {
|
|
340
|
+
name: "Gemma 4",
|
|
341
|
+
temperature: 0.7,
|
|
342
|
+
topP: 0.9,
|
|
343
|
+
supportsReasoning: true,
|
|
344
|
+
reasoningAsContent: false,
|
|
345
|
+
defaultMaxTokens: 16384,
|
|
346
|
+
supportsVision: true
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
];
|
|
350
|
+
function getModelProfile(modelName) {
|
|
351
|
+
const lowerName = modelName.toLowerCase();
|
|
352
|
+
if (lowerName.includes("mock")) {
|
|
353
|
+
return MOCK_PROFILE;
|
|
354
|
+
}
|
|
355
|
+
for (const { pattern, profile } of MODEL_PROFILES) {
|
|
356
|
+
if (lowerName.includes(pattern.toLowerCase())) {
|
|
357
|
+
return profile;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return DEFAULT_PROFILE;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// src/server/llm/streaming.ts
|
|
364
|
+
var XML_TOOL_PATTERNS = ["<tool_call>", "<function=", "</tool_call>", "<parameter="];
|
|
365
|
+
function hasXmlToolPattern(text) {
|
|
366
|
+
return XML_TOOL_PATTERNS.some((p) => text.includes(p));
|
|
367
|
+
}
|
|
368
|
+
async function* streamWithSegments(client, request) {
|
|
369
|
+
const xmlAbortController = new AbortController();
|
|
370
|
+
const combinedSignal = request.signal ? AbortSignal.any([request.signal, xmlAbortController.signal]) : xmlAbortController.signal;
|
|
371
|
+
let content = "";
|
|
372
|
+
let thinkingContent = "";
|
|
373
|
+
let response = null;
|
|
374
|
+
const segments = [];
|
|
375
|
+
let currentTextSegment = "";
|
|
376
|
+
let currentThinkingSegment = "";
|
|
377
|
+
const startTime = performance.now();
|
|
378
|
+
let firstTokenTime = null;
|
|
379
|
+
const flushText = () => {
|
|
380
|
+
if (currentTextSegment.trim()) {
|
|
381
|
+
segments.push({ type: "text", content: currentTextSegment });
|
|
382
|
+
}
|
|
383
|
+
currentTextSegment = "";
|
|
384
|
+
};
|
|
385
|
+
const flushThinking = () => {
|
|
386
|
+
if (currentThinkingSegment.trim()) {
|
|
387
|
+
segments.push({ type: "thinking", content: currentThinkingSegment });
|
|
388
|
+
}
|
|
389
|
+
currentThinkingSegment = "";
|
|
390
|
+
};
|
|
391
|
+
try {
|
|
392
|
+
for await (const event of client.stream({ ...request, signal: combinedSignal })) {
|
|
393
|
+
switch (event.type) {
|
|
394
|
+
case "text_delta":
|
|
395
|
+
if (firstTokenTime === null) {
|
|
396
|
+
firstTokenTime = performance.now();
|
|
397
|
+
}
|
|
398
|
+
flushThinking();
|
|
399
|
+
content += event.content;
|
|
400
|
+
currentTextSegment += event.content;
|
|
401
|
+
if (hasXmlToolPattern(content)) {
|
|
402
|
+
xmlAbortController.abort();
|
|
403
|
+
yield { type: "xml_tool_abort" };
|
|
404
|
+
return null;
|
|
405
|
+
}
|
|
406
|
+
yield { type: "text_delta", content: event.content };
|
|
407
|
+
break;
|
|
408
|
+
case "thinking_delta":
|
|
409
|
+
if (firstTokenTime === null) {
|
|
410
|
+
firstTokenTime = performance.now();
|
|
411
|
+
}
|
|
412
|
+
flushText();
|
|
413
|
+
thinkingContent += event.content;
|
|
414
|
+
currentThinkingSegment += event.content;
|
|
415
|
+
if (hasXmlToolPattern(thinkingContent)) {
|
|
416
|
+
xmlAbortController.abort();
|
|
417
|
+
yield { type: "xml_tool_abort" };
|
|
418
|
+
return null;
|
|
419
|
+
}
|
|
420
|
+
yield { type: "thinking_delta", content: event.content };
|
|
421
|
+
break;
|
|
422
|
+
case "tool_call_delta":
|
|
423
|
+
yield {
|
|
424
|
+
type: "tool_call_delta",
|
|
425
|
+
index: event.index,
|
|
426
|
+
...event.id !== void 0 ? { id: event.id } : {},
|
|
427
|
+
...event.name !== void 0 ? { name: event.name } : {},
|
|
428
|
+
...event.arguments !== void 0 ? { arguments: event.arguments } : {}
|
|
429
|
+
};
|
|
430
|
+
break;
|
|
431
|
+
case "done":
|
|
432
|
+
flushThinking();
|
|
433
|
+
flushText();
|
|
434
|
+
response = event.response;
|
|
435
|
+
yield { type: "done", response: event.response };
|
|
436
|
+
break;
|
|
437
|
+
case "error":
|
|
438
|
+
yield { type: "error", error: event.error };
|
|
439
|
+
return null;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
} catch (error) {
|
|
443
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
444
|
+
return null;
|
|
445
|
+
}
|
|
446
|
+
yield { type: "error", error: error instanceof Error ? error.message : "Unknown error" };
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
449
|
+
if (!response) {
|
|
450
|
+
return null;
|
|
451
|
+
}
|
|
452
|
+
const toolCalls = response.toolCalls ?? [];
|
|
453
|
+
for (const tc of toolCalls) {
|
|
454
|
+
segments.push({ type: "tool_call", toolCallId: tc.id });
|
|
455
|
+
}
|
|
456
|
+
const endTime = performance.now();
|
|
457
|
+
const ttft = ((firstTokenTime ?? endTime) - startTime) / 1e3;
|
|
458
|
+
const completionTime = (endTime - (firstTokenTime ?? startTime)) / 1e3;
|
|
459
|
+
const { promptTokens, completionTokens } = response.usage;
|
|
460
|
+
const effectiveThinkingContent = thinkingContent || content === "" && response.reasoning_content || "";
|
|
461
|
+
return {
|
|
462
|
+
content,
|
|
463
|
+
thinkingContent: effectiveThinkingContent,
|
|
464
|
+
toolCalls,
|
|
465
|
+
response,
|
|
466
|
+
segments,
|
|
467
|
+
timing: {
|
|
468
|
+
ttft,
|
|
469
|
+
completionTime,
|
|
470
|
+
tps: completionTime > 0 ? completionTokens / completionTime : 0,
|
|
471
|
+
prefillTps: ttft > 0 ? promptTokens / ttft : 0
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
export {
|
|
477
|
+
getModelProfile,
|
|
478
|
+
getBackendCapabilities,
|
|
479
|
+
detectBackend,
|
|
480
|
+
getBackendDisplayName,
|
|
481
|
+
streamWithSegments
|
|
482
|
+
};
|
|
483
|
+
//# sourceMappingURL=chunk-XYD5JXRM.js.map
|
package/dist/cli/dev.js
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
saveGlobalConfig,
|
|
14
14
|
setDefaultModelSelection,
|
|
15
15
|
trySmartDefaults
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-XRGMFOVG.js";
|
|
17
|
+
import "./chunk-FX4SUY2S.js";
|
|
18
|
+
import "./chunk-XYD5JXRM.js";
|
|
19
19
|
import "./chunk-R4HADRYO.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-6NPMZFMP.js";
|
|
21
21
|
import "./chunk-PNBH3RAX.js";
|
|
22
22
|
export {
|
|
23
23
|
activateProvider,
|
|
@@ -35,4 +35,4 @@ export {
|
|
|
35
35
|
setDefaultModelSelection,
|
|
36
36
|
trySmartDefaults
|
|
37
37
|
};
|
|
38
|
-
//# sourceMappingURL=config-
|
|
38
|
+
//# sourceMappingURL=config-SWDAJMQ3.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
runBuilderTurn,
|
|
4
4
|
runChatTurn,
|
|
5
5
|
runVerifierTurn
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AU33PQAB.js";
|
|
7
7
|
import {
|
|
8
8
|
TurnMetrics,
|
|
9
9
|
createChatDoneEvent,
|
|
@@ -11,15 +11,15 @@ import {
|
|
|
11
11
|
createMessageStartEvent,
|
|
12
12
|
createToolCallEvent,
|
|
13
13
|
createToolResultEvent
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-HZP2V5Z6.js";
|
|
15
15
|
import "./chunk-NBU6KIOD.js";
|
|
16
16
|
import "./chunk-574HZVLE.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-XYD5JXRM.js";
|
|
18
18
|
import "./chunk-PMDJEJYY.js";
|
|
19
19
|
import "./chunk-EEPU4INU.js";
|
|
20
20
|
import "./chunk-DZHZ3UUR.js";
|
|
21
21
|
import "./chunk-22CTURMH.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-RN2O6JK7.js";
|
|
23
23
|
import "./chunk-XKFPU2FA.js";
|
|
24
24
|
import "./chunk-3EHGGBWE.js";
|
|
25
25
|
import "./chunk-Y6HBEACI.js";
|
|
@@ -38,4 +38,4 @@ export {
|
|
|
38
38
|
runChatTurn,
|
|
39
39
|
runVerifierTurn
|
|
40
40
|
};
|
|
41
|
-
//# sourceMappingURL=orchestrator-
|
|
41
|
+
//# sourceMappingURL=orchestrator-T2IPRZ7B.js.map
|
package/dist/package.json
CHANGED
|
@@ -175,7 +175,7 @@ var QueueProcessor = class {
|
|
|
175
175
|
backend: provider?.backend ?? llmClient.getBackend(),
|
|
176
176
|
model: llmClient.getModel()
|
|
177
177
|
};
|
|
178
|
-
const { runChatTurn } = await import("./orchestrator-
|
|
178
|
+
const { runChatTurn } = await import("./orchestrator-T2IPRZ7B.js");
|
|
179
179
|
const runChatTurnParams = buildRunChatTurnParams({
|
|
180
180
|
sessionManager,
|
|
181
181
|
sessionId,
|
|
@@ -208,4 +208,4 @@ var QueueProcessor = class {
|
|
|
208
208
|
export {
|
|
209
209
|
QueueProcessor
|
|
210
210
|
};
|
|
211
|
-
//# sourceMappingURL=processor-
|
|
211
|
+
//# sourceMappingURL=processor-VKFEOK46.js.map
|
|
@@ -106,6 +106,10 @@ interface LLMCallStats {
|
|
|
106
106
|
generationSpeed: number;
|
|
107
107
|
totalTime: number;
|
|
108
108
|
timestamp?: string;
|
|
109
|
+
temperature?: number;
|
|
110
|
+
topP?: number;
|
|
111
|
+
topK?: number;
|
|
112
|
+
maxTokens?: number;
|
|
109
113
|
}
|
|
110
114
|
interface StatsDataPoint {
|
|
111
115
|
messageId: string;
|
|
@@ -142,6 +146,10 @@ interface CallStatsDataPoint {
|
|
|
142
146
|
prefillSpeed: number;
|
|
143
147
|
generationSpeed: number;
|
|
144
148
|
totalTime: number;
|
|
149
|
+
temperature?: number;
|
|
150
|
+
topP?: number;
|
|
151
|
+
topK?: number;
|
|
152
|
+
maxTokens?: number;
|
|
145
153
|
}
|
|
146
154
|
interface SessionStats {
|
|
147
155
|
totalTime: number;
|
|
@@ -405,6 +413,10 @@ interface ModelConfig {
|
|
|
405
413
|
id: string;
|
|
406
414
|
contextWindow: number;
|
|
407
415
|
source: 'backend' | 'user' | 'default';
|
|
416
|
+
temperature?: number;
|
|
417
|
+
topP?: number;
|
|
418
|
+
topK?: number;
|
|
419
|
+
maxTokens?: number;
|
|
408
420
|
}
|
|
409
421
|
/** LLM provider configuration */
|
|
410
422
|
interface Provider {
|
|
@@ -5,17 +5,18 @@ import {
|
|
|
5
5
|
loadGlobalConfig,
|
|
6
6
|
removeProvider,
|
|
7
7
|
saveGlobalConfig
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XRGMFOVG.js";
|
|
9
9
|
import {
|
|
10
10
|
fetchAvailableModelsFromBackend
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WINI5HX7.js";
|
|
12
12
|
import {
|
|
13
|
-
detectBackend,
|
|
14
13
|
detectModel
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import
|
|
14
|
+
} from "./chunk-FX4SUY2S.js";
|
|
15
|
+
import {
|
|
16
|
+
detectBackend
|
|
17
|
+
} from "./chunk-XYD5JXRM.js";
|
|
17
18
|
import "./chunk-R4HADRYO.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-6NPMZFMP.js";
|
|
19
20
|
import "./chunk-PNBH3RAX.js";
|
|
20
21
|
|
|
21
22
|
// src/cli/provider.ts
|
|
@@ -248,7 +249,7 @@ async function runProviderAdd(mode) {
|
|
|
248
249
|
isActive: makeActive
|
|
249
250
|
});
|
|
250
251
|
if (makeActive) {
|
|
251
|
-
const { setDefaultModelSelection } = await import("./config-
|
|
252
|
+
const { setDefaultModelSelection } = await import("./config-SWDAJMQ3.js");
|
|
252
253
|
newConfig = setDefaultModelSelection(newConfig, newConfig.providers[newConfig.providers.length - 1].id, selectedModel);
|
|
253
254
|
}
|
|
254
255
|
await saveGlobalConfig(mode, newConfig);
|
|
@@ -372,4 +373,4 @@ export {
|
|
|
372
373
|
runProviderRemove,
|
|
373
374
|
runProviderUse
|
|
374
375
|
};
|
|
375
|
-
//# sourceMappingURL=provider-
|
|
376
|
+
//# sourceMappingURL=provider-CDM4LQAC.js.map
|
|
@@ -2,27 +2,27 @@ import {
|
|
|
2
2
|
getActiveProvider,
|
|
3
3
|
getDefaultModel,
|
|
4
4
|
loadGlobalConfig
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-XRGMFOVG.js";
|
|
6
6
|
import {
|
|
7
7
|
VERSION,
|
|
8
8
|
createServer
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SJVEX2NR.js";
|
|
10
10
|
import "./chunk-AV45GQ7B.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-AU33PQAB.js";
|
|
12
|
+
import "./chunk-HZP2V5Z6.js";
|
|
13
13
|
import "./chunk-NBU6KIOD.js";
|
|
14
14
|
import "./chunk-574HZVLE.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-WINI5HX7.js";
|
|
16
|
+
import "./chunk-FX4SUY2S.js";
|
|
17
|
+
import "./chunk-XYD5JXRM.js";
|
|
18
18
|
import "./chunk-PMDJEJYY.js";
|
|
19
19
|
import "./chunk-EEPU4INU.js";
|
|
20
20
|
import "./chunk-DZHZ3UUR.js";
|
|
21
21
|
import "./chunk-22CTURMH.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-RN2O6JK7.js";
|
|
23
23
|
import "./chunk-XKFPU2FA.js";
|
|
24
24
|
import "./chunk-3EHGGBWE.js";
|
|
25
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-B7E3BICY.js";
|
|
26
26
|
import "./chunk-Y6HBEACI.js";
|
|
27
27
|
import {
|
|
28
28
|
ensureDataDirExists,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import {
|
|
33
33
|
loadConfig
|
|
34
34
|
} from "./chunk-TVQOONDR.js";
|
|
35
|
-
import "./chunk-
|
|
35
|
+
import "./chunk-6NPMZFMP.js";
|
|
36
36
|
import {
|
|
37
37
|
logger
|
|
38
38
|
} from "./chunk-PNBH3RAX.js";
|
|
@@ -188,4 +188,4 @@ async function runServe(options) {
|
|
|
188
188
|
export {
|
|
189
189
|
runServe
|
|
190
190
|
};
|
|
191
|
-
//# sourceMappingURL=serve-
|
|
191
|
+
//# sourceMappingURL=serve-X3PKC27B.js.map
|