blun-king-cli 9.1.347 → 9.1.348

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 +41 -3
  2. package/package.json +1 -1
package/blun.mjs CHANGED
@@ -493830,6 +493830,9 @@ var ToolCallComponent = class ToolCallComponent extends Container {
493830
493830
  finishedSubCalls = [];
493831
493831
  subToolActivities = /* @__PURE__ */ new Map();
493832
493832
  subToolOrderSeq = 0;
493833
+ pendingSubToolDeltaIds = /* @__PURE__ */ new Set();
493834
+ subToolDeltaRenderTimer;
493835
+ lastSubToolDeltaFlushAt;
493833
493836
  hiddenSubCallCount = 0;
493834
493837
  /**
493835
493838
  * Recent normal-output lines from the child agent. Historical replay can also
@@ -494016,6 +494019,11 @@ var ToolCallComponent = class ToolCallComponent extends Container {
494016
494019
  this.stopStreamingProgressTimer();
494017
494020
  this.stopSubagentElapsedTimer();
494018
494021
  this.stopDetachHintTimer();
494022
+ if (this.subToolDeltaRenderTimer !== void 0) {
494023
+ clearTimeout(this.subToolDeltaRenderTimer);
494024
+ this.subToolDeltaRenderTimer = void 0;
494025
+ }
494026
+ this.pendingSubToolDeltaIds.clear();
494019
494027
  if (this.liveOutputRenderTimer !== void 0) {
494020
494028
  clearTimeout(this.liveOutputRenderTimer);
494021
494029
  this.liveOutputRenderTimer = void 0;
@@ -494428,14 +494436,43 @@ var ToolCallComponent = class ToolCallComponent extends Container {
494428
494436
  appendSubToolCallDelta(delta) {
494429
494437
  const existing = this.ongoingSubCalls.get(delta.id);
494430
494438
  const nextArgsText = appendStreamingArgsPreview(existing?.streamingArguments, delta.argumentsPart);
494431
- const parsed = parseArgsPreview(nextArgsText);
494432
494439
  this.ongoingSubCalls.set(delta.id, {
494433
494440
  name: delta.name ?? existing?.name ?? "Tool",
494434
- args: parsed,
494441
+ args: existing?.args ?? {},
494435
494442
  streamingArguments: nextArgsText
494436
494443
  });
494437
- this.upsertSubToolActivity(delta.id, delta.name ?? existing?.name ?? "Tool", parsed, "ongoing");
494438
494444
  if (this.subagentPhase === void 0 || this.subagentPhase === "queued" || this.subagentPhase === "spawning") this.subagentPhase = "running";
494445
+ this.pendingSubToolDeltaIds.add(delta.id);
494446
+ this.scheduleSubToolDeltaFlush();
494447
+ }
494448
+ scheduleSubToolDeltaFlush() {
494449
+ if (this.subToolDeltaRenderTimer !== void 0) return;
494450
+ let chars = 0;
494451
+ for (const id of this.pendingSubToolDeltaIds) chars += this.ongoingSubCalls.get(id)?.streamingArguments?.length ?? 0;
494452
+ const interval = resolveStreamingFlushInterval({ toolCallChars: chars });
494453
+ const delay = this.lastSubToolDeltaFlushAt === void 0 ? 0 : Math.max(0, interval - (Date.now() - this.lastSubToolDeltaFlushAt));
494454
+ this.subToolDeltaRenderTimer = setTimeout(() => {
494455
+ this.subToolDeltaRenderTimer = void 0;
494456
+ this.flushPendingSubToolDeltas();
494457
+ }, delay);
494458
+ }
494459
+ applyPendingSubToolDelta(id) {
494460
+ if (!this.pendingSubToolDeltaIds.delete(id)) return;
494461
+ const ongoing = this.ongoingSubCalls.get(id);
494462
+ if (ongoing === void 0 || ongoing.streamingArguments === void 0) return;
494463
+ const parsed = parseArgsPreview(ongoing.streamingArguments);
494464
+ ongoing.args = parsed;
494465
+ this.upsertSubToolActivity(id, ongoing.name, parsed, "ongoing");
494466
+ if (this.pendingSubToolDeltaIds.size === 0 && this.subToolDeltaRenderTimer !== void 0) {
494467
+ clearTimeout(this.subToolDeltaRenderTimer);
494468
+ this.subToolDeltaRenderTimer = void 0;
494469
+ }
494470
+ }
494471
+ flushPendingSubToolDeltas() {
494472
+ if (this.pendingSubToolDeltaIds.size === 0) return;
494473
+ const pending = [...this.pendingSubToolDeltaIds];
494474
+ this.lastSubToolDeltaFlushAt = Date.now();
494475
+ for (const id of pending) this.applyPendingSubToolDelta(id);
494439
494476
  this.headerText.setText(this.buildHeader());
494440
494477
  this.rebuildContent();
494441
494478
  this.notifySnapshotChange();
@@ -494456,6 +494493,7 @@ var ToolCallComponent = class ToolCallComponent extends Container {
494456
494493
  this.ui?.requestRender();
494457
494494
  }
494458
494495
  finishSubToolCall(result) {
494496
+ this.applyPendingSubToolDelta(result.tool_call_id);
494459
494497
  const ongoing = this.ongoingSubCalls.get(result.tool_call_id);
494460
494498
  if (ongoing === void 0) return;
494461
494499
  this.ongoingSubCalls.delete(result.tool_call_id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.347",
3
+ "version": "9.1.348",
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": {