blun-king-cli 9.1.177 → 9.1.179

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,34 @@
1
+ 'use strict';
2
+
3
+ function textWidth(value) {
4
+ return [...String(value ?? '')].length;
5
+ }
6
+
7
+ function wrapMediaActivityChainItems(items, width, options = {}) {
8
+ const safeItems = Array.isArray(items) ? items : [];
9
+ const safeWidth = Math.max(1, Math.floor(Number(width) || 1));
10
+ const measure = typeof options.measure === 'function' ? options.measure : textWidth;
11
+ const firstPrefixWidth = Math.max(0, Number(options.firstPrefixWidth) || 0);
12
+ const continuationPrefixWidth = Math.max(0, Number(options.continuationPrefixWidth) || 0);
13
+ const separatorWidth = Math.max(0, Number(options.separatorWidth) || 0);
14
+ const rows = [];
15
+ let row = [];
16
+ let rowWidth = firstPrefixWidth;
17
+
18
+ for (const item of safeItems) {
19
+ const itemWidth = Math.max(0, measure(item));
20
+ const candidateWidth = rowWidth + (row.length > 0 ? separatorWidth : 0) + itemWidth;
21
+ if (row.length > 0 && candidateWidth > safeWidth) {
22
+ rows.push(row);
23
+ row = [];
24
+ rowWidth = continuationPrefixWidth;
25
+ }
26
+ row.push(item);
27
+ rowWidth += (row.length > 1 ? separatorWidth : 0) + itemWidth;
28
+ }
29
+
30
+ if (row.length > 0) rows.push(row);
31
+ return rows;
32
+ }
33
+
34
+ module.exports = { wrapMediaActivityChainItems };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ const LOW_INFORMATION_TURN_RE = /^(?:k|ok(?:ay)?|ja|jo|jep|yes|yep|passt|danke|dankeschön|thanks|super|perfekt|gut|alles klar|verstanden|notiert|erledigt)[.!?]*$/iu;
4
+
5
+ function isLowInformationPersonalMemoryQuery(value) {
6
+ if (typeof value !== 'string') return false;
7
+ const normalized = value.trim().replaceAll(/\s+/gu, ' ');
8
+ if (normalized.length === 0 || normalized.length > 32) return false;
9
+ return LOW_INFORMATION_TURN_RE.test(normalized);
10
+ }
11
+
12
+ module.exports = { isLowInformationPersonalMemoryQuery };
@@ -73,6 +73,20 @@ function searchDeferredTools(tools, query) {
73
73
  const tokens = normalized.split(/\s+/).filter(Boolean);
74
74
  const requiredNameTokens = tokens.filter((token) => token.startsWith('+')).map((token) => token.slice(1)).filter(Boolean);
75
75
  const searchTokens = tokens.filter((token) => !token.startsWith('+'));
76
+ const eligibleTools = tools.filter((tool) => {
77
+ const name = String(tool?.name || '').toLowerCase();
78
+ return requiredNameTokens.every((token) => name.includes(token));
79
+ });
80
+ const firstSelector = searchTokens[0];
81
+ if (firstSelector) {
82
+ const exactNameMatches = eligibleTools.filter((tool) => String(tool?.name || '').toLowerCase() === firstSelector);
83
+ if (exactNameMatches.length === 1) return exactNameMatches;
84
+ const exactLeafMatches = eligibleTools.filter((tool) => {
85
+ const name = String(tool?.name || '').toLowerCase();
86
+ return name.split(/__|:/).at(-1) === firstSelector;
87
+ });
88
+ if (exactLeafMatches.length === 1) return exactLeafMatches;
89
+ }
76
90
  return tools.map((tool) => {
77
91
  const name = String(tool?.name || '').toLowerCase();
78
92
  const description = String(tool?.description || '').toLowerCase();
package/blun.mjs CHANGED
@@ -231583,6 +231583,7 @@ var init_permission_mode = __esmMin((() => {
231583
231583
  }));
231584
231584
  //#endregion
231585
231585
  //#region ../../packages/agent-core/src/agent/injection/personal-memory-recall.ts
231586
+ var { isLowInformationPersonalMemoryQuery } = createRequire(import.meta.url)("./bin/personal-memory-performance-policy.cjs");
231586
231587
  /** Extracts only the current human message; transport metadata never reaches recall. */
231587
231588
  function personalMemoryRecallQuery(input) {
231588
231589
  const hasImagePart = input.some((part) => part.type === "image_url");
@@ -231614,6 +231615,7 @@ function personalMemoryRecallQuery(input) {
231614
231615
  }
231615
231616
  text = text.replace(TELEGRAM_ATTACHMENT_NOTICE_RE, "").trim();
231616
231617
  if (text.length === 0) return attachmentFallback ?? GENERIC_EMPTY_QUERY;
231618
+ if (attachmentFallback === void 0 && isLowInformationPersonalMemoryQuery(text)) return void 0;
231617
231619
  return text.slice(0, MAX_QUERY_CHARS).trim() || void 0;
231618
231620
  }
231619
231621
  function isTelegramGroupInput(input) {
@@ -500173,6 +500175,8 @@ registerUiCatalogFragment({
500173
500175
  "media.phase.analyzing": "Wird analysiert"
500174
500176
  }
500175
500177
  });
500178
+ var wrapMediaActivityChainItems;
500179
+ ({ wrapMediaActivityChainItems } = createRequire(import.meta.url)("./bin/media-activity-layout-policy.cjs"));
500176
500180
  function mediaActivityStatusKey(value) {
500177
500181
  return String(value ?? "processing").trim().toLowerCase().replaceAll(/[^a-z0-9]+/g, "-");
500178
500182
  }
@@ -500392,16 +500396,24 @@ var MediaActivityComponent = class {
500392
500396
  const line = `${currentTheme.boldFg("primary", "●")} ${currentTheme.boldFg("primary", kind)} · ${phase}${details.length === 0 ? "" : ` · ${details.join(" · ")}`}${progress}`;
500393
500397
  return truncateToWidth(line, Math.max(1, width), "…");
500394
500398
  }
500395
- chainLine(job, width) {
500399
+ chainLines(job, width) {
500400
+ const separator = currentTheme.fg("textDim", " · ");
500401
+ const prefix = ` ${currentTheme.fg("textDim", mediaUiText("media.activity.chain"))} · `;
500402
+ const continuationPrefix = " ";
500396
500403
  const chain = mediaActivityChainStates(job).map(({ phase, state }) => {
500397
500404
  const symbol = state === "done" ? "■" : state === "active" ? "▶" : "□";
500398
500405
  const label = mediaActivityLabel("media.phase", phase, phase);
500399
500406
  const text = `${symbol} ${label}`;
500400
- if (state === "done") return currentTheme.fg("success", text);
500401
- if (state === "active") return currentTheme.boldFg("primary", text);
500402
- return currentTheme.fg("textDim", text);
500407
+ if (state === "done") return { plain: text, styled: currentTheme.fg("success", text) };
500408
+ if (state === "active") return { plain: text, styled: currentTheme.boldFg("primary", text) };
500409
+ return { plain: text, styled: currentTheme.fg("textDim", text) };
500403
500410
  });
500404
- return truncateToWidth(` ${currentTheme.fg("textDim", mediaUiText("media.activity.chain"))} · ${chain.join(currentTheme.fg("textDim", " · "))}`, Math.max(1, width), "…");
500411
+ return wrapMediaActivityChainItems(chain, Math.max(1, width), {
500412
+ measure: (item) => visibleWidth(item.plain),
500413
+ firstPrefixWidth: visibleWidth(prefix),
500414
+ continuationPrefixWidth: visibleWidth(continuationPrefix),
500415
+ separatorWidth: visibleWidth(" · ")
500416
+ }).map((row, index) => truncateToWidth(`${index === 0 ? prefix : continuationPrefix}${row.map((item) => item.styled).join(separator)}`, Math.max(1, width), "…"));
500405
500417
  }
500406
500418
  previewImage(job) {
500407
500419
  let previewDataBase64 = typeof job.previewDataBase64 === "string" ? job.previewDataBase64 : "";
@@ -500434,7 +500446,7 @@ var MediaActivityComponent = class {
500434
500446
  return image;
500435
500447
  }
500436
500448
  extraLines(job, width) {
500437
- const lines = [this.chainLine(job, width)];
500449
+ const lines = [...this.chainLines(job, width)];
500438
500450
  if (Array.isArray(job.waveform) && job.waveform.length > 0) {
500439
500451
  const label = `${mediaUiText("media.detail.waveform")} · `;
500440
500452
  const waveform = renderMediaWaveform(job.waveform, Math.max(1, width - visibleWidth(label) - 2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.177",
3
+ "version": "9.1.179",
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": {