openfox 2.0.0-beta.0 → 2.0.0-beta.10
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/code-reviewer.agent.md +2 -1
- package/dist/{chat-handler-IVIWOR3D.js → chat-handler-6COBLIDR.js} +14 -27
- package/dist/{chunk-CEZNMLOO.js → chunk-7TTEGAO6.js} +12 -13
- package/dist/{chunk-JZQ644DE.js → chunk-BE2S4NJX.js} +6 -6
- package/dist/{chunk-FQLK5GL5.js → chunk-BVHFMAVN.js} +1 -1
- package/dist/{chunk-UFY4I643.js → chunk-C75I2KZM.js} +135 -147
- package/dist/{chunk-QFSSKIQ3.js → chunk-CDDMHSZF.js} +4 -4
- package/dist/{chunk-RF2JGDSS.js → chunk-DMH6JVPF.js} +13 -10
- package/dist/{chunk-NNEHZT3V.js → chunk-EZUR7OEP.js} +11 -3
- package/dist/{chunk-CTQ2FS4K.js → chunk-G4SACK4E.js} +221 -104
- package/dist/{chunk-ALH4KM2Y.js → chunk-LR5R7EEE.js} +2962 -3249
- package/dist/{chunk-XKR3HCAL.js → chunk-NPHYEUYE.js} +128 -34
- package/dist/{chunk-PSJIT5LZ.js → chunk-RFNEDBVO.js} +4 -4
- package/dist/chunk-RI6GAMNP.js +13 -0
- package/dist/{chunk-HHAJ3QF6.js → chunk-UKTPL5ZG.js} +16 -28
- package/dist/{chunk-HGAMIPFO.js → chunk-VIIRNJDT.js} +39 -178
- package/dist/{chunk-NONI4CRP.js → chunk-XJEOP6XU.js} +5 -32
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/compactor-TDNRM3A7.js +9 -0
- package/dist/{config-YU7NYZYG.js → config-TDVA7MQN.js} +9 -8
- package/dist/{events-OHJWCI3S.js → events-PQ3KTI5H.js} +8 -7
- package/dist/{folding-U6UHQAS5.js → folding-CXORTBAU.js} +2 -2
- package/dist/{orchestrator-7ZXM4J22.js → orchestrator-ZNGTMZ7W.js} +18 -22
- package/dist/package.json +1 -1
- package/dist/{processor-TKBJLQ2N.js → processor-WMAU4C2N.js} +8 -9
- package/dist/{protocol-BQ12Aw5J.d.ts → protocol-CDOV1pyc.d.ts} +13 -38
- package/dist/{protocol-K62EPEGS.js → protocol-CN24IKQN.js} +3 -5
- package/dist/{provider-HTJEB3ON.js → provider-BGH4MBLH.js} +25 -10
- package/dist/{serve-FGPHMDOC.js → serve-7VMTNIXT.js} +25 -26
- package/dist/server/index.d.ts +1 -6
- package/dist/server/index.js +15 -16
- package/dist/{settings-VRAOAPLA.js → settings-6XX56F3F.js} +2 -2
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.js +1 -1
- package/dist/{tools-Z7X4HXZN.js → tools-CQGEU3JK.js} +11 -13
- package/dist/web/assets/index-BF6jgTAb.js +299 -0
- package/dist/web/assets/{index-BY8EbT5Z.css → index-CSOB8dwI.css} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/dist/workflow-defaults/default.workflow.json +18 -4
- package/package.json +1 -1
- package/dist/auto-compaction-UIWTO3H5.js +0 -27
- package/dist/chunk-CGZHLM3K.js +0 -70
- package/dist/chunk-SZKEGZIB.js +0 -140
- package/dist/runtime-config-NPSPMRDA.js +0 -9
- package/dist/vision-fallback-3MIZZ6NQ.js +0 -22
- package/dist/web/assets/index-BDezz42a.js +0 -299
|
@@ -1,10 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
describeImageFromDataUrl
|
|
3
|
-
} from "./chunk-SZKEGZIB.js";
|
|
4
1
|
import {
|
|
5
2
|
logger
|
|
6
3
|
} from "./chunk-K44MW7JJ.js";
|
|
7
4
|
|
|
5
|
+
// src/server/llm/url-utils.ts
|
|
6
|
+
var VERSION_PREFIX_REGEX = /\/v\d+(\/|$)/;
|
|
7
|
+
function hasVersionPrefix(url) {
|
|
8
|
+
return VERSION_PREFIX_REGEX.test(url);
|
|
9
|
+
}
|
|
10
|
+
function ensureVersionPrefix(url, defaultVersion = "/v1") {
|
|
11
|
+
if (hasVersionPrefix(url)) return url;
|
|
12
|
+
return `${url.replace(/\/+$/, "")}${defaultVersion}`;
|
|
13
|
+
}
|
|
14
|
+
function stripVersionPrefix(url) {
|
|
15
|
+
return url.replace(/\/v\d+\/?$/, "");
|
|
16
|
+
}
|
|
17
|
+
function buildModelsUrl(baseUrl) {
|
|
18
|
+
return `${ensureVersionPrefix(baseUrl)}/models`;
|
|
19
|
+
}
|
|
20
|
+
|
|
8
21
|
// src/server/llm/backend.ts
|
|
9
22
|
var BACKEND_CAPABILITIES = {
|
|
10
23
|
vllm: {
|
|
@@ -51,7 +64,7 @@ async function detectBackend(baseUrl, explicitBackend, silent = false) {
|
|
|
51
64
|
}
|
|
52
65
|
return explicitBackend;
|
|
53
66
|
}
|
|
54
|
-
const probeUrl = baseUrl
|
|
67
|
+
const probeUrl = stripVersionPrefix(baseUrl);
|
|
55
68
|
try {
|
|
56
69
|
if (await probeOllama(probeUrl)) {
|
|
57
70
|
if (silent) {
|
|
@@ -140,7 +153,7 @@ async function probeSGLang(baseUrl) {
|
|
|
140
153
|
}
|
|
141
154
|
async function probeOpenAI(baseUrl) {
|
|
142
155
|
try {
|
|
143
|
-
const url = baseUrl
|
|
156
|
+
const url = ensureVersionPrefix(baseUrl);
|
|
144
157
|
const response = await fetch(`${url}/models`, {
|
|
145
158
|
signal: AbortSignal.timeout(5e3)
|
|
146
159
|
});
|
|
@@ -362,6 +375,9 @@ function getModelProfile(modelName) {
|
|
|
362
375
|
}
|
|
363
376
|
return DEFAULT_PROFILE;
|
|
364
377
|
}
|
|
378
|
+
function modelSupportsVision(modelName) {
|
|
379
|
+
return getModelProfile(modelName).supportsVision;
|
|
380
|
+
}
|
|
365
381
|
|
|
366
382
|
// src/server/llm/client-pure.ts
|
|
367
383
|
function buildModelParams(params) {
|
|
@@ -372,27 +388,16 @@ function buildModelParams(params) {
|
|
|
372
388
|
...params.maxTokens !== void 0 && { maxTokens: params.maxTokens }
|
|
373
389
|
};
|
|
374
390
|
}
|
|
375
|
-
function buildAttachmentContent(msgContent, attachments,
|
|
391
|
+
function buildAttachmentContent(msgContent, attachments, modelSupportsVision2) {
|
|
376
392
|
const content = [];
|
|
377
393
|
if (msgContent?.trim()) {
|
|
378
394
|
content.push({ type: "text", text: msgContent });
|
|
379
395
|
}
|
|
380
396
|
for (const attachment of attachments) {
|
|
381
|
-
content.push(convertAttachmentSync(attachment,
|
|
397
|
+
content.push(convertAttachmentSync(attachment, modelSupportsVision2));
|
|
382
398
|
}
|
|
383
399
|
return content;
|
|
384
400
|
}
|
|
385
|
-
async function convertMessagesWithOptions(messages, profile, visionFallbackEnabled, userVisionOverride, signal, onVisionFallbackStart, onVisionFallbackDone) {
|
|
386
|
-
const modelSupportsVision = userVisionOverride ?? profile.supportsVision ?? false;
|
|
387
|
-
const options = {
|
|
388
|
-
modelSupportsVision,
|
|
389
|
-
visionFallbackEnabled,
|
|
390
|
-
signal,
|
|
391
|
-
onVisionFallbackStart,
|
|
392
|
-
onVisionFallbackDone
|
|
393
|
-
};
|
|
394
|
-
return needsVisionFallback(messages, modelSupportsVision, visionFallbackEnabled) ? await convertMessagesWithFallback(messages, options) : convertMessages(messages, { modelSupportsVision, visionFallbackEnabled: false });
|
|
395
|
-
}
|
|
396
401
|
function convertToolCalls(toolCalls) {
|
|
397
402
|
return toolCalls.map((toolCall) => ({
|
|
398
403
|
id: toolCall.id,
|
|
@@ -416,8 +421,8 @@ function buildAssistantMessage(msg) {
|
|
|
416
421
|
}
|
|
417
422
|
return result;
|
|
418
423
|
}
|
|
419
|
-
function convertAttachmentSync(attachment,
|
|
420
|
-
if (
|
|
424
|
+
function convertAttachmentSync(attachment, modelSupportsVision2) {
|
|
425
|
+
if (modelSupportsVision2) {
|
|
421
426
|
return {
|
|
422
427
|
type: "image_url",
|
|
423
428
|
image_url: { url: attachment.data }
|
|
@@ -428,68 +433,14 @@ function convertAttachmentSync(attachment, modelSupportsVision) {
|
|
|
428
433
|
text: `[Image: ${attachment.filename || "image"}] (vision not supported, cannot describe)`
|
|
429
434
|
};
|
|
430
435
|
}
|
|
431
|
-
function
|
|
432
|
-
return {
|
|
433
|
-
data,
|
|
434
|
-
...filename !== void 0 && { filename },
|
|
435
|
-
...id !== void 0 && { id }
|
|
436
|
-
};
|
|
437
|
-
}
|
|
438
|
-
async function convertAttachmentWithFallback(attachment, options) {
|
|
439
|
-
logger.debug("[VisionFallback] convertAttachmentWithFallback called", {
|
|
440
|
-
filename: attachment.filename,
|
|
441
|
-
id: attachment.id,
|
|
442
|
-
hasCallbacks: !!options.onVisionFallbackStart
|
|
443
|
-
});
|
|
444
|
-
if (options.modelSupportsVision) {
|
|
445
|
-
logger.debug("[VisionFallback] Model supports vision - passing image directly");
|
|
446
|
-
return {
|
|
447
|
-
type: "image_url",
|
|
448
|
-
image_url: { url: attachment.data }
|
|
449
|
-
};
|
|
450
|
-
}
|
|
451
|
-
if (!options.visionFallbackEnabled) {
|
|
452
|
-
logger.debug("[VisionFallback] Fallback disabled - returning placeholder");
|
|
453
|
-
return {
|
|
454
|
-
type: "text",
|
|
455
|
-
text: `[Image: ${attachment.filename || "image"}] (vision not supported)`
|
|
456
|
-
};
|
|
457
|
-
}
|
|
458
|
-
const attachmentId = attachment.id ?? crypto.randomUUID();
|
|
459
|
-
const filename = attachment.filename;
|
|
460
|
-
logger.debug("[VisionFallback] Starting delegation for:", { attachmentId, filename });
|
|
461
|
-
options.onVisionFallbackStart?.(attachmentId, filename);
|
|
462
|
-
const context = filename ? `File: ${filename}` : void 0;
|
|
463
|
-
const description = await describeImageFromDataUrl(attachment.data, { context, signal: options.signal });
|
|
464
|
-
logger.debug("[VisionFallback] Delegation complete:", { attachmentId, descriptionLength: description.length });
|
|
465
|
-
options.onVisionFallbackDone?.(attachmentId, description);
|
|
466
|
-
return {
|
|
467
|
-
type: "text",
|
|
468
|
-
text: `[Image: ${attachment.filename || "image"}] ${description}`
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
async function buildAttachmentContentWithFallback(msgContent, attachments, options) {
|
|
472
|
-
const content = [];
|
|
473
|
-
if (msgContent?.trim()) {
|
|
474
|
-
content.push({ type: "text", text: msgContent });
|
|
475
|
-
}
|
|
476
|
-
for (const attachment of attachments) {
|
|
477
|
-
const convertedContent = await convertAttachmentWithFallback(
|
|
478
|
-
createAttachmentForConversion(attachment.data, attachment.filename, attachment.id),
|
|
479
|
-
options
|
|
480
|
-
);
|
|
481
|
-
content.push(convertedContent);
|
|
482
|
-
}
|
|
483
|
-
return content;
|
|
484
|
-
}
|
|
485
|
-
function convertMessages(messages, options) {
|
|
436
|
+
function convertMessages(messages, modelSupportsVision2) {
|
|
486
437
|
const filtered = messages.filter((msg) => {
|
|
487
438
|
return !(msg.role === "assistant" && !msg.content?.trim() && (!msg.toolCalls || msg.toolCalls.length === 0));
|
|
488
439
|
});
|
|
489
440
|
return filtered.map((msg) => {
|
|
490
441
|
if (msg.role === "tool") {
|
|
491
442
|
if (msg.attachments && msg.attachments.length > 0) {
|
|
492
|
-
const content = buildAttachmentContent(msg.content, msg.attachments,
|
|
443
|
+
const content = buildAttachmentContent(msg.content, msg.attachments, modelSupportsVision2);
|
|
493
444
|
return {
|
|
494
445
|
role: "tool",
|
|
495
446
|
content,
|
|
@@ -506,7 +457,7 @@ function convertMessages(messages, options) {
|
|
|
506
457
|
return buildAssistantMessage(msg);
|
|
507
458
|
}
|
|
508
459
|
if (msg.role === "user" && msg.attachments && msg.attachments.length > 0) {
|
|
509
|
-
const content = buildAttachmentContent(msg.content, msg.attachments,
|
|
460
|
+
const content = buildAttachmentContent(msg.content, msg.attachments, modelSupportsVision2);
|
|
510
461
|
return {
|
|
511
462
|
role: "user",
|
|
512
463
|
content
|
|
@@ -518,49 +469,6 @@ function convertMessages(messages, options) {
|
|
|
518
469
|
};
|
|
519
470
|
});
|
|
520
471
|
}
|
|
521
|
-
async function convertMessagesWithFallback(messages, options) {
|
|
522
|
-
logger.debug("[VisionFallback] convertMessagesWithFallback called", { messageCount: messages.length });
|
|
523
|
-
const filtered = messages.filter((msg) => {
|
|
524
|
-
return !(msg.role === "assistant" && !msg.content?.trim() && (!msg.toolCalls || msg.toolCalls.length === 0));
|
|
525
|
-
});
|
|
526
|
-
const converted = [];
|
|
527
|
-
for (const msg of filtered) {
|
|
528
|
-
if (msg.role === "tool") {
|
|
529
|
-
if (msg.attachments && msg.attachments.length > 0) {
|
|
530
|
-
const content = await buildAttachmentContentWithFallback(msg.content, msg.attachments, options);
|
|
531
|
-
converted.push({
|
|
532
|
-
role: "tool",
|
|
533
|
-
content,
|
|
534
|
-
tool_call_id: msg.toolCallId
|
|
535
|
-
});
|
|
536
|
-
} else {
|
|
537
|
-
converted.push({
|
|
538
|
-
role: "tool",
|
|
539
|
-
content: msg.content,
|
|
540
|
-
tool_call_id: msg.toolCallId
|
|
541
|
-
});
|
|
542
|
-
}
|
|
543
|
-
continue;
|
|
544
|
-
}
|
|
545
|
-
if (msg.role === "assistant") {
|
|
546
|
-
converted.push(buildAssistantMessage(msg));
|
|
547
|
-
continue;
|
|
548
|
-
}
|
|
549
|
-
if (msg.role === "user" && msg.attachments && msg.attachments.length > 0) {
|
|
550
|
-
const content = await buildAttachmentContentWithFallback(msg.content, msg.attachments, options);
|
|
551
|
-
converted.push({
|
|
552
|
-
role: "user",
|
|
553
|
-
content
|
|
554
|
-
});
|
|
555
|
-
continue;
|
|
556
|
-
}
|
|
557
|
-
converted.push({
|
|
558
|
-
role: msg.role,
|
|
559
|
-
content: msg.content
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
return converted;
|
|
563
|
-
}
|
|
564
472
|
function convertTools(tools) {
|
|
565
473
|
return tools.map((tool) => ({
|
|
566
474
|
type: "function",
|
|
@@ -571,30 +479,10 @@ function convertTools(tools) {
|
|
|
571
479
|
}
|
|
572
480
|
}));
|
|
573
481
|
}
|
|
574
|
-
function
|
|
575
|
-
const hasAttachments = messages.some(
|
|
576
|
-
(msg) => msg.attachments && msg.attachments.length > 0 || msg.role === "tool" && msg.attachments && msg.attachments.length > 0
|
|
577
|
-
);
|
|
578
|
-
const result = hasAttachments && !modelSupportsVision && visionFallbackEnabled;
|
|
579
|
-
logger.debug("[VisionFallback] needsVisionFallback check", {
|
|
580
|
-
hasAttachments,
|
|
581
|
-
modelSupportsVision,
|
|
582
|
-
visionFallbackEnabled,
|
|
583
|
-
result
|
|
584
|
-
});
|
|
585
|
-
return result;
|
|
586
|
-
}
|
|
587
|
-
async function buildChatCompletionCreateParams(model, request, profile, capabilities, disableThinking, visionFallbackEnabled, isStreaming, onVisionFallbackStart, onVisionFallbackDone) {
|
|
482
|
+
async function buildChatCompletionCreateParams(model, request, profile, capabilities, disableThinking, isStreaming) {
|
|
588
483
|
const userVisionOverride = request.modelSettings?.supportsVision;
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
profile,
|
|
592
|
-
visionFallbackEnabled,
|
|
593
|
-
userVisionOverride,
|
|
594
|
-
request.signal,
|
|
595
|
-
onVisionFallbackStart,
|
|
596
|
-
onVisionFallbackDone
|
|
597
|
-
);
|
|
484
|
+
const modelSupportsVision2 = userVisionOverride ?? profile.supportsVision ?? false;
|
|
485
|
+
const convertedMessages = convertMessages(request.messages, modelSupportsVision2);
|
|
598
486
|
const temperature = request.modelSettings?.temperature ?? request.temperature ?? profile.temperature;
|
|
599
487
|
const maxTokens = request.modelSettings?.maxTokens ?? request.maxTokens ?? profile.defaultMaxTokens;
|
|
600
488
|
const topP = request.modelSettings?.topP ?? profile.topP;
|
|
@@ -623,26 +511,14 @@ async function buildChatCompletionCreateParams(model, request, profile, capabili
|
|
|
623
511
|
return { params, modelParams };
|
|
624
512
|
}
|
|
625
513
|
async function buildCreateParamsFromInput(input, isStreaming) {
|
|
626
|
-
const {
|
|
627
|
-
model,
|
|
628
|
-
request,
|
|
629
|
-
profile,
|
|
630
|
-
capabilities,
|
|
631
|
-
disableThinking,
|
|
632
|
-
visionFallbackEnabled = false,
|
|
633
|
-
onVisionFallbackStart,
|
|
634
|
-
onVisionFallbackDone
|
|
635
|
-
} = input;
|
|
514
|
+
const { model, request, profile, capabilities, disableThinking } = input;
|
|
636
515
|
return buildChatCompletionCreateParams(
|
|
637
516
|
model,
|
|
638
517
|
request,
|
|
639
518
|
profile,
|
|
640
519
|
capabilities,
|
|
641
520
|
!!disableThinking,
|
|
642
|
-
|
|
643
|
-
isStreaming,
|
|
644
|
-
onVisionFallbackStart,
|
|
645
|
-
onVisionFallbackDone
|
|
521
|
+
isStreaming
|
|
646
522
|
);
|
|
647
523
|
}
|
|
648
524
|
var buildNonStreamingCreateParams = (input) => buildCreateParamsFromInput(input, false);
|
|
@@ -677,13 +553,7 @@ function extractThinking(content) {
|
|
|
677
553
|
}
|
|
678
554
|
|
|
679
555
|
// src/server/llm/streaming.ts
|
|
680
|
-
var XML_TOOL_PATTERNS = ["<tool_call>", "<function=", "</tool_call>", "<parameter="];
|
|
681
|
-
function hasXmlToolPattern(text) {
|
|
682
|
-
return XML_TOOL_PATTERNS.some((p) => text.includes(p));
|
|
683
|
-
}
|
|
684
556
|
async function* streamWithSegments(client, request) {
|
|
685
|
-
const xmlAbortController = new AbortController();
|
|
686
|
-
const combinedSignal = request.signal ? AbortSignal.any([request.signal, xmlAbortController.signal]) : xmlAbortController.signal;
|
|
687
557
|
let content = "";
|
|
688
558
|
let thinkingContent = "";
|
|
689
559
|
let response = null;
|
|
@@ -705,7 +575,7 @@ async function* streamWithSegments(client, request) {
|
|
|
705
575
|
currentThinkingSegment = "";
|
|
706
576
|
};
|
|
707
577
|
try {
|
|
708
|
-
for await (const event of client.stream(
|
|
578
|
+
for await (const event of client.stream(request)) {
|
|
709
579
|
switch (event.type) {
|
|
710
580
|
case "text_delta":
|
|
711
581
|
if (firstTokenTime === null) {
|
|
@@ -714,11 +584,6 @@ async function* streamWithSegments(client, request) {
|
|
|
714
584
|
flushThinking();
|
|
715
585
|
content += event.content;
|
|
716
586
|
currentTextSegment += event.content;
|
|
717
|
-
if (!request.disableXmlProtection && hasXmlToolPattern(content)) {
|
|
718
|
-
xmlAbortController.abort();
|
|
719
|
-
yield { type: "xml_tool_abort" };
|
|
720
|
-
return null;
|
|
721
|
-
}
|
|
722
587
|
yield { type: "text_delta", content: event.content };
|
|
723
588
|
break;
|
|
724
589
|
case "thinking_delta":
|
|
@@ -728,11 +593,6 @@ async function* streamWithSegments(client, request) {
|
|
|
728
593
|
flushText();
|
|
729
594
|
thinkingContent += event.content;
|
|
730
595
|
currentThinkingSegment += event.content;
|
|
731
|
-
if (!request.disableXmlProtection && hasXmlToolPattern(thinkingContent)) {
|
|
732
|
-
xmlAbortController.abort();
|
|
733
|
-
yield { type: "xml_tool_abort" };
|
|
734
|
-
return null;
|
|
735
|
-
}
|
|
736
596
|
yield { type: "thinking_delta", content: event.content };
|
|
737
597
|
break;
|
|
738
598
|
case "tool_call_delta":
|
|
@@ -756,9 +616,6 @@ async function* streamWithSegments(client, request) {
|
|
|
756
616
|
}
|
|
757
617
|
}
|
|
758
618
|
} catch (error) {
|
|
759
|
-
if (error instanceof Error && error.name === "AbortError") {
|
|
760
|
-
return null;
|
|
761
|
-
}
|
|
762
619
|
yield { type: "error", error: error instanceof Error ? error.message : "Unknown error" };
|
|
763
620
|
return null;
|
|
764
621
|
}
|
|
@@ -791,6 +648,10 @@ async function* streamWithSegments(client, request) {
|
|
|
791
648
|
|
|
792
649
|
export {
|
|
793
650
|
getModelProfile,
|
|
651
|
+
modelSupportsVision,
|
|
652
|
+
ensureVersionPrefix,
|
|
653
|
+
stripVersionPrefix,
|
|
654
|
+
buildModelsUrl,
|
|
794
655
|
getBackendCapabilities,
|
|
795
656
|
detectBackend,
|
|
796
657
|
getBackendDisplayName,
|
|
@@ -801,4 +662,4 @@ export {
|
|
|
801
662
|
extractThinking,
|
|
802
663
|
streamWithSegments
|
|
803
664
|
};
|
|
804
|
-
//# sourceMappingURL=chunk-
|
|
665
|
+
//# sourceMappingURL=chunk-VIIRNJDT.js.map
|
|
@@ -40,7 +40,6 @@ function updateMessageDone(msg, data) {
|
|
|
40
40
|
if (data.stats) msg.stats = data.stats;
|
|
41
41
|
if (data.segments) msg.segments = data.segments;
|
|
42
42
|
if (data.partial) msg.partial = true;
|
|
43
|
-
if (data.promptContext) msg.promptContext = data.promptContext;
|
|
44
43
|
if (data.tokenCount !== void 0) msg.tokenCount = data.tokenCount;
|
|
45
44
|
if ("preparingToolCalls" in msg) {
|
|
46
45
|
msg.preparingToolCalls = [];
|
|
@@ -135,9 +134,10 @@ function applyEvents(initialMessages, events, options) {
|
|
|
135
134
|
}
|
|
136
135
|
break;
|
|
137
136
|
}
|
|
138
|
-
case "
|
|
137
|
+
case "pattern.retry": {
|
|
139
138
|
const data = event.data;
|
|
140
|
-
|
|
139
|
+
const msg = messages.get(data.messageId);
|
|
140
|
+
if (msg) {
|
|
141
141
|
const retries = msg.formatRetries ?? [];
|
|
142
142
|
retries.push({ attempt: data.attempt, maxAttempts: data.maxAttempts, timestamp: event.timestamp });
|
|
143
143
|
msg.formatRetries = retries;
|
|
@@ -210,30 +210,6 @@ function deepCloneMessage(msg) {
|
|
|
210
210
|
return cloned;
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
// src/server/events/optimize-storage.ts
|
|
214
|
-
function stripPromptContextMessages(messages) {
|
|
215
|
-
let lastAssistantIdx = -1;
|
|
216
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
217
|
-
const msg = messages[i];
|
|
218
|
-
if (!msg) continue;
|
|
219
|
-
if (msg.role === "assistant" && msg.promptContext) {
|
|
220
|
-
lastAssistantIdx = i;
|
|
221
|
-
break;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
let changed = false;
|
|
225
|
-
for (let i = 0; i < messages.length; i++) {
|
|
226
|
-
const msg = messages[i];
|
|
227
|
-
if (!msg) continue;
|
|
228
|
-
const pc = msg.promptContext;
|
|
229
|
-
if (pc && pc.messages && pc.messages.length > 0 && i !== lastAssistantIdx) {
|
|
230
|
-
pc.messages = [];
|
|
231
|
-
changed = true;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
return changed;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
213
|
// src/server/events/folding.ts
|
|
238
214
|
import stripAnsi from "strip-ansi";
|
|
239
215
|
function cloneMessage(message) {
|
|
@@ -266,7 +242,6 @@ function spreadOptionalMessageFields(message) {
|
|
|
266
242
|
...message.messageKind !== void 0 && { messageKind: message.messageKind },
|
|
267
243
|
...message.contextWindowId !== void 0 && { contextWindowId: message.contextWindowId },
|
|
268
244
|
...message.isCompactionSummary !== void 0 && { isCompactionSummary: message.isCompactionSummary },
|
|
269
|
-
...message.promptContext !== void 0 && { promptContext: message.promptContext },
|
|
270
245
|
...message.attachments !== void 0 && { attachments: message.attachments },
|
|
271
246
|
...message.preparingToolCalls !== void 0 && message.preparingToolCalls.length > 0 && { preparingToolCalls: message.preparingToolCalls },
|
|
272
247
|
...message.metadata !== void 0 && { metadata: message.metadata }
|
|
@@ -734,7 +709,7 @@ function foldSessionState(events, initialWindowId, maxTokens, initialMessages) {
|
|
|
734
709
|
}
|
|
735
710
|
break;
|
|
736
711
|
}
|
|
737
|
-
case "
|
|
712
|
+
case "pattern.retry": {
|
|
738
713
|
const data = event.data;
|
|
739
714
|
formatRetries.push({
|
|
740
715
|
attempt: data.attempt,
|
|
@@ -845,7 +820,6 @@ function buildSnapshotFromSessionState(input) {
|
|
|
845
820
|
latestSnapshotEvent.data.messages,
|
|
846
821
|
events.slice(latestSnapshotIndex + 1)
|
|
847
822
|
) : foldedState.messages;
|
|
848
|
-
stripPromptContextMessages(messages);
|
|
849
823
|
return {
|
|
850
824
|
mode: session.mode,
|
|
851
825
|
phase: session.phase,
|
|
@@ -886,7 +860,6 @@ function buildContextMessagesFromMessages(messages, windowId) {
|
|
|
886
860
|
}
|
|
887
861
|
|
|
888
862
|
export {
|
|
889
|
-
stripPromptContextMessages,
|
|
890
863
|
spreadOptionalMessageFields,
|
|
891
864
|
buildMessagesFromStoredEvents,
|
|
892
865
|
buildContextMessagesFromStoredEvents,
|
|
@@ -912,4 +885,4 @@ export {
|
|
|
912
885
|
getMessagesForWindow,
|
|
913
886
|
buildContextMessagesFromMessages
|
|
914
887
|
};
|
|
915
|
-
//# sourceMappingURL=chunk-
|
|
888
|
+
//# sourceMappingURL=chunk-XJEOP6XU.js.map
|
package/dist/cli/dev.js
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
removeProvider,
|
|
13
13
|
saveGlobalConfig,
|
|
14
14
|
setDefaultModelSelection,
|
|
15
|
-
trySmartDefaults
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-SZKEGZIB.js";
|
|
15
|
+
trySmartDefaults,
|
|
16
|
+
updateProvider
|
|
17
|
+
} from "./chunk-EZUR7OEP.js";
|
|
18
|
+
import "./chunk-UKTPL5ZG.js";
|
|
19
|
+
import "./chunk-VIIRNJDT.js";
|
|
21
20
|
import "./chunk-K44MW7JJ.js";
|
|
21
|
+
import "./chunk-CQGTEGKL.js";
|
|
22
22
|
export {
|
|
23
23
|
activateProvider,
|
|
24
24
|
addProvider,
|
|
@@ -33,6 +33,7 @@ export {
|
|
|
33
33
|
removeProvider,
|
|
34
34
|
saveGlobalConfig,
|
|
35
35
|
setDefaultModelSelection,
|
|
36
|
-
trySmartDefaults
|
|
36
|
+
trySmartDefaults,
|
|
37
|
+
updateProvider
|
|
37
38
|
};
|
|
38
|
-
//# sourceMappingURL=config-
|
|
39
|
+
//# sourceMappingURL=config-TDVA7MQN.js.map
|
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
emitCriteriaSet,
|
|
11
11
|
emitCriterionUpdated,
|
|
12
12
|
emitFileRead,
|
|
13
|
-
emitFormatRetry,
|
|
14
13
|
emitMessageDelta,
|
|
15
14
|
emitMessageDone,
|
|
16
15
|
emitMessageThinking,
|
|
17
16
|
emitMetadataSet,
|
|
18
17
|
emitModeChanged,
|
|
18
|
+
emitPatternRetry,
|
|
19
19
|
emitPhaseChanged,
|
|
20
20
|
emitRunningChanged,
|
|
21
21
|
emitSessionInitialized,
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
emitUserMessage,
|
|
29
29
|
getContextMessages,
|
|
30
30
|
getCurrentContextWindowId,
|
|
31
|
+
getCurrentWindowMessageOptions,
|
|
31
32
|
getCurrentWindowMessages,
|
|
32
33
|
getEventStore,
|
|
33
34
|
getReadFilesCache,
|
|
@@ -38,8 +39,7 @@ import {
|
|
|
38
39
|
isStoredEvent,
|
|
39
40
|
isTurnEvent,
|
|
40
41
|
truncateSessionMessages
|
|
41
|
-
} from "./chunk-
|
|
42
|
-
import "./chunk-FBGWG4N6.js";
|
|
42
|
+
} from "./chunk-NPHYEUYE.js";
|
|
43
43
|
import {
|
|
44
44
|
buildContextMessagesFromEventHistory,
|
|
45
45
|
buildContextMessagesFromMessages,
|
|
@@ -56,8 +56,8 @@ import {
|
|
|
56
56
|
foldTodos,
|
|
57
57
|
foldTurnEventsToSnapshotMessages,
|
|
58
58
|
getMessagesForWindow
|
|
59
|
-
} from "./chunk-
|
|
60
|
-
import "./chunk-
|
|
59
|
+
} from "./chunk-XJEOP6XU.js";
|
|
60
|
+
import "./chunk-FBGWG4N6.js";
|
|
61
61
|
import "./chunk-K44MW7JJ.js";
|
|
62
62
|
export {
|
|
63
63
|
EventStore,
|
|
@@ -77,12 +77,12 @@ export {
|
|
|
77
77
|
emitCriteriaSet,
|
|
78
78
|
emitCriterionUpdated,
|
|
79
79
|
emitFileRead,
|
|
80
|
-
emitFormatRetry,
|
|
81
80
|
emitMessageDelta,
|
|
82
81
|
emitMessageDone,
|
|
83
82
|
emitMessageThinking,
|
|
84
83
|
emitMetadataSet,
|
|
85
84
|
emitModeChanged,
|
|
85
|
+
emitPatternRetry,
|
|
86
86
|
emitPhaseChanged,
|
|
87
87
|
emitRunningChanged,
|
|
88
88
|
emitSessionInitialized,
|
|
@@ -103,6 +103,7 @@ export {
|
|
|
103
103
|
foldTurnEventsToSnapshotMessages,
|
|
104
104
|
getContextMessages,
|
|
105
105
|
getCurrentContextWindowId,
|
|
106
|
+
getCurrentWindowMessageOptions,
|
|
106
107
|
getCurrentWindowMessages,
|
|
107
108
|
getEventStore,
|
|
108
109
|
getMessagesForWindow,
|
|
@@ -115,4 +116,4 @@ export {
|
|
|
115
116
|
isTurnEvent,
|
|
116
117
|
truncateSessionMessages
|
|
117
118
|
};
|
|
118
|
-
//# sourceMappingURL=events-
|
|
119
|
+
//# sourceMappingURL=events-PQ3KTI5H.js.map
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
handleToolResult,
|
|
24
24
|
spreadOptionalMessageFields,
|
|
25
25
|
stripOrphanedToolCalls
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-XJEOP6XU.js";
|
|
27
27
|
export {
|
|
28
28
|
buildContextMessagesFromEventHistory,
|
|
29
29
|
buildContextMessagesFromMessages,
|
|
@@ -50,4 +50,4 @@ export {
|
|
|
50
50
|
spreadOptionalMessageFields,
|
|
51
51
|
stripOrphanedToolCalls
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=folding-
|
|
53
|
+
//# sourceMappingURL=folding-CXORTBAU.js.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
runChatTurn
|
|
5
|
-
|
|
6
|
-
} from "./chunk-UFY4I643.js";
|
|
2
|
+
injectWorkflowKickoffIfNeeded,
|
|
3
|
+
runAgentTurn,
|
|
4
|
+
runChatTurn
|
|
5
|
+
} from "./chunk-C75I2KZM.js";
|
|
7
6
|
import {
|
|
8
7
|
TurnMetrics,
|
|
9
8
|
createChatDoneEvent,
|
|
@@ -11,23 +10,21 @@ import {
|
|
|
11
10
|
createMessageStartEvent,
|
|
12
11
|
createToolCallEvent,
|
|
13
12
|
createToolResultEvent
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-PSJIT5LZ.js";
|
|
16
|
-
import "./chunk-XAMAYRDA.js";
|
|
13
|
+
} from "./chunk-LR5R7EEE.js";
|
|
17
14
|
import "./chunk-DL6ZILAF.js";
|
|
18
15
|
import "./chunk-PBGOZMVY.js";
|
|
19
16
|
import "./chunk-VRGRAQDG.js";
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-NONI4CRP.js";
|
|
24
|
-
import "./chunk-CEZNMLOO.js";
|
|
17
|
+
import "./chunk-NPHYEUYE.js";
|
|
18
|
+
import "./chunk-XJEOP6XU.js";
|
|
19
|
+
import "./chunk-7TTEGAO6.js";
|
|
25
20
|
import "./chunk-BJYPTN5S.js";
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-RFNEDBVO.js";
|
|
22
|
+
import "./chunk-XAMAYRDA.js";
|
|
23
|
+
import "./chunk-FBGWG4N6.js";
|
|
24
|
+
import "./chunk-BVHFMAVN.js";
|
|
25
|
+
import "./chunk-VIIRNJDT.js";
|
|
30
26
|
import "./chunk-K44MW7JJ.js";
|
|
27
|
+
import "./chunk-CQGTEGKL.js";
|
|
31
28
|
export {
|
|
32
29
|
TurnMetrics,
|
|
33
30
|
createChatDoneEvent,
|
|
@@ -35,9 +32,8 @@ export {
|
|
|
35
32
|
createMessageStartEvent,
|
|
36
33
|
createToolCallEvent,
|
|
37
34
|
createToolResultEvent,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
runChatTurn
|
|
41
|
-
runVerifierTurn
|
|
35
|
+
injectWorkflowKickoffIfNeeded,
|
|
36
|
+
runAgentTurn,
|
|
37
|
+
runChatTurn
|
|
42
38
|
};
|
|
43
|
-
//# sourceMappingURL=orchestrator-
|
|
39
|
+
//# sourceMappingURL=orchestrator-ZNGTMZ7W.js.map
|