openfox 1.6.75 → 1.6.77
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/README.md +18 -18
- package/dist/agent-defaults/code-reviewer.agent.md +1 -0
- package/dist/agent-defaults/explorer.agent.md +2 -1
- package/dist/agent-defaults/verifier.agent.md +4 -0
- package/dist/{ask-3RK5YJZE.js → ask-5SSOA6SZ.js} +2 -2
- package/dist/{auth-LZZX63KI.js → auth-56SIRACI.js} +3 -6
- package/dist/auto-compaction-GOHNI2R2.js +27 -0
- package/dist/{branch.api-XADFZZAA.js → branch.api-PWFW26KC.js} +2 -2
- package/dist/{chat-handler-KYMMXPP6.js → chat-handler-K2RDXBO6.js} +31 -29
- package/dist/{chunk-IA4O65CR.js → chunk-6SYNGMU4.js} +100 -68
- package/dist/{chunk-AFATQ5LJ.js → chunk-B5AP3RSV.js} +1 -1
- package/dist/{chunk-PFRQO5Z3.js → chunk-BBC46FN4.js} +61 -28
- package/dist/{chunk-22CTURMH.js → chunk-BJYPTN5S.js} +1 -1
- package/dist/{chunk-DLINTLB7.js → chunk-BSTVRSV6.js} +7 -5
- package/dist/{chunk-7JPKRM6M.js → chunk-CMQCO27Y.js} +22 -12
- package/dist/{chunk-R4HADRYO.js → chunk-CQGTEGKL.js} +1 -1
- package/dist/{chunk-J5DV33SS.js → chunk-CUDAT6SS.js} +46 -18
- package/dist/{chunk-ETIXH35K.js → chunk-EBQYRNNU.js} +535 -291
- package/dist/{chunk-4CQ7CUQ6.js → chunk-I7JVS7V5.js} +5 -5
- package/dist/{chunk-PNBH3RAX.js → chunk-K44MW7JJ.js} +1 -1
- package/dist/{chunk-BLNFJ22S.js → chunk-KIOUKC3Z.js} +6 -4
- package/dist/{chunk-CTAIXOZJ.js → chunk-NDJ6FKSP.js} +1 -1
- package/dist/{chunk-VIGOXEZG.js → chunk-OJBFC6ER.js} +15 -16
- package/dist/{chunk-GQZGIMJO.js → chunk-OXI26S7U.js} +12 -7
- package/dist/{chunk-NBU6KIOD.js → chunk-PBGOZMVY.js} +4 -4
- package/dist/{chunk-B7E3BICY.js → chunk-RGRBWDZP.js} +2 -4
- package/dist/{chunk-KFBIHS3S.js → chunk-STYHKCG7.js} +20 -14
- package/dist/{chunk-55Z3DJ7G.js → chunk-TGWEH2BC.js} +10 -11
- package/dist/{chunk-TYUNDOX2.js → chunk-UKMRZDWM.js} +90 -41
- package/dist/{chunk-5UTTLO4D.js → chunk-UVN6AKIO.js} +89 -49
- package/dist/{chunk-574HZVLE.js → chunk-VRGRAQDG.js} +2 -2
- package/dist/{chunk-JQBTYHUR.js → chunk-WR6QCJJO.js} +53 -15
- package/dist/{chunk-RBPOAAIZ.js → chunk-XKIEDGQF.js} +22 -18
- package/dist/{chunk-XIZ6B6IS.js → chunk-XSUQDB6R.js} +541 -299
- package/dist/cli/dev.js +2 -2
- package/dist/cli/index.js +2 -2
- package/dist/{config-6T4EHAP2.js → config-5CONAOL7.js} +7 -7
- package/dist/{events-LKEZ3YCW.js → events-5RIXWI5Y.js} +6 -6
- package/dist/{folding-JN2WT44N.js → folding-JNOUTI5Z.js} +2 -2
- package/dist/{inspect-proxy-Y4MRAVB7.js → inspect-proxy-Y75AXMRX.js} +3 -3
- package/dist/{manager-HM2J5VMW.js → manager-W7N3XQ4Q.js} +3 -3
- package/dist/orchestrator-TW5II347.js +43 -0
- package/dist/package.json +19 -3
- package/dist/{paths-ZRI56O63.js → paths-X46PPOI2.js} +2 -2
- package/dist/{processor-23O4HPSS.js → processor-MZ3QIUED.js} +15 -11
- package/dist/{project-creator-LASKNQPA.js → project-creator-VD7MLOWE.js} +8 -5
- package/dist/{projects-HEUOWNSR.js → projects-XLMSDFTQ.js} +4 -4
- package/dist/{protocol-5AWNGFLH.js → protocol-4CTV7OZC.js} +3 -3
- package/dist/{protocol-DRBnujwe.d.ts → protocol-4xbfAlGO.d.ts} +3 -0
- package/dist/{provider-AKN355YH.js → provider-ESEBV3LL.js} +15 -11
- package/dist/{pwa-GHQCMCIU.js → pwa-76XP2DY2.js} +2 -2
- package/dist/{runtime-config-ZCK74XKM.js → runtime-config-CBJJJGBD.js} +2 -2
- package/dist/{serve-TW63YCNQ.js → serve-FTTLGRAO.js} +29 -27
- package/dist/server/index.d.ts +6 -1
- package/dist/server/index.js +22 -22
- package/dist/server/public/__inspect__.js +163 -143
- package/dist/{service-74Z7JK2J.js → service-D6LC3CAM.js} +3 -2
- package/dist/{settings-NI4ITGV6.js → settings-TQNQB56H.js} +4 -4
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/{store-2IF3ZSLD.js → store-OQ45KONN.js} +2 -2
- package/dist/{tools-RUAY6EVI.js → tools-QJ5K5IJP.js} +18 -18
- package/dist/{vision-fallback-AXH3BGJC.js → vision-fallback-ED27LH6C.js} +3 -3
- package/dist/web/__inspect__.js +178 -155
- package/dist/web/assets/{index-CWdKiSP8.js → index-FjLp1t6r.js} +62 -62
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +19 -3
- package/dist/auto-compaction-OW4P2QWQ.js +0 -27
- package/dist/orchestrator-QP4O7MUM.js +0 -43
|
@@ -99,7 +99,18 @@ function applyEvents(initialMessages, events, options) {
|
|
|
99
99
|
const msg = messages.get(data.messageId);
|
|
100
100
|
if (msg) {
|
|
101
101
|
const preparing = msg.preparingToolCalls ?? [];
|
|
102
|
-
preparing.
|
|
102
|
+
const existingIndex = preparing.findIndex((p) => p.index === data.index);
|
|
103
|
+
const entry = {
|
|
104
|
+
index: data.index,
|
|
105
|
+
name: data.name,
|
|
106
|
+
...data.arguments ? { arguments: data.arguments } : {}
|
|
107
|
+
};
|
|
108
|
+
if (existingIndex >= 0) {
|
|
109
|
+
preparing[existingIndex] = entry;
|
|
110
|
+
} else {
|
|
111
|
+
preparing.push(entry);
|
|
112
|
+
}
|
|
113
|
+
;
|
|
103
114
|
msg.preparingToolCalls = preparing;
|
|
104
115
|
}
|
|
105
116
|
break;
|
|
@@ -184,7 +195,10 @@ function deepCloneMessage(msg) {
|
|
|
184
195
|
const cloned = { ...msg };
|
|
185
196
|
const obj = cloned;
|
|
186
197
|
if (obj["toolCalls"]) {
|
|
187
|
-
obj["toolCalls"] = obj["toolCalls"].map((tc) => ({
|
|
198
|
+
obj["toolCalls"] = obj["toolCalls"].map((tc) => ({
|
|
199
|
+
...tc,
|
|
200
|
+
...tc.result ? { result: { ...tc.result } } : {}
|
|
201
|
+
}));
|
|
188
202
|
}
|
|
189
203
|
if (obj["segments"]) {
|
|
190
204
|
obj["segments"] = [...obj["segments"]];
|
|
@@ -274,6 +288,9 @@ function appendSnapshotMessageContext(result, message) {
|
|
|
274
288
|
role: message.role,
|
|
275
289
|
content: message.content
|
|
276
290
|
};
|
|
291
|
+
if (message.thinkingContent) {
|
|
292
|
+
contextMsg.thinkingContent = message.thinkingContent;
|
|
293
|
+
}
|
|
277
294
|
if (message.toolCalls && message.toolCalls.length > 0) {
|
|
278
295
|
contextMsg.toolCalls = message.toolCalls.map((toolCall) => ({
|
|
279
296
|
id: toolCall.id,
|
|
@@ -294,9 +311,11 @@ function appendSnapshotMessageContext(result, message) {
|
|
|
294
311
|
}
|
|
295
312
|
result.push({
|
|
296
313
|
role: "tool",
|
|
297
|
-
content: stripAnsi(
|
|
314
|
+
content: stripAnsi(
|
|
315
|
+
toolCall.result.success ? toolCall.result.output ?? "Success" : toolCall.result.output ? `${toolCall.result.output}
|
|
298
316
|
|
|
299
|
-
Error: ${toolCall.result.error}` : `Error: ${toolCall.result.error}`
|
|
317
|
+
Error: ${toolCall.result.error}` : `Error: ${toolCall.result.error}`
|
|
318
|
+
),
|
|
300
319
|
toolCallId: toolCall.id
|
|
301
320
|
});
|
|
302
321
|
}
|
|
@@ -308,7 +327,9 @@ function getTimestamp(event) {
|
|
|
308
327
|
return event.timestamp ?? Date.now();
|
|
309
328
|
}
|
|
310
329
|
function applyTurnEventsToSnapshotMessages(initialMessages, events) {
|
|
311
|
-
const messages = applyEvents(initialMessages, events, {
|
|
330
|
+
const messages = applyEvents(initialMessages, events, {
|
|
331
|
+
timestampAsNumber: true
|
|
332
|
+
});
|
|
312
333
|
return messages.map((msg) => ({ ...msg, isStreaming: msg.isStreaming ?? true }));
|
|
313
334
|
}
|
|
314
335
|
function buildMessagesFromStoredEvents(events) {
|
|
@@ -341,6 +362,14 @@ function buildContextMessagesFromStoredEvents(events, windowId, options) {
|
|
|
341
362
|
}
|
|
342
363
|
break;
|
|
343
364
|
}
|
|
365
|
+
case "message.thinking": {
|
|
366
|
+
const data = event.data;
|
|
367
|
+
const msg = messageMap.get(data.messageId);
|
|
368
|
+
if (msg) {
|
|
369
|
+
msg.thinkingContent = (msg.thinkingContent ?? "") + data.content;
|
|
370
|
+
}
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
344
373
|
case "message.delta": {
|
|
345
374
|
const data = event.data;
|
|
346
375
|
const msg = messageMap.get(data.messageId);
|
|
@@ -365,19 +394,23 @@ function buildContextMessagesFromStoredEvents(events, windowId, options) {
|
|
|
365
394
|
const msg = {
|
|
366
395
|
id: `tool-${data.toolCallId}`,
|
|
367
396
|
role: "tool",
|
|
368
|
-
content: stripAnsi(
|
|
397
|
+
content: stripAnsi(
|
|
398
|
+
data.result.success ? data.result.output ?? "Success" : data.result.output ? `${data.result.output}
|
|
369
399
|
|
|
370
|
-
Error: ${data.result.error}` : `Error: ${data.result.error}`
|
|
400
|
+
Error: ${data.result.error}` : `Error: ${data.result.error}`
|
|
401
|
+
),
|
|
371
402
|
toolCallId: data.toolCallId
|
|
372
403
|
};
|
|
373
404
|
if (imageMeta?.dataUrl && imageMeta?.mimeType?.startsWith("image/")) {
|
|
374
|
-
msg.attachments = [
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
405
|
+
msg.attachments = [
|
|
406
|
+
{
|
|
407
|
+
id: crypto.randomUUID(),
|
|
408
|
+
filename: imageMeta.path ?? "image",
|
|
409
|
+
mimeType: imageMeta.mimeType,
|
|
410
|
+
size: imageMeta.size ?? 0,
|
|
411
|
+
data: imageMeta.dataUrl
|
|
412
|
+
}
|
|
413
|
+
];
|
|
381
414
|
}
|
|
382
415
|
messages.push(msg);
|
|
383
416
|
}
|
|
@@ -401,10 +434,7 @@ function buildContextMessagesFromEventHistory(events, windowId, options) {
|
|
|
401
434
|
return result;
|
|
402
435
|
}, []);
|
|
403
436
|
const laterEvents = events.filter((event) => event.seq > snapshotEvent.seq);
|
|
404
|
-
return [
|
|
405
|
-
...snapshotMessages,
|
|
406
|
-
...buildContextMessagesFromStoredEvents(laterEvents, windowId, options)
|
|
407
|
-
];
|
|
437
|
+
return [...snapshotMessages, ...buildContextMessagesFromStoredEvents(laterEvents, windowId, options)];
|
|
408
438
|
}
|
|
409
439
|
function foldTurnEventsToSnapshotMessages(events) {
|
|
410
440
|
return applyTurnEventsToSnapshotMessages([], events);
|
|
@@ -423,9 +453,7 @@ function foldCriteria(events) {
|
|
|
423
453
|
}
|
|
424
454
|
case "criterion.updated": {
|
|
425
455
|
const data = event.data;
|
|
426
|
-
criteria = criteria.map(
|
|
427
|
-
(c) => c.id === data.criterionId ? { ...c, status: data.status } : c
|
|
428
|
-
);
|
|
456
|
+
criteria = criteria.map((c) => c.id === data.criterionId ? { ...c, status: data.status } : c);
|
|
429
457
|
break;
|
|
430
458
|
}
|
|
431
459
|
}
|
|
@@ -590,7 +618,10 @@ function foldSessionState(events, initialWindowId, maxTokens, initialMessages) {
|
|
|
590
618
|
if (event.type === "turn.snapshot") {
|
|
591
619
|
const snapshotData = event.data;
|
|
592
620
|
if (snapshotData.lastModeWithReminder) {
|
|
593
|
-
snapshotReminderMode = {
|
|
621
|
+
snapshotReminderMode = {
|
|
622
|
+
seq: event.seq,
|
|
623
|
+
mode: snapshotData.lastModeWithReminder
|
|
624
|
+
};
|
|
594
625
|
}
|
|
595
626
|
}
|
|
596
627
|
}
|
|
@@ -604,12 +635,12 @@ function foldSessionState(events, initialWindowId, maxTokens, initialMessages) {
|
|
|
604
635
|
}
|
|
605
636
|
let sessionInit;
|
|
606
637
|
let sessionTitle;
|
|
607
|
-
|
|
608
|
-
|
|
638
|
+
const visionFallbacks = [];
|
|
639
|
+
const formatRetries = [];
|
|
609
640
|
let pendingUserInput;
|
|
610
641
|
let taskStats;
|
|
611
|
-
|
|
612
|
-
|
|
642
|
+
const messageStats = [];
|
|
643
|
+
const contextWindows = [];
|
|
613
644
|
for (const event of events) {
|
|
614
645
|
switch (event.type) {
|
|
615
646
|
case "session.initialized": {
|
|
@@ -639,7 +670,9 @@ function foldSessionState(events, initialWindowId, maxTokens, initialMessages) {
|
|
|
639
670
|
}
|
|
640
671
|
case "vision_fallback.done": {
|
|
641
672
|
const data = event.data;
|
|
642
|
-
const existing = visionFallbacks.find(
|
|
673
|
+
const existing = visionFallbacks.find(
|
|
674
|
+
(v) => v.messageId === data.messageId && v.attachmentId === data.attachmentId
|
|
675
|
+
);
|
|
643
676
|
if (existing) {
|
|
644
677
|
existing.description = data.description;
|
|
645
678
|
}
|
|
@@ -807,4 +840,4 @@ export {
|
|
|
807
840
|
getMessagesForWindow,
|
|
808
841
|
buildContextMessagesFromMessages
|
|
809
842
|
};
|
|
810
|
-
//# sourceMappingURL=chunk-
|
|
843
|
+
//# sourceMappingURL=chunk-BBC46FN4.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
logger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-K44MW7JJ.js";
|
|
4
4
|
|
|
5
5
|
// src/server/llm/vision-fallback.ts
|
|
6
6
|
var DEFAULT_CONFIG = {
|
|
@@ -29,8 +29,8 @@ function isVisionFallbackEnabled() {
|
|
|
29
29
|
async function ensureVisionFallbackConfigLoaded() {
|
|
30
30
|
if (configLoaded) return;
|
|
31
31
|
try {
|
|
32
|
-
const { loadGlobalConfig, getVisionFallback } = await import("./config-
|
|
33
|
-
const { getRuntimeConfig } = await import("./runtime-config-
|
|
32
|
+
const { loadGlobalConfig, getVisionFallback } = await import("./config-5CONAOL7.js");
|
|
33
|
+
const { getRuntimeConfig } = await import("./runtime-config-CBJJJGBD.js");
|
|
34
34
|
const runtimeConfig = getRuntimeConfig();
|
|
35
35
|
const mode = runtimeConfig.mode ?? "production";
|
|
36
36
|
const globalConfig = await loadGlobalConfig(mode);
|
|
@@ -44,7 +44,9 @@ async function ensureVisionFallbackConfigLoaded() {
|
|
|
44
44
|
configLoaded = true;
|
|
45
45
|
logger.debug("Vision fallback config loaded from global config", { config });
|
|
46
46
|
} catch (error) {
|
|
47
|
-
logger.warn("Failed to load vision fallback config from global config", {
|
|
47
|
+
logger.warn("Failed to load vision fallback config from global config", {
|
|
48
|
+
error: error instanceof Error ? error.message : String(error)
|
|
49
|
+
});
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
var IMAGE_PROMPT = `Describe this image in detail. Focus on:
|
|
@@ -135,4 +137,4 @@ export {
|
|
|
135
137
|
describeImage,
|
|
136
138
|
describeImageFromDataUrl
|
|
137
139
|
};
|
|
138
|
-
//# sourceMappingURL=chunk-
|
|
140
|
+
//# sourceMappingURL=chunk-BSTVRSV6.js.map
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDatabase
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KIOUKC3Z.js";
|
|
4
4
|
|
|
5
5
|
// src/server/db/projects.ts
|
|
6
6
|
function createProject(name, workdir) {
|
|
7
7
|
const db = getDatabase();
|
|
8
8
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
9
9
|
const id = crypto.randomUUID();
|
|
10
|
-
db.prepare(
|
|
10
|
+
db.prepare(
|
|
11
|
+
`
|
|
11
12
|
INSERT INTO projects (id, name, workdir, created_at, updated_at)
|
|
12
13
|
VALUES (?, ?, ?, ?, ?)
|
|
13
|
-
`
|
|
14
|
+
`
|
|
15
|
+
).run(id, name, workdir, now, now);
|
|
14
16
|
return {
|
|
15
17
|
id,
|
|
16
18
|
name,
|
|
@@ -21,9 +23,11 @@ function createProject(name, workdir) {
|
|
|
21
23
|
}
|
|
22
24
|
function getProject(id) {
|
|
23
25
|
const db = getDatabase();
|
|
24
|
-
const row = db.prepare(
|
|
26
|
+
const row = db.prepare(
|
|
27
|
+
`
|
|
25
28
|
SELECT * FROM projects WHERE id = ?
|
|
26
|
-
`
|
|
29
|
+
`
|
|
30
|
+
).get(id);
|
|
27
31
|
if (!row) {
|
|
28
32
|
return null;
|
|
29
33
|
}
|
|
@@ -31,9 +35,11 @@ function getProject(id) {
|
|
|
31
35
|
}
|
|
32
36
|
function getProjectByWorkdir(workdir) {
|
|
33
37
|
const db = getDatabase();
|
|
34
|
-
const row = db.prepare(
|
|
38
|
+
const row = db.prepare(
|
|
39
|
+
`
|
|
35
40
|
SELECT * FROM projects WHERE workdir = ?
|
|
36
|
-
`
|
|
41
|
+
`
|
|
42
|
+
).get(workdir);
|
|
37
43
|
if (!row) {
|
|
38
44
|
return null;
|
|
39
45
|
}
|
|
@@ -41,9 +47,11 @@ function getProjectByWorkdir(workdir) {
|
|
|
41
47
|
}
|
|
42
48
|
function listProjects() {
|
|
43
49
|
const db = getDatabase();
|
|
44
|
-
const rows = db.prepare(
|
|
50
|
+
const rows = db.prepare(
|
|
51
|
+
`
|
|
45
52
|
SELECT * FROM projects ORDER BY updated_at DESC
|
|
46
|
-
`
|
|
53
|
+
`
|
|
54
|
+
).all();
|
|
47
55
|
return rows.map(rowToProject);
|
|
48
56
|
}
|
|
49
57
|
function updateProject(id, updates) {
|
|
@@ -60,9 +68,11 @@ function updateProject(id, updates) {
|
|
|
60
68
|
values.push(updates.customInstructions);
|
|
61
69
|
}
|
|
62
70
|
values.push(id);
|
|
63
|
-
const result = db.prepare(
|
|
71
|
+
const result = db.prepare(
|
|
72
|
+
`
|
|
64
73
|
UPDATE projects SET ${sets.join(", ")} WHERE id = ?
|
|
65
|
-
`
|
|
74
|
+
`
|
|
75
|
+
).run(...values);
|
|
66
76
|
if (result.changes === 0) {
|
|
67
77
|
return null;
|
|
68
78
|
}
|
|
@@ -91,4 +101,4 @@ export {
|
|
|
91
101
|
updateProject,
|
|
92
102
|
deleteProject
|
|
93
103
|
};
|
|
94
|
-
//# sourceMappingURL=chunk-
|
|
104
|
+
//# sourceMappingURL=chunk-CMQCO27Y.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
describeImageFromDataUrl
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BSTVRSV6.js";
|
|
4
4
|
import {
|
|
5
5
|
logger
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-K44MW7JJ.js";
|
|
7
7
|
|
|
8
8
|
// src/server/llm/backend.ts
|
|
9
9
|
var BACKEND_CAPABILITIES = {
|
|
@@ -403,6 +403,19 @@ function convertToolCalls(toolCalls) {
|
|
|
403
403
|
}
|
|
404
404
|
}));
|
|
405
405
|
}
|
|
406
|
+
function buildAssistantMessage(msg) {
|
|
407
|
+
const result = {
|
|
408
|
+
role: "assistant",
|
|
409
|
+
content: msg.content || null
|
|
410
|
+
};
|
|
411
|
+
if (msg.toolCalls?.length) {
|
|
412
|
+
result["tool_calls"] = convertToolCalls(msg.toolCalls);
|
|
413
|
+
}
|
|
414
|
+
if (msg.thinkingContent) {
|
|
415
|
+
result["reasoning_content"] = msg.thinkingContent;
|
|
416
|
+
}
|
|
417
|
+
return result;
|
|
418
|
+
}
|
|
406
419
|
function convertAttachmentSync(attachment, modelSupportsVision) {
|
|
407
420
|
if (modelSupportsVision) {
|
|
408
421
|
return {
|
|
@@ -423,7 +436,11 @@ function createAttachmentForConversion(data, filename, id) {
|
|
|
423
436
|
};
|
|
424
437
|
}
|
|
425
438
|
async function convertAttachmentWithFallback(attachment, options) {
|
|
426
|
-
logger.debug("[VisionFallback] convertAttachmentWithFallback called", {
|
|
439
|
+
logger.debug("[VisionFallback] convertAttachmentWithFallback called", {
|
|
440
|
+
filename: attachment.filename,
|
|
441
|
+
id: attachment.id,
|
|
442
|
+
hasCallbacks: !!options.onVisionFallbackStart
|
|
443
|
+
});
|
|
427
444
|
if (options.modelSupportsVision) {
|
|
428
445
|
logger.debug("[VisionFallback] Model supports vision - passing image directly");
|
|
429
446
|
return {
|
|
@@ -485,12 +502,8 @@ function convertMessages(messages, options) {
|
|
|
485
502
|
tool_call_id: msg.toolCallId
|
|
486
503
|
};
|
|
487
504
|
}
|
|
488
|
-
if (msg.role === "assistant"
|
|
489
|
-
return
|
|
490
|
-
role: "assistant",
|
|
491
|
-
content: msg.content || null,
|
|
492
|
-
tool_calls: convertToolCalls(msg.toolCalls)
|
|
493
|
-
};
|
|
505
|
+
if (msg.role === "assistant") {
|
|
506
|
+
return buildAssistantMessage(msg);
|
|
494
507
|
}
|
|
495
508
|
if (msg.role === "user" && msg.attachments && msg.attachments.length > 0) {
|
|
496
509
|
const content = buildAttachmentContent(msg.content, msg.attachments, options.modelSupportsVision);
|
|
@@ -529,12 +542,8 @@ async function convertMessagesWithFallback(messages, options) {
|
|
|
529
542
|
}
|
|
530
543
|
continue;
|
|
531
544
|
}
|
|
532
|
-
if (msg.role === "assistant"
|
|
533
|
-
converted.push(
|
|
534
|
-
role: "assistant",
|
|
535
|
-
content: msg.content || null,
|
|
536
|
-
tool_calls: convertToolCalls(msg.toolCalls)
|
|
537
|
-
});
|
|
545
|
+
if (msg.role === "assistant") {
|
|
546
|
+
converted.push(buildAssistantMessage(msg));
|
|
538
547
|
continue;
|
|
539
548
|
}
|
|
540
549
|
if (msg.role === "user" && msg.attachments && msg.attachments.length > 0) {
|
|
@@ -614,8 +623,27 @@ async function buildChatCompletionCreateParams(model, request, profile, capabili
|
|
|
614
623
|
return { params, modelParams };
|
|
615
624
|
}
|
|
616
625
|
async function buildCreateParamsFromInput(input, isStreaming) {
|
|
617
|
-
const {
|
|
618
|
-
|
|
626
|
+
const {
|
|
627
|
+
model,
|
|
628
|
+
request,
|
|
629
|
+
profile,
|
|
630
|
+
capabilities,
|
|
631
|
+
disableThinking,
|
|
632
|
+
visionFallbackEnabled = false,
|
|
633
|
+
onVisionFallbackStart,
|
|
634
|
+
onVisionFallbackDone
|
|
635
|
+
} = input;
|
|
636
|
+
return buildChatCompletionCreateParams(
|
|
637
|
+
model,
|
|
638
|
+
request,
|
|
639
|
+
profile,
|
|
640
|
+
capabilities,
|
|
641
|
+
!!disableThinking,
|
|
642
|
+
visionFallbackEnabled,
|
|
643
|
+
isStreaming,
|
|
644
|
+
onVisionFallbackStart,
|
|
645
|
+
onVisionFallbackDone
|
|
646
|
+
);
|
|
619
647
|
}
|
|
620
648
|
var buildNonStreamingCreateParams = (input) => buildCreateParamsFromInput(input, false);
|
|
621
649
|
var buildStreamingCreateParams = (input) => buildCreateParamsFromInput(input, true);
|
|
@@ -773,4 +801,4 @@ export {
|
|
|
773
801
|
extractThinking,
|
|
774
802
|
streamWithSegments
|
|
775
803
|
};
|
|
776
|
-
//# sourceMappingURL=chunk-
|
|
804
|
+
//# sourceMappingURL=chunk-CUDAT6SS.js.map
|