blun-king-cli 9.1.344 → 9.1.346
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/bin/streaming-flush-performance-policy.cjs +28 -0
- package/blun.mjs +12 -1
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const SHORT_STREAM_MAX_CHARS = 8_192;
|
|
4
|
+
const MEDIUM_STREAM_MAX_CHARS = 32_768;
|
|
5
|
+
const LONG_STREAM_MAX_CHARS = 131_072;
|
|
6
|
+
|
|
7
|
+
function safeChars(value) {
|
|
8
|
+
return Number.isFinite(value) && value > 0 ? Math.floor(value) : 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function resolveStreamingFlushInterval(input = {}) {
|
|
12
|
+
const chars = Math.max(
|
|
13
|
+
safeChars(input.assistantChars),
|
|
14
|
+
safeChars(input.thinkingChars),
|
|
15
|
+
safeChars(input.toolCallChars),
|
|
16
|
+
);
|
|
17
|
+
if (chars <= SHORT_STREAM_MAX_CHARS) return 50;
|
|
18
|
+
if (chars <= MEDIUM_STREAM_MAX_CHARS) return 100;
|
|
19
|
+
if (chars <= LONG_STREAM_MAX_CHARS) return 250;
|
|
20
|
+
return 500;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = {
|
|
24
|
+
LONG_STREAM_MAX_CHARS,
|
|
25
|
+
MEDIUM_STREAM_MAX_CHARS,
|
|
26
|
+
SHORT_STREAM_MAX_CHARS,
|
|
27
|
+
resolveStreamingFlushInterval,
|
|
28
|
+
};
|
package/blun.mjs
CHANGED
|
@@ -511411,10 +511411,20 @@ var StreamingUIController = class {
|
|
|
511411
511411
|
this.pendingThinkingFlush = false;
|
|
511412
511412
|
this.pendingToolCallFlushIds.clear();
|
|
511413
511413
|
}
|
|
511414
|
+
getStreamingToolCallArgumentChars() {
|
|
511415
|
+
let chars = 0;
|
|
511416
|
+
for (const streaming of this._streamingToolCallArguments.values()) chars += streaming.argumentsText.length;
|
|
511417
|
+
return chars;
|
|
511418
|
+
}
|
|
511414
511419
|
scheduleFlush() {
|
|
511415
511420
|
if (!this.hasPending()) return;
|
|
511416
511421
|
if (this.flushTimer !== void 0) return;
|
|
511417
|
-
const
|
|
511422
|
+
const flushIntervalMs = resolveStreamingFlushInterval({
|
|
511423
|
+
assistantChars: this._assistantDraft.length,
|
|
511424
|
+
thinkingChars: this._thinkingDraft.length,
|
|
511425
|
+
toolCallChars: this.getStreamingToolCallArgumentChars()
|
|
511426
|
+
});
|
|
511427
|
+
const delay = this.lastFlushAt === void 0 ? 0 : Math.max(0, flushIntervalMs - (Date.now() - this.lastFlushAt));
|
|
511418
511428
|
this.flushTimer = setTimeout(() => {
|
|
511419
511429
|
this.flushTimer = void 0;
|
|
511420
511430
|
this.flush();
|
|
@@ -515913,6 +515923,7 @@ const {
|
|
|
515913
515923
|
readRunningUpdateMode,
|
|
515914
515924
|
writeRunningUpdateMode
|
|
515915
515925
|
} = __require("./bin/running-update-preference.cjs");
|
|
515926
|
+
const { resolveStreamingFlushInterval } = __require("./bin/streaming-flush-performance-policy.cjs");
|
|
515916
515927
|
const RUNNING_UPDATE_RESUME_SESSION_ENV = "BLUN_RUNNING_UPDATE_RESUME_SESSION_ID";
|
|
515917
515928
|
function shouldContinueActiveGoalAfterRunningUpdate(expectedSessionId, currentSessionId, goalStatus) {
|
|
515918
515929
|
return typeof expectedSessionId === "string" && expectedSessionId.length > 0 && currentSessionId === expectedSessionId && goalStatus === "active";
|