openfox 2.0.0-beta.11 → 2.0.0-beta.14

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.
Files changed (51) hide show
  1. package/dist/{ask-5SSOA6SZ.js → ask-BRLFZKEW.js} +2 -1
  2. package/dist/{auth-56SIRACI.js → auth-OGGBJFJQ.js} +2 -1
  3. package/dist/{branch.api-PWFW26KC.js → branch.api-TCWNJXYA.js} +2 -1
  4. package/dist/{chat-handler-NMJCOCCB.js → chat-handler-ZFQIJIJT.js} +9 -8
  5. package/dist/chunk-7D4SUZUM.js +38 -0
  6. package/dist/{chunk-EZUR7OEP.js → chunk-BURBTNDG.js} +15 -9
  7. package/dist/{chunk-DMH6JVPF.js → chunk-BZJAO4VY.js} +47 -19
  8. package/dist/{chunk-NSBYORD5.js → chunk-DHAKJSE7.js} +4 -2
  9. package/dist/{chunk-4RLDN2LL.js → chunk-EYE2JMLA.js} +189 -61
  10. package/dist/{chunk-EQQDA4D3.js → chunk-IONKVOSF.js} +17 -19
  11. package/dist/{chunk-VIIRNJDT.js → chunk-LXX2CPM5.js} +203 -236
  12. package/dist/{chunk-EXYMWI7A.js → chunk-OKLV3ZNN.js} +9 -5
  13. package/dist/chunk-QD6U3BDD.js +25277 -0
  14. package/dist/{chunk-BU56QFHW.js → chunk-RUWSVV7U.js} +8 -9
  15. package/dist/{chunk-LCRJWUW7.js → chunk-YWYYRA2P.js} +11 -11
  16. package/dist/cli/dev.js +2 -1
  17. package/dist/cli/index.js +2 -1
  18. package/dist/{compactor-TDNRM3A7.js → compactor-WL33VHUF.js} +2 -1
  19. package/dist/{config-TDVA7MQN.js → config-MFKBDOOT.js} +6 -5
  20. package/dist/{events-UGTGGFG3.js → events-6UJR2NH4.js} +3 -2
  21. package/dist/{folding-YOCGTZYH.js → folding-GMO644G3.js} +2 -1
  22. package/dist/{inspect-proxy-42ZXL2R5.js → inspect-proxy-JZ54RBUN.js} +2 -1
  23. package/dist/{manager-W7N3XQ4Q.js → manager-NTL3MLGN.js} +2 -1
  24. package/dist/{orchestrator-75L5UGDU.js → orchestrator-HHF4UC3K.js} +8 -7
  25. package/dist/package.json +1 -1
  26. package/dist/{paths-X46PPOI2.js → paths-D7BBTOO5.js} +2 -1
  27. package/dist/{permissions-Z2IIV2V7.js → permissions-YGAJ47F5.js} +3 -1
  28. package/dist/{processor-GHESQ2YV.js → processor-EJJTSLRL.js} +11 -5
  29. package/dist/{project-creator-6DU7E75S.js → project-creator-GMS5YKEF.js} +2 -1
  30. package/dist/{projects-2HYIZC4Y.js → projects-QHGMUKWH.js} +2 -1
  31. package/dist/{protocol-CN24IKQN.js → protocol-QQNATDFM.js} +2 -1
  32. package/dist/{protocol-B9R1CUvt.d.ts → protocol-zn90yuIr.d.ts} +11 -2
  33. package/dist/{provider-BGH4MBLH.js → provider-APFZV234.js} +10 -9
  34. package/dist/provider-manager-2NFFVCX5.js +17 -0
  35. package/dist/{pwa-76XP2DY2.js → pwa-WYVG3NLS.js} +2 -1
  36. package/dist/{serve-I6T7V62Z.js → serve-GTH76EDG.js} +14 -13
  37. package/dist/server/index.d.ts +21 -15
  38. package/dist/server/index.js +10 -9
  39. package/dist/{service-GB7AIOG5.js → service-W43DAQ5K.js} +3 -1
  40. package/dist/{settings-6XX56F3F.js → settings-OAISIQVV.js} +2 -1
  41. package/dist/shared/index.d.ts +2 -2
  42. package/dist/shared/index.js +1 -0
  43. package/dist/{store-OQ45KONN.js → store-JZW6VPEK.js} +2 -1
  44. package/dist/{tools-D3WWIOQD.js → tools-2X2FC6W7.js} +7 -6
  45. package/dist/web/assets/index-DCu8wsRj.js +299 -0
  46. package/dist/web/assets/{index-CSOB8dwI.css → index-Sdax8ayU.css} +1 -1
  47. package/dist/web/index.html +2 -2
  48. package/dist/web/sw.js +1 -1
  49. package/package.json +1 -1
  50. package/dist/chunk-UKTPL5ZG.js +0 -469
  51. package/dist/web/assets/index-tJDr1ODC.js +0 -299
@@ -14,12 +14,15 @@ import {
14
14
  getMaxPerSession,
15
15
  getSessionProcessCount
16
16
  } from "./chunk-VRGRAQDG.js";
17
+ import {
18
+ getProject
19
+ } from "./chunk-XAMAYRDA.js";
17
20
  import {
18
21
  getCurrentContextWindowId,
19
22
  getCurrentWindowMessageOptions,
20
23
  getEventStore,
21
24
  getRuntimeConfig
22
- } from "./chunk-NSBYORD5.js";
25
+ } from "./chunk-DHAKJSE7.js";
23
26
  import {
24
27
  buildContextMessagesFromEventHistory,
25
28
  foldContextState,
@@ -46,21 +49,18 @@ import {
46
49
  getSetting
47
50
  } from "./chunk-RFNEDBVO.js";
48
51
  import {
49
- getProject
50
- } from "./chunk-XAMAYRDA.js";
52
+ getGlobalConfigDir
53
+ } from "./chunk-CQGTEGKL.js";
51
54
  import {
52
55
  buildModelParams,
53
56
  getBackendCapabilities,
54
57
  getModelProfile,
55
58
  modelSupportsVision,
56
59
  streamWithSegments
57
- } from "./chunk-VIIRNJDT.js";
60
+ } from "./chunk-LXX2CPM5.js";
58
61
  import {
59
62
  logger
60
63
  } from "./chunk-K44MW7JJ.js";
61
- import {
62
- getGlobalConfigDir
63
- } from "./chunk-CQGTEGKL.js";
64
64
 
65
65
  // src/server/tools/read.ts
66
66
  import { readFile as readFile2, stat, readdir } from "fs/promises";
@@ -2001,12 +2001,12 @@ function matchRetryPatterns(content, thinking, patterns) {
2001
2001
 
2002
2002
  // src/server/chat/stream-utils.ts
2003
2003
  function buildStreamRequestObject(params) {
2004
- const { messages, tools, toolChoice, disableThinking, signal, modelSettings } = params;
2004
+ const { messages, tools, toolChoice, reasoningEffort, signal, modelSettings } = params;
2005
2005
  return {
2006
2006
  messages,
2007
2007
  ...tools && { tools },
2008
2008
  ...toolChoice && { toolChoice },
2009
- disableThinking: disableThinking ?? false,
2009
+ ...reasoningEffort && { reasoningEffort },
2010
2010
  ...signal && { signal },
2011
2011
  ...modelSettings && { modelSettings }
2012
2012
  };
@@ -2060,7 +2060,7 @@ function createEmptyStreamResult(aborted, modelParams, patternMatch) {
2060
2060
  };
2061
2061
  }
2062
2062
  async function* streamLLMPure(options) {
2063
- const { messageId, systemPrompt, llmClient, messages, tools, toolChoice, signal, disableThinking, retryPatterns } = options;
2063
+ const { messageId, systemPrompt, llmClient, messages, tools, toolChoice, signal, reasoningEffort, retryPatterns } = options;
2064
2064
  const llmMessages = [{ role: "system", content: systemPrompt }, ...messages];
2065
2065
  const profile = getModelProfile(llmClient.getModel());
2066
2066
  const backend = getBackendCapabilities(llmClient.getBackend());
@@ -2093,7 +2093,7 @@ async function* streamLLMPure(options) {
2093
2093
  messages: llmMessages,
2094
2094
  tools,
2095
2095
  toolChoice,
2096
- disableThinking: disableThinking ?? false,
2096
+ reasoningEffort,
2097
2097
  signal: combinedSignal,
2098
2098
  modelSettings: options.modelSettings
2099
2099
  });
@@ -2648,7 +2648,7 @@ async function executeTools(assistantMsgId, toolCalls, ctx, append) {
2648
2648
  type: "chat.ask_user",
2649
2649
  data: { callId: error.callId, question: error.question }
2650
2650
  });
2651
- const { awaitAnswer } = await import("./ask-5SSOA6SZ.js");
2651
+ const { awaitAnswer } = await import("./ask-BRLFZKEW.js");
2652
2652
  const answerPromise = awaitAnswer(error.callId);
2653
2653
  if (!answerPromise) {
2654
2654
  throw new Error(`No pending question found for callId: ${error.callId}`);
@@ -2929,7 +2929,7 @@ ${CONTINUE_PROMPT}` : CONTINUE_PROMPT;
2929
2929
  sessionManager.setCurrentContextSize(sessionId, result.usage.promptTokens);
2930
2930
  if (!compacting) {
2931
2931
  const contextState = sessionManager.getContextState(sessionId);
2932
- const { shouldCompact } = await import("./compactor-TDNRM3A7.js");
2932
+ const { shouldCompact } = await import("./compactor-WL33VHUF.js");
2933
2933
  if (shouldCompact(contextState.currentTokens, contextState.maxTokens, runtimeConfig.context.compactionThreshold)) {
2934
2934
  const compactPromptMsgId = crypto.randomUUID();
2935
2935
  append(
@@ -3051,7 +3051,7 @@ ${COMPACTION_PROMPT}`,
3051
3051
  stats: stats2
3052
3052
  })
3053
3053
  );
3054
- const { createChatDoneMessage: createChatDoneMessage2 } = await import("./protocol-CN24IKQN.js");
3054
+ const { createChatDoneMessage: createChatDoneMessage2 } = await import("./protocol-QQNATDFM.js");
3055
3055
  onMessage(createChatDoneMessage2(assistantMsgId, "complete", stats2));
3056
3056
  }
3057
3057
  break;
@@ -3189,7 +3189,6 @@ function buildAssemblyInput(systemPrompt, baseInput) {
3189
3189
  injectedFiles: baseInput.injectedFiles,
3190
3190
  requestTools: baseInput.requestTools ?? baseInput.promptTools,
3191
3191
  toolChoice: baseInput.toolChoice ?? "auto",
3192
- disableThinking: baseInput.disableThinking ?? false,
3193
3192
  ...baseInput.customInstructions ? { customInstructions: baseInput.customInstructions } : {},
3194
3193
  ...baseInput.skills && baseInput.skills.length > 0 ? { skills: baseInput.skills } : {}
3195
3194
  });
@@ -3281,7 +3280,7 @@ async function describeImageFromDataUrl(dataUrl, visionModel, options) {
3281
3280
  import { createHash as createHash2 } from "crypto";
3282
3281
  async function loadVisionModelFromGlobalConfig() {
3283
3282
  try {
3284
- const { loadGlobalConfig, getVisionFallback } = await import("./config-TDVA7MQN.js");
3283
+ const { loadGlobalConfig, getVisionFallback } = await import("./config-MFKBDOOT.js");
3285
3284
  const runtimeConfig = getRuntimeConfig();
3286
3285
  const mode = runtimeConfig.mode ?? "production";
3287
3286
  const globalConfig = await loadGlobalConfig(mode);
@@ -3644,7 +3643,6 @@ async function executeSubAgent(options) {
3644
3643
  injectedFiles: input.injectedFiles,
3645
3644
  requestTools: input.promptTools,
3646
3645
  toolChoice: input.toolChoice,
3647
- disableThinking: true,
3648
3646
  ...instructionContent ? { customInstructions: instructionContent } : {},
3649
3647
  ...skills.length > 0 ? { skills } : {}
3650
3648
  }),
@@ -3735,7 +3733,7 @@ var callSubAgentTool = {
3735
3733
  };
3736
3734
  }
3737
3735
  try {
3738
- const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-D3WWIOQD.js");
3736
+ const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-2X2FC6W7.js");
3739
3737
  const toolRegistry = getToolRegistryForAgent2(agentDef);
3740
3738
  const turnMetrics = new TurnMetrics();
3741
3739
  const result = await executeSubAgent({
@@ -4787,4 +4785,4 @@ export {
4787
4785
  getToolRegistryForAgent,
4788
4786
  createToolRegistry
4789
4787
  };
4790
- //# sourceMappingURL=chunk-EQQDA4D3.js.map
4788
+ //# sourceMappingURL=chunk-IONKVOSF.js.map
@@ -2,6 +2,176 @@ import {
2
2
  logger
3
3
  } from "./chunk-K44MW7JJ.js";
4
4
 
5
+ // src/server/llm/profiles.ts
6
+ var DEFAULT_PROFILE = {
7
+ name: "default",
8
+ temperature: 0.7,
9
+ topP: 0.9,
10
+ defaultMaxTokens: 4096,
11
+ supportsVision: true
12
+ };
13
+ var MOCK_PROFILE = {
14
+ name: "mock",
15
+ temperature: 0.7,
16
+ topP: 0.9,
17
+ defaultMaxTokens: 1024,
18
+ supportsVision: false
19
+ };
20
+ var MODEL_PROFILES = [
21
+ {
22
+ pattern: "mistral",
23
+ profile: {
24
+ name: "Mistral",
25
+ temperature: 0.7,
26
+ topP: 0.9,
27
+ defaultMaxTokens: 16384,
28
+ supportsVision: false
29
+ }
30
+ },
31
+ {
32
+ pattern: "qwen3-coder-next",
33
+ profile: {
34
+ name: "Qwen3-Coder-Next",
35
+ // Per Qwen docs: "temperature=1.0, top_p=0.95, top_k=40"
36
+ temperature: 1,
37
+ topP: 0.95,
38
+ topK: 40,
39
+ // "This model supports only non-thinking mode and does not generate <think></think> blocks"
40
+ defaultMaxTokens: 16384,
41
+ supportsVision: false
42
+ }
43
+ },
44
+ {
45
+ pattern: "qwen3",
46
+ profile: {
47
+ name: "Qwen3",
48
+ temperature: 0.7,
49
+ topP: 0.9,
50
+ defaultMaxTokens: 16384,
51
+ supportsVision: false
52
+ }
53
+ },
54
+ {
55
+ pattern: "qwen3-vl",
56
+ profile: {
57
+ name: "Qwen3-VL",
58
+ temperature: 0.7,
59
+ topP: 0.9,
60
+ defaultMaxTokens: 16384,
61
+ supportsVision: true
62
+ }
63
+ },
64
+ {
65
+ pattern: "deepseek",
66
+ profile: {
67
+ name: "DeepSeek",
68
+ temperature: 0.6,
69
+ topP: 0.95,
70
+ defaultMaxTokens: 16384,
71
+ supportsVision: false
72
+ }
73
+ },
74
+ {
75
+ pattern: "minimax-m2.5",
76
+ profile: {
77
+ name: "MiniMax-M2.5",
78
+ temperature: 1,
79
+ topP: 0.95,
80
+ topK: 40,
81
+ defaultMaxTokens: 16384,
82
+ supportsVision: false
83
+ }
84
+ },
85
+ {
86
+ pattern: "minimax-m2.7",
87
+ profile: {
88
+ name: "MiniMax-M2.7",
89
+ temperature: 1,
90
+ topP: 0.95,
91
+ topK: 40,
92
+ defaultMaxTokens: 16384,
93
+ supportsVision: false
94
+ }
95
+ },
96
+ {
97
+ pattern: "minimax",
98
+ profile: {
99
+ name: "MiniMax",
100
+ temperature: 1,
101
+ topP: 0.95,
102
+ topK: 40,
103
+ defaultMaxTokens: 16384,
104
+ supportsVision: false
105
+ }
106
+ },
107
+ {
108
+ pattern: "minimax-m3",
109
+ profile: {
110
+ name: "MiniMax-M3",
111
+ temperature: 1,
112
+ topP: 0.95,
113
+ topK: 40,
114
+ defaultMaxTokens: 16384,
115
+ supportsVision: true
116
+ }
117
+ },
118
+ {
119
+ pattern: "llava",
120
+ profile: {
121
+ name: "LLaVA",
122
+ temperature: 0.7,
123
+ topP: 0.9,
124
+ defaultMaxTokens: 16384,
125
+ supportsVision: true
126
+ }
127
+ },
128
+ {
129
+ pattern: "llama",
130
+ profile: {
131
+ name: "Llama",
132
+ temperature: 0.7,
133
+ topP: 0.9,
134
+ defaultMaxTokens: 16384,
135
+ supportsVision: false
136
+ }
137
+ },
138
+ {
139
+ pattern: "claude",
140
+ profile: {
141
+ name: "Claude",
142
+ temperature: 0.7,
143
+ topP: 0.9,
144
+ defaultMaxTokens: 16384,
145
+ supportsVision: false
146
+ }
147
+ },
148
+ {
149
+ pattern: "gemma-4",
150
+ profile: {
151
+ name: "Gemma 4",
152
+ temperature: 0.7,
153
+ topP: 0.9,
154
+ defaultMaxTokens: 16384,
155
+ supportsVision: true
156
+ }
157
+ }
158
+ ];
159
+ function getModelProfile(modelName) {
160
+ const lowerName = modelName.toLowerCase();
161
+ if (lowerName.includes("mock")) {
162
+ return MOCK_PROFILE;
163
+ }
164
+ for (const { pattern, profile } of MODEL_PROFILES) {
165
+ if (lowerName.includes(pattern.toLowerCase())) {
166
+ return profile;
167
+ }
168
+ }
169
+ return DEFAULT_PROFILE;
170
+ }
171
+ function modelSupportsVision(modelName) {
172
+ return getModelProfile(modelName).supportsVision;
173
+ }
174
+
5
175
  // src/server/llm/url-utils.ts
6
176
  var VERSION_PREFIX_REGEX = /\/v\d+(\/|$)/;
7
177
  function hasVersionPrefix(url) {
@@ -21,33 +191,27 @@ function buildModelsUrl(baseUrl) {
21
191
  // src/server/llm/backend.ts
22
192
  var BACKEND_CAPABILITIES = {
23
193
  vllm: {
24
- supportsReasoningField: true,
25
194
  supportsChatTemplateKwargs: true,
26
195
  supportsTopK: true
27
196
  },
28
197
  sglang: {
29
- supportsReasoningField: true,
30
198
  supportsChatTemplateKwargs: true,
31
199
  supportsTopK: true
32
200
  },
33
201
  ollama: {
34
- supportsReasoningField: false,
35
202
  supportsChatTemplateKwargs: false,
36
203
  supportsTopK: false
37
204
  },
38
205
  llamacpp: {
39
- supportsReasoningField: false,
40
206
  supportsChatTemplateKwargs: false,
41
207
  supportsTopK: true
42
208
  },
43
209
  "opencode-go": {
44
- supportsReasoningField: false,
45
210
  supportsChatTemplateKwargs: false,
46
211
  supportsTopK: true
47
212
  },
48
213
  unknown: {
49
214
  // Assume vLLM-like for unknown backends
50
- supportsReasoningField: true,
51
215
  supportsChatTemplateKwargs: true,
52
216
  supportsTopK: true
53
217
  }
@@ -179,206 +343,6 @@ function getBackendDisplayName(backend) {
179
343
  }
180
344
  }
181
345
 
182
- // src/server/llm/profiles.ts
183
- var DEFAULT_PROFILE = {
184
- name: "default",
185
- temperature: 0.7,
186
- topP: 0.9,
187
- supportsReasoning: false,
188
- reasoningAsContent: false,
189
- defaultMaxTokens: 4096,
190
- supportsVision: true
191
- };
192
- var MOCK_PROFILE = {
193
- name: "mock",
194
- temperature: 0.7,
195
- topP: 0.9,
196
- supportsReasoning: false,
197
- reasoningAsContent: false,
198
- defaultMaxTokens: 1024,
199
- supportsVision: false
200
- };
201
- var MODEL_PROFILES = [
202
- {
203
- pattern: "mistral",
204
- profile: {
205
- name: "Mistral",
206
- temperature: 0.7,
207
- topP: 0.9,
208
- supportsReasoning: false,
209
- reasoningAsContent: false,
210
- defaultMaxTokens: 16384,
211
- supportsVision: false
212
- }
213
- },
214
- {
215
- pattern: "qwen3-coder-next",
216
- profile: {
217
- name: "Qwen3-Coder-Next",
218
- // Per Qwen docs: "temperature=1.0, top_p=0.95, top_k=40"
219
- temperature: 1,
220
- topP: 0.95,
221
- topK: 40,
222
- // "This model supports only non-thinking mode and does not generate <think></think> blocks"
223
- supportsReasoning: false,
224
- reasoningAsContent: false,
225
- defaultMaxTokens: 16384,
226
- supportsVision: false
227
- }
228
- },
229
- {
230
- pattern: "qwen3",
231
- profile: {
232
- name: "Qwen3",
233
- temperature: 0.7,
234
- topP: 0.9,
235
- supportsReasoning: true,
236
- reasoningAsContent: false,
237
- defaultMaxTokens: 16384,
238
- supportsVision: false
239
- }
240
- },
241
- {
242
- pattern: "qwen3-vl",
243
- profile: {
244
- name: "Qwen3-VL",
245
- temperature: 0.7,
246
- topP: 0.9,
247
- supportsReasoning: true,
248
- reasoningAsContent: false,
249
- defaultMaxTokens: 16384,
250
- supportsVision: true
251
- }
252
- },
253
- {
254
- pattern: "deepseek",
255
- profile: {
256
- name: "DeepSeek",
257
- temperature: 0.6,
258
- topP: 0.95,
259
- supportsReasoning: true,
260
- reasoningAsContent: false,
261
- defaultMaxTokens: 16384,
262
- supportsVision: false
263
- }
264
- },
265
- {
266
- pattern: "minimax-m2.5",
267
- profile: {
268
- name: "MiniMax-M2.5",
269
- temperature: 1,
270
- topP: 0.95,
271
- topK: 40,
272
- supportsReasoning: true,
273
- reasoningAsContent: false,
274
- defaultMaxTokens: 16384,
275
- supportsVision: false
276
- }
277
- },
278
- {
279
- pattern: "minimax-m2.7",
280
- profile: {
281
- name: "MiniMax-M2.7",
282
- temperature: 1,
283
- topP: 0.95,
284
- topK: 40,
285
- supportsReasoning: true,
286
- reasoningAsContent: false,
287
- defaultMaxTokens: 16384,
288
- supportsVision: false
289
- }
290
- },
291
- {
292
- pattern: "minimax",
293
- profile: {
294
- name: "MiniMax",
295
- temperature: 1,
296
- topP: 0.95,
297
- topK: 40,
298
- supportsReasoning: true,
299
- reasoningAsContent: false,
300
- defaultMaxTokens: 16384,
301
- supportsVision: false
302
- }
303
- },
304
- {
305
- pattern: "minimax-m3",
306
- profile: {
307
- name: "MiniMax-M3",
308
- temperature: 1,
309
- topP: 0.95,
310
- topK: 40,
311
- supportsReasoning: true,
312
- reasoningAsContent: false,
313
- defaultMaxTokens: 16384,
314
- supportsVision: true
315
- }
316
- },
317
- {
318
- pattern: "llava",
319
- profile: {
320
- name: "LLaVA",
321
- temperature: 0.7,
322
- topP: 0.9,
323
- supportsReasoning: false,
324
- reasoningAsContent: false,
325
- defaultMaxTokens: 16384,
326
- supportsVision: true
327
- }
328
- },
329
- {
330
- pattern: "llama",
331
- profile: {
332
- name: "Llama",
333
- temperature: 0.7,
334
- topP: 0.9,
335
- supportsReasoning: false,
336
- reasoningAsContent: false,
337
- defaultMaxTokens: 16384,
338
- supportsVision: false
339
- }
340
- },
341
- {
342
- pattern: "claude",
343
- profile: {
344
- name: "Claude",
345
- temperature: 0.7,
346
- topP: 0.9,
347
- supportsReasoning: true,
348
- reasoningAsContent: false,
349
- defaultMaxTokens: 16384,
350
- supportsVision: false
351
- }
352
- },
353
- {
354
- pattern: "gemma-4",
355
- profile: {
356
- name: "Gemma 4",
357
- temperature: 0.7,
358
- topP: 0.9,
359
- supportsReasoning: true,
360
- reasoningAsContent: false,
361
- defaultMaxTokens: 16384,
362
- supportsVision: true
363
- }
364
- }
365
- ];
366
- function getModelProfile(modelName) {
367
- const lowerName = modelName.toLowerCase();
368
- if (lowerName.includes("mock")) {
369
- return MOCK_PROFILE;
370
- }
371
- for (const { pattern, profile } of MODEL_PROFILES) {
372
- if (lowerName.includes(pattern.toLowerCase())) {
373
- return profile;
374
- }
375
- }
376
- return DEFAULT_PROFILE;
377
- }
378
- function modelSupportsVision(modelName) {
379
- return getModelProfile(modelName).supportsVision;
380
- }
381
-
382
346
  // src/server/llm/client-pure.ts
383
347
  function buildModelParams(params) {
384
348
  return {
@@ -408,7 +372,14 @@ function convertToolCalls(toolCalls) {
408
372
  }
409
373
  }));
410
374
  }
411
- function buildAssistantMessage(msg) {
375
+ function getThinking(msg, override) {
376
+ if (override) {
377
+ const val = msg[override];
378
+ if (val) return val;
379
+ }
380
+ return msg["reasoning"] ?? msg["reasoning_content"] ?? msg["thinking"];
381
+ }
382
+ function buildAssistantMessage(msg, thinkingField) {
412
383
  const result = {
413
384
  role: "assistant",
414
385
  content: msg.content || null
@@ -417,7 +388,7 @@ function buildAssistantMessage(msg) {
417
388
  result["tool_calls"] = convertToolCalls(msg.toolCalls);
418
389
  }
419
390
  if (msg.thinkingContent) {
420
- result["reasoning_content"] = msg.thinkingContent;
391
+ result[thinkingField ?? "reasoning"] = msg.thinkingContent;
421
392
  }
422
393
  return result;
423
394
  }
@@ -433,7 +404,7 @@ function convertAttachmentSync(attachment, modelSupportsVision2) {
433
404
  text: `[Image: ${attachment.filename || "image"}] (vision not supported, cannot describe)`
434
405
  };
435
406
  }
436
- function convertMessages(messages, modelSupportsVision2) {
407
+ function convertMessages(messages, modelSupportsVision2, thinkingField) {
437
408
  const filtered = messages.filter((msg) => {
438
409
  return !(msg.role === "assistant" && !msg.content?.trim() && (!msg.toolCalls || msg.toolCalls.length === 0));
439
410
  });
@@ -454,7 +425,7 @@ function convertMessages(messages, modelSupportsVision2) {
454
425
  };
455
426
  }
456
427
  if (msg.role === "assistant") {
457
- return buildAssistantMessage(msg);
428
+ return buildAssistantMessage(msg, thinkingField);
458
429
  }
459
430
  if (msg.role === "user" && msg.attachments && msg.attachments.length > 0) {
460
431
  const content = buildAttachmentContent(msg.content, msg.attachments, modelSupportsVision2);
@@ -479,10 +450,10 @@ function convertTools(tools) {
479
450
  }
480
451
  }));
481
452
  }
482
- async function buildChatCompletionCreateParams(model, request, profile, capabilities, disableThinking, isStreaming) {
453
+ async function buildChatCompletionCreateParams(model, request, profile, capabilities, reasoningEffort, isStreaming, thinkingField) {
483
454
  const userVisionOverride = request.modelSettings?.supportsVision;
484
455
  const modelSupportsVision2 = userVisionOverride ?? profile.supportsVision ?? false;
485
- const convertedMessages = convertMessages(request.messages, modelSupportsVision2);
456
+ const convertedMessages = convertMessages(request.messages, modelSupportsVision2, thinkingField);
486
457
  const temperature = request.modelSettings?.temperature ?? request.temperature ?? profile.temperature;
487
458
  const maxTokens = request.modelSettings?.maxTokens ?? request.maxTokens ?? profile.defaultMaxTokens;
488
459
  const topP = request.modelSettings?.topP ?? profile.topP;
@@ -502,23 +473,34 @@ async function buildChatCompletionCreateParams(model, request, profile, capabili
502
473
  ;
503
474
  params["top_k"] = topK;
504
475
  }
505
- const shouldDisableThinking = disableThinking || request.disableThinking;
506
- if (capabilities.supportsChatTemplateKwargs && profile.supportsReasoning && shouldDisableThinking) {
476
+ const resolvedEffort = reasoningEffort ?? request.reasoningEffort;
477
+ if (resolvedEffort) {
507
478
  ;
508
- params["chat_template_kwargs"] = { enable_thinking: false };
479
+ params["reasoning_effort"] = resolvedEffort;
480
+ const chatTemplateKwargs = request.modelSettings?.chatTemplateKwargs;
481
+ if (chatTemplateKwargs) {
482
+ ;
483
+ params["chat_template_kwargs"] = chatTemplateKwargs;
484
+ } else if (capabilities.supportsChatTemplateKwargs) {
485
+ ;
486
+ params["chat_template_kwargs"] = {
487
+ enable_thinking: resolvedEffort !== "none"
488
+ };
489
+ }
509
490
  }
510
491
  const modelParams = buildModelParams({ temperature, topP, topK, maxTokens });
511
492
  return { params, modelParams };
512
493
  }
513
494
  async function buildCreateParamsFromInput(input, isStreaming) {
514
- const { model, request, profile, capabilities, disableThinking } = input;
495
+ const { model, request, profile, capabilities, reasoningEffort, thinkingField } = input;
515
496
  return buildChatCompletionCreateParams(
516
497
  model,
517
498
  request,
518
499
  profile,
519
500
  capabilities,
520
- !!disableThinking,
521
- isStreaming
501
+ reasoningEffort,
502
+ isStreaming,
503
+ thinkingField
522
504
  );
523
505
  }
524
506
  var buildNonStreamingCreateParams = (input) => buildCreateParamsFromInput(input, false);
@@ -537,20 +519,6 @@ function mapFinishReason(reason) {
537
519
  return "stop";
538
520
  }
539
521
  }
540
- function extractThinking(content) {
541
- const thinkRegex = /<think>([\s\S]*?)<\/think>/g;
542
- let thinkingContent = "";
543
- let cleanContent = content;
544
- let match;
545
- while ((match = thinkRegex.exec(content)) !== null) {
546
- thinkingContent += match[1];
547
- cleanContent = cleanContent.replace(match[0], "");
548
- }
549
- return {
550
- content: cleanContent.trim(),
551
- thinkingContent: thinkingContent.trim() || null
552
- };
553
- }
554
522
 
555
523
  // src/server/llm/streaming.ts
556
524
  async function* streamWithSegments(client, request) {
@@ -630,10 +598,9 @@ async function* streamWithSegments(client, request) {
630
598
  const ttft = ((firstTokenTime ?? endTime) - startTime) / 1e3;
631
599
  const completionTime = (endTime - (firstTokenTime ?? startTime)) / 1e3;
632
600
  const { promptTokens, completionTokens } = response.usage;
633
- const effectiveThinkingContent = thinkingContent || content === "" && response.reasoning_content || "";
634
601
  return {
635
602
  content,
636
- thinkingContent: effectiveThinkingContent,
603
+ thinkingContent,
637
604
  toolCalls,
638
605
  response,
639
606
  segments,
@@ -656,10 +623,10 @@ export {
656
623
  detectBackend,
657
624
  getBackendDisplayName,
658
625
  buildModelParams,
626
+ getThinking,
659
627
  buildNonStreamingCreateParams,
660
628
  buildStreamingCreateParams,
661
629
  mapFinishReason,
662
- extractThinking,
663
630
  streamWithSegments
664
631
  };
665
- //# sourceMappingURL=chunk-VIIRNJDT.js.map
632
+ //# sourceMappingURL=chunk-LXX2CPM5.js.map