blun-king-cli 9.1.346 → 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.
- package/bin/tool-stream-preview-policy.cjs +9 -0
- package/blun.mjs +50 -5
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function shouldParseStreamingToolCallImmediately(input = {}) {
|
|
4
|
+
return input.eventName === 'AgentSwarm'
|
|
5
|
+
|| input.activeName === 'AgentSwarm'
|
|
6
|
+
|| input.hasAgentSwarmProgress === true;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
module.exports = { shouldParseStreamingToolCallImmediately };
|
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:
|
|
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);
|
|
@@ -508123,8 +508161,14 @@ var SessionEventHandler = class {
|
|
|
508123
508161
|
if (event.argumentsPart.length > 0) this.turnWatchdog.recordProgress();
|
|
508124
508162
|
const { state, streamingUI } = this.host;
|
|
508125
508163
|
streamingUI.accumulateToolCallDelta(event.toolCallId, event.name, event.argumentsPart);
|
|
508126
|
-
|
|
508127
|
-
|
|
508164
|
+
if (shouldParseStreamingToolCallImmediately({
|
|
508165
|
+
eventName: event.name,
|
|
508166
|
+
activeName: streamingUI.getActiveToolCall(event.toolCallId)?.name,
|
|
508167
|
+
hasAgentSwarmProgress: this.subAgentEventHandler.hasAgentSwarmProgress(event.toolCallId)
|
|
508168
|
+
})) {
|
|
508169
|
+
const preview = streamingUI.getStreamingToolCallPreview(event.toolCallId);
|
|
508170
|
+
if (preview !== void 0) this.subAgentEventHandler.handleAgentSwarmToolCallDelta(event.toolCallId, preview.args, { streamingArguments: preview.argumentsText });
|
|
508171
|
+
}
|
|
508128
508172
|
this.host.patchLivePane({
|
|
508129
508173
|
mode: "tool",
|
|
508130
508174
|
pendingApproval: null,
|
|
@@ -515924,6 +515968,7 @@ const {
|
|
|
515924
515968
|
writeRunningUpdateMode
|
|
515925
515969
|
} = __require("./bin/running-update-preference.cjs");
|
|
515926
515970
|
const { resolveStreamingFlushInterval } = __require("./bin/streaming-flush-performance-policy.cjs");
|
|
515971
|
+
const { shouldParseStreamingToolCallImmediately } = __require("./bin/tool-stream-preview-policy.cjs");
|
|
515927
515972
|
const RUNNING_UPDATE_RESUME_SESSION_ENV = "BLUN_RUNNING_UPDATE_RESUME_SESSION_ID";
|
|
515928
515973
|
function shouldContinueActiveGoalAfterRunningUpdate(expectedSessionId, currentSessionId, goalStatus) {
|
|
515929
515974
|
return typeof expectedSessionId === "string" && expectedSessionId.length > 0 && currentSessionId === expectedSessionId && goalStatus === "active";
|