openfox 2.0.144 → 2.0.146
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/CHANGELOG.md +12 -0
- package/dist/CHANGELOG.md +12 -0
- package/dist/{auto-continue-M3RPFGFI.js → auto-continue-IENGLXVQ.js} +9 -9
- package/dist/{chat-handler-QOOQOHHR.js → chat-handler-RJUJHVOX.js} +12 -12
- package/dist/{chunk-OVAHNEFG.js → chunk-2PGRX4RH.js} +5 -4
- package/dist/{chunk-5XKWYLBX.js → chunk-5D4MQG7P.js} +8 -8
- package/dist/{chunk-2DVAF6HY.js → chunk-5JGRKNMS.js} +3 -3
- package/dist/{chunk-MBDYJ35W.js → chunk-7BIGFGU5.js} +8 -8
- package/dist/{chunk-5ONERSDK.js → chunk-7IETJ4D4.js} +63 -56
- package/dist/{chunk-E4F32L4Q.js → chunk-CPRBMVI7.js} +43 -1
- package/dist/{chunk-STVJA7IX.js → chunk-CVQYCAMY.js} +3 -3
- package/dist/chunk-EABIZXTG.js +7 -0
- package/dist/{chunk-QURYQA4D.js → chunk-EZEFBLPY.js} +3 -3
- package/dist/{chunk-FLTNKZNQ.js → chunk-KJEOKIH2.js} +4 -4
- package/dist/{chunk-OSUEWIVU.js → chunk-L43S7FJM.js} +5 -5
- package/dist/chunk-NHHC3AVI.js +231 -0
- package/dist/{chunk-YRSZJ7IZ.js → chunk-NZBO3A3W.js} +2 -2
- package/dist/{chunk-3IVJ65IG.js → chunk-ORIPUMOQ.js} +5 -5
- package/dist/{chunk-Z3C3D4IR.js → chunk-OS4P2KQJ.js} +21 -15
- package/dist/{chunk-VFHGN3IS.js → chunk-P7KUU5VB.js} +2 -2
- package/dist/{chunk-PW5L4WBG.js → chunk-Q6MBLKL4.js} +1 -1
- package/dist/{chunk-C4LI5U6L.js → chunk-QR6FIHIP.js} +55 -30
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{compactor-53WDNC2S.js → compactor-YY7PO2XE.js} +5 -5
- package/dist/{describe-image-IGLGVEOJ.js → describe-image-Z5WS6YU3.js} +8 -8
- package/dist/{dynamic-context-CR4RUXOX.js → dynamic-context-IQUBKUCX.js} +5 -5
- package/dist/{events-ODZ4SSBW.js → events-FTS5W6FX.js} +6 -4
- package/dist/{export-import-3WOHC7PI.js → export-import-NAQDPRET.js} +5 -5
- package/dist/{folding-V2R2MZ6Y.js → folding-VWRMYZ5T.js} +4 -2
- package/dist/{launch-4COI5RGL.js → launch-EUU25RFE.js} +13 -13
- package/dist/{orchestrator-AMTWA6JO.js → orchestrator-PPAIE2UH.js} +11 -11
- package/dist/package.json +1 -1
- package/dist/{path-security-3YFS3GJQ.js → path-security-25P6TQ4R.js} +7 -7
- package/dist/{processor-UZ7OBCAK.js → processor-7XMJPNCD.js} +11 -11
- package/dist/{protocol-Ch2s26bR.d.ts → protocol--oV4P3L_.d.ts} +2 -1
- package/dist/{protocol-MRMOB3P4.js → protocol-M4DFHA32.js} +3 -3
- package/dist/provider/index.d.ts +4 -4
- package/dist/{serve-NLQ6IB2V.js → serve-3GNQNYG6.js} +18 -18
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +17 -17
- package/dist/{server-YXKUQ3DD.js → server-C4LB436R.js} +16 -16
- package/dist/session-stats-Y7WRB5MP.js +23 -0
- package/dist/shared/index.d.ts +25 -9
- package/dist/shared/index.js +7 -3
- package/dist/stats-2QMXP6G4.js +12 -0
- package/dist/{store-AOZ46PBS.js → store-OWOLXB74.js} +3 -3
- package/dist/{tools-7L63ZMNU.js → tools-OH3WW6Q4.js} +9 -9
- package/dist/{types-BajWwfkt.d.ts → types-NEE5osQN.d.ts} +48 -1
- package/dist/{types-BiHNYUUI.d.ts → types-usLcJB6N.d.ts} +1 -1
- package/dist/{update-IBN2GJUI.js → update-PG63SDV3.js} +2 -2
- package/dist/web/assets/{index-DL26wmhi.js → index-jXXIgPm-.js} +84 -84
- package/dist/web/index.html +1 -1
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-7OHXF5GW.js +0 -132
- package/dist/chunk-ZSGELOTW.js +0 -7
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
// src/shared/stats.ts
|
|
2
|
+
var roundTo1 = (n) => Math.round(n * 10) / 10;
|
|
3
|
+
function hasValidStats(stats) {
|
|
4
|
+
return typeof stats.totalTime === "number" && !Number.isNaN(stats.totalTime);
|
|
5
|
+
}
|
|
6
|
+
function getStatsIdentity(stats) {
|
|
7
|
+
return {
|
|
8
|
+
providerId: stats.providerId,
|
|
9
|
+
providerName: stats.providerName,
|
|
10
|
+
backend: stats.backend,
|
|
11
|
+
model: stats.model
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function getModelGroupKey(identity) {
|
|
15
|
+
return `${identity.providerId}::${identity.model}`;
|
|
16
|
+
}
|
|
17
|
+
function getModelGroupLabel(identity) {
|
|
18
|
+
return `${identity.providerName} > ${identity.model}`;
|
|
19
|
+
}
|
|
20
|
+
function aggregateMessages(messagesWithStats) {
|
|
21
|
+
let totalTime = 0;
|
|
22
|
+
let toolTime = 0;
|
|
23
|
+
let prefillTokens = 0;
|
|
24
|
+
let generationTokens = 0;
|
|
25
|
+
let totalPrefillSource = 0;
|
|
26
|
+
let totalPrefillTime = 0;
|
|
27
|
+
let totalGenTime = 0;
|
|
28
|
+
let llmCallCount = 0;
|
|
29
|
+
for (const msg of messagesWithStats) {
|
|
30
|
+
const stats = msg.stats;
|
|
31
|
+
totalTime += stats.totalTime;
|
|
32
|
+
toolTime += stats.toolTime;
|
|
33
|
+
prefillTokens += stats.prefillTokens;
|
|
34
|
+
generationTokens += stats.generationTokens;
|
|
35
|
+
const prefillSource = stats.prefTokenIncrement ?? stats.prefillTokens;
|
|
36
|
+
const prefillTime = stats.prefillSpeed > 0 ? prefillSource / stats.prefillSpeed : 0;
|
|
37
|
+
const genTime = stats.generationSpeed > 0 ? stats.generationTokens / stats.generationSpeed : 0;
|
|
38
|
+
totalPrefillSource += prefillSource;
|
|
39
|
+
totalPrefillTime += prefillTime;
|
|
40
|
+
totalGenTime += genTime;
|
|
41
|
+
llmCallCount += stats.llmCalls?.length ?? 0;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
totalTime,
|
|
45
|
+
toolTime,
|
|
46
|
+
prefillTokens,
|
|
47
|
+
generationTokens,
|
|
48
|
+
totalPrefillSource,
|
|
49
|
+
totalPrefillTime,
|
|
50
|
+
totalGenTime,
|
|
51
|
+
responseCount: messagesWithStats.length,
|
|
52
|
+
llmCallCount
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function summaryFields(agg) {
|
|
56
|
+
return {
|
|
57
|
+
totalTime: roundTo1(agg.totalTime),
|
|
58
|
+
aiTime: roundTo1(agg.totalTime - agg.toolTime),
|
|
59
|
+
toolTime: roundTo1(agg.toolTime),
|
|
60
|
+
prefillTokens: agg.prefillTokens,
|
|
61
|
+
generationTokens: agg.generationTokens,
|
|
62
|
+
avgPrefillSpeed: agg.totalPrefillTime > 0 ? roundTo1(agg.totalPrefillSource / agg.totalPrefillTime) : 0,
|
|
63
|
+
avgGenerationSpeed: agg.totalGenTime > 0 ? roundTo1(agg.generationTokens / agg.totalGenTime) : 0,
|
|
64
|
+
responseCount: agg.responseCount,
|
|
65
|
+
llmCallCount: agg.llmCallCount,
|
|
66
|
+
totalPrefillSource: agg.totalPrefillSource,
|
|
67
|
+
totalPrefillTime: agg.totalPrefillTime,
|
|
68
|
+
totalGenTime: agg.totalGenTime
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function buildModelSummary(identity, groupMessages) {
|
|
72
|
+
return {
|
|
73
|
+
...identity,
|
|
74
|
+
key: getModelGroupKey(identity),
|
|
75
|
+
label: getModelGroupLabel(identity),
|
|
76
|
+
...summaryFields(aggregateMessages(groupMessages))
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function filterWithStats(messages) {
|
|
80
|
+
return messages.filter((msg) => msg.stats !== void 0 && msg.stats !== null && hasValidStats(msg.stats)).sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
81
|
+
}
|
|
82
|
+
function buildSessionStats(messagesWithStats) {
|
|
83
|
+
const agg = aggregateMessages(messagesWithStats);
|
|
84
|
+
const dataPoints = [];
|
|
85
|
+
const callDataPoints = [];
|
|
86
|
+
let sessionCallIndex = 0;
|
|
87
|
+
for (const [index, msg] of messagesWithStats.entries()) {
|
|
88
|
+
const stats = msg.stats;
|
|
89
|
+
const identity = getStatsIdentity(stats);
|
|
90
|
+
dataPoints.push({
|
|
91
|
+
messageId: msg.id,
|
|
92
|
+
timestamp: msg.timestamp,
|
|
93
|
+
...identity,
|
|
94
|
+
mode: stats.mode,
|
|
95
|
+
responseIndex: index + 1,
|
|
96
|
+
prefillTokens: stats.prefillTokens,
|
|
97
|
+
generationTokens: stats.generationTokens,
|
|
98
|
+
prefillSpeed: stats.prefillSpeed,
|
|
99
|
+
generationSpeed: stats.generationSpeed,
|
|
100
|
+
totalTime: stats.totalTime,
|
|
101
|
+
aiTime: stats.totalTime - stats.toolTime,
|
|
102
|
+
toolTime: stats.toolTime
|
|
103
|
+
});
|
|
104
|
+
const llmCalls = stats.llmCalls ?? [];
|
|
105
|
+
for (const call of llmCalls) {
|
|
106
|
+
sessionCallIndex += 1;
|
|
107
|
+
callDataPoints.push({
|
|
108
|
+
messageId: msg.id,
|
|
109
|
+
timestamp: call.timestamp ?? msg.timestamp,
|
|
110
|
+
providerId: call.providerId,
|
|
111
|
+
providerName: call.providerName,
|
|
112
|
+
backend: call.backend,
|
|
113
|
+
model: call.model,
|
|
114
|
+
mode: stats.mode,
|
|
115
|
+
responseIndex: index + 1,
|
|
116
|
+
sessionCallIndex,
|
|
117
|
+
callIndex: call.callIndex,
|
|
118
|
+
promptTokens: call.promptTokens,
|
|
119
|
+
completionTokens: call.completionTokens,
|
|
120
|
+
ttft: call.ttft,
|
|
121
|
+
completionTime: call.completionTime,
|
|
122
|
+
prefillSpeed: call.prefillSpeed,
|
|
123
|
+
generationSpeed: call.generationSpeed,
|
|
124
|
+
totalTime: call.totalTime,
|
|
125
|
+
...call.temperature !== void 0 && { temperature: call.temperature },
|
|
126
|
+
...call.topP !== void 0 && { topP: call.topP },
|
|
127
|
+
...call.topK !== void 0 && { topK: call.topK },
|
|
128
|
+
...call.maxTokens !== void 0 && { maxTokens: call.maxTokens }
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
...summaryFields(agg),
|
|
134
|
+
dataPoints,
|
|
135
|
+
callDataPoints
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function groupMessagesByModel(messagesWithStats) {
|
|
139
|
+
const modelBuckets = /* @__PURE__ */ new Map();
|
|
140
|
+
for (const message of messagesWithStats) {
|
|
141
|
+
const key = getModelGroupKey(getStatsIdentity(message.stats));
|
|
142
|
+
const existing = modelBuckets.get(key) ?? [];
|
|
143
|
+
modelBuckets.set(key, [...existing, message]);
|
|
144
|
+
}
|
|
145
|
+
return modelBuckets;
|
|
146
|
+
}
|
|
147
|
+
function computeSessionStats(messages) {
|
|
148
|
+
const messagesWithStats = filterWithStats(messages);
|
|
149
|
+
if (messagesWithStats.length === 0) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
const modelGroups = Array.from(groupMessagesByModel(messagesWithStats).entries()).map(
|
|
153
|
+
([, groupMessages]) => {
|
|
154
|
+
const identity = getStatsIdentity(groupMessages[0].stats);
|
|
155
|
+
return {
|
|
156
|
+
...identity,
|
|
157
|
+
key: getModelGroupKey(identity),
|
|
158
|
+
label: getModelGroupLabel(identity),
|
|
159
|
+
...buildSessionStats(groupMessages)
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
return {
|
|
164
|
+
...buildSessionStats(messagesWithStats),
|
|
165
|
+
modelGroups
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function computeSessionStatsSummary(messages) {
|
|
169
|
+
const messagesWithStats = filterWithStats(messages);
|
|
170
|
+
if (messagesWithStats.length === 0) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
const modelGroups = Array.from(groupMessagesByModel(messagesWithStats).entries()).map(
|
|
174
|
+
([, groupMessages]) => {
|
|
175
|
+
const identity = getStatsIdentity(groupMessages[0].stats);
|
|
176
|
+
return buildModelSummary(identity, groupMessages);
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
return {
|
|
180
|
+
...summaryFields(aggregateMessages(messagesWithStats)),
|
|
181
|
+
modelGroups
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function mergeLiveStats(base, live) {
|
|
185
|
+
const prefillSource = live.prefTokenIncrement ?? live.prefillTokens;
|
|
186
|
+
const prefillTime = live.prefillSpeed > 0 ? prefillSource / live.prefillSpeed : 0;
|
|
187
|
+
const genTime = live.generationSpeed > 0 ? live.generationTokens / live.generationSpeed : 0;
|
|
188
|
+
const liveCalls = live.llmCalls?.length ?? 0;
|
|
189
|
+
const identity = getStatsIdentity(live);
|
|
190
|
+
const key = getModelGroupKey(identity);
|
|
191
|
+
const mergedAgg = {
|
|
192
|
+
totalTime: (base?.totalTime ?? 0) + live.totalTime,
|
|
193
|
+
toolTime: (base?.toolTime ?? 0) + live.toolTime,
|
|
194
|
+
prefillTokens: (base?.prefillTokens ?? 0) + live.prefillTokens,
|
|
195
|
+
generationTokens: (base?.generationTokens ?? 0) + live.generationTokens,
|
|
196
|
+
totalPrefillSource: (base?.totalPrefillSource ?? 0) + prefillSource,
|
|
197
|
+
totalPrefillTime: (base?.totalPrefillTime ?? 0) + prefillTime,
|
|
198
|
+
totalGenTime: (base?.totalGenTime ?? 0) + genTime,
|
|
199
|
+
responseCount: (base?.responseCount ?? 0) + 1,
|
|
200
|
+
llmCallCount: (base?.llmCallCount ?? 0) + liveCalls
|
|
201
|
+
};
|
|
202
|
+
const modelGroups = (base?.modelGroups ?? []).map((group) => {
|
|
203
|
+
if (group.key !== key) return group;
|
|
204
|
+
const groupAgg = {
|
|
205
|
+
totalTime: group.totalTime + live.totalTime,
|
|
206
|
+
toolTime: group.toolTime + live.toolTime,
|
|
207
|
+
prefillTokens: group.prefillTokens + live.prefillTokens,
|
|
208
|
+
generationTokens: group.generationTokens + live.generationTokens,
|
|
209
|
+
totalPrefillSource: group.totalPrefillSource + prefillSource,
|
|
210
|
+
totalPrefillTime: group.totalPrefillTime + prefillTime,
|
|
211
|
+
totalGenTime: group.totalGenTime + genTime,
|
|
212
|
+
responseCount: group.responseCount + 1,
|
|
213
|
+
llmCallCount: group.llmCallCount + liveCalls
|
|
214
|
+
};
|
|
215
|
+
return { ...group, ...summaryFields(groupAgg) };
|
|
216
|
+
});
|
|
217
|
+
if (!modelGroups.some((group) => group.key === key)) {
|
|
218
|
+
modelGroups.push(buildModelSummary(identity, [{ id: "live", timestamp: (/* @__PURE__ */ new Date()).toISOString(), stats: live }]));
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
...summaryFields(mergedAgg),
|
|
222
|
+
modelGroups
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export {
|
|
227
|
+
computeSessionStats,
|
|
228
|
+
computeSessionStatsSummary,
|
|
229
|
+
mergeLiveStats
|
|
230
|
+
};
|
|
231
|
+
//# sourceMappingURL=chunk-NHHC3AVI.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
buildSnapshot,
|
|
3
3
|
foldSessionState,
|
|
4
4
|
trimSnapshotStreamingOutput
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-CPRBMVI7.js";
|
|
6
6
|
import {
|
|
7
7
|
SETTINGS_KEYS
|
|
8
8
|
} from "./chunk-X6SWZEK7.js";
|
|
@@ -1059,4 +1059,4 @@ export {
|
|
|
1059
1059
|
initEventStore,
|
|
1060
1060
|
getEventStore
|
|
1061
1061
|
};
|
|
1062
|
-
//# sourceMappingURL=chunk-
|
|
1062
|
+
//# sourceMappingURL=chunk-NZBO3A3W.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
combineEventsWithSnapshot
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5JGRKNMS.js";
|
|
4
4
|
import {
|
|
5
5
|
getEventStore
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NZBO3A3W.js";
|
|
7
7
|
import {
|
|
8
8
|
buildMessagesFromStoredEvents,
|
|
9
9
|
foldPendingConfirmations
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CPRBMVI7.js";
|
|
11
11
|
import {
|
|
12
12
|
updateSessionMetadata
|
|
13
13
|
} from "./chunk-CCIG3YLG.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
createContextStateMessage,
|
|
22
22
|
createSessionStateMessage
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-2PGRX4RH.js";
|
|
24
24
|
import {
|
|
25
25
|
getMaxVisibleItems
|
|
26
26
|
} from "./chunk-X6SWZEK7.js";
|
|
@@ -219,4 +219,4 @@ export {
|
|
|
219
219
|
needsNameGeneration,
|
|
220
220
|
generateSessionNameForSession
|
|
221
221
|
};
|
|
222
|
-
//# sourceMappingURL=chunk-
|
|
222
|
+
//# sourceMappingURL=chunk-ORIPUMOQ.js.map
|
|
@@ -2,21 +2,21 @@ import {
|
|
|
2
2
|
generateSessionNameForSession,
|
|
3
3
|
getSessionMessageCount,
|
|
4
4
|
needsNameGeneration
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ORIPUMOQ.js";
|
|
6
6
|
import {
|
|
7
7
|
launchWorkflowRun
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7BIGFGU5.js";
|
|
9
9
|
import {
|
|
10
10
|
runChatTurn
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-5D4MQG7P.js";
|
|
12
12
|
import {
|
|
13
13
|
applyDynamicContext,
|
|
14
14
|
computeSessionHash,
|
|
15
15
|
computeUnifiedDiff
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-L43S7FJM.js";
|
|
17
17
|
import {
|
|
18
18
|
devServerManager
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-QR6FIHIP.js";
|
|
20
20
|
import {
|
|
21
21
|
gitSpawnEnv
|
|
22
22
|
} from "./chunk-J7GAZGZT.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from "./chunk-X7ZAP6YW.js";
|
|
26
26
|
import {
|
|
27
27
|
appendCompactionPrompt
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-P7KUU5VB.js";
|
|
29
29
|
import {
|
|
30
30
|
hasRecentLLMFailure,
|
|
31
31
|
interruptLLMRetryWait
|
|
@@ -38,14 +38,15 @@ import {
|
|
|
38
38
|
} from "./chunk-I72ACQ6R.js";
|
|
39
39
|
import {
|
|
40
40
|
combineEventsWithSnapshot
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-5JGRKNMS.js";
|
|
42
42
|
import {
|
|
43
43
|
getEventStore
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-NZBO3A3W.js";
|
|
45
45
|
import {
|
|
46
46
|
buildMessagesFromStoredEvents,
|
|
47
|
+
buildSessionStatsMessages,
|
|
47
48
|
foldPendingConfirmations
|
|
48
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-CPRBMVI7.js";
|
|
49
50
|
import {
|
|
50
51
|
getRuntimeConfig
|
|
51
52
|
} from "./chunk-YEW4YEJU.js";
|
|
@@ -68,7 +69,7 @@ import {
|
|
|
68
69
|
parseClientMessage,
|
|
69
70
|
serializeServerMessage,
|
|
70
71
|
storedEventToServerMessage
|
|
71
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-2PGRX4RH.js";
|
|
72
73
|
import {
|
|
73
74
|
getPlatformShell
|
|
74
75
|
} from "./chunk-YEFZ5HBD.js";
|
|
@@ -78,9 +79,12 @@ import {
|
|
|
78
79
|
import {
|
|
79
80
|
logger
|
|
80
81
|
} from "./chunk-K44MW7JJ.js";
|
|
82
|
+
import {
|
|
83
|
+
computeSessionStatsSummary
|
|
84
|
+
} from "./chunk-NHHC3AVI.js";
|
|
81
85
|
import {
|
|
82
86
|
createServerMessage
|
|
83
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-Q6MBLKL4.js";
|
|
84
88
|
|
|
85
89
|
// src/server/ws/server.ts
|
|
86
90
|
import { WebSocketServer, WebSocket as WebSocket2 } from "ws";
|
|
@@ -938,6 +942,7 @@ function createWebSocketServer(httpServer, _config, getLLMClient, getActiveProvi
|
|
|
938
942
|
const events = combineEventsWithSnapshot(updatedSession.id, snapshot, eventsSinceSnapshot);
|
|
939
943
|
const maxVisible = getMaxVisibleItems();
|
|
940
944
|
const { messages, hiddenCount } = buildMessagesFromStoredEvents(events, maxVisible || void 0);
|
|
945
|
+
const sessionStats = computeSessionStatsSummary(buildSessionStatsMessages(events));
|
|
941
946
|
const pendingConfirmations = foldPendingConfirmations(events);
|
|
942
947
|
const pendingQuestions = getPendingQuestionsForSession(updatedSession.id);
|
|
943
948
|
const activeWorkflowExecution = sessionManager.getDisplayWorkflowExecution(updatedSession.id);
|
|
@@ -965,7 +970,8 @@ function createWebSocketServer(httpServer, _config, getLLMClient, getActiveProvi
|
|
|
965
970
|
void 0,
|
|
966
971
|
void 0,
|
|
967
972
|
hiddenCount,
|
|
968
|
-
activeWorkflowExecution ?? void 0
|
|
973
|
+
activeWorkflowExecution ?? void 0,
|
|
974
|
+
sessionStats
|
|
969
975
|
)
|
|
970
976
|
);
|
|
971
977
|
if (effectiveWorkdir) {
|
|
@@ -1352,7 +1358,7 @@ async function handleClientMessage(ws, client, message, _getLLMClient, _getActiv
|
|
|
1352
1358
|
}
|
|
1353
1359
|
const session = sessionManager.requireSession(sessionId);
|
|
1354
1360
|
try {
|
|
1355
|
-
const { buildCachedPrompt, computePreviewToolDiff } = await import("./dynamic-context-
|
|
1361
|
+
const { buildCachedPrompt, computePreviewToolDiff } = await import("./dynamic-context-IQUBKUCX.js");
|
|
1356
1362
|
const allAgents = await import("./registry-24U5BZAJ.js");
|
|
1357
1363
|
const agentDef = allAgents.findAgentById(session.mode, await allAgents.loadAllAgentsDefault()) ?? allAgents.findAgentById("planner", await allAgents.loadAllAgentsDefault());
|
|
1358
1364
|
const modelName = session.providerModel ?? _providerManager?.getCurrentModel();
|
|
@@ -1364,7 +1370,7 @@ async function handleClientMessage(ws, client, message, _getLLMClient, _getActiv
|
|
|
1364
1370
|
const oldCached = sessionManager.getCachedPrompt(sessionId);
|
|
1365
1371
|
const oldPrompt = oldCached?.systemPrompt;
|
|
1366
1372
|
const diff = oldPrompt ? computeUnifiedDiff(oldPrompt, newPrompt) : [];
|
|
1367
|
-
const { getToolRegistryForAgent } = await import("./tools-
|
|
1373
|
+
const { getToolRegistryForAgent } = await import("./tools-OH3WW6Q4.js");
|
|
1368
1374
|
const unfilteredTools = getToolRegistryForAgent(agentDef).definitions;
|
|
1369
1375
|
const toolDiff = computePreviewToolDiff(oldCached?.tools, unfilteredTools, newTools);
|
|
1370
1376
|
send({
|
|
@@ -1737,4 +1743,4 @@ export {
|
|
|
1737
1743
|
signalMcpReady,
|
|
1738
1744
|
createWebSocketServer
|
|
1739
1745
|
};
|
|
1740
|
-
//# sourceMappingURL=chunk-
|
|
1746
|
+
//# sourceMappingURL=chunk-OS4P2KQJ.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-ZONLEX2F.js";
|
|
7
7
|
import {
|
|
8
8
|
getCurrentWindowMessageOptions
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-5JGRKNMS.js";
|
|
10
10
|
|
|
11
11
|
// src/server/context/compactor.ts
|
|
12
12
|
function appendCompactionPrompt(sessionId, append) {
|
|
@@ -36,4 +36,4 @@ export {
|
|
|
36
36
|
COMPACTION_MAX_RATIO,
|
|
37
37
|
shouldCompact
|
|
38
38
|
};
|
|
39
|
-
//# sourceMappingURL=chunk-
|
|
39
|
+
//# sourceMappingURL=chunk-P7KUU5VB.js.map
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
requireSession,
|
|
37
37
|
validateActionWithPermission,
|
|
38
38
|
validateFileForWrite
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-KJEOKIH2.js";
|
|
40
40
|
import {
|
|
41
41
|
serverT
|
|
42
42
|
} from "./chunk-X7ZAP6YW.js";
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
extractAbsolutePathsFromCommand,
|
|
46
46
|
extractSensitivePathsFromCommand,
|
|
47
47
|
resolveRelativeTraversals
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-CVQYCAMY.js";
|
|
49
49
|
import {
|
|
50
50
|
TurnMetrics,
|
|
51
51
|
clearLLMFailure,
|
|
@@ -95,10 +95,10 @@ import {
|
|
|
95
95
|
import {
|
|
96
96
|
getCurrentContextWindowId,
|
|
97
97
|
getCurrentWindowMessageOptions
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-5JGRKNMS.js";
|
|
99
99
|
import {
|
|
100
100
|
getEventStore
|
|
101
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-NZBO3A3W.js";
|
|
102
102
|
import {
|
|
103
103
|
buildContextMessagesFromEventHistory,
|
|
104
104
|
foldContextState,
|
|
@@ -108,7 +108,7 @@ import {
|
|
|
108
108
|
handleToolResult,
|
|
109
109
|
reorderToolMessages,
|
|
110
110
|
stripOrphanedToolCalls
|
|
111
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-CPRBMVI7.js";
|
|
112
112
|
import {
|
|
113
113
|
findAgentById,
|
|
114
114
|
getRuntimeConfig,
|
|
@@ -127,7 +127,7 @@ import {
|
|
|
127
127
|
createChatMessageUpdatedMessage,
|
|
128
128
|
createChatStatsMessage,
|
|
129
129
|
createQueueStateMessage
|
|
130
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-2PGRX4RH.js";
|
|
131
131
|
import {
|
|
132
132
|
getModelProfile,
|
|
133
133
|
modelSupportsVision
|
|
@@ -792,14 +792,42 @@ function executeCommand(command, cwd, timeout, signal, onProgress) {
|
|
|
792
792
|
let stderr = "";
|
|
793
793
|
let timedOut = false;
|
|
794
794
|
let aborted = false;
|
|
795
|
+
let exitCode = null;
|
|
795
796
|
let exited = false;
|
|
797
|
+
let settled = false;
|
|
798
|
+
let graceTimer;
|
|
799
|
+
const ZOMBIE_PIPE_GRACE_MS = 2e3;
|
|
800
|
+
const settle = (code, appendix) => {
|
|
801
|
+
if (settled) return;
|
|
802
|
+
settled = true;
|
|
803
|
+
clearTimeout(timer);
|
|
804
|
+
if (graceTimer !== void 0) clearTimeout(graceTimer);
|
|
805
|
+
signal?.removeEventListener("abort", onAbort);
|
|
806
|
+
const out = (stdout + stdoutDecoder.end()).trim();
|
|
807
|
+
resolve3({
|
|
808
|
+
stdout: appendix ? out ? `${out}
|
|
809
|
+
|
|
810
|
+
${appendix}` : appendix : out,
|
|
811
|
+
stderr: (stderr + stderrDecoder.end()).trim(),
|
|
812
|
+
exitCode: code
|
|
813
|
+
});
|
|
814
|
+
};
|
|
796
815
|
const timer = setTimeout(() => {
|
|
797
816
|
timedOut = true;
|
|
817
|
+
if (exited) {
|
|
818
|
+
settle(124, `[Exit code: 124]
|
|
819
|
+
[Process timed out after ${timeout}ms]`);
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
798
822
|
void terminateProcessTree(proc, { exited: () => exited });
|
|
799
823
|
}, timeout);
|
|
800
824
|
const onAbort = () => {
|
|
801
825
|
if (!timedOut && !aborted) {
|
|
802
826
|
aborted = true;
|
|
827
|
+
if (exited) {
|
|
828
|
+
settle(130, "[interrupted by user]");
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
803
831
|
void terminateProcessTree(proc, { exited: () => exited, immediate: true });
|
|
804
832
|
}
|
|
805
833
|
};
|
|
@@ -814,32 +842,28 @@ function executeCommand(command, cwd, timeout, signal, onProgress) {
|
|
|
814
842
|
stderr += text;
|
|
815
843
|
onProgress?.(`[stderr] ${text}`);
|
|
816
844
|
});
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
stdout: appendix ? out ? `${out}
|
|
821
|
-
|
|
822
|
-
${appendix}` : appendix : out,
|
|
823
|
-
stderr: (stderr + stderrDecoder.end()).trim(),
|
|
824
|
-
exitCode
|
|
825
|
-
});
|
|
826
|
-
};
|
|
827
|
-
proc.on("exit", () => {
|
|
845
|
+
proc.on("exit", (code) => {
|
|
846
|
+
exitCode = code;
|
|
847
|
+
exited = true;
|
|
828
848
|
if (aborted) {
|
|
829
|
-
clearTimeout(timer);
|
|
830
|
-
signal?.removeEventListener("abort", onAbort);
|
|
831
849
|
settle(130, "[interrupted by user]");
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
if (timedOut) {
|
|
835
853
|
settle(124, `[Exit code: 124]
|
|
836
854
|
[Process timed out after ${timeout}ms]`);
|
|
855
|
+
return;
|
|
837
856
|
}
|
|
857
|
+
graceTimer = setTimeout(() => {
|
|
858
|
+
settle(
|
|
859
|
+
exitCode ?? 1,
|
|
860
|
+
"[Shell exited, but a background process still held the output pipes open, so output may be incomplete]"
|
|
861
|
+
);
|
|
862
|
+
}, ZOMBIE_PIPE_GRACE_MS);
|
|
838
863
|
});
|
|
839
864
|
proc.on("close", (code) => {
|
|
840
865
|
exited = true;
|
|
841
|
-
clearTimeout(
|
|
842
|
-
signal?.removeEventListener("abort", onAbort);
|
|
866
|
+
if (graceTimer !== void 0) clearTimeout(graceTimer);
|
|
843
867
|
if (timedOut) {
|
|
844
868
|
settle(124, `[Exit code: 124]
|
|
845
869
|
[Process timed out after ${timeout}ms]`);
|
|
@@ -849,10 +873,11 @@ ${appendix}` : appendix : out,
|
|
|
849
873
|
settle(130, "[interrupted by user]");
|
|
850
874
|
return;
|
|
851
875
|
}
|
|
852
|
-
settle(code ?? 1);
|
|
876
|
+
settle(code ?? exitCode ?? 1);
|
|
853
877
|
});
|
|
854
878
|
proc.on("error", (error) => {
|
|
855
879
|
clearTimeout(timer);
|
|
880
|
+
if (graceTimer !== void 0) clearTimeout(graceTimer);
|
|
856
881
|
signal?.removeEventListener("abort", onAbort);
|
|
857
882
|
reject(error);
|
|
858
883
|
});
|
|
@@ -1733,7 +1758,7 @@ ${CONTINUE_PROMPT}` : CONTINUE_PROMPT;
|
|
|
1733
1758
|
currentMaxTokensOverride = void 0;
|
|
1734
1759
|
if (!compacting) {
|
|
1735
1760
|
const contextState = sessionManager.getContextState(sessionId);
|
|
1736
|
-
const { shouldCompact, appendCompactionPrompt } = await import("./compactor-
|
|
1761
|
+
const { shouldCompact, appendCompactionPrompt } = await import("./compactor-YY7PO2XE.js");
|
|
1737
1762
|
if (shouldCompact(
|
|
1738
1763
|
contextState.currentTokens,
|
|
1739
1764
|
contextState.maxTokens,
|
|
@@ -2450,7 +2475,7 @@ var callSubAgentTool = {
|
|
|
2450
2475
|
};
|
|
2451
2476
|
}
|
|
2452
2477
|
try {
|
|
2453
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
2478
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-OH3WW6Q4.js");
|
|
2454
2479
|
const toolRegistry = getToolRegistryForAgent2(agentDef);
|
|
2455
2480
|
const turnMetrics = new TurnMetrics();
|
|
2456
2481
|
const result = await executeSubAgent({
|
|
@@ -3554,11 +3579,11 @@ var mcpConfigTool = createTool(
|
|
|
3554
3579
|
async function notifyContextChanged(sessionId) {
|
|
3555
3580
|
context.sessionManager.setDynamicContextChanged(sessionId, true);
|
|
3556
3581
|
mcpNotifyChanged?.(sessionId);
|
|
3557
|
-
const { injectContextDriftReminders } = await import("./dynamic-context-
|
|
3582
|
+
const { injectContextDriftReminders } = await import("./dynamic-context-IQUBKUCX.js");
|
|
3558
3583
|
await injectContextDriftReminders(context.sessionManager, sessionId);
|
|
3559
3584
|
}
|
|
3560
3585
|
async function rebuildTools() {
|
|
3561
|
-
const { setMcpTools: setMcpTools2 } = await import("./tools-
|
|
3586
|
+
const { setMcpTools: setMcpTools2 } = await import("./tools-OH3WW6Q4.js");
|
|
3562
3587
|
const mcpTools = createMcpTools(mcpManagerForTools);
|
|
3563
3588
|
setMcpTools2(mcpTools);
|
|
3564
3589
|
}
|
|
@@ -4700,4 +4725,4 @@ export {
|
|
|
4700
4725
|
getToolRegistryForAgent,
|
|
4701
4726
|
createToolRegistry
|
|
4702
4727
|
};
|
|
4703
|
-
//# sourceMappingURL=chunk-
|
|
4728
|
+
//# sourceMappingURL=chunk-QR6FIHIP.js.map
|
package/dist/cli/dev.js
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
COMPACTION_MAX_RATIO,
|
|
4
4
|
appendCompactionPrompt,
|
|
5
5
|
shouldCompact
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-P7KUU5VB.js";
|
|
7
7
|
import "./chunk-FAN4P45J.js";
|
|
8
8
|
import "./chunk-ZONLEX2F.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-5JGRKNMS.js";
|
|
10
|
+
import "./chunk-NZBO3A3W.js";
|
|
11
|
+
import "./chunk-CPRBMVI7.js";
|
|
12
12
|
import "./chunk-CCIG3YLG.js";
|
|
13
13
|
import "./chunk-YEW4YEJU.js";
|
|
14
14
|
import "./chunk-OSXPQSLW.js";
|
|
@@ -32,4 +32,4 @@ export {
|
|
|
32
32
|
appendCompactionPrompt,
|
|
33
33
|
shouldCompact
|
|
34
34
|
};
|
|
35
|
-
//# sourceMappingURL=compactor-
|
|
35
|
+
//# sourceMappingURL=compactor-YY7PO2XE.js.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
describeImageTool,
|
|
3
3
|
isDescribeImageEligible
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KJEOKIH2.js";
|
|
5
5
|
import "./chunk-X7ZAP6YW.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-CVQYCAMY.js";
|
|
7
|
+
import "./chunk-5JGRKNMS.js";
|
|
8
|
+
import "./chunk-NZBO3A3W.js";
|
|
9
|
+
import "./chunk-CPRBMVI7.js";
|
|
10
10
|
import "./chunk-CCIG3YLG.js";
|
|
11
11
|
import "./chunk-YEW4YEJU.js";
|
|
12
12
|
import "./chunk-OSXPQSLW.js";
|
|
13
13
|
import "./chunk-V5AC2TV7.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-2PGRX4RH.js";
|
|
15
15
|
import "./chunk-LCLH6ZUL.js";
|
|
16
16
|
import "./chunk-YEFZ5HBD.js";
|
|
17
17
|
import "./chunk-JYYBSODN.js";
|
|
@@ -20,7 +20,7 @@ import "./chunk-FSSUPWYO.js";
|
|
|
20
20
|
import "./chunk-X6SWZEK7.js";
|
|
21
21
|
import "./chunk-WOVWVB5J.js";
|
|
22
22
|
import "./chunk-K44MW7JJ.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-Q6MBLKL4.js";
|
|
24
24
|
import "./chunk-24YKXKCG.js";
|
|
25
25
|
import "./chunk-CQGTEGKL.js";
|
|
26
26
|
import "./chunk-YLJ4XMA6.js";
|
|
@@ -28,4 +28,4 @@ export {
|
|
|
28
28
|
describeImageTool,
|
|
29
29
|
isDescribeImageEligible
|
|
30
30
|
};
|
|
31
|
-
//# sourceMappingURL=describe-image-
|
|
31
|
+
//# sourceMappingURL=describe-image-Z5WS6YU3.js.map
|