blun-king-cli 9.1.645 → 9.1.646

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Versionsverlauf
2
2
 
3
+ ## 9.1.646 — 19.11.2026
4
+
5
+ - Bereits erlaubte Eingaben aus der Warteschlange und Strg+S nutzen denselben Zustellweg in die laufende Gesprächsrunde. Reihenfolge und Belege für die Übernahme bleiben erhalten.
6
+ - Bestätigt abgewiesene Versuche können wiederholt werden. Unklare Versuche behalten für den Abgleich ihre Anfragekennung und ihren Inhalt.
7
+ - Bei gemischten Chat- und Konsoleneingaben sind ausdrückliche Antwortempfänger erforderlich. Automatische Text- und Medienweiterleitung wird abgeschaltet; die Regeln bleiben bei der Wiederaufnahme erhalten.
8
+ - Datenfluss: Es wird kein neuer externer Empfänger eingerichtet. Die Regeln für Antwortempfänger werden im Format 3 in vorhandenen lokalen Sitzungsmetadaten gespeichert. Ältere Versionen verweigern die automatische Zustellung dieser Einträge.
9
+ - Die Übernahme innerhalb von 60 Sekunden ist im laufenden Betrieb noch nicht nachgewiesen; der vollständig scrollbare Originalverlauf bleibt offen.
10
+
11
+ [Versionshinweise und Installation](RELEASE-9.1.646.md).
12
+
3
13
  ## 9.1.645 — 19.11.2026
4
14
 
5
15
  - ReadMediaFile steht auch für Textmodelle bereit, wenn ein separater Bildleser eingerichtet ist, und wird direkt im Grundwerkzeugsatz angeboten.
package/LIESMICH.txt CHANGED
@@ -1,29 +1,30 @@
1
- # blun-king-cli 9.1.645
1
+ # blun-king-cli 9.1.646
2
2
 
3
- ## Installieren oder aktualisieren
3
+ ## Installieren und fortsetzen
4
4
 
5
5
  ```powershell
6
- npm install -g blun-king-cli@9.1.645
7
- king --version
6
+ npm install -g blun-king-cli@9.1.646
8
7
  king -c
9
8
  ```
10
9
 
11
- Für `king -c` denselben Arbeitsordner verwenden. Das Update wirkt beim nächsten Start. Die Startreparaturen aus 9.1.644 sind enthalten.
10
+ Starte die Konsole nach der Installation selbst neu, damit sie die neue Version lädt. Die eingerichtete Telegram-Verbindung bleibt erhalten.
12
11
 
13
- [Exaktes npm-Paket herunterladen](https://registry.npmjs.org/blun-king-cli/-/blun-king-cli-9.1.645.tgz).
12
+ [Genau dieses Paket herunterladen](https://registry.npmjs.org/blun-king-cli/-/blun-king-cli-9.1.646.tgz).
14
13
 
15
- ## Bilddateien lesen
14
+ ## Eingaben während laufender Arbeit
16
15
 
17
- ReadMediaFile ist auch für ein Hauptmodell ohne native Bildfunktion verfügbar, wenn ein separater Bildleser eingerichtet ist. Das Werkzeug gehört zu den direkt angebotenen Grundwerkzeugen. Die vorhandene Werkzeugfreigabe gilt weiterhin.
16
+ Bereits erlaubte Telegram-Nachrichten und normale Konsoleneingaben nutzen denselben Zustellweg in die laufende Gesprächsrunde. Auch Strg+S nutzt diesen Weg. Ein im Vordergrund laufender Unteragent kann die Kontrolle an den Hauptagenten abgeben, ohne beendet zu werden.
18
17
 
19
- Dateiprüfung, Größenlimit und die Parameter `region` und `full_resolution` bleiben erhalten. Bei einem Textmodell geht das gelesene Bild oder der gewählte Ausschnitt an den eingerichteten Bildleser. Das Hauptmodell erhält dessen Beschreibung als ausdrücklich nicht vertrauenswürdige Beobachtung. Eine zusätzliche Verkleinerung durch den Bildleser wird angegeben. Ein Modell mit nativer Bildfunktion nutzt beim Lesen einer Datei den bisherigen Modellpfad.
18
+ Ein abgewiesener Erstversuch blockiert weitere Versuche nicht mehr bis zum Ende der Gesprächsrunde. Unklare Zustellversuche werden mit ihrer bestehenden Anfragekennung und ihrem bestehenden Inhalt abgeglichen. Der Nachrichteneingang wird erst bestätigt, wenn ein Beleg die Übernahme in den Modellkontext nachweist.
20
19
 
21
- Verbrauch des Bildlesers wird erfasst, sofern er Verbrauchsdaten liefert. Ein Fehler des Bildlesers erscheint als Fehler; er wird nicht als erfolgreiche Bildanalyse ausgegeben. Video wird nur angeboten, wenn das Hauptmodell Videoeingaben unterstützt.
20
+ Wenn Eingaben aus verschiedenen Chats oder der Konsole in einer Gesprächsrunde zusammenkommen, wird die automatische Weiterleitung von Text und Medien für diese Runde abgeschaltet. Telegram-Antworten müssen das ausdrückliche Antwortwerkzeug und die ursprüngliche Chat-ID nutzen.
22
21
 
23
- ## Datenfluss und offene Arbeiten
22
+ ## Daten und Berechtigungen
24
23
 
25
- Diese Reparatur erweitert den vorhandenen Bildlesepfad auf ReadMediaFile. Die gewählten Bilddaten werden an den bereits eingerichteten Bildleser gesendet. Beim verwalteten Mediendienst verwendet dieser dessen Upload- und Bildanalyse-Endpunkte. Es wird kein neuer Empfänger eingerichtet.
24
+ Zugriffs- und Erwähnungsregeln, ein ausdrücklicher Stopp, Berechtigungsabfragen, Slash-Befehle und die Behandlung interaktiver Shells bleiben wirksam. Es wird kein neuer externer Empfänger eingerichtet. Die Regeln für Antwortempfänger werden in den vorhandenen lokalen Sitzungsmetadaten gespeichert.
26
25
 
27
- Die automatische Verarbeitung eingehender Nachrichtenbilder verwendet weiterhin den vorhandenen Bildleser. Die direkte Dateifunktion wird mit dieser Version ergänzt. Der vollständige scrollbare Verlauf nach einer Fortsetzung und die sofortige Telegram-Übergabe während laufender Arbeit bleiben eigene offene Arbeiten.
26
+ Das lokale Journal für Zielantworten nutzt jetzt Format 3. Ältere Versionen verweigern die automatische Zustellung dieser Einträge, damit deren Regeln für Antwortempfänger nicht übergangen werden.
28
27
 
29
- Frühere Änderungen und den Versionsnachweis enthält [CHANGELOG.md](CHANGELOG.md).
28
+ ## Grenzen
29
+
30
+ Eine Übernahme innerhalb von 60 Sekunden ist im laufenden Betrieb noch nicht nachgewiesen. Verdichtung, fehlende Verbindungen und vorhandene Zustellsperren können die Übernahme verzögern. Der vollständig scrollbare Originalverlauf bleibt eine eigene offene Aufgabe. Die Reparatur von ReadMediaFile aus 9.1.645 ist enthalten.
package/README.md CHANGED
@@ -1,29 +1,30 @@
1
- # blun-king-cli 9.1.645
1
+ # blun-king-cli 9.1.646
2
2
 
3
- ## Installieren oder aktualisieren
3
+ ## Installieren und fortsetzen
4
4
 
5
5
  ```powershell
6
- npm install -g blun-king-cli@9.1.645
7
- king --version
6
+ npm install -g blun-king-cli@9.1.646
8
7
  king -c
9
8
  ```
10
9
 
11
- Für `king -c` denselben Arbeitsordner verwenden. Das Update wirkt beim nächsten Start. Die Startreparaturen aus 9.1.644 sind enthalten.
10
+ Starte die Konsole nach der Installation selbst neu, damit sie die neue Version lädt. Die eingerichtete Telegram-Verbindung bleibt erhalten.
12
11
 
13
- [Exaktes npm-Paket herunterladen](https://registry.npmjs.org/blun-king-cli/-/blun-king-cli-9.1.645.tgz).
12
+ [Genau dieses Paket herunterladen](https://registry.npmjs.org/blun-king-cli/-/blun-king-cli-9.1.646.tgz).
14
13
 
15
- ## Bilddateien lesen
14
+ ## Eingaben während laufender Arbeit
16
15
 
17
- ReadMediaFile ist auch für ein Hauptmodell ohne native Bildfunktion verfügbar, wenn ein separater Bildleser eingerichtet ist. Das Werkzeug gehört zu den direkt angebotenen Grundwerkzeugen. Die vorhandene Werkzeugfreigabe gilt weiterhin.
16
+ Bereits erlaubte Telegram-Nachrichten und normale Konsoleneingaben nutzen denselben Zustellweg in die laufende Gesprächsrunde. Auch Strg+S nutzt diesen Weg. Ein im Vordergrund laufender Unteragent kann die Kontrolle an den Hauptagenten abgeben, ohne beendet zu werden.
18
17
 
19
- Dateiprüfung, Größenlimit und die Parameter `region` und `full_resolution` bleiben erhalten. Bei einem Textmodell geht das gelesene Bild oder der gewählte Ausschnitt an den eingerichteten Bildleser. Das Hauptmodell erhält dessen Beschreibung als ausdrücklich nicht vertrauenswürdige Beobachtung. Eine zusätzliche Verkleinerung durch den Bildleser wird angegeben. Ein Modell mit nativer Bildfunktion nutzt beim Lesen einer Datei den bisherigen Modellpfad.
18
+ Ein abgewiesener Erstversuch blockiert weitere Versuche nicht mehr bis zum Ende der Gesprächsrunde. Unklare Zustellversuche werden mit ihrer bestehenden Anfragekennung und ihrem bestehenden Inhalt abgeglichen. Der Nachrichteneingang wird erst bestätigt, wenn ein Beleg die Übernahme in den Modellkontext nachweist.
20
19
 
21
- Verbrauch des Bildlesers wird erfasst, sofern er Verbrauchsdaten liefert. Ein Fehler des Bildlesers erscheint als Fehler; er wird nicht als erfolgreiche Bildanalyse ausgegeben. Video wird nur angeboten, wenn das Hauptmodell Videoeingaben unterstützt.
20
+ Wenn Eingaben aus verschiedenen Chats oder der Konsole in einer Gesprächsrunde zusammenkommen, wird die automatische Weiterleitung von Text und Medien für diese Runde abgeschaltet. Telegram-Antworten müssen das ausdrückliche Antwortwerkzeug und die ursprüngliche Chat-ID nutzen.
22
21
 
23
- ## Datenfluss und offene Arbeiten
22
+ ## Daten und Berechtigungen
24
23
 
25
- Diese Reparatur erweitert den vorhandenen Bildlesepfad auf ReadMediaFile. Die gewählten Bilddaten werden an den bereits eingerichteten Bildleser gesendet. Beim verwalteten Mediendienst verwendet dieser dessen Upload- und Bildanalyse-Endpunkte. Es wird kein neuer Empfänger eingerichtet.
24
+ Zugriffs- und Erwähnungsregeln, ein ausdrücklicher Stopp, Berechtigungsabfragen, Slash-Befehle und die Behandlung interaktiver Shells bleiben wirksam. Es wird kein neuer externer Empfänger eingerichtet. Die Regeln für Antwortempfänger werden in den vorhandenen lokalen Sitzungsmetadaten gespeichert.
26
25
 
27
- Die automatische Verarbeitung eingehender Nachrichtenbilder verwendet weiterhin den vorhandenen Bildleser. Die direkte Dateifunktion wird mit dieser Version ergänzt. Der vollständige scrollbare Verlauf nach einer Fortsetzung und die sofortige Telegram-Übergabe während laufender Arbeit bleiben eigene offene Arbeiten.
26
+ Das lokale Journal für Zielantworten nutzt jetzt Format 3. Ältere Versionen verweigern die automatische Zustellung dieser Einträge, damit deren Regeln für Antwortempfänger nicht übergangen werden.
28
27
 
29
- Frühere Änderungen und den Versionsnachweis enthält [CHANGELOG.md](CHANGELOG.md).
28
+ ## Grenzen
29
+
30
+ Eine Übernahme innerhalb von 60 Sekunden ist im laufenden Betrieb noch nicht nachgewiesen. Verdichtung, fehlende Verbindungen und vorhandene Zustellsperren können die Übernahme verzögern. Der vollständig scrollbare Originalverlauf bleibt eine eigene offene Aufgabe. Die Reparatur von ReadMediaFile aus 9.1.645 ist enthalten.
@@ -0,0 +1,30 @@
1
+ # blun-king-cli 9.1.646
2
+
3
+ ## Installieren und fortsetzen
4
+
5
+ ```powershell
6
+ npm install -g blun-king-cli@9.1.646
7
+ king -c
8
+ ```
9
+
10
+ Starte die Konsole nach der Installation selbst neu, damit sie die neue Version lädt. Die eingerichtete Telegram-Verbindung bleibt erhalten.
11
+
12
+ [Genau dieses Paket herunterladen](https://registry.npmjs.org/blun-king-cli/-/blun-king-cli-9.1.646.tgz).
13
+
14
+ ## Eingaben während laufender Arbeit
15
+
16
+ Bereits erlaubte Telegram-Nachrichten und normale Konsoleneingaben nutzen denselben Zustellweg in die laufende Gesprächsrunde. Auch Strg+S nutzt diesen Weg. Ein im Vordergrund laufender Unteragent kann die Kontrolle an den Hauptagenten abgeben, ohne beendet zu werden.
17
+
18
+ Ein abgewiesener Erstversuch blockiert weitere Versuche nicht mehr bis zum Ende der Gesprächsrunde. Unklare Zustellversuche werden mit ihrer bestehenden Anfragekennung und ihrem bestehenden Inhalt abgeglichen. Der Nachrichteneingang wird erst bestätigt, wenn ein Beleg die Übernahme in den Modellkontext nachweist.
19
+
20
+ Wenn Eingaben aus verschiedenen Chats oder der Konsole in einer Gesprächsrunde zusammenkommen, wird die automatische Weiterleitung von Text und Medien für diese Runde abgeschaltet. Telegram-Antworten müssen das ausdrückliche Antwortwerkzeug und die ursprüngliche Chat-ID nutzen.
21
+
22
+ ## Daten und Berechtigungen
23
+
24
+ Zugriffs- und Erwähnungsregeln, ein ausdrücklicher Stopp, Berechtigungsabfragen, Slash-Befehle und die Behandlung interaktiver Shells bleiben wirksam. Es wird kein neuer externer Empfänger eingerichtet. Die Regeln für Antwortempfänger werden in den vorhandenen lokalen Sitzungsmetadaten gespeichert.
25
+
26
+ Das lokale Journal für Zielantworten nutzt jetzt Format 3. Ältere Versionen verweigern die automatische Zustellung dieser Einträge, damit deren Regeln für Antwortempfänger nicht übergangen werden.
27
+
28
+ ## Grenzen
29
+
30
+ Eine Übernahme innerhalb von 60 Sekunden ist im laufenden Betrieb noch nicht nachgewiesen. Verdichtung, fehlende Verbindungen und vorhandene Zustellsperren können die Übernahme verzögern. Der vollständig scrollbare Originalverlauf bleibt eine eigene offene Aufgabe. Die Reparatur von ReadMediaFile aus 9.1.645 ist enthalten.
package/blun.mjs CHANGED
@@ -531387,8 +531387,25 @@ pumpDelivery() {
531387
531387
  };
531388
531388
  }));
531389
531389
  var REMOTE_COMMANDS, REMOTE_COMMAND_LIST;
531390
+ function activeInputRoutingHint(input) {
531391
+ const text = 'Multiple input sources share this turn. Reply to each Telegram message using ' +
531392
+ 'the explicit Telegram reply tool and the chat_id in that message. Keep each reply in its ' +
531393
+ 'original chat. Console input does not require a Telegram reply unless requested.';
531394
+ return typeof input === 'string' ? `${text}\n\n${input}` : [{ type: 'text', text }, ...input];
531395
+ }
531396
+ function activeInputReceiptSender(session, canSubmit) {
531397
+ return {
531398
+ getPromptAdmissionScope: session.getPromptAdmissionScope?.bind(session),
531399
+ getSteerAdmissionReceipt: session.getSteerAdmissionReceipt?.bind(session),
531400
+ steerActiveWithReceipt: typeof session.steerActiveWithReceipt !== 'function' ? undefined : (...args) => {
531401
+ if (!canSubmit()) throw new Error('PROMPT_ADMISSION_CLOSED');
531402
+ return session.steerActiveWithReceipt(...args);
531403
+ },
531404
+ };
531405
+ }
531390
531406
  var init_active_input_delivery = __esmMin((() => {
531391
531407
  ActiveInputDelivery = class {
531408
+ retryTimer;
531392
531409
  host;
531393
531410
  attempts = /* @__PURE__ */ new Map();
531394
531411
  pumping = false;
@@ -531400,12 +531417,20 @@ var init_active_input_delivery = __esmMin((() => {
531400
531417
  has(item) {
531401
531418
  return item !== void 0 && this.attempts.has(item);
531402
531419
  }
531420
+ deferRetry() {
531421
+ if (this.ended) { this.host.retry(); return; }
531422
+ clearTimeout(this.retryTimer);
531423
+ this.retryTimer = setTimeout(() => { this.retryTimer = void 0; this.host.retry(); }, 1000);
531424
+ this.retryTimer.unref?.();
531425
+ }
531403
531426
  endTurn() {
531427
+ clearTimeout(this.retryTimer);
531404
531428
  this.ended = true;
531405
531429
  for (const [item, attempt] of this.attempts) if (attempt.terminal) this.attempts.delete(item);
531406
531430
  this.host.retry();
531407
531431
  }
531408
531432
  cancel() {
531433
+ clearTimeout(this.retryTimer);
531409
531434
  for (const attempt of this.attempts.values()) attempt.abort.abort();
531410
531435
  this.attempts.clear();
531411
531436
  }
@@ -531444,6 +531469,11 @@ var init_active_input_delivery = __esmMin((() => {
531444
531469
  }).then((disposition) => {
531445
531470
  if (attempt.abort.signal.aborted || this.attempts.get(item) !== attempt) return;
531446
531471
  attempt.terminal = true;
531472
+ if (disposition === "rejected" && !attempt.accepted) {
531473
+ this.attempts.delete(item);
531474
+ this.deferRetry();
531475
+ return;
531476
+ }
531447
531477
  if (disposition === "context") {
531448
531478
  this.attempts.delete(item);
531449
531479
  this.host.commit(item);
@@ -531453,7 +531483,13 @@ var init_active_input_delivery = __esmMin((() => {
531453
531483
  this.host.retry();
531454
531484
  }
531455
531485
  }).catch((error) => {
531456
- if (!attempt.abort.signal.aborted) this.host.error(error);
531486
+ if (!attempt.abort.signal.aborted) {
531487
+ if (this.attempts.get(item) === attempt) {
531488
+ this.attempts.delete(item);
531489
+ this.deferRetry();
531490
+ }
531491
+ this.host.error(error);
531492
+ }
531457
531493
  }).finally(admitted);
531458
531494
  await acceptance;
531459
531495
  if (attempt.abort.signal.aborted || !attempt.accepted) return;
@@ -531618,6 +531654,7 @@ function messageText(value) {
531618
531654
  return value.filter((part) => object(part) && part["type"] === "text" && typeof part["text"] === "string").map((part) => part.text).join("");
531619
531655
  }
531620
531656
  function decodeReply(value, sessionId) {
531657
+ if (value?.autoReplySuppressed !== void 0 && typeof value.autoReplySuppressed !== "boolean") throw new TypeError("Invalid Goal routing policy");
531621
531658
  if (!object(value) || value["sessionId"] !== sessionId || typeof value["goalId"] !== "string" || !value["goalId"] || typeof value["chatId"] !== "string" || !/^-?[1-9]\d*$/.test(value["chatId"]) || typeof value["status"] !== "string" || ![
531622
531659
  "active",
531623
531660
  "paused",
@@ -531640,6 +531677,7 @@ function decodeReply(value, sessionId) {
531640
531677
  "blocked"
531641
531678
  ].includes(pending["status"]) || !Number.isInteger(pending["attempts"]) || Number(pending["attempts"]) < 0 || Number(pending["attempts"]) > 3 || pending["acceptedChunks"] !== void 0 && (!Array.isArray(pending["acceptedChunks"]) || !pending["acceptedChunks"].every((chunk) => object(chunk) && typeof chunk["text"] === "string" && messageId(chunk["messageId"]))))) throw new TypeError("Invalid pending Goal delivery");
531642
531679
  return {
531680
+ autoReplySuppressed: value["autoReplySuppressed"] === true,
531643
531681
  goalId: value["goalId"],
531644
531682
  sessionId,
531645
531683
  chatId: value["chatId"],
@@ -531654,6 +531692,7 @@ function decodeReply(value, sessionId) {
531654
531692
  };
531655
531693
  }
531656
531694
  function recoverReply(record, replay) {
531695
+ if (record.autoReplySuppressed) return void 0;
531657
531696
  if (!Array.isArray(replay)) return void 0;
531658
531697
  const index = replay.findLastIndex((entry) => object(entry) && entry["type"] === "goal_updated" && object(entry["snapshot"]) && entry["snapshot"]["goalId"] === record.goalId && entry["snapshot"]["status"] === "complete" && object(entry["change"]) && entry["change"]["kind"] === "completion");
531659
531698
  if (index < 0) return void 0;
@@ -531734,7 +531773,9 @@ var init_goal_channel_replies = __esmMin((() => {
531734
531773
  const value = metadata.custom?.["telegramGoalReplies"];
531735
531774
  if (value !== void 0 && (!object(value) || typeof value["sessionId"] !== "string")) throw new TypeError("Invalid Goal metadata");
531736
531775
  if (!object(value) || value["sessionId"] !== session.id) return;
531737
- if (typeof value["version"] !== "number" || ![1, 2].includes(value["version"]) || !Array.isArray(value["records"])) throw new TypeError("Unsupported Goal metadata");
531776
+ if (typeof value["version"] !== "number" || ![1, 2, 3].includes(value["version"]) || !Array.isArray(value["records"])) throw new TypeError("Unsupported Goal metadata");
531777
+ if (value["version"] === 3 && (value["mixedTurnId"] !== void 0 && typeof value["mixedTurnId"] !== "string" || value["records"].some(record => !object(record) || typeof record.autoReplySuppressed !== "boolean"))) throw new TypeError("Invalid Goal routing metadata");
531778
+ scope.mixedTurnId = value["mixedTurnId"];
531738
531779
  const records = value["records"].map((record) => decodeReply(record, session.id));
531739
531780
  if (new Set(records.map((record) => record.goalId)).size !== records.length) throw new TypeError("Duplicate Goal route");
531740
531781
  for (const record of records) scope.records.set(record.goalId, record);
@@ -531745,6 +531786,7 @@ var init_goal_channel_replies = __esmMin((() => {
531745
531786
  record.turnEnded = false;
531746
531787
  continue;
531747
531788
  }
531789
+ if (record.autoReplySuppressed) continue;
531748
531790
  if (!record.pending && (record.turnEndReason === void 0 || record.turnEndReason === "completed")) {
531749
531791
  const outcome = recoverReply(record, session.getResumeState()?.agents?.["main"]?.replay);
531750
531792
  if (!outcome) continue;
@@ -531764,6 +531806,27 @@ var init_goal_channel_replies = __esmMin((() => {
531764
531806
  })();
531765
531807
  return scope.restoring;
531766
531808
  }
531809
+ needsExplicitRouting(turnId, incomingChat) {
531810
+ const scope = this.scope;
531811
+ if (!scope || !this.current(scope)) return false;
531812
+ if (scope.mixedTurnId === String(turnId)) return true;
531813
+ return [...scope.records.values()].some(record =>
531814
+ (record.status === 'active' || record.turnId === String(turnId)) && record.chatId !== incomingChat);
531815
+ }
531816
+ async suppressAutoReplies(session, turnId) {
531817
+ const scope = this.scope;
531818
+ if (!scope || scope.session !== session || !this.current(scope) || !scope.writable) return false;
531819
+ scope.mixedTurnId = String(turnId);
531820
+ for (const record of scope.records.values()) {
531821
+ if (record.turnId !== String(turnId) && record.status !== 'active') continue;
531822
+ record.autoReplySuppressed = true;
531823
+ clearTimeout(record.timer);
531824
+ record.timer = undefined;
531825
+ }
531826
+ // In-flight sends retain their confirmed chunk receipts. Their next chunk and
531827
+ // retries observe the flag; no pending receipt is discarded here.
531828
+ return await this.persist(scope) && this.current(scope);
531829
+ }
531767
531830
  async bind(session, goal, chatId) {
531768
531831
  await this.restore(session, goal);
531769
531832
  const scope = this.scope;
@@ -531771,6 +531834,7 @@ var init_goal_channel_replies = __esmMin((() => {
531771
531834
  const existing = scope.records.get(goal.goalId);
531772
531835
  if (existing && existing.chatId !== chatId) return false;
531773
531836
  if (!existing) scope.records.set(goal.goalId, {
531837
+ autoReplySuppressed: scope.mixedTurnId !== void 0 && (scope.activeTurnId === void 0 || scope.activeTurnId === scope.mixedTurnId),
531774
531838
  goalId: goal.goalId,
531775
531839
  sessionId: session.id,
531776
531840
  chatId,
@@ -531788,9 +531852,11 @@ var init_goal_channel_replies = __esmMin((() => {
531788
531852
  const scope = this.scope;
531789
531853
  if (!scope || scope.sessionId !== sessionId || !this.current(scope)) return;
531790
531854
  scope.activeTurnId = String(turnId);
531855
+ if (scope.mixedTurnId !== String(turnId)) scope.mixedTurnId = void 0;
531791
531856
  scope.hookEntries.clear();
531792
531857
  const record = scope.records.get(goalId ?? scope.activeGoalId ?? "");
531793
531858
  if (!record || record.status !== "active") return;
531859
+ record.autoReplySuppressed = scope.mixedTurnId === String(turnId);
531794
531860
  record.turnId = String(turnId);
531795
531861
  record.turnEnded = false;
531796
531862
  record.turnEndReason = void 0;
@@ -531817,6 +531883,7 @@ var init_goal_channel_replies = __esmMin((() => {
531817
531883
  }
531818
531884
  record.status = goal.status;
531819
531885
  if (resumed && scope.activeTurnId !== void 0) {
531886
+ record.autoReplySuppressed = scope.mixedTurnId === scope.activeTurnId;
531820
531887
  record.turnId = scope.activeTurnId;
531821
531888
  record.turnEnded = false;
531822
531889
  record.turnEndReason = void 0;
@@ -531902,9 +531969,11 @@ var init_goal_channel_replies = __esmMin((() => {
531902
531969
  persist(scope) {
531903
531970
  if (!scope.writable) return Promise.resolve(false);
531904
531971
  const value = structuredClone({
531905
- version: 2,
531972
+ version: 3,
531973
+ mixedTurnId: scope.mixedTurnId,
531906
531974
  sessionId: scope.sessionId,
531907
531975
  records: [...scope.records.values()].map((record) => ({
531976
+ autoReplySuppressed: record.autoReplySuppressed === true,
531908
531977
  goalId: record.goalId,
531909
531978
  sessionId: record.sessionId,
531910
531979
  chatId: record.chatId,
@@ -531935,7 +532004,7 @@ var init_goal_channel_replies = __esmMin((() => {
531935
532004
  return scope.persistence;
531936
532005
  }
531937
532006
  prepareReply(scope, record) {
531938
- if (!record.turnEnded || record.status !== "complete" || record.turnEndReason !== "completed" || !record.finalText) return;
532007
+ if (record.autoReplySuppressed || !record.turnEnded || record.status !== "complete" || record.turnEndReason !== "completed" || !record.finalText) return;
531939
532008
  if (record.replyReceipts.some((receipt) => receipt.text === record.finalText)) {
531940
532009
  this.remove(scope, record);
531941
532010
  return;
@@ -531955,7 +532024,7 @@ var init_goal_channel_replies = __esmMin((() => {
531955
532024
  }
531956
532025
  deliver(scope, record) {
531957
532026
  const pending = record.pending;
531958
- if (!pending || record.sending || !this.current(scope) || scope.suspended > 0 || record.status !== "complete" || record.turnEndReason !== void 0 && record.turnEndReason !== "completed") return;
532027
+ if (record.autoReplySuppressed || !pending || record.sending || !this.current(scope) || scope.suspended > 0 || record.status !== "complete" || record.turnEndReason !== void 0 && record.turnEndReason !== "completed") return;
531959
532028
  const receiptOnly = pending.attempts >= 3;
531960
532029
  if (!receiptOnly) pending.attempts += 1;
531961
532030
  const progress = {
@@ -531967,7 +532036,7 @@ var init_goal_channel_replies = __esmMin((() => {
531967
532036
  },
531968
532037
  receiptOnly,
531969
532038
  signal: scope.signal.signal,
531970
- isCurrent: () => this.current(scope) && scope.suspended === 0 && scope.records.get(record.goalId) === record && record.pending === pending,
532039
+ isCurrent: () => !record.autoReplySuppressed && this.current(scope) && scope.suspended === 0 && scope.records.get(record.goalId) === record && record.pending === pending,
531971
532040
  persistAccepted: () => this.persist(scope)
531972
532041
  };
531973
532042
  record.sending = (async () => {
@@ -531987,7 +532056,7 @@ var init_goal_channel_replies = __esmMin((() => {
531987
532056
  if (sent) {
531988
532057
  this.remove(scope, record);
531989
532058
  if (this.current(scope)) this.host.onDelivered();
531990
- } else if (this.current(scope) && scope.suspended === 0) if (pending.attempts < 3) {
532059
+ } else if (!record.autoReplySuppressed && this.current(scope) && scope.suspended === 0) if (pending.attempts < 3) {
531991
532060
  record.timer = setTimeout(() => {
531992
532061
  record.timer = void 0;
531993
532062
  this.deliver(scope, record);
@@ -546577,13 +546646,95 @@ channelOwnsStoppedInput(chatId) {
546577
546646
  activeInputRequests;
546578
546647
  activeInputDelivery;
546579
546648
  activeInputScope;
546649
+ canSubmitActiveInput(session, agentId) {
546650
+ return this.session === session && this.interactiveAgentId === agentId &&
546651
+ this.stoppedInputSession !== session && !this.isShuttingDown && !this.deferUserMessages &&
546652
+ !this.queueCommandRunning && !this.editorReplacementActive && this.localShellConsentRequest === undefined &&
546653
+ this.queueSteerInFlight === undefined && this.manualPromptInFlight === undefined &&
546654
+ this.state.appState.streamingPhase !== 'shell' && !this.hasPendingQueueCommandCancellation() &&
546655
+ !this.queuePolicyBlocksInput(session);
546656
+ }
546657
+ commitActiveQueuedInput(item, session, agentId, turn) {
546658
+ if (this.session !== session || this.interactiveAgentId !== agentId || !this.state.queuedMessages.includes(item)) return;
546659
+ this.activeInputRequests?.delete(item);
546660
+ this.state.queuedMessages = this.state.queuedMessages.filter(entry => entry !== item);
546661
+ if (!(item.transcriptRendered || item.channelTranscriptRendered)) this.appendTranscriptEntry({
546662
+ id: nextTranscriptId(), kind: 'user', turnId: String(turn), renderMode: 'plain',
546663
+ content: item.displayText ?? item.text.trim(), origin: item.origin, imageAttachmentIds: item.imageAttachmentIds,
546664
+ });
546665
+ item.channelAcknowledge?.();
546666
+ this.updateQueueDisplay();
546667
+ this.state.ui.requestRender();
546668
+ }
546669
+ reconcileActiveInputHead() {
546670
+ const item = this.state.queuedMessages[0];
546671
+ const request = item === undefined ? undefined : this.activeInputRequests?.get(item);
546672
+ if (request?.identity === undefined) return false;
546673
+ if (request.reconciling !== undefined) return true;
546674
+ if (this.activeInputDelivery?.has(item)) return false;
546675
+ const session = request.session;
546676
+ const agentId = request.agentId;
546677
+ if (session === undefined || !this.canSubmitActiveInput(session, agentId)) return true;
546678
+ clearTimeout(request.reconcileTimer);
546679
+ request.reconcileTimer = undefined;
546680
+ const controller = new AbortController();
546681
+ this.activeInputReconciliations ??= new Set();
546682
+ this.activeInputReconciliations.add(controller);
546683
+ const current = () => this.session === session && this.interactiveAgentId === agentId &&
546684
+ this.state.queuedMessages.includes(item) && this.activeInputRequests?.get(item) === request && !controller.signal.aborted;
546685
+ request.reconciling = Promise.resolve().then(async () => {
546686
+ try {
546687
+ const sender = activeInputReceiptSender(session, () => current() && this.canSubmitActiveInput(session, agentId));
546688
+ const result = await this.withInteractiveAgent(agentId, () => deliverQueueSteer(sender,
546689
+ request.input ?? request.payload, request.identity.expectedTurnId, controller.signal, undefined, request));
546690
+ if (!current()) return;
546691
+ if (result === 'context') this.commitActiveQueuedInput(item, session, agentId, request.identity.expectedTurnId);
546692
+ else if (result === 'discarded' || result === 'rejected') this.activeInputRequests.delete(item);
546693
+ } catch (error) {
546694
+ if (current()) this.showError(formatErrorMessage$2(error));
546695
+ } finally {
546696
+ request.reconciling = undefined;
546697
+ this.activeInputReconciliations.delete(controller);
546698
+ const owned = this.activeInputRequests?.get(item) === request;
546699
+ if (current() || !owned) {
546700
+ if (owned) {
546701
+ request.reconcileTimer = setTimeout(() => this.scheduleQueueDrain(), 1000);
546702
+ request.reconcileTimer.unref?.();
546703
+ } else this.scheduleQueueDrain();
546704
+ }
546705
+ }
546706
+ });
546707
+ return true;
546708
+ }
546580
546709
  activeInputChat;
546581
- admitActiveQueuedInputs() {
546710
+ async prepareActiveInputRouting(item, session, turn, signal) {
546711
+ signal.throwIfAborted();
546712
+ const guard = this.pendingChannelReplyGuard;
546713
+ const chat = item.mode === 'channel' ? item.channelChatId : undefined;
546714
+ // Disable the ephemeral fallback synchronously, before any asynchronous work.
546715
+ let mixed = guard !== undefined ? guard.chatId !== chat || guard.explicitReplyOnly === true : chat !== undefined;
546716
+ if (mixed && guard !== undefined) guard.explicitReplyOnly = true;
546717
+ await this.goalChannelReplies.restore(session, this.state.appState.goal ?? null);
546718
+ signal.throwIfAborted();
546719
+ mixed ||= this.goalChannelReplies.needsExplicitRouting(turn, chat);
546720
+ if (!mixed) return false;
546721
+ if (this.pendingChannelReplyGuard !== undefined) this.pendingChannelReplyGuard.explicitReplyOnly = true;
546722
+ if (!await this.goalChannelReplies.suppressAutoReplies(session, turn)) {
546723
+ throw Object.assign(new Error('Input is waiting for its reply-routing policy to be saved.'),
546724
+ { code: 'ACTIVE_INPUT_ROUTING_NOT_SAVED' });
546725
+ }
546726
+ signal.throwIfAborted();
546727
+ return true;
546728
+ }
546729
+ admitActiveQueuedInputs() {
546730
+ if (this.reconcileActiveInputHead()) return true;
546582
546731
  const session = this.session;
546583
546732
  if (!isExperimentalFlagEnabled("queue_policies") || session === void 0 || this.stoppedInputSession === session || this.isShuttingDown || this.state.appState.streamingPhase === "idle" || this.state.appState.streamingPhase === "shell" || this.queueSteerInFlight !== void 0 || this.manualPromptInFlight !== void 0 || this.deferUserMessages || this.queueCommandRunning || this.editorReplacementActive || this.localShellConsentRequest !== void 0 || this.hasPendingQueueCommandCancellation() || this.queuePolicyBlocksInput(session)) return false;
546584
546733
  const turn = this.streamingUI.getTurnContext().turnId;
546585
546734
  if (turn === void 0 || !/^\d+$/.test(turn) || !Number.isSafeInteger(Number(turn))) return false;
546586
546735
  const agentId = this.interactiveAgentId;
546736
+ const head = this.state.queuedMessages[0];
546737
+ if (head === void 0 || (head.agentId ?? "main") !== agentId || (head.mode === "channel" ? head.channelContextOnly === true : head.mode !== void 0 && head.mode !== "prompt")) return false;
546587
546738
  const scope = JSON.stringify([
546588
546739
  session.id,
546589
546740
  agentId,
@@ -546591,6 +546742,8 @@ admitActiveQueuedInputs() {
546591
546742
  ]);
546592
546743
  if (this.activeInputScope !== scope) {
546593
546744
  this.activeInputDelivery?.cancel();
546745
+ for (const controller of this.activeInputReconciliations ?? []) controller.abort();
546746
+ this.activeInputReconciliations?.clear();
546594
546747
  this.activeInputScope = scope;
546595
546748
  this.activeInputChat = this.pendingChannelReplyGuard?.chatId;
546596
546749
  const current = () => this.session === session && this.activeInputScope === scope && this.interactiveAgentId === agentId;
@@ -546606,51 +546759,42 @@ admitActiveQueuedInputs() {
546606
546759
  }
546607
546760
  if (item.mode === "channel") {
546608
546761
  if (this.activeInputChat === void 0) this.activeInputChat = item.channelChatId;
546609
- if (item.channelContextOnly === true || this.activeInputChat !== void 0 && this.activeInputChat !== item.channelChatId || this.pendingChannelReplyGuard !== void 0 && this.pendingChannelReplyGuard.chatId !== item.channelChatId) break;
546762
+ if (item.channelContextOnly === true) break;
546610
546763
  } else if (item.mode !== void 0 && item.mode !== "prompt") break;
546611
546764
  result.push(item);
546612
546765
  }
546613
546766
  return result;
546614
546767
  },
546615
- send: (item, signal, accepted) => {
546768
+ send: async (item, signal, accepted) => {
546616
546769
  this.activeInputRequests ??= /* @__PURE__ */ new WeakMap();
546617
- let request = this.activeInputRequests.get(item) ?? {};
546770
+ let request = this.activeInputRequests.get(item) ?? { session, agentId };
546618
546771
  this.activeInputRequests.set(item, request);
546772
+ const explicit = await this.prepareActiveInputRouting(item, session, turn, signal);
546773
+ if (!current() || this.streamingUI.getTurnContext().turnId !== turn || this.stoppedInputSession === session || this.isShuttingDown || this.deferUserMessages || this.queueCommandRunning || this.editorReplacementActive || this.localShellConsentRequest !== void 0 || this.hasPendingQueueCommandCancellation() || this.queuePolicyBlocksInput(session)) {
546774
+ throw Object.assign(new Error("Active input scope changed before submission."), { code: "ACTIVE_INPUT_ROUTING_NOT_SAVED" });
546775
+ }
546619
546776
  const image = item.channelImagePath === void 0 ? void 0 : buildChannelImagePart(item.channelImagePath);
546620
546777
  const input = item.parts !== void 0 ? [...item.parts] : image !== void 0 && this.canReadImages() ? [{
546621
546778
  type: "text",
546622
546779
  text: item.text.trim()
546623
546780
  }, image] : item.text.trim();
546781
+ request.input ??= explicit ? activeInputRoutingHint(input) : input;
546624
546782
  return this.withInteractiveAgent(agentId, async () => {
546625
546783
  const originalTurn = request.identity?.expectedTurnId;
546626
- let disposition = await deliverQueueSteer(session, input, Number(turn), signal, () => {
546784
+ let disposition = await deliverQueueSteer(activeInputReceiptSender(session, () => current() && this.state.queuedMessages.includes(item) && this.streamingUI.getTurnContext().turnId === turn && this.canSubmitActiveInput(session, agentId)), request.input, Number(turn), signal, () => {
546627
546785
  if (request.identity?.expectedTurnId === Number(turn)) accepted();
546628
546786
  }, request);
546629
546787
  if (originalTurn !== void 0 && originalTurn !== Number(turn) && disposition !== "context") {
546630
- request = {};
546788
+ request = { session, agentId, input: explicit ? activeInputRoutingHint(input) : input };
546631
546789
  this.activeInputRequests.set(item, request);
546632
- disposition = await deliverQueueSteer(session, input, Number(turn), signal, accepted, request);
546790
+ disposition = await deliverQueueSteer(activeInputReceiptSender(session, () => current() && this.state.queuedMessages.includes(item) && this.streamingUI.getTurnContext().turnId === turn && this.canSubmitActiveInput(session, agentId)), request.input, Number(turn), signal, accepted, request);
546633
546791
  }
546634
546792
  if (disposition !== "context") this.activeInputRequests?.delete(item);
546635
546793
  return disposition;
546636
546794
  });
546637
546795
  },
546638
546796
  commit: (item) => {
546639
- if (!current() || !this.state.queuedMessages.includes(item)) return;
546640
- this.activeInputRequests?.delete(item);
546641
- this.state.queuedMessages = this.state.queuedMessages.filter((entry) => entry !== item);
546642
- if (!(item.transcriptRendered || item.channelTranscriptRendered)) this.appendTranscriptEntry({
546643
- id: nextTranscriptId(),
546644
- kind: "user",
546645
- turnId: turn,
546646
- renderMode: "plain",
546647
- content: item.displayText ?? item.text.trim(),
546648
- origin: item.origin,
546649
- imageAttachmentIds: item.imageAttachmentIds
546650
- });
546651
- item.channelAcknowledge?.();
546652
- this.updateQueueDisplay();
546653
- this.state.ui.requestRender();
546797
+ if (current()) this.commitActiveQueuedInput(item, session, agentId, this.activeInputRequests?.get(item)?.identity?.expectedTurnId ?? turn);
546654
546798
  },
546655
546799
  error: (error) => {
546656
546800
  if (current()) this.showError(formatErrorMessage$2(error));
@@ -546682,6 +546826,7 @@ releaseChannelQueueAtSafePoint() {
546682
546826
  this.steerQueueFlushPrefix();
546683
546827
  }
546684
546828
  canDrainQueue() {
546829
+ if (this.activeInputRequests?.get(this.state.queuedMessages[0])?.identity !== void 0) return false;
546685
546830
  if (this.gatewayStartup && !this.gatewayViewReady) return false;
546686
546831
  if (this.session !== void 0 && this.stoppedInputSession === this.session) return false;
546687
546832
  if (this.queueInterruptCancellations.size > 0) return false;
@@ -546697,6 +546842,7 @@ releaseChannelQueueAtSafePoint() {
546697
546842
  return !this.isShuttingDown && !this.queueCommandRunning && this.queueSteerInFlight === void 0 && this.manualPromptInFlight === void 0 && !this.editorReplacementActive && !this.deferUserMessages && (remoteControl || this.state.appState.streamingPhase === "idle" && !this.state.appState.isCompacting);
546698
546843
  }
546699
546844
  scheduleQueueDrain(minimumDelay = 0) {
546845
+ if (this.reconcileActiveInputHead()) return;
546700
546846
  if (this.admitActiveQueuedInputs()) return;
546701
546847
  if (!this.canDrainQueue()) return;
546702
546848
  if (this.queueDrainTimer !== void 0) {
@@ -546801,6 +546947,10 @@ releaseChannelQueueAtSafePoint() {
546801
546947
  if (this.manualPromptInFlight !== void 0) this.manualPromptInFlight.flushRequested = this.queueFlushBatchRemaining > 0;
546802
546948
  if (this.queueFlushBatchRemaining > 0 && this.state.appState.streamingPhase === "shell")
546803
546949
  toolLiveness642.yieldLocalShellsForInput(this, true);
546950
+ if (isExperimentalFlagEnabled("queue_policies") && this.state.appState.streamingPhase !== "shell") {
546951
+ this.scheduleQueueDrain();
546952
+ return;
546953
+ }
546804
546954
  this.steerQueueFlushPrefix();
546805
546955
  this.scheduleQueueDrain();
546806
546956
  }
@@ -547202,7 +547352,7 @@ releaseChannelQueueAtSafePoint() {
547202
547352
  runChannelMediaFallback(output) {
547203
547353
  const guard = this.pendingChannelReplyGuard;
547204
547354
  const filePath = completedMediaLocalPath(output);
547205
- if (guard === void 0 || filePath === void 0) return;
547355
+ if (guard === void 0 || guard.explicitReplyOnly === true || filePath === void 0) return;
547206
547356
  const deliveryKey = `${guard.chatId}\0${filePath}`;
547207
547357
  if (this.channelMediaDeliveries.has(deliveryKey)) return;
547208
547358
  this.channelMediaDeliveries.add(deliveryKey);
@@ -547216,7 +547366,7 @@ releaseChannelQueueAtSafePoint() {
547216
547366
  const guard = this.pendingChannelReplyGuard;
547217
547367
  if (guard === void 0) return;
547218
547368
  this.pendingChannelReplyGuard = void 0;
547219
- if (guard.goalId !== void 0 || this.goalChannelReplies.handledChat(guard.chatId)) return;
547369
+ if (guard.explicitReplyOnly === true || guard.goalId !== void 0 || this.goalChannelReplies.handledChat(guard.chatId)) return;
547220
547370
  if (reason !== "completed") return;
547221
547371
  if (this.state.transcriptEntries.slice(guard.transcriptStart).some((entry) => entry.kind === "tool_call" && /reply|edit_message/i.test(entry.toolCallData?.name ?? ""))) return;
547222
547372
  if (outboxGrewForChat(guard.outboxMarker, guard.chatId)) return;
@@ -547800,6 +547950,8 @@ releaseChannelQueueAtSafePoint() {
547800
547950
  } : void 0;
547801
547951
  } else this.stoppedQueueBoundary = this.telegramChannel === void 0 ? void 0 : this.captureTelegramQueueBoundary();
547802
547952
  this.activeInputDelivery?.cancel();
547953
+ for (const controller of this.activeInputReconciliations ?? []) controller.abort();
547954
+ this.activeInputReconciliations?.clear();
547803
547955
  const turn = this.streamingUI.getTurnContext().turnId;
547804
547956
  if (turn === void 0 || !/^\d+$/.test(turn)) return;
547805
547957
  const turnId = Number(turn);
@@ -548066,6 +548218,8 @@ releaseChannelQueueAtSafePoint() {
548066
548218
  clearQueuedMessages(preserveCancellations = false) {
548067
548219
  if (!preserveCancellations) this.queueInterruptCancellations.clear();
548068
548220
  this.activeInputDelivery?.cancel();
548221
+ for (const controller of this.activeInputReconciliations ?? []) controller.abort();
548222
+ this.activeInputReconciliations?.clear();
548069
548223
  this.activeInputScope = void 0;
548070
548224
  this.queueSteerInFlight?.receiptAbort?.abort();
548071
548225
  if (this.manualPromptInFlight?.promptAbort !== void 0 && !this.manualPromptInFlight.promptSubmitted && this.state.appState.streamingPhase === "waiting" && !this.streamingUI.hasActiveTurn()) {
@@ -548449,6 +548603,8 @@ releaseChannelQueueAtSafePoint() {
548449
548603
  const previous = this.session;
548450
548604
  this.queueInterruptCancellations.clear();
548451
548605
  this.activeInputDelivery?.cancel();
548606
+ for (const controller of this.activeInputReconciliations ?? []) controller.abort();
548607
+ this.activeInputReconciliations?.clear();
548452
548608
  this.activeInputScope = void 0;
548453
548609
  this.queueSteerInFlight?.receiptAbort?.abort();
548454
548610
  this.manualPromptInFlight?.promptAbort?.abort();
@@ -548538,6 +548694,8 @@ releaseChannelQueueAtSafePoint() {
548538
548694
  if (!this.preserveQueueAcrossSessionReset) this.queueInterruptCancellations.clear();
548539
548695
  if (!this.preserveQueueAcrossSessionReset) {
548540
548696
  this.activeInputDelivery?.cancel();
548697
+ for (const controller of this.activeInputReconciliations ?? []) controller.abort();
548698
+ this.activeInputReconciliations?.clear();
548541
548699
  this.activeInputScope = void 0;
548542
548700
  this.queueSteerInFlight?.receiptAbort?.abort();
548543
548701
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.645",
3
+ "version": "9.1.646",
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": {
@@ -47,7 +47,8 @@
47
47
  "LIESMICH.txt",
48
48
  "tool-liveness642/",
49
49
  "versionierung/",
50
- "RELEASE-9.1.645.md"
50
+ "RELEASE-9.1.645.md",
51
+ "RELEASE-9.1.646.md"
51
52
  ],
52
53
  "keywords": [
53
54
  "blun",