openfox 2.0.0-beta.14 → 2.0.0-beta.15
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/{ask-BRLFZKEW.js → ask-5SSOA6SZ.js} +1 -2
- package/dist/{auth-OGGBJFJQ.js → auth-56SIRACI.js} +1 -2
- package/dist/{branch.api-TCWNJXYA.js → branch.api-PWFW26KC.js} +1 -2
- package/dist/{chat-handler-ZFQIJIJT.js → chat-handler-7QLHIQOM.js} +3 -4
- package/dist/chunk-4F3C6X4M.js +381 -0
- package/dist/{chunk-BZJAO4VY.js → chunk-6CVDQJDV.js} +2 -2
- package/dist/{chunk-YWYYRA2P.js → chunk-AKF52COZ.js} +11 -11
- package/dist/{chunk-RUWSVV7U.js → chunk-D2QILH47.js} +3 -3
- package/dist/{chunk-EYE2JMLA.js → chunk-K6SMOWET.js} +51 -51
- package/dist/{chunk-BURBTNDG.js → chunk-N53OLRIU.js} +2 -2
- package/dist/{chunk-IONKVOSF.js → chunk-W52UQCER.js} +6 -6
- package/dist/cli/dev.js +1 -2
- package/dist/cli/index.js +1 -2
- package/dist/{compactor-WL33VHUF.js → compactor-TDNRM3A7.js} +1 -2
- package/dist/{config-MFKBDOOT.js → config-B6HYTLT4.js} +3 -4
- package/dist/{events-6UJR2NH4.js → events-R7FRQEBE.js} +1 -2
- package/dist/{folding-GMO644G3.js → folding-YOCGTZYH.js} +1 -2
- package/dist/{inspect-proxy-JZ54RBUN.js → inspect-proxy-42ZXL2R5.js} +1 -2
- package/dist/{manager-NTL3MLGN.js → manager-W7N3XQ4Q.js} +1 -2
- package/dist/{orchestrator-HHF4UC3K.js → orchestrator-2AK4AYUD.js} +3 -4
- package/dist/package.json +1 -1
- package/dist/{paths-D7BBTOO5.js → paths-X46PPOI2.js} +1 -2
- package/dist/{permissions-YGAJ47F5.js → permissions-Z2IIV2V7.js} +1 -3
- package/dist/{processor-EJJTSLRL.js → processor-IU56GBIW.js} +2 -3
- package/dist/{project-creator-GMS5YKEF.js → project-creator-6DU7E75S.js} +1 -2
- package/dist/{projects-QHGMUKWH.js → projects-2HYIZC4Y.js} +1 -2
- package/dist/{protocol-QQNATDFM.js → protocol-CN24IKQN.js} +1 -2
- package/dist/{provider-APFZV234.js → provider-2JAXE5EA.js} +5 -6
- package/dist/{provider-manager-2NFFVCX5.js → provider-manager-JMLJSPNX.js} +3 -4
- package/dist/{pwa-WYVG3NLS.js → pwa-76XP2DY2.js} +1 -2
- package/dist/{serve-GTH76EDG.js → serve-NMNHOT4M.js} +7 -8
- package/dist/server/index.js +5 -6
- package/dist/{service-W43DAQ5K.js → service-GB7AIOG5.js} +1 -3
- package/dist/{settings-OAISIQVV.js → settings-6XX56F3F.js} +1 -2
- package/dist/shared/index.js +0 -1
- package/dist/{store-JZW6VPEK.js → store-OQ45KONN.js} +1 -2
- package/dist/{tools-2X2FC6W7.js → tools-VJMWGBUO.js} +2 -3
- package/package.json +1 -1
- package/dist/chunk-7D4SUZUM.js +0 -38
- package/dist/chunk-QD6U3BDD.js +0 -25277
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
hasPendingQuestion,
|
|
8
8
|
provideAnswer
|
|
9
9
|
} from "./chunk-BJYPTN5S.js";
|
|
10
|
-
import "./chunk-7D4SUZUM.js";
|
|
11
10
|
export {
|
|
12
11
|
AskUserInterrupt,
|
|
13
12
|
askUserTool,
|
|
@@ -17,4 +16,4 @@ export {
|
|
|
17
16
|
hasPendingQuestion,
|
|
18
17
|
provideAnswer
|
|
19
18
|
};
|
|
20
|
-
//# sourceMappingURL=ask-
|
|
19
|
+
//# sourceMappingURL=ask-5SSOA6SZ.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getAuthConfigPath
|
|
3
3
|
} from "./chunk-CQGTEGKL.js";
|
|
4
|
-
import "./chunk-7D4SUZUM.js";
|
|
5
4
|
|
|
6
5
|
// src/cli/auth.ts
|
|
7
6
|
import { readFile, writeFile, mkdir, access } from "fs/promises";
|
|
@@ -48,4 +47,4 @@ export {
|
|
|
48
47
|
saveAuthConfig,
|
|
49
48
|
verifyPassword
|
|
50
49
|
};
|
|
51
|
-
//# sourceMappingURL=auth-
|
|
50
|
+
//# sourceMappingURL=auth-56SIRACI.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
logger
|
|
3
3
|
} from "./chunk-K44MW7JJ.js";
|
|
4
|
-
import "./chunk-7D4SUZUM.js";
|
|
5
4
|
|
|
6
5
|
// src/server/branch.api.ts
|
|
7
6
|
import { spawn } from "child_process";
|
|
@@ -46,4 +45,4 @@ function getGitBranch(cwd) {
|
|
|
46
45
|
export {
|
|
47
46
|
getCurrentBranch
|
|
48
47
|
};
|
|
49
|
-
//# sourceMappingURL=branch.api-
|
|
48
|
+
//# sourceMappingURL=branch.api-PWFW26KC.js.map
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
} from "./chunk-OKLV3ZNN.js";
|
|
9
9
|
import {
|
|
10
10
|
runChatTurn
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-D2QILH47.js";
|
|
12
|
+
import "./chunk-W52UQCER.js";
|
|
13
13
|
import "./chunk-DL6ZILAF.js";
|
|
14
14
|
import "./chunk-PBGOZMVY.js";
|
|
15
15
|
import "./chunk-VRGRAQDG.js";
|
|
@@ -32,7 +32,6 @@ import "./chunk-LXX2CPM5.js";
|
|
|
32
32
|
import {
|
|
33
33
|
logger
|
|
34
34
|
} from "./chunk-K44MW7JJ.js";
|
|
35
|
-
import "./chunk-7D4SUZUM.js";
|
|
36
35
|
|
|
37
36
|
// src/server/session/chat-handler.ts
|
|
38
37
|
var activeAgents = /* @__PURE__ */ new Map();
|
|
@@ -162,4 +161,4 @@ export {
|
|
|
162
161
|
startChatSession,
|
|
163
162
|
stopSessionExecution
|
|
164
163
|
};
|
|
165
|
-
//# sourceMappingURL=chat-handler-
|
|
164
|
+
//# sourceMappingURL=chat-handler-7QLHIQOM.js.map
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildModelsUrl,
|
|
3
|
+
buildNonStreamingCreateParams,
|
|
4
|
+
buildStreamingCreateParams,
|
|
5
|
+
ensureVersionPrefix,
|
|
6
|
+
getBackendCapabilities,
|
|
7
|
+
getModelProfile,
|
|
8
|
+
getThinking,
|
|
9
|
+
mapFinishReason,
|
|
10
|
+
stripVersionPrefix
|
|
11
|
+
} from "./chunk-LXX2CPM5.js";
|
|
12
|
+
import {
|
|
13
|
+
logger
|
|
14
|
+
} from "./chunk-K44MW7JJ.js";
|
|
15
|
+
|
|
16
|
+
// src/server/llm/client.ts
|
|
17
|
+
import OpenAI from "openai";
|
|
18
|
+
|
|
19
|
+
// src/server/utils/errors.ts
|
|
20
|
+
var OpenFoxError = class extends Error {
|
|
21
|
+
constructor(message, code, details) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.code = code;
|
|
24
|
+
this.details = details;
|
|
25
|
+
this.name = "OpenFoxError";
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var SessionNotFoundError = class extends OpenFoxError {
|
|
29
|
+
constructor(sessionId) {
|
|
30
|
+
super(`Session not found: ${sessionId}`, "SESSION_NOT_FOUND", { sessionId });
|
|
31
|
+
this.name = "SessionNotFoundError";
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var LLMError = class extends OpenFoxError {
|
|
35
|
+
constructor(message, details) {
|
|
36
|
+
super(message, "LLM_ERROR", details);
|
|
37
|
+
this.name = "LLMError";
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// src/server/llm/client.ts
|
|
42
|
+
import { Agent, setGlobalDispatcher } from "undici";
|
|
43
|
+
var agent = new Agent({ allowH2: true });
|
|
44
|
+
setGlobalDispatcher(agent);
|
|
45
|
+
function createLLMClient(config, initialBackend = "unknown") {
|
|
46
|
+
const baseURL = ensureVersionPrefix(config.llm.baseUrl);
|
|
47
|
+
const openai = new OpenAI({
|
|
48
|
+
baseURL,
|
|
49
|
+
apiKey: config.llm.apiKey ?? "not-needed"
|
|
50
|
+
});
|
|
51
|
+
let model = config.llm.model;
|
|
52
|
+
let profile = getModelProfile(model);
|
|
53
|
+
let backend = initialBackend;
|
|
54
|
+
let capabilities = getBackendCapabilities(backend);
|
|
55
|
+
const reasoningEffort = config.llm.reasoningEffort;
|
|
56
|
+
const thinkingField = config.llm.thinkingField;
|
|
57
|
+
const idleTimeout = config.llm.idleTimeout ?? 3e4;
|
|
58
|
+
return {
|
|
59
|
+
getModel() {
|
|
60
|
+
return model;
|
|
61
|
+
},
|
|
62
|
+
getProfile() {
|
|
63
|
+
return profile;
|
|
64
|
+
},
|
|
65
|
+
getBackend() {
|
|
66
|
+
return backend;
|
|
67
|
+
},
|
|
68
|
+
setBackend(newBackend) {
|
|
69
|
+
logger.debug("Setting LLM backend", { from: backend, to: newBackend });
|
|
70
|
+
backend = newBackend;
|
|
71
|
+
capabilities = getBackendCapabilities(newBackend);
|
|
72
|
+
},
|
|
73
|
+
setModel(newModel) {
|
|
74
|
+
const newProfile = getModelProfile(newModel);
|
|
75
|
+
logger.debug("Switching model", {
|
|
76
|
+
from: model,
|
|
77
|
+
to: newModel,
|
|
78
|
+
profile: newProfile.name,
|
|
79
|
+
temperature: newProfile.temperature
|
|
80
|
+
});
|
|
81
|
+
model = newModel;
|
|
82
|
+
profile = newProfile;
|
|
83
|
+
},
|
|
84
|
+
async complete(request) {
|
|
85
|
+
logger.debug("LLM complete request", {
|
|
86
|
+
messageCount: request.messages.length,
|
|
87
|
+
hasTools: !!request.tools?.length,
|
|
88
|
+
profile: profile.name,
|
|
89
|
+
reasoningEffort: request.reasoningEffort ?? reasoningEffort
|
|
90
|
+
});
|
|
91
|
+
try {
|
|
92
|
+
const resolvedEffort = request.reasoningEffort ?? reasoningEffort;
|
|
93
|
+
const { params: createParams } = await buildNonStreamingCreateParams({
|
|
94
|
+
model,
|
|
95
|
+
request,
|
|
96
|
+
profile,
|
|
97
|
+
capabilities,
|
|
98
|
+
...resolvedEffort ? { reasoningEffort: resolvedEffort } : {},
|
|
99
|
+
...thinkingField ? { thinkingField } : {}
|
|
100
|
+
});
|
|
101
|
+
const response = await openai.chat.completions.create(createParams, {
|
|
102
|
+
signal: request.signal
|
|
103
|
+
});
|
|
104
|
+
const choice = response.choices[0];
|
|
105
|
+
if (!choice) {
|
|
106
|
+
throw new LLMError("No completion choice returned");
|
|
107
|
+
}
|
|
108
|
+
const message = choice.message;
|
|
109
|
+
const content = message.content ?? "";
|
|
110
|
+
const thinkingContent = getThinking(message, thinkingField) ?? "";
|
|
111
|
+
const toolCalls = message.tool_calls?.map((tc) => ({
|
|
112
|
+
id: tc.id,
|
|
113
|
+
name: tc.function.name,
|
|
114
|
+
arguments: JSON.parse(tc.function.arguments)
|
|
115
|
+
}));
|
|
116
|
+
return {
|
|
117
|
+
id: response.id,
|
|
118
|
+
content,
|
|
119
|
+
...thinkingContent ? { thinkingContent } : {},
|
|
120
|
+
...toolCalls && toolCalls.length > 0 ? { toolCalls } : {},
|
|
121
|
+
finishReason: mapFinishReason(choice.finish_reason),
|
|
122
|
+
usage: {
|
|
123
|
+
promptTokens: response.usage?.prompt_tokens ?? 0,
|
|
124
|
+
completionTokens: response.usage?.completion_tokens ?? 0,
|
|
125
|
+
totalTokens: response.usage?.total_tokens ?? 0
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
} catch (error) {
|
|
129
|
+
logger.error("LLM complete error", { error: String(error) });
|
|
130
|
+
throw new LLMError(error instanceof Error ? error.message : "Unknown LLM error", {
|
|
131
|
+
originalError: error instanceof Error ? error : void 0
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
async *stream(request) {
|
|
136
|
+
const resolvedEffort = request.reasoningEffort ?? reasoningEffort;
|
|
137
|
+
logger.debug("LLM stream request", {
|
|
138
|
+
messageCount: request.messages.length,
|
|
139
|
+
hasTools: !!request.tools?.length,
|
|
140
|
+
profile: profile.name,
|
|
141
|
+
reasoningEffort: resolvedEffort,
|
|
142
|
+
idleTimeout
|
|
143
|
+
});
|
|
144
|
+
try {
|
|
145
|
+
const createParams = await buildStreamingCreateParams({
|
|
146
|
+
model,
|
|
147
|
+
request,
|
|
148
|
+
profile,
|
|
149
|
+
capabilities,
|
|
150
|
+
...resolvedEffort ? { reasoningEffort: resolvedEffort } : {},
|
|
151
|
+
...thinkingField ? { thinkingField } : {}
|
|
152
|
+
});
|
|
153
|
+
const { params: streamingParams } = createParams;
|
|
154
|
+
const stream = await openai.chat.completions.create(streamingParams, {
|
|
155
|
+
signal: request.signal
|
|
156
|
+
});
|
|
157
|
+
let fullContent = "";
|
|
158
|
+
let fullThinking = "";
|
|
159
|
+
const toolCalls = /* @__PURE__ */ new Map();
|
|
160
|
+
let finishReason = "stop";
|
|
161
|
+
let usage = { promptTokens: 0, completionTokens: 0, totalTokens: 0 };
|
|
162
|
+
let responseId = "";
|
|
163
|
+
let lastChunkTime = Date.now();
|
|
164
|
+
const idleTimeoutController = new AbortController();
|
|
165
|
+
const idleTimer = setInterval(() => {
|
|
166
|
+
const idleDuration = Date.now() - lastChunkTime;
|
|
167
|
+
if (idleDuration > idleTimeout) {
|
|
168
|
+
logger.warn("LLM stream idle timeout triggered", { idleDuration, idleTimeout });
|
|
169
|
+
idleTimeoutController.abort();
|
|
170
|
+
}
|
|
171
|
+
}, 100);
|
|
172
|
+
const onAbort = () => clearInterval(idleTimer);
|
|
173
|
+
request.signal?.addEventListener("abort", onAbort, { once: true });
|
|
174
|
+
try {
|
|
175
|
+
for await (const chunk of stream) {
|
|
176
|
+
if (idleTimeoutController.signal.aborted) {
|
|
177
|
+
throw new Error(`LLM stream idle timeout: no chunks received for ${idleTimeout}ms`);
|
|
178
|
+
}
|
|
179
|
+
lastChunkTime = Date.now();
|
|
180
|
+
responseId = chunk.id;
|
|
181
|
+
if (chunk.usage) {
|
|
182
|
+
usage = {
|
|
183
|
+
promptTokens: chunk.usage.prompt_tokens,
|
|
184
|
+
completionTokens: chunk.usage.completion_tokens,
|
|
185
|
+
totalTokens: chunk.usage.total_tokens
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
const choice = chunk.choices[0];
|
|
189
|
+
if (!choice) continue;
|
|
190
|
+
if (choice.finish_reason) {
|
|
191
|
+
finishReason = mapFinishReason(choice.finish_reason);
|
|
192
|
+
}
|
|
193
|
+
const delta = choice.delta;
|
|
194
|
+
const reasoning = getThinking(delta, thinkingField);
|
|
195
|
+
if (reasoning) {
|
|
196
|
+
fullThinking += reasoning;
|
|
197
|
+
yield { type: "thinking_delta", content: reasoning };
|
|
198
|
+
}
|
|
199
|
+
if (delta.content) {
|
|
200
|
+
fullContent += delta.content;
|
|
201
|
+
yield { type: "text_delta", content: delta.content };
|
|
202
|
+
}
|
|
203
|
+
if (delta.tool_calls) {
|
|
204
|
+
for (const tc of delta.tool_calls) {
|
|
205
|
+
const existing = toolCalls.get(tc.index);
|
|
206
|
+
if (!existing) {
|
|
207
|
+
toolCalls.set(tc.index, {
|
|
208
|
+
id: tc.id ?? "",
|
|
209
|
+
name: tc.function?.name ?? "",
|
|
210
|
+
arguments: tc.function?.arguments ?? ""
|
|
211
|
+
});
|
|
212
|
+
} else {
|
|
213
|
+
if (tc.id) existing.id = tc.id;
|
|
214
|
+
if (tc.function?.name) existing.name += tc.function.name;
|
|
215
|
+
if (tc.function?.arguments) existing.arguments += tc.function.arguments;
|
|
216
|
+
}
|
|
217
|
+
yield {
|
|
218
|
+
type: "tool_call_delta",
|
|
219
|
+
index: tc.index,
|
|
220
|
+
...tc.id ? { id: tc.id } : {},
|
|
221
|
+
...tc.function?.name ? { name: tc.function.name } : {},
|
|
222
|
+
...tc.function?.arguments ? { arguments: tc.function.arguments } : {}
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
} finally {
|
|
228
|
+
clearInterval(idleTimer);
|
|
229
|
+
request.signal?.removeEventListener("abort", onAbort);
|
|
230
|
+
}
|
|
231
|
+
const finalContent = fullContent.trim();
|
|
232
|
+
const finalThinking = fullThinking.trim();
|
|
233
|
+
const parsedToolCalls = [];
|
|
234
|
+
for (const [, tc] of toolCalls) {
|
|
235
|
+
try {
|
|
236
|
+
parsedToolCalls.push({
|
|
237
|
+
id: tc.id,
|
|
238
|
+
name: tc.name,
|
|
239
|
+
arguments: JSON.parse(tc.arguments)
|
|
240
|
+
});
|
|
241
|
+
} catch (error) {
|
|
242
|
+
logger.warn("Failed to parse tool call arguments", { name: tc.name, arguments: tc.arguments });
|
|
243
|
+
parsedToolCalls.push({
|
|
244
|
+
id: tc.id,
|
|
245
|
+
name: tc.name,
|
|
246
|
+
arguments: {},
|
|
247
|
+
parseError: error instanceof Error ? error.message : "Unknown JSON parse error",
|
|
248
|
+
rawArguments: tc.arguments
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
yield {
|
|
253
|
+
type: "done",
|
|
254
|
+
response: {
|
|
255
|
+
id: responseId,
|
|
256
|
+
content: finalContent,
|
|
257
|
+
...finalThinking ? { thinkingContent: finalThinking } : {},
|
|
258
|
+
...parsedToolCalls.length > 0 ? { toolCalls: parsedToolCalls } : {},
|
|
259
|
+
finishReason,
|
|
260
|
+
usage
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
} catch (error) {
|
|
264
|
+
logger.error("LLM stream error", { error });
|
|
265
|
+
yield {
|
|
266
|
+
type: "error",
|
|
267
|
+
error: error instanceof Error ? error.message : "Unknown LLM error"
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// src/server/llm/models.ts
|
|
275
|
+
var modelCache = /* @__PURE__ */ new Map();
|
|
276
|
+
var llmStatus = "unknown";
|
|
277
|
+
var lastActiveUrl = null;
|
|
278
|
+
var CACHE_TTL_MS = 3e4;
|
|
279
|
+
function getCacheKey(url) {
|
|
280
|
+
return stripVersionPrefix(url);
|
|
281
|
+
}
|
|
282
|
+
async function detectModel(llmBaseUrl, retries = 3, silent = false) {
|
|
283
|
+
const cacheKey = getCacheKey(llmBaseUrl);
|
|
284
|
+
const now = Date.now();
|
|
285
|
+
const cached = modelCache.get(cacheKey);
|
|
286
|
+
if (cached && now - cached.timestamp < CACHE_TTL_MS) {
|
|
287
|
+
lastActiveUrl = cacheKey;
|
|
288
|
+
llmStatus = "connected";
|
|
289
|
+
return cached.model;
|
|
290
|
+
}
|
|
291
|
+
const url = buildModelsUrl(llmBaseUrl);
|
|
292
|
+
for (let attempt = 1; attempt <= retries; attempt++) {
|
|
293
|
+
try {
|
|
294
|
+
if (silent) {
|
|
295
|
+
logger.debug("Fetching models from LLM server", { url, attempt });
|
|
296
|
+
}
|
|
297
|
+
const response = await fetch(url, {
|
|
298
|
+
signal: AbortSignal.timeout(1e4)
|
|
299
|
+
});
|
|
300
|
+
if (!response.ok) {
|
|
301
|
+
if (silent) {
|
|
302
|
+
logger.debug("Failed to fetch models from LLM server", { status: response.status, attempt });
|
|
303
|
+
} else {
|
|
304
|
+
logger.warn("Failed to fetch models from LLM server", { status: response.status, attempt });
|
|
305
|
+
}
|
|
306
|
+
if (attempt < retries) {
|
|
307
|
+
await new Promise((r) => setTimeout(r, 1e3 * attempt));
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
llmStatus = "disconnected";
|
|
311
|
+
return cached?.model ?? null;
|
|
312
|
+
}
|
|
313
|
+
const data = await response.json();
|
|
314
|
+
if (data.data && data.data.length > 0) {
|
|
315
|
+
const modelData = data.data[0];
|
|
316
|
+
const modelId = modelData.id;
|
|
317
|
+
modelCache.set(cacheKey, {
|
|
318
|
+
model: modelId,
|
|
319
|
+
modelInfo: modelData,
|
|
320
|
+
timestamp: now
|
|
321
|
+
});
|
|
322
|
+
lastActiveUrl = cacheKey;
|
|
323
|
+
llmStatus = "connected";
|
|
324
|
+
if (silent) {
|
|
325
|
+
logger.debug("Detected LLM model", {
|
|
326
|
+
model: modelId,
|
|
327
|
+
maxLen: modelData.max_model_len,
|
|
328
|
+
root: modelData.root
|
|
329
|
+
});
|
|
330
|
+
} else {
|
|
331
|
+
logger.info("Detected LLM model", {
|
|
332
|
+
model: modelId,
|
|
333
|
+
maxLen: modelData.max_model_len,
|
|
334
|
+
root: modelData.root
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
return modelId;
|
|
338
|
+
}
|
|
339
|
+
if (silent) {
|
|
340
|
+
logger.debug("LLM server returned empty models list");
|
|
341
|
+
} else {
|
|
342
|
+
logger.warn("LLM server returned empty models list");
|
|
343
|
+
}
|
|
344
|
+
llmStatus = "disconnected";
|
|
345
|
+
return null;
|
|
346
|
+
} catch (error) {
|
|
347
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
348
|
+
if (silent) {
|
|
349
|
+
logger.debug("Could not detect model from LLM server", { error: errMsg, attempt });
|
|
350
|
+
} else {
|
|
351
|
+
logger.warn("Could not detect model from LLM server", { error: errMsg, attempt });
|
|
352
|
+
}
|
|
353
|
+
if (attempt < retries) {
|
|
354
|
+
await new Promise((r) => setTimeout(r, 1e3 * attempt));
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
llmStatus = "disconnected";
|
|
360
|
+
return cached?.model ?? null;
|
|
361
|
+
}
|
|
362
|
+
function getLlmStatus() {
|
|
363
|
+
return llmStatus;
|
|
364
|
+
}
|
|
365
|
+
function clearModelCache(url) {
|
|
366
|
+
if (url) {
|
|
367
|
+
modelCache.delete(getCacheKey(url));
|
|
368
|
+
} else {
|
|
369
|
+
modelCache.clear();
|
|
370
|
+
}
|
|
371
|
+
llmStatus = "unknown";
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export {
|
|
375
|
+
SessionNotFoundError,
|
|
376
|
+
createLLMClient,
|
|
377
|
+
detectModel,
|
|
378
|
+
getLlmStatus,
|
|
379
|
+
clearModelCache
|
|
380
|
+
};
|
|
381
|
+
//# sourceMappingURL=chunk-4F3C6X4M.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
clearModelCache,
|
|
3
3
|
createLLMClient,
|
|
4
4
|
detectModel
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-4F3C6X4M.js";
|
|
6
6
|
import {
|
|
7
7
|
buildModelsUrl,
|
|
8
8
|
detectBackend,
|
|
@@ -542,4 +542,4 @@ export {
|
|
|
542
542
|
parseDefaultModelSelection,
|
|
543
543
|
createProviderManager
|
|
544
544
|
};
|
|
545
|
-
//# sourceMappingURL=chunk-
|
|
545
|
+
//# sourceMappingURL=chunk-6CVDQJDV.js.map
|
|
@@ -32,9 +32,9 @@ Options:
|
|
|
32
32
|
`);
|
|
33
33
|
}
|
|
34
34
|
async function runNetworkSetup(mode) {
|
|
35
|
-
const { loadAuthConfig, saveAuthConfig, encryptPassword } = await import("./auth-
|
|
36
|
-
const { saveGlobalConfig } = await import("./config-
|
|
37
|
-
const { getAuthKeyPath } = await import("./paths-
|
|
35
|
+
const { loadAuthConfig, saveAuthConfig, encryptPassword } = await import("./auth-56SIRACI.js");
|
|
36
|
+
const { saveGlobalConfig } = await import("./config-B6HYTLT4.js");
|
|
37
|
+
const { getAuthKeyPath } = await import("./paths-X46PPOI2.js");
|
|
38
38
|
const existingAuth = await loadAuthConfig(mode);
|
|
39
39
|
if (existingAuth) {
|
|
40
40
|
return;
|
|
@@ -94,8 +94,8 @@ async function runNetworkSetup(mode) {
|
|
|
94
94
|
console.log("\u2713 Configuration saved!\n");
|
|
95
95
|
}
|
|
96
96
|
async function runConfig(mode) {
|
|
97
|
-
const { loadGlobalConfig, getActiveProvider, getDefaultModel } = await import("./config-
|
|
98
|
-
const { getGlobalConfigPath } = await import("./paths-
|
|
97
|
+
const { loadGlobalConfig, getActiveProvider, getDefaultModel } = await import("./config-B6HYTLT4.js");
|
|
98
|
+
const { getGlobalConfigPath } = await import("./paths-X46PPOI2.js");
|
|
99
99
|
const config = await loadGlobalConfig(mode);
|
|
100
100
|
const configPath = getGlobalConfigPath(mode);
|
|
101
101
|
const activeProvider = getActiveProvider(config);
|
|
@@ -151,13 +151,13 @@ async function runCli(options) {
|
|
|
151
151
|
break;
|
|
152
152
|
}
|
|
153
153
|
case "provider": {
|
|
154
|
-
const { runProviderCommand } = await import("./provider-
|
|
154
|
+
const { runProviderCommand } = await import("./provider-2JAXE5EA.js");
|
|
155
155
|
const [, subcommand] = positionals;
|
|
156
156
|
await runProviderCommand(mode, subcommand);
|
|
157
157
|
break;
|
|
158
158
|
}
|
|
159
159
|
case "service": {
|
|
160
|
-
const { runServiceCommand } = await import("./service-
|
|
160
|
+
const { runServiceCommand } = await import("./service-GB7AIOG5.js");
|
|
161
161
|
const [, subcommand] = positionals;
|
|
162
162
|
if (subcommand === "--help" || subcommand === "-h" || values.help) {
|
|
163
163
|
runServiceCommand(mode, void 0);
|
|
@@ -167,7 +167,7 @@ async function runCli(options) {
|
|
|
167
167
|
break;
|
|
168
168
|
}
|
|
169
169
|
case "pwa": {
|
|
170
|
-
const { runPwaCommand, printPwaHelp } = await import("./pwa-
|
|
170
|
+
const { runPwaCommand, printPwaHelp } = await import("./pwa-76XP2DY2.js");
|
|
171
171
|
const [, subcommand] = positionals;
|
|
172
172
|
if (subcommand === "--help" || subcommand === "-h" || values.help) {
|
|
173
173
|
printPwaHelp();
|
|
@@ -188,12 +188,12 @@ async function runCli(options) {
|
|
|
188
188
|
break;
|
|
189
189
|
}
|
|
190
190
|
default: {
|
|
191
|
-
const { configFileExists } = await import("./config-
|
|
191
|
+
const { configFileExists } = await import("./config-B6HYTLT4.js");
|
|
192
192
|
const configExists = await configFileExists(mode);
|
|
193
193
|
if (!configExists) {
|
|
194
194
|
await runNetworkSetup(mode);
|
|
195
195
|
}
|
|
196
|
-
const { runServe } = await import("./serve-
|
|
196
|
+
const { runServe } = await import("./serve-NMNHOT4M.js");
|
|
197
197
|
const serveOptions = { mode };
|
|
198
198
|
if (values.port) serveOptions.port = parseInt(values.port);
|
|
199
199
|
if (values["no-browser"] === true) serveOptions.openBrowser = false;
|
|
@@ -205,4 +205,4 @@ async function runCli(options) {
|
|
|
205
205
|
export {
|
|
206
206
|
runCli
|
|
207
207
|
};
|
|
208
|
-
//# sourceMappingURL=chunk-
|
|
208
|
+
//# sourceMappingURL=chunk-AKF52COZ.js.map
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
loadAllAgentsDefault,
|
|
18
18
|
processEventsForConversation,
|
|
19
19
|
runTopLevelAgentLoop
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-W52UQCER.js";
|
|
21
21
|
import {
|
|
22
22
|
getCurrentContextWindowId,
|
|
23
23
|
getCurrentWindowMessageOptions,
|
|
@@ -46,7 +46,7 @@ function computeDynamicContextHash(instructionContent, skills) {
|
|
|
46
46
|
|
|
47
47
|
// src/server/chat/orchestrator.ts
|
|
48
48
|
async function buildRetryPatterns() {
|
|
49
|
-
const { getSetting, SETTINGS_KEYS } = await import("./settings-
|
|
49
|
+
const { getSetting, SETTINGS_KEYS } = await import("./settings-6XX56F3F.js");
|
|
50
50
|
const raw = getSetting(SETTINGS_KEYS.RETRY_PATTERNS);
|
|
51
51
|
if (!raw) {
|
|
52
52
|
const oldXmlProtection = getSetting("llm.disableXmlProtection");
|
|
@@ -311,4 +311,4 @@ export {
|
|
|
311
311
|
runAgentTurn,
|
|
312
312
|
injectWorkflowKickoffIfNeeded
|
|
313
313
|
};
|
|
314
|
-
//# sourceMappingURL=chunk-
|
|
314
|
+
//# sourceMappingURL=chunk-D2QILH47.js.map
|