blun-king-cli 9.1.351 → 9.1.353
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/blun.mjs +41 -5
- package/package.json +1 -1
package/blun.mjs
CHANGED
|
@@ -507207,6 +507207,9 @@ var SubAgentEventHandler = class {
|
|
|
507207
507207
|
subagentInfo = /* @__PURE__ */ new Map();
|
|
507208
507208
|
agentSwarmProgress = /* @__PURE__ */ new Map();
|
|
507209
507209
|
backgroundAgentMetadata = /* @__PURE__ */ new Map();
|
|
507210
|
+
swarmDeltaRenderTimer;
|
|
507211
|
+
lastSwarmDeltaFlushAt;
|
|
507212
|
+
pendingSwarmDeltaChars = 0;
|
|
507210
507213
|
constructor(host, deps) {
|
|
507211
507214
|
this.host = host;
|
|
507212
507215
|
this.deps = deps;
|
|
@@ -507229,7 +507232,11 @@ var SubAgentEventHandler = class {
|
|
|
507229
507232
|
const swarmProgress = this.agentSwarmProgress.get(parentToolCallId);
|
|
507230
507233
|
if (swarmProgress !== void 0) {
|
|
507231
507234
|
this.applySubagentEventToSwarmProgress(swarmProgress, event, childAgentId);
|
|
507232
|
-
this.
|
|
507235
|
+
if (event.type === "assistant.delta" || event.type === "thinking.delta") this.scheduleSwarmDeltaRender(event.delta.length);
|
|
507236
|
+
else {
|
|
507237
|
+
this.clearSwarmDeltaRenderTimer();
|
|
507238
|
+
this.requestRender();
|
|
507239
|
+
}
|
|
507233
507240
|
return true;
|
|
507234
507241
|
}
|
|
507235
507242
|
const toolCall = this.host.streamingUI.getToolComponent(parentToolCallId);
|
|
@@ -507264,6 +507271,29 @@ var SubAgentEventHandler = class {
|
|
|
507264
507271
|
}
|
|
507265
507272
|
return true;
|
|
507266
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
|
+
}
|
|
507267
507297
|
handleLifecycleEvent(event) {
|
|
507268
507298
|
switch (event.type) {
|
|
507269
507299
|
case "subagent.spawned":
|
|
@@ -507284,6 +507314,7 @@ var SubAgentEventHandler = class {
|
|
|
507284
507314
|
}
|
|
507285
507315
|
}
|
|
507286
507316
|
clearAgentSwarmProgress() {
|
|
507317
|
+
this.clearSwarmDeltaRenderTimer();
|
|
507287
507318
|
for (const progress of this.agentSwarmProgress.values()) progress.dispose();
|
|
507288
507319
|
this.agentSwarmProgress.clear();
|
|
507289
507320
|
this.host.updateActivityPane();
|
|
@@ -507298,14 +507329,16 @@ var SubAgentEventHandler = class {
|
|
|
507298
507329
|
for (const progress of this.agentSwarmProgress.values()) progress.setActivitySpinnerText(spinner === void 0 ? void 0 : (width) => spinner.renderInline(width));
|
|
507299
507330
|
}
|
|
507300
507331
|
handleAgentSwarmToolCallStarted(toolCallId, args) {
|
|
507332
|
+
this.clearSwarmDeltaRenderTimer();
|
|
507301
507333
|
this.ensureAgentSwarmProgress(toolCallId, args).markInputComplete();
|
|
507302
507334
|
this.requestRender();
|
|
507303
507335
|
}
|
|
507304
|
-
handleAgentSwarmToolCallDelta(toolCallId, args, options) {
|
|
507336
|
+
handleAgentSwarmToolCallDelta(toolCallId, args, options, deltaChars) {
|
|
507305
507337
|
this.ensureAgentSwarmProgress(toolCallId, args, options);
|
|
507306
|
-
this.
|
|
507338
|
+
this.scheduleSwarmDeltaRender(deltaChars);
|
|
507307
507339
|
}
|
|
507308
507340
|
handleAgentSwarmToolResult(toolCallId, resultData, isError) {
|
|
507341
|
+
this.clearSwarmDeltaRenderTimer();
|
|
507309
507342
|
const progress = this.agentSwarmProgress.get(toolCallId);
|
|
507310
507343
|
if (progress === void 0) return;
|
|
507311
507344
|
if (isError && isUserCancelledSubagentError(resultData.output)) if (progress.isRequestStreaming()) this.removeAgentSwarmProgress(toolCallId, progress);
|
|
@@ -507334,7 +507367,10 @@ var SubAgentEventHandler = class {
|
|
|
507334
507367
|
progress.markActiveCancelled();
|
|
507335
507368
|
updated = true;
|
|
507336
507369
|
}
|
|
507337
|
-
if (updated)
|
|
507370
|
+
if (updated) {
|
|
507371
|
+
this.clearSwarmDeltaRenderTimer();
|
|
507372
|
+
this.requestRender();
|
|
507373
|
+
}
|
|
507338
507374
|
}
|
|
507339
507375
|
handleSubagentSpawned(event) {
|
|
507340
507376
|
this.rememberSubagent(event);
|
|
@@ -508255,7 +508291,7 @@ var SessionEventHandler = class {
|
|
|
508255
508291
|
hasAgentSwarmProgress: this.subAgentEventHandler.hasAgentSwarmProgress(event.toolCallId)
|
|
508256
508292
|
})) {
|
|
508257
508293
|
const preview = streamingUI.getStreamingToolCallPreview(event.toolCallId);
|
|
508258
|
-
if (preview !== void 0) this.subAgentEventHandler.handleAgentSwarmToolCallDelta(event.toolCallId, preview.args, { streamingArguments: preview.argumentsText });
|
|
508294
|
+
if (preview !== void 0) this.subAgentEventHandler.handleAgentSwarmToolCallDelta(event.toolCallId, preview.args, { streamingArguments: preview.argumentsText }, event.argumentsPart.length);
|
|
508259
508295
|
}
|
|
508260
508296
|
this.host.patchLivePane({
|
|
508261
508297
|
mode: "tool",
|