openfox 1.6.82 → 1.6.84
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/{auto-compaction-I3GTBPTZ.js → auto-compaction-JGRRUO2G.js} +8 -8
- package/dist/{chat-handler-IOHM7XMZ.js → chat-handler-OH5GPGLH.js} +11 -11
- package/dist/{chunk-XI7JEBNT.js → chunk-2IIQ7EZV.js} +110 -23
- package/dist/{chunk-NDJ6FKSP.js → chunk-4VT74LCD.js} +1 -1
- package/dist/{chunk-HJOH367L.js → chunk-6GGYIEBM.js} +3 -3
- package/dist/{chunk-D67V55WE.js → chunk-6GH2PJJC.js} +4 -4
- package/dist/{chunk-WNYDTFJO.js → chunk-6THJULLK.js} +2 -2
- package/dist/{chunk-ZPQDYRQI.js → chunk-GN7RB4Y4.js} +2 -2
- package/dist/{chunk-NRJOTXHG.js → chunk-JDDNBK6T.js} +5 -5
- package/dist/{chunk-Y2LKLZ2V.js → chunk-M7INHE2B.js} +6 -6
- package/dist/{chunk-WHPOBTTU.js → chunk-QIMHUO3E.js} +4 -4
- package/dist/{chunk-DVNZAJT5.js → chunk-TLOL4I7K.js} +3 -3
- package/dist/{chunk-MDL6USSE.js → chunk-W7BC4WCC.js} +38 -35
- package/dist/{chunk-C3O6MZJV.js → chunk-WSRF5L3S.js} +2 -2
- package/dist/{chunk-TS5XFQ2D.js → chunk-XVWVAWSG.js} +1 -1
- package/dist/{chunk-Y325P6Z4.js → chunk-YNIAFX24.js} +5 -5
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{config-RIK5T6WK.js → config-HMMPXQ46.js} +5 -5
- package/dist/{events-I7NDHSNU.js → events-H563T5M5.js} +3 -3
- package/dist/{folding-XIKR6AFM.js → folding-4VHGQE6Y.js} +2 -2
- package/dist/{orchestrator-YFHSFYII.js → orchestrator-NSDEXVSR.js} +9 -9
- package/dist/package.json +1 -1
- package/dist/{processor-EM4BINEJ.js → processor-OHI5QJ6F.js} +7 -7
- package/dist/{protocol-OnZRAPeM.d.ts → protocol-C_BF6KDE.d.ts} +4 -1
- package/dist/{protocol-VVUFP4I7.js → protocol-NEBXAMJ3.js} +3 -3
- package/dist/{provider-AASLIQZJ.js → provider-LDZFYLK6.js} +7 -7
- package/dist/{serve-OJPBEKVE.js → serve-IWRMBDPG.js} +13 -13
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +11 -11
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.js +1 -1
- package/dist/{tools-PPLFGZCK.js → tools-NBBDVEXF.js} +8 -8
- package/dist/{vision-fallback-GMDXLVRN.js → vision-fallback-WT66NURB.js} +2 -2
- package/dist/web/assets/{index-D4Si0Pmc.css → index-CA0bz_5H.css} +1 -1
- package/dist/web/assets/{index-CkbORFn4.js → index-DmpkTC-2.js} +45 -45
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
|
@@ -2,26 +2,26 @@ import {
|
|
|
2
2
|
maybeAutoCompactContext,
|
|
3
3
|
performManualContextCompaction,
|
|
4
4
|
resolveCompactionStatsIdentity
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-2IIQ7EZV.js";
|
|
6
6
|
import "./chunk-OXI26S7U.js";
|
|
7
7
|
import "./chunk-CMQCO27Y.js";
|
|
8
8
|
import "./chunk-DL6ZILAF.js";
|
|
9
9
|
import "./chunk-PBGOZMVY.js";
|
|
10
10
|
import "./chunk-VRGRAQDG.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-YNIAFX24.js";
|
|
12
|
+
import "./chunk-6THJULLK.js";
|
|
13
13
|
import "./chunk-KIOUKC3Z.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-XVWVAWSG.js";
|
|
15
|
+
import "./chunk-GN7RB4Y4.js";
|
|
16
16
|
import "./chunk-BJYPTN5S.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-4VT74LCD.js";
|
|
18
18
|
import "./chunk-CQGTEGKL.js";
|
|
19
19
|
import "./chunk-B5AP3RSV.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-WSRF5L3S.js";
|
|
21
21
|
import "./chunk-K44MW7JJ.js";
|
|
22
22
|
export {
|
|
23
23
|
maybeAutoCompactContext,
|
|
24
24
|
performManualContextCompaction,
|
|
25
25
|
resolveCompactionStatsIdentity
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=auto-compaction-
|
|
27
|
+
//# sourceMappingURL=auto-compaction-JGRRUO2G.js.map
|
|
@@ -5,32 +5,32 @@ import {
|
|
|
5
5
|
generateSessionName,
|
|
6
6
|
getSessionMessageCount,
|
|
7
7
|
needsNameGenerationCheck
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6GH2PJJC.js";
|
|
9
9
|
import {
|
|
10
10
|
runChatTurn
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-QIMHUO3E.js";
|
|
12
|
+
import "./chunk-2IIQ7EZV.js";
|
|
13
13
|
import "./chunk-OXI26S7U.js";
|
|
14
14
|
import "./chunk-CMQCO27Y.js";
|
|
15
15
|
import "./chunk-DL6ZILAF.js";
|
|
16
16
|
import "./chunk-PBGOZMVY.js";
|
|
17
17
|
import "./chunk-VRGRAQDG.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-YNIAFX24.js";
|
|
19
19
|
import {
|
|
20
20
|
getEventStore
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-6THJULLK.js";
|
|
22
22
|
import "./chunk-KIOUKC3Z.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-XVWVAWSG.js";
|
|
24
24
|
import {
|
|
25
25
|
createChatMessageMessage,
|
|
26
26
|
createPhaseChangedMessage,
|
|
27
27
|
createSessionRunningMessage
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-GN7RB4Y4.js";
|
|
29
29
|
import "./chunk-BJYPTN5S.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-4VT74LCD.js";
|
|
31
31
|
import "./chunk-CQGTEGKL.js";
|
|
32
32
|
import "./chunk-B5AP3RSV.js";
|
|
33
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-WSRF5L3S.js";
|
|
34
34
|
import {
|
|
35
35
|
logger
|
|
36
36
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -61,7 +61,7 @@ async function startChatSession(sessionId, content, deps, options) {
|
|
|
61
61
|
sessionManager.setRunning(sessionId, true);
|
|
62
62
|
broadcastForSession(sessionId, createSessionRunningMessage(true));
|
|
63
63
|
try {
|
|
64
|
-
const { maybeAutoCompactContext } = await import("./auto-compaction-
|
|
64
|
+
const { maybeAutoCompactContext } = await import("./auto-compaction-JGRRUO2G.js");
|
|
65
65
|
await maybeAutoCompactContext({
|
|
66
66
|
sessionManager,
|
|
67
67
|
sessionId,
|
|
@@ -175,4 +175,4 @@ export {
|
|
|
175
175
|
startChatSession,
|
|
176
176
|
stopSessionExecution
|
|
177
177
|
};
|
|
178
|
-
//# sourceMappingURL=chat-handler-
|
|
178
|
+
//# sourceMappingURL=chat-handler-OH5GPGLH.js.map
|
|
@@ -28,11 +28,11 @@ import {
|
|
|
28
28
|
getBackendCapabilities,
|
|
29
29
|
getModelProfile,
|
|
30
30
|
streamWithSegments
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-YNIAFX24.js";
|
|
32
32
|
import {
|
|
33
33
|
getCurrentContextWindowId,
|
|
34
34
|
getEventStore
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-6THJULLK.js";
|
|
36
36
|
import {
|
|
37
37
|
buildContextMessagesFromEventHistory,
|
|
38
38
|
foldContextState,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
handleToolCall,
|
|
42
42
|
handleToolResult,
|
|
43
43
|
stripOrphanedToolCalls
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-XVWVAWSG.js";
|
|
45
45
|
import {
|
|
46
46
|
createChatDoneMessage,
|
|
47
47
|
createChatMessageMessage,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
createChatPathConfirmationMessage,
|
|
50
50
|
createChatVisionFallbackMessage,
|
|
51
51
|
createQueueStateMessage
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-GN7RB4Y4.js";
|
|
53
53
|
import {
|
|
54
54
|
AskUserInterrupt,
|
|
55
55
|
askUserTool
|
|
@@ -539,6 +539,7 @@ function computeAggregatedStats(input) {
|
|
|
539
539
|
identity,
|
|
540
540
|
mode,
|
|
541
541
|
totalPrefillTokens,
|
|
542
|
+
totalPrefillIncrement,
|
|
542
543
|
totalGenTokens,
|
|
543
544
|
totalPrefillTime,
|
|
544
545
|
totalGenTime,
|
|
@@ -546,13 +547,15 @@ function computeAggregatedStats(input) {
|
|
|
546
547
|
totalTime,
|
|
547
548
|
llmCalls
|
|
548
549
|
} = input;
|
|
550
|
+
const prefillSource = totalPrefillIncrement ?? totalPrefillTokens;
|
|
549
551
|
return {
|
|
550
552
|
...identity,
|
|
551
553
|
mode,
|
|
552
554
|
totalTime,
|
|
553
555
|
toolTime: totalToolTime,
|
|
554
556
|
prefillTokens: totalPrefillTokens,
|
|
555
|
-
|
|
557
|
+
...totalPrefillIncrement !== void 0 && { prefTokenIncrement: totalPrefillIncrement },
|
|
558
|
+
prefillSpeed: totalPrefillTime > 0 ? roundTo1(prefillSource / totalPrefillTime) : 0,
|
|
556
559
|
generationTokens: totalGenTokens,
|
|
557
560
|
generationSpeed: totalGenTime > 0 ? roundTo1(totalGenTokens / totalGenTime) : 0,
|
|
558
561
|
...llmCalls ? { llmCalls } : {}
|
|
@@ -569,7 +572,8 @@ function createEmptyStreamResult(aborted, xmlFormatError, modelParams) {
|
|
|
569
572
|
timing: { ttft: 0, completionTime: 0, tps: 0, prefillTps: 0 },
|
|
570
573
|
aborted,
|
|
571
574
|
xmlFormatError,
|
|
572
|
-
modelParams
|
|
575
|
+
modelParams,
|
|
576
|
+
finishReason: "stop"
|
|
573
577
|
};
|
|
574
578
|
}
|
|
575
579
|
async function* streamLLMPure(options) {
|
|
@@ -754,7 +758,8 @@ async function* streamLLMPure(options) {
|
|
|
754
758
|
timing: result.timing,
|
|
755
759
|
aborted,
|
|
756
760
|
xmlFormatError,
|
|
757
|
-
modelParams
|
|
761
|
+
modelParams,
|
|
762
|
+
finishReason: result.response.finishReason
|
|
758
763
|
};
|
|
759
764
|
if (result.thinkingContent) {
|
|
760
765
|
baseResult.thinkingContent = result.thinkingContent;
|
|
@@ -764,6 +769,7 @@ async function* streamLLMPure(options) {
|
|
|
764
769
|
var TurnMetrics = class {
|
|
765
770
|
startTime;
|
|
766
771
|
totalPrefillTokens = 0;
|
|
772
|
+
totalPrefillIncrement = 0;
|
|
767
773
|
totalPrefillTime = 0;
|
|
768
774
|
// seconds
|
|
769
775
|
totalGenTokens = 0;
|
|
@@ -776,8 +782,10 @@ var TurnMetrics = class {
|
|
|
776
782
|
constructor() {
|
|
777
783
|
this.startTime = performance.now();
|
|
778
784
|
}
|
|
779
|
-
/** Add metrics from an LLM call
|
|
780
|
-
|
|
785
|
+
/** Add metrics from an LLM call.
|
|
786
|
+
* @param previousContextTokens - context size BEFORE this LLM call (for computing the non-cached increment)
|
|
787
|
+
*/
|
|
788
|
+
addLLMCall(timing, promptTokens, completionTokens, previousContextTokens, modelParams) {
|
|
781
789
|
const callIndex = this.llmCalls.length + 1;
|
|
782
790
|
this.totalPrefillTokens += promptTokens;
|
|
783
791
|
this.totalPrefillTime += timing.ttft;
|
|
@@ -786,15 +794,21 @@ var TurnMetrics = class {
|
|
|
786
794
|
if (modelParams) {
|
|
787
795
|
this.modelParams = modelParams;
|
|
788
796
|
}
|
|
797
|
+
const prefTokenIncrement = previousContextTokens !== void 0 ? Math.max(0, promptTokens - previousContextTokens) : void 0;
|
|
798
|
+
if (prefTokenIncrement !== void 0) {
|
|
799
|
+
this.totalPrefillIncrement += prefTokenIncrement;
|
|
800
|
+
}
|
|
801
|
+
const prefillSource = prefTokenIncrement ?? promptTokens;
|
|
789
802
|
this.llmCalls = [
|
|
790
803
|
...this.llmCalls,
|
|
791
804
|
{
|
|
792
805
|
callIndex,
|
|
793
806
|
promptTokens,
|
|
794
807
|
completionTokens,
|
|
808
|
+
...prefTokenIncrement !== void 0 && { prefTokenIncrement },
|
|
795
809
|
ttft: timing.ttft,
|
|
796
810
|
completionTime: timing.completionTime,
|
|
797
|
-
prefillSpeed: timing.ttft > 0 ? Math.round(
|
|
811
|
+
prefillSpeed: timing.ttft > 0 ? Math.round(prefillSource / timing.ttft * 10) / 10 : 0,
|
|
798
812
|
generationSpeed: timing.completionTime > 0 ? Math.round(completionTokens / timing.completionTime * 10) / 10 : 0,
|
|
799
813
|
totalTime: Math.round((timing.ttft + timing.completionTime) * 10) / 10,
|
|
800
814
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -819,6 +833,7 @@ var TurnMetrics = class {
|
|
|
819
833
|
identity,
|
|
820
834
|
mode,
|
|
821
835
|
totalPrefillTokens: this.totalPrefillTokens,
|
|
836
|
+
...this.totalPrefillIncrement > 0 && { totalPrefillIncrement: this.totalPrefillIncrement },
|
|
822
837
|
totalGenTokens: this.totalGenTokens,
|
|
823
838
|
totalPrefillTime: this.totalPrefillTime,
|
|
824
839
|
totalGenTime: this.totalGenTime,
|
|
@@ -914,7 +929,8 @@ async function consumeStreamWithToolLoop(options) {
|
|
|
914
929
|
workdir,
|
|
915
930
|
onEvent,
|
|
916
931
|
statsIdentity,
|
|
917
|
-
dangerLevel
|
|
932
|
+
dangerLevel,
|
|
933
|
+
sessionManager
|
|
918
934
|
} = options;
|
|
919
935
|
let currentMessages = [...messages];
|
|
920
936
|
let iterations = 0;
|
|
@@ -925,6 +941,7 @@ async function consumeStreamWithToolLoop(options) {
|
|
|
925
941
|
if (++iterations > MAX_TOOL_LOOP_ITERATIONS) {
|
|
926
942
|
throw new Error("Max tool loop iterations exceeded during compaction");
|
|
927
943
|
}
|
|
944
|
+
const previousContextTokens = sessionManager?.getContextState(sessionId).currentTokens;
|
|
928
945
|
const streamGen = streamLLMPure({
|
|
929
946
|
messageId,
|
|
930
947
|
systemPrompt,
|
|
@@ -944,7 +961,13 @@ async function consumeStreamWithToolLoop(options) {
|
|
|
944
961
|
currentMessages = [...currentMessages, correctionMsg];
|
|
945
962
|
continue;
|
|
946
963
|
}
|
|
947
|
-
turnMetrics.addLLMCall(
|
|
964
|
+
turnMetrics.addLLMCall(
|
|
965
|
+
result.timing,
|
|
966
|
+
result.usage.promptTokens,
|
|
967
|
+
result.usage.completionTokens,
|
|
968
|
+
previousContextTokens,
|
|
969
|
+
result.modelParams
|
|
970
|
+
);
|
|
948
971
|
if (result.toolCalls.length > 0) {
|
|
949
972
|
const stats = turnMetrics.buildStats(statsIdentity, "compaction");
|
|
950
973
|
onEvent(
|
|
@@ -2996,13 +3019,12 @@ async function executeToolBatch(assistantMsgId, toolCalls, ctx) {
|
|
|
2996
3019
|
truncated: false
|
|
2997
3020
|
};
|
|
2998
3021
|
ctx.turnMetrics.addToolTime(toolResult2.durationMs);
|
|
2999
|
-
|
|
3022
|
+
eventStore.append(ctx.sessionId, createToolResultEvent(assistantMsgId, toolCall.id, toolResult2));
|
|
3000
3023
|
return {
|
|
3001
3024
|
toolCall,
|
|
3002
3025
|
toolResult: toolResult2,
|
|
3003
3026
|
content: `Error: ${toolResult2.error}`,
|
|
3004
|
-
index
|
|
3005
|
-
event
|
|
3027
|
+
index
|
|
3006
3028
|
};
|
|
3007
3029
|
}
|
|
3008
3030
|
const onProgress = ctx.onMessage ? createToolProgressHandler(eventStore, assistantMsgId, toolCall.id, ctx.sessionId) : void 0;
|
|
@@ -3039,19 +3061,18 @@ async function executeToolBatch(assistantMsgId, toolCalls, ctx) {
|
|
|
3039
3061
|
|
|
3040
3062
|
Error: ${toolResult.error}` : `Error: ${toolResult.error}`
|
|
3041
3063
|
);
|
|
3064
|
+
eventStore.append(ctx.sessionId, createToolResultEvent(assistantMsgId, toolCall.id, toolResult));
|
|
3042
3065
|
return {
|
|
3043
3066
|
toolCall,
|
|
3044
3067
|
toolResult,
|
|
3045
3068
|
content,
|
|
3046
|
-
index
|
|
3047
|
-
event: createToolResultEvent(assistantMsgId, toolCall.id, toolResult)
|
|
3069
|
+
index
|
|
3048
3070
|
};
|
|
3049
3071
|
};
|
|
3050
3072
|
const executionPromises = toolCalls.map((toolCall, index) => executeTool(toolCall, index));
|
|
3051
3073
|
const results = await Promise.all(executionPromises);
|
|
3052
3074
|
results.sort((a, b) => a.index - b.index);
|
|
3053
3075
|
for (const result of results) {
|
|
3054
|
-
eventStore.append(ctx.sessionId, result.event);
|
|
3055
3076
|
toolMessages.push({
|
|
3056
3077
|
role: "tool",
|
|
3057
3078
|
content: result.content,
|
|
@@ -3067,13 +3088,16 @@ Error: ${toolResult.error}` : `Error: ${toolResult.error}`
|
|
|
3067
3088
|
return { toolMessages, criteriaChanged, returnValueContent, returnValueResult };
|
|
3068
3089
|
}
|
|
3069
3090
|
var MAX_FORMAT_RETRIES = 10;
|
|
3091
|
+
var MAX_TRUNCATION_RETRIES = 3;
|
|
3070
3092
|
var FORMAT_CORRECTION_PROMPT2 = `IMPORTANT: You MUST use the JSON function calling API. Do NOT output XML tags like <function=>, <parameter=>, or <invoke=>. Your previous attempt was stopped because you used the wrong format. Use the proper tool_calls format.`;
|
|
3071
3093
|
async function runTopLevelAgentLoop(config, turnMetrics) {
|
|
3072
3094
|
const { mode, sessionManager, sessionId, llmClient, signal, onMessage, statsIdentity } = config;
|
|
3073
3095
|
const eventStore = getEventStore();
|
|
3074
3096
|
let formatRetryCount = 0;
|
|
3097
|
+
let truncationRetryCount = 0;
|
|
3075
3098
|
let returnValueContent;
|
|
3076
3099
|
let returnValueResult;
|
|
3100
|
+
let currentMaxTokensOverride;
|
|
3077
3101
|
for (; ; ) {
|
|
3078
3102
|
await maybeAutoCompactContext({
|
|
3079
3103
|
sessionManager,
|
|
@@ -3161,7 +3185,8 @@ async function runTopLevelAgentLoop(config, turnMetrics) {
|
|
|
3161
3185
|
createChatVisionFallbackMessage({ type: "done", messageId: assistantMsgId, attachmentId, description })
|
|
3162
3186
|
);
|
|
3163
3187
|
};
|
|
3164
|
-
const
|
|
3188
|
+
const previousContextTokens = sessionManager.getContextState(sessionId).currentTokens;
|
|
3189
|
+
const modelSettings = currentMaxTokensOverride !== void 0 ? { ...sessionManager.getCurrentModelSettings(), maxTokens: currentMaxTokensOverride } : sessionManager.getCurrentModelSettings();
|
|
3165
3190
|
const streamGen = streamLLMPure({
|
|
3166
3191
|
messageId: assistantMsgId,
|
|
3167
3192
|
systemPrompt: assembledRequest.systemPrompt,
|
|
@@ -3202,8 +3227,62 @@ async function runTopLevelAgentLoop(config, turnMetrics) {
|
|
|
3202
3227
|
);
|
|
3203
3228
|
throw new Error("Aborted");
|
|
3204
3229
|
}
|
|
3205
|
-
turnMetrics.addLLMCall(
|
|
3230
|
+
turnMetrics.addLLMCall(
|
|
3231
|
+
result.timing,
|
|
3232
|
+
result.usage.promptTokens,
|
|
3233
|
+
result.usage.completionTokens,
|
|
3234
|
+
previousContextTokens,
|
|
3235
|
+
result.modelParams
|
|
3236
|
+
);
|
|
3206
3237
|
sessionManager.setCurrentContextSize(sessionId, result.usage.promptTokens);
|
|
3238
|
+
if (result.finishReason === "length" && result.toolCalls.length === 0) {
|
|
3239
|
+
if (truncationRetryCount < MAX_TRUNCATION_RETRIES) {
|
|
3240
|
+
truncationRetryCount += 1;
|
|
3241
|
+
const currentMaxTokens = result.modelParams?.maxTokens ?? 16384;
|
|
3242
|
+
const promptTokens = result.usage.promptTokens;
|
|
3243
|
+
const contextWindow = sessionManager.getCurrentModelContext();
|
|
3244
|
+
const newMaxTokens = Math.min(Math.floor(currentMaxTokens * 1.5), contextWindow - promptTokens - 2048);
|
|
3245
|
+
currentMaxTokensOverride = newMaxTokens;
|
|
3246
|
+
const interimStats = turnMetrics.buildStats(statsIdentity, mode);
|
|
3247
|
+
eventStore.append(
|
|
3248
|
+
sessionId,
|
|
3249
|
+
createMessageDoneEvent(assistantMsgId, {
|
|
3250
|
+
segments: result.segments,
|
|
3251
|
+
stats: interimStats,
|
|
3252
|
+
promptContext: assembledRequest.promptContext
|
|
3253
|
+
})
|
|
3254
|
+
);
|
|
3255
|
+
onMessage?.(createChatMessageUpdatedMessage(assistantMsgId, { isStreaming: false }));
|
|
3256
|
+
const continueMsgId = crypto.randomUUID();
|
|
3257
|
+
eventStore.append(
|
|
3258
|
+
sessionId,
|
|
3259
|
+
createMessageStartEvent(
|
|
3260
|
+
continueMsgId,
|
|
3261
|
+
"user",
|
|
3262
|
+
"Continue your previous response exactly where you left off.",
|
|
3263
|
+
{
|
|
3264
|
+
...currentWindowMessageOptions ?? {},
|
|
3265
|
+
isSystemGenerated: true
|
|
3266
|
+
}
|
|
3267
|
+
)
|
|
3268
|
+
);
|
|
3269
|
+
eventStore.append(sessionId, { type: "message.done", data: { messageId: continueMsgId } });
|
|
3270
|
+
continue;
|
|
3271
|
+
} else {
|
|
3272
|
+
const stats2 = turnMetrics.buildStats(statsIdentity, mode);
|
|
3273
|
+
eventStore.append(
|
|
3274
|
+
sessionId,
|
|
3275
|
+
createMessageDoneEvent(assistantMsgId, {
|
|
3276
|
+
segments: result.segments,
|
|
3277
|
+
stats: stats2,
|
|
3278
|
+
partial: true,
|
|
3279
|
+
promptContext: assembledRequest.promptContext
|
|
3280
|
+
})
|
|
3281
|
+
);
|
|
3282
|
+
eventStore.append(sessionId, createChatDoneEvent(assistantMsgId, "truncated", stats2));
|
|
3283
|
+
break;
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3207
3286
|
if (result.toolCalls.length > 0) {
|
|
3208
3287
|
eventStore.append(
|
|
3209
3288
|
sessionId,
|
|
@@ -3494,6 +3573,7 @@ async function executeSubAgent(options) {
|
|
|
3494
3573
|
modelName: llmClient.getModel()
|
|
3495
3574
|
});
|
|
3496
3575
|
const effectiveSystemPrompt = assembledRequest.systemPrompt + RETURN_VALUE_INSTRUCTION;
|
|
3576
|
+
const previousContextTokens = sessionManager.getContextState(sessionId).currentTokens;
|
|
3497
3577
|
const streamGen = streamLLMPure({
|
|
3498
3578
|
messageId: assistantMsgId,
|
|
3499
3579
|
systemPrompt: effectiveSystemPrompt,
|
|
@@ -3520,7 +3600,13 @@ async function executeSubAgent(options) {
|
|
|
3520
3600
|
eventStore.append(sessionId, createChatDoneEvent(assistantMsgId, "stopped", stats));
|
|
3521
3601
|
throw new Error("Aborted");
|
|
3522
3602
|
}
|
|
3523
|
-
turnMetrics.addLLMCall(
|
|
3603
|
+
turnMetrics.addLLMCall(
|
|
3604
|
+
result.timing,
|
|
3605
|
+
result.usage.promptTokens,
|
|
3606
|
+
result.usage.completionTokens,
|
|
3607
|
+
previousContextTokens,
|
|
3608
|
+
result.modelParams
|
|
3609
|
+
);
|
|
3524
3610
|
finalContent = result.content;
|
|
3525
3611
|
session = sessionManager.requireSession(sessionId);
|
|
3526
3612
|
if (result.toolCalls.length === 0) {
|
|
@@ -3707,7 +3793,7 @@ var callSubAgentTool = {
|
|
|
3707
3793
|
};
|
|
3708
3794
|
}
|
|
3709
3795
|
try {
|
|
3710
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
3796
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-NBBDVEXF.js");
|
|
3711
3797
|
const toolRegistry = getToolRegistryForAgent2(agentDef);
|
|
3712
3798
|
const turnMetrics = new TurnMetrics();
|
|
3713
3799
|
const result = await executeSubAgent({
|
|
@@ -4802,6 +4888,7 @@ ${COMPACTION_PROMPT}
|
|
|
4802
4888
|
workdir: session.workdir,
|
|
4803
4889
|
onEvent: (event) => eventStore.append(sessionId, event),
|
|
4804
4890
|
statsIdentity,
|
|
4891
|
+
sessionManager,
|
|
4805
4892
|
...session.dangerLevel ? { dangerLevel: session.dangerLevel } : {},
|
|
4806
4893
|
...signal ? { signal } : {}
|
|
4807
4894
|
});
|
|
@@ -4896,4 +4983,4 @@ export {
|
|
|
4896
4983
|
getToolRegistryForAgent,
|
|
4897
4984
|
createToolRegistry
|
|
4898
4985
|
};
|
|
4899
|
-
//# sourceMappingURL=chunk-
|
|
4986
|
+
//# sourceMappingURL=chunk-2IIQ7EZV.js.map
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
clearModelCache,
|
|
3
3
|
createLLMClient,
|
|
4
4
|
detectModel
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-JDDNBK6T.js";
|
|
6
6
|
import {
|
|
7
7
|
detectBackend,
|
|
8
8
|
getModelProfile
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YNIAFX24.js";
|
|
10
10
|
import {
|
|
11
11
|
logger
|
|
12
12
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -511,4 +511,4 @@ export {
|
|
|
511
511
|
parseDefaultModelSelection,
|
|
512
512
|
createProviderManager
|
|
513
513
|
};
|
|
514
|
-
//# sourceMappingURL=chunk-
|
|
514
|
+
//# sourceMappingURL=chunk-6GGYIEBM.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getEventStore,
|
|
3
3
|
updateSessionMetadata
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6THJULLK.js";
|
|
5
5
|
import {
|
|
6
6
|
buildMessagesFromStoredEvents,
|
|
7
7
|
foldPendingConfirmations
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XVWVAWSG.js";
|
|
9
9
|
import {
|
|
10
10
|
createContextStateMessage,
|
|
11
11
|
createSessionStateMessage
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-GN7RB4Y4.js";
|
|
13
13
|
import {
|
|
14
14
|
logger
|
|
15
15
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -143,4 +143,4 @@ export {
|
|
|
143
143
|
needsNameGenerationCheck,
|
|
144
144
|
applyGeneratedSessionName
|
|
145
145
|
};
|
|
146
|
-
//# sourceMappingURL=chunk-
|
|
146
|
+
//# sourceMappingURL=chunk-6GH2PJJC.js.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
foldSessionState,
|
|
10
10
|
spreadOptionalMessageFields,
|
|
11
11
|
stripPromptContextMessages
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XVWVAWSG.js";
|
|
13
13
|
import {
|
|
14
14
|
getRuntimeConfig
|
|
15
15
|
} from "./chunk-B5AP3RSV.js";
|
|
@@ -1269,4 +1269,4 @@ export {
|
|
|
1269
1269
|
compactContext,
|
|
1270
1270
|
getRecentUserPromptsForSession
|
|
1271
1271
|
};
|
|
1272
|
-
//# sourceMappingURL=chunk-
|
|
1272
|
+
//# sourceMappingURL=chunk-6THJULLK.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createServerMessage,
|
|
3
3
|
isClientMessage
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4VT74LCD.js";
|
|
5
5
|
|
|
6
6
|
// src/server/ws/protocol.ts
|
|
7
7
|
function enrichMessagesWithToolResults(messages) {
|
|
@@ -343,4 +343,4 @@ export {
|
|
|
343
343
|
createQueueStateMessage,
|
|
344
344
|
storedEventToServerMessage
|
|
345
345
|
};
|
|
346
|
-
//# sourceMappingURL=chunk-
|
|
346
|
+
//# sourceMappingURL=chunk-GN7RB4Y4.js.map
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
getBackendCapabilities,
|
|
6
6
|
getModelProfile,
|
|
7
7
|
mapFinishReason
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YNIAFX24.js";
|
|
9
9
|
import {
|
|
10
10
|
ensureVisionFallbackConfigLoaded
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WSRF5L3S.js";
|
|
12
12
|
import {
|
|
13
13
|
logger
|
|
14
14
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -188,7 +188,7 @@ function createLLMClient(config, initialBackend = "unknown") {
|
|
|
188
188
|
try {
|
|
189
189
|
const shouldDisableThinking = disableThinking || request.disableThinking === true;
|
|
190
190
|
await ensureVisionFallbackConfigLoaded();
|
|
191
|
-
const { isVisionFallbackEnabled } = await import("./vision-fallback-
|
|
191
|
+
const { isVisionFallbackEnabled } = await import("./vision-fallback-WT66NURB.js");
|
|
192
192
|
const paramsOptions = {
|
|
193
193
|
model,
|
|
194
194
|
request,
|
|
@@ -265,7 +265,7 @@ function createLLMClient(config, initialBackend = "unknown") {
|
|
|
265
265
|
});
|
|
266
266
|
try {
|
|
267
267
|
await ensureVisionFallbackConfigLoaded();
|
|
268
|
-
const { isVisionFallbackEnabled } = await import("./vision-fallback-
|
|
268
|
+
const { isVisionFallbackEnabled } = await import("./vision-fallback-WT66NURB.js");
|
|
269
269
|
const shouldDisableThinking = disableThinking || request.disableThinking === true;
|
|
270
270
|
const createParams = await buildStreamingCreateParams({
|
|
271
271
|
model,
|
|
@@ -478,4 +478,4 @@ export {
|
|
|
478
478
|
getLlmStatus,
|
|
479
479
|
clearModelCache
|
|
480
480
|
};
|
|
481
|
-
//# sourceMappingURL=chunk-
|
|
481
|
+
//# sourceMappingURL=chunk-JDDNBK6T.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-HMMPXQ46.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-HMMPXQ46.js");
|
|
98
98
|
const { getGlobalConfigPath } = await import("./paths-X46PPOI2.js");
|
|
99
99
|
const config = await loadGlobalConfig(mode);
|
|
100
100
|
const configPath = getGlobalConfigPath(mode);
|
|
@@ -149,7 +149,7 @@ async function runCli(options) {
|
|
|
149
149
|
break;
|
|
150
150
|
}
|
|
151
151
|
case "provider": {
|
|
152
|
-
const { runProviderCommand } = await import("./provider-
|
|
152
|
+
const { runProviderCommand } = await import("./provider-LDZFYLK6.js");
|
|
153
153
|
const [, subcommand] = positionals;
|
|
154
154
|
await runProviderCommand(mode, subcommand);
|
|
155
155
|
break;
|
|
@@ -185,12 +185,12 @@ async function runCli(options) {
|
|
|
185
185
|
break;
|
|
186
186
|
}
|
|
187
187
|
default: {
|
|
188
|
-
const { configFileExists } = await import("./config-
|
|
188
|
+
const { configFileExists } = await import("./config-HMMPXQ46.js");
|
|
189
189
|
const configExists = await configFileExists(mode);
|
|
190
190
|
if (!configExists) {
|
|
191
191
|
await runNetworkSetup(mode);
|
|
192
192
|
}
|
|
193
|
-
const { runServe } = await import("./serve-
|
|
193
|
+
const { runServe } = await import("./serve-IWRMBDPG.js");
|
|
194
194
|
const serveOptions = { mode };
|
|
195
195
|
if (values.port) serveOptions.port = parseInt(values.port);
|
|
196
196
|
if (values["no-browser"] === true) serveOptions.openBrowser = false;
|
|
@@ -202,4 +202,4 @@ async function runCli(options) {
|
|
|
202
202
|
export {
|
|
203
203
|
runCli
|
|
204
204
|
};
|
|
205
|
-
//# sourceMappingURL=chunk-
|
|
205
|
+
//# sourceMappingURL=chunk-M7INHE2B.js.map
|
|
@@ -13,14 +13,14 @@ import {
|
|
|
13
13
|
getToolRegistryForAgent,
|
|
14
14
|
loadAllAgentsDefault,
|
|
15
15
|
runTopLevelAgentLoop
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-2IIQ7EZV.js";
|
|
17
17
|
import {
|
|
18
18
|
getCurrentContextWindowId,
|
|
19
19
|
getEventStore
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-6THJULLK.js";
|
|
21
21
|
import {
|
|
22
22
|
buildSnapshotFromSessionState
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-XVWVAWSG.js";
|
|
24
24
|
import {
|
|
25
25
|
logger
|
|
26
26
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -327,4 +327,4 @@ export {
|
|
|
327
327
|
runBuilderTurn,
|
|
328
328
|
runVerifierTurn
|
|
329
329
|
};
|
|
330
|
-
//# sourceMappingURL=chunk-
|
|
330
|
+
//# sourceMappingURL=chunk-QIMHUO3E.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
detectModel
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JDDNBK6T.js";
|
|
4
4
|
import {
|
|
5
5
|
detectBackend
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YNIAFX24.js";
|
|
7
7
|
import {
|
|
8
8
|
getGlobalConfigPath
|
|
9
9
|
} from "./chunk-CQGTEGKL.js";
|
|
@@ -435,4 +435,4 @@ export {
|
|
|
435
435
|
activateProvider,
|
|
436
436
|
mergeConfigs
|
|
437
437
|
};
|
|
438
|
-
//# sourceMappingURL=chunk-
|
|
438
|
+
//# sourceMappingURL=chunk-TLOL4I7K.js.map
|