openfox 2.0.13 → 2.0.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.
- package/dist/{chat-handler-6NUNVXIU.js → chat-handler-ITXCBFJK.js} +4 -4
- package/dist/{chunk-A52FXWJX.js → chunk-3SGGOBCL.js} +10 -387
- package/dist/{chunk-VFRWE5X4.js → chunk-4U45A7B3.js} +386 -2075
- package/dist/chunk-4W2Z4B5U.js +2077 -0
- package/dist/{chunk-2VDLXCLO.js → chunk-4ZTQO5JP.js} +31 -25
- package/dist/{chunk-EZJUU54W.js → chunk-7GJ6XYAF.js} +10 -8
- package/dist/{chunk-FQIT7VIA.js → chunk-LNEBVOH6.js} +6 -6
- package/dist/chunk-NWO6GRYE.js +39 -0
- package/dist/{chunk-HPCGVAS4.js → chunk-PP6VQXQW.js} +17 -1
- package/dist/chunk-PQ56PX7L.js +397 -0
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{config-BU66P4KX.js → config-YFHA5MWV.js} +2 -2
- package/dist/{orchestrator-WXEZHUVQ.js → orchestrator-VP74KOXI.js} +4 -4
- package/dist/package.json +3 -2
- package/dist/{processor-GA5NG3T7.js → processor-CCXZYLX6.js} +4 -4
- package/dist/{protocol-CaLuIetw.d.ts → protocol-BE5dRtYw.d.ts} +9 -0
- package/dist/{provider-QPECLUZ7.js → provider-QUJQLVOM.js} +7 -5
- package/dist/{provider-manager-YA2WALTF.js → provider-manager-DETXLDKW.js} +3 -2
- package/dist/{serve-TJHQ326L.js → serve-GA2UIHHB.js} +11 -7
- package/dist/server/index.d.ts +3 -2
- package/dist/server/index.js +8 -5
- package/dist/server-EA6W7YIC.js +29 -0
- package/dist/shared/index.d.ts +2 -2
- package/dist/tool-adapter-B7QP6NLA.js +7 -0
- package/dist/{tools-THXBQJ7A.js → tools-DUC54GEH.js} +5 -3
- package/dist/web/assets/{index-CQw-9GC9.js → index-D0qVcBva.js} +76 -75
- package/dist/web/assets/{index-Db3yUKBI.css → index-Ho_tVUbw.css} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildNonStreamingCreateParams,
|
|
3
|
+
buildStreamingCreateParams,
|
|
4
|
+
getBackendCapabilities,
|
|
5
|
+
getModelProfile,
|
|
6
|
+
getThinking,
|
|
7
|
+
mapFinishReason
|
|
8
|
+
} from "./chunk-Z4SWOUWC.js";
|
|
9
|
+
import {
|
|
10
|
+
logger
|
|
11
|
+
} from "./chunk-K44MW7JJ.js";
|
|
12
|
+
|
|
13
|
+
// src/server/llm/url-utils.ts
|
|
14
|
+
var VERSION_PREFIX_REGEX = /\/v\d+(\/|$)/;
|
|
15
|
+
function hasVersionPrefix(url) {
|
|
16
|
+
return VERSION_PREFIX_REGEX.test(url);
|
|
17
|
+
}
|
|
18
|
+
function ensureVersionPrefix(url, defaultVersion = "/v1") {
|
|
19
|
+
if (hasVersionPrefix(url)) return url;
|
|
20
|
+
return `${url.replace(/\/+$/, "")}${defaultVersion}`;
|
|
21
|
+
}
|
|
22
|
+
function stripVersionPrefix(url) {
|
|
23
|
+
return url.replace(/\/v\d+\/?$/, "");
|
|
24
|
+
}
|
|
25
|
+
function buildModelsUrl(baseUrl) {
|
|
26
|
+
return `${ensureVersionPrefix(baseUrl)}/models`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/server/llm/client.ts
|
|
30
|
+
import OpenAI from "openai";
|
|
31
|
+
|
|
32
|
+
// src/server/utils/errors.ts
|
|
33
|
+
var OpenFoxError = class extends Error {
|
|
34
|
+
constructor(message, code, details) {
|
|
35
|
+
super(message);
|
|
36
|
+
this.code = code;
|
|
37
|
+
this.details = details;
|
|
38
|
+
this.name = "OpenFoxError";
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var SessionNotFoundError = class extends OpenFoxError {
|
|
42
|
+
constructor(sessionId) {
|
|
43
|
+
super(`Session not found: ${sessionId}`, "SESSION_NOT_FOUND", { sessionId });
|
|
44
|
+
this.name = "SessionNotFoundError";
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var LLMError = class extends OpenFoxError {
|
|
48
|
+
constructor(message, details) {
|
|
49
|
+
super(message, "LLM_ERROR", details);
|
|
50
|
+
this.name = "LLMError";
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/server/llm/client.ts
|
|
55
|
+
import { Agent, setGlobalDispatcher } from "undici";
|
|
56
|
+
var agent = new Agent({ allowH2: true });
|
|
57
|
+
setGlobalDispatcher(agent);
|
|
58
|
+
function createLLMClient(config, initialBackend = "unknown") {
|
|
59
|
+
const baseURL = ensureVersionPrefix(config.llm.baseUrl);
|
|
60
|
+
const openai = new OpenAI({
|
|
61
|
+
baseURL,
|
|
62
|
+
apiKey: config.llm.apiKey ?? "not-needed"
|
|
63
|
+
});
|
|
64
|
+
let model = config.llm.model;
|
|
65
|
+
let profile = getModelProfile(model);
|
|
66
|
+
let backend = initialBackend;
|
|
67
|
+
let capabilities = getBackendCapabilities(backend);
|
|
68
|
+
const reasoningEffort = config.llm.reasoningEffort;
|
|
69
|
+
const thinkingField = config.llm.thinkingField;
|
|
70
|
+
const idleTimeout = config.llm.idleTimeout ?? 3e4;
|
|
71
|
+
return {
|
|
72
|
+
getModel() {
|
|
73
|
+
return model;
|
|
74
|
+
},
|
|
75
|
+
getProfile() {
|
|
76
|
+
return profile;
|
|
77
|
+
},
|
|
78
|
+
getBackend() {
|
|
79
|
+
return backend;
|
|
80
|
+
},
|
|
81
|
+
setBackend(newBackend) {
|
|
82
|
+
logger.debug("Setting LLM backend", { from: backend, to: newBackend });
|
|
83
|
+
backend = newBackend;
|
|
84
|
+
capabilities = getBackendCapabilities(newBackend);
|
|
85
|
+
},
|
|
86
|
+
setModel(newModel) {
|
|
87
|
+
const newProfile = getModelProfile(newModel);
|
|
88
|
+
logger.debug("Switching model", {
|
|
89
|
+
from: model,
|
|
90
|
+
to: newModel,
|
|
91
|
+
profile: newProfile.name,
|
|
92
|
+
temperature: newProfile.temperature
|
|
93
|
+
});
|
|
94
|
+
model = newModel;
|
|
95
|
+
profile = newProfile;
|
|
96
|
+
},
|
|
97
|
+
async complete(request) {
|
|
98
|
+
logger.debug("LLM complete request", {
|
|
99
|
+
messageCount: request.messages.length,
|
|
100
|
+
hasTools: !!request.tools?.length,
|
|
101
|
+
profile: profile.name,
|
|
102
|
+
reasoningEffort: request.reasoningEffort ?? reasoningEffort
|
|
103
|
+
});
|
|
104
|
+
try {
|
|
105
|
+
const resolvedEffort = request.reasoningEffort ?? reasoningEffort;
|
|
106
|
+
const { params: createParams } = await buildNonStreamingCreateParams({
|
|
107
|
+
model,
|
|
108
|
+
request,
|
|
109
|
+
profile,
|
|
110
|
+
capabilities,
|
|
111
|
+
...resolvedEffort ? { reasoningEffort: resolvedEffort } : {},
|
|
112
|
+
...thinkingField ? { thinkingField } : {}
|
|
113
|
+
});
|
|
114
|
+
const response = await openai.chat.completions.create(createParams, {
|
|
115
|
+
signal: request.signal
|
|
116
|
+
});
|
|
117
|
+
const choice = response.choices[0];
|
|
118
|
+
if (!choice) {
|
|
119
|
+
throw new LLMError("No completion choice returned");
|
|
120
|
+
}
|
|
121
|
+
const message = choice.message;
|
|
122
|
+
const content = message.content ?? "";
|
|
123
|
+
const thinkingContent = getThinking(message, thinkingField) ?? "";
|
|
124
|
+
const toolCalls = message.tool_calls?.map((tc) => ({
|
|
125
|
+
id: tc.id,
|
|
126
|
+
name: tc.function.name,
|
|
127
|
+
arguments: JSON.parse(tc.function.arguments)
|
|
128
|
+
}));
|
|
129
|
+
return {
|
|
130
|
+
id: response.id,
|
|
131
|
+
content,
|
|
132
|
+
...thinkingContent ? { thinkingContent } : {},
|
|
133
|
+
...toolCalls && toolCalls.length > 0 ? { toolCalls } : {},
|
|
134
|
+
finishReason: mapFinishReason(choice.finish_reason),
|
|
135
|
+
usage: {
|
|
136
|
+
promptTokens: response.usage?.prompt_tokens ?? 0,
|
|
137
|
+
completionTokens: response.usage?.completion_tokens ?? 0,
|
|
138
|
+
totalTokens: response.usage?.total_tokens ?? 0
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
} catch (error) {
|
|
142
|
+
logger.error("LLM complete error", { error: String(error) });
|
|
143
|
+
throw new LLMError(error instanceof Error ? error.message : "Unknown LLM error", {
|
|
144
|
+
originalError: error instanceof Error ? error : void 0
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
async *stream(request) {
|
|
149
|
+
const resolvedEffort = request.reasoningEffort ?? reasoningEffort;
|
|
150
|
+
logger.debug("LLM stream request", {
|
|
151
|
+
messageCount: request.messages.length,
|
|
152
|
+
hasTools: !!request.tools?.length,
|
|
153
|
+
profile: profile.name,
|
|
154
|
+
reasoningEffort: resolvedEffort,
|
|
155
|
+
idleTimeout
|
|
156
|
+
});
|
|
157
|
+
try {
|
|
158
|
+
const createParams = await buildStreamingCreateParams({
|
|
159
|
+
model,
|
|
160
|
+
request,
|
|
161
|
+
profile,
|
|
162
|
+
capabilities,
|
|
163
|
+
...resolvedEffort ? { reasoningEffort: resolvedEffort } : {},
|
|
164
|
+
...thinkingField ? { thinkingField } : {}
|
|
165
|
+
});
|
|
166
|
+
const { params: streamingParams } = createParams;
|
|
167
|
+
const stream = await openai.chat.completions.create(streamingParams, {
|
|
168
|
+
signal: request.signal
|
|
169
|
+
});
|
|
170
|
+
let fullContent = "";
|
|
171
|
+
let fullThinking = "";
|
|
172
|
+
const toolCalls = /* @__PURE__ */ new Map();
|
|
173
|
+
let finishReason = "stop";
|
|
174
|
+
let usage = { promptTokens: 0, completionTokens: 0, totalTokens: 0 };
|
|
175
|
+
let responseId = "";
|
|
176
|
+
let lastChunkTime = Date.now();
|
|
177
|
+
const idleTimeoutController = new AbortController();
|
|
178
|
+
const idleTimer = setInterval(() => {
|
|
179
|
+
const idleDuration = Date.now() - lastChunkTime;
|
|
180
|
+
if (idleDuration > idleTimeout) {
|
|
181
|
+
logger.warn("LLM stream idle timeout triggered", { idleDuration, idleTimeout });
|
|
182
|
+
idleTimeoutController.abort();
|
|
183
|
+
}
|
|
184
|
+
}, 100);
|
|
185
|
+
const onAbort = () => clearInterval(idleTimer);
|
|
186
|
+
request.signal?.addEventListener("abort", onAbort, { once: true });
|
|
187
|
+
try {
|
|
188
|
+
for await (const chunk of stream) {
|
|
189
|
+
if (idleTimeoutController.signal.aborted) {
|
|
190
|
+
throw new Error(`LLM stream idle timeout: no chunks received for ${idleTimeout}ms`);
|
|
191
|
+
}
|
|
192
|
+
lastChunkTime = Date.now();
|
|
193
|
+
responseId = chunk.id;
|
|
194
|
+
if (chunk.usage) {
|
|
195
|
+
usage = {
|
|
196
|
+
promptTokens: chunk.usage.prompt_tokens,
|
|
197
|
+
completionTokens: chunk.usage.completion_tokens,
|
|
198
|
+
totalTokens: chunk.usage.total_tokens
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
const choice = chunk.choices[0];
|
|
202
|
+
if (!choice) continue;
|
|
203
|
+
if (choice.finish_reason) {
|
|
204
|
+
finishReason = mapFinishReason(choice.finish_reason);
|
|
205
|
+
}
|
|
206
|
+
const delta = choice.delta;
|
|
207
|
+
const reasoning = getThinking(delta, thinkingField);
|
|
208
|
+
if (reasoning) {
|
|
209
|
+
fullThinking += reasoning;
|
|
210
|
+
yield { type: "thinking_delta", content: reasoning };
|
|
211
|
+
}
|
|
212
|
+
if (delta.content) {
|
|
213
|
+
fullContent += delta.content;
|
|
214
|
+
yield { type: "text_delta", content: delta.content };
|
|
215
|
+
}
|
|
216
|
+
if (delta.tool_calls) {
|
|
217
|
+
for (const tc of delta.tool_calls) {
|
|
218
|
+
const existing = toolCalls.get(tc.index);
|
|
219
|
+
if (!existing) {
|
|
220
|
+
toolCalls.set(tc.index, {
|
|
221
|
+
id: tc.id ?? "",
|
|
222
|
+
name: tc.function?.name ?? "",
|
|
223
|
+
arguments: tc.function?.arguments ?? ""
|
|
224
|
+
});
|
|
225
|
+
} else {
|
|
226
|
+
if (tc.id) existing.id = tc.id;
|
|
227
|
+
if (tc.function?.name) existing.name += tc.function.name;
|
|
228
|
+
if (tc.function?.arguments) existing.arguments += tc.function.arguments;
|
|
229
|
+
}
|
|
230
|
+
yield {
|
|
231
|
+
type: "tool_call_delta",
|
|
232
|
+
index: tc.index,
|
|
233
|
+
...tc.id ? { id: tc.id } : {},
|
|
234
|
+
...tc.function?.name ? { name: tc.function.name } : {},
|
|
235
|
+
...tc.function?.arguments ? { arguments: tc.function.arguments } : {}
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
} finally {
|
|
241
|
+
clearInterval(idleTimer);
|
|
242
|
+
request.signal?.removeEventListener("abort", onAbort);
|
|
243
|
+
}
|
|
244
|
+
const finalContent = fullContent.trim();
|
|
245
|
+
const finalThinking = fullThinking.trim();
|
|
246
|
+
const parsedToolCalls = [];
|
|
247
|
+
for (const [, tc] of toolCalls) {
|
|
248
|
+
try {
|
|
249
|
+
parsedToolCalls.push({
|
|
250
|
+
id: tc.id,
|
|
251
|
+
name: tc.name,
|
|
252
|
+
arguments: JSON.parse(tc.arguments)
|
|
253
|
+
});
|
|
254
|
+
} catch (error) {
|
|
255
|
+
logger.warn("Failed to parse tool call arguments", { name: tc.name, arguments: tc.arguments });
|
|
256
|
+
parsedToolCalls.push({
|
|
257
|
+
id: tc.id,
|
|
258
|
+
name: tc.name,
|
|
259
|
+
arguments: {},
|
|
260
|
+
parseError: error instanceof Error ? error.message : "Unknown JSON parse error",
|
|
261
|
+
rawArguments: tc.arguments
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
yield {
|
|
266
|
+
type: "done",
|
|
267
|
+
response: {
|
|
268
|
+
id: responseId,
|
|
269
|
+
content: finalContent,
|
|
270
|
+
...finalThinking ? { thinkingContent: finalThinking } : {},
|
|
271
|
+
...parsedToolCalls.length > 0 ? { toolCalls: parsedToolCalls } : {},
|
|
272
|
+
finishReason,
|
|
273
|
+
usage
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
} catch (error) {
|
|
277
|
+
logger.error("LLM stream error", { error });
|
|
278
|
+
yield {
|
|
279
|
+
type: "error",
|
|
280
|
+
error: error instanceof Error ? error.message : "Unknown LLM error"
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// src/server/llm/models.ts
|
|
288
|
+
var modelCache = /* @__PURE__ */ new Map();
|
|
289
|
+
var llmStatus = "unknown";
|
|
290
|
+
var lastActiveUrl = null;
|
|
291
|
+
var CACHE_TTL_MS = 3e4;
|
|
292
|
+
function getCacheKey(url) {
|
|
293
|
+
return stripVersionPrefix(url);
|
|
294
|
+
}
|
|
295
|
+
async function detectModel(llmBaseUrl, retries = 3, silent = false) {
|
|
296
|
+
const cacheKey = getCacheKey(llmBaseUrl);
|
|
297
|
+
const now = Date.now();
|
|
298
|
+
const cached = modelCache.get(cacheKey);
|
|
299
|
+
if (cached && now - cached.timestamp < CACHE_TTL_MS) {
|
|
300
|
+
lastActiveUrl = cacheKey;
|
|
301
|
+
llmStatus = "connected";
|
|
302
|
+
return cached.model;
|
|
303
|
+
}
|
|
304
|
+
const url = buildModelsUrl(llmBaseUrl);
|
|
305
|
+
for (let attempt = 1; attempt <= retries; attempt++) {
|
|
306
|
+
try {
|
|
307
|
+
if (silent) {
|
|
308
|
+
logger.debug("Fetching models from LLM server", { url, attempt });
|
|
309
|
+
}
|
|
310
|
+
const response = await fetch(url, {
|
|
311
|
+
signal: AbortSignal.timeout(1e4)
|
|
312
|
+
});
|
|
313
|
+
if (!response.ok) {
|
|
314
|
+
if (silent) {
|
|
315
|
+
logger.debug("Failed to fetch models from LLM server", { status: response.status, attempt });
|
|
316
|
+
} else {
|
|
317
|
+
logger.warn("Failed to fetch models from LLM server", { status: response.status, attempt });
|
|
318
|
+
}
|
|
319
|
+
if (attempt < retries) {
|
|
320
|
+
await new Promise((r) => setTimeout(r, 1e3 * attempt));
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
llmStatus = "disconnected";
|
|
324
|
+
return cached?.model ?? null;
|
|
325
|
+
}
|
|
326
|
+
const data = await response.json();
|
|
327
|
+
if (data.data && data.data.length > 0) {
|
|
328
|
+
const modelData = data.data[0];
|
|
329
|
+
const modelId = modelData.id;
|
|
330
|
+
modelCache.set(cacheKey, {
|
|
331
|
+
model: modelId,
|
|
332
|
+
modelInfo: modelData,
|
|
333
|
+
timestamp: now
|
|
334
|
+
});
|
|
335
|
+
lastActiveUrl = cacheKey;
|
|
336
|
+
llmStatus = "connected";
|
|
337
|
+
if (silent) {
|
|
338
|
+
logger.debug("Detected LLM model", {
|
|
339
|
+
model: modelId,
|
|
340
|
+
maxLen: modelData.max_model_len,
|
|
341
|
+
root: modelData.root
|
|
342
|
+
});
|
|
343
|
+
} else {
|
|
344
|
+
logger.info("Detected LLM model", {
|
|
345
|
+
model: modelId,
|
|
346
|
+
maxLen: modelData.max_model_len,
|
|
347
|
+
root: modelData.root
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
return modelId;
|
|
351
|
+
}
|
|
352
|
+
if (silent) {
|
|
353
|
+
logger.debug("LLM server returned empty models list");
|
|
354
|
+
} else {
|
|
355
|
+
logger.warn("LLM server returned empty models list");
|
|
356
|
+
}
|
|
357
|
+
llmStatus = "disconnected";
|
|
358
|
+
return null;
|
|
359
|
+
} catch (error) {
|
|
360
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
361
|
+
if (silent) {
|
|
362
|
+
logger.debug("Could not detect model from LLM server", { error: errMsg, attempt });
|
|
363
|
+
} else {
|
|
364
|
+
logger.warn("Could not detect model from LLM server", { error: errMsg, attempt });
|
|
365
|
+
}
|
|
366
|
+
if (attempt < retries) {
|
|
367
|
+
await new Promise((r) => setTimeout(r, 1e3 * attempt));
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
llmStatus = "disconnected";
|
|
373
|
+
return cached?.model ?? null;
|
|
374
|
+
}
|
|
375
|
+
function getLlmStatus() {
|
|
376
|
+
return llmStatus;
|
|
377
|
+
}
|
|
378
|
+
function clearModelCache(url) {
|
|
379
|
+
if (url) {
|
|
380
|
+
modelCache.delete(getCacheKey(url));
|
|
381
|
+
} else {
|
|
382
|
+
modelCache.clear();
|
|
383
|
+
}
|
|
384
|
+
llmStatus = "unknown";
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export {
|
|
388
|
+
SessionNotFoundError,
|
|
389
|
+
ensureVersionPrefix,
|
|
390
|
+
stripVersionPrefix,
|
|
391
|
+
buildModelsUrl,
|
|
392
|
+
createLLMClient,
|
|
393
|
+
detectModel,
|
|
394
|
+
getLlmStatus,
|
|
395
|
+
clearModelCache
|
|
396
|
+
};
|
|
397
|
+
//# sourceMappingURL=chunk-PQ56PX7L.js.map
|
package/dist/cli/dev.js
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
saveGlobalConfig,
|
|
14
14
|
setDefaultModelSelection,
|
|
15
15
|
updateProvider
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-PP6VQXQW.js";
|
|
17
17
|
import "./chunk-CQGTEGKL.js";
|
|
18
18
|
export {
|
|
19
19
|
activateProvider,
|
|
@@ -31,4 +31,4 @@ export {
|
|
|
31
31
|
setDefaultModelSelection,
|
|
32
32
|
updateProvider
|
|
33
33
|
};
|
|
34
|
-
//# sourceMappingURL=config-
|
|
34
|
+
//# sourceMappingURL=config-YFHA5MWV.js.map
|
|
@@ -2,8 +2,9 @@ import {
|
|
|
2
2
|
injectWorkflowKickoffIfNeeded,
|
|
3
3
|
runAgentTurn,
|
|
4
4
|
runChatTurn
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-7GJ6XYAF.js";
|
|
6
|
+
import "./chunk-4ZTQO5JP.js";
|
|
7
|
+
import "./chunk-XAMAYRDA.js";
|
|
7
8
|
import {
|
|
8
9
|
TurnMetrics,
|
|
9
10
|
createChatDoneEvent,
|
|
@@ -15,7 +16,6 @@ import {
|
|
|
15
16
|
import "./chunk-DL6ZILAF.js";
|
|
16
17
|
import "./chunk-PBGOZMVY.js";
|
|
17
18
|
import "./chunk-VRGRAQDG.js";
|
|
18
|
-
import "./chunk-XAMAYRDA.js";
|
|
19
19
|
import "./chunk-SYG2ENUQ.js";
|
|
20
20
|
import "./chunk-LX66KJPL.js";
|
|
21
21
|
import "./chunk-3QB2RMX2.js";
|
|
@@ -37,4 +37,4 @@ export {
|
|
|
37
37
|
runAgentTurn,
|
|
38
38
|
runChatTurn
|
|
39
39
|
};
|
|
40
|
-
//# sourceMappingURL=orchestrator-
|
|
40
|
+
//# sourceMappingURL=orchestrator-VP74KOXI.js.map
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openfox",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.14",
|
|
4
4
|
"description": "Local-LLM-first agentic coding assistant",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@clack/prompts": "^1.1.0",
|
|
62
62
|
"@fontsource/jetbrains-mono": "^5.2.8",
|
|
63
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
63
64
|
"@xterm/addon-fit": "^0.11.0",
|
|
64
65
|
"@xterm/xterm": "^6.0.0",
|
|
65
66
|
"bash-language-server": "^5.6.0",
|
|
@@ -82,9 +83,9 @@
|
|
|
82
83
|
"sql-language-server": "^1.7.1",
|
|
83
84
|
"strip-ansi": "^7.2.0",
|
|
84
85
|
"turndown": "^7.2.2",
|
|
85
|
-
"undici": "^8.5.0",
|
|
86
86
|
"typescript": "^5.8.2",
|
|
87
87
|
"typescript-language-server": "^5.1.3",
|
|
88
|
+
"undici": "^8.5.0",
|
|
88
89
|
"vite": "^6.1.0",
|
|
89
90
|
"vscode-jsonrpc": "^8.2.1",
|
|
90
91
|
"vscode-langservers-extracted": "^4.10.0",
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
getSessionMessageCount,
|
|
7
7
|
needsNameGenerationCheck
|
|
8
8
|
} from "./chunk-TIKQWNYK.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-4ZTQO5JP.js";
|
|
10
|
+
import "./chunk-XAMAYRDA.js";
|
|
10
11
|
import "./chunk-L7TDUIQY.js";
|
|
11
12
|
import "./chunk-DL6ZILAF.js";
|
|
12
13
|
import "./chunk-PBGOZMVY.js";
|
|
13
14
|
import "./chunk-VRGRAQDG.js";
|
|
14
|
-
import "./chunk-XAMAYRDA.js";
|
|
15
15
|
import {
|
|
16
16
|
getEventStore
|
|
17
17
|
} from "./chunk-SYG2ENUQ.js";
|
|
@@ -191,7 +191,7 @@ var QueueProcessor = class {
|
|
|
191
191
|
backend: provider?.backend ?? llmClient.getBackend(),
|
|
192
192
|
model: llmClient.getModel()
|
|
193
193
|
};
|
|
194
|
-
const { runChatTurn } = await import("./orchestrator-
|
|
194
|
+
const { runChatTurn } = await import("./orchestrator-VP74KOXI.js");
|
|
195
195
|
const runChatTurnParams = buildRunChatTurnParams({
|
|
196
196
|
sessionManager,
|
|
197
197
|
sessionId,
|
|
@@ -239,4 +239,4 @@ var QueueProcessor = class {
|
|
|
239
239
|
export {
|
|
240
240
|
QueueProcessor
|
|
241
241
|
};
|
|
242
|
-
//# sourceMappingURL=processor-
|
|
242
|
+
//# sourceMappingURL=processor-CCXZYLX6.js.map
|
|
@@ -483,6 +483,15 @@ interface Config {
|
|
|
483
483
|
workdir: string;
|
|
484
484
|
/** Active workflow ID (defaults to "default") */
|
|
485
485
|
activeWorkflowId?: string | undefined;
|
|
486
|
+
/** MCP server configurations */
|
|
487
|
+
mcpServers?: Record<string, {
|
|
488
|
+
transport: 'stdio' | 'http';
|
|
489
|
+
command?: string;
|
|
490
|
+
args?: string[];
|
|
491
|
+
env?: Record<string, string>;
|
|
492
|
+
url?: string;
|
|
493
|
+
disabledTools?: string[];
|
|
494
|
+
}> | undefined;
|
|
486
495
|
}
|
|
487
496
|
interface ElementData {
|
|
488
497
|
tag: string;
|
|
@@ -5,12 +5,14 @@ import {
|
|
|
5
5
|
loadGlobalConfig,
|
|
6
6
|
removeProvider,
|
|
7
7
|
saveGlobalConfig
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-PP6VQXQW.js";
|
|
9
9
|
import "./chunk-CQGTEGKL.js";
|
|
10
10
|
import {
|
|
11
|
-
detectModel,
|
|
12
11
|
fetchAvailableModelsFromBackend
|
|
13
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3SGGOBCL.js";
|
|
13
|
+
import {
|
|
14
|
+
detectModel
|
|
15
|
+
} from "./chunk-PQ56PX7L.js";
|
|
14
16
|
import "./chunk-Z4SWOUWC.js";
|
|
15
17
|
import "./chunk-K44MW7JJ.js";
|
|
16
18
|
|
|
@@ -252,7 +254,7 @@ async function runProviderAdd(mode) {
|
|
|
252
254
|
isActive: makeActive
|
|
253
255
|
});
|
|
254
256
|
if (makeActive) {
|
|
255
|
-
const { setDefaultModelSelection } = await import("./config-
|
|
257
|
+
const { setDefaultModelSelection } = await import("./config-YFHA5MWV.js");
|
|
256
258
|
newConfig = setDefaultModelSelection(
|
|
257
259
|
newConfig,
|
|
258
260
|
newConfig.providers[newConfig.providers.length - 1].id,
|
|
@@ -380,4 +382,4 @@ export {
|
|
|
380
382
|
runProviderRemove,
|
|
381
383
|
runProviderUse
|
|
382
384
|
};
|
|
383
|
-
//# sourceMappingURL=provider-
|
|
385
|
+
//# sourceMappingURL=provider-QUJQLVOM.js.map
|
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
fetchAvailableModelsFromBackend,
|
|
4
4
|
fetchModelsWithContext,
|
|
5
5
|
parseDefaultModelSelection
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3SGGOBCL.js";
|
|
7
|
+
import "./chunk-PQ56PX7L.js";
|
|
7
8
|
import "./chunk-Z4SWOUWC.js";
|
|
8
9
|
import "./chunk-K44MW7JJ.js";
|
|
9
10
|
export {
|
|
@@ -12,4 +13,4 @@ export {
|
|
|
12
13
|
fetchModelsWithContext,
|
|
13
14
|
parseDefaultModelSelection
|
|
14
15
|
};
|
|
15
|
-
//# sourceMappingURL=provider-manager-
|
|
16
|
+
//# sourceMappingURL=provider-manager-DETXLDKW.js.map
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
VERSION,
|
|
3
3
|
createServer
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4U45A7B3.js";
|
|
5
|
+
import "./chunk-4W2Z4B5U.js";
|
|
5
6
|
import "./chunk-FWJ6YXGA.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-NWO6GRYE.js";
|
|
8
|
+
import "./chunk-7GJ6XYAF.js";
|
|
9
|
+
import "./chunk-4ZTQO5JP.js";
|
|
10
|
+
import "./chunk-XAMAYRDA.js";
|
|
8
11
|
import "./chunk-L7TDUIQY.js";
|
|
9
12
|
import "./chunk-DL6ZILAF.js";
|
|
10
13
|
import "./chunk-PBGOZMVY.js";
|
|
11
14
|
import "./chunk-VRGRAQDG.js";
|
|
12
|
-
import "./chunk-XAMAYRDA.js";
|
|
13
15
|
import {
|
|
14
16
|
loadConfig
|
|
15
17
|
} from "./chunk-SYG2ENUQ.js";
|
|
@@ -24,13 +26,14 @@ import {
|
|
|
24
26
|
getActiveProvider,
|
|
25
27
|
getDefaultModel,
|
|
26
28
|
loadGlobalConfig
|
|
27
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-PP6VQXQW.js";
|
|
28
30
|
import {
|
|
29
31
|
ensureDataDirExists,
|
|
30
32
|
getDatabasePath,
|
|
31
33
|
getGlobalConfigPath
|
|
32
34
|
} from "./chunk-CQGTEGKL.js";
|
|
33
|
-
import "./chunk-
|
|
35
|
+
import "./chunk-3SGGOBCL.js";
|
|
36
|
+
import "./chunk-PQ56PX7L.js";
|
|
34
37
|
import "./chunk-Z4SWOUWC.js";
|
|
35
38
|
import {
|
|
36
39
|
logger
|
|
@@ -167,6 +170,7 @@ async function runServe(options) {
|
|
|
167
170
|
activeProviderId: globalConfig.activeProviderId,
|
|
168
171
|
activeWorkflowId: globalConfig.activeWorkflowId,
|
|
169
172
|
defaultModelSelection: globalConfig.defaultModelSelection,
|
|
173
|
+
mcpServers: globalConfig.mcpServers,
|
|
170
174
|
// Workdir precedence: .env override → global config → process.cwd()
|
|
171
175
|
// Normalize: remove trailing slash to prevent double slashes in paths
|
|
172
176
|
workdir: (process.env["OPENFOX_WORKDIR"] ?? globalConfig.workspace?.workdir ?? process.cwd()).replace(/\/$/, "")
|
|
@@ -189,4 +193,4 @@ async function runServe(options) {
|
|
|
189
193
|
export {
|
|
190
194
|
runServe
|
|
191
195
|
};
|
|
192
|
-
//# sourceMappingURL=serve-
|
|
196
|
+
//# sourceMappingURL=serve-GA2UIHHB.js.map
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aO as ToolCall, c as Attachment, R as Diagnostic, an as Provider, ab as ModelConfig, aA as Session, aJ as SessionSummary, aj as Project, aE as SessionMode, aG as SessionPhase, M as Message, J as Criterion, L as CriterionStatus, a8 as MetadataEntry, aw as QueuedMessage, F as ContextState, O as DangerLevel$1, ay as ServerMessage, aL as StatsIdentity, aR as ToolResult, D as Config } from '../protocol-
|
|
1
|
+
import { aO as ToolCall, c as Attachment, R as Diagnostic, an as Provider, ab as ModelConfig, aA as Session, aJ as SessionSummary, aj as Project, aE as SessionMode, aG as SessionPhase, M as Message, J as Criterion, L as CriterionStatus, a8 as MetadataEntry, aw as QueuedMessage, F as ContextState, O as DangerLevel$1, ay as ServerMessage, aL as StatsIdentity, aR as ToolResult, D as Config } from '../protocol-BE5dRtYw.js';
|
|
2
2
|
import { Server } from 'node:http';
|
|
3
3
|
|
|
4
4
|
interface LLMMessage {
|
|
@@ -478,9 +478,10 @@ declare class SessionManager {
|
|
|
478
478
|
* Update execution state.
|
|
479
479
|
*/
|
|
480
480
|
updateExecutionState(sessionId: string, updates: Record<string, unknown>): void;
|
|
481
|
-
setCachedPrompt(sessionId: string, systemPrompt: string, hash: string): void;
|
|
481
|
+
setCachedPrompt(sessionId: string, systemPrompt: string, tools: LLMToolDefinition[], hash: string): void;
|
|
482
482
|
getCachedPrompt(sessionId: string): {
|
|
483
483
|
systemPrompt: string;
|
|
484
|
+
tools: LLMToolDefinition[];
|
|
484
485
|
hash: string;
|
|
485
486
|
} | undefined;
|
|
486
487
|
setDynamicContextChanged(sessionId: string, changed: boolean): void;
|
package/dist/server/index.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createServer,
|
|
3
3
|
createServerHandle
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-4U45A7B3.js";
|
|
5
|
+
import "../chunk-4W2Z4B5U.js";
|
|
5
6
|
import "../chunk-FWJ6YXGA.js";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-NWO6GRYE.js";
|
|
8
|
+
import "../chunk-7GJ6XYAF.js";
|
|
9
|
+
import "../chunk-4ZTQO5JP.js";
|
|
10
|
+
import "../chunk-XAMAYRDA.js";
|
|
8
11
|
import "../chunk-L7TDUIQY.js";
|
|
9
12
|
import "../chunk-DL6ZILAF.js";
|
|
10
13
|
import "../chunk-PBGOZMVY.js";
|
|
11
14
|
import "../chunk-VRGRAQDG.js";
|
|
12
|
-
import "../chunk-XAMAYRDA.js";
|
|
13
15
|
import "../chunk-SYG2ENUQ.js";
|
|
14
16
|
import "../chunk-LX66KJPL.js";
|
|
15
17
|
import "../chunk-3QB2RMX2.js";
|
|
@@ -19,7 +21,8 @@ import "../chunk-FBGWG4N6.js";
|
|
|
19
21
|
import "../chunk-VUQCQXXJ.js";
|
|
20
22
|
import "../chunk-5BDVM6YI.js";
|
|
21
23
|
import "../chunk-CQGTEGKL.js";
|
|
22
|
-
import "../chunk-
|
|
24
|
+
import "../chunk-3SGGOBCL.js";
|
|
25
|
+
import "../chunk-PQ56PX7L.js";
|
|
23
26
|
import "../chunk-Z4SWOUWC.js";
|
|
24
27
|
import "../chunk-K44MW7JJ.js";
|
|
25
28
|
export {
|