blun-king-cli 9.1.313 → 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.
@@ -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
- return item.telegramCommandName === 'reload';
9
+ const name = String(item.telegramCommandName || '').trim().toLowerCase();
10
+ return name || null;
6
11
  }
7
- return item?.mode === 'command' && item.text?.trim() === '/reload';
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 removeQueuedReloadCommands(queue) {
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
- if (isQueuedReload(item)) {
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
- module.exports = { removeQueuedReloadCommands };
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.discardQueuedReloadCommands();
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.discardQueuedReloadCommands();
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();
@@ -517060,18 +517065,22 @@ var BlunTUI = class {
517060
517065
  }
517061
517066
  }, routedEnvelope, this.channelPreamble);
517062
517067
  }
517063
- discardQueuedReloadCommands() {
517064
- const removed = removeQueuedReloadCommands(this.state.queuedMessages);
517068
+ discardQueuedSlashCommands(commandName) {
517069
+ const removed = removeQueuedSlashCommands(this.state.queuedMessages, commandName);
517065
517070
  if (removed.length === 0) return 0;
517066
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;
517067
517073
  this.queueFlushBatchRemaining = Math.max(0, this.queueFlushBatchRemaining - removed.length);
517068
517074
  this.syncChannelQueueDeadline();
517069
517075
  this.updateQueueDisplay();
517070
517076
  this.state.ui.requestRender();
517071
517077
  return removed.length;
517072
517078
  }
517079
+ discardQueuedReloadCommands() {
517080
+ return this.discardQueuedSlashCommands("reload");
517081
+ }
517073
517082
  injectTelegramRemoteCommand(envelope, command, acknowledge) {
517074
- if (command.name === "reload") this.discardQueuedReloadCommands();
517083
+ this.discardQueuedSlashCommands(command.name);
517075
517084
  const item = {
517076
517085
  text: command.input,
517077
517086
  displayText: command.displayText,
@@ -517438,12 +517447,25 @@ var BlunTUI = class {
517438
517447
  this.track("input_queue");
517439
517448
  }
517440
517449
  enqueueSlashCommand(text) {
517441
- if (parseSlashInput(text)?.name === "reload") this.discardQueuedReloadCommands();
517442
- this.state.queuedMessages.push({
517450
+ const commandName = parseSlashInput(text)?.name;
517451
+ if (commandName !== void 0) this.discardQueuedSlashCommands(commandName);
517452
+ const item = {
517443
517453
  text,
517444
517454
  agentId: this.harness.interactiveAgentId,
517445
517455
  mode: "command"
517446
- });
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);
517447
517469
  this.track("input_queue", { kind: "command" });
517448
517470
  this.updateQueueDisplay();
517449
517471
  this.state.ui.requestRender();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.313",
3
+ "version": "9.1.314",
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": {