blun-king-cli 9.1.383 → 9.1.385

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.
@@ -63,6 +63,29 @@ function mediaGenerationToolNamesForText(value) {
63
63
  return selected;
64
64
  }
65
65
 
66
+ function mediaToolNamesForTurnText(value) {
67
+ const text = String(value || '');
68
+ const selected = new Set();
69
+ const channelBodies = [...text.matchAll(
70
+ /(?:^|\r?\n)<channel\b[^>]*>\r?\n([\s\S]*?)\r?\n<\/channel>(?=\r?\n|$)/giu,
71
+ )].map((match) => match[1]);
72
+ const intentTexts = channelBodies.length > 0 ? channelBodies : [text];
73
+
74
+ for (const intentText of intentTexts) {
75
+ for (const name of mediaGenerationToolNamesForText(intentText)) selected.add(name);
76
+ }
77
+
78
+ if (/\bimage_path\s*=\s*["'][^"']+["']/iu.test(text)) {
79
+ selected.add('ReadMediaFile');
80
+ selected.add('UnderstandImage');
81
+ }
82
+ if (/\battachment_file_id\s*=\s*["'][^"']+["']/iu.test(text)) {
83
+ selected.add('mcp__plugin-telegram_telegram__download_attachment');
84
+ selected.add('UnderstandImage');
85
+ }
86
+ return selected;
87
+ }
88
+
66
89
  function toolSchemaBudgetTokens(maxContextTokens) {
67
90
  const context = Number(maxContextTokens);
68
91
  if (!Number.isFinite(context) || context <= 0) return TOOL_SCHEMA_MAX_TOKENS;
@@ -326,6 +349,7 @@ module.exports = {
326
349
  deferredToolCatalog,
327
350
  deferredToolNames,
328
351
  mediaGenerationToolNamesForText,
352
+ mediaToolNamesForTurnText,
329
353
  normalizeDeferredToolQuery,
330
354
  rememberDeferredToolAfterNotFound,
331
355
  toolSchemaBudgetTokens,
package/blun.mjs CHANGED
@@ -261514,7 +261514,7 @@ function toolResultText(result) {
261514
261514
  function abandonedToolResultOutput(ended) {
261515
261515
  return `Tool call did not complete: ${ended.reason === "cancelled" ? "the turn was cancelled" : ended.reason === "failed" ? `the turn failed${ended.error !== void 0 ? ` (${ended.error.message})` : ""}` : "the turn ended"} before its result was recorded. Do not assume the tool completed successfully.`;
261516
261516
  }
261517
- var BLUN_CORE_TOOL_NAMES, BLUN_LEAN_TOOL_NAMES, BLUN_ATTACHMENT_MARKER_RE, BLUN_TELEGRAM_OUTBOUND_TOOL_RE, BLUN_TELEGRAM_CHANNEL_RE, BLUN_TOOL_BUDGET_RATIO, createDeferredToolLoader, mediaGenerationToolNamesForText, rememberDeferredToolAfterNotFound, toolSchemaBudgetTokens, projectRecurringCronHistory, TelegramDeliveryLedger, createRuntimeCognitiveTurnLifecycle, cognitiveFocusScopesForTurn, buildCognitiveWorkFocus, buildAttentionQueueItem, LLM_NOT_SET_MESSAGE, GOAL_CONTINUATION_ORIGIN, GOAL_COMPLETION_REMINDER_NAME, GOAL_BLOCKED_REMINDER_NAME, GOAL_RATE_LIMIT_PAUSE_REASON, GOAL_PROVIDER_CONNECTION_PAUSE_PREFIX, GOAL_PROVIDER_AUTH_PAUSE_PREFIX, GOAL_PROVIDER_API_PAUSE_PREFIX, GOAL_MODEL_CONFIG_PAUSE_PREFIX, GOAL_RUNTIME_PAUSE_PREFIX, GOAL_PROVIDER_FILTERED_PAUSE_REASON, GOAL_CONTINUATION_PROMPT, TurnFlow;
261517
+ var BLUN_CORE_TOOL_NAMES, BLUN_LEAN_TOOL_NAMES, BLUN_ATTACHMENT_MARKER_RE, BLUN_TELEGRAM_OUTBOUND_TOOL_RE, BLUN_TELEGRAM_CHANNEL_RE, BLUN_TOOL_BUDGET_RATIO, createDeferredToolLoader, mediaToolNamesForTurnText, rememberDeferredToolAfterNotFound, toolSchemaBudgetTokens, projectRecurringCronHistory, TelegramDeliveryLedger, createRuntimeCognitiveTurnLifecycle, cognitiveFocusScopesForTurn, buildCognitiveWorkFocus, buildAttentionQueueItem, LLM_NOT_SET_MESSAGE, GOAL_CONTINUATION_ORIGIN, GOAL_COMPLETION_REMINDER_NAME, GOAL_BLOCKED_REMINDER_NAME, GOAL_RATE_LIMIT_PAUSE_REASON, GOAL_PROVIDER_CONNECTION_PAUSE_PREFIX, GOAL_PROVIDER_AUTH_PAUSE_PREFIX, GOAL_PROVIDER_API_PAUSE_PREFIX, GOAL_MODEL_CONFIG_PAUSE_PREFIX, GOAL_RUNTIME_PAUSE_PREFIX, GOAL_PROVIDER_FILTERED_PAUSE_REASON, GOAL_CONTINUATION_PROMPT, TurnFlow;
261518
261518
  var init_turn = __esmMin((() => {
261519
261519
  init_dist$4();
261520
261520
  init_src$4();
@@ -261531,7 +261531,7 @@ var init_turn = __esmMin((() => {
261531
261531
  init_tool_result_budget();
261532
261532
  init_user_message_offload();
261533
261533
  init_assistant_message_offload();
261534
- ({ CORE_TOOL_NAMES: BLUN_CORE_TOOL_NAMES, createDeferredToolLoader, mediaGenerationToolNamesForText, rememberDeferredToolAfterNotFound, toolSchemaBudgetTokens } = createRequire(import.meta.url)("./bin/turn-tool-performance-policy.cjs"));
261534
+ ({ CORE_TOOL_NAMES: BLUN_CORE_TOOL_NAMES, createDeferredToolLoader, mediaToolNamesForTurnText, rememberDeferredToolAfterNotFound, toolSchemaBudgetTokens } = createRequire(import.meta.url)("./bin/turn-tool-performance-policy.cjs"));
261535
261535
  ({ projectRecurringCronHistory } = createRequire(import.meta.url)("./bin/recurring-cron-history-policy.cjs"));
261536
261536
  ({ TelegramDeliveryLedger } = createRequire(import.meta.url)("./bin/repeated-user-message-projection.cjs"));
261537
261537
  ({ createRuntimeCognitiveTurnLifecycle } = createRequire(import.meta.url)("./bin/cognitive-turn-lifecycle.cjs"));
@@ -261539,7 +261539,7 @@ var init_turn = __esmMin((() => {
261539
261539
  ({ buildCognitiveWorkFocus } = createRequire(import.meta.url)("./bin/cognitive-work-focus.cjs"));
261540
261540
  ({ buildAttentionQueueItem } = createRequire(import.meta.url)("./bin/cognitive-attention-delivery.cjs"));
261541
261541
  BLUN_LEAN_TOOL_NAMES = new Set(BLUN_CORE_TOOL_NAMES);
261542
- BLUN_ATTACHMENT_MARKER_RE = /\b(?:attachment_file_id|telegram-anhang|telegram attachment)\b/i;
261542
+ BLUN_ATTACHMENT_MARKER_RE = /\b(?:attachment_file_id|image_path|telegram-anhang|telegram attachment)\b/i;
261543
261543
  BLUN_TELEGRAM_OUTBOUND_TOOL_RE = /^mcp__[^\s]*telegram[^\s]*__(?:reply|react|edit_message)$/i;
261544
261544
  BLUN_TELEGRAM_CHANNEL_RE = /<channel\b[^>]*\bsource=["']telegram["'][^>]*>/i;
261545
261545
  BLUN_TOOL_BUDGET_RATIO = .25;
@@ -262270,8 +262270,7 @@ var init_turn = __esmMin((() => {
262270
262270
  const turnThinkingEffort = turnHasAttachment ? void 0 : selectThinkingEffortForTurn(blunExtractText(blunThinkingIntentInput(input)), origin.kind);
262271
262271
  const fastConversation = turnThinkingEffort === "off" || turnThinkingEffort === "low";
262272
262272
  const pendingMediaJobIds = this.agent.toolServices?.media?.pendingMediaJobIds?.() ?? [];
262273
- const requiredToolNames = mediaGenerationToolNamesForText(blunExtractText(blunThinkingIntentInput(input)));
262274
- if (turnHasAttachment) requiredToolNames.add("mcp__plugin-telegram_telegram__download_attachment");
262273
+ const requiredToolNames = mediaToolNamesForTurnText(blunExtractText(input));
262275
262274
  const turnSystemPrompt = pendingMediaJobIds.length > 0 ? blunPendingMediaSystemPrompt(fastConversation ? this.agent.fastConversationSystemPrompt : this.agent.effectiveSystemPrompt, pendingMediaJobIds) : fastConversation ? this.agent.fastConversationSystemPrompt : void 0;
262276
262275
  const turnLLM = this.agent.llmForTurn(turnThinkingEffort, turnSystemPrompt);
262277
262276
  let previousStepToolOutcome = "initial";
@@ -262357,7 +262356,7 @@ var init_turn = __esmMin((() => {
262357
262356
  const steerThinkingEffort = "low";
262358
262357
  const steerPendingMediaJobIds = this.agent.toolServices?.media?.pendingMediaJobIds?.() ?? [];
262359
262358
  const steerLLM = this.agent.llmForTurn(steerThinkingEffort, blunPendingMediaSystemPrompt(this.agent.fastConversationSystemPrompt, steerPendingMediaJobIds));
262360
- const steerRequiredToolNames = mediaGenerationToolNamesForText(blunExtractText(blunThinkingIntentInput(steerInput)));
262359
+ const steerRequiredToolNames = mediaToolNamesForTurnText(blunExtractText(steerInput));
262361
262360
  const steerTools = [...blunFastConversationTools(eligibleTools, steerInput, steerPendingMediaJobIds, steerRequiredToolNames)];
262362
262361
  const steerHistory = () => blunFastConversationHistory(this.agent.context.history);
262363
262362
  const buildSteerMessages = () => this.agent.context.project(steerHistory(), { dropOrphanResults: true });
@@ -518234,6 +518233,8 @@ var BlunTUI = class {
518234
518233
  }
518235
518234
  setStartupReady() {
518236
518235
  this.state.startupState = "ready";
518236
+ this.requestQueueDrain();
518237
+ this.channelQueueDeadline.requestDeliveryNow();
518237
518238
  }
518238
518239
  clearQueuedMessages() {
518239
518240
  this.state.queuedMessages = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.383",
3
+ "version": "9.1.385",
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": {