blun-king-cli 9.1.431 → 9.1.433
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 +45 -3
- package/package.json +1 -1
package/blun.mjs
CHANGED
|
@@ -30353,6 +30353,7 @@ async function chatWithRetry(input) {
|
|
|
30353
30353
|
nextAttempt: attempt + 1,
|
|
30354
30354
|
maxAttempts,
|
|
30355
30355
|
delayMs,
|
|
30356
|
+
outputMayHaveStarted: input.llm.didErrorEmitPartialOutput?.(error) === true,
|
|
30356
30357
|
...retryErrorFields(error)
|
|
30357
30358
|
});
|
|
30358
30359
|
await sleepForRetry(delayMs, input.params.signal);
|
|
@@ -244541,6 +244542,7 @@ async function chatWithLiveResponseRepetitionRecovery(deps) {
|
|
|
244541
244542
|
nextAttempt: 2,
|
|
244542
244543
|
maxAttempts: 2,
|
|
244543
244544
|
delayMs: 0,
|
|
244545
|
+
outputMayHaveStarted: true,
|
|
244544
244546
|
errorName: "LiveResponseRepetitionError",
|
|
244545
244547
|
errorMessage: "Repeated assistant text detected during streaming"
|
|
244546
244548
|
});
|
|
@@ -246082,6 +246084,7 @@ var init_events$1 = __esmMin((() => {
|
|
|
246082
246084
|
nextAttempt: number$1(),
|
|
246083
246085
|
maxAttempts: number$1(),
|
|
246084
246086
|
delayMs: number$1(),
|
|
246087
|
+
outputMayHaveStarted: boolean$1().optional(),
|
|
246085
246088
|
errorName: string(),
|
|
246086
246089
|
errorMessage: string(),
|
|
246087
246090
|
statusCode: number$1().optional()
|
|
@@ -261463,6 +261466,7 @@ function mapLoopEvent(event, turnId) {
|
|
|
261463
261466
|
nextAttempt: event.nextAttempt,
|
|
261464
261467
|
maxAttempts: event.maxAttempts,
|
|
261465
261468
|
delayMs: event.delayMs,
|
|
261469
|
+
outputMayHaveStarted: event.outputMayHaveStarted,
|
|
261466
261470
|
errorName: event.errorName,
|
|
261467
261471
|
errorMessage: event.errorMessage,
|
|
261468
261472
|
statusCode: event.statusCode
|
|
@@ -265060,9 +265064,13 @@ var init_fallback_llm = __esmMin((() => {
|
|
|
265060
265064
|
}
|
|
265061
265065
|
}
|
|
265062
265066
|
isRetryableError(error) {
|
|
265063
|
-
|
|
265067
|
+
const outputMayHaveStarted = this.didErrorEmitPartialOutput(error);
|
|
265068
|
+
if (isAccountQuotaExhausted(error) || !outputMayHaveStarted && isFallbackCandidateError(error) || error instanceof APIContextOverflowError || isUnavailableFallbackCandidate(error)) return false;
|
|
265064
265069
|
return this.current.llm.isRetryableError?.(error) ?? false;
|
|
265065
265070
|
}
|
|
265071
|
+
didErrorEmitPartialOutput(error) {
|
|
265072
|
+
return typeof error === "object" && error !== null && this.errorsAfterOutput.has(error);
|
|
265073
|
+
}
|
|
265066
265074
|
get current() {
|
|
265067
265075
|
return this.candidates[this.currentIndex];
|
|
265068
265076
|
}
|
|
@@ -496396,6 +496404,7 @@ function runPromptTurn(session, prompt, outputFormat, stdout, stderr, model) {
|
|
|
496396
496404
|
return;
|
|
496397
496405
|
case "turn.step.retrying":
|
|
496398
496406
|
outputWriter.discardAssistant();
|
|
496407
|
+
outputWriter.writeRetry?.(formatModelRetryProgress(event), event.outputMayHaveStarted === true);
|
|
496399
496408
|
return;
|
|
496400
496409
|
case "assistant.delta":
|
|
496401
496410
|
outputWriter.writeAssistantDelta(event.delta);
|
|
@@ -496494,7 +496503,16 @@ var PromptTranscriptWriter = class {
|
|
|
496494
496503
|
writeToolCallDelta() {}
|
|
496495
496504
|
writeToolResult() {}
|
|
496496
496505
|
flushAssistant() {}
|
|
496497
|
-
discardAssistant() {
|
|
496506
|
+
discardAssistant() {
|
|
496507
|
+
this.assistantFilter = new ThoughtTagFilter();
|
|
496508
|
+
this.thinkingWriter.finish();
|
|
496509
|
+
this.assistantWriter.finish();
|
|
496510
|
+
}
|
|
496511
|
+
writeRetry(hint, outputMayHaveStarted) {
|
|
496512
|
+
if (!outputMayHaveStarted) return;
|
|
496513
|
+
this.thinkingWriter.write(hint);
|
|
496514
|
+
this.thinkingWriter.finish();
|
|
496515
|
+
}
|
|
496498
496516
|
finish() {
|
|
496499
496517
|
const { visible, thought } = this.assistantFilter.flush();
|
|
496500
496518
|
if (thought.length > 0) this.thinkingWriter.write(thought);
|
|
@@ -496580,6 +496598,7 @@ var PromptJsonStreamWriter = class {
|
|
|
496580
496598
|
discardAssistant() {
|
|
496581
496599
|
this.assistantText = "";
|
|
496582
496600
|
this.toolCalls.length = 0;
|
|
496601
|
+
this.assistantFilter = new ThoughtTagFilter();
|
|
496583
496602
|
}
|
|
496584
496603
|
finish() {
|
|
496585
496604
|
this.assistantText += this.assistantFilter.flush().visible;
|
|
@@ -496674,6 +496693,7 @@ var PromptJsonSingleWriter = class {
|
|
|
496674
496693
|
discardAssistant() {
|
|
496675
496694
|
this.assistantText = "";
|
|
496676
496695
|
this.toolCalls.length = 0;
|
|
496696
|
+
this.assistantFilter = new ThoughtTagFilter();
|
|
496677
496697
|
}
|
|
496678
496698
|
setTurnEnded(reason) {
|
|
496679
496699
|
this.turnEndReason = reason;
|
|
@@ -504130,8 +504150,8 @@ function resolveEditorCommand(configured) {
|
|
|
504130
504150
|
async function editInExternalEditor(initialText, command) {
|
|
504131
504151
|
const dir = await mkdtemp(join(tmpdir(), "blun-edit-"));
|
|
504132
504152
|
const file = join(dir, "prompt.md");
|
|
504133
|
-
await writeFile(file, initialText, "utf-8");
|
|
504134
504153
|
try {
|
|
504154
|
+
await writeFile(file, initialText, "utf-8");
|
|
504135
504155
|
const shellCmd = `${command} ${quoteShellArg(file)}`;
|
|
504136
504156
|
if (await new Promise((resolve, reject) => {
|
|
504137
504157
|
const child = spawn(shellCmd, {
|
|
@@ -508122,6 +508142,19 @@ var SessionEventHandler = class {
|
|
|
508122
508142
|
handleStepRetrying(event) {
|
|
508123
508143
|
this.turnWatchdog.recordProgress();
|
|
508124
508144
|
const hint = formatModelRetryProgress(event);
|
|
508145
|
+
if (event.outputMayHaveStarted === true) {
|
|
508146
|
+
const { streamingUI } = this.host;
|
|
508147
|
+
streamingUI.flushNow();
|
|
508148
|
+
streamingUI.discardUnfinishedToolUi();
|
|
508149
|
+
streamingUI.finalizeLiveTextBuffers("idle");
|
|
508150
|
+
this.host.appendTranscriptEntry({
|
|
508151
|
+
id: nextTranscriptId(),
|
|
508152
|
+
kind: "status",
|
|
508153
|
+
turnId: String(event.turnId),
|
|
508154
|
+
renderMode: "plain",
|
|
508155
|
+
content: uiText("sessionEvent.interrupted.reason", { reason: hint })
|
|
508156
|
+
});
|
|
508157
|
+
}
|
|
508125
508158
|
this.modelRetryHint = hint;
|
|
508126
508159
|
this.host.state.footer.setTransientHint(hint);
|
|
508127
508160
|
this.host.state.ui.requestRender();
|
|
@@ -511622,6 +511655,15 @@ var StreamingUIController = class {
|
|
|
511622
511655
|
this._pendingReadGroup = null;
|
|
511623
511656
|
this.resetToolCallState();
|
|
511624
511657
|
}
|
|
511658
|
+
discardUnfinishedToolUi() {
|
|
511659
|
+
const { state } = this.host;
|
|
511660
|
+
const components = [...this._pendingToolComponents.values()];
|
|
511661
|
+
const toolCallIds = /* @__PURE__ */ new Set(this._pendingToolComponents.keys());
|
|
511662
|
+
this.resetToolUi();
|
|
511663
|
+
for (const component of components) state.transcriptContainer.removeChild(component);
|
|
511664
|
+
if (toolCallIds.size > 0) state.transcriptEntries = state.transcriptEntries.filter((entry) => !toolCallIds.has(entry.toolCallData?.id));
|
|
511665
|
+
state.ui.requestRender();
|
|
511666
|
+
}
|
|
511625
511667
|
resetToolCallState() {
|
|
511626
511668
|
this._activeToolCalls.clear();
|
|
511627
511669
|
}
|