blun-king-cli 9.1.295 → 9.1.297

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.
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ function isQueuedReload(item) {
4
+ if (item?.mode === 'channel-command') {
5
+ return item.telegramCommandName === 'reload';
6
+ }
7
+ return item?.mode === 'command' && item.text?.trim() === '/reload';
8
+ }
9
+
10
+ function removeQueuedReloadCommands(queue) {
11
+ const removed = [];
12
+ let writeIndex = 0;
13
+
14
+ for (const item of queue) {
15
+ if (isQueuedReload(item)) {
16
+ removed.push(item);
17
+ continue;
18
+ }
19
+ queue[writeIndex] = item;
20
+ writeIndex += 1;
21
+ }
22
+
23
+ queue.length = writeIndex;
24
+ return removed;
25
+ }
26
+
27
+ module.exports = { removeQueuedReloadCommands };
package/blun.mjs CHANGED
@@ -295886,7 +295886,7 @@ var init_connection_manager = __esmMin((() => {
295886
295886
  init_public_display();
295887
295887
  init_types$1();
295888
295888
  DEFAULT_STARTUP_TIMEOUT_MS$1 = 3e4;
295889
- MCP_AUTO_RECONNECT_DELAYS_MS = [1e3, 3e3];
295889
+ MCP_AUTO_RECONNECT_DELAYS_MS = [1e4];
295890
295890
  McpConnectionManager = class {
295891
295891
  options;
295892
295892
  entries = /* @__PURE__ */ new Map();
@@ -296127,7 +296127,6 @@ var init_connection_manager = __esmMin((() => {
296127
296127
  this.emit(entry);
296128
296128
  void this.connectOne(entry, attemptId);
296129
296129
  }, MCP_AUTO_RECONNECT_DELAYS_MS[retryIndex]);
296130
- timer.unref?.();
296131
296130
  this.reconnectTimers.set(entry.name, timer);
296132
296131
  }
296133
296132
  beginConnectAttempt(entry) {
@@ -418834,6 +418833,7 @@ registerUiCatalogFragment({
418834
418833
  */
418835
418834
  var { projectUnaddressedTelegramContext } = createRequire(import.meta.url)("./bin/telegram-context-projection-policy.cjs");
418836
418835
  var { enqueueTelegramUrgent, rewriteTelegramUrgentEnvelope, telegramUrgentMessage } = createRequire(import.meta.url)("./bin/telegram-urgent-policy.cjs");
418836
+ var { removeQueuedReloadCommands } = createRequire(import.meta.url)("./bin/reload-queue-policy.cjs");
418837
418837
  const MAX_BUFFERED_CONTEXT_MESSAGES = 20;
418838
418838
  const MAX_BUFFERED_CONTEXT_CHARS = 24e3;
418839
418839
  const CONTEXT_TRUNCATED_MARKER = "\n[Telegram-Kontext gekuerzt]";
@@ -504520,6 +504520,7 @@ var EditorKeyboardController = class {
504520
504520
  return;
504521
504521
  }
504522
504522
  if (host.state.appState.isCompacting && host.streamingUI.hasActiveTurn()) {
504523
+ host.discardQueuedReloadCommands();
504523
504524
  this.cancelCurrentStream();
504524
504525
  this.clearPendingUndoEsc();
504525
504526
  return;
@@ -504534,6 +504535,7 @@ var EditorKeyboardController = class {
504534
504535
  return;
504535
504536
  }
504536
504537
  if (host.queueSteerInFlight !== void 0 || host.streamingUI.hasActiveTurn() || host.state.appState.streamingPhase !== "idle") {
504538
+ host.discardQueuedReloadCommands();
504537
504539
  this.cancelCurrentStream();
504538
504540
  this.clearPendingUndoEsc();
504539
504541
  return;
@@ -516904,7 +516906,18 @@ var BlunTUI = class {
516904
516906
  }
516905
516907
  }, routedEnvelope, this.channelPreamble);
516906
516908
  }
516909
+ discardQueuedReloadCommands() {
516910
+ const removed = removeQueuedReloadCommands(this.state.queuedMessages);
516911
+ if (removed.length === 0) return 0;
516912
+ for (const item of removed) item.channelAcknowledge?.();
516913
+ this.queueFlushBatchRemaining = Math.max(0, this.queueFlushBatchRemaining - removed.length);
516914
+ this.syncChannelQueueDeadline();
516915
+ this.updateQueueDisplay();
516916
+ this.state.ui.requestRender();
516917
+ return removed.length;
516918
+ }
516907
516919
  injectTelegramRemoteCommand(envelope, command, acknowledge) {
516920
+ if (command.name === "reload") this.discardQueuedReloadCommands();
516908
516921
  const item = {
516909
516922
  text: command.input,
516910
516923
  displayText: command.displayText,
@@ -517261,6 +517274,7 @@ var BlunTUI = class {
517261
517274
  this.track("input_queue");
517262
517275
  }
517263
517276
  enqueueSlashCommand(text) {
517277
+ if (parseSlashInput(text)?.name === "reload") this.discardQueuedReloadCommands();
517264
517278
  this.state.queuedMessages.push({
517265
517279
  text,
517266
517280
  agentId: this.harness.interactiveAgentId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.295",
3
+ "version": "9.1.297",
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": {