blun-king-cli 9.1.344 → 9.1.345
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.
|
@@ -0,0 +1,24 @@
|
|
|
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(safeChars(input.assistantChars), safeChars(input.thinkingChars));
|
|
13
|
+
if (chars <= SHORT_STREAM_MAX_CHARS) return 50;
|
|
14
|
+
if (chars <= MEDIUM_STREAM_MAX_CHARS) return 100;
|
|
15
|
+
if (chars <= LONG_STREAM_MAX_CHARS) return 250;
|
|
16
|
+
return 500;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = {
|
|
20
|
+
LONG_STREAM_MAX_CHARS,
|
|
21
|
+
MEDIUM_STREAM_MAX_CHARS,
|
|
22
|
+
SHORT_STREAM_MAX_CHARS,
|
|
23
|
+
resolveStreamingFlushInterval,
|
|
24
|
+
};
|
package/blun.mjs
CHANGED
|
@@ -511414,7 +511414,11 @@ var StreamingUIController = class {
|
|
|
511414
511414
|
scheduleFlush() {
|
|
511415
511415
|
if (!this.hasPending()) return;
|
|
511416
511416
|
if (this.flushTimer !== void 0) return;
|
|
511417
|
-
const
|
|
511417
|
+
const flushIntervalMs = resolveStreamingFlushInterval({
|
|
511418
|
+
assistantChars: this._assistantDraft.length,
|
|
511419
|
+
thinkingChars: this._thinkingDraft.length
|
|
511420
|
+
});
|
|
511421
|
+
const delay = this.lastFlushAt === void 0 ? 0 : Math.max(0, flushIntervalMs - (Date.now() - this.lastFlushAt));
|
|
511418
511422
|
this.flushTimer = setTimeout(() => {
|
|
511419
511423
|
this.flushTimer = void 0;
|
|
511420
511424
|
this.flush();
|
|
@@ -515913,6 +515917,7 @@ const {
|
|
|
515913
515917
|
readRunningUpdateMode,
|
|
515914
515918
|
writeRunningUpdateMode
|
|
515915
515919
|
} = __require("./bin/running-update-preference.cjs");
|
|
515920
|
+
const { resolveStreamingFlushInterval } = __require("./bin/streaming-flush-performance-policy.cjs");
|
|
515916
515921
|
const RUNNING_UPDATE_RESUME_SESSION_ENV = "BLUN_RUNNING_UPDATE_RESUME_SESSION_ID";
|
|
515917
515922
|
function shouldContinueActiveGoalAfterRunningUpdate(expectedSessionId, currentSessionId, goalStatus) {
|
|
515918
515923
|
return typeof expectedSessionId === "string" && expectedSessionId.length > 0 && currentSessionId === expectedSessionId && goalStatus === "active";
|