blun-king-cli 5.3.6 → 5.4.0

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.
@@ -13,6 +13,10 @@ function normalizeUrl(input) {
13
13
  .replace(/^[<\s"'`]+/, "")
14
14
  .replace(/[>\s"'`]+$/, "");
15
15
 
16
+ if (/^about:blank$/i.test(cleaned)) {
17
+ return "about:blank";
18
+ }
19
+
16
20
  if (/^www\./i.test(cleaned)) {
17
21
  cleaned = `https://${cleaned}`;
18
22
  }
@@ -30,7 +34,7 @@ function normalizeUrl(input) {
30
34
 
31
35
  async function ensurePage() {
32
36
  if (!browserInstance) {
33
- browserInstance = await chromium.launch({ headless: true });
37
+ browserInstance = await chromium.launch({ headless: false });
34
38
  }
35
39
  if (!pageInstance) {
36
40
  pageInstance = await browserInstance.newPage({ viewport: { width: 1440, height: 960 } });
@@ -44,6 +48,14 @@ async function open(url) {
44
48
  return snapshot();
45
49
  }
46
50
 
51
+ async function search(query) {
52
+ const q = String(query || "").trim();
53
+ if (!q) {
54
+ throw new Error("No search query provided.");
55
+ }
56
+ return open(`https://www.google.com/search?q=${encodeURIComponent(q)}`);
57
+ }
58
+
47
59
  async function click(selector) {
48
60
  const page = await ensurePage();
49
61
  await page.locator(String(selector)).first().click();
@@ -92,11 +104,13 @@ async function close() {
92
104
 
93
105
  module.exports = {
94
106
  normalizeUrl,
107
+ search,
95
108
  open,
96
109
  click,
97
110
  type,
98
111
  press,
99
112
  snapshot,
100
113
  screenshot,
101
- close
114
+ close,
115
+ isOpen: function() { return !!pageInstance; }
102
116
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "5.3.6",
3
+ "version": "5.4.0",
4
4
  "description": "BLUN King CLI — Your local AI assistant powered by Gemma4",
5
5
  "type": "commonjs",
6
6
  "bin": {
package/runtime.js CHANGED
@@ -56,8 +56,9 @@ function clampConfidence(score) {
56
56
  return Math.max(0, Math.min(1, score / 8));
57
57
  }
58
58
 
59
- function hasResolvableUrl(raw) {
60
- return /(https?:\/\/\S+)|(?:^|[\s<(])(?:www\.)?[a-z0-9.-]+\.[a-z]{2,}(?:\/[^\s)>"']*)?/i.test(String(raw || ""));
59
+ function hasResolvableUrl(text) {
60
+ return /https?:\/\/\S+/i.test(String(text || "")) ||
61
+ /\b(?:www\.)?[a-z0-9.-]+\.[a-z]{2,}(?:\/\S*)?\b/i.test(String(text || ""));
61
62
  }
62
63
 
63
64
  function detectIntent(raw, session) {
@@ -230,12 +231,12 @@ function detectIntent(raw, session) {
230
231
  const wantsDebug = hasAny(text, debugTerms);
231
232
  const wantsOperator = hasAny(text, operatorTerms);
232
233
  const wantsCoding = hasAny(text, codingTerms);
233
- const hasUrl = hasResolvableUrl(raw);
234
- const screenshotStorageComplaint =
234
+
235
+ const screenshotStorageFollowup =
235
236
  activeTask?.type === "browser_capture" &&
236
237
  wantsScreenshot &&
237
- !hasUrl &&
238
- /\b(ordner|datei|gespeichert|download|liegt|finde|fehlt|nicht im ordner|nicht da)\b/i.test(text);
238
+ !hasResolvableUrl(raw) &&
239
+ /(ordner|datei|file|gespeichert|download|liegt|finde|fehlt|nicht im ordner|nicht da|wo ist)/i.test(text);
239
240
 
240
241
  const scores = {
241
242
  installation:
@@ -243,7 +244,7 @@ function detectIntent(raw, session) {
243
244
  scoreApproxWords(text, ["installier", "installieren", "telegram", "telegramm", "plugin", "skill", "playwright"], 1.5) +
244
245
  scoreApproxPhrases(text, ["telegram bot", "playwright"], 2),
245
246
  browser_capture:
246
- ((wantsWebsite || hasUrl) ? 2 : scoreApproxWords(text, ["website", "webseite"], 1.5)) +
247
+ (wantsWebsite ? 2 : scoreApproxWords(text, ["website", "webseite"], 1.5)) +
247
248
  (wantsScreenshot ? 3 : scoreApproxWords(text, ["screenshot", "screen"], 1.5)),
248
249
  website_builder:
249
250
  (wantsWebsite ? 2 : scoreApproxWords(text, ["website", "webseite", "landingpage", "homepage"], 1.5)) +
@@ -266,7 +267,7 @@ function detectIntent(raw, session) {
266
267
  return { kind: "followup", activeTask, scores, confidence: 1 };
267
268
  }
268
269
 
269
- if (screenshotStorageComplaint) {
270
+ if (screenshotStorageFollowup) {
270
271
  return { kind: "followup", activeTask, scores, confidence: 1 };
271
272
  }
272
273