blun-king-cli 9.1.350 → 9.1.352

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 +62 -3
  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));
@@ -507179,6 +507207,9 @@ var SubAgentEventHandler = class {
507179
507207
  subagentInfo = /* @__PURE__ */ new Map();
507180
507208
  agentSwarmProgress = /* @__PURE__ */ new Map();
507181
507209
  backgroundAgentMetadata = /* @__PURE__ */ new Map();
507210
+ swarmDeltaRenderTimer;
507211
+ lastSwarmDeltaFlushAt;
507212
+ pendingSwarmDeltaChars = 0;
507182
507213
  constructor(host, deps) {
507183
507214
  this.host = host;
507184
507215
  this.deps = deps;
@@ -507201,7 +507232,11 @@ var SubAgentEventHandler = class {
507201
507232
  const swarmProgress = this.agentSwarmProgress.get(parentToolCallId);
507202
507233
  if (swarmProgress !== void 0) {
507203
507234
  this.applySubagentEventToSwarmProgress(swarmProgress, event, childAgentId);
507204
- this.requestRender();
507235
+ if (event.type === "assistant.delta" || event.type === "thinking.delta") this.scheduleSwarmDeltaRender(event.delta.length);
507236
+ else {
507237
+ this.clearSwarmDeltaRenderTimer();
507238
+ this.requestRender();
507239
+ }
507205
507240
  return true;
507206
507241
  }
507207
507242
  const toolCall = this.host.streamingUI.getToolComponent(parentToolCallId);
@@ -507236,6 +507271,29 @@ var SubAgentEventHandler = class {
507236
507271
  }
507237
507272
  return true;
507238
507273
  }
507274
+ scheduleSwarmDeltaRender(deltaChars) {
507275
+ this.pendingSwarmDeltaChars += deltaChars;
507276
+ if (this.swarmDeltaRenderTimer !== void 0) return;
507277
+ const interval = resolveStreamingFlushInterval({ assistantChars: this.pendingSwarmDeltaChars });
507278
+ const delay = this.lastSwarmDeltaFlushAt === void 0 ? 0 : Math.max(0, interval - (Date.now() - this.lastSwarmDeltaFlushAt));
507279
+ this.swarmDeltaRenderTimer = setTimeout(() => {
507280
+ this.swarmDeltaRenderTimer = void 0;
507281
+ this.flushPendingSwarmDeltaRender();
507282
+ }, delay);
507283
+ }
507284
+ flushPendingSwarmDeltaRender() {
507285
+ if (this.pendingSwarmDeltaChars === 0) return;
507286
+ this.pendingSwarmDeltaChars = 0;
507287
+ this.lastSwarmDeltaFlushAt = Date.now();
507288
+ this.requestRender();
507289
+ }
507290
+ clearSwarmDeltaRenderTimer() {
507291
+ if (this.swarmDeltaRenderTimer !== void 0) {
507292
+ clearTimeout(this.swarmDeltaRenderTimer);
507293
+ this.swarmDeltaRenderTimer = void 0;
507294
+ }
507295
+ this.pendingSwarmDeltaChars = 0;
507296
+ }
507239
507297
  handleLifecycleEvent(event) {
507240
507298
  switch (event.type) {
507241
507299
  case "subagent.spawned":
@@ -507256,6 +507314,7 @@ var SubAgentEventHandler = class {
507256
507314
  }
507257
507315
  }
507258
507316
  clearAgentSwarmProgress() {
507317
+ this.clearSwarmDeltaRenderTimer();
507259
507318
  for (const progress of this.agentSwarmProgress.values()) progress.dispose();
507260
507319
  this.agentSwarmProgress.clear();
507261
507320
  this.host.updateActivityPane();
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.352",
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": {