blun-king-cli 9.1.312 → 9.1.314
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/reload-queue-policy.cjs +18 -5
- package/blun.mjs +56 -16
- package/package.json +1 -1
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
function isQueuedReload(item) {
|
|
4
|
+
return queuedSlashCommandName(item) === 'reload';
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function queuedSlashCommandName(item) {
|
|
4
8
|
if (item?.mode === 'channel-command') {
|
|
5
|
-
|
|
9
|
+
const name = String(item.telegramCommandName || '').trim().toLowerCase();
|
|
10
|
+
return name || null;
|
|
6
11
|
}
|
|
7
|
-
|
|
12
|
+
if (item?.mode !== 'command') return null;
|
|
13
|
+
const match = String(item.text || '').trim().match(/^\/([^\s/]+)/u);
|
|
14
|
+
return match?.[1]?.toLowerCase() || null;
|
|
8
15
|
}
|
|
9
16
|
|
|
10
|
-
function
|
|
17
|
+
function removeQueuedSlashCommands(queue, commandName) {
|
|
18
|
+
const target = String(commandName || '').trim().toLowerCase() || null;
|
|
11
19
|
const removed = [];
|
|
12
20
|
let writeIndex = 0;
|
|
13
21
|
for (const item of queue) {
|
|
14
|
-
|
|
22
|
+
const name = queuedSlashCommandName(item);
|
|
23
|
+
if (name !== null && (target === null || name === target)) {
|
|
15
24
|
removed.push(item);
|
|
16
25
|
continue;
|
|
17
26
|
}
|
|
@@ -22,4 +31,8 @@ function removeQueuedReloadCommands(queue) {
|
|
|
22
31
|
return removed;
|
|
23
32
|
}
|
|
24
33
|
|
|
25
|
-
|
|
34
|
+
function removeQueuedReloadCommands(queue) {
|
|
35
|
+
return removeQueuedSlashCommands(queue, 'reload');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = { isQueuedReload, queuedSlashCommandName, removeQueuedReloadCommands, removeQueuedSlashCommands };
|
package/blun.mjs
CHANGED
|
@@ -403718,6 +403718,7 @@ function slashCommandBusyReason(options) {
|
|
|
403718
403718
|
function shouldQueueBusySlashCommand(input, options) {
|
|
403719
403719
|
const parsed = parseSlashInput(input);
|
|
403720
403720
|
if (parsed === null) return false;
|
|
403721
|
+
if (parsed.name === "goal" || parsed.name === "loop") return false;
|
|
403721
403722
|
if (slashCommandBusyReason(options) === void 0) return false;
|
|
403722
403723
|
const normalizedName = normalizeLegacyEffortCommandName(parsed.name);
|
|
403723
403724
|
const command = findBuiltInSlashCommand(normalizedName);
|
|
@@ -418943,7 +418944,7 @@ registerUiCatalogFragment({
|
|
|
418943
418944
|
*/
|
|
418944
418945
|
var { projectUnaddressedTelegramContext } = createRequire(import.meta.url)("./bin/telegram-context-projection-policy.cjs");
|
|
418945
418946
|
var { enqueueTelegramUrgent, rewriteTelegramUrgentEnvelope, telegramUrgentMessage } = createRequire(import.meta.url)("./bin/telegram-urgent-policy.cjs");
|
|
418946
|
-
var { removeQueuedReloadCommands } = createRequire(import.meta.url)("./bin/reload-queue-policy.cjs");
|
|
418947
|
+
var { removeQueuedReloadCommands, removeQueuedSlashCommands } = createRequire(import.meta.url)("./bin/reload-queue-policy.cjs");
|
|
418947
418948
|
const MAX_BUFFERED_CONTEXT_MESSAGES = 20;
|
|
418948
418949
|
const MAX_BUFFERED_CONTEXT_CHARS = 24e3;
|
|
418949
418950
|
const CONTEXT_TRUNCATED_MARKER = "\n[Telegram-Kontext gekuerzt]";
|
|
@@ -504634,7 +504635,7 @@ var EditorKeyboardController = class {
|
|
|
504634
504635
|
return;
|
|
504635
504636
|
}
|
|
504636
504637
|
if (host.state.appState.isCompacting && host.streamingUI.hasActiveTurn()) {
|
|
504637
|
-
host.
|
|
504638
|
+
host.discardQueuedSlashCommands();
|
|
504638
504639
|
this.cancelCurrentStream();
|
|
504639
504640
|
this.clearPendingUndoEsc();
|
|
504640
504641
|
return;
|
|
@@ -504649,7 +504650,7 @@ var EditorKeyboardController = class {
|
|
|
504649
504650
|
return;
|
|
504650
504651
|
}
|
|
504651
504652
|
if (host.queueSteerInFlight !== void 0 || host.streamingUI.hasActiveTurn() || host.state.appState.streamingPhase !== "idle") {
|
|
504652
|
-
host.
|
|
504653
|
+
host.discardQueuedSlashCommands();
|
|
504653
504654
|
this.cancelCurrentStream();
|
|
504654
504655
|
this.clearPendingUndoEsc();
|
|
504655
504656
|
return;
|
|
@@ -504658,6 +504659,10 @@ var EditorKeyboardController = class {
|
|
|
504658
504659
|
this.clearPendingUndoEsc();
|
|
504659
504660
|
return;
|
|
504660
504661
|
}
|
|
504662
|
+
if (host.discardQueuedSlashCommands() > 0) {
|
|
504663
|
+
this.clearPendingUndoEsc();
|
|
504664
|
+
return;
|
|
504665
|
+
}
|
|
504661
504666
|
if (this.pendingUndoEsc !== null) {
|
|
504662
504667
|
this.clearPendingUndoEsc();
|
|
504663
504668
|
host.openUndoSelector();
|
|
@@ -515893,6 +515898,7 @@ var BlunTUI = class {
|
|
|
515893
515898
|
signalCleanupHandlers = [];
|
|
515894
515899
|
isShuttingDown = false;
|
|
515895
515900
|
startupNotice;
|
|
515901
|
+
startupTranscriptNotice;
|
|
515896
515902
|
onStartupNoticeShown;
|
|
515897
515903
|
startupLoginRequired = false;
|
|
515898
515904
|
startupWorkspaceSelectionPending = false;
|
|
@@ -515969,6 +515975,7 @@ var BlunTUI = class {
|
|
|
515969
515975
|
};
|
|
515970
515976
|
this.options = tuiOptions;
|
|
515971
515977
|
this.startupNotice = invalidAppearance ? combineStartupNotice(startupInput.startupNotice, new TuiConfigParseError(DEFAULT_TUI_CONFIG).message) : startupInput.startupNotice;
|
|
515978
|
+
this.startupTranscriptNotice = startupInput.startupTranscriptNotice;
|
|
515972
515979
|
this.onStartupNoticeShown = startupInput.onStartupNoticeShown;
|
|
515973
515980
|
this.state = createTUIState(tuiOptions);
|
|
515974
515981
|
this.state.loopIndicator.setRefreshHandler(() => {
|
|
@@ -516264,6 +516271,7 @@ var BlunTUI = class {
|
|
|
516264
516271
|
this.showTmuxKeyboardWarningIfNeeded();
|
|
516265
516272
|
this.startTelegramChannel();
|
|
516266
516273
|
if (this.state.startupState === "picker") {
|
|
516274
|
+
await this.flushStartupTranscriptNotice();
|
|
516267
516275
|
this.bootstrapFromPicker();
|
|
516268
516276
|
return;
|
|
516269
516277
|
}
|
|
@@ -516280,9 +516288,10 @@ var BlunTUI = class {
|
|
|
516280
516288
|
if (!continuedAfterUpdate) await this.promptStartupResumeGoalIfNeeded();
|
|
516281
516289
|
if (this.aborted) return;
|
|
516282
516290
|
}
|
|
516283
|
-
|
|
516284
|
-
|
|
516285
|
-
|
|
516291
|
+
this.showSessionWarnings(this.session);
|
|
516292
|
+
}
|
|
516293
|
+
await this.flushStartupTranscriptNotice();
|
|
516294
|
+
this.fetchSessions();
|
|
516286
516295
|
if (this.session !== void 0) this.updateTerminalTitle();
|
|
516287
516296
|
this.refreshSkillCommands(this.session);
|
|
516288
516297
|
this.refreshPluginCommands(this.session);
|
|
@@ -516291,11 +516300,25 @@ var BlunTUI = class {
|
|
|
516291
516300
|
if (this.startupNotice !== void 0) {
|
|
516292
516301
|
this.showStatus(this.startupNotice);
|
|
516293
516302
|
this.startupNotice = void 0;
|
|
516294
|
-
const onShown = this.onStartupNoticeShown;
|
|
516295
|
-
this.onStartupNoticeShown = void 0;
|
|
516296
|
-
await onShown?.().catch(() => {});
|
|
516297
516303
|
}
|
|
516298
516304
|
}
|
|
516305
|
+
async flushStartupTranscriptNotice() {
|
|
516306
|
+
const notice = this.startupTranscriptNotice?.trimEnd();
|
|
516307
|
+
this.startupTranscriptNotice = void 0;
|
|
516308
|
+
if (notice !== void 0 && notice.length > 0) {
|
|
516309
|
+
const [content, ...detailLines] = notice.split("\n");
|
|
516310
|
+
this.appendTranscriptEntry({
|
|
516311
|
+
id: nextTranscriptId(),
|
|
516312
|
+
kind: "status",
|
|
516313
|
+
renderMode: "notice",
|
|
516314
|
+
content,
|
|
516315
|
+
...(detailLines.length === 0 ? {} : { detail: detailLines.join("\n") })
|
|
516316
|
+
});
|
|
516317
|
+
}
|
|
516318
|
+
const onShown = this.onStartupNoticeShown;
|
|
516319
|
+
this.onStartupNoticeShown = void 0;
|
|
516320
|
+
await onShown?.().catch(() => {});
|
|
516321
|
+
}
|
|
516299
516322
|
async showSessionWarnings(session) {
|
|
516300
516323
|
try {
|
|
516301
516324
|
const warnings = await session.getSessionWarnings();
|
|
@@ -517042,18 +517065,22 @@ var BlunTUI = class {
|
|
|
517042
517065
|
}
|
|
517043
517066
|
}, routedEnvelope, this.channelPreamble);
|
|
517044
517067
|
}
|
|
517045
|
-
|
|
517046
|
-
const removed =
|
|
517068
|
+
discardQueuedSlashCommands(commandName) {
|
|
517069
|
+
const removed = removeQueuedSlashCommands(this.state.queuedMessages, commandName);
|
|
517047
517070
|
if (removed.length === 0) return 0;
|
|
517048
517071
|
for (const item of removed) item.channelAcknowledge?.();
|
|
517072
|
+
if (!this.queueCommandRunning && !this.editorReplacementActive && !this.state.queuedMessages.some((item) => item.mode === "command" || item.mode === "channel-command")) this.preserveQueueAcrossSessionReset = false;
|
|
517049
517073
|
this.queueFlushBatchRemaining = Math.max(0, this.queueFlushBatchRemaining - removed.length);
|
|
517050
517074
|
this.syncChannelQueueDeadline();
|
|
517051
517075
|
this.updateQueueDisplay();
|
|
517052
517076
|
this.state.ui.requestRender();
|
|
517053
517077
|
return removed.length;
|
|
517054
517078
|
}
|
|
517079
|
+
discardQueuedReloadCommands() {
|
|
517080
|
+
return this.discardQueuedSlashCommands("reload");
|
|
517081
|
+
}
|
|
517055
517082
|
injectTelegramRemoteCommand(envelope, command, acknowledge) {
|
|
517056
|
-
|
|
517083
|
+
this.discardQueuedSlashCommands(command.name);
|
|
517057
517084
|
const item = {
|
|
517058
517085
|
text: command.input,
|
|
517059
517086
|
displayText: command.displayText,
|
|
@@ -517420,12 +517447,25 @@ var BlunTUI = class {
|
|
|
517420
517447
|
this.track("input_queue");
|
|
517421
517448
|
}
|
|
517422
517449
|
enqueueSlashCommand(text) {
|
|
517423
|
-
|
|
517424
|
-
this.
|
|
517450
|
+
const commandName = parseSlashInput(text)?.name;
|
|
517451
|
+
if (commandName !== void 0) this.discardQueuedSlashCommands(commandName);
|
|
517452
|
+
const item = {
|
|
517425
517453
|
text,
|
|
517426
517454
|
agentId: this.harness.interactiveAgentId,
|
|
517427
517455
|
mode: "command"
|
|
517428
|
-
}
|
|
517456
|
+
};
|
|
517457
|
+
const phase = this.state.appState.streamingPhase;
|
|
517458
|
+
const activeTurn = !this.queueCommandRunning && !this.editorReplacementActive && !this.state.appState.isCompacting && (this.streamingUI.hasActiveTurn() || phase !== "idle" && phase !== "shell");
|
|
517459
|
+
if (activeTurn) {
|
|
517460
|
+
this.state.queuedMessages.unshift(item);
|
|
517461
|
+
this.preserveQueueAcrossSessionReset = true;
|
|
517462
|
+
this.session?.cancel();
|
|
517463
|
+
this.track("input_queue", { kind: "command-preemptive" });
|
|
517464
|
+
this.updateQueueDisplay();
|
|
517465
|
+
this.state.ui.requestRender();
|
|
517466
|
+
return;
|
|
517467
|
+
}
|
|
517468
|
+
this.state.queuedMessages.push(item);
|
|
517429
517469
|
this.track("input_queue", { kind: "command" });
|
|
517430
517470
|
this.updateQueueDisplay();
|
|
517431
517471
|
this.state.ui.requestRender();
|
|
@@ -519130,7 +519170,6 @@ async function runShell(opts, version, updateStartupNotice) {
|
|
|
519130
519170
|
}
|
|
519131
519171
|
if (updateStartupNotice !== void 0) {
|
|
519132
519172
|
updateNoticeText = renderUpdateSuccessNotice(updateStartupNotice.details, resolveUiLocale(tuiConfig.uiLocale));
|
|
519133
|
-
configWarning = combineStartupNotice(configWarning, updateNoticeText);
|
|
519134
519173
|
}
|
|
519135
519174
|
const palette = await getColorPalette(tuiConfig.theme);
|
|
519136
519175
|
currentTheme.setPalette(palette);
|
|
@@ -519180,6 +519219,7 @@ async function runShell(opts, version, updateStartupNotice) {
|
|
|
519180
519219
|
version,
|
|
519181
519220
|
workDir,
|
|
519182
519221
|
startupNotice: configWarning,
|
|
519222
|
+
startupTranscriptNotice: updateNoticeText,
|
|
519183
519223
|
onStartupNoticeShown: updateStartupNotice === void 0 || updateNoticeText === void 0 ? void 0 : async () => {
|
|
519184
519224
|
const delivery = await sendTelegramUpdateNotice(updateNoticeText, { version: updateStartupNotice.details.version });
|
|
519185
519225
|
if (!delivery.configured || delivery.attempted === 0 || delivery.sent === delivery.attempted) await updateStartupNotice.acknowledge();
|