blun-king-cli 9.1.350 → 9.1.351

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.
Files changed (2) hide show
  1. package/blun.mjs +30 -2
  2. package/package.json +1 -1
package/blun.mjs CHANGED
@@ -502888,6 +502888,8 @@ var BtwPanelComponent = class {
502888
502888
  maxScrollTop = 0;
502889
502889
  spinnerFrame = 0;
502890
502890
  liveStatusTimer;
502891
+ streamingRenderTimer;
502892
+ lastStreamingFlushAt;
502891
502893
  constructor(options) {
502892
502894
  this.options = options;
502893
502895
  }
@@ -502915,13 +502917,38 @@ var BtwPanelComponent = class {
502915
502917
  const turn = this.currentTurn();
502916
502918
  if (turn === void 0) return;
502917
502919
  turn.answer += delta;
502920
+ this.scheduleStreamingRender();
502918
502921
  }
502919
502922
  appendThinking(delta) {
502920
502923
  const turn = this.currentTurn();
502921
502924
  if (turn === void 0) return;
502922
502925
  turn.thinking += delta;
502926
+ this.scheduleStreamingRender();
502927
+ }
502928
+ scheduleStreamingRender() {
502929
+ if (this.streamingRenderTimer !== void 0) return;
502930
+ const turn = this.currentTurn();
502931
+ const interval = resolveStreamingFlushInterval({
502932
+ assistantChars: turn?.answer.length ?? 0,
502933
+ thinkingChars: turn?.thinking.length ?? 0
502934
+ });
502935
+ const delay = this.lastStreamingFlushAt === void 0 ? 0 : Math.max(0, interval - (Date.now() - this.lastStreamingFlushAt));
502936
+ this.streamingRenderTimer = setTimeout(() => {
502937
+ this.streamingRenderTimer = void 0;
502938
+ this.flushPendingStreamingRender();
502939
+ }, delay);
502940
+ }
502941
+ flushPendingStreamingRender() {
502942
+ this.lastStreamingFlushAt = Date.now();
502943
+ this.options.requestRender();
502944
+ }
502945
+ clearStreamingRenderTimer() {
502946
+ if (this.streamingRenderTimer === void 0) return;
502947
+ clearTimeout(this.streamingRenderTimer);
502948
+ this.streamingRenderTimer = void 0;
502923
502949
  }
502924
502950
  restartCurrentTurn(notice) {
502951
+ this.clearStreamingRenderTimer();
502925
502952
  const turn = this.currentTurn();
502926
502953
  if (turn === void 0 || turn.phase !== "running") return;
502927
502954
  turn.startedAtMs = Date.now();
@@ -502932,6 +502959,7 @@ var BtwPanelComponent = class {
502932
502959
  this.transientNotices.push(notice);
502933
502960
  }
502934
502961
  markDone(resultSummary) {
502962
+ this.clearStreamingRenderTimer();
502935
502963
  const turn = this.currentTurn();
502936
502964
  if (turn === void 0) return;
502937
502965
  if (turn.answer.trim().length === 0 && resultSummary !== void 0) turn.answer = resultSummary;
@@ -502940,6 +502968,7 @@ var BtwPanelComponent = class {
502940
502968
  this.stopLiveStatusTimer();
502941
502969
  }
502942
502970
  markFailed(error) {
502971
+ this.clearStreamingRenderTimer();
502943
502972
  const turn = this.currentTurn();
502944
502973
  if (turn === void 0 || turn.phase !== "running") {
502945
502974
  this.turns.push({
@@ -502961,6 +502990,7 @@ var BtwPanelComponent = class {
502961
502990
  }
502962
502991
  invalidate() {}
502963
502992
  dispose() {
502993
+ this.clearStreamingRenderTimer();
502964
502994
  this.stopLiveStatusTimer();
502965
502995
  }
502966
502996
  render(width) {
@@ -503218,12 +503248,10 @@ var BtwPanelController = class {
503218
503248
  case "assistant.delta":
503219
503249
  this.clearInactivityTimer(this.activeForAgent(event.agentId));
503220
503250
  panel.appendAnswer(event.delta);
503221
- this.host.state.ui.requestRender();
503222
503251
  return true;
503223
503252
  case "thinking.delta":
503224
503253
  panel.appendThinking(event.delta);
503225
503254
  this.armInactivityTimer(this.activeForAgent(event.agentId));
503226
- this.host.state.ui.requestRender();
503227
503255
  return true;
503228
503256
  case "hook.result":
503229
503257
  this.clearInactivityTimer(this.activeForAgent(event.agentId));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.350",
3
+ "version": "9.1.351",
4
4
  "description": "BLUN CLI - your own AI agent with a Telegram channel. Get it done. With BLUN.",
5
5
  "license": "MIT",
6
6
  "bin": {