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
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getProject
|
|
3
|
+
} from "./chunk-XAMAYRDA.js";
|
|
1
4
|
import {
|
|
2
5
|
COMPACTION_PROMPT,
|
|
3
6
|
TurnMetrics,
|
|
@@ -28,9 +31,6 @@ import {
|
|
|
28
31
|
getMaxPerSession,
|
|
29
32
|
getSessionProcessCount
|
|
30
33
|
} from "./chunk-VRGRAQDG.js";
|
|
31
|
-
import {
|
|
32
|
-
getProject
|
|
33
|
-
} from "./chunk-XAMAYRDA.js";
|
|
34
34
|
import {
|
|
35
35
|
getCurrentContextWindowId,
|
|
36
36
|
getCurrentWindowMessageOptions,
|
|
@@ -2266,7 +2266,7 @@ ${CONTINUE_PROMPT}` : CONTINUE_PROMPT;
|
|
|
2266
2266
|
systemPrompt: assembledRequest.systemPrompt,
|
|
2267
2267
|
llmClient,
|
|
2268
2268
|
messages: assembledRequest.messages,
|
|
2269
|
-
tools:
|
|
2269
|
+
tools: assembledRequest.tools,
|
|
2270
2270
|
toolChoice: "auto",
|
|
2271
2271
|
signal,
|
|
2272
2272
|
...config.retryPatterns ? { retryPatterns: config.retryPatterns } : {},
|
|
@@ -2575,7 +2575,8 @@ function createAssemblyResult(input) {
|
|
|
2575
2575
|
const messagesForLLM = input.messages.filter((m) => m.source !== "runtime");
|
|
2576
2576
|
return {
|
|
2577
2577
|
systemPrompt: input.systemPrompt,
|
|
2578
|
-
messages: messagesForLLM.map((message) => messageToMinimal(message))
|
|
2578
|
+
messages: messagesForLLM.map((message) => messageToMinimal(message)),
|
|
2579
|
+
tools: input.requestTools
|
|
2579
2580
|
};
|
|
2580
2581
|
}
|
|
2581
2582
|
function buildAssemblyInput(systemPrompt, baseInput) {
|
|
@@ -2676,7 +2677,7 @@ async function describeImageFromDataUrl(dataUrl, visionModel, options) {
|
|
|
2676
2677
|
import { createHash as createHash2 } from "crypto";
|
|
2677
2678
|
async function loadVisionModelFromGlobalConfig() {
|
|
2678
2679
|
try {
|
|
2679
|
-
const { loadGlobalConfig, getVisionFallback } = await import("./config-
|
|
2680
|
+
const { loadGlobalConfig, getVisionFallback } = await import("./config-YFHA5MWV.js");
|
|
2680
2681
|
const runtimeConfig = getRuntimeConfig();
|
|
2681
2682
|
const mode = runtimeConfig.mode ?? "production";
|
|
2682
2683
|
const globalConfig = await loadGlobalConfig(mode);
|
|
@@ -3131,7 +3132,7 @@ var callSubAgentTool = {
|
|
|
3131
3132
|
};
|
|
3132
3133
|
}
|
|
3133
3134
|
try {
|
|
3134
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
3135
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-DUC54GEH.js");
|
|
3135
3136
|
const toolRegistry = getToolRegistryForAgent2(agentDef);
|
|
3136
3137
|
const turnMetrics = new TurnMetrics();
|
|
3137
3138
|
const result = await executeSubAgent({
|
|
@@ -4056,24 +4057,28 @@ function createRegistryFromTools(tools, allowedTools, toolPermissions) {
|
|
|
4056
4057
|
}
|
|
4057
4058
|
};
|
|
4058
4059
|
}
|
|
4060
|
+
var mcpToolsOverride = [];
|
|
4061
|
+
function setMcpTools(tools) {
|
|
4062
|
+
mcpToolsOverride = tools;
|
|
4063
|
+
}
|
|
4059
4064
|
function getAllToolsMap() {
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
]);
|
|
4065
|
+
const builtInTools = [
|
|
4066
|
+
readFileTool,
|
|
4067
|
+
writeFileTool,
|
|
4068
|
+
editFileTool,
|
|
4069
|
+
runCommandTool,
|
|
4070
|
+
askUserTool,
|
|
4071
|
+
sessionMetadataTool,
|
|
4072
|
+
callSubAgentTool,
|
|
4073
|
+
loadSkillTool,
|
|
4074
|
+
returnValueTool,
|
|
4075
|
+
webFetchTool,
|
|
4076
|
+
devServerTool,
|
|
4077
|
+
stepDoneTool,
|
|
4078
|
+
backgroundProcessTool
|
|
4079
|
+
].map((t) => [t.name, t]);
|
|
4080
|
+
const mcpEntries = mcpToolsOverride.map((t) => [t.name, t]);
|
|
4081
|
+
return new Map([...builtInTools, ...mcpEntries]);
|
|
4077
4082
|
}
|
|
4078
4083
|
function createPermissionErrorMessage(toolName, allowedTools) {
|
|
4079
4084
|
if (allowedTools.length === 0) {
|
|
@@ -4182,8 +4187,9 @@ export {
|
|
|
4182
4187
|
getToolPermissions,
|
|
4183
4188
|
validateToolAction,
|
|
4184
4189
|
createRegistryFromTools,
|
|
4190
|
+
setMcpTools,
|
|
4185
4191
|
getToolRegistryForSubAgent,
|
|
4186
4192
|
getToolRegistryForAgent,
|
|
4187
4193
|
createToolRegistry
|
|
4188
4194
|
};
|
|
4189
|
-
//# sourceMappingURL=chunk-
|
|
4195
|
+
//# sourceMappingURL=chunk-4ZTQO5JP.js.map
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
loadAllAgentsDefault,
|
|
12
12
|
processEventsForConversation,
|
|
13
13
|
runTopLevelAgentLoop
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-4ZTQO5JP.js";
|
|
15
15
|
import {
|
|
16
16
|
TurnMetrics,
|
|
17
17
|
WORKFLOW_KICKOFF_PROMPT,
|
|
@@ -38,10 +38,11 @@ import {
|
|
|
38
38
|
|
|
39
39
|
// src/server/chat/dynamic-context.ts
|
|
40
40
|
import { createHash } from "crypto";
|
|
41
|
-
function computeDynamicContextHash(instructionContent, skills) {
|
|
41
|
+
function computeDynamicContextHash(instructionContent, skills, toolFingerprint) {
|
|
42
42
|
const dynamicInputs = JSON.stringify({
|
|
43
43
|
instructions: instructionContent,
|
|
44
|
-
skills: skills.map((s) => s.id).sort()
|
|
44
|
+
skills: skills.map((s) => s.id).sort(),
|
|
45
|
+
...toolFingerprint ? { tools: toolFingerprint } : {}
|
|
45
46
|
});
|
|
46
47
|
return createHash("sha256").update(dynamicInputs).digest("hex");
|
|
47
48
|
}
|
|
@@ -237,8 +238,9 @@ async function runAgentTurn(options, turnMetrics, agentId, append, callbacks) {
|
|
|
237
238
|
onMessage: options.onMessage,
|
|
238
239
|
assembleRequest: (input) => {
|
|
239
240
|
const cached = options.sessionManager.getCachedPrompt(options.sessionId);
|
|
241
|
+
const toolFingerprint = input.promptTools.map((t) => `${t.function.name}:${JSON.stringify(t.function.parameters)}`).sort().join("|");
|
|
240
242
|
if (cached) {
|
|
241
|
-
const currentHash = computeDynamicContextHash(instructionContent ?? "", skills);
|
|
243
|
+
const currentHash = computeDynamicContextHash(instructionContent ?? "", skills, toolFingerprint);
|
|
242
244
|
if (cached.hash !== currentHash) {
|
|
243
245
|
options.sessionManager.setDynamicContextChanged(options.sessionId, true);
|
|
244
246
|
}
|
|
@@ -246,7 +248,7 @@ async function runAgentTurn(options, turnMetrics, agentId, append, callbacks) {
|
|
|
246
248
|
systemPrompt: cached.systemPrompt,
|
|
247
249
|
messages: input.messages,
|
|
248
250
|
injectedFiles: input.injectedFiles,
|
|
249
|
-
requestTools: input.promptTools,
|
|
251
|
+
requestTools: cached.tools.length > 0 ? cached.tools : input.promptTools,
|
|
250
252
|
toolChoice: input.toolChoice
|
|
251
253
|
});
|
|
252
254
|
}
|
|
@@ -256,8 +258,8 @@ async function runAgentTurn(options, turnMetrics, agentId, append, callbacks) {
|
|
|
256
258
|
subAgentDefs,
|
|
257
259
|
modelName: options.llmClient.getModel()
|
|
258
260
|
});
|
|
259
|
-
const hash = computeDynamicContextHash(instructionContent ?? "", skills);
|
|
260
|
-
options.sessionManager.setCachedPrompt(options.sessionId, result.systemPrompt, hash);
|
|
261
|
+
const hash = computeDynamicContextHash(instructionContent ?? "", skills, toolFingerprint);
|
|
262
|
+
options.sessionManager.setCachedPrompt(options.sessionId, result.systemPrompt, result.tools, hash);
|
|
261
263
|
return result;
|
|
262
264
|
},
|
|
263
265
|
getToolRegistry: () => getToolRegistryForAgent(agentDef),
|
|
@@ -314,4 +316,4 @@ export {
|
|
|
314
316
|
runAgentTurn,
|
|
315
317
|
injectWorkflowKickoffIfNeeded
|
|
316
318
|
};
|
|
317
|
-
//# sourceMappingURL=chunk-
|
|
319
|
+
//# sourceMappingURL=chunk-7GJ6XYAF.js.map
|
|
@@ -33,7 +33,7 @@ Options:
|
|
|
33
33
|
}
|
|
34
34
|
async function runNetworkSetup(mode) {
|
|
35
35
|
const { loadAuthConfig, saveAuthConfig, encryptPassword } = await import("./auth-56SIRACI.js");
|
|
36
|
-
const { saveGlobalConfig } = await import("./config-
|
|
36
|
+
const { saveGlobalConfig } = await import("./config-YFHA5MWV.js");
|
|
37
37
|
const { getAuthKeyPath } = await import("./paths-X46PPOI2.js");
|
|
38
38
|
const existingAuth = await loadAuthConfig(mode);
|
|
39
39
|
if (existingAuth) {
|
|
@@ -94,7 +94,7 @@ 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-
|
|
97
|
+
const { loadGlobalConfig, getActiveProvider, getDefaultModel } = await import("./config-YFHA5MWV.js");
|
|
98
98
|
const { getGlobalConfigPath } = await import("./paths-X46PPOI2.js");
|
|
99
99
|
const config = await loadGlobalConfig(mode);
|
|
100
100
|
const configPath = getGlobalConfigPath(mode);
|
|
@@ -152,7 +152,7 @@ async function runCli(options) {
|
|
|
152
152
|
break;
|
|
153
153
|
}
|
|
154
154
|
case "provider": {
|
|
155
|
-
const { runProviderCommand } = await import("./provider-
|
|
155
|
+
const { runProviderCommand } = await import("./provider-QUJQLVOM.js");
|
|
156
156
|
const [, subcommand] = positionals;
|
|
157
157
|
await runProviderCommand(mode, subcommand);
|
|
158
158
|
break;
|
|
@@ -191,12 +191,12 @@ async function runCli(options) {
|
|
|
191
191
|
break;
|
|
192
192
|
}
|
|
193
193
|
default: {
|
|
194
|
-
const { configFileExists } = await import("./config-
|
|
194
|
+
const { configFileExists } = await import("./config-YFHA5MWV.js");
|
|
195
195
|
const configExists = await configFileExists(mode);
|
|
196
196
|
if (!configExists) {
|
|
197
197
|
await runNetworkSetup(mode);
|
|
198
198
|
}
|
|
199
|
-
const { runServe } = await import("./serve-
|
|
199
|
+
const { runServe } = await import("./serve-GA2UIHHB.js");
|
|
200
200
|
const serveOptions = { mode };
|
|
201
201
|
if (values.port) serveOptions.port = parseInt(values.port);
|
|
202
202
|
if (values["no-browser"] === true) serveOptions.openBrowser = false;
|
|
@@ -208,4 +208,4 @@ async function runCli(options) {
|
|
|
208
208
|
export {
|
|
209
209
|
runCli
|
|
210
210
|
};
|
|
211
|
-
//# sourceMappingURL=chunk-
|
|
211
|
+
//# sourceMappingURL=chunk-LNEBVOH6.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// src/server/mcp/tool-adapter.ts
|
|
2
|
+
function createMcpTools(mcpManager) {
|
|
3
|
+
const tools = [];
|
|
4
|
+
for (const server of mcpManager.getAllServers()) {
|
|
5
|
+
for (const mcpTool of server.tools) {
|
|
6
|
+
if (!mcpTool.enabled) continue;
|
|
7
|
+
const prefixedName = `${server.name}_${mcpTool.name}`;
|
|
8
|
+
const definition = {
|
|
9
|
+
type: "function",
|
|
10
|
+
function: {
|
|
11
|
+
name: prefixedName,
|
|
12
|
+
description: mcpTool.description ?? "",
|
|
13
|
+
parameters: mcpTool.inputSchema
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
tools.push({
|
|
17
|
+
name: prefixedName,
|
|
18
|
+
definition,
|
|
19
|
+
execute: async (args, _context) => {
|
|
20
|
+
const start = Date.now();
|
|
21
|
+
const result = await mcpManager.callTool(server.name, mcpTool.name, args);
|
|
22
|
+
return {
|
|
23
|
+
success: result.success,
|
|
24
|
+
...result.output ? { output: result.output } : {},
|
|
25
|
+
...result.error ? { error: result.error } : {},
|
|
26
|
+
durationMs: Date.now() - start,
|
|
27
|
+
truncated: false
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return tools;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
createMcpTools
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=chunk-NWO6GRYE.js.map
|
|
@@ -61,9 +61,18 @@ var visionFallbackSchema = z.object({
|
|
|
61
61
|
model: z.string().default("qwen3.5:0.8b"),
|
|
62
62
|
timeout: z.number().default(120)
|
|
63
63
|
});
|
|
64
|
+
var mcpServerSchema = z.object({
|
|
65
|
+
transport: z.enum(["stdio", "http"]).default("stdio"),
|
|
66
|
+
command: z.string().optional(),
|
|
67
|
+
args: z.array(z.string()).optional(),
|
|
68
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
69
|
+
url: z.string().optional(),
|
|
70
|
+
disabledTools: z.array(z.string()).optional()
|
|
71
|
+
});
|
|
64
72
|
var defaultVisionFallback = { enabled: false, url: "http://localhost:11434", model: "qwen3.5:0.8b", timeout: 120 };
|
|
65
73
|
var configSchema = z.object({
|
|
66
74
|
providers: z.array(providerSchema).default([]),
|
|
75
|
+
mcpServers: z.record(z.string(), mcpServerSchema).optional(),
|
|
67
76
|
defaultModelSelection: z.string().optional(),
|
|
68
77
|
activeProviderId: z.string().optional(),
|
|
69
78
|
activeWorkflowId: z.string().optional(),
|
|
@@ -74,6 +83,7 @@ var configSchema = z.object({
|
|
|
74
83
|
visionFallback: visionFallbackSchema.optional()
|
|
75
84
|
}).transform((data) => ({
|
|
76
85
|
providers: data.providers ?? [],
|
|
86
|
+
mcpServers: data.mcpServers,
|
|
77
87
|
defaultModelSelection: data.defaultModelSelection,
|
|
78
88
|
activeProviderId: data.activeProviderId,
|
|
79
89
|
activeWorkflowId: data.activeWorkflowId,
|
|
@@ -225,6 +235,7 @@ async function saveGlobalConfig(mode, config) {
|
|
|
225
235
|
const configPath = getGlobalConfigPath(mode);
|
|
226
236
|
const fullConfig = {
|
|
227
237
|
providers: config.providers ?? [],
|
|
238
|
+
mcpServers: config.mcpServers,
|
|
228
239
|
defaultModelSelection: config.defaultModelSelection,
|
|
229
240
|
activeProviderId: config.activeProviderId,
|
|
230
241
|
activeWorkflowId: config.activeWorkflowId,
|
|
@@ -260,6 +271,7 @@ function setDefaultModelSelection(config, providerId, model) {
|
|
|
260
271
|
const defaultModelSelection = `${providerId}/${model}`;
|
|
261
272
|
return {
|
|
262
273
|
providers: config.providers?.map((p) => ({ ...p, isActive: p.id === providerId })) ?? [],
|
|
274
|
+
mcpServers: config.mcpServers,
|
|
263
275
|
defaultModelSelection,
|
|
264
276
|
activeProviderId: providerId,
|
|
265
277
|
activeWorkflowId: config.activeWorkflowId,
|
|
@@ -287,6 +299,7 @@ function addProvider(config, provider) {
|
|
|
287
299
|
...(config.providers ?? []).map((p) => shouldActivate ? { ...p, isActive: false } : p),
|
|
288
300
|
{ ...newProvider, isActive: shouldActivate }
|
|
289
301
|
],
|
|
302
|
+
mcpServers: config.mcpServers,
|
|
290
303
|
defaultModelSelection: shouldActivate ? `${newProvider.id}/auto` : config.defaultModelSelection,
|
|
291
304
|
activeProviderId: shouldActivate ? newProvider.id : config.activeProviderId,
|
|
292
305
|
activeWorkflowId: config.activeWorkflowId,
|
|
@@ -323,6 +336,7 @@ function removeProvider(config, providerId) {
|
|
|
323
336
|
const newActiveId = wasActive && filtered.length > 0 ? filtered[0].id : wasActive ? void 0 : config.activeProviderId;
|
|
324
337
|
return {
|
|
325
338
|
providers: filtered.map((p) => ({ ...p, isActive: p.id === newActiveId })),
|
|
339
|
+
mcpServers: config.mcpServers,
|
|
326
340
|
activeProviderId: newActiveId,
|
|
327
341
|
defaultModelSelection: newDefaultModelSelection,
|
|
328
342
|
activeWorkflowId: config.activeWorkflowId,
|
|
@@ -343,6 +357,7 @@ function activateProvider(config, providerId) {
|
|
|
343
357
|
if (!provider) {
|
|
344
358
|
return {
|
|
345
359
|
providers: config.providers ?? [],
|
|
360
|
+
mcpServers: config.mcpServers,
|
|
346
361
|
defaultModelSelection: config.defaultModelSelection,
|
|
347
362
|
activeProviderId: config.activeProviderId,
|
|
348
363
|
activeWorkflowId: config.activeWorkflowId,
|
|
@@ -360,6 +375,7 @@ function activateProvider(config, providerId) {
|
|
|
360
375
|
}
|
|
361
376
|
return {
|
|
362
377
|
providers: (config.providers ?? []).map((p) => ({ ...p, isActive: p.id === providerId })),
|
|
378
|
+
mcpServers: config.mcpServers,
|
|
363
379
|
defaultModelSelection: config.defaultModelSelection,
|
|
364
380
|
activeProviderId: providerId,
|
|
365
381
|
activeWorkflowId: config.activeWorkflowId,
|
|
@@ -419,4 +435,4 @@ export {
|
|
|
419
435
|
activateProvider,
|
|
420
436
|
mergeConfigs
|
|
421
437
|
};
|
|
422
|
-
//# sourceMappingURL=chunk-
|
|
438
|
+
//# sourceMappingURL=chunk-PP6VQXQW.js.map
|