openfox 0.2.4 → 1.0.0
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/agent-defaults/builder.agent.md +3 -7
- package/dist/agent-defaults/code-reviewer.agent.md +1 -2
- package/dist/agent-defaults/debugger.agent.md +1 -2
- package/dist/agent-defaults/planner.agent.md +2 -9
- package/dist/agent-defaults/test-generator.agent.md +1 -1
- package/dist/agent-defaults/verifier.agent.md +4 -5
- package/dist/ask-3RK5YJZE.js +19 -0
- package/dist/auto-compaction-7LNZ5J3W.js +23 -0
- package/dist/{branch.api-WDHKZJS6.js → branch.api-XADFZZAA.js} +2 -2
- package/dist/chat-handler-T7SLWZ4E.js +201 -0
- package/dist/chunk-22CTURMH.js +128 -0
- package/dist/chunk-2KSCZSXQ.js +680 -0
- package/dist/{chunk-S5NRIWEU.js → chunk-2TBNG7CS.js} +12 -12
- package/dist/{chunk-4Z2OZ6NX.js → chunk-3EHGGBWE.js} +29 -2
- package/dist/{chunk-GZ7ZVJIW.js → chunk-3UQACISJ.js} +159 -49
- package/dist/{chunk-AF7XS4OI.js → chunk-5YQAXUKO.js} +4 -1
- package/dist/{chunk-MTX5Y3V3.js → chunk-7IOZFJBW.js} +2 -2
- package/dist/chunk-BU2ZYOEA.js +1067 -0
- package/dist/chunk-M2C5GEQR.js +137 -0
- package/dist/{chunk-U62ZECSQ.js → chunk-PNBH3RAX.js} +2 -2
- package/dist/chunk-QDEKU5RL.js +75 -0
- package/dist/chunk-QYP5HQV4.js +438 -0
- package/dist/{chunk-O4W4555H.js → chunk-RAZQTQK2.js} +1353 -1134
- package/dist/chunk-S4QKTRGJ.js +343 -0
- package/dist/{chunk-ARFK3RZW.js → chunk-TPT6HP4H.js} +1 -1
- package/dist/chunk-TVQOONDR.js +75 -0
- package/dist/{chunk-5ZUU23XF.js → chunk-U6BUT37A.js} +286 -33
- package/dist/chunk-VZXXJKSQ.js +314 -0
- package/dist/{chunk-26NRL3HX.js → chunk-XFXOSPYH.js} +3 -2
- package/dist/{chunk-N2XYX4ZA.js → chunk-XKFPU2FA.js} +13 -2
- package/dist/{chunk-FUUYYDVG.js → chunk-YB2574C6.js} +2841 -4507
- package/dist/cli/dev.js +4 -3
- package/dist/cli/index.js +4 -3
- package/dist/{config-GIXXE4VK.js → config-GIFCEJDU.js} +11 -6
- package/dist/events-G6CKHDNZ.js +114 -0
- package/dist/folding-O52L65VN.js +37 -0
- package/dist/{init-2EJ5AC7Z.js → init-MKTUIGZU.js} +46 -13
- package/dist/orchestrator-UGXX7JRQ.js +39 -0
- package/dist/package.json +9 -2
- package/dist/{paths-4BPXWB2W.js → paths-MM76AWYB.js} +2 -2
- package/dist/processor-KLHKDILM.js +236 -0
- package/dist/{project-creator-CWPKRIKI.js → project-creator-KAQXMZCT.js} +9 -8
- package/dist/projects-GSMMEVSO.js +19 -0
- package/dist/{protocol-BFFz3WM0.d.ts → protocol-BZ6OIASP.d.ts} +71 -50
- package/dist/protocol-WQENDK72.js +88 -0
- package/dist/{provider-QEVVNYOX.js → provider-4KTWU6IV.js} +41 -9
- package/dist/runtime-config-2XJJIMSC.js +9 -0
- package/dist/{serve-RYEBLJVN.js → serve-UK6B6G2O.js} +38 -18
- package/dist/server/index.d.ts +81 -27
- package/dist/server/index.js +19 -11
- package/dist/{settings-D5O3TMLD.js → settings-NCLN4JDZ.js} +4 -4
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.js +1 -1
- package/dist/tools-SGBQE736.js +48 -0
- package/dist/vision-fallback-63VPBSEN.js +22 -0
- package/dist/web/assets/{index-DHmZmhnR.css → index-BsaaC0X0.css} +32 -1
- package/dist/web/assets/index-CvO7QkGh.js +141 -0
- package/dist/web/index.html +2 -2
- package/dist/web/sounds/typing.mp3 +0 -0
- package/dist/workflow-defaults/default.workflow.json +1 -1
- package/package.json +9 -2
- package/dist/chunk-L4XDA3V7.js +0 -218
- package/dist/tools-QMIIDJTV.js +0 -48
- package/dist/web/assets/index-CAD7Iv_d.js +0 -122
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createServerMessage,
|
|
3
|
+
isClientMessage
|
|
4
|
+
} from "./chunk-TPT6HP4H.js";
|
|
5
|
+
|
|
6
|
+
// src/server/ws/protocol.ts
|
|
7
|
+
function enrichMessagesWithToolResults(messages) {
|
|
8
|
+
const resultMap = /* @__PURE__ */ new Map();
|
|
9
|
+
for (const msg of messages) {
|
|
10
|
+
if (msg.role === "tool" && msg.toolCallId && msg.toolResult) {
|
|
11
|
+
resultMap.set(msg.toolCallId, msg.toolResult);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (resultMap.size === 0) return messages;
|
|
15
|
+
return messages.map((msg) => {
|
|
16
|
+
if (msg.role !== "assistant" || !msg.toolCalls?.length) return msg;
|
|
17
|
+
const needsEnrichment = msg.toolCalls.some((tc) => !tc.result && resultMap.has(tc.id));
|
|
18
|
+
if (!needsEnrichment) return msg;
|
|
19
|
+
return {
|
|
20
|
+
...msg,
|
|
21
|
+
toolCalls: msg.toolCalls.map((tc) => {
|
|
22
|
+
if (tc.result) return tc;
|
|
23
|
+
const result = resultMap.get(tc.id);
|
|
24
|
+
return result ? { ...tc, result } : tc;
|
|
25
|
+
})
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function parseClientMessage(data) {
|
|
30
|
+
try {
|
|
31
|
+
const parsed = JSON.parse(data);
|
|
32
|
+
if (isClientMessage(parsed)) {
|
|
33
|
+
return parsed;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
} catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function serializeServerMessage(message) {
|
|
41
|
+
return JSON.stringify(message);
|
|
42
|
+
}
|
|
43
|
+
function createErrorMessage(code, message, correlationId) {
|
|
44
|
+
return createServerMessage("error", { code, message }, correlationId);
|
|
45
|
+
}
|
|
46
|
+
function createSessionStateMessage(session, messages, pendingConfirmations = [], correlationId) {
|
|
47
|
+
const enrichedMessages = enrichMessagesWithToolResults(messages);
|
|
48
|
+
return createServerMessage("session.state", { session, messages: enrichedMessages, pendingConfirmations }, correlationId);
|
|
49
|
+
}
|
|
50
|
+
function createSessionListMessage(sessions, correlationId) {
|
|
51
|
+
return createServerMessage("session.list", { sessions }, correlationId);
|
|
52
|
+
}
|
|
53
|
+
function createSessionRunningMessage(isRunning) {
|
|
54
|
+
return createServerMessage("session.running", { isRunning });
|
|
55
|
+
}
|
|
56
|
+
function createProjectStateMessage(project, correlationId) {
|
|
57
|
+
return createServerMessage("project.state", { project }, correlationId);
|
|
58
|
+
}
|
|
59
|
+
function createProjectListMessage(projects, correlationId) {
|
|
60
|
+
return createServerMessage("project.list", { projects }, correlationId);
|
|
61
|
+
}
|
|
62
|
+
function createChatDeltaMessage(messageId, content) {
|
|
63
|
+
return createServerMessage("chat.delta", { messageId, content });
|
|
64
|
+
}
|
|
65
|
+
function createChatThinkingMessage(messageId, content) {
|
|
66
|
+
return createServerMessage("chat.thinking", { messageId, content });
|
|
67
|
+
}
|
|
68
|
+
function createChatToolPreparingMessage(messageId, index, name) {
|
|
69
|
+
return createServerMessage("chat.tool_preparing", { messageId, index, name });
|
|
70
|
+
}
|
|
71
|
+
function createChatToolCallMessage(messageId, callId, tool, args) {
|
|
72
|
+
return createServerMessage("chat.tool_call", { messageId, callId, tool, args });
|
|
73
|
+
}
|
|
74
|
+
function createChatToolResultMessage(messageId, callId, tool, result) {
|
|
75
|
+
return createServerMessage("chat.tool_result", { messageId, callId, tool, result });
|
|
76
|
+
}
|
|
77
|
+
function createChatToolOutputMessage(messageId, callId, output, stream) {
|
|
78
|
+
return createServerMessage("chat.tool_output", { messageId, callId, output, stream });
|
|
79
|
+
}
|
|
80
|
+
function createChatTodoMessage(todos) {
|
|
81
|
+
return createServerMessage("chat.todo", { todos });
|
|
82
|
+
}
|
|
83
|
+
function createChatSummaryMessage(summary) {
|
|
84
|
+
return createServerMessage("chat.summary", { summary });
|
|
85
|
+
}
|
|
86
|
+
function createChatProgressMessage(message, phase) {
|
|
87
|
+
return createServerMessage("chat.progress", { message, ...phase ? { phase } : {} });
|
|
88
|
+
}
|
|
89
|
+
function createChatFormatRetryMessage(attempt, maxAttempts) {
|
|
90
|
+
return createServerMessage("chat.format_retry", { attempt, maxAttempts });
|
|
91
|
+
}
|
|
92
|
+
function createChatMessageMessage(message) {
|
|
93
|
+
return createServerMessage("chat.message", { message });
|
|
94
|
+
}
|
|
95
|
+
function createChatMessageUpdatedMessage(messageId, updates) {
|
|
96
|
+
return createServerMessage("chat.message_updated", { messageId, updates });
|
|
97
|
+
}
|
|
98
|
+
function createChatDoneMessage(messageId, reason, stats) {
|
|
99
|
+
return createServerMessage("chat.done", { messageId, reason, ...stats ? { stats } : {} });
|
|
100
|
+
}
|
|
101
|
+
function createChatErrorMessage(error, recoverable) {
|
|
102
|
+
return createServerMessage("chat.error", { error, recoverable });
|
|
103
|
+
}
|
|
104
|
+
function createChatPathConfirmationMessage(callId, tool, paths, workdir, reason) {
|
|
105
|
+
return createServerMessage("chat.path_confirmation", { callId, tool, paths, workdir, reason });
|
|
106
|
+
}
|
|
107
|
+
function createChatAskUserMessage(callId, question) {
|
|
108
|
+
return createServerMessage("chat.ask_user", { callId, question });
|
|
109
|
+
}
|
|
110
|
+
function createChatVisionFallbackMessage(payload) {
|
|
111
|
+
return createServerMessage("chat.vision_fallback", payload);
|
|
112
|
+
}
|
|
113
|
+
function createModeChangedMessage(mode, auto, reason) {
|
|
114
|
+
return createServerMessage("mode.changed", { mode, auto, ...reason ? { reason } : {} });
|
|
115
|
+
}
|
|
116
|
+
function createPhaseChangedMessage(phase) {
|
|
117
|
+
return createServerMessage("phase.changed", { phase });
|
|
118
|
+
}
|
|
119
|
+
function createCriteriaUpdatedMessage(criteria, changedId) {
|
|
120
|
+
return createServerMessage("criteria.updated", { criteria, ...changedId ? { changedId } : {} });
|
|
121
|
+
}
|
|
122
|
+
function createContextStateMessage(context) {
|
|
123
|
+
return createServerMessage("context.state", { context });
|
|
124
|
+
}
|
|
125
|
+
function createSessionNameGeneratedMessage(name, sessionId) {
|
|
126
|
+
const msg = {
|
|
127
|
+
type: "session.name_generated",
|
|
128
|
+
payload: { name }
|
|
129
|
+
};
|
|
130
|
+
if (sessionId) {
|
|
131
|
+
msg.sessionId = sessionId;
|
|
132
|
+
}
|
|
133
|
+
return msg;
|
|
134
|
+
}
|
|
135
|
+
function isSessionLoadPayload(payload) {
|
|
136
|
+
return typeof payload === "object" && payload !== null && "sessionId" in payload;
|
|
137
|
+
}
|
|
138
|
+
function isChatSendPayload(payload) {
|
|
139
|
+
return typeof payload === "object" && payload !== null && "content" in payload;
|
|
140
|
+
}
|
|
141
|
+
function isModeSwitchPayload(payload) {
|
|
142
|
+
return typeof payload === "object" && payload !== null && "mode" in payload;
|
|
143
|
+
}
|
|
144
|
+
function isCriteriaEditPayload(payload) {
|
|
145
|
+
return typeof payload === "object" && payload !== null && "criteria" in payload;
|
|
146
|
+
}
|
|
147
|
+
function isPathConfirmPayload(payload) {
|
|
148
|
+
return typeof payload === "object" && payload !== null && "callId" in payload && "approved" in payload;
|
|
149
|
+
}
|
|
150
|
+
function isAskAnswerPayload(payload) {
|
|
151
|
+
return typeof payload === "object" && payload !== null && "callId" in payload && "answer" in payload;
|
|
152
|
+
}
|
|
153
|
+
function createQueueStateMessage(messages) {
|
|
154
|
+
return createServerMessage("queue.state", { messages });
|
|
155
|
+
}
|
|
156
|
+
function isQueueAsapPayload(payload) {
|
|
157
|
+
return typeof payload === "object" && payload !== null && "content" in payload && typeof payload.content === "string";
|
|
158
|
+
}
|
|
159
|
+
function isQueueCompletionPayload(payload) {
|
|
160
|
+
return typeof payload === "object" && payload !== null && "content" in payload && typeof payload.content === "string";
|
|
161
|
+
}
|
|
162
|
+
function isQueueCancelPayload(payload) {
|
|
163
|
+
return typeof payload === "object" && payload !== null && "queueId" in payload && typeof payload.queueId === "string";
|
|
164
|
+
}
|
|
165
|
+
function storedEventToServerMessage(event) {
|
|
166
|
+
switch (event.type) {
|
|
167
|
+
case "message.start": {
|
|
168
|
+
const data = event.data;
|
|
169
|
+
const isUserOrSystem = data.role === "user" || data.role === "system";
|
|
170
|
+
const message = {
|
|
171
|
+
id: data.messageId,
|
|
172
|
+
role: data.role,
|
|
173
|
+
content: data.content ?? "",
|
|
174
|
+
timestamp: new Date(event.timestamp).toISOString(),
|
|
175
|
+
tokenCount: 0,
|
|
176
|
+
isStreaming: !isUserOrSystem,
|
|
177
|
+
// Only assistant messages stream
|
|
178
|
+
...data.contextWindowId ? { contextWindowId: data.contextWindowId } : {},
|
|
179
|
+
...data.subAgentId ? { subAgentId: data.subAgentId } : {},
|
|
180
|
+
...data.subAgentType ? { subAgentType: data.subAgentType } : {},
|
|
181
|
+
...data.isSystemGenerated ? { isSystemGenerated: data.isSystemGenerated } : {},
|
|
182
|
+
...data.messageKind ? { messageKind: data.messageKind } : {},
|
|
183
|
+
...data.isCompactionSummary ? { isCompactionSummary: data.isCompactionSummary } : {},
|
|
184
|
+
...data.attachments ? { attachments: data.attachments } : {}
|
|
185
|
+
};
|
|
186
|
+
return createChatMessageMessage(message);
|
|
187
|
+
}
|
|
188
|
+
case "message.delta": {
|
|
189
|
+
const data = event.data;
|
|
190
|
+
return createChatDeltaMessage(data.messageId, data.content);
|
|
191
|
+
}
|
|
192
|
+
case "message.thinking": {
|
|
193
|
+
const data = event.data;
|
|
194
|
+
return createChatThinkingMessage(data.messageId, data.content);
|
|
195
|
+
}
|
|
196
|
+
case "message.done": {
|
|
197
|
+
const data = event.data;
|
|
198
|
+
const updates = { isStreaming: false };
|
|
199
|
+
if (data.partial) {
|
|
200
|
+
updates.partial = true;
|
|
201
|
+
}
|
|
202
|
+
if (data.stats) {
|
|
203
|
+
updates.stats = data.stats;
|
|
204
|
+
}
|
|
205
|
+
if (data.promptContext) {
|
|
206
|
+
updates.promptContext = data.promptContext;
|
|
207
|
+
}
|
|
208
|
+
return createChatMessageUpdatedMessage(data.messageId, updates);
|
|
209
|
+
}
|
|
210
|
+
case "tool.preparing": {
|
|
211
|
+
const data = event.data;
|
|
212
|
+
return createChatToolPreparingMessage(data.messageId, data.index, data.name);
|
|
213
|
+
}
|
|
214
|
+
case "tool.call": {
|
|
215
|
+
const data = event.data;
|
|
216
|
+
return createChatToolCallMessage(
|
|
217
|
+
data.messageId,
|
|
218
|
+
data.toolCall.id,
|
|
219
|
+
data.toolCall.name,
|
|
220
|
+
data.toolCall.arguments
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
case "tool.output": {
|
|
224
|
+
const data = event.data;
|
|
225
|
+
return createChatToolOutputMessage("", data.toolCallId, data.content, data.stream);
|
|
226
|
+
}
|
|
227
|
+
case "tool.result": {
|
|
228
|
+
const data = event.data;
|
|
229
|
+
return createChatToolResultMessage(
|
|
230
|
+
data.messageId,
|
|
231
|
+
data.toolCallId,
|
|
232
|
+
"",
|
|
233
|
+
// Tool name not available in event, but not used by frontend for matching
|
|
234
|
+
data.result
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
case "phase.changed": {
|
|
238
|
+
const data = event.data;
|
|
239
|
+
return createPhaseChangedMessage(data.phase);
|
|
240
|
+
}
|
|
241
|
+
case "task.completed": {
|
|
242
|
+
const data = event.data;
|
|
243
|
+
return createServerMessage("task.completed", data);
|
|
244
|
+
}
|
|
245
|
+
case "mode.changed": {
|
|
246
|
+
const data = event.data;
|
|
247
|
+
return createModeChangedMessage(data.mode, data.auto, data.reason);
|
|
248
|
+
}
|
|
249
|
+
case "running.changed": {
|
|
250
|
+
const data = event.data;
|
|
251
|
+
return createSessionRunningMessage(data.isRunning);
|
|
252
|
+
}
|
|
253
|
+
case "criteria.set": {
|
|
254
|
+
const data = event.data;
|
|
255
|
+
return createCriteriaUpdatedMessage(data.criteria);
|
|
256
|
+
}
|
|
257
|
+
case "criterion.updated": {
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
case "context.state": {
|
|
261
|
+
const data = event.data;
|
|
262
|
+
return createContextStateMessage(data);
|
|
263
|
+
}
|
|
264
|
+
case "session.name_generated": {
|
|
265
|
+
const data = event.data;
|
|
266
|
+
return {
|
|
267
|
+
type: "session.name_generated",
|
|
268
|
+
payload: { name: data.name },
|
|
269
|
+
sessionId: event.sessionId
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
case "todo.updated": {
|
|
273
|
+
const data = event.data;
|
|
274
|
+
return createChatTodoMessage(data.todos);
|
|
275
|
+
}
|
|
276
|
+
case "chat.done": {
|
|
277
|
+
const data = event.data;
|
|
278
|
+
return createChatDoneMessage(data.messageId, data.reason, data.stats);
|
|
279
|
+
}
|
|
280
|
+
case "chat.error": {
|
|
281
|
+
const data = event.data;
|
|
282
|
+
return createChatErrorMessage(data.error, data.recoverable);
|
|
283
|
+
}
|
|
284
|
+
case "chat.ask_user": {
|
|
285
|
+
const data = event.data;
|
|
286
|
+
return createChatAskUserMessage(data.callId, data.question);
|
|
287
|
+
}
|
|
288
|
+
case "format.retry": {
|
|
289
|
+
const data = event.data;
|
|
290
|
+
return createChatFormatRetryMessage(data.attempt, data.maxAttempts);
|
|
291
|
+
}
|
|
292
|
+
case "turn.snapshot":
|
|
293
|
+
case "context.compacted":
|
|
294
|
+
return null;
|
|
295
|
+
default:
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export {
|
|
301
|
+
parseClientMessage,
|
|
302
|
+
serializeServerMessage,
|
|
303
|
+
createErrorMessage,
|
|
304
|
+
createSessionStateMessage,
|
|
305
|
+
createSessionListMessage,
|
|
306
|
+
createSessionRunningMessage,
|
|
307
|
+
createProjectStateMessage,
|
|
308
|
+
createProjectListMessage,
|
|
309
|
+
createChatDeltaMessage,
|
|
310
|
+
createChatThinkingMessage,
|
|
311
|
+
createChatToolPreparingMessage,
|
|
312
|
+
createChatToolCallMessage,
|
|
313
|
+
createChatToolResultMessage,
|
|
314
|
+
createChatToolOutputMessage,
|
|
315
|
+
createChatTodoMessage,
|
|
316
|
+
createChatSummaryMessage,
|
|
317
|
+
createChatProgressMessage,
|
|
318
|
+
createChatFormatRetryMessage,
|
|
319
|
+
createChatMessageMessage,
|
|
320
|
+
createChatMessageUpdatedMessage,
|
|
321
|
+
createChatDoneMessage,
|
|
322
|
+
createChatErrorMessage,
|
|
323
|
+
createChatPathConfirmationMessage,
|
|
324
|
+
createChatAskUserMessage,
|
|
325
|
+
createChatVisionFallbackMessage,
|
|
326
|
+
createModeChangedMessage,
|
|
327
|
+
createPhaseChangedMessage,
|
|
328
|
+
createCriteriaUpdatedMessage,
|
|
329
|
+
createContextStateMessage,
|
|
330
|
+
createSessionNameGeneratedMessage,
|
|
331
|
+
isSessionLoadPayload,
|
|
332
|
+
isChatSendPayload,
|
|
333
|
+
isModeSwitchPayload,
|
|
334
|
+
isCriteriaEditPayload,
|
|
335
|
+
isPathConfirmPayload,
|
|
336
|
+
isAskAnswerPayload,
|
|
337
|
+
createQueueStateMessage,
|
|
338
|
+
isQueueAsapPayload,
|
|
339
|
+
isQueueCompletionPayload,
|
|
340
|
+
isQueueCancelPayload,
|
|
341
|
+
storedEventToServerMessage
|
|
342
|
+
};
|
|
343
|
+
//# sourceMappingURL=chunk-S4QKTRGJ.js.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// src/server/config.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var backendSchema = z.enum(["auto", "vllm", "sglang", "ollama", "llamacpp"]).default("auto");
|
|
4
|
+
var visionFallbackSchema = z.object({
|
|
5
|
+
enabled: z.boolean().default(false),
|
|
6
|
+
url: z.string().default("http://localhost:11434"),
|
|
7
|
+
model: z.string().default("qwen3-vl:2b")
|
|
8
|
+
});
|
|
9
|
+
var envSchema = z.object({
|
|
10
|
+
// New env var name, with fallback to old name for backward compatibility
|
|
11
|
+
OPENFOX_LLM_URL: z.string().url().optional(),
|
|
12
|
+
OPENFOX_VLLM_URL: z.string().url().optional(),
|
|
13
|
+
OPENFOX_BACKEND: backendSchema,
|
|
14
|
+
OPENFOX_MODEL_NAME: z.string().default("qwen3.5-122b-int4-autoround"),
|
|
15
|
+
OPENFOX_MAX_CONTEXT: z.coerce.number().default(2e5),
|
|
16
|
+
OPENFOX_PORT: z.coerce.number().default(10369),
|
|
17
|
+
OPENFOX_HOST: z.string().default("0.0.0.0"),
|
|
18
|
+
OPENFOX_WORKDIR: z.string().optional(),
|
|
19
|
+
OPENFOX_DB_PATH: z.string().default("./openfox.db"),
|
|
20
|
+
OPENFOX_LOG_LEVEL: z.enum(["debug", "info", "warn", "error"]).default("info"),
|
|
21
|
+
OPENFOX_DISABLE_THINKING: z.coerce.boolean().default(false),
|
|
22
|
+
OPENFOX_DEV: z.coerce.boolean().default(false)
|
|
23
|
+
});
|
|
24
|
+
function loadConfig() {
|
|
25
|
+
const env = envSchema.parse(process.env);
|
|
26
|
+
const llmUrl = env.OPENFOX_LLM_URL ?? env.OPENFOX_VLLM_URL ?? "http://localhost:8000/v1";
|
|
27
|
+
const workdir = env.OPENFOX_WORKDIR ?? process.cwd();
|
|
28
|
+
return {
|
|
29
|
+
llm: {
|
|
30
|
+
baseUrl: llmUrl,
|
|
31
|
+
model: env.OPENFOX_MODEL_NAME,
|
|
32
|
+
timeout: 3e5,
|
|
33
|
+
// 5 minutes (deprecated, kept for backward compatibility)
|
|
34
|
+
idleTimeout: 3e5,
|
|
35
|
+
// 5 minutes of inactivity
|
|
36
|
+
backend: env.OPENFOX_BACKEND,
|
|
37
|
+
disableThinking: env.OPENFOX_DISABLE_THINKING
|
|
38
|
+
},
|
|
39
|
+
context: {
|
|
40
|
+
maxTokens: env.OPENFOX_MAX_CONTEXT,
|
|
41
|
+
compactionThreshold: 0.85,
|
|
42
|
+
compactionTarget: 0.6
|
|
43
|
+
},
|
|
44
|
+
agent: {
|
|
45
|
+
maxIterations: 10,
|
|
46
|
+
maxConsecutiveFailures: 3,
|
|
47
|
+
toolTimeout: 12e4
|
|
48
|
+
},
|
|
49
|
+
server: {
|
|
50
|
+
port: env.OPENFOX_PORT,
|
|
51
|
+
host: env.OPENFOX_HOST
|
|
52
|
+
},
|
|
53
|
+
database: {
|
|
54
|
+
path: env.OPENFOX_DB_PATH
|
|
55
|
+
},
|
|
56
|
+
mode: env.OPENFOX_DEV ? "development" : "production",
|
|
57
|
+
workdir
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// src/server/runtime-config.ts
|
|
62
|
+
var runtimeConfig = null;
|
|
63
|
+
function setRuntimeConfig(config) {
|
|
64
|
+
runtimeConfig = config;
|
|
65
|
+
}
|
|
66
|
+
function getRuntimeConfig() {
|
|
67
|
+
return runtimeConfig ?? loadConfig();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
loadConfig,
|
|
72
|
+
setRuntimeConfig,
|
|
73
|
+
getRuntimeConfig
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=chunk-TVQOONDR.js.map
|