openfox 2.0.124 → 2.0.126
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 +24 -0
- package/README.md +1 -0
- package/dist/CHANGELOG.md +24 -0
- package/dist/{backend-67OLCS5O.js → backend-4YPEC3J2.js} +2 -2
- package/dist/{chat-handler-N43TBYLV.js → chat-handler-OJ4XBQY4.js} +13 -13
- package/dist/{chunk-QJNBQCAF.js → chunk-2UPFWNC4.js} +4 -4
- package/dist/{chunk-57UCBFBD.js → chunk-6VW4BQMP.js} +9 -9
- package/dist/{chunk-5CCM655F.js → chunk-76A3E4LK.js} +35 -19
- package/dist/{chunk-KGFERMCV.js → chunk-77PJWQR7.js} +6 -6
- package/dist/chunk-ABCCTPBC.js +7 -0
- package/dist/{chunk-UGEFD67O.js → chunk-CTHRGR4O.js} +2 -2
- package/dist/{chunk-SYTEO5LA.js → chunk-FNXTJLCZ.js} +197 -8
- package/dist/{chunk-RXLAFEZB.js → chunk-H2RZDEVL.js} +4 -4
- package/dist/{chunk-W4SM4FFZ.js → chunk-HOSFRPPI.js} +14 -10
- package/dist/{chunk-MIPQOHWS.js → chunk-KAZWU73N.js} +26 -2
- package/dist/{chunk-62GUO2EG.js → chunk-LJX7KXRU.js} +3 -3
- package/dist/{chunk-AZHWLLPP.js → chunk-PBFGJFGC.js} +28 -10
- package/dist/{chunk-A6EZBX62.js → chunk-T3JVYO3Z.js} +16 -6
- package/dist/{chunk-FAL4WO4V.js → chunk-TP2PGZSE.js} +3 -3
- package/dist/{chunk-JEZN37KV.js → chunk-UAAFZEIS.js} +2 -2
- package/dist/{chunk-3NMLSANH.js → chunk-Y3BSBKHY.js} +31 -17
- package/dist/chunk-ZFNBATE3.js +196 -0
- package/dist/{chunk-VUBFPRKT.js → chunk-ZS55MMG6.js} +58 -51
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{client-XHJHOFMU.js → client-YHYIWZY7.js} +5 -5
- package/dist/{client-pure-QSY7TJGK.js → client-pure-CJKM3ACP.js} +2 -2
- package/dist/{compactor-VTATJTPN.js → compactor-7KPBTFZF.js} +5 -5
- package/dist/{dynamic-context-KTQCAPTK.js → dynamic-context-PYAUG2LP.js} +2 -2
- package/dist/{http-client-N4ASJEKJ.js → http-client-ROVNSHF6.js} +2 -2
- package/dist/{launch-Z5D5YFRJ.js → launch-3F2GCRRF.js} +13 -13
- package/dist/{orchestrator-BQBBO4US.js → orchestrator-BRHIA2KE.js} +12 -12
- package/dist/package.json +1 -1
- package/dist/plugins-registry.json +6 -0
- package/dist/{processor-WTRVYXAO.js → processor-2IFXIJXG.js} +12 -12
- package/dist/provider/index.d.ts +2 -2
- package/dist/{provider-LICG53GG.js → provider-6LUA73HF.js} +6 -6
- package/dist/{provider-manager-3QC2MSSR.js → provider-manager-OQTEXZ7X.js} +6 -6
- package/dist/{serve-75G5Z7UQ.js → serve-WJKFUMLI.js} +18 -18
- package/dist/server/index.d.ts +6 -1
- package/dist/server/index.js +17 -17
- package/dist/{server-N3VATHIA.js → server-6LDC4HU6.js} +16 -16
- package/dist/{service-OURGS2SI.js → service-BRKMLM4C.js} +7 -7
- package/dist/{tasks-4SOLTX6A.js → tasks-DEUZ6BNS.js} +7 -7
- package/dist/{tools-G44LBKD4.js → tools-AOLICK5U.js} +10 -10
- package/dist/{types-Cr4EgGwK.d.ts → types-BWuVnaBw.d.ts} +3 -1
- package/dist/{update-R2TEHD7V.js → update-VH75MTCP.js} +2 -2
- package/dist/web/assets/index-DQ3Wg2OF.js +324 -0
- package/dist/web/index.html +1 -1
- package/dist/web/sw.js +1 -1
- package/dist/{workspace-J3JEGF6U.js → workspace-6CUE26YA.js} +2 -2
- package/package.json +1 -1
- package/plugins-registry.json +6 -0
- package/dist/chunk-SBADOWVC.js +0 -7
- package/dist/chunk-VPRB5FNR.js +0 -167
- package/dist/web/assets/index-GZTGHRRr.js +0 -324
|
@@ -3,9 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-GJL3QSMP.js";
|
|
4
4
|
import {
|
|
5
5
|
getBackendCapabilities
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PBFGJFGC.js";
|
|
7
7
|
import {
|
|
8
|
-
ensureVersionPrefix
|
|
8
|
+
ensureVersionPrefix,
|
|
9
|
+
stripVersionPrefix
|
|
9
10
|
} from "./chunk-HNCM3D7Y.js";
|
|
10
11
|
import {
|
|
11
12
|
buildNonStreamingCreateParams,
|
|
@@ -13,15 +14,199 @@ import {
|
|
|
13
14
|
getThinking,
|
|
14
15
|
mapFinishReason,
|
|
15
16
|
parseToolArguments
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KAZWU73N.js";
|
|
17
18
|
import {
|
|
19
|
+
ChatHttpClient,
|
|
18
20
|
LLMError,
|
|
19
21
|
OpenAIHttpClient
|
|
20
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ZFNBATE3.js";
|
|
21
23
|
import {
|
|
22
24
|
logger
|
|
23
25
|
} from "./chunk-K44MW7JJ.js";
|
|
24
26
|
|
|
27
|
+
// src/server/llm/ollama-native.ts
|
|
28
|
+
function mapDoneReason(reason) {
|
|
29
|
+
switch (reason) {
|
|
30
|
+
case "length":
|
|
31
|
+
return "length";
|
|
32
|
+
case "tool_calls":
|
|
33
|
+
return "tool_calls";
|
|
34
|
+
case "content_filter":
|
|
35
|
+
return "content_filter";
|
|
36
|
+
default:
|
|
37
|
+
return "stop";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function stringifyToolArguments(rawArguments) {
|
|
41
|
+
if (typeof rawArguments === "string") return rawArguments;
|
|
42
|
+
if (rawArguments === void 0 || rawArguments === null) return "{}";
|
|
43
|
+
return JSON.stringify(rawArguments);
|
|
44
|
+
}
|
|
45
|
+
var OLLAMA_THINK_LEVELS = /* @__PURE__ */ new Set(["low", "medium", "high", "max"]);
|
|
46
|
+
function toOllamaThink(effort) {
|
|
47
|
+
if (effort === "none") return false;
|
|
48
|
+
if (effort === "xhigh") return "max";
|
|
49
|
+
if (OLLAMA_THINK_LEVELS.has(effort)) return effort;
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
function toNativeMessage(message) {
|
|
53
|
+
const raw = message;
|
|
54
|
+
const toolCalls = raw["tool_calls"];
|
|
55
|
+
if (!Array.isArray(toolCalls) || toolCalls.length === 0) {
|
|
56
|
+
return raw;
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
...raw,
|
|
60
|
+
tool_calls: toolCalls.map((toolCall) => {
|
|
61
|
+
const fn = toolCall.function;
|
|
62
|
+
if (!fn || typeof fn.arguments !== "string") return toolCall;
|
|
63
|
+
try {
|
|
64
|
+
return {
|
|
65
|
+
...toolCall,
|
|
66
|
+
function: { ...fn, arguments: JSON.parse(fn.arguments) }
|
|
67
|
+
};
|
|
68
|
+
} catch {
|
|
69
|
+
return toolCall;
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function buildOllamaChatRequest(params) {
|
|
75
|
+
const options = {};
|
|
76
|
+
if (params.temperature !== void 0) options["temperature"] = params.temperature;
|
|
77
|
+
if (params.top_p !== void 0) options["top_p"] = params.top_p;
|
|
78
|
+
if (params.top_k !== void 0) options["top_k"] = params.top_k;
|
|
79
|
+
if (params.max_tokens !== void 0) options["num_predict"] = params.max_tokens;
|
|
80
|
+
if (params["num_ctx"] !== void 0) options["num_ctx"] = params["num_ctx"];
|
|
81
|
+
if (params["stop"]) options["stop"] = params["stop"];
|
|
82
|
+
if (params["frequency_penalty"] !== void 0) options["frequency_penalty"] = params["frequency_penalty"];
|
|
83
|
+
if (params["presence_penalty"] !== void 0) options["presence_penalty"] = params["presence_penalty"];
|
|
84
|
+
if (params["seed"] !== void 0) options["seed"] = params["seed"];
|
|
85
|
+
const body = {
|
|
86
|
+
model: params.model,
|
|
87
|
+
messages: params.messages.map(toNativeMessage),
|
|
88
|
+
stream: Boolean(params.stream),
|
|
89
|
+
...params.tools && params.tools.length > 0 ? { tools: params.tools } : {},
|
|
90
|
+
...Object.keys(options).length > 0 ? { options } : {}
|
|
91
|
+
};
|
|
92
|
+
if (params["response_format"] && typeof params["response_format"] === "object") {
|
|
93
|
+
const type = params["response_format"].type;
|
|
94
|
+
if (type === "json_object" || type === "json") {
|
|
95
|
+
body["format"] = "json";
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const kwargs = params.chat_template_kwargs;
|
|
99
|
+
if (kwargs && typeof kwargs["enable_thinking"] === "boolean") {
|
|
100
|
+
body["think"] = kwargs["enable_thinking"];
|
|
101
|
+
}
|
|
102
|
+
if (params.reasoning_effort) {
|
|
103
|
+
body["think"] = toOllamaThink(params.reasoning_effort);
|
|
104
|
+
}
|
|
105
|
+
return body;
|
|
106
|
+
}
|
|
107
|
+
function nativeToolCallToOpenAIResponse(toolCall, index) {
|
|
108
|
+
const fn = toolCall.function ?? {};
|
|
109
|
+
return {
|
|
110
|
+
id: toolCall.id ?? `call_${index}`,
|
|
111
|
+
type: "function",
|
|
112
|
+
function: {
|
|
113
|
+
name: fn.name ?? "",
|
|
114
|
+
arguments: stringifyToolArguments(fn.arguments)
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function nativeToolCallToOpenAIStream(toolCall, index) {
|
|
119
|
+
const fn = toolCall.function ?? {};
|
|
120
|
+
return {
|
|
121
|
+
index: typeof fn.index === "number" ? fn.index : index,
|
|
122
|
+
id: toolCall.id ?? `call_${index}`,
|
|
123
|
+
function: {
|
|
124
|
+
name: fn.name ?? "",
|
|
125
|
+
arguments: stringifyToolArguments(fn.arguments)
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function parseOllamaChatResponse(data) {
|
|
130
|
+
const msg = data.message ?? {};
|
|
131
|
+
const toolCalls = (msg.tool_calls ?? []).map(nativeToolCallToOpenAIResponse);
|
|
132
|
+
const promptTokens = typeof data.prompt_eval_count === "number" ? data.prompt_eval_count : 0;
|
|
133
|
+
const completionTokens = typeof data.eval_count === "number" ? data.eval_count : 0;
|
|
134
|
+
const message = {
|
|
135
|
+
content: msg.content ?? ""
|
|
136
|
+
};
|
|
137
|
+
if (msg.reasoning) message["reasoning_content"] = msg.reasoning;
|
|
138
|
+
if (msg.thinking) message["thinking"] = msg.thinking;
|
|
139
|
+
if (toolCalls.length > 0) message["tool_calls"] = toolCalls;
|
|
140
|
+
return {
|
|
141
|
+
id: `chatcmpl-${Date.now()}`,
|
|
142
|
+
choices: [
|
|
143
|
+
{
|
|
144
|
+
finish_reason: mapDoneReason(data.done_reason),
|
|
145
|
+
message
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
usage: {
|
|
149
|
+
prompt_tokens: promptTokens,
|
|
150
|
+
completion_tokens: completionTokens,
|
|
151
|
+
total_tokens: promptTokens + completionTokens
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function parseOllamaChatChunk(data) {
|
|
156
|
+
const msg = data.message ?? {};
|
|
157
|
+
const toolCalls = (msg.tool_calls ?? []).map(nativeToolCallToOpenAIStream);
|
|
158
|
+
const delta = {};
|
|
159
|
+
if (msg.content) delta["content"] = msg.content;
|
|
160
|
+
if (msg.reasoning) delta["reasoning_content"] = msg.reasoning;
|
|
161
|
+
if (msg.thinking) delta["thinking"] = msg.thinking;
|
|
162
|
+
if (toolCalls.length > 0) delta["tool_calls"] = toolCalls;
|
|
163
|
+
const promptTokens = typeof data.prompt_eval_count === "number" ? data.prompt_eval_count : void 0;
|
|
164
|
+
const completionTokens = typeof data.eval_count === "number" ? data.eval_count : void 0;
|
|
165
|
+
return {
|
|
166
|
+
id: `chatcmpl-${Date.now()}`,
|
|
167
|
+
choices: [
|
|
168
|
+
{
|
|
169
|
+
delta,
|
|
170
|
+
finish_reason: data.done ? mapDoneReason(data.done_reason) : null
|
|
171
|
+
}
|
|
172
|
+
],
|
|
173
|
+
...promptTokens !== void 0 ? {
|
|
174
|
+
usage: {
|
|
175
|
+
prompt_tokens: promptTokens,
|
|
176
|
+
completion_tokens: completionTokens ?? 0,
|
|
177
|
+
total_tokens: promptTokens + (completionTokens ?? 0)
|
|
178
|
+
}
|
|
179
|
+
} : {}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
var OllamaHttpClient = class extends ChatHttpClient {
|
|
183
|
+
baseURL;
|
|
184
|
+
constructor(options) {
|
|
185
|
+
super();
|
|
186
|
+
this.baseURL = options.baseURL;
|
|
187
|
+
}
|
|
188
|
+
buildRequest(params) {
|
|
189
|
+
return {
|
|
190
|
+
url: `${this.baseURL}/api/chat`,
|
|
191
|
+
headers: {
|
|
192
|
+
"Content-Type": "application/json"
|
|
193
|
+
},
|
|
194
|
+
body: JSON.stringify(buildOllamaChatRequest(params))
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
parseNonStreaming(data) {
|
|
198
|
+
return parseOllamaChatResponse(data);
|
|
199
|
+
}
|
|
200
|
+
parseStreamLine(trimmed) {
|
|
201
|
+
try {
|
|
202
|
+
return parseOllamaChatChunk(JSON.parse(trimmed));
|
|
203
|
+
} catch (error) {
|
|
204
|
+
logger.warn("Failed to parse Ollama stream chunk", { data: trimmed, error });
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
|
|
25
210
|
// src/server/llm/client.ts
|
|
26
211
|
function extractContentFromBlocks(blocks) {
|
|
27
212
|
let text = "";
|
|
@@ -39,12 +224,16 @@ function extractContentFromBlocks(blocks) {
|
|
|
39
224
|
}
|
|
40
225
|
return { text, thinking };
|
|
41
226
|
}
|
|
42
|
-
function createLLMClient(config, initialBackend = "unknown") {
|
|
227
|
+
function createLLMClient(config, initialBackend = config.llm.backend ?? "unknown") {
|
|
43
228
|
const baseURL = ensureVersionPrefix(config.llm.baseUrl);
|
|
44
229
|
const httpClient = new OpenAIHttpClient({
|
|
45
230
|
baseURL,
|
|
46
231
|
apiKey: config.llm.apiKey ?? "not-needed"
|
|
47
232
|
});
|
|
233
|
+
const ollamaHttpClient = new OllamaHttpClient({
|
|
234
|
+
baseURL: stripVersionPrefix(baseURL)
|
|
235
|
+
});
|
|
236
|
+
const httpFor = (b) => b === "ollama" ? ollamaHttpClient : httpClient;
|
|
48
237
|
let model = config.llm.model;
|
|
49
238
|
let profile = getModelProfile(model);
|
|
50
239
|
let backend = initialBackend;
|
|
@@ -103,7 +292,7 @@ function createLLMClient(config, initialBackend = "unknown") {
|
|
|
103
292
|
capabilities,
|
|
104
293
|
...buildExtraParams(resolvedEffort)
|
|
105
294
|
});
|
|
106
|
-
const httpResponse = await
|
|
295
|
+
const httpResponse = await httpFor(backend).createChatCompletion(
|
|
107
296
|
createParams,
|
|
108
297
|
{
|
|
109
298
|
signal: request.signal
|
|
@@ -180,7 +369,7 @@ function createLLMClient(config, initialBackend = "unknown") {
|
|
|
180
369
|
}
|
|
181
370
|
}, 100);
|
|
182
371
|
const streamSignal = request.signal ? AbortSignal.any([request.signal, idleTimeoutController.signal]) : idleTimeoutController.signal;
|
|
183
|
-
const stream =
|
|
372
|
+
const stream = httpFor(backend).createChatCompletionStream(streamingParams, {
|
|
184
373
|
signal: streamSignal
|
|
185
374
|
});
|
|
186
375
|
let fullContent = "";
|
|
@@ -317,4 +506,4 @@ function createLLMClient(config, initialBackend = "unknown") {
|
|
|
317
506
|
export {
|
|
318
507
|
createLLMClient
|
|
319
508
|
};
|
|
320
|
-
//# sourceMappingURL=chunk-
|
|
509
|
+
//# sourceMappingURL=chunk-FNXTJLCZ.js.map
|
|
@@ -163,7 +163,7 @@ async function runCli(options) {
|
|
|
163
163
|
break;
|
|
164
164
|
}
|
|
165
165
|
case "provider": {
|
|
166
|
-
const { runProviderCommand } = await import("./provider-
|
|
166
|
+
const { runProviderCommand } = await import("./provider-6LUA73HF.js");
|
|
167
167
|
const [, subcommand] = positionals;
|
|
168
168
|
await runProviderCommand(mode, subcommand);
|
|
169
169
|
break;
|
|
@@ -200,7 +200,7 @@ async function runCli(options) {
|
|
|
200
200
|
break;
|
|
201
201
|
}
|
|
202
202
|
case "update": {
|
|
203
|
-
const { runUpdate } = await import("./update-
|
|
203
|
+
const { runUpdate } = await import("./update-VH75MTCP.js");
|
|
204
204
|
const code = await runUpdate();
|
|
205
205
|
if (code !== 0) {
|
|
206
206
|
process.exit(code);
|
|
@@ -213,7 +213,7 @@ async function runCli(options) {
|
|
|
213
213
|
if (!configExists) {
|
|
214
214
|
await runNetworkSetup(mode);
|
|
215
215
|
}
|
|
216
|
-
const { runServe } = await import("./serve-
|
|
216
|
+
const { runServe } = await import("./serve-WJKFUMLI.js");
|
|
217
217
|
const serveOptions = { mode };
|
|
218
218
|
if (values.port) serveOptions.port = parseInt(values.port);
|
|
219
219
|
if (values["no-browser"] === true) serveOptions.openBrowser = false;
|
|
@@ -225,4 +225,4 @@ async function runCli(options) {
|
|
|
225
225
|
export {
|
|
226
226
|
runCli
|
|
227
227
|
};
|
|
228
|
-
//# sourceMappingURL=chunk-
|
|
228
|
+
//# sourceMappingURL=chunk-H2RZDEVL.js.map
|
|
@@ -131,7 +131,8 @@ function resolveSessionProvider(session, providerManager, effective) {
|
|
|
131
131
|
providerId: provider.id,
|
|
132
132
|
baseUrl: provider.url,
|
|
133
133
|
...provider.apiKey ? { apiKey: provider.apiKey } : {},
|
|
134
|
-
model: effectiveModel
|
|
134
|
+
model: effectiveModel,
|
|
135
|
+
...provider.backend ? { backend: provider.backend } : {}
|
|
135
136
|
};
|
|
136
137
|
}
|
|
137
138
|
async function generateSessionNameForSession(sessionId, userMessage, deps, signal) {
|
|
@@ -161,14 +162,17 @@ async function generateSessionNameForSession(sessionId, userMessage, deps, signa
|
|
|
161
162
|
client = deps.getLLMClient();
|
|
162
163
|
client.setModel(providerConfig.model);
|
|
163
164
|
} else if (providerConfig) {
|
|
164
|
-
const { createLLMClient } = await import("./client-
|
|
165
|
-
client = createLLMClient(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
165
|
+
const { createLLMClient } = await import("./client-YHYIWZY7.js");
|
|
166
|
+
client = createLLMClient(
|
|
167
|
+
{
|
|
168
|
+
llm: {
|
|
169
|
+
baseUrl: providerConfig.baseUrl,
|
|
170
|
+
model: providerConfig.model,
|
|
171
|
+
...providerConfig.apiKey ? { apiKey: providerConfig.apiKey } : {}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
providerConfig.backend ?? "unknown"
|
|
175
|
+
);
|
|
172
176
|
} else if (deps.getLLMClient) {
|
|
173
177
|
client = deps.getLLMClient();
|
|
174
178
|
} else {
|
|
@@ -212,4 +216,4 @@ export {
|
|
|
212
216
|
needsNameGeneration,
|
|
213
217
|
generateSessionNameForSession
|
|
214
218
|
};
|
|
215
|
-
//# sourceMappingURL=chunk-
|
|
219
|
+
//# sourceMappingURL=chunk-HOSFRPPI.js.map
|
|
@@ -617,11 +617,35 @@ async function buildChatCompletionCreateParams(model, request, profile, capabili
|
|
|
617
617
|
;
|
|
618
618
|
params["top_k"] = topK;
|
|
619
619
|
}
|
|
620
|
+
if (capabilities.supportsNumCtx && request.modelSettings?.numCtx) {
|
|
621
|
+
;
|
|
622
|
+
params["num_ctx"] = request.modelSettings.numCtx;
|
|
623
|
+
}
|
|
620
624
|
const resolvedEffort = reasoningEffort ?? request.reasoningEffort;
|
|
621
625
|
const queryParams = request.modelSettings?.queryParams;
|
|
622
626
|
const hasQueryParams = queryParams && Object.keys(queryParams).length > 0;
|
|
623
627
|
const hasExplicitModelSettings = hasQueryParams || !!request.modelSettings?.chatTemplateKwargs;
|
|
624
|
-
if (
|
|
628
|
+
if (capabilities.routesEffortViaChatTemplateKwargs) {
|
|
629
|
+
let userKwargs = request.modelSettings?.chatTemplateKwargs;
|
|
630
|
+
if (hasQueryParams) {
|
|
631
|
+
const { chat_template_kwargs: userKwargsFromQP, ...restQueryParams } = queryParams;
|
|
632
|
+
Object.assign(params, restQueryParams);
|
|
633
|
+
if (userKwargsFromQP) {
|
|
634
|
+
userKwargs = userKwargsFromQP;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
const kwargs = { ...userKwargs ?? {} };
|
|
638
|
+
if (resolvedEffort === "none") {
|
|
639
|
+
delete kwargs["reasoning_effort"];
|
|
640
|
+
kwargs["enable_thinking"] = false;
|
|
641
|
+
} else if (resolvedEffort && kwargs["reasoning_effort"] === void 0) {
|
|
642
|
+
kwargs["reasoning_effort"] = resolvedEffort;
|
|
643
|
+
}
|
|
644
|
+
if (Object.keys(kwargs).length > 0) {
|
|
645
|
+
;
|
|
646
|
+
params["chat_template_kwargs"] = kwargs;
|
|
647
|
+
}
|
|
648
|
+
} else if (hasQueryParams) {
|
|
625
649
|
Object.assign(params, queryParams);
|
|
626
650
|
if (resolvedEffort) {
|
|
627
651
|
;
|
|
@@ -711,4 +735,4 @@ export {
|
|
|
711
735
|
buildStreamingCreateParams,
|
|
712
736
|
mapFinishReason
|
|
713
737
|
};
|
|
714
|
-
//# sourceMappingURL=chunk-
|
|
738
|
+
//# sourceMappingURL=chunk-KAZWU73N.js.map
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-GJL3QSMP.js";
|
|
7
7
|
import {
|
|
8
8
|
getBackendCapabilities
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PBFGJFGC.js";
|
|
10
10
|
import {
|
|
11
11
|
buildModelParams
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KAZWU73N.js";
|
|
13
13
|
import {
|
|
14
14
|
logger
|
|
15
15
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -518,4 +518,4 @@ export {
|
|
|
518
518
|
createChatDoneEvent,
|
|
519
519
|
consumeStreamGenerator
|
|
520
520
|
};
|
|
521
|
-
//# sourceMappingURL=chunk-
|
|
521
|
+
//# sourceMappingURL=chunk-LJX7KXRU.js.map
|
|
@@ -2,39 +2,57 @@
|
|
|
2
2
|
var BACKEND_CAPABILITIES = {
|
|
3
3
|
vllm: {
|
|
4
4
|
supportsChatTemplateKwargs: true,
|
|
5
|
-
supportsTopK: true
|
|
5
|
+
supportsTopK: true,
|
|
6
|
+
supportsNumCtx: false,
|
|
7
|
+
routesEffortViaChatTemplateKwargs: false
|
|
6
8
|
},
|
|
7
9
|
sglang: {
|
|
8
10
|
supportsChatTemplateKwargs: true,
|
|
9
|
-
supportsTopK: true
|
|
11
|
+
supportsTopK: true,
|
|
12
|
+
supportsNumCtx: false,
|
|
13
|
+
routesEffortViaChatTemplateKwargs: false
|
|
10
14
|
},
|
|
11
15
|
openai: {
|
|
12
16
|
supportsChatTemplateKwargs: false,
|
|
13
|
-
supportsTopK: false
|
|
17
|
+
supportsTopK: false,
|
|
18
|
+
supportsNumCtx: false,
|
|
19
|
+
routesEffortViaChatTemplateKwargs: false
|
|
14
20
|
},
|
|
15
21
|
anthropic: {
|
|
16
22
|
supportsChatTemplateKwargs: false,
|
|
17
|
-
supportsTopK: false
|
|
23
|
+
supportsTopK: false,
|
|
24
|
+
supportsNumCtx: false,
|
|
25
|
+
routesEffortViaChatTemplateKwargs: false
|
|
18
26
|
},
|
|
19
27
|
ollama: {
|
|
20
28
|
supportsChatTemplateKwargs: false,
|
|
21
|
-
supportsTopK: false
|
|
29
|
+
supportsTopK: false,
|
|
30
|
+
supportsNumCtx: true,
|
|
31
|
+
routesEffortViaChatTemplateKwargs: false
|
|
22
32
|
},
|
|
23
33
|
llamacpp: {
|
|
24
34
|
supportsChatTemplateKwargs: false,
|
|
25
|
-
supportsTopK: true
|
|
35
|
+
supportsTopK: true,
|
|
36
|
+
supportsNumCtx: false,
|
|
37
|
+
routesEffortViaChatTemplateKwargs: true
|
|
26
38
|
},
|
|
27
39
|
lmstudio: {
|
|
28
40
|
supportsChatTemplateKwargs: false,
|
|
29
|
-
supportsTopK: true
|
|
41
|
+
supportsTopK: true,
|
|
42
|
+
supportsNumCtx: false,
|
|
43
|
+
routesEffortViaChatTemplateKwargs: false
|
|
30
44
|
},
|
|
31
45
|
"opencode-go": {
|
|
32
46
|
supportsChatTemplateKwargs: false,
|
|
33
|
-
supportsTopK: true
|
|
47
|
+
supportsTopK: true,
|
|
48
|
+
supportsNumCtx: false,
|
|
49
|
+
routesEffortViaChatTemplateKwargs: false
|
|
34
50
|
},
|
|
35
51
|
unknown: {
|
|
36
52
|
supportsChatTemplateKwargs: true,
|
|
37
|
-
supportsTopK: true
|
|
53
|
+
supportsTopK: true,
|
|
54
|
+
supportsNumCtx: false,
|
|
55
|
+
routesEffortViaChatTemplateKwargs: false
|
|
38
56
|
}
|
|
39
57
|
};
|
|
40
58
|
function getBackendCapabilities(backend) {
|
|
@@ -67,4 +85,4 @@ export {
|
|
|
67
85
|
getBackendCapabilities,
|
|
68
86
|
getBackendDisplayName
|
|
69
87
|
};
|
|
70
|
-
//# sourceMappingURL=chunk-
|
|
88
|
+
//# sourceMappingURL=chunk-PBFGJFGC.js.map
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-K2QKX4ZJ.js";
|
|
4
4
|
import {
|
|
5
5
|
createLLMClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FNXTJLCZ.js";
|
|
7
7
|
import {
|
|
8
8
|
getModelProfile
|
|
9
9
|
} from "./chunk-GJL3QSMP.js";
|
|
10
10
|
import {
|
|
11
11
|
getBackendCapabilities
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PBFGJFGC.js";
|
|
13
13
|
import {
|
|
14
14
|
buildModelsUrl,
|
|
15
15
|
ensureVersionPrefix,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./chunk-HNCM3D7Y.js";
|
|
18
18
|
import {
|
|
19
19
|
resolveAttachmentsInMessages
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-KAZWU73N.js";
|
|
21
21
|
import {
|
|
22
22
|
getCatalogEntry,
|
|
23
23
|
resolveEffortForModel
|
|
@@ -456,7 +456,10 @@ function createProviderManager(config, options = {}) {
|
|
|
456
456
|
function createClientForProvider(provider, model, reasoningEffort) {
|
|
457
457
|
const resolvedModel = resolveProviderModel(provider, model);
|
|
458
458
|
const transport = options.adapters?.getTransport(resolveTransportAdapter(provider));
|
|
459
|
-
return transport ? createTransportLLMClient(provider, resolvedModel, transport, reasoningEffort) : createLLMClient(
|
|
459
|
+
return transport ? createTransportLLMClient(provider, resolvedModel, transport, reasoningEffort) : createLLMClient(
|
|
460
|
+
createConfigForProvider(provider, resolvedModel, reasoningEffort),
|
|
461
|
+
provider.backend
|
|
462
|
+
);
|
|
460
463
|
}
|
|
461
464
|
async function fetchProviderModels(provider) {
|
|
462
465
|
const transport = options.adapters?.getTransport(resolveTransportAdapter(provider));
|
|
@@ -761,6 +764,8 @@ function createProviderManager(config, options = {}) {
|
|
|
761
764
|
if (model["maxTokens"] !== void 0) baseSettings["maxTokens"] = model["maxTokens"];
|
|
762
765
|
if (model["supportsVision"] !== void 0) baseSettings["supportsVision"] = model["supportsVision"];
|
|
763
766
|
if (model["omitParams"] !== void 0) baseSettings["omitParams"] = model["omitParams"];
|
|
767
|
+
if (typeof model["contextWindow"] === "number" && model["contextWindow"] > 0)
|
|
768
|
+
baseSettings["numCtx"] = model["contextWindow"];
|
|
764
769
|
const rawQueryParams = mode === "thinking" ? model.thinkingQueryParams : model.nonThinkingQueryParams;
|
|
765
770
|
if (rawQueryParams) {
|
|
766
771
|
return { ...baseSettings, queryParams: JSON.parse(rawQueryParams) };
|
|
@@ -776,9 +781,14 @@ function createProviderManager(config, options = {}) {
|
|
|
776
781
|
if (fallbackRawQP) {
|
|
777
782
|
return { ...baseSettings, queryParams: JSON.parse(fallbackRawQP) };
|
|
778
783
|
}
|
|
779
|
-
if (
|
|
784
|
+
if (Object.keys(baseSettings).length > 0) return baseSettings;
|
|
780
785
|
return void 0;
|
|
781
786
|
},
|
|
787
|
+
resolveModelEffort(providerId, modelId, explicitEffort) {
|
|
788
|
+
const provider = providers.find((p) => p.id === providerId);
|
|
789
|
+
if (!provider) return void 0;
|
|
790
|
+
return resolveModelThinkingConfig(provider, modelId, explicitEffort).reasoningEffort;
|
|
791
|
+
},
|
|
782
792
|
async refreshProviderModels(providerId) {
|
|
783
793
|
const provider = providers.find((p) => p.id === providerId);
|
|
784
794
|
if (!provider) {
|
|
@@ -841,4 +851,4 @@ export {
|
|
|
841
851
|
parseDefaultModelSelection,
|
|
842
852
|
createProviderManager
|
|
843
853
|
};
|
|
844
|
-
//# sourceMappingURL=chunk-
|
|
854
|
+
//# sourceMappingURL=chunk-T3JVYO3Z.js.map
|
|
@@ -105,7 +105,7 @@ function resolveAgentDef(sessionManager, sessionId) {
|
|
|
105
105
|
}
|
|
106
106
|
async function buildCachedPrompt(sessionManager, sessionId, agentDef, modelName) {
|
|
107
107
|
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
108
|
-
const { getToolRegistryForAgent } = await import("./tools-
|
|
108
|
+
const { getToolRegistryForAgent } = await import("./tools-AOLICK5U.js");
|
|
109
109
|
const tools = getToolRegistryForAgent(agentDef, sessionId).definitions;
|
|
110
110
|
const toolFingerprint = getToolFingerprint(tools);
|
|
111
111
|
const allAgents = await loadAllAgentsDefault(sessionManager.getProjectWorkdir(sessionId));
|
|
@@ -124,7 +124,7 @@ async function buildCachedPrompt(sessionManager, sessionId, agentDef, modelName)
|
|
|
124
124
|
async function computeSessionHash(sessionManager, sessionId, modelName) {
|
|
125
125
|
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
126
126
|
const agentDef = await resolveAgentDef(sessionManager, sessionId);
|
|
127
|
-
const { getToolRegistryForAgent } = await import("./tools-
|
|
127
|
+
const { getToolRegistryForAgent } = await import("./tools-AOLICK5U.js");
|
|
128
128
|
const tools = getToolRegistryForAgent(agentDef, sessionId).definitions;
|
|
129
129
|
const toolFingerprint = getToolFingerprint(tools);
|
|
130
130
|
return computeDynamicContextHash(instructionContent, skills, toolFingerprint, modelName);
|
|
@@ -148,4 +148,4 @@ export {
|
|
|
148
148
|
computeSessionHash,
|
|
149
149
|
applyDynamicContext
|
|
150
150
|
};
|
|
151
|
-
//# sourceMappingURL=chunk-
|
|
151
|
+
//# sourceMappingURL=chunk-TP2PGZSE.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createMessageStartEvent
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LJX7KXRU.js";
|
|
4
4
|
import {
|
|
5
5
|
COMPACTION_PROMPT
|
|
6
6
|
} from "./chunk-GIJUWPRQ.js";
|
|
@@ -36,4 +36,4 @@ export {
|
|
|
36
36
|
COMPACTION_MAX_RATIO,
|
|
37
37
|
shouldCompact
|
|
38
38
|
};
|
|
39
|
-
//# sourceMappingURL=chunk-
|
|
39
|
+
//# sourceMappingURL=chunk-UAAFZEIS.js.map
|