openfox 2.0.35 → 2.0.37
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-YCFYRTFG.js → chat-handler-HPXOVKUX.js} +9 -9
- package/dist/{chunk-4MEYFRSN.js → chunk-2G2H4HUO.js} +128 -46
- package/dist/{chunk-OSMUHB5F.js → chunk-55RWNJBT.js} +6 -2
- package/dist/{chunk-XJU2PBLN.js → chunk-BJPPDLJX.js} +136 -46
- package/dist/{chunk-IBKGV6OJ.js → chunk-DAC7YKYW.js} +7 -7
- package/dist/{chunk-6PLAWCHQ.js → chunk-EHYFYQXY.js} +4 -2
- package/dist/{chunk-BGCDJYNU.js → chunk-JGNAYJJZ.js} +6 -5
- package/dist/{chunk-WTDCC4IP.js → chunk-NF6WHQAT.js} +9 -2
- package/dist/{chunk-Y2CUJ7JD.js → chunk-PKE4MQWI.js} +13 -7
- package/dist/{chunk-BW6DQC2L.js → chunk-PWY6EBZ6.js} +16 -39
- package/dist/{chunk-EB2RIVZA.js → chunk-QG2WM7EX.js} +5 -5
- package/dist/{chunk-DHOOJDHX.js → chunk-SM2PK6TV.js} +4 -4
- package/dist/{chunk-ZMONCXGW.js → chunk-WXAOEWJS.js} +3 -3
- package/dist/{chunk-ZJ4FP6RS.js → chunk-Z6W4YHJB.js} +7 -1
- package/dist/{chunk-QYP6MOB5.js → chunk-ZBLT7MNL.js} +2 -2
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{client-X6BVH4Q4.js → client-XTPAYYRH.js} +3 -3
- package/dist/{client-pure-5NOTSIRK.js → client-pure-N2MOIDQ6.js} +2 -2
- package/dist/{compactor-SHEOFZDB.js → compactor-RZA5VSRT.js} +6 -6
- package/dist/{config-OV5OLKOC.js → config-QI3KOU42.js} +2 -2
- package/dist/{events-YLICLPBY.js → events-KZZPCW2Q.js} +3 -3
- package/dist/{folding-PI67HWBR.js → folding-ENYH4LMG.js} +2 -2
- package/dist/{orchestrator-YJV4CXKV.js → orchestrator-PTKTND5E.js} +8 -8
- package/dist/package.json +1 -1
- package/dist/{processor-VGVPSVGE.js → processor-D6HYPRZD.js} +9 -9
- package/dist/{protocol-BC1QSQ-Y.d.ts → protocol-COpRaEpx.d.ts} +1 -0
- package/dist/{provider-AHIVZZI5.js → provider-ZLMMOORK.js} +6 -6
- package/dist/{provider-manager-5742XBEI.js → provider-manager-GTWFGTCV.js} +4 -4
- package/dist/{serve-6IHK22FM.js → serve-NGAWODZ2.js} +13 -13
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +12 -12
- package/dist/{server-RHYGD2Q6.js → server-K2BDDDL4.js} +11 -11
- package/dist/shared/index.d.ts +2 -2
- package/dist/{tools-2QBZBNDL.js → tools-JPKBLAQ5.js} +7 -7
- package/dist/web/assets/{index-DIvNnXne.css → index-GFd2V-Ja.css} +1 -1
- package/dist/web/assets/{index-BRf6aPnh.js → index-I3ZLVKAn.js} +65 -64
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
|
@@ -49,13 +49,13 @@ import {
|
|
|
49
49
|
createToolCallEvent,
|
|
50
50
|
createToolResultEvent,
|
|
51
51
|
streamLLMPure
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-55RWNJBT.js";
|
|
53
53
|
import {
|
|
54
54
|
getCurrentContextWindowId,
|
|
55
55
|
getCurrentWindowMessageOptions,
|
|
56
56
|
getEventStore,
|
|
57
57
|
getRuntimeConfig
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-NF6WHQAT.js";
|
|
59
59
|
import {
|
|
60
60
|
buildContextMessagesFromEventHistory,
|
|
61
61
|
foldContextState,
|
|
@@ -64,14 +64,14 @@ import {
|
|
|
64
64
|
handleToolCall,
|
|
65
65
|
handleToolResult,
|
|
66
66
|
stripOrphanedToolCalls
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-EHYFYQXY.js";
|
|
68
68
|
import {
|
|
69
69
|
logger
|
|
70
70
|
} from "./chunk-K44MW7JJ.js";
|
|
71
71
|
import {
|
|
72
72
|
loadGlobalConfig,
|
|
73
73
|
saveGlobalConfig
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-PWY6EBZ6.js";
|
|
75
75
|
import {
|
|
76
76
|
getGlobalConfigDir
|
|
77
77
|
} from "./chunk-CQGTEGKL.js";
|
|
@@ -2581,7 +2581,7 @@ ${CONTINUE_PROMPT}` : CONTINUE_PROMPT;
|
|
|
2581
2581
|
sessionManager.setCurrentContextSize(sessionId, result.usage.promptTokens);
|
|
2582
2582
|
if (!compacting) {
|
|
2583
2583
|
const contextState2 = sessionManager.getContextState(sessionId);
|
|
2584
|
-
const { shouldCompact, appendCompactionPrompt } = await import("./compactor-
|
|
2584
|
+
const { shouldCompact, appendCompactionPrompt } = await import("./compactor-RZA5VSRT.js");
|
|
2585
2585
|
if (shouldCompact(contextState2.currentTokens, contextState2.maxTokens, runtimeConfig.context.compactionThreshold)) {
|
|
2586
2586
|
appendCompactionPrompt(sessionId, append);
|
|
2587
2587
|
compacting = true;
|
|
@@ -2844,24 +2844,55 @@ var IMAGE_PROMPT = `Describe this image in detail. Focus on:
|
|
|
2844
2844
|
- Key elements and their relationships
|
|
2845
2845
|
|
|
2846
2846
|
Provide a concise but comprehensive description.`;
|
|
2847
|
+
function buildPrompt(context) {
|
|
2848
|
+
return context ? `${IMAGE_PROMPT}
|
|
2849
|
+
|
|
2850
|
+
Context: ${context}` : IMAGE_PROMPT;
|
|
2851
|
+
}
|
|
2852
|
+
function buildOllamaRequest(base64Data, model, context) {
|
|
2853
|
+
return {
|
|
2854
|
+
model,
|
|
2855
|
+
messages: [
|
|
2856
|
+
{
|
|
2857
|
+
role: "user",
|
|
2858
|
+
content: buildPrompt(context),
|
|
2859
|
+
images: [base64Data]
|
|
2860
|
+
}
|
|
2861
|
+
],
|
|
2862
|
+
stream: false,
|
|
2863
|
+
think: false
|
|
2864
|
+
};
|
|
2865
|
+
}
|
|
2866
|
+
function buildOpenAIRequest(base64Data, model, context) {
|
|
2867
|
+
return {
|
|
2868
|
+
model,
|
|
2869
|
+
messages: [
|
|
2870
|
+
{
|
|
2871
|
+
role: "user",
|
|
2872
|
+
content: [
|
|
2873
|
+
{ type: "text", text: buildPrompt(context) },
|
|
2874
|
+
{ type: "image_url", image_url: { url: `data:image/png;base64,${base64Data}` } }
|
|
2875
|
+
]
|
|
2876
|
+
}
|
|
2877
|
+
]
|
|
2878
|
+
};
|
|
2879
|
+
}
|
|
2880
|
+
function parseOllamaResponse(data) {
|
|
2881
|
+
const resp = data;
|
|
2882
|
+
return resp.message?.content?.trim() ?? null;
|
|
2883
|
+
}
|
|
2884
|
+
function parseOpenAIResponse(data) {
|
|
2885
|
+
const resp = data;
|
|
2886
|
+
const choice = resp.choices?.[0];
|
|
2887
|
+
if (!choice) return null;
|
|
2888
|
+
return choice.message?.content?.trim() ?? null;
|
|
2889
|
+
}
|
|
2847
2890
|
async function describeImage(base64Data, visionModel, options) {
|
|
2848
2891
|
const timeout = visionModel.timeout;
|
|
2849
2892
|
try {
|
|
2850
|
-
const
|
|
2851
|
-
const
|
|
2852
|
-
|
|
2853
|
-
messages: [
|
|
2854
|
-
{
|
|
2855
|
-
role: "user",
|
|
2856
|
-
content: options?.context ? `${IMAGE_PROMPT}
|
|
2857
|
-
|
|
2858
|
-
Context: ${options.context}` : IMAGE_PROMPT,
|
|
2859
|
-
images: [base64Data]
|
|
2860
|
-
}
|
|
2861
|
-
],
|
|
2862
|
-
stream: false,
|
|
2863
|
-
think: false
|
|
2864
|
-
};
|
|
2893
|
+
const isOpenAI = visionModel.backend === "openai";
|
|
2894
|
+
const url = isOpenAI ? `${visionModel.baseUrl.replace(/\/+$/, "")}/chat/completions` : `${visionModel.baseUrl.replace(/\/+$/, "")}/api/chat`;
|
|
2895
|
+
const requestBody = isOpenAI ? buildOpenAIRequest(base64Data, visionModel.model, options?.context) : buildOllamaRequest(base64Data, visionModel.model, options?.context);
|
|
2865
2896
|
const timeoutController = new AbortController();
|
|
2866
2897
|
const timeoutId = setTimeout(() => timeoutController.abort(), timeout);
|
|
2867
2898
|
const signal = options?.signal ? AbortSignal.any([timeoutController.signal, options.signal]) : timeoutController.signal;
|
|
@@ -2880,7 +2911,7 @@ Context: ${options.context}` : IMAGE_PROMPT,
|
|
|
2880
2911
|
return `[Image description failed: HTTP ${response.status}]`;
|
|
2881
2912
|
}
|
|
2882
2913
|
const data = await response.json();
|
|
2883
|
-
const description = data
|
|
2914
|
+
const description = isOpenAI ? parseOpenAIResponse(data) : parseOllamaResponse(data);
|
|
2884
2915
|
if (!description) {
|
|
2885
2916
|
logger.warn("Vision fallback returned empty description");
|
|
2886
2917
|
return "[Image - could not describe]";
|
|
@@ -2907,13 +2938,18 @@ async function describeImageFromDataUrl(dataUrl, visionModel, options) {
|
|
|
2907
2938
|
import { createHash as createHash2 } from "crypto";
|
|
2908
2939
|
async function loadVisionModelFromGlobalConfig() {
|
|
2909
2940
|
try {
|
|
2910
|
-
const { loadGlobalConfig: loadGlobalConfig2, getVisionFallback } = await import("./config-
|
|
2941
|
+
const { loadGlobalConfig: loadGlobalConfig2, getVisionFallback } = await import("./config-QI3KOU42.js");
|
|
2911
2942
|
const runtimeConfig = getRuntimeConfig();
|
|
2912
2943
|
const mode = runtimeConfig.mode ?? "production";
|
|
2913
2944
|
const globalConfig = await loadGlobalConfig2(mode);
|
|
2914
2945
|
const fallback = getVisionFallback(globalConfig);
|
|
2915
2946
|
if (fallback?.enabled && fallback.model) {
|
|
2916
|
-
return {
|
|
2947
|
+
return {
|
|
2948
|
+
baseUrl: fallback.url,
|
|
2949
|
+
model: fallback.model,
|
|
2950
|
+
timeout: fallback.timeout * 1e3,
|
|
2951
|
+
backend: fallback.backend ?? "ollama"
|
|
2952
|
+
};
|
|
2917
2953
|
}
|
|
2918
2954
|
} catch {
|
|
2919
2955
|
}
|
|
@@ -2933,12 +2969,6 @@ function hasImageMetadata(result) {
|
|
|
2933
2969
|
const mimeType = meta["mimeType"];
|
|
2934
2970
|
return typeof dataUrl === "string" && typeof mimeType === "string" && mimeType.startsWith("image/");
|
|
2935
2971
|
}
|
|
2936
|
-
function buildImageDescription(filename, description) {
|
|
2937
|
-
return `[Image: ${filename || "image"} - description: ${description}]`;
|
|
2938
|
-
}
|
|
2939
|
-
function buildImagePlaceholder(filename) {
|
|
2940
|
-
return `[Image: ${filename || "image"}]`;
|
|
2941
|
-
}
|
|
2942
2972
|
async function describeAttachment(att, messageId, options, descriptions) {
|
|
2943
2973
|
const cacheKey = contentHash(att.data);
|
|
2944
2974
|
if (descriptionCache.has(cacheKey)) {
|
|
@@ -2964,7 +2994,7 @@ async function describeAttachment(att, messageId, options, descriptions) {
|
|
|
2964
2994
|
options.onEvent?.({ type: "vision_fallback.done", data: { messageId, attachmentId: att.id, description } });
|
|
2965
2995
|
return description;
|
|
2966
2996
|
}
|
|
2967
|
-
const placeholder =
|
|
2997
|
+
const placeholder = `[Image: ${att.filename || "image"}]`;
|
|
2968
2998
|
descriptions.set(att.id, placeholder);
|
|
2969
2999
|
return placeholder;
|
|
2970
3000
|
}
|
|
@@ -2996,7 +3026,7 @@ async function describeToolResultImage(dataUrl, filename, toolCallId, messageId,
|
|
|
2996
3026
|
});
|
|
2997
3027
|
return description;
|
|
2998
3028
|
}
|
|
2999
|
-
const placeholder =
|
|
3029
|
+
const placeholder = `[Image: ${filename || "image"}]`;
|
|
3000
3030
|
descriptions.set(toolCallId, placeholder);
|
|
3001
3031
|
return placeholder;
|
|
3002
3032
|
}
|
|
@@ -3012,20 +3042,28 @@ async function processContextImages(events, options) {
|
|
|
3012
3042
|
if (!data.attachments || data.attachments.length === 0) continue;
|
|
3013
3043
|
const imageAtts = data.attachments.filter(isImageAttachment);
|
|
3014
3044
|
if (imageAtts.length === 0) continue;
|
|
3015
|
-
let
|
|
3045
|
+
let enriched = false;
|
|
3016
3046
|
for (const att of imageAtts) {
|
|
3047
|
+
if (att.description) {
|
|
3048
|
+
descriptions.set(att.id, att.description);
|
|
3049
|
+
continue;
|
|
3050
|
+
}
|
|
3017
3051
|
const description = await describeAttachment(att, data.messageId, options, descriptions);
|
|
3018
|
-
|
|
3019
|
-
|
|
3052
|
+
att.description = description;
|
|
3053
|
+
enriched = true;
|
|
3054
|
+
}
|
|
3055
|
+
if (enriched && options.persistEvent) {
|
|
3056
|
+
options.persistEvent(event.sessionId, event.seq, data);
|
|
3020
3057
|
}
|
|
3021
|
-
;
|
|
3022
|
-
data.content = content;
|
|
3023
|
-
delete data.attachments;
|
|
3024
3058
|
}
|
|
3025
3059
|
if (event.type === "tool.result") {
|
|
3026
3060
|
const data = event.data;
|
|
3027
3061
|
if (!data.result.metadata || !hasImageMetadata(data.result)) continue;
|
|
3028
3062
|
const meta = data.result.metadata;
|
|
3063
|
+
if (meta["description"]) {
|
|
3064
|
+
descriptions.set(data.toolCallId, meta["description"]);
|
|
3065
|
+
continue;
|
|
3066
|
+
}
|
|
3029
3067
|
const dataUrl = meta["dataUrl"];
|
|
3030
3068
|
const path = meta["path"];
|
|
3031
3069
|
const description = await describeToolResultImage(
|
|
@@ -3036,8 +3074,54 @@ ${buildImageDescription(att.filename, description)}`;
|
|
|
3036
3074
|
options,
|
|
3037
3075
|
descriptions
|
|
3038
3076
|
);
|
|
3039
|
-
|
|
3040
|
-
|
|
3077
|
+
meta["description"] = description;
|
|
3078
|
+
if (options.persistEvent) {
|
|
3079
|
+
options.persistEvent(event.sessionId, event.seq, data);
|
|
3080
|
+
}
|
|
3081
|
+
}
|
|
3082
|
+
if (event.type === "turn.snapshot") {
|
|
3083
|
+
const snapshot = event.data;
|
|
3084
|
+
let enriched = false;
|
|
3085
|
+
for (const message of snapshot.messages) {
|
|
3086
|
+
if (message.role === "user" && message.attachments && message.attachments.length > 0) {
|
|
3087
|
+
const imageAtts = message.attachments.filter(isImageAttachment);
|
|
3088
|
+
if (imageAtts.length === 0) continue;
|
|
3089
|
+
for (const att of imageAtts) {
|
|
3090
|
+
if (att.description) {
|
|
3091
|
+
descriptions.set(att.id, att.description);
|
|
3092
|
+
continue;
|
|
3093
|
+
}
|
|
3094
|
+
const description = await describeAttachment(att, message.id, options, descriptions);
|
|
3095
|
+
att.description = description;
|
|
3096
|
+
enriched = true;
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
if (message.role === "assistant" && message.toolCalls) {
|
|
3100
|
+
for (const toolCall of message.toolCalls) {
|
|
3101
|
+
if (!toolCall.result || !toolCall.result.metadata || !hasImageMetadata(toolCall.result)) continue;
|
|
3102
|
+
const meta = toolCall.result.metadata;
|
|
3103
|
+
if (meta["description"]) {
|
|
3104
|
+
descriptions.set(toolCall.id, meta["description"]);
|
|
3105
|
+
continue;
|
|
3106
|
+
}
|
|
3107
|
+
const dataUrl = meta["dataUrl"];
|
|
3108
|
+
const path = meta["path"];
|
|
3109
|
+
const description = await describeToolResultImage(
|
|
3110
|
+
dataUrl,
|
|
3111
|
+
path,
|
|
3112
|
+
toolCall.id,
|
|
3113
|
+
message.id,
|
|
3114
|
+
options,
|
|
3115
|
+
descriptions
|
|
3116
|
+
);
|
|
3117
|
+
meta["description"] = description;
|
|
3118
|
+
enriched = true;
|
|
3119
|
+
}
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
3122
|
+
if (enriched && options.persistEvent) {
|
|
3123
|
+
options.persistEvent(event.sessionId, event.seq, snapshot);
|
|
3124
|
+
}
|
|
3041
3125
|
}
|
|
3042
3126
|
}
|
|
3043
3127
|
return { events: modifiedEvents, descriptions };
|
|
@@ -3150,11 +3234,17 @@ async function processEventsForConversation(sessionId, llmClient, onEvent) {
|
|
|
3150
3234
|
const rawEvents = eventStore.getEvents(sessionId);
|
|
3151
3235
|
const modelVision = modelSupportsVision(llmClient.getModel());
|
|
3152
3236
|
const runtimeConfig = getRuntimeConfig();
|
|
3153
|
-
const visionModel = runtimeConfig.llm?.visionModel ? {
|
|
3237
|
+
const visionModel = runtimeConfig.llm?.visionModel ? {
|
|
3238
|
+
baseUrl: runtimeConfig.llm.baseUrl,
|
|
3239
|
+
model: runtimeConfig.llm.visionModel,
|
|
3240
|
+
timeout: runtimeConfig.llm.timeout,
|
|
3241
|
+
backend: runtimeConfig.llm.backend === "ollama" ? "ollama" : "openai"
|
|
3242
|
+
} : await loadVisionModelFromGlobalConfig();
|
|
3154
3243
|
const { events: processedEvents } = await processContextImages(rawEvents, {
|
|
3155
3244
|
modelSupportsVision: modelVision,
|
|
3156
3245
|
...visionModel ? { visionModel } : {},
|
|
3157
|
-
onEvent
|
|
3246
|
+
onEvent,
|
|
3247
|
+
persistEvent: (sid, seq, data) => eventStore.updateEventPayload(sid, seq, data)
|
|
3158
3248
|
});
|
|
3159
3249
|
return processedEvents;
|
|
3160
3250
|
}
|
|
@@ -3362,7 +3452,7 @@ var callSubAgentTool = {
|
|
|
3362
3452
|
};
|
|
3363
3453
|
}
|
|
3364
3454
|
try {
|
|
3365
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
3455
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-JPKBLAQ5.js");
|
|
3366
3456
|
const toolRegistry = getToolRegistryForAgent2(agentDef);
|
|
3367
3457
|
const turnMetrics = new TurnMetrics();
|
|
3368
3458
|
const result = await executeSubAgent({
|
|
@@ -4178,7 +4268,7 @@ function resolveAgentDef2(sessionManager, sessionId) {
|
|
|
4178
4268
|
}
|
|
4179
4269
|
async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
|
|
4180
4270
|
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
4181
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
4271
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-JPKBLAQ5.js");
|
|
4182
4272
|
const tools = getToolRegistryForAgent2(agentDef).definitions;
|
|
4183
4273
|
const toolFingerprint = getToolFingerprint(tools);
|
|
4184
4274
|
const allAgents = await loadAllAgentsDefault();
|
|
@@ -4191,7 +4281,7 @@ async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
|
|
|
4191
4281
|
async function computeSessionHash(sessionManager, sessionId) {
|
|
4192
4282
|
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
4193
4283
|
const agentDef = await resolveAgentDef2(sessionManager, sessionId);
|
|
4194
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
4284
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-JPKBLAQ5.js");
|
|
4195
4285
|
const tools = getToolRegistryForAgent2(agentDef).definitions;
|
|
4196
4286
|
const toolFingerprint = getToolFingerprint(tools);
|
|
4197
4287
|
return computeDynamicContextHash(instructionContent, skills, toolFingerprint);
|
|
@@ -4298,7 +4388,7 @@ var mcpConfigTool = createTool(
|
|
|
4298
4388
|
await saveGlobalConfig(mcpConfigMode, { ...globalConfig, mcpServers: updated });
|
|
4299
4389
|
}
|
|
4300
4390
|
async function rebuildTools() {
|
|
4301
|
-
const { setMcpTools: setMcpTools2 } = await import("./tools-
|
|
4391
|
+
const { setMcpTools: setMcpTools2 } = await import("./tools-JPKBLAQ5.js");
|
|
4302
4392
|
const mcpTools = createMcpTools(mcpManagerForTools);
|
|
4303
4393
|
setMcpTools2(mcpTools);
|
|
4304
4394
|
}
|
|
@@ -4702,4 +4792,4 @@ export {
|
|
|
4702
4792
|
getToolRegistryForAgent,
|
|
4703
4793
|
createToolRegistry
|
|
4704
4794
|
};
|
|
4705
|
-
//# sourceMappingURL=chunk-
|
|
4795
|
+
//# sourceMappingURL=chunk-BJPPDLJX.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
injectWorkflowKickoffIfNeeded,
|
|
3
3
|
runAgentTurn,
|
|
4
4
|
runChatTurn
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-QG2WM7EX.js";
|
|
6
6
|
import {
|
|
7
7
|
applyDynamicContext,
|
|
8
8
|
checkAborted,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
loadAllAgentsDefault,
|
|
17
17
|
saveItemToDir,
|
|
18
18
|
spawnShellProcess
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-BJPPDLJX.js";
|
|
20
20
|
import {
|
|
21
21
|
getPlatformShell,
|
|
22
22
|
onProcessEvent
|
|
@@ -40,19 +40,19 @@ import {
|
|
|
40
40
|
} from "./chunk-EU3WWTFH.js";
|
|
41
41
|
import {
|
|
42
42
|
appendCompactionPrompt
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-WXAOEWJS.js";
|
|
44
44
|
import {
|
|
45
45
|
TurnMetrics,
|
|
46
46
|
createMessageStartEvent
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-55RWNJBT.js";
|
|
48
48
|
import {
|
|
49
49
|
getCurrentContextWindowId,
|
|
50
50
|
getEventStore,
|
|
51
51
|
getRuntimeConfig
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-NF6WHQAT.js";
|
|
53
53
|
import {
|
|
54
54
|
createLLMClient
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-ZBLT7MNL.js";
|
|
56
56
|
import {
|
|
57
57
|
ensureVersionPrefix
|
|
58
58
|
} from "./chunk-HNCM3D7Y.js";
|
|
@@ -2056,4 +2056,4 @@ export {
|
|
|
2056
2056
|
signalMcpReady,
|
|
2057
2057
|
createWebSocketServer
|
|
2058
2058
|
};
|
|
2059
|
-
//# sourceMappingURL=chunk-
|
|
2059
|
+
//# sourceMappingURL=chunk-DAC7YKYW.js.map
|
|
@@ -396,13 +396,15 @@ Error: ${data.result.error}` : `Error: ${data.result.error}`
|
|
|
396
396
|
toolCallId: data.toolCallId
|
|
397
397
|
};
|
|
398
398
|
if (imageMeta?.dataUrl && imageMeta?.mimeType?.startsWith("image/")) {
|
|
399
|
+
const description = imageMeta["description"];
|
|
399
400
|
toolMsg.attachments = [
|
|
400
401
|
{
|
|
401
402
|
id: crypto.randomUUID(),
|
|
402
403
|
filename: imageMeta.path ?? "image",
|
|
403
404
|
mimeType: imageMeta.mimeType,
|
|
404
405
|
size: imageMeta.size ?? 0,
|
|
405
|
-
data: imageMeta.dataUrl
|
|
406
|
+
data: imageMeta.dataUrl,
|
|
407
|
+
...typeof description === "string" ? { description } : {}
|
|
406
408
|
}
|
|
407
409
|
];
|
|
408
410
|
}
|
|
@@ -831,4 +833,4 @@ export {
|
|
|
831
833
|
buildSnapshot,
|
|
832
834
|
buildSnapshotFromSessionState
|
|
833
835
|
};
|
|
834
|
-
//# sourceMappingURL=chunk-
|
|
836
|
+
//# sourceMappingURL=chunk-EHYFYQXY.js.map
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
getEventStore,
|
|
10
10
|
updateSessionMetadata
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-NF6WHQAT.js";
|
|
12
12
|
import {
|
|
13
13
|
buildMessagesFromStoredEvents,
|
|
14
14
|
foldPendingConfirmations
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-EHYFYQXY.js";
|
|
16
16
|
import {
|
|
17
17
|
logger
|
|
18
18
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -105,6 +105,7 @@ function resolveSessionProvider(session, providerManager) {
|
|
|
105
105
|
const provider = session.providerId ? providers.find((p) => p.id === session.providerId) : providers.find((p) => p.isActive);
|
|
106
106
|
if (!provider) return void 0;
|
|
107
107
|
return {
|
|
108
|
+
providerId: provider.id,
|
|
108
109
|
baseUrl: provider.url,
|
|
109
110
|
...provider.apiKey ? { apiKey: provider.apiKey } : {},
|
|
110
111
|
model: effectiveModel
|
|
@@ -117,7 +118,7 @@ async function generateSessionNameForSession(sessionId, userMessage, deps, signa
|
|
|
117
118
|
const messageCount = getSessionMessageCount(sessionId);
|
|
118
119
|
if (!needsNameGenerationCheck(sessionId, session.metadata.title, messageCount)) return;
|
|
119
120
|
const providerConfig = resolveSessionProvider(session, providerManager);
|
|
120
|
-
const modelSettings = providerConfig ? providerManager.getModelSettings(providerConfig.model, "non-thinking") : void 0;
|
|
121
|
+
const modelSettings = providerConfig ? providerManager.getModelSettings(providerConfig.providerId, providerConfig.model, "non-thinking") : void 0;
|
|
121
122
|
const prompt = SESSION_NAME_PROMPT.replace("{message}", userMessage);
|
|
122
123
|
try {
|
|
123
124
|
let client;
|
|
@@ -125,7 +126,7 @@ async function generateSessionNameForSession(sessionId, userMessage, deps, signa
|
|
|
125
126
|
client = deps.getLLMClient();
|
|
126
127
|
client.setModel(providerConfig.model);
|
|
127
128
|
} else if (providerConfig) {
|
|
128
|
-
const { createLLMClient } = await import("./client-
|
|
129
|
+
const { createLLMClient } = await import("./client-XTPAYYRH.js");
|
|
129
130
|
client = createLLMClient({
|
|
130
131
|
llm: {
|
|
131
132
|
baseUrl: providerConfig.baseUrl,
|
|
@@ -174,4 +175,4 @@ export {
|
|
|
174
175
|
buildRunChatTurnParams,
|
|
175
176
|
generateSessionNameForSession
|
|
176
177
|
};
|
|
177
|
-
//# sourceMappingURL=chunk-
|
|
178
|
+
//# sourceMappingURL=chunk-JGNAYJJZ.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
foldContextState,
|
|
6
6
|
foldSessionState,
|
|
7
7
|
spreadOptionalMessageFields
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EHYFYQXY.js";
|
|
9
9
|
import {
|
|
10
10
|
getDatabase
|
|
11
11
|
} from "./chunk-ZPIZLTWU.js";
|
|
@@ -226,6 +226,13 @@ var EventStore = class {
|
|
|
226
226
|
transaction();
|
|
227
227
|
return count;
|
|
228
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* Update the payload of an existing event in-place.
|
|
231
|
+
* Used to persist enriched data (e.g., vision fallback descriptions) back to the store.
|
|
232
|
+
*/
|
|
233
|
+
updateEventPayload(sessionId, seq, data) {
|
|
234
|
+
this.db.prepare(`UPDATE events SET payload = ? WHERE session_id = ? AND seq = ?`).run(JSON.stringify(data), sessionId, seq);
|
|
235
|
+
}
|
|
229
236
|
/**
|
|
230
237
|
* Get the latest sequence number for a session
|
|
231
238
|
*/
|
|
@@ -1425,4 +1432,4 @@ export {
|
|
|
1425
1432
|
truncateSessionMessages,
|
|
1426
1433
|
getRecentUserPromptsForSession
|
|
1427
1434
|
};
|
|
1428
|
-
//# sourceMappingURL=chunk-
|
|
1435
|
+
//# sourceMappingURL=chunk-NF6WHQAT.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-QI3KOU42.js");
|
|
37
37
|
const { getAuthKeyPath } = await import("./paths-X46PPOI2.js");
|
|
38
38
|
const existingAuth = await loadAuthConfig(mode);
|
|
39
39
|
if (existingAuth) {
|
|
@@ -89,12 +89,18 @@ async function runNetworkSetup(mode) {
|
|
|
89
89
|
logging: { level: "error" },
|
|
90
90
|
database: { path: "" },
|
|
91
91
|
workspace: { workdir: process.cwd() },
|
|
92
|
-
visionFallback: {
|
|
92
|
+
visionFallback: {
|
|
93
|
+
enabled: false,
|
|
94
|
+
url: "http://localhost:11434",
|
|
95
|
+
model: "qwen3.5:0.8b",
|
|
96
|
+
timeout: 120,
|
|
97
|
+
backend: "ollama"
|
|
98
|
+
}
|
|
93
99
|
});
|
|
94
100
|
console.log("\u2713 Configuration saved!\n");
|
|
95
101
|
}
|
|
96
102
|
async function runConfig(mode) {
|
|
97
|
-
const { loadGlobalConfig, getActiveProvider, getDefaultModel } = await import("./config-
|
|
103
|
+
const { loadGlobalConfig, getActiveProvider, getDefaultModel } = await import("./config-QI3KOU42.js");
|
|
98
104
|
const { getGlobalConfigPath } = await import("./paths-X46PPOI2.js");
|
|
99
105
|
const config = await loadGlobalConfig(mode);
|
|
100
106
|
const configPath = getGlobalConfigPath(mode);
|
|
@@ -152,7 +158,7 @@ async function runCli(options) {
|
|
|
152
158
|
break;
|
|
153
159
|
}
|
|
154
160
|
case "provider": {
|
|
155
|
-
const { runProviderCommand } = await import("./provider-
|
|
161
|
+
const { runProviderCommand } = await import("./provider-ZLMMOORK.js");
|
|
156
162
|
const [, subcommand] = positionals;
|
|
157
163
|
await runProviderCommand(mode, subcommand);
|
|
158
164
|
break;
|
|
@@ -191,12 +197,12 @@ async function runCli(options) {
|
|
|
191
197
|
break;
|
|
192
198
|
}
|
|
193
199
|
default: {
|
|
194
|
-
const { configFileExists } = await import("./config-
|
|
200
|
+
const { configFileExists } = await import("./config-QI3KOU42.js");
|
|
195
201
|
const configExists = await configFileExists(mode);
|
|
196
202
|
if (!configExists) {
|
|
197
203
|
await runNetworkSetup(mode);
|
|
198
204
|
}
|
|
199
|
-
const { runServe } = await import("./serve-
|
|
205
|
+
const { runServe } = await import("./serve-NGAWODZ2.js");
|
|
200
206
|
const serveOptions = { mode };
|
|
201
207
|
if (values.port) serveOptions.port = parseInt(values.port);
|
|
202
208
|
if (values["no-browser"] === true) serveOptions.openBrowser = false;
|
|
@@ -208,4 +214,4 @@ async function runCli(options) {
|
|
|
208
214
|
export {
|
|
209
215
|
runCli
|
|
210
216
|
};
|
|
211
|
-
//# sourceMappingURL=chunk-
|
|
217
|
+
//# sourceMappingURL=chunk-PKE4MQWI.js.map
|
|
@@ -59,7 +59,8 @@ var visionFallbackSchema = z.object({
|
|
|
59
59
|
enabled: z.boolean().default(false),
|
|
60
60
|
url: z.string().default("http://localhost:11434"),
|
|
61
61
|
model: z.string().default("qwen3.5:0.8b"),
|
|
62
|
-
timeout: z.number().default(120)
|
|
62
|
+
timeout: z.number().default(120),
|
|
63
|
+
backend: z.enum(["ollama", "openai"]).default("ollama")
|
|
63
64
|
});
|
|
64
65
|
var mcpServerSchema = z.object({
|
|
65
66
|
transport: z.enum(["stdio", "http"]).default("stdio"),
|
|
@@ -70,7 +71,13 @@ var mcpServerSchema = z.object({
|
|
|
70
71
|
headers: z.record(z.string(), z.string()).optional(),
|
|
71
72
|
disabledTools: z.array(z.string()).optional()
|
|
72
73
|
});
|
|
73
|
-
var defaultVisionFallback = {
|
|
74
|
+
var defaultVisionFallback = {
|
|
75
|
+
enabled: false,
|
|
76
|
+
url: "http://localhost:11434",
|
|
77
|
+
model: "qwen3.5:0.8b",
|
|
78
|
+
timeout: 120,
|
|
79
|
+
backend: "ollama"
|
|
80
|
+
};
|
|
74
81
|
var configSchema = z.object({
|
|
75
82
|
providers: z.array(providerSchema).default([]),
|
|
76
83
|
mcpServers: z.record(z.string(), mcpServerSchema).optional(),
|
|
@@ -225,12 +232,7 @@ async function saveGlobalConfig(mode, config) {
|
|
|
225
232
|
logging: config.logging ?? { level: "error" },
|
|
226
233
|
database: config.database ?? { path: "" },
|
|
227
234
|
workspace: config.workspace ?? { workdir: process.cwd() },
|
|
228
|
-
visionFallback: config.visionFallback ??
|
|
229
|
-
enabled: false,
|
|
230
|
-
url: "http://localhost:11434",
|
|
231
|
-
model: "qwen3.5:0.8b",
|
|
232
|
-
timeout: 120
|
|
233
|
-
}
|
|
235
|
+
visionFallback: config.visionFallback ?? defaultVisionFallback
|
|
234
236
|
};
|
|
235
237
|
await mkdir(dirname(configPath), { recursive: true });
|
|
236
238
|
await writeFile(configPath, JSON.stringify(fullConfig, null, 2));
|
|
@@ -261,12 +263,7 @@ function setDefaultModelSelection(config, providerId, model) {
|
|
|
261
263
|
logging: config.logging ?? { level: "error" },
|
|
262
264
|
database: config.database ?? { path: "" },
|
|
263
265
|
workspace: config.workspace ?? { workdir: process.cwd() },
|
|
264
|
-
visionFallback: config.visionFallback ??
|
|
265
|
-
enabled: false,
|
|
266
|
-
url: "http://localhost:11434",
|
|
267
|
-
model: "qwen3.5:0.8b",
|
|
268
|
-
timeout: 120
|
|
269
|
-
}
|
|
266
|
+
visionFallback: config.visionFallback ?? defaultVisionFallback
|
|
270
267
|
};
|
|
271
268
|
}
|
|
272
269
|
function addProvider(config, provider) {
|
|
@@ -289,12 +286,7 @@ function addProvider(config, provider) {
|
|
|
289
286
|
logging: config.logging ?? { level: "error" },
|
|
290
287
|
database: config.database ?? { path: "" },
|
|
291
288
|
workspace: config.workspace ?? { workdir: process.cwd() },
|
|
292
|
-
visionFallback: config.visionFallback ??
|
|
293
|
-
enabled: false,
|
|
294
|
-
url: "http://localhost:11434",
|
|
295
|
-
model: "qwen3.5:0.8b",
|
|
296
|
-
timeout: 120
|
|
297
|
-
}
|
|
289
|
+
visionFallback: config.visionFallback ?? defaultVisionFallback
|
|
298
290
|
};
|
|
299
291
|
}
|
|
300
292
|
function updateProvider(config, providerId, updates) {
|
|
@@ -327,12 +319,7 @@ function removeProvider(config, providerId) {
|
|
|
327
319
|
logging: config.logging ?? { level: "error" },
|
|
328
320
|
database: config.database ?? { path: "" },
|
|
329
321
|
workspace: config.workspace ?? { workdir: process.cwd() },
|
|
330
|
-
visionFallback: config.visionFallback ??
|
|
331
|
-
enabled: false,
|
|
332
|
-
url: "http://localhost:11434",
|
|
333
|
-
model: "qwen3.5:0.8b",
|
|
334
|
-
timeout: 120
|
|
335
|
-
}
|
|
322
|
+
visionFallback: config.visionFallback ?? defaultVisionFallback
|
|
336
323
|
};
|
|
337
324
|
}
|
|
338
325
|
function activateProvider(config, providerId) {
|
|
@@ -348,12 +335,7 @@ function activateProvider(config, providerId) {
|
|
|
348
335
|
logging: config.logging ?? { level: "error" },
|
|
349
336
|
database: config.database ?? { path: "" },
|
|
350
337
|
workspace: config.workspace ?? { workdir: process.cwd() },
|
|
351
|
-
visionFallback: config.visionFallback ??
|
|
352
|
-
enabled: false,
|
|
353
|
-
url: "http://localhost:11434",
|
|
354
|
-
model: "qwen3.5:0.8b",
|
|
355
|
-
timeout: 120
|
|
356
|
-
}
|
|
338
|
+
visionFallback: config.visionFallback ?? defaultVisionFallback
|
|
357
339
|
};
|
|
358
340
|
}
|
|
359
341
|
return {
|
|
@@ -366,12 +348,7 @@ function activateProvider(config, providerId) {
|
|
|
366
348
|
logging: config.logging ?? { level: "error" },
|
|
367
349
|
database: config.database ?? { path: "" },
|
|
368
350
|
workspace: config.workspace ?? { workdir: process.cwd() },
|
|
369
|
-
visionFallback: config.visionFallback ??
|
|
370
|
-
enabled: false,
|
|
371
|
-
url: "http://localhost:11434",
|
|
372
|
-
model: "qwen3.5:0.8b",
|
|
373
|
-
timeout: 120
|
|
374
|
-
}
|
|
351
|
+
visionFallback: config.visionFallback ?? defaultVisionFallback
|
|
375
352
|
};
|
|
376
353
|
}
|
|
377
354
|
function mergeConfigs(...configs) {
|
|
@@ -418,4 +395,4 @@ export {
|
|
|
418
395
|
activateProvider,
|
|
419
396
|
mergeConfigs
|
|
420
397
|
};
|
|
421
|
-
//# sourceMappingURL=chunk-
|
|
398
|
+
//# sourceMappingURL=chunk-PWY6EBZ6.js.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
loadAllAgentsDefault,
|
|
13
13
|
processEventsForConversation,
|
|
14
14
|
runTopLevelAgentLoop
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-BJPPDLJX.js";
|
|
16
16
|
import {
|
|
17
17
|
TurnMetrics,
|
|
18
18
|
WORKFLOW_KICKOFF_PROMPT,
|
|
@@ -20,16 +20,16 @@ import {
|
|
|
20
20
|
buildAgentSmallReminder,
|
|
21
21
|
createChatDoneEvent,
|
|
22
22
|
createMessageStartEvent
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-55RWNJBT.js";
|
|
24
24
|
import {
|
|
25
25
|
getCurrentContextWindowId,
|
|
26
26
|
getCurrentWindowMessageOptions,
|
|
27
27
|
getEventStore,
|
|
28
28
|
getRuntimeConfig
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-NF6WHQAT.js";
|
|
30
30
|
import {
|
|
31
31
|
buildSnapshotFromSessionState
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-EHYFYQXY.js";
|
|
33
33
|
import {
|
|
34
34
|
logger
|
|
35
35
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -310,4 +310,4 @@ export {
|
|
|
310
310
|
runAgentTurn,
|
|
311
311
|
injectWorkflowKickoffIfNeeded
|
|
312
312
|
};
|
|
313
|
-
//# sourceMappingURL=chunk-
|
|
313
|
+
//# sourceMappingURL=chunk-QG2WM7EX.js.map
|